Posts

Showing posts from August, 2015

c - does read / write atomicity hold on multi-computer memory? -

i'm working in multi-computer environment 2 computers access same memory on 32bit pci bus. the first computer write 32bit int. *int_pointer = number; the second computer read 32bit int. number = *int_pointer; both os's / cpu's 32bit architecture. computer pci intel based. computer on pci card power pc. the case worried if write computer changing variable @ same time read computer reading it, causing invalid data read computer. i'd know if atomicity of reading / writing same position in memory preserved on multiple computers. if so, following prevent race condition: number = *int_pointer; while(*int_pointer != number) { number = *int_pointer; } i can guarantee writes occur every 16ms*, , reads occur randomly. *times drift since both computers have different timers. there isn't enough information answer definitively. if either of cpus decide cache memory @ *int_pointer , fail , code not fix race condition. assuming both cpus k...

c++ - explain this code with decltype in it -

([] () -> decltype(std::cout << "hello") { return std::cout << "hello"; }()) << ", world!"; prints hello, world! . i don't understand what's going on here. can explain me in simple terms? ([] () -> decltype(std::cout << "hello") this creates lambda (in-place function) same return type expression std::cout << "hello" has - that's std::ostream& . [] starts lambda, () empty parameter list, -> preceeds return type, , decltype(x) equivalent type of expression x. function body: { return std::cout << "hello"; } then function called... outputs "hello" , returns stream.... ()) and finally, returned stream, little more text sent... << ", world!";

c++ - libev-4.15 doesn't compile on OSX 10.8 -

i'm trying upgrade libev-3.8 (which compiles fine on osx 10.8) libev-4.15 , getting following error. third_party/libev-4.15/ev.h:234: error: expected identifier before numeric constant third_party/libev-4.15/ev.h:234: error: expected `}' before numeric constant third_party/libev-4.15/ev.h:234: error: expected unqualified-id before numeric constant third_party/libev-4.15/ev.h:842: error: expected declaration before ‘}’ token link ev.h: http://cvs.schmorp.de/libev/ev.h?revision=1.171&view=markup my system config: checking host system type... i386-apple-darwin12.3.0 checking target system type... i386-apple-darwin12.3.0 checking ld used gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld checking if linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) gnu ld... no checking how convert i386-apple-darwin12.3.0 file names i386-apple-darwin12.3.0 format... func_convert_file_noop checking how convert i386-apple-darwin12.3.0 file names toolch...

Why 4 lines per request in Mac OSX apache access_log -

i have local virtualhost configured on macbook pro. (10.7.5) running default apache 2 , php 5.3.15. i added test.php <?php phpinfo(); ?> when access once via browser, 4 lines in access log show up: 127.0.0.1 - - [20/may/2013:19:15:10 -0700] "get /test.php http/1.1" 200 89145 127.0.0.1 - - [20/may/2013:19:15:10 -0700] "get /test.php?=phpe9568f34-d428-11d2-a769-00aa001acf42 http/1.1" 200 2524 127.0.0.1 - - [20/may/2013:19:15:10 -0700] "get /test.php?=suho8567f54-d428-14d2-a769-00da302a5f18 http/1.1" 200 2813 127.0.0.1 - - [20/may/2013:19:15:10 -0700] "get /test.php?=phpe9568f35-d428-11d2-a769-00aa001acf42 http/1.1" 200 2146 why there 4 entries single request? view page source in browser. i'm pretty sure you'll see things like: <img border="0" src="/test.php?=phpe9568f34-d428-11d2-a769-00aa001acf42" alt="php logo" /> when browser sees in page, of course goes , fetches url s...

actionscript 3 - AS3: Separate instances in an array? -

i'm making side scrolling game in as3, player spawns units automatically walks towards exit on other side of screen, there towers stopping them. towers shoot separately, there way? here's code, once if statements satisfied towers fire @ same time. private function tower1fire():void { (var j:int = creep1array.length - 1; j >= 0; j--) { each (var towerone:mctower1 in tower1array) { if (creep1array[j].x - towerone.x <= 100 && creep1array[j].y > towerone.y) { var newtower1bullet:mclaser1 = new mclaser1; newtower1bullet.x = towerone.x; newtower1bullet.y = towerone.y; tower1bulletarray.push(newtower1bullet); stage.addchild(newtower1bullet); } } } } i have 3 towers on screen, added using ...

