Posts

Showing posts from September, 2015

jQuery Ajax Render Fragments OR Whole Page -

i'm in throes of building application wraps mess of legacy code. page working on, need substitute fragment divs constructed on back-end -- or else need replace entire page altogether. idea there dynamically controlled flow needs satisfied before can forward legacy product. substituting fragments works fine, seen in below my_body_content swap. trouble comes when i'm trying render not fragment, whole page, in "body" swap. @ point page goes blank. i want similar errors returned server. want nice rest 404 error messages displayed on screen, legacy-product 404s show in legacy-product 404 page. yes, requirements project weird. that's not problem can fix. here's jquery invocation, names changed protect guilty: $.ajax({ url: "places/things", type: "post", data: json.stringify(somebadassobject), datatype: "text", accepts: "text/html", contenttype: "application/json; charset=

Eclipse RCP- org.eclipse.ui.plugin missing -

i've written eclipse rcp application runs fine in eclipse, however, packaging standalone application has been tricky. i've worked way though few class path errors, i'm getting new one. after running export wizard , launching application, throws classdeferror , classnotfoundexception, it's looking org.eclipse.ui.plugin.abstractuiplugin. did not find in copy of eclipse sdk, , downloaded sdk again sure, , still couldn't find it. found jar online supposedly contained fiel along other eclipse packages, however, got this: nosuchmethoderror: org.eclipse.ui.plugin.abstractuiplugin: method ()v not found i figure problem more did wrong rather class missing, i've gone though configurations , i'm sure required packages , dependencies included. ideas? download , install new version of adt plugin 21.0.0.

c# - Global Variables vs. ASP.NET Session State -

this going sound rather naive, i'm developing web application spans multiple pages. of these pages instantiate same class object w/ methods accesses cms using api. currently, when user starts creating content, i'm storing variables folder id content located in session variable. my question this: can instantiate single instance of class can used across pages without having on every page? if so, each person accessing page given own version of class? assume using static variables , methods isn't way go since shared in memory. , also, where/how declared if going used globally in web application in .net c# application? i recommend making base class inherits system.page. have page code behind inherit that. then, inside base class, create property reference object. example, this: public class basepage : system.web.ui.page { public foo currentfoo { { return (foo)session["foosessionob

C# Maintain 3 threads and close one if it takes to long -

this code using call 3 threads. for (int = 0; < 3; i++) { new thread(() => { processeventlogtesting(); }) {isbackground = true }.start(); } i thinking adjusting this public static int threadcounter = 0; if (threadcounter < 3) { threadcounter ++; (int = 0; < 3; i++) { new thread(() => { processeventlogtesting(/*somewhere in here code says */threadcounter--;);}) {isbackground = true }.start(); } } } however, think not best way this. also, want put in new timer says if thread x goes on 20 minutes, kill thread x. appreciated. since don't know thread does, try private object lockobject = new object(); private int threadcounter = 0; public int threadcounter { { lock(lockobject) { return threadcounter; } } set {

c# - LongListSelector Data Virtualization -

does longlistselector support data virtualization? read on several blogs does, can't work. here tried: provided ilist implementation itemssource list. problem list calls getenumerator() instead of this[int index] list item. so question: how implement data virtualization longlistselector ? as said, longlistselector still based around getenumerator when rendering ilist types. control need rewritten support purpose. while blogs might support it, none of them says how, i'm not inclined believe them. longlistselector's default render items. as loading of data, can done progressive using observablecollection. got example project shows how use observablecollection in combination longlistselector. basically allow progressively add more groups and/or, more data groups, , ui should update accordingly.

Taking picture without using Media Intent in android -

i developing application have take picture without using media intent i-e without previewing camera.how can can me in regard. waiting reply altaf you cannot take picture without preview. whether preview offered intent or preview create surfaceview when use camera object, there has preview.

eclipse - How do I relocate my Android project in SVN? -

i set svn repository android project wrong way , appreciated correcting it. i created standard svn repository follows (i did not create root "svn" folder because plan store 1 project in repository) : http://myserver/myproject /trunk /branches /tags when checked in project went root folder instead of /trunk folder. had folders: http://myserver/myproject /trunk /branches /tags /myproject /src /res /...etc i've been working way while, using eclipse , (i think) subversive svn connectors. know nothing svn command line. need move project trunk folder should have done beginning. copied myproject folder trunk folder copy/pasting in svn repositories view in eclipse , renamed old folder, have: http://myserver/myproject /trunk /myproject /src /res /...etc /branches /tags /myproject.old /src /res /...etc how project start using /tru

sorting - Ordered Many-Many Relationship in Doctrine? -

attempting link categories websites , using websitecategory refclass. websitecategory has column rank , indicates order in categories should retrieved when call $website->getcategories() i'm stumped, didn't think difficult. can help? was not able doctrine order relationship natively (like damien suggesting) instead, added getcategories() function model runs proper query , returns result set.

java - JTree Not Refreshed When Called on Different Location But On Same Event-Dispatching Thread -

i have been struggling jtree . cannot refresh after add new tree node ( defaultmutabletreenode ). able refresh when code adds tree node called within gui class, not outside it. here code adds node jtree : public class treeviewer extends jpanel implements treeselectionlistener { jtree tree; defaultmutabletreenode rootnode; defaulttreemodel treemodel; public void modifyjtree(string name) { defaultmutabletreenode childnode = new defaultmutabletreenode(name); treemodel.insertnodeinto(childnode, rootnode, rootnode.getchildcount()); } } when called in main method, gui failed refresh after node added. experimented several ways put on event-dispatching thread, not work. tried on main thread, , failed. code examples provided below: public static void main(string[] args) throws exception { final treeviewer viewer = new caseviewer(); // omit code sets gui , displays // calls modifyjtree on event-dispatching thread // , not work

ruby - rails attaching database entry to logged in user -

i'm new rails , done setting login system. however, want able make new blog post , attach account when logged in. how can attach post user_id list previous posts? define model posts ( should have column name user_id ) model post < activerecord::base belongs_to :user end in user model model user < activerecord::base has_many :posts end with above defined associations user_id foriegn key user model can posts user below user.find(id).posts

uiscrollviewdelegate - How to "stick" a UIScrollView subview to top/bottom when scrolling? -

you see in iphone apps gilt. user scrolls view, , subview apparently "sticks" 1 edges rest of scrollview slides underneath. is, there text box (or whatever) in scrollview, scrollview hits top of view, "sticks" there rest of view continues slide. so, there several issues. first, 1 can determine via "scrollviewdidscroll:" (during normal scrolling) when view of interest passing (or re-appearing). there fair amount of granularity here - differences between delegate calls can hundred of points or more. said, when see view approach top of scrollview, turn on second copy of view statically displayed under scrollview top. have not coded this, seems lack real "stick" - view first disappear reappear. second, if 1 setcontentoffset:animated, 1 not delegate messages (gilt not this). so, how callbacks in case? use kvo on "scroll.layer.presentationlayer.bounds" ? well, found 1 way this. when user scrolls flicking , dragging, uiscrollv

C++ Format for cout << Automatically -

if had simple class 2 variables, x , y, , function tostring() returns formatted string data. when call cout << simpleclass << "\n"; anyone know way have simpleclass.tostring automatically called return correctly formatted string? i'm guessing there's way operator functions, don't know how this. if you're asking how define such operator, template<class chart, class traitst> std::basic_ostream<chart, traitst>& operator <<(std::basic_ostream<chart, traitst>& os, simpleclass const& sc) { return os << sc.tostring(); }

version control - How can I find the name/location of an SVN repository? -

i have number of files under version control svn, , i'm trying switch git . however, has been long time since made repository, , have forgotten url. is there way url of subversion repository associated given file? do like: svn info <file> run on given checked out file repository. should give more information file status , repository url.

Seam EntityQuery Many-to-Many Joins, Distinct, and Oracle -

i'm seam newbie in established project, lot of code use borrowed , i'm not sure how things work. problem using query object extended entityquery list page search , sort capabilities needs search across many-to-many relationship , separate many-to-one relationship must used sort. because many-to-many relationship has joined in allow search capability, query returns duplicate records each assignment. that's not big deal because added "distinct" ejbql , worked fine. however, when try order other many-to-one relationship, oracle throws error. appears oracle not accept order column not in select clause when using distinct keyword http://ora-01791.ora-code.com/ , , http://oraclequirks.blogspot.com/2009/04/ora-01791-not-selected-expression.html . here relationships defined in entities: [subject m:m jobfunction] (obviously through assignment table [subject o:m subject_jobfunction m:o jobfunction]), , [subject m:o type]. because need search subject jobfunction, joine

Javascript: open & close new window on image's onMouseOver & onMouseOut, but only if new window onMouseOver = true -

thank helping me javascripting problems. current problem need open & close new window on image's onmouseover & onmouseout, respectively, if new window onmouseover == true don't want new window close. i sure there simple solution, can't seem figure out way cancel image's onmouseout="closedetails();" if user hovers on new window. below of code dealing with. in advance help. <body> <img name="img1" id="img1" onmouseover="windowdelay(this);" onmouseout="closedetails();" src="images/127.jpg" height="240" width="166"/> </body> <script language="javascript" type="text/javascript"> // opens movie details pop-up after // half second interval. function windowdelay(thatimg) { winopentimer = window.settimeout(function() {opendetails(thatimg);}, 2000); } // function open // new window when mouse moved on image function op

osx - Is Lion (gold master) part of the iOS Developers Program? -

i know beta versions of lion available ios dev program members, final release of lion available download? i trying avoid paying lion twice (once via app store , once via joining dev program). pre-release versions of os x part of mac dev program, not ios dev program. for it's worth, when logged in mac app store today, showed installed (i had downloaded gm build few weeks ago). deleted downloaded gm , let me download again free, apparently being member of mac dev program , having downloaded beta version allows release version free!

c# - Memory allocation on object creation -

how memory allocated in stack in heap when instantiate class/struct student? i guess id = 4 bytes reference (32 bit machine) , name = 4 bytes reference , facultyadvisor = 4 bytes reference. totally 12 bytes in stack , actual size in heap. heap size may vary depends upon value assign fields(id, name, facultyadvisor) uses object obj(student obj = new student()) the same struct right? public class student { int id; string name; professor facultyadvisor; } public struct student { int id; string name; professor facultyadvisor; } assuming 32 bit clr (references 64 bit on 64 bit clr) , taking account heap allocation student class student{} class professor{} stack: 4 bytes heap: 4 bytes (int) + 4 bytes (professor reference) + 4 bytes (string reference) + 12 bytes (object header) = 24 bytes class student{} struct professor{} stack: 4 bytes heap: 4 bytes (int) + size of processor + 4 bytes (string reference) + 12 bytes (object header) = ?? bytes struct stu

Any way to return PHP `json_encode` with encode UTF-8 and not Unicode? -

any way return php json_encode encode utf-8 , not unicode? $arr=array('a'=>'á'); echo json_encode($arr); mb_internal_encoding('utf-8'); and $arr=array_map('utf8_encode',$arr); not fix it. result: {"a":"\u00e1"} expected result: {"a":"á"} {"a":"\u00e1"} , {"a":"á"} different ways write same json document; json decoder decode unicode escape. in php 5.4+, php's json_encode have json_unescaped_unicode option plain output. on older php versions, can roll out own json encoder not encode non-ascii characters, or use pear's json encoder , remove line 349 433.

jQuery - Problem loading new image src -

Image
** edit ** image showing needed done. when admin clicks on unapproved (x) comment automatically approves , image changed check mark , vice versa. i using following jquery code, having problems loading new image src on click. <script> $(document).ready(function(){ $(".disapprovecomment").click(function() { var id = $(this).children("p").text(); $.ajax({ type: "post", url: "/comments/disapprovecomment/"+id, async:false, success: function(msg){ //using $(this).(".disapprove")... not work $(".disapprove").attr("src","/img/icons/approve.png"); } }); }); }); </script> this view file <?php if($comment['comment']['approved'] == 1){ echo '<div class="disapprovecomment"><p style="display:none">'; echo $comment['comment'

c# - Usage of Stream more than once -

i trying upload image file repository using httppostedfile.inputstream , resize different thumbnail sizes using same stream. step 1. using stream sm = httppostedfile.inputstream able upload file successfully. step 2. use same stream resize image different sizes. error saying stream being used. suppose if skip step 1 , perform step 2, able resize inputstream (images) different size. letting me use inputstream once. how can achieve process both step 1 , 2 sequentially ? i did try storing inputstream variable , used separate copy each step no luck. can suggest/help me ? thank you did set stream.position 0 before reusing it? by storing in multiple variables you're duplicating reference same object in memory.

css - Vertically aligning text to graphics based bullets -

see bullets on blog post: http://www.nielsbrinch.com/managing-expectation-management/ i have had change text characteristics in order align text graphics based bullets. set same line-height (25) rest of text, had set 15 in order alignment orange bullet correct. here combined styles bullets. .post ul li { background: url(images/yellow-bullet.png) no-repeat 0px 4px; padding-left: 15px; font-family: tahoma; line-height: 15px; font-size: 11pt; padding-top: -12px; margin-bottom: 10px; margin-left: 10px; } question: how ensure keep text correctly aligned bullets, while preserving full control of text characteristics? (i want changing styles, please not suggest change html structure, such including div in li tag) list-style-image: url(images/yellow-bullet.png); instead of background: url(images/yellow-bullet.png) no-repeat 0px 4px; should trick?

custom tab title in android -

i setting custom title in tab activity this boolean customtitlesupported; customtitlesupported = requestwindowfeature(window.feature_custom_title); // customtitlesupported = false; //check custom title supported feature if(customtitlesupported == true) { customtitlebar(); } else { requestwindowfeature(window.feature_left_icon); string title = prefmanager.gettitle(); settitle(name + " " + title); } //set contentview of activity setcontentview(r.layout.tabactivity); if(customtitlesupported == false){ setfeaturedrawableresource(window.feature_left_icon, r.drawable.logo); } everything working fine.but when make customtitlesupported false check if custom title support not there in sdk should call normal settitle() function. if customtitlesupported = false; getting following error android.util.androidruntimeexception: cannot combine custom titles other title features i not u

C# SharpZipLib write a file directly into zip -

my process needs create zip file large number of files(that created process). instead of having create temporary files, zipping them , deleting, can directly add files zip file? yes, can. performance of poor compared direct file creation. anyway, sharpdevelop wiki has examples.

WCF REST services 'unexpected end of file' -

i have asp.net web application using wcf rest services insert 500 reords getting error 'unexpected end of file' have put <bindings> <basichttpbinding> <!-- create custom binding our service enable sending large amount of data --> <binding name="newbinding0" sendtimeout="00:10:00" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647"> <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" /> </binding> </basichttpbinding> </bindings> in both client cofig , service config ,but same issue exists...any solution solution stop , search articles wcf , rest , learn @ least essentials of api trying use. basichttpbinding soap services, not rest services. rest services use webhttpbi

types - Problem reading a TStream in Delphi XE -

in previous versions of delphi, following code: var inbuf: array[1..45] of byte; count := instream.read(inbuf, sizeof(inbuf)); filled variable inbuf correct values ( every byte had value ). in delphi xe, every second byte of array 0, suppose because byte data type twice big, because of unicode nature in delphi xe. but, streams generated , need pass through procedure, need type (maybe?) half size of byte or solution if faced problem. thanks what has happened here, >99% probability have written stream string variable. unicode strings utf-16 encoding have 2 bytes per character whereas older versions of delphi using ansi encodings 1 byte per character. english text, when encoded utf-16 have pattern observe of every second byte being zero. in order solve need investigate section of code writes stream.

javascript - How can I squeeze an additional 10 FPS out of my [primitive] voxel algorithm? -

so, made simple 4dof voxel algorithm in javascript, , feel quite proud of myself, don't have near enough time debug , i've lost several days worth of sleep, notice it's running relatively slowly. now, there obvious %-scaling , setinterval loops slowing down, getting less 20 fps on 100 voxels, of aren't on screen. please excuse following code, adapted primitive little game engine, won't run on own page, can test @ url (http://nextgengame.webs.com/fun/sandbox.htm). world=new array(); for(i=0;i<100;i++){ world[i]=[math.random()*50-25,-3,math.random()*50-25,['#ffffff','#ff0000','#00ff00','#0000ff','#ffff33'][math.round(math.random()*4)]]; } r=0; camx=0; camy=0; camz=0; fps=0; frames=0; window.setinterval(function(){ fps=frames; frames=0; },1000); window.setinterval(function(){; r+=0.02; if(r>math.pi*2)r=0; points=[]; for(i=0;i<world.length;i++){; u=world[i]; x1=u[0]-camx; z1=u[2]-camz; z2=x1*math.sin(r)+z

java - throwing meaningful exceptions from hibernate DAO implementation -

in web application(jsp+hibernate+hsqldb on tomcat) code, using couple of dao implementations.the base class dao implementation contains session open,close logic.a number of domain specific dao classes extend base class provide specific find(),delete() methods i wanted give user meaningful messages when error occurs ,instead of error500 message . since,the base class method uses hibernate.session class get(),saveorupdate() methods ,they throw hibernateexception.the domain specific subclasses need catch wrap in custom exception , rethrow it. i tried way..i don't know if correct way it..i welcome opinion/suggestions sincerely, jim abstract class basedao{ private class persistentclass; public basedao(class persistentclass) { super(); this.persistentclass = persistentclass; } public object findbyid(long id) { sessionfactory factory = hibernateutil.getsessionfactory(); session session = factory.opensession(); object objec

php - Zend Framework – subdirectories and deprecating action within the URL -

i’m in process of learning use zend framework, , i’m therefore trying grasp concept of mvc. through zend manual, , helpful youtube video tutorial have sort of understood concept – still there things need clarify. the web project i’m working on web site organization i’m part of. consists of: the public portion, consisting of information us, calendar , media – static information, couple of pages, calendar, need retrieve data db. the internal pages, after login allow users rsvp events , comment them well. the administrative controls , allows admins add events , manage users etc. so far looks zend wants url this: http?://[domain]/[controller]/[action] here questions: do have have action in url, or lack of action use index-action default? can have subdirectory distinguish between internal , public portions of site: http://[domain]/internal/[controller]/[action] ? can done having subfolder within different mvc-folders somehow? latter question isn’t important, i’d sepa

structuremap does return named instance instead of default one -

as title says, structuremap not return default instance when have configured named instances. here type registration: /// <summary> /// initializes new instance of <see cref="commandprocessingtyperegistry"/> class. /// </summary> public commandprocessingtyperegistry() { for<icommandprocessor>().singleton().use<commandcoordinator>(); for<icommandprocessor>().singleton().use<systemcommandswitch>().named(typeof(systemcommandswitch).fullname); for<icommandprocessor>().singleton().use<telephonycommandswitch>().named(typeof(telephonycommandswitch).fullname); for<icommandprocessor>().singleton().use<audiocommandswitch>().named(typeof(audiocommandswitch).fullname); for<icommandprocessor>().singleton().use<tetracommandswitch>().named(typeof(tetracommandswitch).fullname); for<icommandprocessor>().singleton().use<radiocommandswitch>().named(typeof(radi

php - notice undefined constant assumed MySql -

here code working after installing new wamp server in new mini compaq laptop? errors: $sno=mysql_result($result,$m,"sno"); $name=mysql_resul($result,$m,"name"); $location=mysql_result($result,$m,"location"); $sector=mysql_result($result,$m,"sector"); $status=mysql_result($result,$m,"status");*/?> <table width="320" border="0"cellspacing="0"> <tr> <strong> <td width="194"><strong><span class="style16"><font face="lucida console, lucida sans unicode">pv no:</font></span></strong></td> <td width="110" nowrap><span class="style16"><strong><?php echo "$_post[pvno]";?></strong></span></td></strong> </tr> <tr> <td width="194"><span class="style16"><strong><font f

android - where to put device_admin_sample.xml? -

where put ' device_admin_sample.xml ', giving error wherever put it.. device_admin_sample.xml <device-admin xmlns:android="http://schemas.android.com/apk/res/android"> <uses-policies> <limit-password /> <watch-login /> <reset-password /> <force-lock /> <wipe-data /> </uses-policies> </device-admin> this should in /res/xml folder. here sample apidemos: http://developer.android.com/resources/samples/apidemos/res/xml/device_admin_sample.html

jquery - Changing a character in a class -

i amend last character of string in particular class. is, change comma full-stop in list items belonging class last ( li.last ). example: <li>one,</li> <li>two,</li> <li>three,</li> <li class="last">four,</li> change to: <li class="last">four.</li> is there simple way this? you can use .text overload takes function, useful if have many such elements: $('li.last').text(function(i, text){ return text.replace(/,$/, '.'); }); example: http://jsfiddle.net/xvhkd/ note can use :last-child selector: $('li:last-child') .

java - HttpClient.execute always gives Exception -

i tried bring html of web , use code doing : httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httpget httpget = new httpget("http://www.google.com"); httpresponse response; try { response = httpclient.execute(httpget, localcontext); } catch (clientprotocolexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } and in response = httpclient.execute(httpget, localcontext); give me exception, in other codes tried have tried setting internet permission in manifest file? sample code: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sample.hello" android:versioncode="1" android:versionname="1.0"> <!--- here put permissions. ---> <uses-permission android:nam

javascript - Question on iPad Safari Event Handler -

lets have box/table multiple rows..these rows draggable. now have js have implemented event handlers touchstart,touchmove, touchend ipad....basically map these events corresponding mouse events mouseover, mousedown, mouseup, etc now here issue; while able drag of rows table, want able scroll it. when press finger on screen , drag down, drag action row (since using event.preventdefault() touchmove prevent default scrolling region). now understand cannot have both actions (drag/scroll) using single finger.. want implement/have scroll action when 2-fingers used..(the other case i.e. single finger, should drag action) now aware event.touches.length/event.targettouches.length gives no of fingers on screen, not sure how use scrolling action...just fyi, scrolling similar on ipad fixed height div scrolling (overflow:auto), ipad provides out-of-the-box.. thank you. you fire preventdefault later , , optionally. figuring out if want custom / drag behavior first. someth

Parse html using Perl -

i have following html- <div> <strong>date: </strong> 19 july 2011 </div> i have been using html::treebuilder parse out particular parts of html using either tags or classes aforementioned html giving me difficulty in trying extract date only. for instance tried- for ( $tree->look_down( '_tag' => 'div')) { $date = $_->look_down( '_tag' => 'strong' )->as_trimmed_text; but seems conflict earlier use of <strong>. looking parse out '19 july 2011'. have read documentation on treebuilder can not find way of doing this. how can using treebuilder? the "dump" method invaluable in finding way around html::treebuilder object. the solution here parent element of element you're interested in (which is, in case, <div>) , iterate across content list. text you're interested in plain text nodes, i.e. elements in list not references html::element objects.

select - Tapestry: default value for a dropdown component -

i use following code select-component: java-class: @component(parameters = {"blankoption=auto", "model=somemodel", "value=someid", "zone=somezone"}) private select demoselect; template: <select t:id="demoselect" /> this gets rendered following: <select id="demoselect" name="demoselect"> <option value=""></option> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> </select> the behavior i'm looking is, option preselected (this should decided in page class). how can configure in tapestry? need tell tapestry render "selected" appropriate option, e.g.: <select id="demoselect" name="demoselect"> <option value=""></option> <option value=&q

c# - how to retain a button1 clicks action with a sleep against another button2 click action without sleep -

my problem have 2 labels , 2 buttons in 2 different update panel in asp.net. update panels contains 2 buttons. when buttons clicked update corresponding label text. issue is, suppose gave delay of 5 seconds in button1_click() method, when click button1 , button2 immediately, label2 gettin updated, whereas label1 not getting updated. can suggest i'm going wrong? protected void button1_click2(object sender, eventargs e) { system.threading.thread.sleep(5000); label1.text = "hello"; } protected void button2_click1(object sender, eventargs e) { label2.text = "world"; } in button click event, update update panel second label presents below: updatepanel2.update();

c# - How to get the key value from the AppSettings.Config file? -

i'm trying key value set in appsettings.config file seems not working. this wrote that. code called constructor of mdi file , returning null value. know why? var getvalue = configurationsettings.appsettings["showquerytextbox"]; i tried configurationmanager.appsettings . didnt work. my appsettings code follows. <configuration> <appsettings> <add key="showquerytextbox" value="true"/> </appsettings> </configuration> configurationsettings.appsettings obsolete, try configurationmanager.appsettings["showquerytextbox"];

iphone - problem with parsing data -

hi folks parsing xml file using nsxmlparser class.i sending path , can able see parsing in simulator upto got expected.now installed same code , same data of(xml file) device , again checked data working well. my problem:after disconnecting the device xcode again trying parse data same above time not working. myquestion: know simulator case in sensitive , device(ipad) case sensitive while installed through xcode working in device after disconnecting not working.can 1 please give me idea situation.i cross checked code there no problem.your suggestion more important me.thanks in advance. check if xml file copied bundle resources. goto 'targets' select/right-click target , expand 'copy bundle resources', if file not there, +/drag-drop it. hope works :)

jquery - Setting element width() does not work with a variable -

i'm trying set element width using jquery , won't work. here code: var $padding = 30, $oddwidth = parseint( math.round( $(window).width()*0.75 ) ), $odd = $oddwidth-$padding; $('div:jqmdata(role="content")').css({ 'margin-left':'25%'}).width( $odd ); can me out? the following working me, wrapping jquery code inside following? $(document).ready(function() { $("div:jqmdata(role='page')").live('pageshow',function(){ var $padding = 30, $oddwidth = parseint( math.round( $(window).width()*0.75 ) ), $odd = $oddwidth-$padding; $('div:jqmdata(role="content")').css({ 'margin-left':'25%'}).width( $odd ); }); }); jquery.mobile has different document.ready() when "page" loaded, perhaps without this, width() not correct or <div data-role="content"> not exist yet.

winforms - Using button click to open helpProvider c# -

just quick question possible open helpprovider? all want open chm file when click button in addition f1 key? if it’s not possibly know of work around? thanks peter i think mean windows forms application. there windows forms control called helpprovider you. system.windows.forms.helpprovider hlpprovider = new system.windows.forms.helpprovider(); hlpprovider.setshowhelp(this, true); // file hlpprovider.helpnamespace = "helpfile.chm"; you can open file process proc = new process(); proc.startinfo.filename = "helpfile.cfm"; proc.start();

jquery - Backbone.js - instantiate Models/Views from exisiting html -

i've started looking @ backbone.js today way better organize code in application. i wondering (conceptually - reply pseudocode means) how use existing html create backbone models (and views). all of tutorials i've found consist of using blank html template , injecting in content using ajax. don't want this. if have collection of books. <!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>my book collection</title> </head> <body> <head> </head> <body> <ul id="bookcollection"> <li class="book" data-book-id="1"><input type="text" name="book_1_name" value="my book a"/></li> <li class="book" data-book-id="2"><input type="text" name="book_2_name" value="my book b"/>&l

java - Can I define custom character class shorthands? -

java provides useful character classes \d , \w . can define own character classes? example, useful able define shorthands character classes [a-za-z_] . can define own character classes? no, can't. personally, when have (slightly) complicated regex, break regex in smaller sub-regexes , "glue" them string.format(...) this: public static boolean isvalidip4(string address) { string block_0_255 = "(0|[1-9]\\d|2[0-4]\\d|25[0-5])"; string regex = string.format( "%s(\\.%s){3}", block_0_255, block_0_255 ); return address.matches(regex); } which far more readable single pattern: "(0|[1-9]\\d|2[0-4]\\d|25[0-5])(\\.(0|[1-9]\\d|2[0-4]\\d|25[0-5])){3}" note quick example: validating ip addresses can better done class java.net package, , if you'd that, pattern should placed outside method , pre-compiled. be careful % signs inside pattern!

c# - Secure ASP.NET MVC 3 site -

i read couple of articles mentioning you're supposed have of controllers derive parent class [authorize] attribute not leave security holes in site. (example: article ) however, controllers derive parent controller, doesn't have [authorize] attribute. best way enforce suggestion without having add attribute every single controller? for mvc3 (and possibly 2 not remember) can use global hooks like: public static void registerglobalfilters(globalfiltercollection filters) { filters.add(new handleerrorattribute()); } protected void application_start() { registerglobalfilters(globalfilters.filters); }

c# - Get SOAP request body in proxy client -

i have application calls wcf service. monitoring , tracking purposes have log request messages application failed call service. loke need call operation called removesubscription , once failed(may network problem or wcf service down) log soap message xml or txt file. generaly possible request soap contact in proxy class. i found info can done extending soapextension class. if right way how register/inject new class extends soapextension channel stack. edit : service not hosted in iis in windows service... right in case soapextension not right solution. with wcf based client, can create endpoint behavior intercept request & response messages. technet article shows how access message being sent , response message. wcf client can generated either adding service reference in visual studio, using svcutil manually generate client code or rolling own proxy directly in code using channelfactory class. your logging code write out request message status of requested , t

gwt - How to internationalize the text attribute of a TreeItem in UIBinder? -

given uibinder tree this: <g:tree ...> <g:treeitem text='links1' > <g:hyperlink ... /> <g:hyperlink ... /> <g:treeitem text='links2' > <g:hyperlink ... /> <g:hyperlink ... /> </g:tree> how internationalize 'text' attribute of treeitem elements (without resorting doing programmatically)? if have messages (or constants) interface can follows: add ui:with resource to uibinder xml: <ui:with field='i18n' type="com.example.myapp.client.i18n.mymessages" /> next use follows: <g:tree ...> <g:treeitem text='{i18n.links1}' > <g:hyperlink ... /> <g:hyperlink ... /> <g:treeitem text='{i18n.links2}' > <g:hyperlink ... /> <g:hyperlink ... /> </g:tree> where links1 , links2 refer method names on mymessages interface.

Confusing Scala Dynamic code snippet -

i came across following code snippet on scala mailing list: scala> class dynamicimpl(x: anyref) extends dynamic { | def _select_(name: string): dynamicimpl = { | new dynamicimpl(x.getclass.getmethod(name).invoke(x)) | } | def _invoke_(name: string)(args: any*) = { | new dynamicimpl(x.getclass.getmethod(name, args.map(_.asinstanceof[anyref].getclass) : _*).invoke(x, args.map(_.asinstanceof[anyref]) : _*)) | } | override def typed[t] = x.asinstanceof[t] | override def tostring = "dynamic(" + x.tostring + ")" | } defined class dynamicimpl scala> scala> implicit def todynamic(x: any): dynamic = new dynamicimpl(x.asinstanceof[anyref]) todynamic: (x: any)dynamic scala> class duck { | def quack = "quack!" | } defined class duck scala> class quackingswan { | def quack = "swack!" | } defined class quackingswan scala> def makequack(d: dyna

iphone - How to initialize local notification? -

i want implement local notification in clock app.basically want music file should played after every half hour in ship's clock in chimes played after every 30 minutes. can give rough idea how can implement functionality when app enters in background? i used local notification stuff , used following functions //setting local notifications for (int i= 1 ; i<=10; i++) { //we here set 10 notification after every 30 minutes can modify accordingly nsdate *scheduled = [[nsdate date] datebyaddingtimeinterval:60*30*i]; //these seconds nsdictionary* datadict = [nsdictionary dictionarywithobjectsandkeys:scheduled,fire_time_key,@"background notification received",notification_message_key,nil]; [self schedulenotificationwithitem:datadict]; } where schedulenotificationwithitem defined - (void)schedulenotificationwithitem:(nsdictionary*)item { uilocalnotification *localnotification = [[uilocalnotification alloc] init]; if (

filter - Solr search/faceting results have strange behaviour: i only get "stemmed" strings (hope it's correct definition) -

sorry title bad, didn't know how describe problem. i'm using sunburnt (python interface) query solr within django app. when i'm searching, ok, full string. on other hand, if i'm faceting (let's on "job_title" field) i'm getting stemmed words like this: <lst name="job_title"> <int name="manag">17095</int> <int name="sale">7689</int> <int name="engin">6995</int> <int name="consult">4907</int> <int name="account">4710</int> <int name="develop">4509</int> <int name="senior">4366</int> and on... text fieldtype definition: <fieldtype name="text" class="solr.textfield" positionincrementgap="100" autogeneratephrasequeries="true"> <analyzer> <tokenizer class="solr.whitespacetokenizerfactory

c# - Colorize the Autocomplete list of the combobox -

i'm using c# 4.0 on windows forms application, i've combobox items, enabled auto complete feature of suggestappend, auto complete source listitems (binded source) now when user start typing, auto complete list apears, want colorize items in autocomplete list depending on condition, i knew there way colorize combobox items using drawitem event handler, want in autocomplete list. is applicable ?? , how ? this not possible. the windows feature .net control relying on: shautcomplete doesn't support this. .net control uses cannot it.

2d - fast 2dimensional histograming in matlab -

Image
i have written 2d histogram algorithm 2 matlab vectors. unfortunately, cannot figure out how vectorize it, , order of magnitude slow needs. here have: function [ result ] = hist2d( vec0, vec1 ) %hist2d takes 2 vectors, , computes 2 dimensional histogram % of images. assumes vectors non-negative, , bins % integers. % % outputs % result - % size(result) = 1 + [max(vec0) max(vec1)] % result(i,j) = number of pixels have value % i-1 in vec0 , value j-1 in vec1. result = zeros(max(vec0)+1, max(vec1)+1); fvec0 = floor(vec1)+1; fvec1 = floor(vec0)+1; % ugh, gross, there has better way... = 1 : size(fvec0); result(fvec0(i), fvec1(i)) = 1 + result(fvec0(i), fvec1(i)); end end thoughts? thanks!! john here version 2d histogram: %# random data x = randn(2500,1); y = randn(2500,1)*2; %# bin centers (integers) xbins = floor(min(x)):1:ceil(max(x)); ybins = floor(min(y)):1:ceil(max(y));

java - How to access DAO from Webservice using JAX-WS -

just started using jax-ws. created service class , dao class. service running fine gives nullpointerexeption b'coz can't locate dao; trying call dao service class : package com.nmmc.works.service.impl; @webservice(servicename="myservice") public class securityserviceimpl extends genericserviceimpl implements isecurityservice { private isecuritydao securitydao; ....getter setter methods.... @webmethod public integer getbidacceptanceidforsdpayment(integer tmastno) { internalresultsresponse<object> response = getsecuritydao().getmymethod(tendermastno); if(response != null && response.getresultslist().size() > 0){ return integer.parseint(response.getfirstresult().tostring()); }else{ return -1; } } and sun-jaxws.xml..... <b> <?xml version="1.0" encoding="utf-8"?> <endpoints version="2.0" xmlns="http://java.sun.c

python - manage.py runserver Error: [Errno 10013] -

i having problems running django. when use command manage.py runserver receive error says: error: [errno 10013] attempt made access socket in way forbidden access permissions i use postgresql database. edit: run windows vista if don't have permission bind socket, can try sudo manage.py runserver root privileges. with windows vista / 7 need run shell administrator privileges. can right click on icon , select "run administrator" or go c:\windows\system32\ , right click on cmd.exe , select "run administrator". edit: ok, error occurs when process using same port. change port, manage.py runserver 8080 number @ end port want.

Is mapping your TFS local workspace to C:\ a bad idea? -

my small development team uses tfs2010 in corporate setting, , on team has tfs workspace mapped folder @ root level of c: drive (e.g., c:\tfs ). security perspective, bad idea? i fear person in our organization log onto our pcs , have read access uncompiled code , connection strings in there. considered best practice map tfs workspace subfolder in user account's documents folder, non-administrators can't access? my fellow teammates' original intent house workspace @ level of c: keep mapped directory name simple, , avoid problems directory , filename limitations in tfs (see error tf14078 ) complex projects. thanks! one thing need careful when mapping tfs collection far under root of drive file name/path name length. file name must less 260 characters , file path must less 248 characters.

java - my ideal cache using guava -

off , on past few weeks i've been trying find ideal cache implementation using guava's mapmaker . see previous 2 questions here , here follow thought process. taking i've learned, next attempt going ditch soft values in favor of maximumsize , expireafteraccess: concurrentmap<string, myobject> cache = new mapmaker() .maximumsize(maximum_size) .expireafteraccess(minutes_to_expiry, timeunit.minutes) .makecomputingmap(loadfunction); where function<string, myobject> loadfunction = new function<string, myobject>() { @override public myobject apply(string uidkey) { return getfromdatabase(uidkey); } }; however, 1 remaining issue i'm still grappling implementation evict objects if reachable, once time up. result in multiple objects same uid floating around in environment, don't want (i believe i'm trying achieve known canonicalization). so far can tell answer have additional map functions interner

ms office - Unable to install Excel 2003 Addin. How to diagnose troubles? -

i have create excel 2003 addin , installer according manual http://blogs.msdn.com/b/cristib/archive/2010/11/01/deploying-a-vsto-word-2007-add-in-to-all-users-visual-studio-2008-sp1.aspx @ time try install addin on machine. installation pass success, addin not work. excel not shows errors, plugin not loaded correctly , not work. exists way diagnose problems addin? duplicate question. how troubleshoot vsto addin not load? more info can found here: http://msdn.microsoft.com/en-us/library/ms269003.aspx

How to build, in git, old project's history? -

i have project want put onto git. have many old 'zip' snapshots of project can used create basis of putative historical lineage, plus few older bits, many i've still 'find', i'd still add history build. it isn't hard create lineage newer zips [ copy, commit, copy, commit, .. etc. ] immediately, how graft(?) on older history retrospectively? i'd history entered them chronologically, sort of re-write required. because team small , co-located can handle change on draft version 'proper' version, practical exercise in getting started, , finessing 'still find' portions once has started using git (i'd rather using git waiting till sufficient 'history found ;-). so question how retrospectively graft on history, , re-write whole repo graft doesn't show? know re-write all commit sha1 ids. you want described here: https://softwareengineering.stackexchange.com/questions/33868/script-tool-to-import-series-of-snapshots-

c# - complicated relation fluent nhibernate -

hey all i'm not sure how map this. i have got buyer, buyer can have many buyers. got contract, now, each contract buyer have many different buyers.. public class buyer { private ilist<buyer> m_buyerlist = new list<buyer>(); public virtual ilist<buyer> buyerslist { { return m_buyerlist; } set { m_buyerlist = value; } } public virtual string name { get; set; } public virtual int id { get; set; } public virtual string address { get; set; } public virtual string extraaddress { get; set; } public virtual string phonea { get; set; } public virtual string phoneb { get; set; } public virtual string phonec { get; set; } public virtual string email { get; set; } public virtual string fax { get; set; } } public class contract { public virtual buyer mainbuyer { get; set; } public virtual datetime signeddate { get; set; } } thank guys. buyer mapping:

macros - How to trigger the __cplusplus (C++) #ifdef? -

#ifdef __cplusplus // c++ code #else // c code #endif the structure this. question is, how trigger #ifdef on? i mean, in program? code write can turn #ifdef on? for example, in case. #define __cplusplus will turn on? "#define __cplusplus" will let on? yes, "let on". __cplusplus should automatically defined c++ compiler. c++ uses different name mangling , macro used make c headers compatible c++: #ifdef __cplusplus extern "c" { #endif ... #ifdef __cplusplus } #endif

sql server ce - CSHTML/SQL SUM For A Row -

i know in mysql sum(size), reason building in razor cshtml not same , cant find anywhere talks adding or subtracting 2 numbers in cshtml. right function use add rows size? code: @{ page.title = "home @"; var pagetitle = "home"; var db = database.open("photogallery"); var shows = db.query(@"select * shows").tolist(); var seasons = db.query(@"select * seasons").tolist(); var episodes = db.query(@"select * episodes").tolist(); var comics = db.query(@"select * comics").tolist(); var artists = db.query(@"select * artists").tolist(); var albums = db.query(@"select * albums").tolist(); var comicsize = db.query(@"select sum(size) comics").tolist(); var totalsizeb = comicsize; } <h1>@pagetitle</h1> <p align="center"> @shows.count tv shows | @seasons.count seasons | @episodes.count episodes | @comics.count com