Posts

Showing posts from April, 2014

gwt rpc - Encode request payload in GWT RPC call -

i using gwt create web-app. when making rpc call client side (browser), in inspect element request payload below : 7|0|8|https://xxxx.xxxx.in/testproject/in.testproject.main/|87545f2996a876761a0c13cd750ea654|in.testproject.client.customerclassservice|check_user_login|java.lang.string/2004016611|in.testproject.beans.customerbean/3980370781|userid|password|1|2|3|4|3|5|5|6|7|8|6|0|0|0|0|0|custid|0|0|0|0|0|0|0|0|0| in request details username, password & custid displayed in request payload. my question is, possible encode or hide details request payload? you looking @ wrong level of abstraction. what's point of encoding/"hidding" these values in payload? exchange between server , client can intercepted anyway... unless use https . ensures safe/encrypted communication between server , client. don't try "clever" , encrypt part of communication/payload, just use https . but concern client should not able seen method call making, param

javascript - how to get properly formatted text value from a div -

i trying formatted text contenteditable='true' div send server. i used use textarea , when value of textarea preserves white space , line breaks, when using contenteditable div when using styles such following can not formatted text: white-space: pre-wrap; word-wrap: break-word; for example if type div: "a aa asdf" i out textcontent: "a aaasdf" is there way formatted text out of contenteditable div textarea? use .innerhtml linebreaks too. readup: .innerhtml | mdn working code snippet: document.getelementbyid('copy').addeventlistener('click', function(){ var text = document.getelementbyid('input').innerhtml; document.getelementbyid('output').innerhtml = text; }); div{ width: 200px; height: 200px; border: 1px solid black; display: inline-block; vertical-align: top; } <div contenteditable='true' id="input">enter funny<br>;)</div&g

Height issue with Facebook Embed Post -

i using fb post embed. on initial load posts shown up. if add new post , call ajax postback, after postback posts not shown.i checked documentation mentioned call fb.xfbml.parse() method, called still didn't work. while looking the code saw height , width of span fb returns , iframe inside span set 0 , overflow hidden. fb:post code shown here: i able resolve issue. issue have kept inside container div tag using $("#container").prepend("");. container div tag getting emptied , refilled using $("#container").empty();, that's why height width getting 0. updated code keep fb-root outside of container using $("#container").parent().prepend("");

MarkLogic - How can you do a collection-delete using Java API? -

how can collection-delete using java api ? i'm using jsondocumentmanager crud operations. there way like: xdmp:collection-delete("mycollection") use querymanager.delete() passing querymanager.newdeletedefinition() , in deletequerydefinition set list of collections want have deleted.

Android listview simple_list_item_checked -

i have listview uses android.r.layout.simple_list_item_checked layout. i need app detect when user checks item in listview , passes state of checkbox variable. how done? remember im not using custom layout listview. im using android.r.layout.simple_list_item_checked. for need enable android:choicemode="multiplechoice" in layout xml listview created. then set onitemclicklistener on listview : @override public void onitemclick(adapterview<?> parent, view view, int position,long id) { sparsebooleanarray sparsebooleanarray = listview.getcheckeditempositions(); system.out.println("clicked position := "+position +" value: "+sparsebooleanarray.get(position)); }

Clean the data in an efficient way in Python -

