Posts

Showing posts from May, 2013

xcode - When I rotate a imageView, size shrinks -

Image
above image view before executing following code. @interface viewcontroller () @property (nonatomic, weak) iboutlet uiview *layerview; @end @implementation viewcontroller @synthesize layerview; - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. cgaffinetransform transform = cgaffinetransformmakerotation(m_pi_4); self.layerview.layer.affinetransform = transform; } ... // more code and, above image view after executing code. want snowman rotated same size. but, reason it's giving me small snowman... can notice bug? layers use catransform3d, not cgaffinetransform. 2 not interchangeable. you should getting compiler warning code. there equivalent functions manipulating catransform3d. in case want catransform3dmakerotation. method rotates around 3d vector. want pass in 0 x , y, , 1 z of vector. make layer perform flat 2d rotation code cgaffinetransform applied view.

php - Where does `recipe` hash come from in chef? -

to use php-fpm use code. $ knife cookbook create ppa $ vi site-cookbooks/ppa/recipes/default.rb apt_repository "nginx-php" uri "http://ppa.launchpad.net/nginx/php5/ubuntu" distribution node['lsb']['codename'] components ["main"] keyserver "keyserver.ubuntu.com" key "c300ee8c" end http://community.opscode.com/cookbooks/apt and added recipe[apt] runlist . i want know come recipe hash. keys same directories of cookbooks ? i don't know when these directories created. the pattern follows recipe[cookbook_name::recipe_name] a short hand recipe[cookbook_name::default] is recipe[cookbook_name] the cookbook_name name defined in each cookbook's metadata.rb file. cannot assume directory name same cookbook name. the recipe_name the name of file in recipes directory sans .rb extension.

java - How to redirect on login page after logout -

i want when click on log out tab redirect on login page after logout. not go on login page. home.jsp <ul><li><a href="http://pushkalit.in/logout.jsp"> logout</a></li></ul> logout.jsp <% try { if(session.getattribute("username") != null) { response.setheader("cache-control","no-cache"); response.setheader("cache-control","no-store"); response.setheader("pragma","no-cache"); response.setdateheader ("expires", 0); session.invalidate(); response.sendredirect("http://pushkalit.in/hrlogin.jsp"); } else {} } catch(exception ex) { out.print(ex); } %> url mapping in anchor tag seems wrong. it linked logout.jsp have redirect code in hrlogout.jsp . change : <a href="http://pushkalit.in/logout.jsp"> logout</a> to : <a href="ht...

Error while creating a Redis object and executing commands when calling methods -

this output of rails console after include rubygems , redis. 2.0.0-p353 :024 > r = redis.new => #<redis client v3.0.7 redis://127.0.0.1:6379/0> 2.0.0-p353 :025 > r.set('foo','bar') => "ok" 2.0.0-p353 :026 > r.get('foo') => "bar" 2.0.0-p353 :033 > r.lpush('foo','bar') redis::commanderror: err operation against key holding wrong kind of value /home/poorva/.rvm/gems/ruby-2.0.0-p353/gems/redis-3.0.7/lib/redis/client.rb:97:in `call' /home/poorva/.rvm/gems/ruby-2.0.0-p353/gems/redis-3.0.7/lib/redis.rb:949:in `block in lpush' /home/poorva/.rvm/gems/ruby-2.0.0-p353/gems/redis-3.0.7/lib/redis.rb:37:in `block in synchronize' /home/poorva/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' /home/poorva/.rvm/gems/ruby-2.0.0-p353/gems/redis-3.0.7/lib/redis.rb:37:in `synchronize' /home/poorva/.rvm/gems/ruby-2.0.0-p353/gems/redis-3.0.7/lib/redis.rb:948:in `lpus...

php - 'error' tag replacing with some 'meta refresh' tag -

