Posts

Showing posts from January, 2010

json - MapKit Annotations Imported From MySQL -

i've been creating app supposed show pins on map stored in mysql database. i've used javascript convert database json converted json data nsstrings, problem here needed convert 2 of these nsstrings doubles because pins need placed via latitude , longitude, here code below when builds shows no issues crashes simulator , shows errors shall post directly under code. if can me solve forever grateful: hazards.h #import <foundation/foundation.h> #import <mapkit/mapkit.h> @interface hazards : nsobject <mkannotation> @property (nonatomic, assign) cllocationdegrees latitude; @property (nonatomic, assign) cllocationdegrees longitude; @property (nonatomic, copy) nsstring *title; @property (nonatomic, copy) nsstring *subtitle; @property (nonatomic, strong) nsstring * id; @property (nonatomic, strong) nsstring * route; @property (nonatomic, strong) nsstring * address; @property (nonatomic, strong) nsstring * latitude; @property (nonatomic, strong) nsstring * lon

javascript - How can I upload a new file on click of image button -

i have got task upload new file click of image button. code is <label>file</lable> <input type="image" src="http://upload.wikimedia.org/wikipedia/commons/c/ca/button-lightblue.svg" width="30px"/> on click of button want upload new file.how can this? can check code demo you add hidden file input field, like: <input type="image" src="http://upload.wikimedia.org/wikipedia/commons/c/ca/button-lightblue.svg" width="30px"/> <input type="file" id="my_file" style="display: none;" /> and do: $("input[type='image']").click(function() { $("input[id='my_file']").click(); }); demo:: updated fiddle

android - Why won't my Threads die and cause a memory leak? -

an app of mine accumulating lot of thread instances gc can't pick , clear out. memory leak crashes app in long run. i'm not 100% sure come from, have distinct feeling following might code in question: public class urahosthttpconnection extends abstracturahostconnection { private handler uithreadhandler = new handler(looper.getmainlooper()); private executor taskexecutor = new executor() { public void execute(runnable command) { new thread(command).start(); } }; private connectiontask task = null; @override public void sendrequest(final httpurirequest request) { this.task = new connectiontask(); this.uithreadhandler.post(new runnable() { public void run() { task.executeonexecutor(taskexecutor, request); } }); } @override public void cancel() { if (this.task != null) this.task.cancel(true); } } this code allows me

performance - Why is computing point distances so slow in Python? -

my python program slow. so, profiled , found of time being spent in function computes distance between 2 points (a point list of 3 python floats): def get_dist(pt0, pt1): val = 0 in range(3): val += (pt0[i] - pt1[i]) ** 2 val = math.sqrt(val) return val to analyze why function slow, wrote 2 test programs: 1 in python , 1 in c++ similar computation. compute distance between 1 million pairs of points. (the test code in python , c++ below.) the python computation takes 2 seconds, while c++ takes 0.02 seconds. 100x difference! why python code so slower c++ code such simple math computations? how speed up match c++ performance? the python code used testing: import math, random, time num = 1000000 # generate random points , numbers pt_list = [] rand_list = [] in range(num): pt = [] j in range(3): pt.append(random.random()) pt_list.append(pt) rand_list.append(random.randint(0, num - 1)) # compute beg_time = time.clock()

Calculate the distribution of values in PHP and MySQL -

i'm trying calculate distribution of values large data set. values floats between 1 , 7, , i'd aggregate them granularity. right i'm aggregating half values (1.0, 1.5, 2.0, etc) i'd able set granularity more dynamically (for example 1 decimal). there smart way of doing this? right this //create distribution table $distribution_table="create table distribution_table(collective_ability float primary key, number int)"; // execute query if (mysql_query($distribution_table)) { echo "table distribution_table created successfully"; } else { echo "error creating distribution table: " . mysql_error(); die; } //calculate distribution of collective ability $distribution = "insert distribution_table (collective_ability) values (1.0),(1.5),(2.0),(2.5),(3.0),(3.5),(4.0),(4.5),(5.0),(5.5),(6.0),(6.5),(7.0)"; // execute query if (mysql_query($distribution)) { } else { echo "error selecting inserting values

