Posts

Showing posts from September, 2013

Spring Scheduled Tasks: Fixed Rate and Cron -

Spring Scheduled Tasks: Fixed Rate and Cron - i implementing scheduled tasks using spring. have fixed rate task runs every 30 minutes. configure run every 30 min during 9 - 5, mon - fri. please suggest me way this. simple. fixed rate: import org.springframework.scheduling.annotation.scheduled; import static org.apache.commons.lang.time.dateutils.millis_per_minute; @scheduled(fixedrate = 30 * millis_per_minute) cron look (not tested, please prepare if incorrect): @scheduled(cron = "* 0,30 9-17 * * mon-fri") see also: 25.5.1 @scheduled annotation spring spring-mvc scheduled-tasks

java - I am missing a return statement -

java - I am missing a return statement - i building dao mill project this class: package dao; import interfaces.idaoproject; import datapackage.dbobject; import java.util.arraylist; import type.programma.oefening; public class daoproject extends dbobject implements idaoproject { @override public arraylist<oefening> load(oefening o) { try{ string sql = "load oefeningen set code = " + o.getcode() + " code = " + o.getcode(); openconnection(); stmt = conn.createstatement(); rs = stmt.executequery(sql); } catch(exception e){ system.out.println(e.getmessage());} } } now gives error @ public class daoproject extends dbobject implements idaoproject { missing homecoming statement how can prepare this? you have declared method public arraylist<oefening> load(oefening o) shouldn't returning arraylist ? java

linux - How to download the created PDF file in python? -

linux - How to download the created PDF file in python? - i able convert html pdf , store on local directory. point how download same file after beeing created progamatically using python? this code: filename = "test.pdf" body= fromstring( u"<div>" + tostring( fromstring( str(self.request.post['content']).decode('utf-8') ).body ) + u"</div>" ) tx = tostring(body).encode('utf-8') pisa.createpdf(tx, file(filename, 'wb')) hi there founded solution: fh = open('path_to_file','r') self._response.data = fh.read() fh.close() self._response.headers.add('content-type', 'application/pdf') self._response.headers.add('content-disposition', 'attachment') so able download created file... python linux

streaming - How to use BulkOutputFormat to stream the data to the Cassandra from Hadoop Map function? -

streaming - How to use BulkOutputFormat to stream the data to the Cassandra from Hadoop Map function? - 1) have row-key, column , value in map of hadoop job , came know can stream straight cassandra using bulkoutputformat. 2) have gone through code quite hard understand how utilize it. how can utilize bulkoutputformat api stream info cassandra? as more documentation not yet available on request cassandra experts guide me through this. little code snippet helpful. planning test current development version. by looking cassandra source code , cassandra jira have figured out way utilize bulkoutputformat , described here:using bulkoutputformat load info cassandra hadoop streaming hadoop mapreduce cassandra

sql server 2008 - MDX query creating verbose xml style field names in dataset in SSRS -

sql server 2008 - MDX query creating verbose xml style field names in dataset in SSRS - i pasted query (which works in ssms) new dataset in vs.net/bids however, field/column names returned showing values like: id__xml_version__1_0__encoding__utf_8____field_xmlns_xsi__http___www_w3_org_2001_xmlschema_instance__xmlns_xsd__http___www_w3_org_2001_xmlschema__xsi_type__level__uniquename___... what causing , how can prepare it? this way ssas produces xmla. imhu no real way prepare it. sql-server-2008 reporting-services ssas mdx xmla

c# - Using custom settings for WebBrowser Control -

c# - Using custom settings for WebBrowser Control - i'm trying build c# application uses webbrowser command for, obviouly, webbrowsing. enhance security of system, i'd set own security settings. these 2 of settings set through software: disable download file-extensions (*.exe) disable cookies i found, webbrowser class straight uses settings net explorer. there way utilize own settings specific webbrower or overide these settings (maybe temporarely)? i think question may similar this: overriding ie settings when embedding webbrowser command using ie9 (but i'm not sure... :) edit: if alter cookie-settings net explorer, used webbrowser-control, right? possible alter these global settings via c#? maybe easy solution problem... unfortunately, doesn't can disable cookies, though can clear them; however, when so, clearing cookies all ie instances on pc (for particular account). here stackoverflow more detail. as far controlling files may downloa...

