Posts

Showing posts from January, 2015

iphone - How to set Title for cell using Dictionary -

i want use nsdictionary instead of cell array. following code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ uitableviewcell *cell=[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; //add bg image cell //add label uilabel *celltitle=[[uilabel alloc]initwithframe:cgrectmake(15, 7, 300, 30)]; [celltitle setbackgroundcolor:[uicolor clearcolor]]; [celltitle setfont:[uifont fontwithname:@"helvetica-bold" size:12]]; [celltitle settextcolor:[uicolor darkgraycolor]]; [celltitle settext:[[cellarray objectatindex:indexpath.section] objectatindex:indexpath.row]]; [cell.contentview addsubview:celltitle]; return cell; } nsdictionary *dictionary1 = [[nsdictionary alloc] initwithobjectsandkeys:@"abc",@"name",@"12",@"

android - How to delete a item from a custom Listview -

i want delete item listview on selecting check box in listview . custom adapter follows: public class listadapter extends arrayadapter<list> { private int resource; private layoutinflater inflater; private context context; // private final boolean[] mcheckedstate; private final arraylist<list> list; private final activity mcontext; boolean checkall_flag = false; boolean checkitem_flag = false; public listadapter(activity context, arraylist<list> list) { super(context, r.layout.listdata, list); this.mcontext = context; this.list = list; } static class viewholder { protected textview text1; protected textview text2; protected checkbox checkbox; } @override public view getview(int position, view convertview, viewgroup parent) { viewholder viewholder = null; if (convertview == null) { layoutinflater inflator = mcontext.getlayoutinflater(); convertview = inflator.inflate(r.layout.listdata, null); viewhold

Find if Update happened or not in PDO Php -

i using following code update query. suppose ability value 0 , update didn't happen. how can find out? $statement = $conn->prepare ('update players set ability = ability - 1 id = :playerid , ability > 0'); $statement->bindparam (':playerid', $player['id'],pdo::param_int); $statement->execute(); $stmt = $conn->prepare("update....."); $stmt->execute(array($var, $var)); now, if want check success update.. if($stmt->rowcount() > 0){ //means updated }else{ //means not updated }

ios - AFNetworing - setImageWithURLRequest not working -

i want set tableview cell images in 1 of apps. use afnetworking (1.2.1) , setimagewithurlrequest . my code in set images looks this: if (user.avatar) { nsstring *imageurl = user.avatar.url; [cell.profileimage setimagewithurlrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:imageurl]] placeholderimage:nil success:^(nsurlrequest *request, nshttpurlresponse *response, uiimage *image) { [cell setneedslayout]; } failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error) { nslog(@"error: %@", error); }]; } my error log returns this: error: error domain=nsurlerrordomain code=-999 "the operation couldn’t completed. (nsurlerrordomain error -999.)" userinfo=0x1f5b56a0 {nserrorfailingurlkey=https://d2rfichhc2fb9n.cloudfront.net/image/5/cf7t_ba6- nfgl5ah0w4hdvmk_vp7inmioijzmyisimiioijhzg4tdxnlci1hc3nldhmilcjrijoiyxnzzxrzl3vzzxivztivm2mvmja vztizyziwmdawmdawmdawmc5qcgci

c# - Can't Download Json Array Windows phone -

Image
i can download json array in windows 8 following code: astring = " http://website.com/image/image_manifest.json "; private async void getjson(string astring) { var client = new httpclient(); var lresponse = await client.getstringasync(astring); } this works 100% i attempting same in windows phone private void getjson(string anasaurl) { webclient webclient = new webclient(); webclient.downloadstringcompleted += new downloadstringcompletedeventhandler(webclienthandler); webclient.downloadstringasync(new uri(astring)); } private void webclienthandler(object sender, downloadstringcompletedeventargs e) { var lresponse = e.result; } this not work, receive exception: an exception of type 'system.reflection.targetinvocationexception' occurred in system.ni.dll not handled in user code going inner exception see this: innerexception {sys

asp.net - form verification before submitting -

i have following form <form id="myform" action="/problems/post" method="post" enctype="multipart/form-data"> <input type="text" id="problemsubject" name="problemsubject" /> <input type="file" id="uploadfile" name="uploadfile"/> <textarea rows="" cols="" class="form-textarea" id="problemdescription" name="problemdescription"></textarea> </form> i have submit form controller method(which have done), should first validated i.e. should not contain empty fields. want "a message should appear telling field blank". how can done. please me. thanks. take @ of samples. ( http://www.asp.net/mvc/tutorials/older-versions/javascript/creating-a-mvc-3-application-with-razor-and-unobtrusive-javascript ) essentially can validate on client side , on server side, should both. it easy valid

node.js - SIGSEGV 0xb on Java 1.6 and 1.7 on Ubuntu -

i have annoying problems java 1.6 , java 1.7 on ubuntu 13.10 (and xubuntu 12.10), both x64. problem doesn't occur on debian 6.0 x64. i run test code nodejs application running java code per jni (if understand correctly, i'm not developer of code). developers said, worked no problems on systems. # # fatal error has been detected java runtime environment: # # sigsegv (0xb) @ pc=0x00007f0aef63e2fb, pid=3442, tid=139685052057408 # # jre version: 7.0_21-b11 # java vm: java hotspot(tm) 64-bit server vm (23.21-b01 mixed mode linux-amd64 compressed oops) # problematic frame: # v [libjvm.so+0x5842fb] jni_argumentpushervaarg::jni_argumentpushervaarg(_jmethodid*, __va_list_tag*)+0x1b # # failed write core dump. core dumps have been disabled. enable core dumping, try "ulimit -c unlimited" before starting java again # # if submit bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # full log on pastebin: http://pastebin.com/bexyihhj i using vm

android - GCM communicate with others activites -

i'm using gcm event server, works fine i'd communicate others activities using class gcmintentservice i have method receve messages @override protected void onmessage(context context, intent intent) { log.d("gcm", "recieved message"); // data intent , send notificaion bar generatenotification(context, intent); } i'd exemple send datas mainactivity can't find how find: intent intent = new intent(getbasecontext(), signoutactivity.class); intent.putextra("extra_session_id", sessionid); startactivity(intent); but in case don't want start new activity want send datas running activity. thanks i find solution, @selalerer help in first time init receiver: //receive events private class receiver extends broadcastreceiver { @override public void onreceive(context arg0, intent arg1) { system.out.println("receive"); } } in oncreate add intentfilter filter = new intentfilte

Mule Esb File output not received -

Image
i tried create data-mapper example in mule in both inbound , outbound endpoints file, looks thing like. when execute program output folder of file remains empty, logically assume need put , hashmap xml transformer between data mapper , output file. more on created csv file xml file selecting example option in data mapper. tried use ftp endpoint started resulting error replaced ftp file endpoint. here sharing configuration.xml file <mule xmlns:file="....> <data-mapper:config name="sample_mapper_grf" transformationgraphpath="sample_mapper.grf" doc:name="datamapper"/> <flow name="csv_to_xml_data_mapperflow1" doc:name="csv_to_xml_data_mapperflow1"> <file:inbound-endpoint path="/home/jay/csv_xml_/input" responsetimeout="10000" doc:name="input file"/> <data-mapper:transform config-ref="sample_mapper_grf" doc:name="datamapper&q

sql - Join query in oracle 10g -

i have written query display last name, department number, , department name employees work in toronto. select last_name, job_id, department_id, department_name employees e join departments d on d.department_id=e.department_id join locations l on d.location_id=l.location_id , l.city='toronto'; i getting error ora-00918: column ambiguously defined change first line to: select e.last_name, e.job_id, e.department_id, d.department_name

ubuntu 12.04 - MRTG: ERROR: did not find any matching data in cfg file -

i have vps server ubuntu 12.04 lts , i'm installing mrtg. used install snmpd apach2 mrtg. made cfg file vytv cfgmaker , edited it: runasdaemon: yes interval: 5 logdir: /var/log/ enableipv6: no and last want make index file indexmaker index.html error: error: did not find matching data in cfg file my command: indexmaker --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg i found http://piserv.nl/blog/index.php/mrtg-on-the-raspberry-pi/ . there tutorial edit snmpd makes no change. paste mrtg.cfg file here. happens when mrtg can't find line create index it. means lines commented out or start blank space. make sure blocks regarding network interface definition not commented out , don't have space @ beginning of line. target[127.0.0.1_1]: 1:public@127.0.0.1: setenv[127.0.0.1_1]: mrtg_int_ip="127.0.0.1" mrtg_int_descr="lo" maxbytes[127.0.0.1_1]: 1250000 title[127.0.0.1_1]: traffic analysis local loopback pagetop[127.0.0.1_1]: <h1&g

c# - Parsing local file -

i want parse local file (.txt) , this. can help? i use visual studio 2012 , make win8 app using grid template. an unhandled exception of type 'system.exception' occurred in mscorlib.dll winrt information: invalid character @ position 1063. additional information: invalid json string. app.xaml.cs: protected override async void onlaunched(launchactivatedeventargs args) { frame rootframe = window.current.content frame; if (rootframe == null) { // create frame act navigation context , navigate first page rootframe = new frame(); //associate frame suspensionmanager key suspensionmanager.registerframe(rootframe, "appframe"); if (args.previousexecutionstate == applicationexecutionstate.terminated) { // restore saved session state when appropriate try {

ios - Not possible to add child nodes to sprite for CCProgressTimer? -

i'm trying add child nodes sprite , use ccprogresstimer gradually reveal it. child node, in case cclabelttf not appearing on screen @ all. can see testsprite . ccsprite *testsprite = [ccsprite spritewithfile:@"btnsmall-red-normal.png"]; cclabelttf *labeltest = [cclabelttf labelwithstring:@"testing123" fontname:@"marker felt" fontsize:64]; [labeltest setposition:ccpmult( ccpfromsize(testsprite.contentsize), 0.5f )]; [testsprite addchild: labeltest]; ccprogresstimer *testpt = [ccprogresstimer progresswithsprite:testsprite]; [self addchild:testpt]; testpt.position = ccp(windowsize.width/2, windowsize.height/2+100); testpt.percentage = 100;

actionscript 3 - http error 405 with mobile flex application -

i having issue everytime try upload image flex mobile application iis directory , directory configerd web application http error 405 'method not allowed' hence dont use script server side , dont want use .. and code upload button protected function getimage(event:event):void { var image:bitmap = bitmap(event.target.content); bitmapdata = image.bitmapdata; byte = jpgencoder.encode(bitmapdata); // bytearray uploadrequest = new urlrequest("http://localhost/problmeimages/"); var header:urlrequestheader = new urlrequestheader("content-type","application/octet-stream"); uploadrequest.requestheaders.push(header); uploadrequest.method = urlrequestmethod.put; uploadrequest.data = byte; urlloader1.dataformat = urlloaderdataformat.binary; urlloader1.addeventlistener(event.complete,uploaded); urlloa

c++ - how to get non topmost qgraphicsitem from the scene -

excuse me if topic created. have and, regardless, not found one. can qgraphicsitem click coordinates beneath topmost item cute small way? mean can try use fact scene sends click-signal items beneath cursor position, seems unnecessary complication. use qgraphicsview::items(const qpoint& pos) const return items under viewport coordinate, in descending stacking order ( docs ).

multithreading - Thread execution order in c# -

i have list of thread want ensure execution order between them code for (int k = 0; k < radiolist.count; k++) { (int = 0; < filepaths.count(); i++) { thread t = new thread(delegate() { thread_encde_function(tempradio.publishpoint, filepaths[i], encodingtype); }); t.start(); thread.sleep(1000); } } i want know if thread.join() can job. if tasks can execute asynchronously (out of order), threads appropriate. however, if have number of tasks want execute in order (strictly 1 after other), why use threads? should execute them in loop, can't parallelized. using thread.join wait thread right after start trick, way have wait until task finished before starting next one, executing them in order. however, if have parts of tasks can executed simultaneously, , other parts have sequential, can take @ c# task parallel library , makes d

display cpanel xml-api output using php -

i'm creating php site creates accounts automatically using xml-api of php. account creation works perfectly, , var_dump output of $response shown below: $response="simplexmlelement object ( [result] => simplexmlelement object ( [status] => 1 [statusmsg] => account creation ok ) )"; how can retrieve value of status tag , display user? i tried this, not working: echo (string) $response->result->status; thanks help!

algorithm - First appearance in Stern's Diatomic Sequance -

you integer n , need find index of first appearance in stern's diatomic sequence. the sequence defined this: a[0] = 0 a[1] = 1 a[2*i] = a[i] a[2*i+1] = a[i] + a[i+1] see mathworld . because n can 400000, it's not idea brute-force it, since time limit 4000 ms. the sequence pretty odd: first occurrence of 8 21, first occurrence of 6 33. any ideas how solve this? maybe might help: oeis we can solve first occurrence of number in range of 400000 in under 4 seconds: prelude diatomic> firstdiatomic 400000 363490989 (0.03 secs, 26265328 bytes) prelude diatomic> map firstdiatomic [400000 .. 400100] [363490989,323659475,580472163,362981813,349334091,355685483,346478235,355707595 ,291165867,346344083,347155797,316314293,576398643,315265835,313171245,355183267 ,315444051,315970205,575509833,311741035,340569429,313223987,565355925,296441165 ,361911645,312104147,557145429,317106853,323637939,324425077,610613547,311579309 ,316037811,311744107,3424

getting error in sql: Every derived table must have its own alias -

need in fixing error,trying run query , getting error every derived table must have own alias, below code: $sql="select trouble_type_priority, category_1, category_2, status, count(*) ( select distinct trouble_type_priority, category_1, category_2 tbl_main ) group trouble_type_priority,category_1,category_2 having count(*) > 1"; you need give subquery "alias", or name. notice addition of a after subquery: $sql="select trouble_type_priority, category_1, category_2, status, count(*) ( select distinct trouble_type_priority, category_1, category_2 tbl_main ) group trouble_type_priority,category_1,category_2 having count(*) > 1";

android - Creating a Facebook post with rich/interactive content -

Image
i'm looking way create wall post android app can contain styled/interactive content. similar nike+ running app does: what correct approach achieve this? app generates "score" user can share on facebook. currently, i'm publishing "me/feed" far can see allows plain text elements (message, caption, description). using facebook android sdk 3.0. any ideas/suggestions appreciated. this special type of open graph data: " bike, walk, run " you have configure app use actions in open graph panel of developer area: also notice app must in " health , fitness " category. for info: open graph documentation facebook app developer panel