ios - Resize TableCell on select/deselect -

i'm new ios , monotouch, , have pretty basic need - have 2 vastly different views display in same table cell depending on whether selected or not. when load app i'll present list of products in custom uitableview, rows deselected , each row showing product names in label. user taps 1 of rows , selects it, show different view more of shopping cart layout. since 2 views different have vastly different sizes. need cell (or row?) grow , shrink according natural height of whichever view being displayed. i'm using descendants of uitableviewcontroller, uitableviewsource, , uitableviewcell solution. add both versions cell's contentview, set hidden property needed when cell/row selected/deselected show right layout. works well. i'm in demo mode right now, i'm not overly worried efficiency or responsiveness, have come later. i know getheightforrow responsible sizing rows gets called once, when cell first shown. seems me need alert tableview re-poll source new size...

I want to make the asp.net MVC page configurable, any ideas? -

guys, applied big task make mvc page configurable. means: webpart in webform. 1.we can config partial view in view,make partial view enable or not,we can drag , drop partial view anywhere in container. 2.one partial view related simple mode(entity),and fields of form in partial view can configurable:enable or not , position can adjusted. now have ideas following: 1.i create model base, let other models inherit model base,model base hold metadata related fields , model itself. 2.render settings in model base hidden field throght html helper , partial view.and on client, use jquery handle layout according setting in hidden field. 3.the partial view let render only, , real logic hand on page contain partial view. think simple , extendable.right? so ideas here? think task complicate. in past, omar al zabir blog has portal website, called dropthings, maybe closed now. tried implemented things igoogle did. can see project @ codeplex . , can find ideas find of application @ ...

c# - Returning int value from @html.DropDownList -

actually have problem happened because of lack of knowledge in asp.net - mvc 4. trying getting selected value drop down , return controller (as integer). makes me more confuse other dropdownlist returning string value working fine. my model : public partial class product { public int id { get; set; } public string product_name { get; set; } public int category_id { get; set; } public string language { get; set; } } public partial class product_category { public int id { get; set; } public string category_name { get; set; } public string language { get; set; } } my controller : //populating viewbag listproductcategory = new list<product_category>(); listproductcategory = db.product_category.tolist(); ilist<product_category> prodcategories = db.product_category.tolist(); ienumerable<selectlistitem> selectlistcategory = c in prodcategories select new selectlistitem { text = c.category_name, value = c....

vb.net - System.IO.FileLoadException thrown for no reason -

when switching between tabs, whenever enter tabcurves control @ point after initial entry, system.io.fileloadexception thrown @ line lstcurves_selectedindexchanged(nothing, eventargs.empty) . baffling me, have sub ( tabnurbs_enter(...) ) has identical code, not throw exceptions. what going on here? code: private sub tabcurves_enter(byval sender object, byval e system.eventargs) handles tabcurves.enter ' see if tab enter event marked supressed... if tabmain.tag tabmain _ exit sub lstcurves.items ' remove old entries. .clear() ' add new curves. integer = 0 m_nis.curves.count - 1 .add(m_nis.curves(i).name) next end ' update selection. lstcurves_selectedindexchanged(nothing, eventargs.empty) end sub private sub lstcurves_selectedindexchanged(byval sender object, byval e system.eventargs) handles lstcurves.selectedindexchanged if lstcurves.selectedindex = -1 '...

objective c - string of the @exp@ in breakpoint Log Message has only one first symbol -

Image
i need trace program. made symbolic breakpoint: full string is: "class name @*(char*)object_getclassname(*(long*)($esp+4))@" but instead full class name have first 1 symbol on console i.e: "class name 'u'" why? have idea? ide : xcode 4.6.2. lldb. from screenshot seems have * before (char *) . dereferences string first character. update: log message class name @(char*)object_getclassname(*(long*)($esp+4))@ does not work intended because lldb prints pointer value instead of c string. workaround, can use method https://stackoverflow.com/a/12695845/1187415 : set action "debugger command" instead of "log message", set debugger command to expr -- (void)printf("class name %s\n",(char *) object_getclassname(*(long*)($esp+4)))

ios - Difference between @property and variable within interface declaration -

