Posts

Showing posts from February, 2011

python - How can I continuously check the hour within a while loop? -

this first post , first project in python. i'm trying control hardware sensor through number of conditions: if sensor senses movement, send e-mail , sleep elif time range not between work hours, sleep until 9am else sleep half second , wait sensor so far first condition , last condition work. is, if there no movement, repeat sleep(0.5) until sensor activates. issue: i'm having trouble middle portion time not between 9-5. if run code before 9 or after 5, sleeps until 9am arrives intended, if code running between 9-5 (waiting movement), middle condition never triggers. gets stuck on sleep(0.5). i'm not experienced have vague idea second process should keep track of time. suggestions? here code. def pir_init(): while true: m = datetime.datetime.now().time().minute #loop through current time h = datetime.datetime.now().time().hour if h < 9: print("sleeping...&quo

php - How to properly enable the twig's sandbox extension in Symfony2? -

in symfony2, there twig module disabled default. 1 of them debug extension, adds {% debug %} tag (useful on development environment). to enable it, nothing difficult, add service configuration : debug.twig.extension: class: twig_extensions_extension_debug tags: - { name: 'twig.extension' } but how enable {% sandbox %} tag? my issue extension's constructor takes security policies : public function __construct(twig_sandbox_securitypolicyinterface $policy, $sandboxed = false) { $this->policy = $policy; $this->sandboxedglobally = $sandboxed; } by reading twig documentation , seen way natively (without symfony2) : $tags = array('if'); $filters = array('upper'); $methods = array( 'article' => array('gettitle', 'getbody'), ); $properties = array( 'article' => array('title', 'body'), ); $functions = array('range'); $policy = new twig_san

ios - UISegmentedControl won't change value -

i trying create uisegmentedcontrol programatically. have uiviewcontroller in storyboard nothing in it. .h file uisegmentedcontrol *segmentedcontrol; nsstring *feedbackbuttontitle; nsstring *contactsbuttontitle; and here property declarations. @property (nonatomic,retain) iboutlet uisegmentedcontrol *segmentedcontrol; -(void) segmentedcontrolindexchanged; in viewdidload: have initalized , added uisegmentedcontrol . nsstring *language = [[nslocale preferredlanguages] objectatindex:0]; if ([language isequaltostring:@"en"]){ contactsbuttontitle = [[[configfiledictionary objectforkey:@"contacts"] objectforkey:@"label"] objectforkey:@"en"]; feedbackbuttontitle = [[[[[configfiledictionary objectforkey:@"contacts"] objectforkey:@"contact"]objectforkey:@"feedback"]objectforkey:@"label"]objectforkey:@"en"]; } else if([language isequaltostring:@"fr"]){ contactsbutt

How to I show a list of ForeignKey reverse lookups in the DJango admin interface? -

i have couple of models: class customer(models.model): customer_name = models.charfield(max_length=200) def __unicode__(self): return self.customer_name class meta: ordering = ('customer_name',) class unit(models.model): unit_number = models.integerfield() rentable = models.booleanfield() owner = models.foreignkey(customer, related_name='units', blank=true, null=true) def __unicode__(self): return str(self.unit_number) class meta: ordering = ('unit_number',) i have admin interface working fine when i'm adding unit (i can select customer assign to) when go create/edit customer in django admin interface, doesn't list units choose from. how can enable lookup in section match 1 in create/edit customer area? by default, modeladmin let manage model "itself", not related models. in order edit related unit model, need define "inlinemodeladmin" - such admin.t

ios - UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: but I do -

i dont understand this: cellforrowatindexpath: indexpath: returns proper uitableviewcell. (i have assertion effect not nil , trace prove it) but stil getting sporadic exception? this how allocate / reuse cell: ... { uitableviewcell *cell = [tv dequeuereusablecellwithidentifier: cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle: uitableviewcellstyledefault reuseidentifier: cellidentifier] autorelease]; cell.selectionstyle = uitableviewcellselectionstylenone; } assert(cell); // (code populate cell) // ... assert( cell != nil); nslog(@"returning cell %@ type %@", cell, nsstringfromclass([cell class])); // edit: showing actual return value return cell; } the crash looks in log: 2013-04-17 16:46:05.323 .. -[someeditviewcontroller tableview:cellforrowatindexpath:] returning cell <uitableviewcell: 0x20d1a2e0; frame = (0 351; 320 43); hidden = yes; autoresize = w;

Reassign MongoDB _id in shell -

