Posts

android - trying to open the sdcard's .txt file in my EditText -

i trying open sdcard's .txt file in edittext change text in , save changes using button click not going in right way .may know correct way achieve objective? try one.. must set permission in manifest file: <uses-permission android:name="android.permission.write_external_storage"/> file f = new file(environment.getexternalstoragedirectory().getabsolutepath() + "followed ur file dir"); file f = new file(environment.getexternalstoragedirectory().getabsolutepath() + "sdcard.txt"); (file wavfile : f.listfiles()) { string str = wavfile.getname().tostring(); stringbuffer stringbuffer = new stringbuffer(); string adatarow = ""; string abuffer = ""; try { file myfile = new file("/...

iphone - strange exception NSInvalidArgument on viewDidLoad ios7 -

ok, im writing app iphone under ios7, using xcode 5 i've got main view controller table view controller, , on start good, view loads without errors, after leave view controller, use other scenes, , rewind via segue got this: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[__nsarraym insertobject:atindex:]: object cannot nil' here code of method - (void)viewdidload { [super viewdidload]; nslog(@"from collectinfotvc, viewdidload"); // set side bar button action. when it's tapped, it'll show sidebar. _sidebarbutton.target = self.revealviewcontroller; _sidebarbutton.action = @selector(revealtoggle:); // set gesture [self.view addgesturerecognizer:self.revealviewcontroller.pangesturerecognizer]; _cancelcarbutton.hidden = yes; } could guys please me ? upd.#1: call stack looks this 2014-03-24 11:48:23.286 demotaxi[28008:60b] *** terminating app due uncaught exception ...

python - SWIG function not printing output -

i'm having prblem in executing function i've written in c. i've made , interface file given below: %module cnode %{ #include "cnode.h" %} %include "cnode.h" and here c program : #include <stdio.h> #include "cnode.h" void kill(void) { printf("method executed\n"); } the header file: void kill(void); when i'm trying execute in python interpreter, don't output. there problem declarations or bug? figured out, kill() predefined function won't work. changing name of function works fine.

css - I want to align grid in center -

as see code grid_2 has float left. added center class fix in center div block floating left. want place grid_2 div in center. can 1 me fix this? html code: <div class="center"><div class="grid_2">content goes here </div> </div> css: .grid_0 { width: 100%; margin-bottom: 15px; display: block; } .grid_1, .grid_2, .grid_3, .grid_3c, .grid_4, .grid_4c { margin-left : 1.00%; margin-right : 1.00%; margin-bottom : 15px; float : left; display : block; -webkit-box-sizing: border-box; /* safari/chrome, other webkit */ -moz-box-sizing: border-box; /* firefox, other gecko */ box-sizing: border-box; /* opera/ie 8+ */ } .center{ display: block; text-align: center; margin: 0 auto !important; } .grid_1 { width: 98%; } .grid_2 { width: 48%; } please find link below http://jsfiddle.net/kiranm/aqbs6/5/ ok, here problem lies in width of grid_2. as width of grid_2 = 48% of...

oop - Function for all prototypes - Javascript -

i'm working on video player video.js. on side i've got elements (volume, fullscreen, play, pause...) prototypes . on other side i've got functions parse() going use of canvas prototypes (they come different elements). parse function : vjs.parsehex = function(c) { if(c.charat(0) == "#") { return c.substring(1,7); } else if(c.substr(0,2) == "0x") { return c.substring(2,8); } else { return c; } }, vjs.parsered = function(c) { return parseint((this.parsehex(c)).substring(0,2),16); }, vjs.parsegreen = function(c) { return parseint((this.parsehex(c)).substring(2,4),16); }, vjs.parseblue = function(c) { return parseint((this.parsehex(c)).substring(4,6),16); } an exemple of canvas prototype : js.volumebar.prototype.drawsound = function(){ . . . } i want parse functions accessible of different prototypes. possible ? if yes, how can that? thank helping me, léa. it seems vjs sort...

neo4j - Relationship properties are confused with nodes resulting in SyntaxError: Don't know how to compare that -

if make following cypher query results expected: match (:keydata {key:"kgv"})<-[k:keydata]-(s:symbol) k.value>15.0 return k.value nodes of label keydata have properties {key: "some string"} nodes of label symbol have properties {key: "some string"} relationships of label keydata have properties {value: 123.45} but if symbol nodes matched before: match (s:symbol) match (:keydata {key:"kgv"})<-[k:keydata]-(s) k.value>15.0 return k.value i error: don't know how compare that. left: "evn" (string); right: 15.0 (double) i using neo4j 2.0.1 you comparing string value double value, not possible. have 2 options. store values in different type or use neo4j 2.1.0-m01 , use tofloat() method. e.g. where tofloat(k.value)>15.0

Contact Form PHP Email Script -

Image
hello having problem email script on site. i used files https://jonbake.com/blog/bootstrap-3-contact-form-with-captcha/ but add fields. sending email i'm not receiving data inputted on fields. here html form <form role="form" id="feedbackform"> <div class="form-group"> <input type="text" class="form-control" id="first_name" name="first_name" placeholder="first name"> <span class="help-block" style="display: none;">please enter name.</span> </div> <div class="form-group"> <input type="text" class="form-control" id="last_name" name="last_name" placeholder="last name"> <span class="help-block" style="display: none;">please enter name.</span> </di...

SQL server time related -

i want take fields 9 pm 11 table month in sql server 2008. i tried select * your_table datecol between (datecol=cast (getdate() date) , timecol<'21:00:00') , (datecol=cast (getdate() date) , timecol<'11:00:00') , datecol between '2014-01-01 00:00:00.000' , '2014-01-31 23:59:59.760' for month, fields time of 9pm t0 11 am try ! ;with cte ( select *,cast(datetime_col time) x1,cast(datetime_col date) x2 table001 ) select * cte x1 between 21:00:00 , 11:00:00 , x2 between 01-jan-2014 , 31-jan-2014 read date formats

Why isn't this AJAX request waiting? -

i try make ajax request jquery flickr, single images url , return src process further, jquery doesn't wait, returns default declaration of "": function getflickr(url){ var src = ""; var settings = $.extend({ url : url, key : '61328c74e544a789b356a36aec03acfe', secret : 'f119e504140f0964' }), id, method = 'flickr.photos.getinfo', format = 'json', id = settings.url.match(/\/photos\/(.*)/)[1].split('/')[1]; $.ajax({ type: 'get', url: 'http://www.flickr.com/services/rest/?method='+method+'&format='+format+'&api_key='+settings.key, async: false, datatype: 'json', data: {'photo_id':id}, jsonpcallback: 'jsonflickrapi', success: function(data){ src = 'http://farm'+data.photo.farm+'.static.flickr.com/'+data.photo.server+'/'+id+'_'+data.photo.secret+'.jpg'; ...

java - JOptionPane Input Dialog how to decide if the value is 2 or JOptionPane.CANCEL_OPTION -

i use following code inputdialog: string c = joptionpane.showinputdialog("select number",joptionpane.ok_option); i want user uses integervalues between 0 , 100. handle following code: while(notallowed){ try{ int t =integer.parseint(c); if(t==joptionpane.cancel_option) { notallowed=false; cancel=true; } if(t<=100 && t>0 &&notallowed) notallowed=false; } catch( exception err) {} if(notallowed) c = joptionpane.showinputdialog("only numbers between 1 , 100 allowed"); } now if uses types number 2 clicking cancel button because value of joptionpane.cancel_option 2. how can find out if cancel clicked or input value 2. joptionpane returns null if user clicks on cancel. otherwise value returned. figured out using small example: public class joptionpanetest { public static void main(string[] args) { object obj = ...

php - Is "mysqli_query() or die(mysqli_error())" a good practice? -

so use structure execute queries on php, other day pointed out bad practice. could tell me why wrong , give me tips on should instead? i'm looking learn , improve code. thanks in advance. this practice awful. it's bad heredity last century ways of writing code. instead, have add line before connection code mysqli_report(mysqli_report_error | mysqli_report_strict); it relieve need of writing code every mysql call, make mysqli throw exception in case of error automatically. while exception way better regular error, can caught , gracefully handled. yet converted error, if not caught, again right - because regular errors, depends on site-wide settings, can either shown on-screen or logged. again without need of writing single line of code. while developing, have display_errors setting on , see errors moment occurred. while on live site, display_errors have turned off , log_errors have on instead - , make exception logged, future reference.

c++ - Arduino hangs during multiple http requests on Linux but not on Windows -

Image
i have problem when send http requests arduino linux mysql server. randomly hangs after requests (~150) on windows runs smoothly. because of thinking problem not on arduino code somewhere else. the linux server runs on raspberry pi (raspbian). any suggestions? the arduino code here if(!getpage(server,serverport)) serial.print(f("fail ")); byte getpage(ipaddress ipbuf,int thisport) { int inchar; serial.print(f("connecting...")); if(client.connect(ipbuf,thisport)) { serial.println(f("connected")); strcpy(outbuf,"get /write3.php?value0="); itoa(value0,tbuf,10); strcat(outbuf,tbuf); strcat(outbuf,"&value1="); itoa(dht_humidity,tbuf,10); strcat(outbuf,tbuf); strcat(outbuf,"&value2="); itoa(temperature,tbuf,10); strcat(outbuf,tbuf); strcat(outbuf,"&value3="); itoa(pressure,tbuf,10); strcat(outbuf,tbuf); strcat(outbuf,...

java - How to use delimiter using scanner when the file contain "0195153448";"Classical Mythology";"Mark P. O. Morford";"2002";"Oxford University Press" -

how use delimiter using scanner in java when text file contain following line. "0195153448";"classical mythology";"mark p. o. morford";"2002";"oxford university press" how output: 0195153448 classical mythology mark p. o. morford 2002 oxford university press please tell me how use scanner delimiter in java here. scan.usedelimiter(pattern.compile(";")); scanner.usedelimiter("");

c# - is a Field but used like a Type error -

did miss "using"? because how see use instance not type. the error appears first time use of "settings" using system; using system.collections.generic; using system.linq; using system.text; using system.xml; using system.windows.markup; namespace ampelthingy { class save { stringbuilder outstr = new stringbuilder(); xmlwritersettings settings = new xmlwritersettings(); settings.indent = true; settings.omitxmldeclaration = true; settings.newlineonattributes = true; xamldesignerserializationmanager dsm = new xamldesignerserializationmanager(xmlwriter.create(outstr, settings)); dsm.xamlwritermode = xamlwritermode.expression; xamlwriter.save(wrappanel1, dsm); string savedcontrols = outstr.tostring(); file.writealltext(@"aa.xaml", savedcontrols); } } theres lot more wrong code, please wrap code in method. you have namespace { class { ...

ios - creating walls for simple maze game -

i doing single view game demo, maze game walls. player control character uibutton. basically have devised need check if in next step, character going intersect wall, character movement return false. but, cannot seem put them together. i have boolean function check if character going intersect wall -(boolean) checkcollision : (cgrect) newframe{ cgrect frame = self.mainchar.frame; frame.origin.x = self.currentpoint.x; frame.origin.y = self.currentpoint.y; (uiimageview *image in self.hardwalls) { if (cgrectintersectsrect(frame, image.frame)) { return true; } } return false; } my uibutton movement is -(ibaction)charmovingleft:(id)sender; { cgpointmake(mainchar.center.x -charmovement, mainchar.center.y); what should adding button method stop movement when intersection going happen? thanks in advance -(ibaction)charmovingleft:(id)sender { cgrect newframe = your_characters_frame_if_it_moved; if (![self checkcollision:newframe]; ...

java - Use fragments ans swipe views without extend fragmentsActivity -

my main activity have classic tabs, want implement swipable tabs in main actuvity, in every tutorial/guide i've found, each time main activity extends fragmentactivity : public class mainactivity extends fragmentactivity implements actionbar.tablistener { but, have other things in activity, main activity extends activity, question : how add fragments, view pager , other methods, in activity extend activity ? source http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ to host fragments, activity needs fragmentmanager , needs extend fragmentactivity , 1 standard library, or 1 support library. there no other choice.

actionscript 3 - Local connection from Flash to Air not sending data -

im trying pass score as2 swf as3 air application. first im listening local connection , loading as2 swf onto as3 air application. here's receiving side code(as3 air application): var lcairget:localconnection = new localconnection(); lcairget.allowdomain("*"); lcairget.client = this; lcairget.connect("_myconnection"); function savescore(score:string):void { trace("score: "+score); } and sending side code in as2 swf is: var lcairset:localconnection = new localconnection(); lcairset.allowdomain("*"); lcairset.send("_myconnection", "savescore", 50); but score not getting sent. i'm missing? pls help...

VBA Select value from a multicolumn listbox -

before had insert column listbox 1 working fine: listbox1.value = ws.range("g5").value it selects listbox value based on value in "g5" i achieve same functionality two-column listbox, selection in first column of listbox based on "g5" value also 1 give me error : listbox1.column(0).value = ws.range("g5").value

php - jQuery .click method doesn't work on <a> that was already made by previous method -

html: <div id="ajax_search_add_button_div"> <a id="ajax_search_add_button" style="cursor: pointer;">add</a> </div> <div id="ajax_search_added_items"> selected items: <table> <tr> <td>nr.</td> <td>item name</td> <td>amount</td> <td></td> </tr> </table> </div> javascript 1 $("#ajax_search_add_button").click(function() { $("#ajax_search_added_items table").append('<tr><td>1</td><td>2</td><td>3</td><td><a id="ajax_search_remove_button" style="cursor: pointer;">remove</a></td></tr>'); }); javascript 2 $("#ajax_search_remove_button").click(function() { $(this).closest("tr").remove(); }); why nothing happen...

android - How can I get button pressed time when I holding button on -

i have button, press , continue holding it, if holding time exceeds time interval fires kind of intent, how can this. try this you can use touch listener this. try: handler handel = new handler(); b.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view arg0, motionevent arg1) { switch (arg1.getaction()) { case motionevent.action_down: handel.postdelayed(run, 5000/* or amount of time want */); break; default: handel.removecallbacks(run); break; } return true; } }); where b view (in case should button) on want make long click. and runnable run follows runnable run = new runnable() { @override public void run() { // code run on long click } }; hope help... :)