this question has answer here: properties , instance variables in objective-c 5 answers what's difference between putting variable inside of @interface{} declaration in header file, , putting in @property after declaration? e.g., @interface gamecentermanager : nsobject { gkinvite* pendinginvite; } @end as opposed to @interface gamecentermanager : nsobject @property (weak, nonatomic) gkinvite* pendinginvite @end declaring property generates getters , setters instance variable, according criteria within parenthesis. defining variables in brackets declares them instance variables. following links provides more info on these. http://www.cocoawithlove.com/2010/03/dynamic-ivars-solving-fragile-base.html is there difference between "instance variable" , "property" in objective-c? http://iphonedevelopment.blogspot...

chef can't create cron -

i tried simplest example given http://docs.opscode.com/resource_cron.html#examples cron "name_of_cron_entry" hour "8" weekday "6" mailto "admin@opscode.com" action :create end i use knife ssh make recipe run on chef client, , client gives error: error executing action create on resource cron[name_of_cron_entry] error updating state of name_of_cron_entry, exit: 1 has met same problem before? solutions? i stumbled same problem , found example using had newlines in it. problem cron provider runs crontab -u user - , pipes stdin process. appears doesn't accept newlines whatever reason. in /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider/cron.rb , found this: status = popen4("crontab -u #{@new_resource.user} -", :waitlast => true) |pid, stdin, stdout, stderr| stdin.write crontab end if status.exitstatus > 0 raise chef::except...

Difficulty assembling maven plugin with Eclipse IDE for android -

i trying assemble maven plug-in eclipse ide. want make android application. i have installed android-release archtype, , have made new maven project. when make new project, 3 files - projectname, projectname-it , projectname-parent formed. but shows error : groupid duplicate of parent groupid versionid duplicate of parent versionid in pom.xml of projectname , projectname-it file and error : multiple markers @ line - line breakpoint:helloandroidactivity [line: 21] - oncreate(bundle) - r cannot resolved variable in helloandroidactivity.java file of projectname. what should ?

c# - Why 'innerhtml' does not work properly for 'select' tag -

i trying set innerhtml of html select tag cannot set feature;therefor,i need use outerhtml feature.this way,not code hardcode ,but preposterous.i have read ' innerhtml ie 8 doesn't work properly? resetting form ',it did not though. i appreciate if tell me how set innerhtml feature of html select tag. c# code: public void setdefaultvalue(string controlid, string controlvalue) { system.windows.forms.htmldocument doc = webbrowser1.document; htmlelement htmlcontrol = doc.getelementbyid(controlid); string listresult; string listinnerhtml = ""; listinnerhtml += "<option value = " + lststring + ">" + lststring + "</option>"; listresult = "<select id = " + '"' + htmlcontrol.id + '"' + " type = " + '"' + htmlcontrol.getattribute("type") + '"...

cocos2d iphone - Joint on the edge of the circle -

Image
the green square box2d ground. the bigger circle connected ground revolute joint, , can rotated. all circles b2_dynamicbody i want joint smaller circles on edge or border of bigger circle shown below. please tell me how can achieve , kind of joint have use? when rotate big circle small circle should stick @ place. go through code.... // create joint between hook big circle wheelsprite = [[ccsprite alloc] initwithfile:@"herowheel.png"]; wheelsprite.visible = false; wheelsprite.scale = 1.0*hero_size_factor; wheelsprite.rotation = 0.0; wheelsprite.anchorpoint = cgpointmake(0.5,0.5); [layer addchild:wheelsprite z:5]; ballbodydef.userdata = wheelsprite; //create hook between big circle hook = world->createbody(&ballbodydef); b2polygonshape hookshape; hookshape.setasbox(0.2,0.1); b2fixturedef hookdef; hookdef.shape=&hookshape; hookdef.density=0.5f*hero_size_factor; hookdef.friction = 0.0f; hookdef.restitution = 0.0f; hookdef.filter....

Javascript MVVM Organization View empty, ViewModel full of code -