sql - Auto-increment subquery in tsql select statement -

sql - Auto-increment subquery in tsql select statement - i have t-sql select statement , want auto-increment column in (that doesn't exist in database) select dbo.a, dbo.b, dbo.c, select @d:=1; @increment:=@increment+1 d is possible? assuming you're using sql 2005 or later: select dbo.a, dbo.b, dbo.c, row_number() over(order getdate()) d to order rows returned form db. if want specify order can so: select dbo.a, dbo.b, dbo.c, row_number() over(order dbo.a) d for sql 2000 , before need unique value order by: select dbo.a, dbo.b, dbo.c, (select count(*) dbo d2 d2.a <= dbo.a) d dbo or if don't need single select: select identity(int,1,1) id, dbo.a, dbo.b, dbo.c #temp dbo select * #temp sql sql-server tsql sql-server-2000

matlab - Inf value after incrementation -

matlab - Inf value after incrementation - here's code: x=0; i=1:100 x=x+sqrt(((1/((((2*i)-2)^2)*(((2*i)+2)^2)))*16)+8); end for reason maintain getting infinity value (inf) x after operation??? can help explain why? that because split 0 @ i==1 : take @ (2*i)-2 i==1 . i can guess meant utilize i imaginary square root of -1 . in case, alter loop to: x=0; k=1:100 x=x+sqrt(((1/((((2*i)-2)^2)*(((2*i)+2)^2)))*16)+8); end and in that case loop not necessary @ all. matlab increment infinity

postgresql - ERROR: operator is not unique: unknown + unknown -

postgresql - ERROR: operator is not unique: unknown + unknown - i have postgis database , have compute new values rows in new column. these values should average of values of several columns. query: insert bdps (da_m) values (avg('da_1'+'da_2'+'da_3'+'da_4'+'da_5'+'da_6'+'da_7')); in query bdps database, da_m new column , da_1 da_7 existing columns have double precision type. da_m created using alter table bdps add together column da_m double precision; i next error: error: operator not unique: unknown + unknown line 2: values (avg('da_1'+'da_2'+'da_3'+'da_4'+'da_5'+'da_6'+'da_7... ^ hint: not take best candidate operator. might need add together explicit type casts. ********** error ********** error: operator not unique: unknown + unknown sql state: 42725 hint: not take best candidate operator. might need add togethe...

Creating a program in Python 3 for Windows users, cannot use PIL? -

Creating a program in Python 3 for Windows users, cannot use PIL? - i wrote simple gui programme automate few processes windows users in python (as programming language familiar run on windows). ideally not want user have run install programme on machine, plan run self-contained in usb drive. it depends on os, shutil, string, sys, tkinter, webbrowser, pil, ftplib, , glob. it seems though of dependencies got imported when ran cx_freeze on it, except pil. have never used cx_freeze before, doing wrong doesn't seem it. running programme unfrozen .py script works fine. here's error message receive when trying utilize pil command: exception in tkinter callback traceback (most recent phone call last): file "c:\python32\lib\tkinter\__init__.py", line 1399, in __call__ homecoming self.func(*args) file "e:\albumuploader.py", line 143, in onbutton2click img.thumbnail(size, image.antialias) file "c:\python32\lib\site-packages\pi...

javascript - How to change speed of a sprite animation on Spritely? -

javascript - How to change speed of a sprite animation on Spritely? - i've been reading spritely documentation on , on , can't find solution. i have sprite made of 4 frames. want animate endlessly each iteration : 1st frame @ 99 ms , next 3 frames @ 11ms. how accomplish slow downwards on first frame? the syntaxe doing isn't clear @ , i've tried failed. thanks in advance help :) $('#test') .sprite({fps: 6, no_of_frames: 4}) }); from able find, of calls allow speed, random instance. illustration give: $('#bird') .sprite({fps: 8, no_of_frames: 3}) .sprandom({ top: 70, left: 100, right: 200, bottom: 340, speed: 4000, pause: 3000 }); allows speed. sprite phone call appears not to. other speed attribute appears on backgrounds, might worth shot. example: $('#trees').pan({fps: 30, speed: 2, dir: 'left'}); or $('#hills'...

.net - How can I put WebBrowser display behind my control? -

.net - How can I put WebBrowser display behind my control? - i trying create menu on top of webbrowser control, when user select it, tell webbrowser go centain page. so did like: <grid x:name="root"> <webbrowser name="_webbrowser" source="http://google.ca" grid.column="0" grid.row="0"></webbrowser> <expander name="expander1" horizontalalignment="left" verticalalignment="stretch" width="250" expanddirection="right" isexpanded="true" grid.column="0" grid.row="0"> far know, lastly define command should on top... but strange, webbrowser display on top....and covers expander (menu). tried set webbrowser within carvas or button lol webbrowser still display on top.... i hope not bug in .net 3.5..... the short reply limitation of wpf. the webbrowser command managed wrapper around windows com com...

tsql - T-SQL Generate Random/Sample Data from RegEx -

tsql - T-SQL Generate Random/Sample Data from RegEx - i have unusual problem. have generate random data, regular look given. yeah, illustration have rules: 1) isregex('^(((([0-1]?[0-9]|2[0-3])(:[0-5][0-9])?)?:)?[0-5])?[0-9]$', #comment#) 2) isregex('^[0-9]+:([0-5][0-9]):([0-5][0-9])$',#comment#) 3) isregex( '^[0-9]+$' , #comment#) and many others... have generate text (#comment#) pass rule. not necessary there many variations. 1 enough. have this? thanks in advance. the proper way in sql server - thru clr stored procedure or clr user defined function, if sql server version allows this. else - there no acceptable way. tsql

iphone - UIScrollView sporadically loses bounce and fluid scrolling -

iphone - UIScrollView sporadically loses bounce and fluid scrolling - i have implemented working uiscrollview layer on top of cocos2d using fantastic tutorial: http://bitbattalion.com/2011/09/uikit-uiscrollview-and-cocos2d/ however, scroll view sporadically becomes sluggish , choppy, including upon loading scene. when happens, scrolling , no longer able flicked or downwards sort of variable velocity. loses of it's bounce , remain partially of screen until next touch registered. the weird thing though, if pull downwards notification center, fixes scroll view every time. scrolling of sudden becomes fluid , edges bounce beautifully place. what happening here? instruments may help tackle problem. run using coreanimation tool can handle on might experiencing drop in frame rate. you'll need have device connected run coreanimation tool. this tutorial available @ http://mobileoverlord.com/instruments-optimizing-core-animation/ select profile build scheme. ...

system.reflection - Issue with reflection in msbuild, devenv is good -

system.reflection - Issue with reflection in msbuild, devenv is good - i have gone through questions related , not find issue , hence, asking question. i have buildtask (added afterbuild target), validate types names. these type names qualified type names silverlight projects beingness build. to resolve these type names, utilize type.reflectiononlygettype() . load dependent assemblies handle appdomain.currentdomain.reflectiononlyassemblyresolve event load project specific assemblies project output path , silverlight base of operations assemblies silverlight installation path using assembly.reflectiononlyloadfrom(filepath) . this works fine, when build projects in vs2010, fails when build msbuild i.e. c:\windows\microsoft.net\framework\v4.0.30319\msbuild.exe "c:\root\branches\x.x.x\clients.sln" /t:rebuild /p:configuration=debug "/p:platform=any cpu" /v:quiet /maxcpucount:1 while building msbuild, reflectiononlyassemblyresolve event fired "sy...

flex - Value in Datagrid itemrenderers set data method doesn't return the correct data -

flex - Value in Datagrid itemrenderers set data method doesn't return the correct data - i've got gridcolumn in datagrid (spark). column's dataprovider number value gets updated via binding. now, without item renderer cell displays right values. if set item renderer, can't access values in renderer. my renderer looks this, nil here (for now) trace value, value nan. <?xml version="1.0" encoding="utf-8"?> <s:griditemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%" > <fx:script> <![cdata[ override public function set data(value:object):void { trace(number(value)); } ]]> </fx:script> </s:griditemrenderer> i don't understand why happens, insight much appreciated! again, without renderer, column displays right values, apparently defaultg...

hyperlink - Like button on website page link to like facebook page (differents urls) -

hyperlink - Like button on website page link to like facebook page (differents urls) - i saw lot of posts here , didn't find answer. allow me explain. have site , facebook page facebook . com/example . com. in website there button each page, users can illustration . com/page, illustration . com/page2. don't know if possible when user page1 increases on facebook .com/example . com> page? resuming : facebook . com/example . com has 2 likes. illustration . com/page1 has 1 like. illustration . com/page1 has 7 likes. i see on facebook.com/example.com on middle left 10 likes. possible? if yes how can it? it not possible, because every button "likes" 1 object. , there no object hierarchy 1 object consist of many other objects or 1 object accumulates likes of other objects. what set button facebook.com/example.com page on every website. in case every button shows same count. can subscribe border event javascript api , count like-bu...

android - setText doesn't set text -

android - setText doesn't set text - i have class fetches som info website. i've followed thenewboston's tutorial (147-149 think) , copied writes exactly, doesn't work me. problem settext . seek switch tv.settext(returned) tv.settext("hello") doesn't change. know what's wrong? @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textview tv= (textview) findviewbyid(r.id.text1); getmethodex test = new getmethodex(); string returned; seek { returned = test.getinternetdata(); tv.settext(returned); } grab (exception e) { e.printstacktrace(); } } try this: string returned = "some default string."; seek { returned = test.getinternetdata(); } grab (exception e) { e.printstacktrace(); } tv.settext(returned); this way, know settext called data, regardless of if there exception. ...