android - How to save HTML page using webView.saveWebArchive() below API level 11? -

i want save html page locally on sd card , reuse later. i able same using webview.savewebarchive(filename); but method not present below api level 11. how can perform same function api level below 11?

javascript - If element exists in a document -

it's possible situation function use out of date jquery element. example when use closer , callback: $("input").each(function () { var input = $(this); //here example remove input dom //and insert new 1 input $.ajax(url, function(){ fun(input) } }); function fun(input){ //do input.val('newvalue') } questions are: how can sure reference on variable still right. , if element has been reacreated how can new reference on new input (input doesnt have id , classes)? update1: made small update. use old input reference in function fun . , newvalue not apply new input coz current input old value. you can check whether element exists checking length of jquery object. example: if($(this).length < 1) { // element no longer exists in dom } however, can use jquery's on() function bind events elements exist now, or in future, , perhaps that's better approach 1 you're working wi

How to get Rails application working on two domains, Reverse Proxy -

i have 2 separate application running on www.a.com , www.b.com . second 1 rails-3 application. common login working between 2 sharing cookies, redirecting requests on www.a.com/b www.b.com . using apache reverse proxy achieve this: proxypass /b/ http://www.b.com/ this works fine apart fact asset/javascript links getting formed assuming www.a.com root. example: <%= javascript_include_tag 'js/bootstrap-datepicker'%> is resulting in link http://a.com/assets/js/bootstrap-datepicker.js whereas want http://a.com/b/assets/js/bootstrap-datepicker.js i solving doing: config.action_controller.asset_host = "http://a.com/analytics" this works fine though find solution bit hacky. real problem starts when put links other pages in application. in order put link page named page , need put b/page in href. works fine when accessing application using a.com. doesn't allow me access app using b.com link starts pointing www.b.com/b/page doesn't exist.

c# - Writing SQL queries without table access full -

tl;dr i'm using entityframework 5.0 oracle , need query table 2 columns using index nvl of 2 columns. details after hours of attempts... i'll try organize possible. the desired sql query should be: select t.code, nvl(t.local, t.global) description shows t t.code = 123 so problem? if want use context.shows.parts.sqlquery(query) must return whole row( * ), table access full , must return desired columns. the next thing(actually there lot of tries before following...) i've tried gives close results using null-coalescing operator ( ?? ) : context.shows.where(x => x.code == 123) .select(x => new { x.code, description = x.local ?? x.global); but sql it's using complicated using case & when , not using index on code, nvl(local, global) critical! my next step using database.sqlquery context.database.sqlquery<tuple<int, string>>("the raw-sqlquery above"); but error tuple must not abstract , mus

html - Could i use <a> in <ul> around <li> -

ive got following code: <ul> <a href="./index.php?profile=user1"> <li>user1 : 16</li> </a> <a href="./index.php?profile=user2"> <li>user2 : 4</li> </a> </ul> this works perfektly fine in major browsers, isnt allowed/invalid html , right way should this: <ul> <li> <a href="./index.php?profile=user1">user1 : 16</a> </li> <li> <a href="./index.php?profile=user2">user2 : 4</a> </li> </ul> but if second example text not whole <li> clickable want to. should stay invalid working version or has better solution? use css make link take entire list item, eg. display: block (and other styling might want). wrapping links around list items invalid html.

stocktwits - Differentiating between username and userid in widget -

i'm noticing issues widgets displaying wrong data users username starts number. widget looks treating them if user id. is there way differentiate when using username on user id? the user parameter can either username or id. @ least should. correct numbers of username getting confused. fix issue , report back. pointing out.

php - setVariables() many to many relation symfony2 -

