Posts

Showing posts from April, 2014

vba - mid()=foo in VBS? -

in vba , vb6 can assign mid example mid(str,1,1)="a" in vbs doesn't work. need because string concatenation freakin' slow here actual code hacked real quick function fastxmlencode(str) dim strlen strlen = len(str) dim buf dim varptr dim dim j dim charlen varptr = 1 buf = space(strlen * 7) dim char = 1 strlen char = cstr(asc(mid(str, i, 1))) charlen = len(char) mid(buf, varptr, 2) = "&#" varptr = varptr + 2 mid(buf, varptr, charlen) = char varptr = varptr + charlen mid(buf, varptr, 1) = ";" varptr = varptr + 1 next fastxmlencode = trim(buf) end function how can work in vbs? authoritative source explicitly stating it's not available in vbscript: visual basic applications features not in vbscript : strings: fixed-length strings lset, rset mid statement strconv vba has both mid statement , mid functi...

c++ - choose correct template specialization at run-time -

i have template <int i> struct { static void f (); }; with specializations done @ different places in code. how can call correct a<i>::f i known @ runtime? void f (int i) { a<i>::f (); } // won't compile i don't want list possible values of i in big switch . edit: i thought of like #include <iostream> template <int i> struct { static void f (); }; struct regf { typedef void (*f)(); enum { arrsize = 10 }; static f v[arrsize]; template < int > static int apply (f f) { static_assert (i < arrsize, ""); v[i] = a<i>::f; return 0; } }; regf::f regf::v[arrsize]; template <int i> struct reg { static int dummy; }; template <int i> int reg<i>::dummy = regf::apply<i> (); void f (int i) { return regf::v[i] (); } #define add(i) \ template <> struct a<i> : reg<i> { \ static void f () { std::cout << << "\n"; } \ }; add(1...

java - Decoding RIMM streaming file format -

i want decode video (visual) frames within blackberry rimm file. far have parser , , corresponding container documentation rim. the video codec h264 , explicitly set on device using 1 of video.encodings properties. however, ffmpeg not able decode frames , driving me nuts. edit 1: issues seems lack of sps , pps in frames, , artificially inserting them have proven unsuccessful far (all grey image). blackberry 9700 sends 0x00 0x00 0x?? 0x?? 0xtype where type according table 7-1 in h264 spec (i , p frames). believe 0x?? 0x?? represent size of frame, size not correspond size found parser (the parser seems working correctly). i have windows decoder codec blackberry, called mc_demux_mp2_ds.ax, , can play mpeg-4 files captured same way, binary windows. , h264 files not play either way. aware of previous attempts . capture url javax.microedition.media.manager is encoding=video-3gpp_width=176_height=144_video_codec=h264_audio_codec=aac and writing output stream. example files...

Sync files between pc and Android phone like Windows ActiveSync? -

is possible sync files (like textfiles) specific path on android phone specific folder on pc via usb? pretty activesync connect phone pc , syncs specific files phone pc if changed. i not talking outlook, contacts or word documents, plain text files custom extension. basically app makes changes textfile whenever app used, , when user done syncs textfile pc read our main program. is possible sync files (like textfiles) specific path on android phone specific folder on pc via usb? there no apis in android sdk access usb. developer can via ddms, or via adb pull , app has no way of initiating this, let alone arbitrary users.

c++ - If there are virtual methods, is vtable is going to be created? -

if create simple class : class { public : virtual void foo() { } }; (no virtual destructor) compiler going create vtable? or modern compilers smart enough recognize case (which might bad copy , paste) , not add virtual table such classes? the v-table implementation detail. compilers use v-tables virtual functions create 1 class. don't, won't.

php - post rating for an individual item in a list using codeigniter -