objective c - iPhone custom UIView with partial transparency -

objective c - iPhone custom UIView with partial transparency - i'm trying have single big uiview (for illustration web view) have different transparent regions. think of cardboard cutout person can insert head, this: the user should able tap on screen user wants transparency appear, able dynamically edit content retrieved internet. i want know if possible have single uiview (for illustration imageview or web view) have regions of different transparency. illustration person's face may made transparent , face substituted in it's place. currently know how create view using multiple uiviews different transparencies. know how set alpha single uiview. any input appreciated. yes, possible. can, instance, utilize image alpha channel in view. if want cardboard cutouts, create images cutouts anyway. have head-holes transparent (and utilize transparent backgroundcolor uiimageview). there nil wrong using composite view accomplish desired outcome, though. i...

javascript - replace tag content using jquery -

javascript - replace tag content using jquery - in html have code: <div class="selfclear"> <h3><a id="lnkname" href="/dir/subdir/?id=577">name</a></h3> <address> street name, 3 <br />3222 city<br />phone. : 0202 777 876 </address> </div> i want replace phone number depending on id passed url within tag using jquery. so far able id doing so: function getid(){ var = $('#lnkname').attr('href').split('='); var id= a[1]; } and content of : function print_address(){ var div = $('#lnkname'); if (!div.length) return; var adress = $('#lnkname').parent().siblings('address').html(); adress.replace( '/phone : .*/', '/phone : 777' ); var newtel = $('#lnkname').parent().siblings('address').html( adress ); div.html(newtel).show(...

Javascript setTimeout-recursion doesn't work with Chrome and Firefox -

Javascript setTimeout-recursion doesn't work with Chrome and Firefox - the code below sliding div within hidden overflow div (concept future website). text box below "next" , "previous" links indicating x value. ie8 works fine. with chrome , firefox seems function 1 time (one step) both "next" , "prev", means settimeout doesn't run. <html> <meta http-equiv="content-script-type" content="text/javascript"> <head> <script type="text/javascript"> var ie5 = (document.all && document.getelementbyid); var ns6 = (!document.all && document.getelementbyid); function next(startx, fadestep, end){ if(startx > end){ startx -= math.round((1/math.pow(fadestep,0.6))); if (startx < end) startx = end; document.getelementbyid('lastname'...

html - How come padding is not calculated into the width for submit buttons? -

html - How come padding is not calculated into the width for submit buttons? - first of all, think absolutely ridiculous padding considered part of width of dom element. however, gritted teeth , accepted fact... find out submit buttons paddings not calculated part of width. http://jsfiddle.net/cpryb/2/ how go fixing this? i'm not sure if misspoke, padding not considered part of width default. say, if element has width of 100px, padding of 10px, , border of 5px, rendered on 100+(10*2)+(5*2)=130px. however, element contain 100px of space, amount set in width . that beingness said, can alter default behavior box-sizing property. set border-box subtract padding (and border) box's width, or content-box render padding outside of specified width. here's a demo. for increased compatibility should include vendor prefixes. so, input[type=button] { -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; } html css...

api - Retreive all the posts done through my facebook app in some specified time? -

api - Retreive all the posts done through my facebook app in some specified time? - i take stream_publish permission user, , utilize publish content facebook wall. in insights page, see number n wall posts done on specific date. there graph api phone call or fql through can retreive wallposts done using app's application id , access_tokens on specific date ? or may lastly 100 wallposts done through app. i have read_stream permisssion each user's access_token . try graph call: fql?q=select message, attachment, attribution, app_id stream source_id=me() , app_id={appid} limit 100 api facebook-graph-api facebook-fql facebook-insights

c# - How do extension methods work under-the-hood? -

c# - How do extension methods work under-the-hood? - a contractor work using extension methods implement crud on well-known internal classes own. improve utilize normal inheritance on extension methods next reasons. using extension methods obfuscates, hides & confuses source of crud methods. i assume extension methods create heavy utilize of reflection (which slower). his logic is, "it's compiled, it's fast." maybe i'm wrong...but because compiled doesn't mean doesn't utilize reflection, nor mean faster normal inheritance. so questions are: how extension methods work under-the-hood? is improve utilize inheritance or extension methods on well-known classes own? how extension methods work under-the-hood? they're static methods; compiler rewrites calls myobject.myextensionmethod() myextensionclass.myextensionmethod(myobject) . is improve utilize inheretance or extension methods on well-known clas...

c - Is this a printf()/pthread bug, or am I missing something? -

c - Is this a printf()/pthread bug, or am I missing something? - i endeavoured larn multiple threading, , ran next unexpected - me, @ to the lowest degree - behaviour: printf not print more line @ 1 time when called in simple next code: pthread_mutex_t mutex = pthread_mutex_initializer; pthread_cond_t cond = pthread_cond_initializer; char buffer[2]; void * thread_routine(void * args){ pthread_mutex_lock(&mutex); pthread_cond_wait(&cond, &mutex); printf("test %s\n test\n", buffer); pthread_mutex_unlock(&mutex); return(null); } int main(void){ pthread_t thread; pthread_create(&thread, null, thread_routine, null); sleep(1); buffer[0] = 'c'; buffer[1] = '\0'; pthread_mutex_lock(&mutex); pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); sleep(10); return(0); } the output test c (wai...

cross browser - IE9 devicePixelRatio equivalent -

cross browser - IE9 devicePixelRatio equivalent - has discovered reliable method determine device pixel ratio windows phone 7.5 (mango). it based off of ie9. in webkit based browsers have window.devicepixelratio or using window.matchmedia() appropriate media query. in windows mobile can determine pixel ratio doing: screen.devicexdpi / screen.logicalxdpi though appears reliable 1 time page has been rendered. prior devicexdpi reports same logicalxdpi has found solution? thanks help/suggestions use (min/max-)resolution equivalent test in media query: @media (min-resolution: 1.5dppx), (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2) {} or through matchmedia: if (window.matchmedia) { if (window.matchmedia('(resolution: 96dpi)').matches) { } // resolution feature & dppx unit if (window.matchmedia('(min-resolution: 1dppx)').matches) { } // -webkit-device-pixel-ratio feature if (wind...

jquery - how to change the background position of an element upon clicking a button -

jquery - how to change the background position of an element upon clicking a button - ok. know topic has been covered hundred times. , i've tried lastly couple hours. . . , lastly few days. i'm pissed right now. fine, whatever. i'll inquire help. simple task. click button alter position of object. (i want able click button , scatter list items in list page... sense 1 time figure out how simple task, can figure out there. i have tried everything, every variation of code saw online. don't know why it's not working me, think must because i'm messing syntax. <p> want move text </p> <input type = "button" value = "click me"> <script type = "text/javascript" src = "js/jquery.js"></script> <script type = "text/javascript"> $(':button').click(function() { $('p').css({backgroundposition: '100px 0px'}); }); </script> i tried r...

xna - Drag Image in a Window Phone 7+ Silverlight app -

xna - Drag Image in a Window Phone 7+ Silverlight app - windows phone 7.5 silverlight app i want allow user drag image on page within restricted area. image within grid has other elements. i using gesturelistener , have tried implementing. below code. have tried after reading few sample articles. <image x:name="imgfootball" margin="55,108,55,1" grid.row="1" source="/ball.png" height="250" width="250"> <toolkit:gestureservice.gesturelistener> <toolkit:gesturelistener dragdelta="gesturelistener_dragdelta"></toolkit:gesturelistener> </toolkit:gestureservice.gesturelistener> <image.rendertransform> <compositetransform x:name="imgimagetranslate" /> </image.rendertransform> </image> private void gesturelistener_dragdelta(object sender, dragdeltagestureeventa...

deployment - deploy svn branch without version folder -

deployment - deploy svn branch without version folder - using beanstalkapp, deploy branch staging environment. branch has name of "version_1.0.0". ftp staging environment , see "version_1.0.0" folder has been created here also. how deploy files without having branch name or version appear? maybe went naming branch in wrong way, don't know. you need tweak checkout command bit. rather doing: svn checkout [path/to/my/reopo/branches/version_1.0.0] you need add together . end (assuming in directory want files checked out to). this: svn checkout [path/to/my/reopo/branches/version_1.0.0] . svn deployment branch

wpf - ItemTemplate - works wrong. Custom apperance and binding -

wpf - ItemTemplate - works wrong. Custom apperance and binding - i have created own extendedtabcontrol totally alter it's apperance. works ok. have created closeabletabitem control. works well. however... far have manually set closeabletabitem in extendedtabcontrol way: <etc:extendedtabcontrol> <etc:closeabletabitem header="first item"> <...some content... /> </etc:closeabletabitem> </etc:extendedtabcontrol> now want bind observablecollection extendedtabcontrol. objects within collection contains: header , contenttext. set itemsource, ok, works. how can create tabitems closeabletabitems? more, how bind class objects closeabletabitems? have noticed tabcontrol has property called itemtemplate, setting not alter it's apperance totally. there still background can't change. apperance works, binding not or bindings work, apperance partly. can do? please help. in extendedtabcon...

maven-deploy-plugin deploy-file goal insists on deploying javadoc file for previous deploy-file execution -

maven-deploy-plugin deploy-file goal insists on deploying javadoc file for previous deploy-file execution - i have pom utilize bundle 3rd party jars deploy local nexus. fails sec upload. seems if picking javadoc associated first deploy-file execution, eventhough have not specified this. is bug, or doing wrong? <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>a.b.c</groupid> <artifactid>vendorx_jdbc_driver_wrapper</artifactid> <version>0.0.1-snapshot</version> <packaging>pom</packaging> <properties> <vendorx_jdbc_driver_wrapper.javadoczip>${basedir}/files/11.2.0.1.0/jdbc/javadoc.zip</vendorx_jdbc_driver_wrapper.javadoczip> <vendorx_jdbc_...

Android "Application Framework" Docs/Tuts -

Android "Application Framework" Docs/Tuts - can point me tutorials related android application framework development? here particularly talking "application framework" (second layer top in android architecture) & not app development. i interested in: what happens after app calls system/framework api? how os check if app has particular permission? component in "application framework" handles checking? java classes responsible it? i play these java classes & create observations. p.s.: assuming permission-model implemented in "application framework" layer. right me if wrong. there limited resources framework development far aware, of available spread out on different blogs , mailing lists. started recommend open source project site, source.android.com. contains limited documentation on how things @ to the lowest degree provides setup working open source project. there official mailing lists related platform , framework l...

android - Save game state after pause. AndEngine -

android - Save game state after pause. AndEngine - i've found after resuming game engine reloaded , application reinitialized. want save engine state , in "onresume" resume game proccess. i've tried save engine (mengine) , after resume game in "onloadengine" homecoming saved engine. think bad solution , doesn't work what best solution pause\resume game (after powerfulness key pressed example) in andengine ? the solution found serialize state of engine json , save shared storage. lot of work, save it. since andengine going re-init engine , textures after pause, think there not many choices, unless want re-write of andengine game. (which can) in json record position type velocity etc of each sprite. complexity of gets saved depends on complexity of game. , each class added deserialize method accepts json input. as footnote method, cannot speak highly plenty of amazing gson library making easier task. http://code.google.com/p/googl...

php - mysql_real_escape_string and html_special_chars enough? -

php - mysql_real_escape_string and html_special_chars enough? - this question gets asked lot, still haven't found straight reply on stackoverflow. these 2 functions sufficient or not? there lot of contradictory comments around net "yes fine?, "no, never utilize it". others say, utilize pdo, don't understand. i'm beginner php, don't understand of ins , outs of security. i've tried reading , understanding following, many don't create much sense me. http://ha.ckers.org/xss.html do htmlspecialchars , mysql_real_escape_string maintain php code safe injection? what if utilize preg_replace strip unwanted characters? i'm incredibly confused , don't know start. edit: please recommend how go understanding prepared statements (assuming best option). sam, if storing input in database, avoid sql injection , xss 2 functions enough. if storing passwords, must encrypt passwords one-way encryption (that can not decrypted). let ...

.net - Dynamically Building Buttons -

.net - Dynamically Building Buttons - i using vb.net. have list of 13 buttons. names of these buttons constructed through combination of 3 different variables. i need disable these buttons. not want iterate through each button disable them. dynamically phone call these buttons in loop , disable them. this; for count = 1 13 periodroomid = ("r" & ds.tables("sqlspecroomrequest").rows(i).item(3) & count) periodroomid.enabled = false periodroomid.backcolor = color.gray next the problem 1 time creating variable periodroomid, can't address button because; that mean there 2 buttons same name. periodroomid string , hence can't enabled because makes no sense. how around this? you can seek controls.find method. dim cntrl() command count = 1 13 periodroomid = ("r" & ds.tables("sqlspecroomrequest").rows(i).item(3) & count) cntrl = me.controls.find(periodroomid,true) cntrl(0).en...

R dcast error / Find irregular IDs in a dataframe -

R dcast error / Find irregular IDs in a dataframe - my dataframe looks this: id | value | value b 1 | a1 | f 1 | a2 | n 1 | a3 | b 1 | a4 | s 2 | a1 | b 2 | a2 | g 2 | a3 | n 3 | a1 | f 3 | a2 | h 3 | a3 | j 3 | a4 | n so have 4 rows 1 id each. trying utilize dcast() function, works if ids have same number of rows. id no. 2 error case in example. there easy way find ids have more or less 4 rows? or may there way create dcast function ignore error cases? originally trying reshape dataframe this: id | a1 | a2 | a3 | a4 1 | f | n | b | s 2 | b | g | n | na 3 | f | h | j | n apparently dcast() function reshape2 bundle doesn´t work irregular ids. gives me next erros message: 'aggregation function missing: defaulting length' smaller part of dataset - doesn´t have irregular ids - works. ideas? or may thought how reshape dataframe without using dcast? thanks! ...

ipad - Problems with touch detection -

ipad - Problems with touch detection - i'm learning cocos2d , objective-c, , have problems touch detection. i have several sprites in helloworldlayer , draggablesprites (nsmutablearray). 2 of draggablesprites located 1 on (the bottom 1 bigger). then have code shakes touched sprite: - (void)selectspritefortouch:(cgpoint)touchlocation { ccsprite *touchsprite = nil; (ccsprite *sprite in dragablesprites) { if (cgrectcontainspoint(sprite.boundingbox, touchlocation)) { touchsprite = sprite; break; } } if (touchsprite != selsprite) { [selsprite stopallactions]; [selsprite runaction:[ccrotateto actionwithduration:0.1 angle:0]]; ccrotateto * rotleft = [ccrotateby actionwithduration:0.1 angle:-1.0]; ccrotateto * rotcenter = [ccrotateby actionwithduration:0.1 angle:0.0]; ccrotateto * rotright = [ccrotateby actionwithduration:0.1 angle:1.0]; ccsequence * rotseq =...

Java Generics always for collections -

Java Generics always for collections - i have question java generics. if define class this: public test<string> ... does mean class acts collection type strings? illustration when seeing list know list of strings. <> mean it's collection (general meaning, not actual collection type)? thanks, no. means type parameterized type string. there plenty of non-collection generic types. see callable<t> , future<t> , comparator<t> example. java generics

iphone - How do I add or remove rows from UITableView at runtime? -

iphone - How do I add or remove rows from UITableView at runtime? - i'm sure nooby question, can't figure out. have uitextfield *numberofpointstextbox allows users input integer. want value number of rows in uitableview *mytableview in same view numberofpointstextbox. want user able alter value , have number of cells update accordingly. solution have been able find create "for" loop create nsindexpath each, there must improve solution out there. ideas? in advance! the number of rows uitableview displays controlled through uitableviewdatasource 's tableview:numberofrowsinsection: method. code should hear changes of uitextfield *numberofpointstextbox , update number of points in custom instance of uitableviewdatasource have configured uitableview , , phone call reloaddata on uitableview finish update. iphone objective-c ios uitableview

java - Unpredictable behaviour with Processing -

java - Unpredictable behaviour with Processing - i've started creating application in processing, , i'm getting unpredictable behaviour when place papplet object jframe using borderlayout.center. the width of papplet 100 less width , height of jframe. on occasions, when click 'run', programme fills screen , runs smoothly, on other runs, papplet starts top left , leaves gap on 100 on bottom of screen , left hand side, , quite laggy. i have no thought going on if i'm honest. this result runs smoothly: this unpredictable one: here code i'm using: papplet subclass public class jcanvas extends papplet { /** * papplet method - performs setup actions */ public void setup(){ size(1400,900,p3d); background(80); } /** * papplet method - drawing occurs here */ public void draw(){ background(80); pushmatrix(); translate(mousex,mousey, -199); fill(220,0,0); box(120,500,90); popmatrix(); } } viewer class public...

Uploading multiple image on php server from android -

Uploading multiple image on php server from android - help specific server side php code don't have knowledge of php , have upload 3 images android php page. i have tried many methods , searched no tutorial or didn't help me android code working properly. dns configured images aren't shown @ server side. please help me java code. php: <?php if ($_files["file1"]["error"] > 0) { header("http/1.1 400 bad request"); echo "error: " . $_files["file1"]["error"] . "<br />"; } else if ($_files["file2"]["error"] > 0) { header("http/1.1 400 bad request"); echo "error: " . $_files["file1"]["error"] . "<br />"; } else if ($_files["file3"]["error"] > 0) { header("http/1.1 400 bad request"); echo "error: " . $_files["file1"]["error"]...