i'm trying use mongodb reassign ids. however, not setting ids equal value assign, rather creating new objectid. how assign own id? > db.pgithub.find(); { "_id" : objectid("516f202da1faf201daa15635"), "url" : { "raw" : "https://github.com/quatlus", "domain" : "github.com", "canonical" : "https://github.com/quatlus" } } { "_id" : objectid("516f202da1faf201daa15636"), "url" : { "raw" : "https://github.com/quasii", "domain" : "github.com", "canonical" : "https://github.com/quasii" } } > db.pgithub.find().foreach(function(myprofile) { var oldid = myprofile._id; myprofile._id = 'exampleid'; db.pgithub.save(myprofile); db.pgithub.remove({_id: oldid}); }); > db.pgithub.find(); { "_id" : objectid("516f204da

mysql - SQL select the available rooms by date cheking -

i have in database table called rooms contain rooms information , property ,and table called reservation table contain room reserved, fromdate , todate . what want make user pick room size want reserve , pick date reserving room ,then provide him available rooms depend on room reservation table. here did: select * rooms,reservations rooms.r_size = 'roomsize' , ('4/19/2013' not between reservation.fromdate , reservation.todate , '4/19/2013' not between reservation.fromdate , reservation.todate) the problem return me duplicate's rooms , if between reserved date in specific reservation not between reserved date in reservation still return me. what want check if room reserved @ same or between specif date , if don't want selected , returned @ all. thanks.. , sorry poor english there 2 problems query. 1 there no condition on join between rooms , reservations, such rooms of correct size returned once each reservation satisfying da

c++ - The difference between QDataStream and QByteArray -

qtemporaryfile tf; tf.open (); qdatastream tfbs (&tf); tfbs << "hello\r\n" << "world!\r\n"; const int pos = int (tf.pos ()); qbytearray ba; ba.append ("hello\r\n"); ba.append ("world!\r\n"); const int size = ba.size (); basically question is, doing wrong? why pos > size? should not using << ? should not using qdatastream? edit: there way configure qdatastream or qtemporaryfile << operator doesn't prepend strings 32bit lengths , store null terminators in file? calling qdatastream::writebytes when have series of quoted strings , qstrings makes ugly code. the answer in docs. i'm not going go on qbytearray, believe it's obvious working expected. the qdatastream operator<<(char*) overload evaluates the writebytes() function . this function outputs: writes length specifier len , buffer s stream , returns reference stream. len serialized quint32, followed len bytes s. note d

java - How to stop ProGuard from stripping the Serializable interface from a class -

is there explicit way stop proguard changing class implementing interface? i have class implements java.io.serializable , let's call com.my.package.name.foo . i've found after running through proguard, no longer implements serializable . null after cast serializable foo , false if check instance instanceof serializable . i've made sure set proguard ignore class: -keep class com.my.package.name.foo i've tried: -keep class com.my.package.name.foo { *; } and i've tried whole package doing this: -keep class com.my.package.name.** { *; } or: -keep class com.my.package.** { *; } and keep serializable classes: -keep class * implements java.io.serializable { *; } but no avail. have class in sibling package (roughly: com.my.package.name2.bar ) implements serializable , used has no issues. i'm not sure it's relevant, i'm packing in jar use android. code uses these classes include putting them in bundle s why need serializable . co

iphone - How to draw a triangle programmatically -

i have triangle solver, want way use values answer draw triangle screen matches it. if subclass uiview can implement in drawrect draw triangle: -(void)drawrect:(cgrect)rect { cgcontextref ctx = uigraphicsgetcurrentcontext(); cgcontextbeginpath(ctx); cgcontextmovetopoint (ctx, cgrectgetminx(rect), cgrectgetminy(rect)); // top left cgcontextaddlinetopoint(ctx, cgrectgetmaxx(rect), cgrectgetmidy(rect)); // mid right cgcontextaddlinetopoint(ctx, cgrectgetminx(rect), cgrectgetmaxy(rect)); // bottom left cgcontextclosepath(ctx); cgcontextsetrgbfillcolor(ctx, 1, 1, 0, 1); cgcontextfillpath(ctx); }

arrays - What does java.lang.ArrayIndexOutOfBoundsException mean? -

i new java , today started work on arrays , i'm lost. trying put values in array i'm getting error java.lang.arrayindexoutofboundsexception . here have done far. int n=6; int[]a= new int [1]; for(i=0;i<n;i++){ a[i]=keyboard.nextint(); } java.lang.arrayindexoutofboundsexception means trying access array index doesn't exist. the problem array of size one.however, going through loop 6 times. can either make n equal one, or increase size of array.

python - with open (name,"rb") as f need not close am i right? -

i notice can open file this: f=open("a.dat","rb") and method: with open("a.dat","rb") f: in opinion, if use first one, must call f.close() function, while second method need not. right? or there better method? 1 best open file in python? thanks;-) yes, not need close file handled with block. if exception occurs before end of block, close file before exception caught outer exception handler. since python 2.5 (when with statement introduced) using with statement file operations preferable way.