i have data in following format : top (s (pp-loc (in in) (np (np (dt an) (nnp oct.) (cd 19) (nn review) ) (pp (in of) (np ( ) (np-ttl (dt the) (nn misanthrope) ) ('' '') (pp-loc (in at) (np (np (nnp chicago) (pos 's) ) (nnp goodman) (nnp theatre) )))) (prn (-lrb- -lrb-) ( ) (s-hln (np-sbj (vbn revitalized) (nns classics) ) (vp (vbp take) (np (dt the) (nn stage) ) (pp-loc (in in) (np (nnp windy) (nnp city) )))) (, ,) ('' '') (np-tmp (nn leisure) (cc &) (nns arts) ) (-rrb- -rrb-) ))) (, ,) (np-sbj-2 (np (np (dt the) (nn role) ) (pp (in of) (np (nnp celimene) ))) (, ,) (vp (vbn played) (np (-none- *) ) (pp (in by) (np-lgs (nnp kim) (nnp cattrall) ))) (, ,) ) (vp (vbd was) (vp (advp-mnr (rb mistakenly) ) (vbn attributed) (np (-none- *-2) ) (pp-clr (to to) (np (nnp christina) (nnp haag) )))) (. .) )) (top (s (np-sbj (nnp ms.) (nnp haag) ) (vp (vbz plays ) (np ( n

android - IllegalStateException: Could not execute method of the activity -

can explain me why i'm getting java.lang.illegalstateexception: not execute method of activity when trying click button data database? my xml code has onclick this: <button android:layout_width="0dip" android:layout_height="wrap_content" android:text="delete" android:id="@+id/btndelete" android:layout_weight="1" android:onclick="onclick_deleteall"/> my mainactivity code: public void onclick_deleteall(view view){ dbtools dbtools = new dbtools(getapplicationcontext()) float total = dbtools.total(); } my database class(dbtools.java) code: public float total(){ float total = 0; sqlitedatabase db = getreadabledatabase(); cursor cursor = db.rawquery("select sum("+ price +") " + table_item_sell, null); if (cursor.movetofirst()){ total = float.parsefloat(cursor.getstring(0)); } return total; } don&#

Using attributes in slim Rails -

i'm trying add data-toggle="tab" links, can't seem work. piece of code works: li = link_to pages_catering_path = "catering" while 1 not? (i routing error): li = link_to "catering",pages_catering_path here attempt: nav.navbar-header.col-md-3 button.navbar-toggle data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" type="button" span.sr-only toggle navigation span.icon-bar span.icon-bar span.icon-bar .collapse.navbar-collapse.nav-justified ul.nav.nav-pills.nav-stacked li.active data-toggle = "tab" = link_to pages_about_path = "home" li = link_to pages_about_path = "about" li = link_to pages_catering_path = "catering" li = link_to pages_deli_and_bread_path = "deli & bread" li = link_to pages_pastries_path

limits - Why doesn't the contourf function in Matlab use the highest value of the plotted data? -

does know why function countourf doesn't use color corresponding maximum value anywhere in plot area? if try code below, , command get(h_colorbar,'ylim') matlab returns upper limit not highest element of matrix (500), smaller number (475.9091). as can see commented lines in code, able change upper/lower limits of colorbar, of course doesn't solve problem. i'd matlab use highest values in matrix of data; instance, i'd see point corresponding (200,300) colored in darkest red. xdata=[7 11 15 19 23 27 31 39 50 75 100 200]; ydata=[50 100 140 150 200 300]; dataz=[... 500 500 438 310 269 253 245 238 235 237 241 500 ... 500 414 291 259 248 244 241 239 239 250 274 500 ... 500 335 268 251 246 243 241 240 242 261 308 500 ... 500 323 264 250 245 243 241 241 243 265 319 500 ... 500 289 256 248 244 243 242 243 248 287 500 500 ... 360 264 250 245 244 243 244 247 261 376 500 500 ... ]'; % % % in matrix form mdataz=vec2mat(dataz,le

c# - Check if at least two hours have been spent within a time range, when given two dates -

i have 2 dates , need check if @ least 2 consecutive hours have been spent between times 1am , 5am, within dates. for example, if datefrom 2014-05-05 17:00:00 , dateto 2014-05-06 6:00:00, means 2 consecutive hours have been spend between 1am , 5am between 2 dates. the times (1am , 5am) configurable , not hard-coded - thus, represented variables. this have done far: //the timefromresidencyrange , timetoresidencyrange 1am , 5am respectively. //they collected 2 `datetimepicker` .net controls. timefromresidencyrange = dtptime1.value; //for testing, 1am (but can time) timetoresidencyrange = dtptime2.value; //for testing, 5am (but can time) private bool iswithinresidencyrange(datetime datefrom, datetime dateto, double consecutivehours) { var totaldiff = (dateto - datefrom).totalhours; if (totaldiff < consecutivehours) { return false; } datetime desirefromdate = new datetime(); if ((datefrom.timeofday.hours < timetoresidencyrange.hour)

android - How to specify Age/Gender on AdMob interstitials by code? -

the adrequest object has way specify age , gender, can't find way specify on interstitialad object. knows how ? it seems interstitialad has method loadad(adrequest adrequest) can set age , gender on adrequest object.

CouchDB: Create/Update/Delete if new, modified or removed -

i´m doing nightly data synchronisation pull out complete set of documents source/master through rest api , update slave destination couchdb. the data load pretty small, maximum 100 json documents. update frequency in master expected 1-2 times in week couple of documents. following changes can occur: document removed document added data in existing document changed does couchdb provide out-of-box bulk operation doing create/update/delete based on document collection sent in , automatically checks if documents new/changed/removed? if not, approach implement myself? edit: found 2 useful npm modules comparing json in source , destination. of interestes in solution of question. https://www.npmjs.com/package/json-diff https://www.npmjs.com/package/jsondiffpatch since data-set small, recommend using bulk documents api . you can use _all_docs retrieve entire data-set, store in memory , "does exist" , "what has changed" checks in-place. @

Why my PHP get changed to a comment? -

on webpage view-source:http://cordbloodcenter.com/en/corporate/cord-blood.alej.html wrote short php code when check source code, php code font green -> change comment. the php code is: <?php $myfile = fopen("units.txt", "r") or die("unable open file!"); echo fread($myfile,filesize("units.txt")); fclose($myfile); ?> why php changed comment? help, -luxqs the file extension .html not parsed php interpreter. can simple thing, , change file extension .php or make php parse .html files. go php ini file. @ end find this: addtype application/x-httpd-php .php change to: addtype application/x-httpd-php .php .html .htm and restart activate it. if use apache command: httpd -k restart this quite straightforward. prefer keep .html , .htm extension , hide fact using php. why give away more information needed? (not obfuscation way implement security, cannot hurt). don't need make artificial distinction between

android - facebook - recover from CLOSE_LOGIN_FAILED when user hits cancel button -

in app when user hits facebook login button, facebook displays page asking him confirm permissions - ask email permission in addition public_profile. if user hits "cancel" , exits main page session state becomes closed_login_failed. if user hits facebook login button again, permissions page displayed again, time shows "public_profile". how can make ask email when session state closed_login_failed? here code: if(!session.isopened() && !session.isclosed()) { session.openforread(new session.openrequest(context).setcallback(statuscallback).setpermissions(arrays.aslist("email"))); } else { session.openactivesession(context, true, statuscallback); } achieved following code: if (session.isopened()) { session.openactivesession(activity, true, statuscallback); } else if(session.getstate().equals(sessionstate.created)) { session.openforread(new session.openrequest(activity).setcallba

c++builder - Firemonkey C++, how to change font color and cell color in StringGrid, changing in ApplyStyleLookup -

i have made research of how dynamically @ run time change font color , cell background color, solutions in delphi code, , cannot used in c++. like one: cellctrl := tcolumnaccess( stringgrid1.columns[ col ] ).cellcontrolbyrow( row ); cellcontrolbyrow doesnt exist in fmx c++ builder. have tried use tgrid , make grid slow when each cell has drawn custom in event driven ondrawxxxx . there solution changing font color , cell color in event onapplystylelookup , again solution in delphi doesn't exist in c++ builder, or don't know how implement in onapplystylelookup c++ builder style. any on appreciated, since have been week in now.

java - Wicket: AutoCompleteTextField with "favourites" -

i need build autocompletetextfield-like component user can mark options favourites (when starts write, options show , each option has checkbox mark favourite). user can check checkbox outside autocompletetextfield choose whether favourites shown or on contrary values no matter if favourites or not, shown. i have read using panels instead of string in autocompletetextfield , think done using iautocompleterenderer... any ideas? i go solution provided robert in https://stackoverflow.com/a/15484348/461499 . why? if have complete control on how choices rendered (by using plain wicket components instead of javscript), can built rich component. although think take javascript effort make choices-panel , feel correct, should worth investment.

osx - Coudn't load JSON while calling api in Swift -

i have own api application. trying call api , need json data response. here code import cocoa class viewcontroller: nsviewcontroller { @iboutlet weak var emailtext: nstextfield! @iboutlet weak var passwordtext: nssecuretextfield! @ibaction func signin(sender: anyobject) { println("email \(emailtext.objectvalue) , password \(passwordtext.objectvalue)") var url : string = "https:username:password@api.example.co/api/v3/auth/token/" var request : nsmutableurlrequest = nsmutableurlrequest() request.url = nsurl(string: url) request.httpmethod = "get" nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue(), completionhandler:{ (response:nsurlresponse!, data: nsdata!, error: nserror!) -> void in var error: autoreleasingunsafemutablepointer<nserror?> = nil let jsonresult: nsdictionary! = nsjsonserialization.jsonobjectwithdata(data, options:nsjsonreadingoptions.mutablecontainers, error: e

c# - Update command not firing datasource's update transport method - Kendo Grid -

hi returning data table stored procedure used bind grid. no identity field returned data table. in scenario please me out firing 'update', 'destroy' , 'create'. this controller method, public jsonresult employee_read([datasourcerequest]datasourcerequest request) { datatable dt = new datatable(); using (sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["manualconn"].connectionstring)) { var command = new sqlcommand("usp_fetchuserdetails", con); command.commandtype = commandtype.storedprocedure; con.open(); sqldataadapter da = new sqldataadapter(command); da.fill(dt); system.web.script.serialization.javascriptserializer serializer = new system.web.script.serialization.javascriptserializer(); list<dictionary<string, object>> ro

regex - Partial Matching two data frames having a common column(by words) in R/Python -

i have 2 dataframes csv files df1 has more rows df2 : df1 name count xxx yyyyyy bbb cccc 15 fffdd 444 ggg 20 kkbbb ccc dd 29p 5 22 cc pbc2 kmn3 b23 efgh 4 ccccccccc sss qqqq 2 df2 name xxx yyyyyy bbb cccc ccccccccc sss qqqq pppc 22 cc pbc2 kmn3 b23,efgh i want partial matching(approximate/fuzzy matching) matching either first two/three words. output this: output: name count xxx yyyyyy bbb cccc 15 22 cc pbc2 kmn3 b23 efgh 4 ccccccccc sss qqqq 2 by trying exact matching, i'm missing of rows. tried agrep in r somehow not working , fuzzy matching quite slow. please suggest me way in r or python. appreciated! in r, can use agrep fuzzy matching. can use max.distance parameter set maximum distance allowed match. df1[sapply(df2$name, agrep, df1$name, max.distance = 0.2), ] # name count # 1 xxx yyyyyy bbb cccc

html - Javascript - Move DIV Scrollbar to Top When iFrame SRC Changes -

Image
re: http://www.gooplusplus.com/cost-of-living-compare-cities/ i made relatively simple web site make easier compare potential "expat" cities. there links (target=iframe) each city cost of living data, wikipedia, expat blogs, climate info, , google map. the left column consists of several control links each city. the main window single iframe within div . iframe scrolling set off. scrolling done using iframe's div. iframe contents external domains . the problem: if 1 scrolls down view long wikipedia entry , user clicks on new city link, iframe content position stays @ old div position , not typically wanted. the desired behavior ( javascript , not jquery): move div's vertical scrollbar - go top of document whenever iframe src document changes. this easier more complex web sites using iframes. simple web page, body , not div control scrolling. <iframe src="numbeo.html" onload="window.scrollto(0,0);" etc. >

merging profile views in google analytics -

i have website users commonly go x/y/z/userprofile=123456 , analytics data being polluted lot of different profile views. want merge them 1 'viewed profile' bit of data. does have idea should putting filters information want? i new ga unsure start

VB6 recordset code to VB.Net -

i updating elses old code vb6 windows application vb.net web application. understand old code, not sure how translate .net recordsets. mystoredprocedure = "sp_writevpayrollcurrent" mycurrentpast = "'n'" mystoredprocedure = "sp_obtainsubclassid" myclassname = "payroll major" mysubclassname = "new hire" set rs = tgetreadresultsetwithparms(myclassname, mysubclassname, (mystoredprocedure)) also, not sure happen "mystoredprocedure" being declared twice or error? the tgetreadresultsetwithparms function follows (some cases redacted free space): dim en rdoenvironment dim cn rdoconnection dim rq rdoquery rdodefaultcursordriver = rduseserver 'open connection tstdbexecutive database using dsnless connections set en = rdoenvironments(0) set cn = connectionstring stuff here select case mystoredprocedure 'create reusable rdoquery , call sql server stored procedure. case

Libss7 with asterisk 13 -

does knows libss7 work asterisk 13 , if yes version of libss7 suits best? , if libss7 doesn't work asterisk 13 alternatives. thanks. it's documented on asterisk wiki - both in upgrade notes , in new features list asterisk 13. namely, yes, supported; however, due substantial updates in both chan_dahdi , libss7, must use libss7 2.0.0 or later.

internet explorer 8 - bootstrap modal dialog backdrop in IE8 -

//ingnore html element $("#mydialog").modal({ show: true,backdrop: "static", keyboard: false }); the top code. can show modal dialog in ie8, shadow mask lost,it means can click link on page when dialog open. ie9+, firefox, chrome can work well. how can solve problem in ie8, thanks!

ios - How do I show UITextField data on a UILabel in a second UIViewController in swift? -

i'd pass through data entered uitextfields in current view controller second view controller on save button action. i'm using storyboards, advise me on how achieve this? i'm using xcode 6. @ibaction func savebuttontapped(sender: anyobject) { let viewcontroller = secondviewcontroller(); viewcontroller.name = self.nametextfield.text; viewcontroller.phone = self.phonetextfield.text; viewcontroller.city = self.citytextfield.text; } i found problem @ibaction func savebuttontapped(sender: anyobject) { let viewcontroller = secondviewcontroller(); viewcontroller.name = self.nametextfield.text; viewcontroller.phone = self.phonetextfield.text; viewcontroller.city = self.citytextfield.text; } problem line let viewcontroller = secondviewcontroller() i changed to let viewcontroller = self.storyboard!.instantiateviewcontrollerwithidentifier("secondviewcontroller") as! secondviewcontroller with change code working fine thanks..

pptp - use of chap-password and mschap-resposse attributes -

with radius want understand if 'chap-password' attribute can used authentication both chap , mschap. or 'chap-password' used chap protocol , 'mschap-challenge', 'mschap-response' vsa's used mschap based authentication. found link explaining mschap uses mschap vsas , chap uses chap-password avp authentication. https://www.packtpub.com/books/content/freeradius-working-authentication-methods also rfc 2548 explains microsoft vendor-specific radius attributes doesn't chap-password can used mschap authentication.

ruby - Rails check if URL is already encoded -

i using uri.encode encode url's in rail's application. these url's can encoded , not want encode them again. can see 1 solution here: how find out if string has been url encoded? however, wondering there api available in ruby doing ? also suggested in https://stackoverflow.com/a/2295286/1475737 decoding string , checking length original correct solution ? appreciate suggestions! the 'uri' module has regular expression holding list of characters should escaped uri encoding: require 'uri' uri::regexp::unsafe => /[^-_.!~*'()a-za-z\d;\/?:@&=+$,\[\]]/n so 1 solution test whether given string matches regexp , encode if does.

bzip2 - using bz2.decompress in python,but the answers different -

i have string this: un: 'bzh91ay&sya\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3m\x07<]\xc9\x14\xe1ba\x06\xbe\x084' pw: 'bzh91ay&sy\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3m\x13<]\xc9\x14\xe1bbp\x91\xf08' and code: un = re.search(r"un: '(.+)'",page).group(1) bz2.decompress(un) then use bz2.decompress method, returns error: ioerror: invalid data stream and try this: un = 'bzh91...\x084' bz2.decompress(un) and returns correct answer. supplement :this complete code. #!/usr/bin/env python import urllib import re import bz2 def main(): page=urllib.urlopen("http://www.pythonchallenge.com/pc/def/integrity.html").read() unstring = re.search(r"un: *'(.+)'",page).group(1) print unstring un = "bzh91ay&sya\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3m\x07<]\xc9\x14\xe1ba\x06\xbe\x084" #the string un copied output

ubuntu - How to know what version of UglifyCSS was installed? -

i has installed uglifycss globally command: npm install -g uglifycss how can current version of installed uglifycss ? p.s. version of uglifyjs check command: uglifyjs -v but when try similar command uglifycss : uglifycss -v i had error: unable process "-v" error: enoent, no such file or directory '-v' same error when try -v , --version there no command line option installed version. valid options --max-line-len , --expand-vars , --ugly-comments , --cute-comments . however, can run npm list -g or npm list list of installed packages , version numbers. or can add package name query specific package, e.g. nmp list uglify-js .

node.js - Confused in with real time web server choice -

i want develop real time web application chatting & real time message conversion. searched internet , got confused few technology erlang ejabberd nodejs openfire right im in java domain won't hesitate learn new things. can explain these technology in simple words , technology need achieve target ? these same thing ? , new technology suggestion side appriciated. these entirely different things :) at lowest level have: erlang/otp piece of technology, lets built low latency, fault tolerant systems. includes erlang programming language, erlang vm , otp, set of patterns, libraries , practices writing systems. nodejs platform, lets code javascript on server side. makes life little bit easier, when dealing events, erlang still better saving callback hell actors , messages between them. at higher level have xmpp: xmpp extensible messaging , presence protocol. great implementing chats facebook chat, because extensible, can use kind of messaging. ejabbe

javascript - When creating a table inside a div. Text "undefined" shows up for no reason -

i have table create in div. on button click table being created inside div. html code use create emtpy div, when page being opened: <div id="historytablediv"> </div> this javascript code execute when button clicked create table inside div: function createtable() { var text = 'id: test<br>'; var thead = '<table><thead><tr><td>#</td><td>name</td></tr></thead><tbody>'; var tbody = '<tr>'; tbody += '<td>test id</td>'; tbody += '<td>test name</td>'; var tfooter = '</tr></tbody></table>'; document.getelementbyid('historytablediv').innerhtml = text + thead + tbody + tfooter; } the table created fine. problem text "undefined" showing between text "id: test" , table. have absolutely no idea coming from. extra info: have 6 divs on

android - how to change the color RatingBar depending on the number of stars? -

how following? if ratingbar has 1-3 stars - red stars. if ratingbar has 4 stars - yellow stars. if ratingbar has 5 stars - green stars. ((ratingbar) layout.findviewbyid(r.id.ratingbar)).setprogress(integer.parseint(surveybeans.get(section).get(position).getrate())); <ratingbar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ratingbar" android:stepsize="1" android:clickable="false" style="?android:attr/ratingbarstylesmall" android:layout_gravity="right" android:layout_marginright="15dp" /> edit: @override public view getitemview(int section, int position, view convertview, viewgroup parent) { linearlayout layout; if (convertview == null) { layoutinflater inflator = (layoutinflater) parent.getcontext().getsystemservice(context.layout_inflater_service);

.net - Retry policy for SOAP over a ClientBase auto-generated class? -

i have class theservicesoapclient inheriting clientbase has been auto-generated visual studio 2012 based on wsdl associated remote web service based on soap. var myclient = new theservicesoapclient(); var r = myclient.getsomething(); // unreliable, need retry policy yet, remote service not reliable , fails, returning http error codes 403 or 500. implement retry-policy let me intercept faulty responses , retry according. how can that? catch invalidoperationexception exception during unreliable getsomething() operation, , use appropriate delay before retrying. retries = 0; while (retries < retrylimit) { try { var r = myclient.getsomething(); } catch (invalidoperationexception exception) { retries++; system.threading.thread.sleep(50); } }

php - Split a paragraph into 100 characters arrays -

i'm trying split paragraph 100 characters arrays. algorithm doesn't work... in output first 1 100 characters. second 1 200, next 1 300 think... $desc = $this->getdescription(); $desc = preg_replace('/[^a-za-z0-9\s]/', ' ', strip_tags(html_entity_decode($desc))); $desc = preg_replace('/(\s\s+|\t|\n)/', ' ', $desc); $count = strlen($desc); $time = ($count/100); $x = 0; $y = 100; for($i = 0; $i<ceil($time);$i++){ $array[$i] = substr($desc,$x,$y); $array[$i] = str_replace(" ", "+", $array[$i]); $link[$i] = 'http://translate.google.com/translate_tts?tl=en&q=' . $array[$i]; $x+= 100; $y+= 100; } does know problem? the output get: where tried debug it... characters: 100 | x: 0 | y: 100 | |characters: 200 | x: 100 | y: 200 | |characters: 300 | x: 200 | y: 300 | |characters: 400 | x: 300 | y: 400 | |characters: 422 |

android - How can I parse json before post data for my listview adapter -

i m trying make json parser android application. i need post data after m getting json object in while listview adapter. m using code getting error. tried because change many times cant that. (i can json data, in case, want make post before json parse.) how should edit code? help, documents. i m getting error : java.lang.runtimeexception: error occured while executing doinbackground() this code : public class veritabanikayit extends asynctask<string, integer, jsonobject> { private progressdialog pdialog; jsonobject json2; @override protected void onpreexecute() { super.onpreexecute(); yaydescription = (textview)findviewbyid(r.id.yaydescription); yaydistance = (textview)findviewbyid(r.id.yaydistance); yaycreatedtime = (textview)findviewbyid(r.id.yaycreatedtime); pdialog = new progressdialog(homelistview.this); pdialog.setmessage("wait min ..."); pdialog.setindeterminate(false);

C++: check if vector<Class> is subset of vector<Class> -

i have following piece of code. have 2 strings (k1, k2), break tokens using whitespace delimeter (t1, t2). want check if t1 contained in t2. problem issubset(t1, t1) 0 value returned. want avoid using vector<string> instead of vector<stringref> , if possible. doing wrong? output should 2 1's 2 0's instead. #include<string> #include<iostream> #include <time.h> #include <string.h> #include <vector> #include <algorithm> using namespace std; class stringref { private: char const* begin_; int size_; public: int size() const { return size_; } char const* begin() const { return begin_; } char const* end() const { return begin_ + size_; } std::string tostring() { std::string value(begin_); return value; } stringref( char const* const begin, int const size ) : begin_( begin ) , size_( size )

ibm rad - Differences between webAppAccess.getVariables().getXmlElement("someResults","RowSet") and webAppAccess.getVariables().getXml("someResults","RowSet") -

i wondering differences between: webappaccess.getvariables().getxmlelement("someresults","rowset") and webappaccess.getvariables().getxml("someresults") in ibm web experience factory? when call getxmlelement("someresults","rowset") ixml variable named "someresults" searched element "rowset" in , same returned. getxml("someresults") returns full ixml variable. here eg. suppose ixml variable "someresults" has following value <data> <rowset> <row> <name>row1</name> </row> </rowset> </data> **output for** getxmlelement("someresults","rowset") <rowset> <row> <name>row1</name> </row> </rowset> **output for** getxml("someresults") <data> <

ant - Jenkins PHP job failed -

a few days wrestling jenkins , errors gave me. have things stabilized somewhat, can not understand, because build fails. that's earn , can not figure out i'm wrong. consider following 2 topics: jenkins php job failing , jenkins-job fails but can not find solution problem. [workspace] $ ant buildfile: /var/lib/jenkins/jobs/mtr-cms/workspace/build.xml clean: [delete] deleting directory /var/lib/jenkins/jobs/mtr-cms/workspace/build/coverage [delete] deleting directory /var/lib/jenkins/jobs/mtr-cms/workspace/build/logs prepare: [mkdir] created dir: /var/lib/jenkins/jobs/mtr-cms/workspace/build/coverage [mkdir] created dir: /var/lib/jenkins/jobs/mtr-cms/workspace/build/logs phpunit: [exec] phpunit 4.4.0 sebastian bergmann. [exec] [exec] configuration read /var/lib/jenkins/jobs/mtr-cms/workspace/phpunit.xml [exec] [exec] . [exec] [exec] time: 154 ms, memory: 10.00mb [exec] [exec] ok (1 test, 1 assertion)

r - Show me if the maximum value moved to other column -

Image
i prepared example data let's take on it: > dput(example1) structure(list(fr1 = c(0.2, 0, 0, 0, 0, 0), fr2 = c(0.7, 0, 0, 0, 0, 0), fr3 = c(1, 0.35, 0, 0, 0, 0), fr4 = c(0.1, 1, 0, 0, 0.5, 0), fr5 = c(0, 0.4, 0, 0, 1, 0), fr6 = c(0, 0, 0, 0, 0.3, 0), fr7 = c(0, 0, 0, 0.7, 0, 0), fr8 = c(0, 0, 0, 1, 0, 0), fr9 = c(0, 0, 0, 1, 0, 0), fr10 = c(0, 0, 0, 0.65, 0, 0.7), fr11 = c(0, 0, 0, 0.2, 0, 1)), .names = c("fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9", "fr10", "fr11"), row.names = c("mazda rx4", "mazda rx4 wag", "datsun 710", "hornet 4 drive", "hornet sportabout", "valiant"), class = "data.frame") > dput(example2) structure(list(fr1 = c(1, 0, 0, 0, 0, 0), fr2 = c(0.7, 0, 0, 0, 0, 0), fr3 = c(0.2, 0, 0, 0, 0, 0), fr4 = c(0.1, 0, 0, 0, 0.5, 0), fr5 = c(0, 0.1, 0, 0, 1,

.net - C# DataTable delete row -

i have datatable participantaccounts not connected database or something. how can delete row it? this not working : for (int = participantaccounts.rows.count - 1; >= 0; i--) { datarow dr= participantaccounts.rows[i]; if (equals(dr["sellrmembid"].tostring(), itemid)) participantaccounts.rows.removeat(i); } participantaccounts.acceptchanges(); it acts fine row still remains in datatable. tried dr.delete() neither works. when try participantaccounts.rows.remove(dr) exception the given datarow not in current datarowcollection. what doing wrong? if (participantaccounts.rows.contains(itemid)) { datarow foundrow = participantaccounts.rows.find(itemid); participantaccounts.rows.remove(foundrow); }

c - How can client send and receive messages at the same time with sockets? -

i created chatroom clients , server , works. have problem of printing. problem client can write message , read message other clients @ same time. used thread both @ same time. works @ example problem : here start writing first messhere received message interrupts writingand here continue writing i don't know if it's clear : start writing message don't send yet because it's not on in same time message received prints after beginning of writing message , after can continue writing. do have idea how fix problem ? here client code : void getmessage(char* message) { size_t ln = -1; while (ln <= 0 || ln > message_max-1) { printf(">"); fgets(message, message_max, stdin); ln = strlen(message) - 1; } if (message[ln] == '\n') message[ln] = '\0'; } void *thread_message(void *arg) { char* message; message = malloc (sizeof(char) * message_max); int* sockfd = (int*)arg; while (1) { getmessage(

java - How to integrate two Parse Tree data structures from two different NLP Tools -

i using both stanford corenlp , fudan nlp process chinese natural language. these 2 tools both generate parse tree, i.e. stanford corenlp parse tree , fudan nlp parse tree (let me call them stree , ftree ). and need make use of stree , ftree , , costumed method on them, sharing same function signature , various in implement details. best practice define class can generate both stree , ftree . however, these 2 kind of parse tree totally different in aspect of data structure. can think of 2 solutions: define class tree generic type, passed content type of stree , ftree . plus treefactory pass these 2 kind of content types , generate relative trees. if follow way, cannot take apart 2 kind of implementation of same method. define interface or abstract class tree , contains several methods. extend interface 2 different subclass corresponding stree , ftree . if follow way, children in subclasses not subclass of super.children . class treenode { list<treenode