i’m having heck of time figuring out how post rating individual item in list of items, this code let’s me rate multiple items, not single items: for($i=0;$i<2;$i++){ $doc_item_id = $_post['item_id0'][$i]; $doc_rating = $_post['document_rating'][$i]; $it_rt = array( 'item_id' => $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); } whereas code let’s me rate first item (or last item depending on put "break;"): foreach($_post['item_id0'] $doc_item_id){ foreach($_post['document_rating'] $doc_rating){ } break; } $it_rt = array( 'item_id' => $doc_item_id, 'rating' => $doc_rating, ); $this->purchases_model->update_document($it_rt); any thoughts on how correct either of these such user rate individual item of choosing appreciated, if user supposed choose item rate (in...

jsf 2 - JSF 2 OpenJPA 2 Glassfish 3.1 WEB9031 Error -

i got error according apache support issue relating glassfish rather openjpa: java.lang.illegalstateexception: web9031: webappclassloader unable load resource [org.apache.openjpa.util.longid], because has not yet been started, or stopped the stacktrace is: caused by: java.lang.illegalstateexception: web9031: webappclassloader unable load resource [org.apache.openjpa.util.longid], because has not yet been started, or stopped @ org.glassfish.web.loader.webappclassloader.loadclass(webappclassloader.java:1410) @ org.glassfish.web.loader.webappclassloader.loadclass(webappclassloader.java:1368) @ com.ckd.model.bookmodel.pcnewobjectidinstance(bookmodel.java) @ org.apache.openjpa.enhance.pcregistry.newobjectid(pcregistry.java:138) @ org.apache.openjpa.meta.metadatarepository.processregisteredclass(metadatarepository.java:1693) @ org.apache.openjpa.meta.metadatarepository.processregisteredclasses(metadatarepository.java:1643) ... 112 more has come across ...

java - How to know when the request is forwarded in a RequestWrapper object -

i using subclass of httpservletrequestwrapper translations on request parameters, , cache translated values first time requested. example, first time getquerystring() called, call super.getquerystring() , calculate result want , keep in field, , return it. next times, use cached result. this method works charm unless there's "forwarding". when request forwarded, tomcat replaces original request, cached query string not changed, , forwarded page gets original query string, not 1 forwarded to. overriding setrequest() method clear cache doesn't either, if request wrapped twice, calls setrequest on inner wrapper (which not mine), , have no way know when happens. i'm looking way notified when there change in wrapped request hierarchy, can clear cache, when there "forward". the original request uri available request attribute key requestdispatcher.forward_request_uri . string originalrequesturi = request.getattribute(requestdispatcher...

cocoa - Hide NSMenu programmatically from NSStatusItem -

i have application shows item in system's status bar, , 1 of items custom view nstextfield , nsbutton. when user clicks on status bar item, shows menu, user inputs text , presses button. triggers action displays window. the problem i'm having is, when button pressed trigger action, menu remains visible. want hide menu, because action has been processed. i've searched through api, couldn't find how it. any ideas? this how i'm creating menu: nsstatusbar *bar = [nsstatusbar systemstatusbar]; self.statusitem = [bar statusitemwithlength:nsvariablestatusitemlength]; [statusitem setimage:[nsimage imagenamed:@"icon_status_bar.png"]]; [statusitem sethighlightmode:yes]; nsmenuitem *textinputitem = [[nsmenuitem alloc] initwithtitle:@"" action:nil keyequivalent:@""]; [textinputitem setview:mycustomview]; // created on nib file... nsmenu *menu = [[nsmenu alloc] initwithtitle:nslocalizedstring(@"statusbarmenutitle", @...

php - Preferred design-pattern/architecture for specific application -

peace , love! i'm relatively new web dev, focusing on php, js , mysql. until i've practiced basic "spaghetti" / procedural approach in coding, , think it's time move on study , experience oop. i'm starting work on project small business client, i'm developing them scratch application manage products , customers, creation of quotes, orders, crm , analysis (db queries, charts etc.). small tailor-made erp. now, don't know yet of oo design patterns out there, , question - based on kind of application - design pattern consider developing , why? once ideas can focus , study 1 approach , start implement it. don't want study 10 patterns know should use. p.s.1. see lots of "mvc" flying around - answer? p.s.2. believe want program scratch, not using existing framework. because wish learn firsthand fundamentals of oop. thank you! i think should first try out mvc framework familiar pattern before trying develop 1 yourself. h...

c++ - Convert custom API to Ruby on Rails ActiveResource -

i have set of embedded devices run software written in c++. api communicate devices simple: get/set/acquire parameters , signals. i'd implement common web application access of devices single point. my idea add xml rpc interface devices , use activeresource access devices web server. combination doesn't seem used @ in practice. i'm free choose protocol inside devices. recommendations? if you're considering xml rpc i'm assuming have sort of web server running on device. choose restful web service on xml rpc. if designed have corresponding services on rails app. for example: http://somedevice/signals.json - gets signals http://yourrailsapp/somedevice/signals.json - gets somedevice's signals; use id instead here if makes more sense ( http://yourrailsapp/devices/1/signals.json ).

jQuery hover function -

hi trying create jquery function fades other divs when 1 of div clicked on. code isn't working , i'm not sure how write it. here have far: $("#slider div.popup").hover( var ind = $(this).index(); $("#slider div.popup").each(function() { if ($(this).index() != ind) { //fades other .popup divs $(this).animate({ opacity: 0 }); } }), $("#slider div.popup").each(function() { if ($(this).index() != ind) { //unfades other .popup divs $('span', this).animate({ opacity: 1 }); } } )); there example here : http://jsfiddle.net/7j3mk/ can give me guidance on how code working? beside wrong syntax use hover method ( it takes 2 functions parameters ) need use .not() docs method $("#slider div.popup").hover( function(){ $("#slider div.popup").not(this).stop().animate({ opacity: 0 }); }, function(){ ...

android - TabHost: What if I need to handle onOptionsItemSelected each in separate Tab/Activity -

i need have tabhost consisting of 2 tabs each tab represented separate activity . each activity has own data fields , methods operate on them. want each tab have own menu , menu need onoptionsitemselected() method part of class make able invoke methods of class . what best approach implement this? i've started menu definition in class represents tabhost , faced problem don't have access methods of activities . decided make methods of activities static have access them need define fields of these activities static doesn't seem solution me. update : it became easier thought. in onoptionsitemselected() can current activity of opened tab . secondactivity sa = (secondactivity)this.getcurrentactivity() sa.mypublicmethod(); this depends on sort of functionality implementing. have each activity implement interface instance methods need , have tabhost contain reference current activity of type interface. if this, make sure update reference each...

wpf - Should I use Prism for developing simple desktop applications? C# -

i want move on wpf applications , convert win-form apps(into wpf) at moment there learn wpf in order nice application... i found prism : http://msdn.microsoft.com/en-us/library/gg406140.aspx and believe can shortcut allow me cool abilities of wpf adding business logic. do recommend prism wpf beginner? will possible remove prism , build own ui after i'll more experienced wpf? if have other ideas creating desktop application support multiple views , navigation - please let me know thanks. no, prism big layer sits on top of wpf (or silverlight). not make learning wpf easier or remove need learn how wpf works. prism powerful abstraction layer can accelerate creation/maintenance of large enterprise applications - has steep learning curve beyond learning curve of wpf. if building simple application, build in straight wpf. things learn doing later build things prism. effective prism, need comfortable lot of more complex aspects of wpf development such bi...

jQuery how to set first tab active? -

$( '#xxx' ).tabs({ select: function(event, ui) { var theselectedtab2 = ui.index; if (theselectedtab2 == 0) { $('ul li.ep_s1').removeclass('ep_s1').addclass('ep_s-click1'); if ($('ul li#h13').hasclass('ep_l-click1')) { $('ul li#h13').removeclass('ep_l-click1').addclass('ep_l1'); }} else if (theselectedtab2 == 1 ) { $('ul li.ep_l1').removeclass('ep_l1').addclass('ep_l-click1'); if ($('ul li#h12').hasclass('ep_sidebar_friends-click1')) { $('ul li#h12').removeclass('ep_s-click1').addclass('ep_s1'); }} } }); if use selected: 0 set first tab active go through if (theselectedtab2 == 0) statement , go through adding classes. if after page loads click on tabs script works perfect. basically want when page loads if (theselectedtab2 == 0) statement , happens inside active. thanks trigger click event on first tab after page l...

mysql - Store picture to database; retrieve from db into Picturebox -

hi posted earlier , got still no working solution. have determined last q & there wrong "save db" code "retrieve picture" code. if manually save pic in db stil wont retreive. code patched 3 or 4 examples around net. ideally if had known code , direct me best. dim filename string = txtname.text + ".jpg" dim filesize uint32 dim imagestream system.io.memorystream imagestream = new system.io.memorystream pbpicture.image.save(imagestream, system.drawing.imaging.imageformat.jpeg) redim rawdata(cint(imagestream.length - 1)) imagestream.position = 0 imagestream.read(rawdata, 0, cint(imagestream.length)) filesize = imagestream.length dim query string = ("insert actors (actor_pic, filename, filesize) values (?file, ?filename, ?filesize)") cmd = new mysqlcommand(query, conn) cmd.parameters.addwithvalue("?filename", filename) cmd.parameters.addwithvalue("?filesize", filesi...

C++ header file -

possible duplicate: in c++ why have header files , cpp files? why in c++ there .h , .cpp , not 1 file c# , java ? for historical reasons. specifically, compatibility c. language designed run on (for 70s standards) low-end machines; header files (and still are) substituted inline separate program, keep memory use of compiler down. still helps keep libraries small.

javascript - store values from form to grid -

i have create add record form in extjs stores user entered data grid. well , if found following method form values formpanel var formpanel = new ext.form.formpanel({...}); var form = formpanel.getform(); var firstname = form.findfield('firstname').getvalue(); but want covert user input value json , want store grid panel , want send server also. using findfield have manually create array , need encode json , there alternate way directly read values form , convert json , store grid panel. when "want store in gridpanel" updating existing record in grid's store or inserting new 1 or both? (depending on whether add or update probably?) for such situations, basicform (var form in snippet above) provides updaterecord( record record ) method. so steps - var record = record.create(...) // in case of insert or var record = //obtain record grid.getstore() in case of update then, formpanel.getform().updaterecord(record); //update passed recor...

Is there a name for this compression algorithm? -

say have 4 byte integer , want compress fewer bytes. able compress because smaller values more probable larger values (i.e., probability of value decreases magnitude). apply following scheme, produce 1, 2, 3 or 4 byte result: note in description below (the bits one-based , go significant least significant), i.e., first bit refers significant bit, second bit next significant bit, etc...) if n<128, encode single byte first bit set 0 if n>=128 , n<16,384 , use 2 byte integer. set first bit one, indicate , second bit zero. use remaining 14 bits encode number n. if n>16,384 , n<2,097,152 , use 3 byte integer. set first bit one, second bit one, , third bit zero. use remaining 21 bits, encode n. if n>2,097,152 , n<268,435,456 , use 4 byte integer. set first 3 bits 1 , fourth bit zero. use remaining 28 bits encode n. if n>=268,435,456 , n<4,294,967,296, use 5 byte integer. set first 4 bits 1 , use following 32-bits set exact value of n, 4 byte integer. r...

javascript - Too much recursion -

can tell me loop comes from? js: if (zahl > 1) { document.getelementbyid('makroclickm2').innerhtml = data_split[zahlm2]; document.getelementbyid('makroclickm2').onclick = getwords(zahlm2++); } else { document.getelementbyid('makroclickm2').innerhtml = ""; document.getelementbyid('makroclickm2').onclick = ""; } if (zahl > 0) { document.getelementbyid('makroclickm1').innerhtml = data_split[zahlm1]; document.getelementbyid('makroclickm1').onclick = getwords(zahlm1++); } else { document.getelementbyid('makroclickm1').innerhtml = ""; document.getelementbyid('makroclickm1').onclick = ""; } document.getelementbyid('makroclick').innerhtml = data_split[zahl]; document.getelementbyid('makroclick').onclick = getwords(zahl++); document.getelementbyid('makroclickp1').innerhtml = data_split[zahlp1]; document.getelementbyid(...

Equivalent Url Rewrite in .NET? -

i'm lamp background. i'm trying come .net equivalent following .htaccess file rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewritecond %{query_string} (.*) rewriterule ^(.*)\/?$ $1.php?%1 [l] in php world, put code .htaccess file sits in web root. each of following urls http://mysite.com/helloworld , http://mysite.com/helloworld.php , , http://mysite.com/helloworld?param=5 , http://mysite.com/helloworld.php?param=5 resolve page helloworld.php, latter 2 having $_get['param'] populated. how achieve same results in .net world aspx pages? i using asp.net web forms. thanks you either download , install urlrewrite 2.0 httpmodule manually www.iis.net, or use web platform installer (wpi) install it. personally, prefer wpi. grab wpi here: http://www.microsoft.com/web/downloads/platform.aspx it let install , configure aspects of windows web development environment. -oisin

java - Lightweight JVM Instrumentation to find unused code -

i wondering if there lightweight way instrument production jvm gather information on period of months gather statistics on unused code in code base. thanks lot looking @ this. file under "experimental science project". invoke dynamic feature coming in jdk7 used in interesting low-overhead test coverage prototype . maybe bit bleeding-edge today, interesting once java 7 out.

Using python string formatting in a django template -

is there easy way use python string formatting within django template? is, i'd able in template {{ variable|%.3f }} i know in case, 1 can use {{ variable|floatformat:3 }} but i'd able generically use python string format on django variable. in system it's inconvenient have deal 2 different ways format output (python vs django), i'd standardize. write custom template tag like {% pyformat variable format="%.3f" %} or maybe custom template filter like {{ variable|pyformat:"%.3f" }} do either of these exist? customer filter work string passed in that? {{ variable|stringformat:".3f" }} source: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#stringformat

Is there a Core Data predicate for all objects in a linked list? -

is there way formulate core data predicate given object, representing head of singly linked list, , of other objects in list? e.g., have objects, each of has relationship object (say nextobject ) , want predicate specified object , other objects reachable traversing nextobject (until nil ). clarification : i'm using these uitableview 's nsfetchedresultscontroller , these need part of fetch, not iterate through in code. you wouldn't use predicate linked list. instead, start first object of interest , walk relationships calling nextobject until hit 1 did not have nextobject value. you can find first , last objects predicate in fetch looking previousobject==nil , nextobject==nil . predicates not understand arbitrarily long relationship chains. understand chain enity1.entity2.entity3 not nextobject.nextobject.nextobject... because have no way of knowing when stop.

python - String formatting with "{0:d}".format gives Unknown format code 'd' for object of type 'float' -

if understood docs correctly, in python 2.6.5 string formatting "{0:d}" same "%d" string.format() way of formatting strings " have {0:d} dollars on me ".format(100.113) should print "i have 100 dollars on me " however error : valueerror: unknown format code 'd' object of type 'float' the other format operations work.for eg. >>> "{0:e}".format(112121.2111) '1.121212e+05' that error signifying passing float format code expecting integer. use {0:f} instead. thus: "i have {0:f} dollars on me".format(100.113) will give: 'i have 100.113000 dollars on me'

use a custom directory for build in eclipse cdt c++ makefile project -

hi have c++ makefile project in eclipse helios cdt. my external makefile make binary output files in projectdirectory/bin if build project eclipse runs makefile , there no compilation problem if run it.. eclipse doesn't find files.. some advice? if goto "run" menu , select "debug configurations" or "run configurations" (whichever concerns you), select "c/c++ application", , press 'new' icon little white page yellow plus icon in top right. on right hand side should see text field "c/c++ application:" buttons "search project..." , "browse...". select "browse..." , navigate location of build output executable. this should sufficient , running.

iphone - Switching view controllers at the end of a movie's playback? -

in app, there's uibutton end user can push, pushes view controller plays video in frame using mpmovieplayercontroller. i'd able detect when video reaches it's end, , when happens, push new view controller. though can't seem find code can this. does know how this? the video playback code looks this: //video stuff cgrect myvideorect = cgrectmake(0.0f, 145.0f, 320.0f, 160.0f); movieurl = [[nsbundle mainbundle] urlforresource:@"mymovie" withextension:@"m4v"]; movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:movieurl]; [[movieplayercontroller view] setframe:myvideorect]; movieplayercontroller.controlstyle = mpmoviecontrolstylenone; [self.view addsubview:movieplayercontroller.view]; [movieplayercontroller play]; thanks! register view controller listen playbackdidfinish notification player: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(playbackfinished:) name:mpmovieplayerplayb...

latex - create an explanation of a table in R -

i have latex table generated inside pdf r data frame after statistical test , want create summary of table explain significant variables inside it. how can done ?? that's table : \hline & & b & c & d & e \\ \hline & 1.00 & 0.00 & 0.00 & 0.00 & 0.02 \\ b & 0.00 & 1.00 & 0.00 & 0.08 & 0.40 \\ c & 0.00 & 0.00 & 1.00 & 0.00 & 0.00 \\ d & 0.00 & 0.08 & 0.00 & 1.00 & 0.99 \\ e & 0.02 & 0.40 & 0.00 & 0.99 & 1.00 \\ \hline note : significant varaibles variables have value bigger 0.7 , e.g (d , e have value =0.99 ) signifcant. want summary text under table (e.g variables d , e similar | , e "weakly similar" (0.02) t less similar c) , , want put * on significant numbers , , numbers came data frame in r thanks in advance see if want. there more efficient ways go doing this, without details structure of data - bit of mind ...

php - How do I get the http response/server code from each request in Zend Framework? -

using zend framework http client, how http response/server code each request? getting body fine, response code nice too. found answer: $response->getstatus();

unix - android wireless file transfer -

i detect if phone around wirelessly , transfer new files computer...which in turn upload amazon. have upload set via shell script. way if loose phone have data. don't want plug phone in transfer files. what take make happen? there can in bash shell?

multithreading - Java POJO: strategies for handling a queue of request objects to a server -

right i'm torn in deciding best way of handling request objects send server. in other words, have tracking request objects things such impression , click tracking within app. simple requests low payloads. there places in app said objects need tracked appear concurrently next each other (at 3 concurrent objects have track), every time said objects visible example, have create tracking request object each of them. now know can create singleton queue thread adds objects vector , thread either processes them in main loop or calls wait on queue until have objects process. while sounds clear cut solution, queue can accumulate dozens, can cumbersome @ times, since it's making 1 connection each request, won't run concurrently. what had in mind create thread pool allow me create 2 concurrent connections via semaphore , process thread objects contain tracking event requests. in other words, wanted create function create new thread object , add vector, in thread pool iterate t...

c# - is using while for this ok? -

while(player.closemenu(menutype)) { } player.closemenu(menutype) close 1 menu of chosen type, or return false if there none left of type. is ok use empty loop close menus of given type? i expand on of these answers , create method called closeallmenus(menutype menutype) . can put whatever kind of ugly implementation in there, , obvious doing when call it. current code doesn't explain happening unless know there can multiple menus of particular type open, , call close 1 of them.

Iterating over separate lists in R -

i have lots of variables in r, of type list a100 = list() a200 = list() # ... p700 = list() each variable complicated data structure: a200$time$data # returns 1000 x 1000 matrix now, want apply code each variable in turn. however, since r doesn't support pass-by-reference, i'm not sure do. one idea had create big list of these lists, i.e., biglist = list() biglist[[1]] = a100 ... and iterate on biglist: for (i in 1:length(biglist)){ biglist[[i]]$newstuff = "profit" # more code here } and finally, after loop, go backwards existing code (that uses variable names) still works: a100 = biglist[[1]] # ... the question is: there better way iterate on set of named lists? have feeling i'm doing things horribly wrong. there easier, like: # fake, idealized code: foreach x in (a100, a200, ....){ x$newstuff = "profit" } a100$newstuff # "profit" to parallel walk on lists can use mapply, take parallel lists , ...

localhost image not showing up in asp.net listview -

my web application retrieves location of image database. i'd show image in listview using image control. although database gives correct location of image, reason, web application cannot render image file. (when put same address in image control, image appears.) have clue on matter? in advance. codes in listview are: <itemtemplate> <td runat="server" style=""> <asp:image id="albumimage" imageurl = '<%# eval("imglocation") %>' runat="server" alternatetext= '<%# eval("imglocation") %>' /><br /> <asp:label id="albmnamelabel" runat="server" text='<%# eval("albmname") %>' /> <br /> </td> </itemtemplate> html generated portion of web application is: <td style=""> <img i...

windowbuilder - Eclipse and Window Builder Pro -

i using eclipse helios window builder pro plugin swing designing . makes eclipse horribly unstable. have negative experiences gwt designer same company. it happens randomly , lot. eclipse changes process state "sleeping". on ubuntu 10.10, had problems on windows 7. does have same problems , possibly solution how teach plugins behave? if not, please suggest free popular swing designer eclipse 3.6 (not myeclipse or older eclipse). quite liked matisse @ netbeans. have tried reporting problem on windowbuilder forum? stackoverflow great , all, no substitute going directly software maker when running problems. http://forums.instantiations.com/viewforum.php?f=14

css - Simple way to have a different stylesheet for mobile, screen, and print -

i have 1 webpage want pull different stylesheets print, mobile, screen, etc. i have screen , print working perfectly. have 2 different stylesheets mobile - 1 modern smartphones (iphone/android), 1 blackberries. they're called mobile.css , blackberry.css respectively. how can have page load mobile stylesheet when iphone/android accesses page, , blackberry stylesheet when blackberries load page? using max-width: 480px work, force mobile stylesheet upon blackberry (whose screen 480px wide), undesired behavior. any help? for printing: <link rel="stylesheet" href="print.css" media="print"> for targetting blackberry specifically, may have user-agent sniffing.

JavaScript validator throws NullPointerException in Eclipse -

i'm coding php files on eclipse ide, , keep getting error says "building workspace has encountered problem" -- workspace name of project area. when click on "details" link this errors occurred during build. errors running builder 'javascript validator' on project 'ullman'. java.lang.nullpointerexception as mentioned, i'm working in php don't know why it's trying set javascript validator. can't figure out how stop doing these things. know? i'm not experienced, please provide detailed answer if can. project->properties->builders disable 'javascript validator http://blindcoder.wordpress.com/2011/03/04/javascript-validator-problem-in-eclipse/

windows - call in BATCH doesnt work -

i have created file called a.bat call echo. > outfile call dup.bat file1 outfile 7 call more file2 >> outfile call dup.bat file1 outfile 10 when execute output is c:\>a c:\>call echo. 1>outfile c:\>call dup.bat file1 outfile 7 c:\> i don't understand why stops excution after executing first batch the batch answer question how loop in batch? the dup.bat @echo off set infile=%1 set outfile=%2 set times=%3 rem if exist %outfile% del %outfile% /l %%i in (1,1,%times%) ( call more %infile% >> %outfile% ) maybe silent exception being thrown? how catch it? any ideas? i think works: execution not stop, echo stops! please check output file outfile , verify contents. reason not see last 2 lines of a.bat dup.bat turns echo off…

activerecord - Rails 3.0.3 Rails.cache.read can't write to DB -

i playing around rails 3 rails.cache feature , when write activerecord entry cache, cannot read back, change attributes write database. "typeerror: can't modify frozen hash". used use memcache plugin, i'm trying switch on heroku, , it's incredibly annoying cannot save activerecord entries throw memcache. result in lot of unnecessary db reads change small bits of information. for example, might in database. assuming user model is: user -> login:string , typing following rails c user = user.new user.login = 'test' user.save rails.cache.write('user:login:test', user) user2 = rails.cache.read('user:login:test') user2.login = 'test2' typeerror: can't modify frozen hash /app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods/write.rb:26:in `[]=' /app/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/attribute_methods/write.rb:26:in `write_attribute' /app/.bundl...

oracle - min function in PL/SQL -

i want choose min value in 2 date ,such c := min(a,b); it occupy compiler error : error(20,10): pls-00103: encountered symbol "," when expecting 1 of following: . ( ) * @ % & - + / @ mod remainder rem || multiset i know can use aggregate function min in sql. dan't whether there similar func can use pl/sql? in plsql, least function returns smallest value in list of expressions.

floating point - PHP not parsing 1000, 10000, 100000, etc. **Fixed** -

i using following code take html $_post vars [type:text] representing min & max price, sanitize , strip "$" , ",", commit them $_session , use them mysql query against data in column of type "float". code follows... //the locale i'm using setlocale(lc_all, 'en_us.utf8'); //the minimum price handled //sanitized post var session var $_session['minprice'] = filter_var($_post['minprice'], filter_sanitize_stripped); // strip currency symbol , commas $_session['minprice'] = str_replace(array(',','$'),array('',''),$_session['minprice']); //session var local float var sql query $minprice = floatval($_session['minprice']); //the same done maximum price //sanitized post var session var $_session['maxprice'] = filter_var($_post['maxprice'], filter_sanitize_stripped); // strip currency symbol , commas $_session['maxprice'] = str_replace(array(...

c - Only one write() call sends data over socket connection -

first stackoverflow question! i've searched...i promise. haven't found answers predicament. have...a severely aggravating problem least. make long story short, developing infrastructure game mobile applications (an android app , ios app) communicate server using sockets send data database. end server script (which call bes, or end server), several thousand lines of code long. essentially, has main method accepts incoming connections socket , forks them off, , method reads input socket , determines it. of code lies in methods send , receive data database , sends mobile apps. of them work fine, except newest method have added. method grabs large amount of data database, encodes json object, , sends mobile app, decodes json object , needs do. problem data large, , of time not make across socket in 1 data write. thus, added 1 additional data write socket informs app of size of json object receive. however, after write happens, next write sends empty data mobile app. the odd t...

html - How to upload a file using javascript -

i have form want able upload several files, , files appear in textarea tag right underneath. how upload files using javascript? the easy path go plugin. here upload plugin jquery library.

Android Twitter integration -

hello friends have ingrate x auth android apps using xauth, body have idea x auth code twitter integration , if body have twitter xatuh demo apps , plz send me. twitter provide cosumer key , secreat key of xauth testing pupose. thanks in advance have @ zwitscher , this. users asked credentials in loginactivity::loginxauth , twitterhelper::generateaccount() checks validity against twitter , stores resulting token.

iphone - becomeFirstResponder slows down app -

i have 2 textfields username , password , submit button. when submit button pressed check performed see if username , password typed or not. if not shows alert message , field value not entered becomes first responder. -(ibaction)loginpressed:(id)sender { if ([username.text length] == 0) { [self showalert:@"invalid username/ password"]; [username becomefirstresponder]; return; } if ([password.text length] == 0) { [self showalert:@"invalid username/ password"]; [password becomefirstresponder]; return; } } i observed on clicking button, button remains selected 1.5 seconds , alert shown. if comment out becomefirstresponder method, works without pause. need becomefirstresponder there. how speed things using this? switch ordering of becomefirstresponder , showalert.

html - Why does Opera resize email input fields? -

here code: jsfiddle . i've tested in latest versions of chrome, opera, ff, , safari. seems appear fine except opera. seems if opera resizes email input field because when change text, works out fine. there fix this? edit: using opera v11.01 on mac os x 10.6.7 i'm not aware of says default style email input should have same width default style text input, , you're not explicitly asking other browser's default style.

tsql - Conditional Insert -

i want fill temporary table on happening of condition, if select statement return result statement, else statement fill table e.g; if exists(select name table name='zain') insert #table(name) --values above select statement else if exists(select name table name='ali') insert #table(name) --values above select statement one way is: insert #table (name) select name table name='zain' if (@@rowcount = 0) begin insert #table (name) select name table name='ali' end

message driven bean - Wrong Spring AppContext found in EAR -

i have ear multiple mdbs in it. each mdb jar has own application context. when message arrives can see logging appropriate mdb initialises, obtains application context different mdb! i thought each ejb should have it's own classloader. seems doesn't. how can enforce each mdb load own app context? i using websphere 7. my project structure is: meta-inf/ meta-inf/manifest.mf topicreader-ejb-mdb01.jar topicreader-ejb-mdb02.jar lib/ lib/3rdpartylib01.jar lib/3rdpartylib02.jar ... etc the content of mdb jars is: applicationcontext.xml com/mycompany/ ... (classes) meta-inf/ejb-jar.xml meta-inf/manifest.mf in can change classloader order wars!!, hope can same jars. normaly class loader order "parent first". try "parent last".

ruby on rails - Validation errrors: how to get rid of "Validation failed: "? -

whenever do rescue exception => e flash[:error] = e.message the e.message contain "validation error:" string , object example: validation failed: price "message:", price "message" how tell rails want message? , not other parts of validation error displayed? you can data want #errors attribute of model trying save. there potentially multiple validation errors (not one). see http://api.rubyonrails.org/classes/activemodel/errors.html

analytics - Stop word removal in Javascript -

hi looking library that'll remove stop words text in javascript , end goal calculate tf-idf , convert given document vector space, , of javascript . can point me library that'll me that.just library remove stop words great. i think there no libraries such think, need download words http://www.ranks.nl/resources/stopwords.html . , replace written in comments text = text.replace(stopword, "")

c# - How to fix "Configuration system failed to initialize/Root element is missing" error when loading config file? -

i got error in c# windows application: "configuration system failed initialize". it working fine. got exception. shows inner exception detail "root element missing". (c:\users\company\appdata\local\clickbase_corp_sverige_ab\touchstation.vshost.exe_url_no1nets4fg3oy2p2q2pnwgulbvczlv33\1.1.0.12\user.config)"}.this happens when try values settings.cs class. in program.cs file below code written if (properties.settings.default.callupgrade) { properties.settings.default.upgrade(); properties.settings.default.callupgrade = false; properties.settings.default.save(); } and calls settings.cs class below code throws above exception [global::system.configuration.userscopedsettingattribute()] [global::system.diagnostics.debuggernonusercodeattribute()] [global::system.configuration.defaultsettingvalueattribute("true")] public bool callupgrade { ...

ruby - Sinatra and session variables which are not being set -

for reason, session variables not being set in app. using sinatra 1.2.1. here piece of code: module gitwiki class app < sinatra::base configure enable :sessions set :app_file, __file__ set :root, file.expand_path(file.join(file.dirname(__file__), '..', '..')) set :auth |bool| condition redirect '/login' unless logged_in? end end end helpers def logged_in? not @user.nil? end end error pagenotfound page = request.env["sinatra.error"].name redirect "/#{page}/edit" end before content_type "text/html", :charset => "utf-8" @user = session[:user] end "/login/?" erb :login end post "/login" user = user.get if user.authenticate(params[:username], params[:password]) session[:user] = params[:username] p session # =...

flex - Mxmlc generates different binary on same source -

i'm compiling single .as file swf using mxmlc. whenever run mxmlc, results different in size when source code not changed. for example, // test.as package { public class test { } } and generates .swf using mxmlc : mxmlc test.as and result size differs 461 465 bytes. i suppose it's because of timestamp-like things in compiler, not find how fix or disable that. ideas on generating "same binary same source" ? thanks! finally, found metadata tag (tag type = 77) , undocumented 'product info' tag (tag type = 41) both contains compliation time. i succeeded remove timestamps following steps : 1. open swf , un-zlib 2. clear timestamps in metadata tag , product info tag 3. re-zlib , make new .swf but i'm not happy that, needs work on swf file. want find easier way. there may 'bypass product info' option on mxmlc.. you can find more information on swf file structure , metadata tag on http://www.adobe.com/devnet/s...

java - Android: Null Pointer Exception at Text View -

here code face exception public class shosuper extends activity{ string officername; string arr[]; string[] offn; public void oncreate(bundle savedinstancestate) { try{ super.oncreate(savedinstancestate); final textview tv; tv=(textview)findviewbyid(r.id.txt1); system.out.println("i new activity"); arr=receiver.split(receiver.orignal, ","); string value1= arr[1]; system.out.println("array index " + value1); string value2=arr[2]; system.out.println("array 2nd index " + value2); tv.settext(value1 + " @ " + value2); officername= arr[5]; offn =new string[officername.length()]; offn=receiver.split(officername, "_"); } catch(exception e){ e.printstacktrace(); } setcontentview(r.layout.main); } } on line tv.settext(value1 + " @ " + value2); face null pointer exception this **04-12 1...

c++ - What to watch out for when converting a std::string to a char* for C function? -

i have read many posts asking question on how convert c++ std::string or const std::string& char* pass c function , seems there quite few caveat's in regards doing this. 1 has beware string being contiguous , lot of other things. point i've never understood points 1 needs aware of , why ? i wondered if sum caveats , downfalls doing conversion std::string char* needed pass c function? this when std::string const reference , when it's non-const reference, , when c function alter char* , when not alter it. first, whether const reference or value doesn't change anything. you have consider function expecting. there different things function can char* or char const* ---the original versions of memcpy , example, used these types, , it's possible there still such code around. is, hopefully, rare, , in following, assume char* in c function refer '\0' terminated strings. if c function takes char const* , can pass results of std:...

Editor generator for ANTLR grammars? -

i'm using antlr creating new general purpose programming language , i'm quite happy it. due fact provide tools ease development of programs written language i'm starting thinking on realising editor language through proper eclipse plugin. is there tools/project allow have fully-fledged editor (with syntax highlighting, code completion, etc.). know xtext allow in automatic, antlr? i've seen this mail antlr mailing list has no answers i'd give xtext try. not provide features of antlr on grammar level, framework offers great infrastructure components such tight integration eclipse modeling components , eclipse ui.

date - How to add part of time in Android -

i have code returning me string (hh:mm). simpledateformat curformater = new simpledateformat("yyyy-mm-dd hh:mm:ss"); java.util.date dateobj; try { dateobj = curformater.parse(start); simpledateformat postformater = new simpledateformat("hh:mm"); string newdatestr = postformater.format(dateobj); startview.settext(newdatestr); emission_start = newdatestr; } catch (parseexception e) { // todo auto-generated catch block log.d(" * error", e.tostring()); } it works great... right to: add x (is dynamically provided) minutes (x = 5 1000 minutes) , transform time (example time:3:45, add 25 minutes, transform time 4:10) get current time , calculate difference between current time , time step 1 (4:10) get time difference (from step 2) in minutes! thanks help! i haven't tested, should work: long newdate = dateobj.getti...

string - VB6: CDate(some date) returns runtime error 13 -

hi, i have string: "2010-12-27 23:05:36.0". when parse cdate this: cdate("2010-12-27 23:05:36.0") returns error 13. when remove '.0' string working fine. the date string comes database there mixture of dates formatted this: 'yyyy-mm-dd' , 'yyyy-mm-dd hh-mm-ss.n' easy way rid of error 13? you check string length -> if >19, rid of rest , apply cdate function

c# - Is there any sense or organisation to the Umbraco .Net namespaces? -

umbraco has variety of namespaces, however, seem ill-organised , complicated. for instance, what's difference between umbraco.businesslogic and umbraco.cms.businesslogic is there behind way they're organised? off top of head, umbraco.businesslogic = business logic whole application while umbraco.cms.businesslogic = business logic powering umbraco backend admin section, acting facade umbraco.businesslogic authorization, etc thrown in. when think it, makes sense because of how more complicated administration section is, compared actual site application present (just url rewrite lookup against xml/db , combining bunch of xslt/controls/masterpages/contents/etc).

cocoa touch - How to create a simple app that displays weather details -

i want create simple weather app displays weather details 3 consecutive days. when click on weather tab weather details 3 consecutive days should shown on table view. how possible? can provide me links regarding problem? thanks. u can use google api weather detail please have on google api

background - Android: create custom bar -

i saw this bar in iphone gui psd collection , want add in android application. created transparent png image (for shadow) , use png tiled background layout: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/tile" android:tilemode="repeat" /> of course works... question how make resizable? want draw different labels using layouts (with different text size)...so has have wrap_cotent height. possible? please, help... try accepted answer here: set 2 titles?

rollback - Deleted DB re Populate in MySql -

i in deep trouble.. i have lost db mistake have deleted db mysql db, so me in getting rollback of it. please help the simplest solution execute recent backup.

javascript - center on resize too -

this works: $.fn.center = function () { this.css("position", "absolute"); this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrolltop() + "px"); this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollleft() + "px"); return }; $('#container').center(); .. element stays in same position if window resized, how center resize too? thanks you need execute code in window resize event. but, if browser resized event fires huge! it's in general idea create little "balancer". $(window).bind('resize', function() { var = this; if(!('balancer' in that) ) { that.balancer = settimeout(function() { $('#container').center(); delete that.balancer; }, 200); } }); this absorb many events fired when resizing browser window. in fact, calls .center() @ maximum of 200...

javascript - show page as a popup -

is there solution when acces normal page loaded in popup if user has javascript activated? so,can make normal page popup? using jquery plugin example? thank you! yes, sure can have pages popup when js active. check jquery bpopup plugin . it's simple implement, , quite interesting in features. thanks.

jquery - CSS - Target background image in DIV -

i'd target background-image of div can apply 'glow' style when div hovered over. see fiddle exmaple of current setup , how i'm attempting (albeit, targeting div , not image in div). is possible? if so, how :) ..if not, how might change html/css give same visual effect see in fiddle allow image have 'glow' apply it? thanks in advance. a background image binary data. can't manipulate contents using css. the way to, on hover, switch image file has glow around arrow graphic: .collapsible { background-image: url('/arrow_mini_up.png'); background-repeat: no-repeat; background-position: right; } .collapsible:hover { background-image: url('/arrow_mini_up_glow.png'); } even if use data uri, it's same thing: need specify 1 background image default state , hover state: .collapsible { background-image: url('data:image/png;base64,a0giftt6...'); background-repeat: no-repeat; background-p...

php - Camouflage product id's on website -

i'm building retail e-shop jewellery manufacturer sells wholesale other shops , i'm looking efficient way "hide"/"camouflage" product id's products other competitors wont able see product's barcodes , find out manufacturer doing direct sales @ lower prices. all products on website have 4-5 digit id name of products' images, ie product #1234 image filename 1234.jpg one thought add 3-digit random int before , after product id make quite hard figure out product id. thought reverse id's or perform sort of scrambling. work fine links within site , i'd have strip off first , last 3 digits off product id's or de-scramble before using in queries can when comes displaying product images? don't want visitors able see filenames, blow cover ll product id's. suggestions , ideas welcome. you shouldn't allow direct access images that. instead, use php wrapper translates fake product id actual image file , return that. ...

python - Transfer Ipython namespace to ipdb -

i in middle of ipython session. i've loaded module foo contains function foo.bar . while working, notice foo.bar gives weird output when feed input x , x variable in local ipython scope. investigate behavior in debugger. how set breakpoint @ foo.bar , run foo.bar(x) in debugger? i know pdb.set_trace() , require me open code of foo module insert breakpoint manually, save it, reload module in ipython, etc. there has better way. i believe can use pdb.runcall in case: import pdb pdb.runcall(foo.bar, x)

c# - What is the downside of TableAdapterManager? -

i using tableadaptermanager updating data. when want save function window freezing. problem? you can use backgroundworker avoid "window freezing". useful if have lots of data load.

java - Spring Security URL pattern configuration -

this 1 should quite simple. i've been stuck while. i'm trying implement spring security in web application. by default, url's should publically accessible. except following: /nl/favorieten/ /fr/favorites/ i've tried several things, ending following: <http auto-config="true" access-denied-page="/login"> <intercept-url pattern="/*/favori*" access="is_authenticated_fully" /> <intercept-url pattern="/**" access="is_authenticated_anonymously" /> <form-login always-use-default-target="true" login-page="/login" default-target-url="/" authentication-failure-url="/login?login_error=1" /> <logout invalidate-session="false" logout-url="/logout" /> </http> obviously without success. i've tried combination of regex, ordering rules, changing roles. nothing seems redi...