java - primitives vs wrapper class initialization -

what difference between declaring int's below. cases suits usage of different types int = 20; integer = 20; integer = new integer(20); please note : have goggled , found first going create primitive int.second going carry out auto boxing , third going create reference in memory. i looking scenario explains when should use first, second , third kind of integer initialization.does interchanging usage going have performance hits thanks reply. the initialization in 1st case simple assignment of constant value. nothing interesting... except primitive value being assigned, , primitive values don't have "identity"; i.e. "copies" of int value 20 same. the 2nd , 3rd cases bit more interesting. 2nd form using "boxing", , equivalent this: integer = integer.valueof(20); the valueof method may create new object, or may return reference object existed previously. (in fact, jls guarantees valueof cache integer values numb

java - Is there any tool to generate a String from a JSON? -

my doubt if there tool on-line or not generate string json. example, have json: { "my_json": [ { "number": 20, "name": "androider", }, { "id": 3432, "name": "other_name", } ] } if want declare string in code values, have write many quotation marks have json in string acceptable format. so want know if thre tool generate string? some choices are: jackson gson they have built in methods whatever need in efficient way...

drupal 7 - FFMPEG+video+video.js dont show up the video -

Image
i have video content type want show video user. downloaded video module , video.js purpose. have installed ffmpeg transcoder in apache serv now go admin/config/media/video. withing players tab select html5 player mp4 video , video.js run html5 video below:- now go video content type , add video field video upload type , save it.the video converted after clicking on play button nothing happens. need in this.

asp.net - Programmically set JWPlayer to play file from database -

i have querystring on page load use filename , thumbnail image jwplayer. not getting filename or thumbname, however. there must reasson why can't on aspx page, vb code behind.see code: code behind (vb): protected sub page_load(sender object, e system.eventargs) handles me.load dim videoname string = request.querystring("filename") dim thumb string = request.querystring("thumb") end sub and need these string variables .aspx page jwplayer script, not .aspx: <div id='container'></div> <script type="text/javascript" src="~/player/jwplayer.js</script> <script type="text/javascript"> jwplayer("container").setup({ file: videoname, flashplayer: '~/player/player.swf', volume: 35, width: 480, height: 270, skin: '~/player/skins/skin.zip', image: thumb,

permission is not working in Broadcast in android -

here have registered .reciever_ <receiver android:name=".reciever_" android:permission="com.paad.my_broadcast_permission"> <intent-filter > <action android:name="com.paad.action.new_lifeform_"/> </intent-filter> </receiver> and want use android:permission in code not working . i using permission in code string requiredpermission = "com.paad.my_broadcast_permission"; i want send ordered broadcast . sendorderedbroadcast( new intent("com.paad.action.new_lifeform_") , requiredpermission ) ; program control not going inside onrecieve() method ? check below link same problem.... how set permissions in broadcast sender , receiver in android in manifest of broadcast sender, new permission should declared: <permission android:name="com.paad.my_broadcast_permission"></permission> <uses-permission android:name="com.paad.my_broad

datetime - Time data in R for logged durations in H M S format (but H can be > 24) -

i have data set this: > dput(data) structure(list(run = c("dur 2", "dur 3", "dur 4", "dur 5", "dur 7", "dur 8", "dur 9"), reference = c("00h 00m 32s", "00h 00m 31s", "00h 05m 46s", "00h 03m 51s", "00h 06m 49s", "00h 06m 47s", "00h 08m 56s" ), test30 = c("00h 00m 44s", "00h 00m 41s", "00h 21m 54s", "00h 13m 37s", "00h 28m 48s", "00h 22m 54s", "10h 02m 12s"), test31 = c("00h 00m 39s", "00h 00m 45s", "00h 40m 10s", "00h 23m 07s", "00h 35m 23s", "00h 47m 42s", "25h 37m 05s"), test32 = c("00h 01m 05s", "00h 01m 13s", "00h 55m 02s", "00h 28m 54s", "01h 03m 17s", "01h 02m 08s", "39h 04m 39s")), .names = c("run", "refer

grails - Parameter #1 is not set error -

i got error grails query. had class user: class user { string username string passwordhash static hasmany = [roles: role, permissions: string, clients: user, owners: user] } when query: def addclient() { def principal = securityutils.subject?.principal user currentuser = user.findbyusername(principal); if (request.method == 'get') { user user = new user() [client: currentuser, clientcount: user.countbyowners(currentuser)] } } grails that: parameter "#1" not set; sql statement: select count(*) y0_ user this_ this_.id=? [90012-164] why? looks currentuser null . btw, wonder, why count owners, specify user owners? according hasmany definition, owners collection.

jquery - Calculate div max-height using javascript -

i have div is, hypothetically sandwiched between many elements , on sidebar. need calculate how space there between div , element below it. , set max-height of div it's current height plus space below, never extends past (thus extending page). initial max-height, small value, should changed js. so, basically: <thing></thing> <div id="mydiv"></div> <another></another> and need (jquery example): var spacebelow = space between mydiv , <another> var daheight = (currentheight + spacebelow); $("#mydiv").attr("style", "max-height:" + daheight + "px"); is there anyway this? i think want :- var divoffset=$(#divid).offset(); var divanotheroffset=$(#divanotherid).offset(); var spacebelow =divanotheroffset.top-divoffset.top; var currentheight =$(#divid).height(); var daheight = (currentheight + spacebelow); //set max-height:- $("#mydiv

php - User still online after closing page -

i'm working php login script. (and have stupid beginner question) plan log off users cookie after 1 hour. but if user didn't press logout button user stayed online (on database table there keeps record open on mysql db) when deleted record goes fine , user can login. could me out? need let script delete session or else? solution: problem needed delete (make sure) user login data deleted before users wants login again. made small script deletes open session user if want login. after stopped using own code. using codeigniter , works good! indeed, that's way sessions typically work. once page loaded, there's no connection between browser , server anymore. basically, once page has finished loading , sitting there in browser, it's same if user had closed window. there's no way 100% reliably detect whether user still "online" or not. you'd have have javascript send constant heartbeat that, comes down timeouts . if have not seen user

android - Fit html page text to the window width -

hi have website designed mobile devices. i use webview in application show website. when user zooms text, horizontal scroll bar. instead, want that, text in page, should wrap next line , text should fit screen width. what html5, css3 properties should used wrap text fit in screen of mobile? on apple site says the user can zoom in , out using gestures. when zooming in , out, user changes scale of viewport, not size of viewport. consequently, panning , zooming not change layout of webpage. figure 3-8 shows same webpage when user zooms in see details. so think it's not possible, unless can manipulate scale

Flot xaxis ticks exceeds the specified number -

i'm new flot, understanding of ticks number of columns flot draw on chart. as labels quite long, having 6 ticks fits nicely. times, exceeds number set, , screws labels. i assume has flot's algorithm? there way can fix 6 columns? a simplet of how set it. xaxis: { mode: 'time', timeformat: "%y/%m/%d %h:%m:%s", tick:6 }, the ticks option guideline. flot tries match value, first priority choose 'round' values, i.e. 5:00 instead of 5:01. there several ways work around this, depending on data. guaranteed solution calculate 6 tick values manually, , provide them flot in 'ticks' array option. besides that, may able coax flot generating correct number of ticks adjusting minticksize , axis min/max.

javascript - Could someone explain this code for me? window.clientTimeDivergence = (1366265216 * 1000) - (new Date).getTime(); -

window.clienttimedivergence = (1366265216 * 1000) - (new date).gettime(); i want know changing value 1366265216 means; , whole expression means. thanks all! (new date()).gettime() gives present time in milliseconds , 1366265216 appears time in seconds being converted milliseconds subtract resultant (new date()).gettime() . by way, u missing () in (new date).getdate(); plus, u can check var date = new date(1366265216) or var date = new date(1366265216*1000) find out date/time out of 1366265216 .

php - Allowed memory size error in magento -

i have create php file name "category-set.php" , call in magento admin panel under iframe. when open file using admin panel generate error --- fatal error: allowed memory size of 1073741824 bytes exhausted (tried allocate 268435476 bytes) in /var/www/html/category-set.php on line 111. have set memory_limit = 1024m in php.ini file, problem not solved. please me. edit <?php function res($cur_category,$s){ $children_categories = mage::getmodel('catalog/category')->getcategories($cur_category->getid()); $s.= $s; foreach($children_categories $child){ //$childcat = mage::getmodel('catalog/category')->load($child->getid()); $name = $child->getname(); $option.='<option value="'.$child->getid().'">' .$s .$child->getname(). "</option>"; //$option.=res($childcat,$s); $option.=res($child,$s); } un

c - What happens to a function's stack when it returns? -

this question has answer here: returning local data functions in c , c++ via pointer 13 answers returning address of local variable [duplicate] 3 answers #include <stdio.h> void function() { int stackvar = 10; printf("stack variable = %d\n", stackvar); } int main(void) { function(); return 0; } what happens stack frame of function when returns? firstly, you've edited question dramatically, other answers (somewhat unfairly) no longer relevant. still, answer current question: what happens stack frame of function when returns? it seems me lack general feel how stack operates. - going bit crazy here - try analogy might make "click". can imagine stack frame being waves on beach. more nested function calls get, ,

c# - How do I maintain the selected item in GridView DropDownList -

my problem not able retain item in gridview after gridview_rowediting event. <asp:templatefield headerstyle-cssclass="gridheading" headertext="get alerts sms" itemstyle-cssclass="gridvalue" itemstyle-horizontalalign="center"> <itemtemplate> <asp:label id="lblalertbysmsgeofence" runat="server" text=' <%# (convert.toboolean(convert.toint32(eval("alertbysms")))) ? "yes" : "no" %>'></asp:label> </itemtemplate> <edititemtemplate> <asp:dropdownlist id="ddlalertbysmsgeofence" runat="server" appenddatabounditems="true" cssclass="gridvalue"> <asp:listitem text="yes" value="1"/>

html5 - How to remove default border of button in jquery mobile? -

Image
how remove default border of button in jquery mobile? declare <a> tag button, custom background images below: <a id="btnlogin" href="../main/mainx.html" data-role="button" data-corner="false"> login</a> <a id="btnsignup" href="../singup/signup.html" data-role="button" data-corner="false"> sign up</a> css: a{ width: 265px; height: 38px; margin-left: auto; margin-right: auto; margin-top: 5px; border: 0px; border-color: transparent; display: box; text-transform: none; text-shadow: none; } #loginpage .ui-btn-inner{ padding-top: 11px; } #loginpage #btnlogin{ background: transparent url(../../res/img/login_btn.png) no-repeat; background-size: 100% 100%; color: #fff; } #loginpage #btnlogin:hover{ background: transparent url(../../res/img/login_btn_over.png) no-repeat; background-size: 100% 100%; } #loginpage

android - What is difference between custom dialog and activity as dialog means "Theme.Dialog"? -

here question real difference between custom dialog , activity made theme dialog , opening dialog, have used both of these, of small difference understand follows coding remains in other file in activity , in same file in custom dialog(if haven't created new class file dialog), activity stays in activity stack, while dialog not. is there other difference? y need custom dialog in place of activity dialog , visa versa, my current problem when click on listitem , opens new activity (as dialog here), , when press button , click again on item "stops unexpectedly", , couldn't understand error, error below 04-18 12:21:18.945: e/androidruntime(915): fatal exception: main 04-18 12:21:18.945: e/androidruntime(915): java.lang.illegalstateexception: content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. [in listview(2131230777, class android.widget.listview) adapter(class com.lo

dart - Can not run unit test: No constructor 'Future.value' declared in class 'Future' -

i have new dart project fail add unit tests. but new dart perhaps punished rookies should ... or should they!? error when running unit tests error: exception: no constructor 'future.value' declared in class 'future'. nosuchmethoderror : method not found: 'future.value' receiver: type: class 'future' arguments: [] stack trace: #0 _defer (http://127.0.0.1:3030/users/gunnar/git/chessbuddy/src/main/webapp/dart/chessmodel/test/packages/unittest/unittest.dart:671:20) #1 _ensureinitialized (http://127.0.0.1:3030/users/gunnar/git/chessbuddy/src/main/webapp/dart/chessmodel/test/packages/unittest/unittest.dart:830:11) #2 ensureinitialized (http://127.0.0.1:3030/users/gunnar/git/chessbuddy/src/main/webapp/dart/chessmodel/test/packages/unittest/unittest.dart:809:21) #3 group (http://127.0.0.1:3030/users/gunnar/git/chessbuddy/src/main/webapp/dart/chessmodel/test/packages/unittest/unittest.dart:585:20) #4 main (http://127.0.0.1:3030

c# - Linq distinct & max -

i have query table: symbol time ------ ---------- aaa 2013-04-18 09:10:28.000 bbb 2013-04-18 09:10:27.000 aaa 2013-04-18 09:10:27.000 bbb 2013-04-18 09:10:26.000 i need one row distinct symbols having biggest time value. how have write linq query? thanks in advance, group rows symbol , select each group item max time ( table database table name context): from r in table group r r.symbol g select g.orderbydescending(x => x.time).first() same method syntax: table.groupby(r => r.symbol) .select(g => g.orderbydescending(x => x.time).first());

Can't change input language in any java application on windows -

i' m trying switch windows input language alt+shift russian english doesn't in java applications. in windows works fine when switch alt+tab 1 of java applications doesn't work. fix have restart application, example itellij idea. after time appears again. can describe how fix it? afaik, default language decided @ start-up, experienced. allows override default language using command line arguments. i'm afraid, how is. have restart application changed default language os.

java - Wicket datatable change font or css of cell after onchange -

in application have defaultdatatable, clickable column , search field filter table. filter filters content of datatable after character inserted input field. goal underline (or other css) parts of text in fields apply input of user. example: characters 'a' , 'b' of string 'abc' should underlined if user enters 'ab'. javascript can add styling, function strange things datatable. deletes inside table tags en puts new html there. other information gone. doing wrong? <script> $('.searchfield').keyup(function(){ var page = $('.datatable'); alert(page.text()); var pagetext = page.text().replace("<span>","").replace("</span>"); alert(pagetext); var searchedtext = $('#searchfield').val(); var theregex = new regexp("("+searchedtext+")", "igm"); var newhtml = pagetext.replace(theregex ,"

Get service path from services.msc c# -

Image
i'm trying service executable path services.msc i wrote next code: var service = servicecontroller.getservices().where(p => p.servicename.equals("service name", stringcomparison.invariantcultureignorecase)); if (service.any()) //get service data i couldn`t find (if @ all) service executable path located? in services.msc can see path i'm assuming possible through code. any ideas? you can registry so: private static string getserviceinstallpath(string servicename) { registrykey regkey; regkey = registry.localmachine.opensubkey(string.format(@"system\currentcontrolset\services\{0}", servicename)); if (regkey.getvalue("imagepath") == null) return "not found"; else return regkey.getvalue("imagepath").tostring(); }

git svn - Git-svn merge two SVN branches -

Image
i have read numerous questions , blogs on git-svn , merging. of them (notably git-svn man page) warns against using merge anywhere near branch plan dcommit from. others, so answer , state merging fine long use one-off feature branches delete before dcommitting . i have setup 2 long-living svn (and git) branches: trunk (git-svn: svn/trunk , git: master ) - stable branch branches/devel (git-svn: svn/devel , git: devel ) - main development branch fork off feature branches (and can live rebasing them devel instead of merging). in picture above, (1) shows past svn history, branches/devel has been merged trunk . (2) shows have dcommitted current development svn. the question: can use git-svn merge two svn branches history shows merge point (as svn can do)? in other words: happens if dcommit master shown in (3) ? will mess svn (or git) history? or plain forget devel merged master @ all? edit: if git forgets devel merged master , there difference

Drawing a polyline that ends in a curve with Google Maps Android API v2 -

i'm converting application v1 v2, , i'm running problem : old application used draw function of overlay class display lines between different locations. of lines ended in curve such below : example http://img594.imageshack.us/img594/9539/002stc.jpg i'm thinking replacing polyline points close each other, in order make curve afar. i'm afraid consume way memory. have better idea ? possible draw line on map canvas ? i don't think should worry memory issue. new google maps api have called circle, seems practically bunch of polylines , doesn't consume huge amounts of memory far i've noticed. also, have application loads of different polylines 1k nodes each, , navigation on map still smoother few overlays in api v1.

ios - How do I properly encode Unicode characters in my NSString? -

problem statement i create number of strings, concatenate them csv format, , email string attachment. when these strings contain ascii characters, csv file built , emailed properly. when include non-ascii characters, result string becomes malformed , csv file not created properly. (the email view shows attachment, not sent.) for instance, works: uncle bill's house of pancakes but doesn't (note curly apostrophe): uncle bill’s house of pancakes question how create , encode final string valid unicode characters included , result string formed properly? notes the strings created via uitextfield , written , read core data store. this suggests problem lies in initial creation , encoding of string: nsstring unicode encoding problem i don't want have this: remove non ascii characters nsstring in objective-c the strings written , read to/from data store fine. strings display (individually) in app's table views. problem manifests when concatenating str

java - Add comment to an ARFF file -

this first question in forum.... i'm making adata-mining application in java weka api. make first pre-processing stage , when save arff file add couple of lines (as comments) specifing preprocessing task have done file... problem don't know how add comments arff file java weka api. save file use class arffsaver this... try { arffsaver saver = new arffsaver(); saver.setinstances(datapost); saver.setfile(arfffile); saver.writebatch(); return true; } catch (ioexception ex) { logger.getlogger(preprocesamiento.class.getname()).log(level.severe, null, ex); return false; } i greatfull if give idea... thanks! you should avoid writting comments on .arff file, more when writting java. these files "parser-sensitive". weka api create these files restrictive particular reason. even though, can add comments manually % symbol. said, wouldn't recommend writting more instances, attributes , va

php - Passing parameter in header tag -

i trying pass value header. is there way pass parameter directed new web page. below header code (it not work), pass parameter of "mycode" page. header("location: http://evon1991-z.comp.nus.edu.sg/kxclusive/insertdetail.php".'$mycode'); how should go doing it? variables don't expand inside single quotes. result of string concatenation like: http://evon1991-z.comp.nus.edu.sg/kxclusive/insertdetail.php$mycode you need: header("location: http://evon1991-z.comp.nus.edu.sg/kxclusive/insertdetail.php?param=$mycode"); ..assuming $mycode plain value. in case $mycode complete percent-encodeded query string format, prepend ? , append main url.

ipad - Customized Animation in iphone -

Image
i creating application have many customization. customization in sense, want give new application. in part of customization want add this kind of animation inside application. i have searched on internet found many 3d animations. results not satisfy needs. suggest me piece of code make animation possible. if u provide source code, helpful me. this want.set view this. _transitionframe label outlet.that label placed on display view. include quartzcore framework , define method convert degree radians this #import <quartzcore/quartzcore.h> #define degrees_to_radians(angle) ((angle) / 180.0 * m_pi) in view did load method write following code. - (void)viewdidload { cgrect preframe=_transitionframe.frame; preframe.origin.y+=preframe.size.height/2; [_transitionframe setframe:preframe]; [uiview beginanimations:nil context:nil]; catransform3d _3dt = catransform3drotate(_transitionframe.layer.transform,degrees_to_radians(90), 1.0, 0.0,0.0);

command line - How to set %variable%=%variable% using batch files -

i have 2 batch files. file a: set variablex=0 file b: set variabley=1 set %variablex%=%variabley% echo %variablex% the result 0 , not 1 expected. tried various options such quotes, exclamation etc. the value of variablex lost when batch file has done executing. if call file b within file a, should work.

Length method is not working in c# -

i want make comparison between table in mysql , 1 table in sql server using cod below. length method tried use marked error. should please need little help. thank ! int lengthclienti = mysqlsetclienti.tables["clienti"].length; int columnclienti = 4; (int = 0; <= lengthclienti - 1; i++)//row { (int j = 0; <= columnclienti; j++)//column { if (sqldataset.tables["clientiimporti"].rows[i][j].tostring() == mysqlsetclienti.tables["clienti"].rows[i][j].tostring()) { } } } you want include rows; mysqlsetclienti.tables["clienti"].rows.count

joomla - Can i use articles info for custom html modules? -

i want create picture sldier module, displays latest news article info in slider page, creating animations , text position easy, how can title , preview text in joomla 2.5? want take info latest 3 news articles. http://i.stack.imgur.com/lr3ja.jpg

Getting __init__() got an unexpected keyword argument 'instance' with CreateView of Django -

some details: request method: request url: http://localhost:8080/user/create django version: 1.5.1 exception type: typeerror exception value: ____init____() got unexpected keyword argument 'instance' exception location: /place/venv/local/lib/python2.7/site-packages/django/views/generic/edit.py in get_form, line 35 python executable: /place/venv/bin/python python version: 2.7.3 views.py class usercreateview(createview): model = models.user form_class = forms.userform urls.py url(r'^user/create$', usercreateview.as_view(), name='user_create'), forms.py class userform(forms.form): group_choices = [(-1, '[choose]')] group_choices += [(group.id, group.name.capitalize()) group in auth.models.group.objects.all()] email = forms.emailfield( label='email', widget=forms.textinput(attrs={'placeholder': 'email'}) ) first_name = forms.charfield( label='first name',

javascript - Make sure all async calls have been completed in jQuery -

i have webapp doing bunch of async api calls using jquery:s $.get , $.post methods. need make sure these have finished (http status code 200) before activate button (display: none/block). is there way make sure there no outstanding async calls waiting out-of-the-box in jquery? or need keep track of myself? i'm using jquery v1.8.3. you can create "master deferred", resolve when of other deferreds (the ajax requests) have completed successfully; jquery.when(jquery.get('/foo'), jquery.post('/bar'), jquery.get('/baz')).done(function () { $('button').show(); }); the syntax pass each deferred parameter jquery.when() , returns deferred resolves when 1 fails, or when of them complete. if don't know beforehand how many ajax requests have, have them in array, or don't want use above, can use function.apply so; var ajaxrequests = [jquery.get('/foo'), jquery.post('/bar'), jquery.get('/baz'

c# - The type or namespace name 'Server' could not be found (are you missing a using directive or an assembly reference?) -

the type or namespace name 'server' not found (are missing using directive or assembly reference?) what namespaces or assemblies added counter error.similar error thrown when using serverconnection class. you should refer below assembly namespace : microsoft.sqlserver.management.common assembly : microsoft.sqlserver.connectioninfo (in microsoft.sqlserver.connectioninfo.dll) find more here

Magento edit shopping cart title in header -

i have magento webshop , in header standing: shopping cart - subtotaal winkelwagen i looking way edit text. have looked .php files etc. didn't found there far. hope can tell me can edit text. the best way erwin_smit described it. as addition fastest solution using inline translation tool under system->configuration->developer->inline translation after activation reload front-end , edit dotted text.

Premature end of script headers: php-cgi -- While running a CURL script -

before go host (yet again) error log giving on below script is: premature end of script headers: php-cgi the scrip running works on other servers , local machine on perticualr server giving error 500: $ch = curl_init("http://feeds.energydigger.com/headlines.xml"); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_header, 0); $data = curl_exec($ch); curl_close($ch); $doc = new simplexmlelement($data, libxml_nocdata); if(isset($doc->channel)) { parserss($doc); } function parserss($xml) { $cnt = 3; for($i=0; $i<$cnt; $i++) { $url = $xml->channel->item[$i]->link; $title = $xml->channel->item[$i]->title; $desc = $xml->channel->item[$i]->description; $date = $xml->channel->item[$i]->pubdate; echo '<p><a href="'.$url.'">'.$title.'</a><br />'.$date.'</p>'; } } does know ma

javascript - For Loop not working -

i want function add 2 values inputted form instead of adding values merges number. if input 2 , 2 comes 22, whereas want 4 outputted. take loop not wotking <script> var calculate = function(){ var input = document.getelementsbytagname("input"); var length = input.length; (var = 0; < length; i++) { input[i] = input[i].value; input[i] = parseint(input[i]); } var total_living_room = input[0] + input[1]; document.getelementbyid("sh").innerhtml=total_living_room; } </script> the problem is, getelementsbytagname() returns nodelist , no array (see,e.g., mdn on this ). both behave similar in many ways, elements of nodelist can not changed in way do. as solution parse values in second array , use that: <script> var calculate = function(){ var input = document.getelementsbytagname("input"), length = input.length, inputvals = []; (var = 0; < length; i++) { inputvals.push( parseint( input[i].value,

content management system - Magento custom theme pulling in images but not styles or scripts -

i have magento store trying develop custom theme. copied files skin/frontend/default/default , app/design/frontend/default/default skin/frontend/occasions/occasions , app/design/frontend/occasions/occasions respectively, went system->configuration->design , changed package , theme text boxes occasions, when load site, pulls in images occasions/occasions not css or js, pulling in base/default. any ideas? here code sample head tag illustrate issue: <link rel="icon" href="xxxxx/skin/frontend/occasions/occasions/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="xxxxx/skin/frontend/occasions/occasions/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="xxxxx/skin/frontend/base/default/css/styles.css" media="all" /> <link rel="stylesheet" type="text/css" href="xxxxx/skin/frontend/base/def

ios - Remove an item from a UICollectionView -

i have set of images showing in uicollectionview . when user taps on image, spawns uiactionsheet few options image. 1 of them id removing photo uicollectionview . when user selects remove button in uiactionsheet , pops alert view asking confirmation. if user selects yes, should remove photo. my problem is, remove item uicollectionview , have pass indexpath deleteitemsatindexpaths event. since final confirmation granted in alert view's diddismisswithbuttonindex event, can't figure out way indexpath of selected image there pass deleteitemsatindexpaths event. how can this? here's code: - (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { switch (buttonindex) { case 0: deletephotoconfirmalert = [[uialertview alloc] initwithtitle:@"remove photo" message:@"do want remove photo?"

c# - Update Gridview data to SQL Server 2008 R2 through XML -

i have gridview has 4 columns, id,first(radiobutton),second(radiobutton) , yes/no(checkbox) , sample data follows: id first(radiobutton) second(radiobutton) yes/no(checkbox) 001 checked not checked checked 002 not checked checked not checked 003 checked not checked checked 004 checked not checked checked in sql server table contains columns id(varchar), priority(int) 1 if first radiobutton checked , 2 if second radio button checked, , decision(true if yes/no checkbox checked , false id not checked), as(according gridview data id priority decision 001 1 true 002 2 false 003 1 true 004 1 true now, want update data clicking 'save' button want tpo update data thro

asp.net mvc 3 - I have a javascript that must generate in runtime. In MVC 3 -

i have javascript must generate in runtime. in controller string view .like asp literal control there method in mvc 3 razor.??? me masters this might work: <script type="text/javascript"> @html.raw(model.yourjavascriptstring) </script>

python - Generate code at runtime -

i need generate @ run time model below base on values. below example of i'm trying acheive, issue clear i.e. [field.value]... def import_data(form, *args, **kw): class contactcsvmodel(csvmodel): field in form: [field.value] = charfield() class meta: delimiter = "," dbmodel = contact update = {'keys': ["mobile", "group"]} return contactcsvmodel.import_data(*args, **kw) so above code after generated (if typed static code).... def import_data(form, *args, **kw): class contactcsvmodel(csvmodel): first_name = charfield() mobile = charfield() last_name = charfield() class meta: delimiter = "," dbmodel = contact update = {'keys': ["mobile", "group"]} return contactcsvmodel.import_data(*args, **kw) how can [field.value] work in way need to? i