i have many many relation between let's entitya , entityb , use embeeded forms in order add attribute of entitya in form of entityb follows $builder ->add('entityas', 'entity', array( 'class' => 'xxxbundle:entitya', 'property' => 'name', 'multiple' => false, ));} when set 'multiple' true, ok. when set false, following error property "entityas" not public in class "xxx\entity\entityb". maybe should create method "setentityas()"? as usual property entityas in entityb class not public (protected or private). have write (or generate) setter it: setentityas($entityas) multiple true may work, think (not sure) uses addxxx setter. proof me, if have addentityas method in entityb class? buuuuut, if have many many relation, why set multiple false?

scala - Scalaz minimal imports required to inject right and left use -

simple question, have looked @ 1 already: managing imports in scalaz7 , can't figure out how minimally inject right , left methods objects construct instances of \/ . i did try: import syntax.todataops , other variations of to... such syntax.toidops suggested in http://eed3si9n.com/learning-scalaz-day13 . simple example: import scalaz.{\/, syntax} import // goes here class test { def returneithert(h: int): string \/ int = { h right } } thanks, jason. =========== i solved using import syntax.id._ i'm unsure why worked. syntax.id contains syntax "plain" values, i.e. places no constraints on type of value. in general, when import syntax expression of form x.op , place import syntax depends on type of x , because op needs valid operation on type. because \/[a, b] universally quantified , b, using syntax x.left , x.right places no constraints on type of x . hence, belongs in syntax.id . for working understanding

excel - Extract text data from PCL using DELPHI code -

i looking 2 things here... is there way can read pcl file instructions read formats applied text, bold, italics, , font size etc. and know way extract text data without pcl instruction pcl file, there option hack pcl file , remove pcl instructions it. the background is, trying convert existing rave reports creats pcl file excel based report using flexcel3 component, finding hard read , extract data pcl file. if text based output parse data based on field length , create excel report using flexcel, if format information pcl file apply formats excel. need suggestions. thanks

html - Is this usage of the H2 tag correct? -

i use h2 tag in way. usage of h2 tag correct? <h2><a href="#w" style="margin-left:20px;">what this?</a></h2> <h2><a href="#h" style="margin-left:20px;">how cost?</a></h2> <p class="title-faq"><h2>what this?</h2></p> it's not appropriate use tag means "heading" within body text. tags logical tags; use imparts meaning enclosed text -- namely, text section heading. although use display: inline attribute, consider using more appropriate tag, or tag. aside that, , answer question, h2 block level element. making inline level element cause behave how describe b tag acting see here

search - Can I combine a constantsearchquery with a phrase query into a booleanquery in lucene? -

can have booleanquery has 2 other queries, 1 should , 1 must ? want should query of type constantscorequery , other of type phrasequery . i know phrasequery contributes overall score constantscorequery won't contribute. true? how results arranged if constantscorequery along other types of queries in booleanquery ? similar other question , constantscorequery contributes constant overall score. matches constant boost it, non-matches no boost it. if constantscorequery required search term, doesn't contribute meaningfully score (all documents returned overall search have same score boost it), still contribute scoring. as far how results arranged "along other types of queries", that's vague meaningfully answered. perhaps benefit lucene documentation on scoring .

jquery - How to set different colors for source and target Endpoint with jsplumb -