i'm making https request in android, , response this: {"responsecode":52145,"errors":{"error":"some error","description":"some description"}} now iphone client or postman client on browser, coming expected. in android, getting: {"responsecode":52145,"errors":{"<meta http-equiv="refresh" content="5; url=mydomain">":"some error","description":"some description"}} difference: "error" getting replaced "<meta http-equiv="refresh" content="5; url=mydomain">" my https headers are: accept = application/json user-agent = android if use http instead of https fine. makes me believe there on server side related security thing. main thing curios " error " tag getting replaced, using " errors " ok. while not replacing @ end, server guy make sure sending corr...

android - Can't receive APDU data with Arduino NFC module -

i'm trying use hce on lg g2 , send data arduino uno elechouse nfc module 2.0. the problem nfc.indataexchange(selectapdu, sizeof(selectapdu), response, &responselength) returns false . what's going wrong? on arduino forums , misterfrench got working , i'm doing things using same principle. took following android hce examples , send rubbish data: @override public byte[] processcommandapdu(byte[] commandapdu, bundle extras) { log.i(tag, "received apdu: " + bytearraytohexstring(commandapdu)); // if apdu matches select aid command service, // send loyalty card account number, followed select_ok status trailer (0x9000). if (arrays.equals(select_apdu, commandapdu)) { stringbuilder stringbuilder = new stringbuilder(); stringbuilder.append(build.manufacturer); stringbuilder.append("#"); stringbuilder.append(build.model); stringbuilder.append(((telephonymanager)getsystemservice(context.telepho...

How to add onclick to a html element dynamically using javascript -

i able create button element , add onclick event shown below. elem.onclick=function() { alert("qweqweqwe"); } how go using predefined function instead of defining function inside of event? like: elem.onclick=func(); add eventlistener element has defined function call : elem.addeventlistener("click", func, false); //where func function name

c++ - QTDom - recursively add child to specific elements -

i have few xml files, , of it's nodes contains "reference" each other. want add content of xml child nodes, contains references void gameobject::expandnode(qdomelement& expnode) { if ((expnode.tagname() == "instance" && expnode.attribute("type") == "library") || (expnode.tagname() == "library" && expnode.hasattribute("file"))) { qstring filename; if (expnode.tagname() == "instance" ) filename = findlib(expnode.attribute("definition")).attribute("file"); else filename = expnode.attribute("file"); qfile nestedfile(filename); qdomdocument nestedlib; nestedlib.setcontent(&nestedfile); qdomelement nestednode = libdoc->createelement("nestedlibrary"); nestednode.setattribute("path", filename); nestednode.appendchild(nestedlib)...

php - How to change order / presentation when echo? -

i'm trying change way playlist looks when fetch form database. right when echo out playlist ( echo $row['lista']; ) this: 1.2.3. , on... i wanna make this: 1. 2. 3. ... is possible? i've tried suggestions, it's not working. have text in table? looks this: den självslagne 2. en sångarsaga 3. infruset 4. ungdomen 5. snigelns visa 6. strövtåg hembygden 7. men 8. en ung mor 9. titania 10. gråbergssång you need line break here. you not adding line break so, data getting printed side side. all need is: echo $row['lista'] . "<br />";

ruby - Rails Controller Inheritance vs. Concerns and Mixins -

i have lot of similar resources in rails application, , have dry'd code using controller inheritance. see there directory called concerns under controller folder, potentially write similar concerns (such archiving, activate/deactivate etc.) can write mixins too. is there preferred approach dry controller code? there downside in using inheritance, or there advantages using other techniques? is there preferred approach dry controller code? in experience, depends on want code do. i've used concerns simple controller-independent methods, such before_action or something i use inheritance if controller's methods able rely on super class or something. experience far has lead me use inherited_resources - dry way create controller inheritance

Calling notifyDataSetChanged() on my adapter that is within a ListFragment causes a NullPointerException? -