i end having code inside viewmodel because there nothing suits. should go view ? examples ? depends on library use. e.g angularjs ( http://angularjs.org ) has ability use expressions in views : http://docs.angularjs.org/guide/expression the goal have view based logic (even expressions) in view. , business logic in viewmodel. having such expressiveness missing in other libraries e.g in knockout view pretty dumb.

regex - convert string to int in java -

i have string has int value in it. want extract int value string , print. string str="no. of days : 365"; string dayswithsplchar = str.replaceall("[a-z][a-z]","").trim(); char[] ch = dayswithsplchar.tochararray(); stringbuffer stb = new stringbuffer(); for(char c : ch) { if(c >= '0' && c <= '9') { stb.append(c); } } int days = integer.parseint(stb.tostring()); is there better way this. please let me know. try string.replaceall string str = "no. of days : 365"; str = str.replaceall(".*?(\\d+).*", "$1"); system.out.println(str); you get 365

Quickly Coloring a Graph's Edges -

suppose greedily assigning colors edges of graph g = (v,e) follows, select uncolored edge (u,v) identify colors of edges touching u , select lowest unused color. same v. assign (u,v) larger of 2 colors. a trivial way perform step 2 check colors 1,2,... until coming across 1 not used edge touching u . there faster way? just @ this . depending on yout want, can have variations of algorithms can have performance boost, wether you're looking 1 or solutions.

java - Google Map V2 on Top half of the android screen and list view on the bottom half of the android screen -

i working on android project in need show google map v2 on top half of android screen , in bottom half of same android screen, need show listview . below code, have far launched launch application. have setup androidmanifest.xml file google map v2 key . public class sampleactivity extends activity { @targetapi(11) @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.sample); if (build.version.sdk_int >= build.version_codes.honeycomb) { getactionbar().hide(); } findviewbyid(r.id.sample_button).setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { int width = (int) typedvalue.applydimension( typedvalue.complex_unit_dip, 40, getresources() .getdisplaymetrics()); ...

python - How to create a legend for 3D bar in matplotlib? -

Image
given ax = plt.subplot() : ax.bar()[0] can passed plt.legend() . however, ax.bar3d() returns none . how create legend displayed bars? update: passing legend="stuff" ax.bar3d() , calling ax.legend() raises /usr/lib/python2.6/site-packages/matplotlib/axes.py:4368: userwarning: no labeled objects found. use label='...' kwarg on individual plots. warnings.warn("no labeled objects found. " you need use proxy artist legends not supported. this code: from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot plt import numpy np fig = plt.figure() ax = fig.add_subplot(111, projection='3d') x, y = np.random.rand(2, 100) * 4 hist, xedges, yedges = np.histogram2d(x, y, bins=4) elements = (len(xedges) - 1) * (len(yedges) - 1) xpos, ypos = np.meshgrid(xedges[:-1]+0.25, yedges[:-1]+0.25) xpos = xpos.flatten() ypos = ypos.flatten() zpos = np.zeros(elements) dx = 0.5 * np.ones_like(zpos) dy = dx.copy() dz = hist.flatten() ax...

grails - Ignore WebSocket connection in Spring Security SavedRequest -

i have grails application spring-security-core plugin , atmosphere framework. if log out page has opened websocket connection, spring security keeps url of websocket connection savedrequest. debug savedrequest.httpsessionrequestcache - defaultsavedrequest added session: defaultsavedrequest[http://localhost:8080/formx/formx/update] debug savedrequest.httpsessionrequestcache - defaultsavedrequest added session: defaultsavedrequest[http://localhost:8080/formx/formx/notifications/?x-atmosphere-transport=close&x-atmosphere-tracking-id=b5d8fde4-d950-41fd-9b49-02e06799a36f&conversationid=988080042] the first entry in log has correct value savedrequest, somehow overwritten atmosphere websocket connection. how tell spring security not use atmosphere websocket connection savedrequest? i guess can use atmosphere protocol specific header distinguish connections. in java config can set requestmatcher - it's easy. in websecurityconfigureradapter: protected ...

c# - How to set new XML document from XML feed -

is there possibility set new xml document specific fields xml feed? public string xmlresult; public void page_load(object sender, eventargs args){ string url = string.format("http://search.twitter.com/search.atom?q=test&show-user=true&rpp=10"); httpwebrequest request = webrequest.create(url) httpwebrequest; using (httpwebresponse response = request.getresponse() httpwebresponse) { streamreader reader = new streamreader(response.getresponsestream()); xmlresult = reader.readtoend(); console.writeline("output: " + xmlresult); } xmldocument doc = new xmldocument(); doc.loadxml(xmlresult); response.contenttype = "text/xml"; response.write(doc.outerxml); } i make new xml document specific fields in example below. <feed> <entry> <content></content> <author></author> <created_time></created_time> </ent...

sql server 2008 - T-SQL - How to update these records -

myfield description ------- ----------- a001 alcantara a002 apacible arctic arkansas b001 backdoor ballpen brother ..and on on records above, how query (in 1 query possible) in t-sql update having output this: myfield description ------- ----------- a001 alcantara a002 apacible a003 arctic a004 arkansas b001 backdoor b002 ballpen b003 brother thanks in advance! try this: ;with cte ( select myfield,description,row_number() on (partition left([description],1) order [description]) rn table1 ) update cte set myfield=left(description,1) +case when rn <= 9 '00' else '0' end+cast(rn varchar(3)) cte

escaping - How to escape curly braces in hibernate validator messages (test case provided) -

i want put {this} message value hibernate validator validation message. so escaped value of given message in properties file :\{this\} however hibrnate validator tries check if there message given key. think bug maybe doing wrong? (tested hibernate-validator 4.3.1 , 5.0.1 - same result - stack overflow test case: (for simplification not have properties file, return value java class. in reality handlegetobject read value custom-provided properties): import org.hibernate.validator.hibernatevalidator; import org.hibernate.validator.hibernatevalidatorconfiguration; import org.hibernate.validator.internal.engine.constraintvalidation.constraintvalidatorfactoryimpl; import org.hibernate.validator.messageinterpolation.resourcebundlemessageinterpolator; import org.hibernate.validator.spi.resourceloading.resourcebundlelocator; import org.junit.test; import javax.validation.*; import javax.validation.constraints.max; import java.util.enumeration; import java.util.locale; import jav...

php - nmap to check battery installed or not -

i'm working on project scan lan , display reslut in html/php/mysql using nmap commands. similar application spiceworks. in spiceworks said categorized nmap output according following criteria. laptops: machines respond wmi or ssh ports , found have battery installed. desktops: machines respond wmi or ssh ports, but not have battery installed , not running server operating system. now can categorized results according open ports butii can't find battery status (available or not). there nmap command find battery status in given ip? or have idea using find battery installes during scan? powercfg -devicequery all_devices|find "battery" >battery.log set empty=y /f %%i in (battery.log) set empty=n if %empty%==y ( ... del battery.log ) else ( ... del battery.log ) pause

opencv - Android Camera takePicture is using Previews small buffer -

i developing project using opencv. have process on oncameraframe. while shows previews, user can take photo. in devices, take error after called takepicture(...) method. should do? e/camera-jni(11783): manually set buffer small! expected 539380 bytes, got 460800! new symptom: buffer's size frame size, 460800. logged frame size @ oncameraframe . every frame's sizes 460800. far understand, takepicture tries use previews buffer. , theirs sizes different. i solved kind of problem. seems on android 2.2.1 have set camera parameters before call camera.startpreview() however on later systems android 3.2.1 no longer issue (however vendor specific).

ios - Why does self.SwipeDirection work if the property is called swipeDirection? -

i have simple viewcontroller derived uiviewcontroller have added enum property swipedirection. in code refer self.swipedirection in 1 instance notice have mistakenly typed self.swipedirection. if jump definition right variable , code compiles , runs correctly sure correct variable being used. .h file enum escrolldirection { e_scroll_direction_none = 0, e_scroll_direction_left, e_scroll_direction_right, e_scroll_direction_up, e_scroll_direction_down }; typedef enum escrolldirection escrolldirection; @interface processingviewcontroller : uiviewcontroller <uiscrollviewdelegate> @property(nonatomic, assign)escrolldirection swipedirection; @end .m file - (void)scrollviewdidscroll:(uiscrollview *)sender { cgpoint offset = self.graphscrollview.contentoffset; self.swipedirection = [self getscrolldirection:self.previoustouchpoint endpoint:self.graphscrollview.contentoffset]; // ... } in theory properties compiled setter method call follo...

ios - iPhone @1x artwork 'multiple build' errors -

i've added @1x artwork iphone app i'm getting 'multiple build commands output file' each piece of @2x artwork. appreciated thanks! only check required resource file required target only

android - to prevent softkeyboard from moving up of layout -

when softkeyboard shows,it pushes rest of content screen.how adjust this. i have tried using adjust pan,adjust resize , stuffs of no use. this layout <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" tools:ignore="uselessparent" > <relativelayout android:id="@+id/top_layout" android:layout_width="fill_parent" android:layout_height="40dp" android:background="@drawable/post_header_background" tools:ignore="uselessparent" > <textview android:id="@+id/sender_name_txtvw" android:layout_width="wrap_conte...

Texture rendering appears Dull (openGL ES 2.0 iOS) -

ive started opengles2.0 on ios , im trying render texture onto screen. the problem texture appears different (dull , monochromatic) compared real image supposed render. in sense true colors of texture image isnt reflected while rendering using opengl the shader program quite simple: fragment shader varying lowp vec4 destinationcolor; varying lowp vec2 texcoordout; uniform sampler2d texture; void main(void) { gl_fragcolor = texture2d(texture, texcoordout); } vertex shader attribute vec4 position; uniform mat4 projection; uniform mat4 modelview; attribute vec2 texcoordin; varying vec2 texcoordout; void main(void) { gl_position = projection * modelview * position; texcoordout = texcoordin; } the same texturing worked fine on opengl es 1.0, colors showing correctly! edit: opengl context setup code: - (void)setupcontext { eaglrenderingapi api = keaglrenderingapiopengles2; _context = [[eaglcontext alloc] initwithapi:api]; if (!_...

Java single dimention arrays equating two variables of different size -

class myarray{ public static void main(string args []){ int x[]={2,3}; int y[]={4,5,6}; system.out.println(x);/*gives [i@5445a*/ system.out.println(y);/*[i@5442c */ x=y; system.out.println(x); /*gives same of y (i.e [i@5442c ). happen here?*/ system.out.println(x[2]);/* gives 6*/ } } but happen when use "x=y" ?does address of y goes x or else?is garbage value? array variables references class-typed variable. x , y contain references array somewhere in memory. let's @ assignment: but happen when use "x=y" ? yes, objects in java, address array y stored in x. result x , y reference same array , array referenced x lost (and garbage collected). if instead want copy of y assigned x try: x = arrays.copyof(y, y.length) a tip: try using following code if want print contents of array: system.out.println(arrays.tostring(x)); for more info arrays class try: http://docs.oracle.com/javase/6/docs/api/ja...

iphone - <Error>: GeezaPro: FT_Load_Glyph failed: error 6 -

i have 2 view controllers in application, when use (segue) push second view controller (detail view controller), face error : : geezapro: ft_load_glyph failed: error 6. this error displayed in debug area while detail view controller opened. note: don't have sharekit in application. can know reason of error , how fix please

java - FormHttpMessageConverter filename from byte array -

i'm trying upload file post request. post must of enclosure-type multipart/form-data. insert file byte array: multivaluemap<string, object> requestparameters = new linkedmultivaluemap<string, object>(); byte[] image=getimage(); // ... adding parameters in requestparameters // todo filename requestparameters .add("file", image); then make post request org.springframework.http.converter.formhttpmessageconverter: formhttpmessageconverter multipartformconverter = new formhttpmessageconverter(); multipartformtemplate = new resttemplate(); multipartformtemplate.setmessageconverters(collections.<httpmessageconverter<?>> singletonlist(multipartformconverter)); responseentity<string> uploadanswer=multipartformtemplate.postforentity(freeplanresponse.geturl(), requestparameters, string.class); the problem - cant found, how change filename . result default filename ( ${filename} ) file hosting, i'm using...

Parsing XML with ActionScript 3.0 -

i have xml goes this: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <root xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <row> <columna>2013-08-07</columna> <columnb>pizza</columnb> </row> <row> <columna>2013-04-07</columna> <columnb>burger</columnb> </row> <row> <columna>2013-04-07</columna> <columnb>pizza</columnb> </row> the xml goes on hundreds of rows. trying achieve this. "output: pizza: 2 occurances on 2013-08-07 & 2013-04-07." far i've tried: //variables var myxml:xml; var xmlloader:urlloader = new urlloader(); //check xml loaded xmlloader.load(new urlrequest ("myxml.xml")); xmlloader.addeventlistener(event.complete, processxml); function processxml(e:event):void { myxml = new xml(e.target....

android - How to run an emulator using Galaxy S4 configuration? -

i have created galaxy s4 emulator using post how open galaxy s4 emulator problem when tried run emulator takes long time , @ last said time out. ram 6gm. , created emulator providing 800mb ram. , laptop screen resolution hd. how resolve problem because have test app in galaxy s4. emulators slow. no matter configuration have. testing in emulator doesn't mean it'll give same behaviour in real device. unless samsung decided so, won't available android sdk predefined config. may need manually set configurations (which have done). os gonna run in s4 customised samsung yet again said earlier won't sdk package.

c++ - Using vertex_name when reading a GraphML file with Boost Graph -

i trying load simple graphml file such each vertex has vertex name stored in graphml. can change graphml, important thing have access vertex_name code afterwards. here's minimal example extract still shows problem: #include <iostream> #include <string> #include <fstream> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/graphml.hpp> int main() { using namespace boost; typedef adjacency_list<vecs, vecs, directeds,property<vertex_name_t,std::string> > boostgraphtype; typedef dynamic_properties boostdynamicproperties; std::string fn = "simple.graphml"; std::ifstream is(fn.c_str()); if (!is.is_open()) { std::cout << "loading file '" << fn << "'failed." << std::endl; throw "could not load file."; } boostgraphtype g; boostdynamicproperties dp ; const std::string vn = "vertex_name"...

javascript - Behavior of 'return' and 'new' in constructors -

i wonder what's difference between these 2 calls: var = array(1,2,3); var b = new array(1,2,3); i tried mimic behavior way: function test() { return {x:42}; } var = test(); var b = new test(); console.log(a,b); // same how possible b same a ? if new used, return value should ignored: function test() { return 1; } var = test(); var b = new test(); console.log(a,b); // 1 test{} when call function using new , new object created , passed function this . if function doesn't return (or returns primitive), new object passed in result of new expression. but , if function returns object, new object created thrown away , object returned function result of new expression instead. covered in turgid prose in section 11.2.2 of spec. it's useful immutable objects constructor maintains kind of cache , reuses instances if arguments identical (or of course, singletons). so in example, since test function returns object, calling via new creates , throws a...

how to use nsdocuments directory for downloads in iphone -

i have iphone app downloads option , iam using nsdocument directory path downloading.but after download how can access documents path in iphone. need install other app file access . if yes, please tell me app.thank . //nsdownloadsdirectory = download folder //nsdocumentdirectory = document folder nsarray *patharr = nssearchpathfordirectoriesindomains(nsdownloadsdirectory , nsuserdomainmask, yes); nsstring *downloadsdir = [paths objectatindex:0]; store content path(you can create folder in too.). , fetch files stored in folder, enumerating files in directory

android : error in datepicker -

i using link provide date picker in android app but getting error: 05-21 10:19:08.712: e/androidruntime(13265): android.view.windowmanager$badtokenexception: unable add window -- token android.app.localactivitymanager$localactivityrecord@40d42048 not valid; activity running? 05-21 10:19:08.712: e/androidruntime(13265): @ android.view.viewrootimpl.setview(viewrootimpl.java:567) 05-21 10:19:08.712: e/androidruntime(13265): @ android.view.windowmanagerglobal.addview(windowmanagerglobal.java:246) 05-21 10:19:08.712: e/androidruntime(13265): @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) 05-21 10:19:08.712: e/androidruntime(13265): @ android.app.dialog.show(dialog.java:281) 05-21 10:19:08.712: e/androidruntime(13265): @ android.app.activity.showdialog(activity.java:3071) 05-21 10:19:08.712: e/androidruntime(13265): @ android.app.activity.showdialog(activity.java:3021) how resolve error??? please help!!! heres java code: public c...

proguard - What symbolicated crash reporting means in android -

i started using crittercism crash reporting tool android app . their web shows content beyond tiny head. like an alert message "to symbolicated crash reports, upload proguard mapping files matching app's version in app settings page" afaik both symbolicated , proguard mapping used ios crash debugging , irrelevant android. gut feeling website wrongly provides these things in android app well. or may there android well, not aware of . please educate me if case. here's brief summary of proguard (from proguard site ): proguard free java class file shrinker, optimizer, obfuscator , , preverifier. detects , removes unused classes, fields, methods, , attributes. optimizes bytecode , removes unused instructions. renames remaining classes, fields, , methods using short meaningless names. finally, preverifies processed code java 6 or higher, or java micro edition. the main thing note, concerns crittercism , proguard can used obfu...

cordova - Phonegap javascript globalization detect languages and redirect to .html files -

i know topic before can´t find proper solution it. i want detect language on devices phonegap, can redirect user right indexlanguagex.html document. i´ve got code phonegap documentation: function checklanguage() { navigator.globalization.getpreferredlanguage( function (language) {alert('language: ' + language.value + '\n');}, function () {alert('error getting language\n');} ); } this should check preferred language , alert it, right? doesn´t work on android device.. tried phonegap alert version, doesn´t work either. can tell me how can work? after alert, still need redirect. thought work like: function (language) {if (language.value=us_en) { window.locaton="indexlanguagex.html"}}, figured out topic function checklanguage() { navigator.globalization.getpreferredlanguage( function (language) { if(language.value == "english") { window.location.replace("newdocument...

algorithm - All Paths Between 2 vertexes in R -

i use igraph. i want yo find possible paths between 2 nodes. for moment, there doesn't seem exist function find paths between 2 nodes in igraph i found subject gives code in python: all possible paths 1 node in directed tree (igraph) i tried port r have little problems. gives me error: error of (newpath in newpaths) { : for() loop sequence incorrect here code: find_all_paths <- function(graph, start, end, mypath=vector()) { mypath = append(mypath, start) if (start == end) { return(mypath) } paths = list() (node in graph[[start]][[1]]) { if (!(node %in% mypath)){ newpaths <- find_all_paths(graph, node, end, mypath) (newpath in newpaths){ paths <- append(paths, newpath) } } } return(paths) } test <- find_all_paths(graph, farth[1], farth[2]) here dummy code taken igrah package, sample graph , nodes: actors <- data.frame(name=c("alice", "bob", "cecil", "d...

BlackBerry read json string from an URL -

Image
i tried read json string loading url , not find complete code sample. can 1 provide or point me complete client code. i'm newer bb development. this have done still can't work please me. thanks! to read , parse data url need implement 2 routines. first 1 of them handle reading data specified url on http connection, , second 1 parse data. check following application httpurlreaderdemoapp , first read data specified url , parse retrieved data. url used retrieve data: http://codeincloud.tk/json_android_example.php sample data format: {"name":"froyo", "version":"android 2.2"} classes: httpurlreaderdemoapp - uiapplication instance httpresponselistener - interface used notify other classes http request status httpurlreader - reads data given url appmainscreen - mainscreen instance dataparser - parse data datamodel - data definition screenshots: request data when data retrieved successfully par...

ios - "Install prohibited" when trying to install ad hoc .ipa file -

i have following problem - trying install ad hoc .ipa file on ipad 2, model mc979hc/a ios version 6.1.3 . when try install app via iphone configuration utility or itunes says: " an unknown error message 'install prohibited', received device. " app created using xcode 4.6.1 . installed same app on ipad 2 ios version 6.0. problem, because can't find solution on internet? guess can version of xcode , ios. have mention in ipad 2 general settings, restrictions disabled. if enable restrictions, option "installing apps" set off , not active, can't change it. how activate option? you may have installed other app in iphone same provisioning profile. please uninstall app same provisioning profile installed , install again clean build.

jquery - Additional Play Button for HTML5 Flowplayer -

i using latest version (v5.4.1) of html5 flowplayer , trying add additional play button, video start click on button click on video container. therefore i've embedded video in overlay (which working fine): <div id="overlay"> <div id="is-finished-demo" class="flowplayer is-splash is-closeable color-alt" data-swf="js/flowplayer.swf"> <video preload='none'> <source type="video/mp4" src="media/video.mp4" /> <source type="video/ogg" src="media/video.ogv" /> <source type="video/webm" src="media/video.webm" /> </video> <div class="when-video-ends"> <a class="fp-toggle"> <div class="play-this-again"></div> </a> </div> </div> </div> <scr...