i new jsplumb. need complete sample. how set different colors source , target endpoint jsplumb? <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script> <script type="text/javascript" src="../js/jquery.jsplumb-1.3.16-all-min.js"></script> <script type="text/javascript"> jsplumb.bind("ready", function () { var source= jsplumb.addendpoint("source", { overlays: [["label"

c# - How to send back data from multiple auto-generated fields from view to controller -

i'm building application allows users go trough series of questions , select response 4 pre-determined options. problem i'm facing how send data controller. have object game holds property questions while each question holds code , question , answer , string type. i've created page displays every question , answer in dropdownlist (once figure out how place radiobuttons, i'll use that), i'm stumped how should send results controller: every select element in generated html code has same id , how can distinguish question-answer relationship other? are there alternative approaches better? i've tried working partialview each question, if possible i'd stick 1 page list of questions. the code i'm using create current view this: @using (html.beginform("save", "game", formmethod.post)) { foreach (var question in model.questions) { <div class="question"> <h4>@vraag.vra

Export data from sqlite to a csv file in rails -

i have app uses sqlite db , there entries in table. have change sqlite postgres . , table design changed. if same table design have gone use taps or dump data using yaml-db , push data postgres, in scenario table design changes want move data sqlite postgres according new table. so thought of exporting data sqlite csv file , move data csv postgres. way have or there other way doing it? if way how can export csv , import postgres ? another thing is, after exporting data sqlite, there way push data through migration ? please me. to export in csv format add controller action respond_to csv , in matching view folder create .csv.erb file create csv. can called adding .csv url. so controller this: def index @people = person.all respond_to |format| format.html # index.html.erb format.json { render json: @people } format.csv end end and view saved in file (something /app/views/people/index.csv.erb) contain: first name,last name <% @peop

https - When facebook application use Secure Canvas? -

i have facebook application, , host have selfsigned certificate. thats not problem, because browsers used canvas url (with http), , worked fine. other browsers requires secure canvas url (with https), , throw exception if secure canvas url empty, or if host has incorrect certificate. how browser/facebook decides when use canvas url, , when secure canvas url? can make them use canvas url only, without https? if i'm correct applications have setting "october 2011" or (i'll try verify you). maybe if disable 1 can use http. idea behind implementation put every new applications on https. now can understand development purposes want try without https. not every browser acts same way self-signed certificates (chrome <-> ff). in business environment suggest have valid certificate. edit : possible duplicate of question http://facebook.stackoverflow.com/questions/7308348/facebook-canvas-apps-https-and-http edit 2 : apps on facebook authentication ,

inline editing - Integrate RTE with JQGrid -

i using inline editing events. , on click of non editable cell want open rich text box. tried using edittype: custom , returning rte nothing displays. there other way this. please suggest! thanks, arshya using edittype: custom makes no sense non-editable column. make column editable, using editable: true

ssh - Setting up OpenSSH for Windows using public key authentication -

i having issues setting openssh windows, using public key authentication. i have working on local desktop , can ssh key unix machines or other openssh windows machines. i have replicated build onto server, can password authentication working fine, when use keys following issue: debug1: authentications can continue: publickey,password,keyboard-interactive debug3: start over, passed different list publickey,password,keyboard-interactive debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: next authentication method: publickey debug1: offering rsa public key: /cygdrive/c/sshusers/jsadmint2232/.ssh/id_rsa debug3: send_pubkey_test debug2: sent publickey packet, wait reply connection closed 127.0.0.1 so purposes of testing, have been trying ssh localhost, when tried remotely same issue. even more strange, when have both password &am

chat - QuickBlox for iOS applications -

i new ios development. have build chat application , found website, quickblox.com, provide code , back-end helping build applications on various platforms. had doubt i take website, applications build me applications completely. concern if build application should application , other website or company's name should not visible user's when reaches them. if knows quickblox.com please clarify doubt. the app yours, can publish under yor own name , use business model want. you can check these case studies, donwload apps , check yourself http://quickblox.com/apps/ however, if want publish remember have own appstore licences apple appstore , google play. hope helps,

email - Phonegap - Send mail from app -

i need add button on app, send suggest mail gmail. i tried methods none of them worked. i trying, this: <section data-role="page" id="home"> <article data-role="content" style="position: fixed;text-align: center;width: 100%;height: 100%;margin:0;padding:0;overflow: hidden;" > <!--<a id="go" href="#view-feed-custom"> <img style="max-width: 100%;" src="img/portada.jpg" alt="logo"> </a>--> <script> var args = { subject: 'hi there', body: 'message suggest you', torecipients: 'reciver@gmail.com' }; cordova.exec(null, null, "emailcomposer", "showemailcomposer", [args]); </script> <a href="#" onclick="cordova.exec(null, null, "emailcomposer&

CNAME address in apache configuration -

i have multiple domain map server's subdomain. example www.xyz.com -> goo.myserverdomain.com www.lmn.com -> fb.myserverdomain.com www.abc.com -> twt.myserverdomain.com i mapping using cname in each domain. @ server end, want resolve server subdomain. want configure servername myserverdomain.com serveralias *.myserverdomain.com proxypass / http://<ip>:8780/(goo/fb/twt ...) when configuration, apache not recognize virtual host , show first default one. seems getting host name. how resolve myserverdomain address in configuration. please help it not matter how domain mapping done. apache not know , web browser not care. reacts on line "host:" send in header. to enable virtual name solving, need set namevirtualhost ... for each ip+port combination or '*' all. usually when starting, apache tell you have virtual hosts, no proper name switching.

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

Image
i trying set "applies to" field under folder auditing options programatically. in msdn, the code example there uses filesystemauditrule class add new audit rule folder. there nothing obvious in class set particular audit rule needs applied to. this code using set permissions: const string myfolder = @"s:\temp\somefoldertoaudit"; var account = new securityidentifier(wellknownsidtype.worldsid, null).translate(typeof(ntaccount)); filesecurity fsecurity = file.getaccesscontrol(myfolder, accesscontrolsections.audit); fsecurity.addauditrule(new filesystemauditrule(account, filesystemrights.writedata | filesystemrights.delete | filesystemrights.changepermissions, auditflags.success)); file.setaccesscontrol(myfolder, fsecurity); this creates audit rules nicely except highlighted option below: i need " this folder, subfolders , files " example or other " this folder only ". don't want traverse directories , files , set same auditing r

How to send the value of a variable from Node.js to the browser? -

i don't understand why can't value of "i" in browser. got erreur 101 (net::err_connection_reset) var http = require('http'); var i=0; http.createserver(function (req, res) { i++; res.writeheader(200, {'content-type': 'text/plain'}); res.write(i); res.end(); }).listen(80, "127.0.0.1"); but work if : res.write("i =" + i); thank you short answer: because type of i number . long answer: take @ socket.prototype.write definition: socket.prototype.write = function(chunk, encoding, cb) { if (typeof chunk !== 'string' && !buffer.isbuffer(chunk)) throw new typeerror('invalid data'); return stream.duplex.prototype.write.apply(this, arguments); };

javascript - Newest Google Analytics API reference? -

i've got unusual google api code snippet: (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxxx-1', '192.168.8.101'); ga('send', 'pageview'); this looks similar older variant, however, can't find reference these api. i'm looking analogues of: _setcustomvar _trackpageview (is 'send', 'pageview' equivalent it?) _setdomainname (i want test on computer on intranet / connected http server running locally). sorry, there confusion here. i've found reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/domains here is, posterity, however, can't find analogue

version control - How to insert revision number of Java code file in to Java class file -

java code file contains @author , @version tags. version tag has information revision number of file. information resides in comments. there compilation flag or other mechanism available can add information .class file? short answer: compiler ignores javadoc other forms of comments. long answer: need write application copy existing @author authorname , @version versionstring javadoc elements above class/method declarations, such as: @author({"authorname", "otherauthor"}) @version("versionstring") public class [...] { [...] } an example author annotation be: @author("afk5min") @target({ elementtype.annotation_type, elementtype.constructor, elementtype.method, elementtype.type }) @retention(retentionpolicy.class) public @interface author { string[] value(); } this way, each annotation present in resulting class file , may accessed. 9.6.3.2. @retention annotations may present in source code, or may present in

javascript - How do I select a value from a dropdownlist case insensitive? -

i trying find "cat" in dropdown values of dropdown ["cat","rat","mat"] result not able find text , dont have id "cat" find id. suggestion? edit: lowercase() change "cat" cat right?? dropdown has "cat" try compare values lowercase : if(myvalue.tolowercase() === ddl[i].tolowercase()) { //... }

javascript - BlockUI scrolls to top -

Image
i using jquery blockui plugin: function block(msg) { $.blockui({ message: msg, css: { border: 'none', padding: '15px', backgroundcolor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .8, color: '#fff' } }); } function unblock() { $.unblockui(); } the problem facing is, call it, scrolls page top. not good. here generated html: is there modify not touch pageoffset / scrolling? there preserve or anything? thanks called here: function callbump(realid) { block('bumping...'); $.ajax({ type: "post", url: "calendarservices.aspx/bump", data: 'id=' + realid, success: function (data) { $('#calendar').fullcalendar('refetchevents'); unblock();

bash - Passing commands to named screen session via .sh script -

i'm beginner this, googled if elseif else tutorial , started build script. i'm trying create .sh script gives me option manage valves sourceserver php script. have currently: #!/bin/sh # config logfile="/var/www/management/ifacelog" newdate=`tz=gmt-3 date +%d.%m.%y" "%h:%m:%s` # end of config scriptcommand=$1 csgocommand=$2 if [ $scriptcommand = "start" ] ; echo $newdate "server started! connect cs.kask.fi; password gd | rcon_password tuksu" >> test touch lockfile screen -a -m -d -s csgo -l /home/csgo/server/srcds_run -game csgo -console -usercon -tickrate 128 +net_public_adr 46.246.93.192 +ip 46.246.93.192 +tv_port 27010 -maxplayers_override 11 +game_type 0 +game_mode 1 +host_worksh$ elif [ $scriptcommand = "restart" ] ; echo $newdate "stopping server" >> test echo $newdate "passing command tv_stoprecord , waiting 10sec." >> test scre

Check if input field value is included in array - Jquery -

i'm trying fire function if input field's value equal of number in array. i have code below, doesn't seem work!! var num1 = $("#people-number").val(); var numberarray = [1,3,5,7,9]; if ($.inarray(num1,numberarray) > -1) { $("#valid-people").hide(); $("#non-valid-people").fadein(); } any tips appreciated..... it because array has int values , the value testing string $.inarray(parseint(num1),numberarray) demo: fiddle

Python import file with dependencies in the same folder -

i have file ref.py depends on text file ex.txt , in same directory \home\ref_dir . works when run file ref.py , if try import ref.py file work.py in different directory \home\work_dir , following import sys sys.path.append('\home\ref_dir') import ref but error, program cannot find ex.txt how can solve issue without using absolute paths. ideas? use os module access current absolute path of module you're in, , dirname that you want open ex.txt in file this. import os open('%s/ex.txt' % os.path.dirname(os.path.abspath(__file__)) ex: print ex.read()

python - Check if part of string contains regex pattern -

i have list of strings. each string contains random text , sequence of numbers , letters may or may not match regex. example string: "bla bla bla 123-abc-456 bla bla blaaha" 123-abc-456 match regex. i wish store matching sequences new list; sequence is, not bla bla bla. how done? need break out sequence using regex somehow. in case have 1 "sequence" per string interested in: in [1]: import re in [2]: re.search(r'\d{3}-\d{3}-\d{3}', ..: "bla bla bla 123-abc-456 bla bla blaaha").group() out[2]: '123-abc-456' just in for loop , save results new list. if want multiple matches, use re.findall suggested above.

javascript - Extract and execute scripts from AJAX response -

my ajax response returns this: <div> .. </div> <script type="text/javascript"> .. </script> <script type="text/javascript"> .. </script> <div> .. </div> i want execute scripts script tag (should work cross-browserly) , insert text (divs) page after. your script tags don't need type="text/javascript" attribute cross-browser compatibility. and javascript execute top down. whatever script comes first execute first. add text insertion last, this: html: <div id="mydiv"></div> javascript: document.getelementbyid("mydiv").innerhtml = "hello";

hornetq - Setting JMS filter (Range filter) -

**i setting jms filter in producer side i.e jmsmessage.setobjectproperty("filter",filterid1) ... so 1 one relationship . i.e. key filter associated 1 value i.e filterid1 ( msg consumed consumer has value filterid1 ).... but want 1 many relationship , i.e . filter associted many filterid's (filterid1 or filterid2 or filterid3 or filterid4 or filterid5 ) consumer having value between of these filterid's can consume message ..... is der functionality in jms if no how can achieve programitically.....** you can use between on filter, suspect should use different queue sets. overusing filters give bad performance if have many messages scanned. i favor subscriptions filter, or use multiple queues stuff need. but that's going big beyond answering question, simple answer use between on filter clause @ consumer. (also: there's no such thing jms filter in producer. filter applies consumer. assume meant setting data used on filter).

android - JSON Parsing Error on Looping and others -

i having hard time parsing through following json output: {   "status":"success",   "data":[  { "question_id":"1", "category_id":"1", "question":"jjj", "answer":"ffdf", "created_on":"16 apr, 2013 06:52", "modified_on":"", "user_id":"1", "category_name":"career", "is_answered":true  },  { "question_id":"3", "category_id":"1", "question":"ssssssssssss", "answer":null, "created_on":"23 apr, 2013 15:12", "modified_on":"", "user_id":"1", "category_name":"career", &q

json - Android null pointer exception when using Async task -

i have async task in class , is parsing json. when execute code, in logcat see message: fatal exception: asynctask #1 . . . caused by: java.lang.nullpointerexception. if want @ it, here code: mainactivity.java protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); new readjson().execute(there address here); textview = (textview) findviewbyid(r.id.textview1); } //async task: inputstream inputstream = null; string result = null; httpresponse response; bufferedreader reader; jsonobject jobject; string ajsonstring1; string ajsonstring2; public class readjson extends asynctask<string, void, string> { protected string doinbackground(string... url) { defaulthttpclient httpclient = new defaulthttpclient(new basichttpparams()); httppost httppost = new httppost(there same address he

Android Google Map V2 Direction -

i trying driving direction between 2 positions - latlng(15.244,45.85555) , latlng(78.459,97.4666). the code have tried - polyline line = mmap.addpolyline(new polylineoptions(). add(new latlng(15.244,45.85555), new latlng(78.459,97.4666)) .width(5).color(color.red)); but draws straight line between 2 points . is there other method/way driving directions between these 2 points. try way: create gmapv2direction class public class gmapv2direction { public final static string mode_driving = "driving"; public final static string mode_walking = "walking"; public final static string mode_bicycling = "bicycling"; arraylist<string> str=new arraylist<string>(); public gmapv2direction() { } public document getdocument(latlng start, latlng end, string mode) { string url = "http://maps.googleapis.com/maps/api/directions/xml?" + "origin=" + start.latitude + "," + start

Ektron member to change password -

ektron 8.0.1 sp1 i found solution ( ektron user change password? ) appears different version of ektron. on site, members accounts set them , using custom profile page allow them change information. last piece allowing them change password 1 of choosing. tried searching old ektron forums search features seems broken/disabled. anyone have right code? i stopped looking specific api call change password , found code using elsewhere userdata, change , save back. worked perfect thought i'd share. protected void page_init(object sender, eventargs e) { _userapi = new ektron.cms.api.user.user(); if (_userapi.userid > 0) { _userdata = _userapi.getactiveuser(_userapi.userid, false); } } protected void btnsubmit_click(object sender, eventargs e) { // put validation code here try { _userdata.password = txtpassword.text.trim(); _userapi.updateuser(_userdata); } catch (exception ex) { // handle

xslt - How to print < and > symbols which are part of text..? -

i can't figure out way output string : <xml version="1.0" encoding="utf-8"> this tried: <xsl:variable name="lessthan" select="&#x3c;"/> <xsl:variable name="greaterthan" select="&#x3e;"/> <xsl:value-of select="$lessthan"/> <xsl:text>xml version="1.0" encoding="utf-8"</xsl:text> <xsl:value-of select="$greaterthan"/> but output i'm getting: &lt;xml version="1.0" encoding="utf-8"&gt; i tried doin this: <xsl:text><xml version="1.0" encoding="utf-8"></xsl:text> but editor doesn't let me this.it throws error match end tag ps:i not versed in xslt please reply if question sounds naive. try this: <xsl:text disable-output-escaping="yes">&lt;xml version="1.0" encoding="utf-8"&gt;</x