introduction: i have following set up: a mainactivity methods onnewintent , processnewintent , mainactivity implements fragmentactivity ; , has tabbed fragment implements fragmentlist a listaddactivity activity creates new parcelable listcontrolobject the listaddactivity activity sends intent carrying parcel reconstructs listcontrolobject inside of mainactivity 's onnewintent , processnewintent class. however; can take in intent onnewintent method , constructs new listcontrolobject fine; when call adapter.notifydatasetchanged method on fragmentlist class. logcat error: 03-24 04:18:44.149: e/trace(16964): error opening trace file: no such file or directory (2) 03-24 04:18:49.543: e/androidruntime(16964): fatal exception: main 03-24 04:18:49.543: e/androidruntime(16964): java.lang.runtimeexception: unable start activity componentinfo{com.nanospark.upcdemo/com.nanospark.upcdemo.mainactivity}: java.lang.nullpointerexception 03-24 04:18:49.543: e/androidru...

java - how to fix ArrayIndexOutOfBoundsException in android -

public class readrecords extends listactivity { private string[] colummns = new string[] { contactscontract.contacts._id, contactscontract.contacts.display_name, contactscontract.contacts.has_phone_number }; private uri contactslisturi = contactscontract.contacts.content_uri; private uri phoneuri = contactscontract.commondatakinds.phone.content_uri; private string contactiduri = contactscontract.commondatakinds.phone.contact_id; private string numberuri = contactscontract.commondatakinds.phone.number; private cursor cursor; private arraylist<string> arraylist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); arraylist = new arraylist<string>(); cursor = managedquery(contactslisturi, null, null, null, null); readcontacts(); } void readcontacts() { if (cursor == null) { toast.maketext(getapplicatio...

ssh git - logged in as another user -

i run following command on machine (not locally): ssh -t hg@bitbucket.org and output logged in maxifl this user old , use user. how change user? moreover, error while run "git pull" conq: repository access denied. fatal: remote end hung unexpectedly what think caused issue? how can fix on remote machine?

jquery - Bind array object list to the combobox -

Image
i have array inside object.how can bind object combobox list . combobox code: <select name="select-native-5" id="cmbdty"></select> i need bind id , ad field combobox and array object; here how object array, jquery code: $("#select-native-11").change(function () { var dd = $("#select-native-11").val(); $.ajax({ type: "post", url: "masasiparis.aspx/altmenugetir2", data: "{'p':'" + dd + "'}", datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data) { alert(data.d); $.each(data.d, function (val, text) { alert(val); //i need put here }); }); ...

android - How to refresh Gallery after deleting image from SDCard -

when deleting images on android’s sd card, sometime images correctly removed in gallery still remain preview of removed image. when tapping on it, loaded black image. resolve it, need run mediascanner. code won't work , still preview of review image remain in gallery. anyone knows how resolve this. uri contenturi = uri.fromfile(file); intent mediascanintent = new intent(intent.action_media_scanner_scan_file,contenturi); sendbroadcast(mediascanintent); you should delete mediastore public static void deletefilefrommediastore(final contentresolver contentresolver, final file file) { string canonicalpath; try { canonicalpath = file.getcanonicalpath(); } catch (ioexception e) { canonicalpath = file.getabsolutepath(); } final uri uri = mediastore.files.getcontenturi("external"); final int result = contentresolver.delete(uri, mediastore.files.filecolumns.data + "=?", new string[] {canonicalpath}); ...

android - Remotely activate GPS function -

i asked question implementation of toast message when gps not enabled. of knew possible. is possible automatically activate gps function in background. when remotely activate application in background. can activate the gps phone aswell without other phone reporting user ? the situation this. we have project named parentalcontrol application. parent has able track child remotely. does have suggestion or ideas ... ? if of anyhelp code i'm using @ moment. import android.app.activity; import android.content.context; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.widget.textview; import android.widget.toast; public class mainactivity extends activity { textview txtlat; textview txtlong; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_m...

php - Sending multiple emails in YII using YiiMail extension -

i using yiimail extension send mails. have default contact.php file view. able send mails individuals multiple emails not allowed here. mycontroller- public function actioncontact() { $model=new contactform; if(isset($_post['contactform'])) { $message = new yiimailmessage; $message->body=$_post['body']; $message->subject = $_post['subject'] $message->addto($_post['email']); $message->from = "frommail@gmail.com"; if(yii::app()->mail->send($message) ) echo 'mail sent'; else echo 'error while sending email'; } } i have tried following too- foreach ($model $value) { $message->addto($model[$value]); } it not accept multiple email id's. how can resolved? i have checked code in yii mailer. haven't given such facility. if achieve need extend yii mail. it's useless because looping in new extended class or loopin...

java - get content of RSS Feed article -

i content off article rss feed. for example if have cnn rss feed ( http://rss.cnn.com/rss/edition.rss ). list of articles. each article has content in it. if got article ( http://edition.cnn.com/2014/03/23/world/europe/uk-south-africa-dewani/index.html ). how can text "the department of justice and...... carjacking , denies involvement in killing." is possible content of article using rss feeds or best way it?

php - Wordpress meta query with multiple key value pairs and relations -

i have following problem. on wordpress page there small sticky posts , 1 big sticky post, fine. there regular posts , need not display posts marked sticky or big sticky meta value. i need query value not true or doesn't exist home_post key , value not true or doesn't exist big_home_post key. the code came following: 'meta_query' => array( 'relation' => 'and', array( 'relation' => 'or', array( 'key' => 'big_home_post', 'value' => true, 'compare' => '!=' ), array( 'key' => 'big_home_post', 'value' => true, 'compare' => 'not exists' ), ), array( 'relation' => 'or', array( 'key' => 'home_post', 'value' => true, ...

javascript - jQuery: set dropdown options selected to the html string -

i appending string containing html main div. string contains dropdown generated function cant modify. string containing html dropdown set option of dropdown , append div var stringhtml = "<div> <select>"+ somefunction() + "</select></div>"; jquery('#maindiv').append(stringhtml); so somefunction() above helps options select , append options i somthing this jquery(stringhtml).find("select option[value=\"" + sumevalue + "\"]").attr('selected', 'selected'); and append html required value selected thanks the problem here still inserting string page. should insert jquery object created when called jquery(stringhtml) , because 1 affected code. results should like: var stringhtml = "<div> <select>"+ somefunction() + "</select></div>"; var html = jquery(stringhtml); //save whole string object html.find("select").val(su...

java - print array of objects without brackets -

how can print array 2d without brackets. adding first array new values 2d : books=(object[][]) arrays.copyof(row,2); whereas books initialized 2d array : static object[][] books=new object[1][1]; but when try print first row books : system.out.println(arrays.deeptostring(books[0])+" "); it prints me brackets , commas [asds,asdas,223] like suppose do. how can remove those? thank ! you can try this string output ; for(string s: books[0]){ output = output +s+ ","; } output = output.substring(0, output.length()-1); system.out.print(output);

html - How to access values present in one jquery function into another jquery function? -

i know have 2 jquery scripts. 1- gauge meter (using jqwidgets.com library) 2- own defined script a gauge meter widget using. want access value of gauge meter. if meter reading is, lets assume 10, want 10 value accessible in own defined script can use ever , whatever purpose. here html code. <div class="demo-gauge" style="position: relative;height: 200px;margin-left:2.5em;"> <div id='gauge' style="position: absolute; top: 0px; left: 0px;"> </div> <div id='slider' style="position: absolute; top: 160px; left: 5px"> </div> </div> and script gauge. script value , alert @ moment. <script type="text/javascript"> var gauge_value = endvalue; $(document).ready(function () { $('#gauge').jqxgauge({ ranges: [{ startvalue: 0, endvalue: 130, style: { fill: '#4cb848', stroke: ...

c# - Iterate object list and get element property with a string -

i looking solution solve problem have. i got object: - person (string id, string firstname, string lastname) i got list couple persons - list<person> persons; what goal is: 1. iterate through list 2. property value element string named property for example: i want know id of person in list: i can this: foreach(person p in persons) { string personid = p.id; } but want this: foreach(person p in persons) { string personid = p. + "id"; } i want append string "id" id of element, instead of calling p.id . is possible? need solution this, , have spent lot of time couldn't find solution on internet. you use reflection value of property name: foreach (person p in persons) { var personid = typeof(person).getproperty("id").getvalue(p, null) string; } of course needs error handling , null checks, gist :)

IntelliJ not showing 'Test Module' option for Android -

i'm attempting add test module existing android application using intellij, option not show in list of available android modules. if create new android project scratch in intellij gives me no option add testing, , again there no ability add test module. are there prerequisites, or other reason why isn't working me? there no errors in log can see related either testing or android. i'm using intellij 13.1.1 android support 10.0. junit , testng plugins active. the gradle build system android not require separate test module. information available @ the android site explains how set testing in environment. if obtain errors regarding tasks being unavailable please sure run gradle tasks see tasks available. in case although document referred tasks such assembletest did not exist in build , instead had use assembledebugtest , example.

javascript - I cannot stop AJAX from escaping request body I pass -

i need pass json request server, ajax escapes every character pass. not want this. for example, if pass empty object, {} the server received escaped sequence %7b%7d= my ajax call is: $.ajax({ url: 'http://my-server-name.com:8002/store_test', datatype: 'text', data: "{}", processdata: false, type: 'post', success: function(data) { console.log(data); } }); how disable escaping? try use jquery post. $.post("http://my-server-name.com:8002/store_test", { //your post data //data:"hi", }) .done(function(data) { console.log(data); }).fail(function() { alert( "error" ); });

android - add different elements in listview -

my previous question was: hide listview on click hi all, want hide listview on click of button. have mainactivity.in there 2 listviews. and mainactivity extends activity can't used implements keyword.. , hiding listview activity must extends listactivity. in below code.. but android donot use multiple inheritance. how done? use getlistview().setvisibility(view.invisible); within listactivity. how looks inside code: public onclicklistener teamlisten = new onclicklistener() { public void onclick(view v) { getlistview().setvisibility(view.invisible); } }; it works , 2nd question is: how add different elements in listview ? first row elemnt profile image. , rest text home, profile, settings etc. refer code hide list view : string a1[] =new string[]{"apple","mango"}; string a2[] =new string[]{"shop","mall"}; print=(button)findviewbyid(r.id.click); l1 = (listview) findviewbyid(r.id.list1); a...

c# - OwinStartup and startup in signalr in asp.net mvc -

Image
i have problem signalr in asp.net mvc add package below: and add startup.cs using microsoft.owin; using owin; [assembly: owinstartup(typeof(paksh.startup))] namespace paksh { public class startup { public static void configuresignalr(iappbuilder app) { app.mapsignalr(); } } } but error: the following errors occurred while attempting load app. - owinstartupattribute.friendlyname value '' not match given value 'productionconfiguration' in assembly 'paksh, version=1.0.0.0, culture=neutral, publickeytoken=null'. - given type or method 'productionconfiguration' not found. try specifying assembly. disable owin startup discovery, add appsetting owin:automaticappstartup value of "false" in web.config. specify owin startup assembly, class, or method, add appsetting owin:appstartup qualified startup class or configuration method name in web.config. the error states ...

php - How to cycle through MySQL rows? -

i trying achieve web php program display data records in mysql database in html form. have couple of navigation buttons wish cycle next , previous records in database. my problem is, can't seem cycle , forth through records. mysql_fetch_assoc gets 1 row or when comes while loop. any appreciated! have far... $page = intval($_get['page']); $limitstart = $page - 1; if($limitstart < 0) { $limitstart = 0; } $query = "select caleadid, region, siteaddr1, siteaddr2, siteaddr3, siteaddr4, sitepcode, "; $query .= "addgennotes, description, value, award, awardaddr1, awardaddr2, awardaddr3, awardaddr4, awardpcode, "; $query .= "phone_number, fax_number, fldawardedwebsite, fldawardedemail, contact_name, date tbltradesman_awarded 1"; $query .= ' limit ' . $limitstart . ',2'; $result = mysqli_query($connection, $query); confirm_query($result); $result_array = array(); whil...

java - Android WebView not showing data -

hi i'm developing android app uses webview. had working on froyo using: webview.setwebviewclient(new webviewclient(){ @override public boolean shouldoverrideurlloading(webview view, string url) { if (uri.parse(url).gethost().equals(urlstring)) { // web site, not override; let webview load page return false; } // otherwise, link not page on site, launch activity handles urls intent intent = new intent(intent.action_view, uri.parse(url)); startactivity(intent); return true; } @override public void onreceivedsslerror (webview view, sslerrorhandler handler, sslerror error) { handler.proceed(); } }); for reason code doesn't hit when using froyo, white screen displayed. working fine week ago , have come make changes , doesn't work now. code doesn't hit when add breakpoint it. can suggest whats gone wro...

java - Get the exact latitude and longitude in Android -

i trying latitude , longitude of phone, , send location details email address. it's working, i'm not able exact longitude , latitude of current location. not want use map view, trying use gps not able use properly. code: package com.example.mapq; import android.location.criteria; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.app.activity; import android.content.context; import android.content.intent; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; public class mapactivity extends activity implements locationlistener{ locationmanager lm; textview lt, ln; button b1; string provider; location l; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_map); ln=(textview)findviewbyid(r.id.lng); lt=(textview)fi...

c++ - What is the fastest way to convert very large binary number representation to decimal representation? -

i've got big number stored in binary representation , need output in decimal representation: struct biginteger { int *parts; // 1 part stores 12 bits of number, range: 0 0xfff int parts_n; }; void converttodecstring( biginteger *in, std::string &out ); i can't find approach, in linear time. for demostration can chose order parts. i've got ordered in way, [0] lowest value, , [n-1] highest value. i afraid cannot done in linear time, because every read bit affects digits of decimal representation. longer digit, longer every new read bit takes.

How to filter the json response returning from spring rest web service -

how filter json response returning spring rest web service. when use call customevents need outout eventid , event name only. when ask specifc event need send full details of event. class customevent{ long id; string eventname; account createdby; account modifiedby; .. } class account{ long id; string fname; string lname; .... } @controller public class customeventservice { @requestmapping("/customevents") public @responsebody list<customevent> getcustomeventsummaries() {} @requestmapping("/customevents/{eventid}") public @responsebody customevent getcustomevent(@pathvariable("eventid") long eventid) {} } how can achieve above? i'm using spring 3.1 @ moment. ther support in 3.1 version achieve above or later verion i can think of 2 solutions off hand both take advantage of jackson's mixin feature. the first solution far more complicated awesome approach if describing replicated in other p...

ios - My app doesn't release location services -

one of apps not release location services when it's killed user. symptoms: location services icon appears on phone @ times. it has "background app refresh" setting on phone far know not use background services. i use location services in 2 places in app (should deallocating?): place 1: locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; [locationmanager startmonitoringsignificantlocationchanges]; place 2: have mkmapview in 1 view controller. you've started monitoring using startmonitoringsignificantlocationchanges , you'll need stop using stopmonitoringsignificantlocationchanges . i listening uiapplicationdidenterbackgroundnotification , uiapplicationwillterminatenotification , calling stopmonitoringsignificantlocationchanges .

Python - type(name,bases,dict) -

docs: with 3 arguments, return new type object. dynamic form of class statement. name string class name , becomes __name__ attribute; bases tuple itemizes base classes , becomes __bases__ attribute; , dict dictionary namespace containing definitions class body , becomes __dict__ attribute. while learning python have come across use of type "a dynamic form of class statement", seems interesting , useful , wish understand better. can explain role of __name__ , __bases__ , , __dict__ in class , give example type(name, bases, dict) comes own right. when define class: class foo(base1, base2): bar = 'baz' def spam(self): return 'ham' python this: def spam(self): return 'ham' body = {'bar': 'baz', 'spam': spam} foo = type('foo', (base1, base2), body) where foo added namespace class statement defined in. the block under class statement executed if function no argu...

c# - Asp.net MVC Handling Model Status -

ie: model called equipment responsible storing information equipments, , status. my question is, efficient way store item's status. approach creating different model called equipmentstatus. when comes write code, need write code below : if(equiment.equipmentstatusid == 2) i think not approach. best way ? there nothing wrong in code if want in efficient way, use can enum . also see great post. when use enum? public enum status { success = 1, failed = 2, default = 3 } if(equiment.equipmentstatusid == (int)status.success) { //something }

ios - How to send array of dictionaries with big data using afnetworking 2.0 -

i have big array of dictionaries data of trips. want send in 1 request want responses after each dictionary send. using afnetworking 2.0 , use afhttprequestserializer serializer. update. use method now, if user lot of data there risk can interrupted in case of bad internet. , have know trips been sent - (void)sendtripdata:(nsarray*)trips withsuccessblock:(requestsuccessblockwithdict)successblock failureblock:(failureblock)failureblock { nsstring* path = @"add_trips"; nsdictionary *params = @{@"trips":trips, @"mobile_id":[[uidevice currentdevice].identifierforvendor uuidstring]}; [self post:path parameters:params success:^(afhttprequestoperation *operation, id responseobject) { nsloglight(@"full data trips send success"); if ([responseobject iskindofclass:[nsdictionary class]]) { nsdictionary* dict = (nsdictionary*) responseobject; if ([dict[@"status"] i...

PHP SimpleXMLElement slash in elements -

i have string these ($_post['output_xml'): <process> <path>/var/somepath/</path> </process> the output should formatted xml written file: header("content-type: application/json; charset=utf-8",true); header('cache-control: no-cache, must-revalidate'); $xml_data = $_post['output_xml']; $fp = fopen("xml_output.xml","w"); $xml = new simplexmlelement($xml_data); fwrite($fp,$xml->asxml()); fclose($fp); i error because of slash in path element. how solve this? i have made tests here , situation php don't told me wich node have caused parsing problem when $xml_data varialble empty try check variable content.

jQuery hiding/showing content -

when corresponding tab link clicked trying display content below, jquery below works in example: http://jsfiddle.net/jmqs9/ i need show content 2 '.tab-content' it works first 1 , ignores second, im presuming issue because cant have multiple id's, know need fix this? $(function () { $('.tab-links li').click(function (e) { e.preventdefault(); $('.tab-content > li').hide(); $('#' + $(this).data('num')).show(); }); }); use class insted of id see demo <ul class="tab-links"> <li data-num="1"><a href="#">tab one</a> </li> <li data-num="2"><a href="#">tab two</a> </li> </ul> <ul class="tab-content"> <li class="1">content tab one</li> <li class="2">content tab two</li> </ul> <ul class=...

java - Apache Click Model properties are not rendering -

i new apache click framework , trying execute helloworld example. using click-2.3.0.jar. http://click.apache.org/docs/user-guide/html/ch01.html . i configured web.xml , click.xml per http://www.ibm.com/developerworks/library/wa-apacheclick/ . as per example in page class adding parameter addmodel("time", time); , printing in html. instead of printing time , prints variable $time .i tried ${time} . the template path should have .htm extension specified in web.xml route *.htm requests clickservlet. [1] maybe named file html extension. [1] http://click.apache.org/docs/user-guide/htmlsingle/click-book.html#chapter-pages]

wordpress - Get Directions change language -

i'm working on wordpress site uses plugin get directions . works , gives me directions in english, want recieve them in dutch. i've tried changing url maps.google.com alternatives maps.google.nl , maps.google.com?language=nl-nl does know how can directions in dutch? have asked on official wordpress forums don't know how long takes them respond. seems impossible. plugin uses api url http://www.mapquestapi.com/geocoding/ . , checking documentation, there locale parameter /directions web service, nothing exist /geocoding web service, 1 plugin uses. note standard locale codes in format language_country , eg, nl_nl . tried modify plugin code adding &locale=nl_nl (and other languages), made no difference.

javascript - Jquery 'each' does not applicable on ajax loaded dom -

i trying refresh google advertisement, inside div. have added common css class named 'adslot' div. few divs loads ajax. @ document ready, when call div's jquery each function, applicable divs, has loaded before ajax call. example, if give number of available '.adslot', alert($('.adslot').length); output: 5, correct. 3 of divs generated before ajax call, , 2 of generated after ajax call. at same this, if write - $('.adslot').each(function() { var id = $(this).attr('id'); alert(id); }); i alert of 1st 3 divs id, generated before ajax call. has there way read 5 divs ids jquery? try code in success callback like $(function(){ $.ajax({ url:...., data:..., success:function(data){ $('.adslot').each(function() { var id = this.id; alert(id); }); } }); });

c++ - getting a string to work in password function -

hi apologies poor explanation i'm new this. working on password function i'm having problems. have set account name string "john" , account password int 1111. password works fine string causing error. when change "const string name = "john"" random integer code works fine. i hoping spot i'm going wrong? bool login() { const int password = 1111; int passwordattempt; const string name = "john"; string nameattempt; int attempts = 0; std::cout << "please enter password:" << std::endl; //first attempt @ account number & password std::cin >> passwordattempt; std::cout << "enter name:"<< std::endl; std::cin >> nameattempt; if (passwordattempt == password && nameattempt == name) { return true; } else while (passwordattempt!=password || nameattempt!=name) { if(attempts++ ==2)//.. loop 2 more attempts { std::cout...

android - not correct take picture in custom camera activity -

Image
i used custom camera .but open camera activity not take portrait mode .my code below. i used takebutton click : btntakepicture.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub intent cameraact = new intent(getactivity(), cameraactivity.class); startactivityforresult(cameraact, 1); } }); cameraactivity::: public class cameraactivity extends activity { private camera mcamera; private camerapreview mcamerapreview; protected static final int media_type_image = 0; static string filepath = ""; button takepicture; static string base64string=""; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.camera_preview); ...

java - No.of Inactive session increased while connection made using BoneCP - for every run -

i have connected oracle db application. each , every run, no.of inactive sessions increased , means old sessions not reused , new 3 connection s created every insert/update operation. after shut downing application server reset , comes normal. if continues, whether raise problem?. idea why happened , anyway rectify issue? this basic config jdbc connection oracle class.forname(driverclass); bonecpconfig config = new bonecpconfig(); config.setjdbcurl("jdbc:oracle:thin:@localhost:1521:orcl"); config.setusername(username); config.setpassword(password); config.setpartitioncount(1); config.setminconnectionsperpartition(2); config.setmaxconnectionsperpartition(4); config.setacquireincrement(3); config.setlazyinit(true); config.setdefaultautocommit(true); config.setlogstatementsenabled(true); poolmanager = new bonecp(config); query select * v$session username='oracle_db'; "saddr" "sid" "serial#" "audsid" "pa...

javascript - Animation search bar with css -

i'm working on css search field. want me something. if visit demo page see have menu in front of search button. search bar opened. want remain @ bottom front menu. this demo page in jsfiddle html code : <div class="b_t_menu3"> <div class="b_search"> <form method="get" class="search-form" action="http://www.google.com/search" target="top"> <input name="sitesearch" value="beben-koben.blogspot.com" type="hidden"> <input type="search" class="search-field" placeholder="search &hellip;" value="" name="q" title="search for..." /> <input type="submit" class="search-submit" value="search" /> </form> </div> <div class="b_invitation"><a href="#">menu</a></div> </div> and css c...