Posts

Showing posts from June, 2011

iphone - How to get data back from webserver with NSMutableURLRequest -

iphone - How to get data back from webserver with NSMutableURLRequest - i seek build app user come in info , info post webserver save in database. web server returns info id or else. how can receive info webserver returns back? transfer works nsmutableurlrequest. search sollution read reply web server , display on label. have @ delegate methods of nsurlconnection . iphone

html - testing code on ie6 without installing it? -

html - testing code on ie6 without installing it? - i'm on windows 7. there way test ie6-tuned code on local machine without installing browser? try microsoft look web superpreview. html windows browser internet-explorer-6

Android: Old Google Drive integration issue? -

Android: Old Google Drive integration issue? - my android application integrates google drive using api google published prior it's current drive api, includes bunch of jars 'google-api-client-1.12.0-beta.jar', 'google-api-services-drive-v2-rev59-1.12.0-beta.jar', etc... and in manifest file, include: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> i'm not sure changed, line in manifest file gives next error: error: no resource found matches given name (at 'value' value '@integer/google_play_services_version'). i see utilize new google-play-services_lib resolve error, require rewriting entire integration utilize new api. there way reference resource value @integer/google_play_services_version without including new library project? (or thought how project compiled without error, despite not defining resource or including lib proj...

node.js - is reyling on req.param(name) dangerous in regards to queryParam injection? -

node.js - is reyling on req.param(name) dangerous in regards to queryParam injection? - say, i've got next resource: customers/{id} with authentication/authorization performed in middleware on req.params.id . i.e.: check client can alter it's own resource , none other. suppose there's set endpoint @ resource: put customers/{id} which internally implemented doing lookup followed update in mongo (for instance) if lookup performed id coming req.param("id") have big problem seems. why: mutual practice not check superfluous query-params, silently ignore them. if forget blacklist query-param id ? e.g.: put customers/{evilcustomerid}?id=victimcustomerid now evilcustomer can freely update `victimcustomer, while still having passed authorization middleware. of course of study argue there should more validation in place create sure doesn't happen. but, if utilize req.params.id instead of req.param(id) never happen. in other word...

avoid duplicate in mysql insert -

avoid duplicate in mysql insert - i have friends table has 'id', 'friend (integer)' , 'user (integer)' fields. a friend relationship exists between user , friend. i.e. id user friend 6 22 45 7 45 22 is same friend relationship , should considered duplicate record. i want input whole lot of records @ once, like: insert friends (user, friend) values(22, 34), (22, 76), (22, 567)...; in situation, can utilize ignore avoid entering duplicate (22, 34) entry(if (22, 34) exists), there way can avoid entering (22, 34) if (34, 22) exists, same relationship. sort each pair; insert ignore avoid error messages. you can sort insert doing insert ignore tbl (a,b) values (least($a, $b), greatest($a, $b)); however, in order batch insert, should sort in client language. another issue: insert ignore create id before checks dup. therefore, lots of auto_increment values 'burned'. rather explain...

c# - Is possible to create strongly typed action link helper? -

c# - Is possible to create strongly typed action link helper? - my goal pretty simple want create typed actionlink helper concrete controller in asp.net mvc. doesn't work; thought i'm on right way... can give me advice? public static mvchtmlstring actionlinkfor<tcontroller>(this htmlhelper<tmodel> html, expression<func<tcontroller, actionresult>> action) { homecoming mvchtmlstring.empty; } usage pretty simple ( <li>@(html.actionlinkfor<hellocontroller>(a => a.index))</li> ), i'm ending error message: cs0428: cannot convert method grouping 'index' non-delegate type 'system.web.mvc.actionresult'. did intend invoke method? instead of <li>@(html.actionlinkfor<hellocontroller>(a => a.index))</li> use <li>@(html.actionlinkfor<hellocontroller>(a => a.index()))</li> c# asp.net asp.net-mvc asp.net-mvc-4 lambda

Long Polling in Python with Flask -

Long Polling in Python with Flask - i'm trying long polling jquery , python under flask framework. having done long polling before in php, i've tried go in same way: a script/function has while(true) loop, checking changes periodically eg.every 0,5 seconds in database, , returns info when alter occurs. so in ini.py i've created app.route /poll jquery call. jquery gives info client's current state, , poll() function compares what's in database. loop ended , returns info when alter observed. here's python code: @app.route('/poll') def poll(): client_state = request.args.get("state") #remove html encoding + whitesapce client state html_parser = htmlparser.htmlparser() client_state = html_parser.unescape(client_state) client_state = "".join(client_state.split()) #poll database while true: time.sleep(0.5) info = get_data() json_state = to_json(data) json_stat...

xml - android drawable selector compatibility issue -

xml - android drawable selector compatibility issue - i had button drawable selector set background. button_sign_in_background.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_sign_in_background_selected" android:state_focused="true" /> <item android:drawable="@drawable/button_sign_in_background_selected" android:state_pressed="true" /> <item android:drawable="@drawable/button_sign_in_background_selected" android:state_selected="true" /> <item android:drawable="@drawable/button_sign_in_background_normal" /> </selector> button_sign_in_background_normal.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle...

google maps - Given two point's latitude and longitude, computing coordinates of point in between -

google maps - Given two point's latitude and longitude, computing coordinates of point in between - i'm trying generate annotations on map. currently, i'm using openstreetmap query general. have 2 end points on map , corpus of few selected points highlight. the 2 endpoints given in form lat, long <walksteps> <distance>9.742464221826811</distance> <streetname>5th st nw</streetname> <absolutedirection>east</absolutedirection> <stayon>false</stayon> <bogusname>false</bogusname> <lon>-84.3937361115149</lon> <lat>33.77692965678444</lat> <elevation/> </walksteps> <walksteps> <distance>508.2608917548245</distance> <relativedirection>left</relativedirection> <streetname>fowler st nw</streetname> <absolutedirection>north</absolutedirection> <stayon>false</stayon> <bogusname>false</bogusname> ...

xml - can I use current() function in XPath, outside of XSLT? -

xml - can I use current() function in XPath, outside of XSLT? - this xml document: <root> <bad> <id>13</id> <id>27</id> </bad> <books> <book id='5'/> <book id='7'/> <book id='13'/> </books> </root> now i'm trying select books not "bad": /root/books/book[not(/root/bad/id[.=@current()/@id])] this doesn't work. i'm getting books, while book no.13 should excluded. it's not xslt. it's xpath request (i'm java). what's wrong? the current() function supported xslt. there's no need utilize current() here. can result want next expression: /root/books/book[not(@id=/root/bad/id)] xml xpath

plot - Distribution fitting and histogram overlay (scaling matter) - MATLAB -

plot - Distribution fitting and histogram overlay (scaling matter) - MATLAB - while trying overlay pdf (probability density function) values on histogram face important scaling issues histogram barely visible on chart. might due scaling factors used in below code, otherwise density curves tiny. in predicament , wondering if there better way accomplish task without resorting adhoc scaling factor? bmin=min(b); bmx=max(b); nrow=length(b); nbin=sqrt(nrow); pd = fitdist(b,'normal'); p = stblfit(b,'ecf'); x_pdf=[bmin:0.0025:bmax]; y=pdf(pd,x_pdf); hist(b,nrow); h = findobj(gca, 'type','patch'); h.facecolor=[0 0 0]; hold on; scale = 0.156*max(y); plot(x_pdf,y.*scale,'or'); hold on; scale2 = 0.24*max(y); plot(x_pdf,stblpdf(x_pdf,p(1),p(2),p(3),p(4)).*scale2,'k-'); legend('p&l distribution','normal fit', 'ecf fit') thanks as plotting histogram, y-axis represents number of counts specific interval. if...

javascript - Browserify module hash not recognized after bundling -

javascript - Browserify module hash not recognized after bundling - i'm using this guide having multiple bundles in gulp-browserify configuration. want seperate vendor , app scripts minimize build times much possible. basically uses bundle.require() , bundle.external() within browserify.on('prebundle') work: the tasks run fine, in browser error: uncaught error: cannot find module 'xpfelz' after opening created main.js (build/main.js) see this: what missing? why module name go weird? if manually alter xpfelz jquery works fine. this issue seems related although never resolved. edit: apparently 'xpfelz' hash assigned browserify. why hash not recognized within main.js? javascript jquery build-process gulp browserify

Is the factory pattern suitable for making more than one object? -

Is the factory pattern suitable for making more than one object? - i have create lot of objects relate each (i.e. 1 passed in parameter of constructor other) work. usually mill type patterns seem suitable making 1 object. several. thinking of doing fluent interface , properties on class final objects, or utilize specification design pattern. there other improve way? thanks it sounds want builder pattern sorry, link had dead image, this one may help also design-patterns

java - Why does this parallel algorithm run more slowly than its sequential counterpart? -

java - Why does this parallel algorithm run more slowly than its sequential counterpart? - sequential: void do(list<d> d, final list<c> c) { (d datum : d) getchampoid(datum, c).tally(datum); parallel: static final int procs = runtime.getruntime().availableprocessors(); static final executorservice pool = executors.newfixedthreadpool(procs); void do(list<d> d, final list<c> c) { list<future> futures = new arraylist<>(); (final d datum : d) futures.add(pool.submit(new runnable() { @override public void run() { getchampoid(datum, c).tally(datum); } })); (future f : futures) seek { f.get(); } grab (interruptedexception e) { e.printstacktrace(); } grab (executionexception e) { e.printstacktrace(); } i'm stumped because me exact same thing, parallel version should faster, it's ...

geolocation - How to get areas/regions for a country and cities for this area/region? -

geolocation - How to get areas/regions for a country and cities for this area/region? - we made simple query gets cities: select * `allcountries` name='moscow' , `country_code` = 'ru' here result of query - http://i.stack.imgur.com/vjvrq.png (we not have 10 reputation post image). for example, city result 4-7 rows. how areas/regions country , cities area/region? p.s.: please careful. not interested in api site , database fetch. thanks! background in geonames have feature_class es , feature_code s discriminate location type. can find detailed description of code in geonames website. in snapshot, p.pplc means "city (populated place) capital of political entity" , s.hlc means "building (spot) hotel". also, every geoname have properties identify location in "hierarchy" within country; properties country_code , admin1_code , admin2_code , admin3_code , admin4_code . note not properties used every given geoname, sinc...

filesystems - Monitor/audit file delete on Linux -

filesystems - Monitor/audit file delete on Linux - one of .beam files of 1 of application deps beingness deleted , not sure what/how. is there way monitor or audit file see happens when deleted? i'm using redhat distro. yes, can utilize audit daemon. did't linux distro. reddish hat based systems contain auditd, , can utilize auditctl add together rules. to watch directory recursively changes: auditctl -w /usr/local/someapp/ -p wa to watch scheme calls made programme pid of 2021: auditctl -a exit,always -s -f pid=2021 check man page auditctl. results logged /var/log/audit/audit.log to ensure it's running. /etc/init.d/auditd status for more thorough approach, utilize tripwire or ossec, they're geared more toward intrusion detection. linux filesystems

mysql - Retrieve data from two tables -

mysql - Retrieve data from two tables - i want retrieve info 2 tables in parse. have searched fail find query it. please help me out. mysql join parse.com

knockout.js - How to avoid binding table knockout in computed array -

knockout.js - How to avoid binding table knockout in computed array - i have table load values of arraya wich 1 ko.computed array, wich 1 depends of value of other arrayb. when remove element of array b, automatically arraya updated new values of arrayb. the problem when example: <tbody data-bind="foreach: arraya()"> <tr><td data-bind="text: $data.value"></td></tr> </tbody> javascript: arrayb.remove(data); when operation in html table reloaded previous values of arraya without element deleted + new value of arraya. how can avoid reload of table previous values of arraya + new value of arraya computed? want reload new values of computed arraya without previous content. thanks in advance. if create ko.computed , becomes dependant observable, hence changes made observable computed watching cause update. way designed work, it's called dependency chain. i suggest looking alternative solution...

hadoop - Phoenix view not reading HBase numerical values properly -

hadoop - Phoenix view not reading HBase numerical values properly - my hbase table has columns containing bigint. bigints declared hive, has used hive generate hbase's hfiles mass loading. from hbase shell can print row , see appropriate integer value : ... 00000020-079e-4e9f-800b-e71937a78b5d column=cf:p_le_id, timestamp=1428571993408, value=1395243843 ... from phoenix select row , see negative value. select "p_le_id" "bulk_1month" uuid = '00000020-079e-4e9f-800b-e71937a78b5d'; i tried several types declaring column in phoenix. none of them matched hbase value : -- bigint : -5678131804545731784 -- unsigned int : 825440565 -- unsigned long : 3545240232309044024 -- unsigned_float : 2.6080447e-9 -- integer : -1.322.043.083 one interesting point : hbase value 1,395,243,843. phoenix type showing "more similar" value integer. thanks in advance suggestions! i noticed can read appropriate value when using varc...

c# - Delete specific document from DocumentDb -

c# - Delete specific document from DocumentDb - the next code retrieves crawlresult documents specific jobid. var result = (from c in documentdb.createdocumentquery<shared.crawlresult>(collection.selflink) c.jobid == jobid select c); now want delete documents specific jobid. way delete documents found was: documentdb.deletedocumentasync(string documentlink) but how documentlink execute documentdb.deletedocumentasync() ? to this, need write sql query can dynamically access both internal properties of document, crawlresult. for example, in next code: class crawlresult { [jsonproperty("jobid")] public string jobid; } private async task queryanddelete(documentclient client, string collectionlink) { await client.createdocumentasync(collectionlink, new crawlresult { jobid = "j123" }); await client.createdocumentasync(collectionlink, new crawlresult { jobid = "j456" }); foreach...

mysql - Query to sum two tables -

mysql - Query to sum two tables - query sum 2 tables i have transaction table , payment table. need total amount both on trans table , payment table , must grouping transid. hope can help me right sql statement this. i tried sql below sum of amount on trans table multiplied number of records of same transid on payment table. -> select trans.transid, sum(trans.amount), sum(payment.amount) trans left bring together payment on payment.transid = trans.transid i tried sql below processing time longer compared sql statement above. -> select td.transid, td.amt, pd.paid ( select trans.transid, sum(trans.amount) amt trans grouping trans.transid ) td left bring together ( select payment.transid, sum(payment.amount) paid payment grouping payment.transid ) pd on pd.transid = td.transid trans table transid | amount t1 | 10 t2 | 15 t3 | 12 t4 | 20 t5 ...

java - Libsvm without kernel -

java - Libsvm without kernel - i have searched quite long, haven't found reply question. how can utilize libsvm in java without kernel? or how possible simulate such behaviour? kernels used map info higher dimensional space. if want perform svm in original space of input data, utilize linear kernel. libsvm classifier = new libsvm(); classifier.setkerneltype(new selectedtag(libsvm.kerneltype_linear, libsvm.tags_kerneltype)); java kernel libsvm

java - Does driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS) used only for element search? -

java - Does driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS) used only for element search? - i want know utilize of driver.manage().timeouts().implicitlywait(10000, timeunit.seconds); will used element search or other purpose page load , refresh? i using in begginning of driver initialization. but in application want inspect error message after entering wrong password,but come in wrong password,it leave page , wont wait error message on same page.will initialize/load page once,when utilize thread.sleep(3) stops @ page 3 secs , reading error message. but dont want utilize thread.sleep,since using driver.manage().timeouts().implicitlywait(0, timeunit.seconds) can please tell me utilize , how resolve error? code snippet:(not working,returning failure) (without thread.sleep) settext(webelements.text_box, password); click(webelements.submit_button); //thread.sleep(3000); if (iselementpresent(webelements.error_message)) ...

c# - An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll 430 -

c# - An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll 430 - the da.fill(ds) giving me an unhandled exception of type 'system.invalidoperationexception' occurred in system.data.dll i'm not 100% sure why error here know appeared after attempted login code. using (sqlconnection con = new sqlconnection("data source=c:\\registrationmdb.accdb")) { sqldataadapter da = new sqldataadapter(); dataset ds = new dataset(); sqlcommand cmd = new sqlcommand("select id, password students id = @id or password = @password", con); cmd.commandtype = commandtype.storedprocedure; cmd.parameters.add("@id", sqldbtype.varchar).value = id; cmd.parameters.add("@password", sqldbtype.varchar).value = pw; da.fill(ds); foreach (datarow dr in ds.tables[0].rows) ...

automation - how to handle Windows authentication dialogue using selenium webdriver -

automation - how to handle Windows authentication dialogue using selenium webdriver - i have requirement of opening share point url , looks credential through windows authentication. read utilize autoit seleniun webdriver how can phone call autoit script because web driver script wait until window dialogue off.so cursor not go next line execute autoit script , not able run our script. please help not sure if using java or c#. in c#, go msuia. write method deal windows dialogues , run on separate thread. method should deed listener desktop tree , whenever encounters command needs work on, job. have method scan desktop tree 1 time every 5 seconds or , set sleep if no object found. in java, using autoit should trick, not won't in c# http://www.toolsqa.com/selenium-webdriver/autoit-selenium-webdriver/ selenium-webdriver automation

c++ - Fundamental typedef operand syntax -

c++ - Fundamental typedef operand syntax - given: typedef type-declaration synonym; i can see how: typedef long unsigned int size_t; declares size_t synonym long unsigned int , (know but) can't see exactly how: typedef int (*f)(size_t, size_t); declares f synonym pointer function (size_t, size_t) returning int typedef's 2 operands (type-declaration, synonym) in first illustration long unsigned int , size_t . what 2 arguments typedef in declaration of f or there perhaps overloaded versions of typedef? if there relevant distinction between c , c++ please elaborate otherwise i'm interested in c++ if helps. type declarations using typedef same corresponding variable declarations, typedef prepended. so, int x; // declares variable named 'x' of type 'int' typedef int x; // declares type named 'x' 'int' it's same function pointer types: int(*f)(size_t); // declares variable na...

html - Table and Body with two separate background colors -

html - Table and Body with two separate background colors - hey all, simple question i'm sure, have body of page 1 color , have table in center separate color. tried specifying body color , table color, body overrides it. i'm attempting in css, , have feeling need utilize "not" excluder create happen? such specifying body not:table or along lines of that. absolute beginner here, easy on me. thanks! make sure styles beingness applied table tag. if table not alter colors, css selector wrong. here simple illustration of styles beingness applied body tag. class bg added table tag in markup, pick other colors. see here: http://jsfiddle.net/uegrg/ html css xhtml

jquery - Get json object without JSON.parse? -

jquery - Get json object without JSON.parse? - i found this: use python output: print ‘content-type: text/x-json\n\n’ print json.dumps([{'title':arr['title']}]) and json string jquery: $ajax( success: function(msg){ if(msg[0].title) alert(msg[0].title); } ) it works, can tell me why is? thanks~ jquery calls json.parse internally on modern browsers have if content-type json homecoming window.json && window.json.parse ? window.json.parse( info ) : (new function("return " + data))(); json jquery

iphone - How to disable text-autocorrection for an UITextField or keyboard? -

iphone - How to disable text-autocorrection for an UITextField or keyboard? - this question has reply here: disable auto correction of iphone text field 6 answers i have case autocorrection never makes sense. it's incredibly annoying. can disable uitextfield? with interface builder can disable "correction" in "attributes" tab in inspector. programmaticaly can use uitextfield* textfield = [[uitextfield alloc] init]; textfield.autocorrectiontype = uitextautocorrectiontypeno; iphone uitextfield

javascript - Click event fires on document load Tampermonkey -

javascript - Click event fires on document load Tampermonkey - i'm writing tampermonkey script adds button page , adds onclick event button. have button on page want it, when seek attach click event using "addeventlistener" recommended in related questions click events in user scripts, event handler fires on page load , not when button clicks. var testbutton = document.createelement("button"); testbutton.addeventlistener('click', alert("working"), false); testbutton.id = "testbutton"; testbutton.innerhtml = "this button"; testelement.appendchild(testbutton); basically, when page loads "working" alert fires, not when click button. no console feedback either. missing? that's because you're calling alert on pageload, not on click, wanted anonymous function well var testbutton = document.createelement("button"); testbutton.addeventlistener('click', function() { ...

php - Symfony2: How to set default locale and case insensitive translation -

php - Symfony2: How to set default locale and case insensitive translation - i starting using symfony2 , facing difficulty need helps expert guys. question 1: how set default locale , fallback locale people seek nail www.example.com/home or www.example.com/fr/home (not supported locale) redirect www.example.com/cn/home? i have read lot symfony2 document (http://symfony.com/doc/current/book/translation.html) , searching on google still can't create works. not default locale not working, fallback locale not working. example, when user seek come in www.example.com/fr/home not supported app, supposes redirect user www.example.com/cn/home fails so. i seek clear cache seem not working. question 2: how match translation key in case insensitive? for example, in translation file ("message.cn.yml") contains welcome: 欢迎 so in twig template, utilize {{ 'welcome' | trans }} help me convert 欢迎 when utilize {{ 'welcome' | trans }} not conver...

c - Why this way of copying files isn't working -

c - Why this way of copying files isn't working - i'm writing wrapper help me in future projects (i finished c book), , want re-create file without using fgetc . here's code, doesn't work: int copyfile(char* filename, char* dest) { file* fp, *fout; fp = fopen(filename,"rb"); //fout = fopen(dest, "wb"); if(fp == null) { homecoming -1; } /*while((c = fgetc(fp)) != eof) { fputc(c,fout); }*/ long size = getfilesize(fp); printf("%lu", size); char* file = malloc(size); fread(file, size, 1, fp); //fclose(fp); fout = fopen(dest, "wb"); fwrite(file, size, 1, fout); fclose(fp); fclose(fout); homecoming 0; } i open files hexeditor , aren't similar. doing wrong? the problem in getfilesize function, move file-pointer end, never rewind origin again. that means fread function phone call not read anything, pointer @ end of file. what's written contents of allocated ...

c - How to store a changed variable as the original variable -

c - How to store a changed variable as the original variable - say, wanted know how many times programme has been executed. possible have variable, when programme has been accessed increment variable 1 etc. , store original variable next time executed, can incremented again. e.g. (this not right or real code) /*variable stored*/ int num; /*initial value*/ num = 0; . /*some stuff i'll do*/ /*so num becomes incremented*/ /*please don't rage have done way*/ num = num + 1; ...and somehow store int num . please help me, suggestions welcome. in question, term program little ambiguous. sake of clarity, allow me split question 2 seperate parts. if question regarding possibility below cases, how many times function has been executed? yes, utilize static variable counter. how many times binary has been executed? yes again, cannot achieved using without file i/o. need utilize file i/o write value file 1 time binary has been executed. eac...

python 3.x - Inserting date into URL and Getting currency data for that date -

python 3.x - Inserting date into URL and Getting currency data for that date - i trying write function gathers currency info date https://openexchangerates.org/ , homecoming dicitionary. bit stuck on how insert date in url @ point says yyyy-mm-dd , how onto python. any help hugely appreciated my code have far follows: def _fetch_exrates(date): import json import urllib.request f = urllib.request.urlopen('http://openexchangerates.org/api/historical/yyyy-mm-dd.json?app_id=188bd7b8d2634e4cb0602ab5b3c223e7') charset = f.info().get_param('charset', 'utf8') info = f.read() decoded = json.loads(data.decode(charset)) print(json.dumps(decoded, indent=4)) import datetime print('please year in form of yyyy , month mm , day dd') = int(input('choose year :',)) b = int(input('choose month :',)) c = int(input('choose day :',)) date = datetime.date(a,b,c) print(date) def _fetch_exrates(year,...

LibVLC for android: how to save the playing http stream? -

LibVLC for android: how to save the playing http stream? - investigating java code of lib, found no way save playing video somewhere. however, vlc core has such capabilities, according this doc, can duplicate stream , save it, redirecting right file. i thought supply corresponding arguments while creating instance of lib, tried add together alternative when initializing library in libvlcjni.c that: "--sout=duplicate{dst=standard{access=file,mux=ts,dst=/storage/emulated/0/example.mp4}, dst=display}" but seems it's not working. other ideas? android libvlc

Insert after x node minidom xml python -

Insert after x node minidom xml python - i'm appending node xml, want insert before tags, possible? newnode = xmldoc.createelement("tag2") txt = xmldoc.createtextnode("value2") newnode.appendchild(txt) n.appendchild(newnode) this xml. when append child, add together after unimed, want insert after cantidad , before unimed. (simplified version of xml) "item" can have more childs, , not know how many. <ns0:item> <ns0:cantidad>1</ns0:cantidad> <ns0:unimed>l</ns0:unimed> </ns0:item> i think can solve reading al childs of item, erase them, , add together them in order want. dont think best idea... any ideas? edited solution itemchildnodes = n.childnodes n.insertbefore(newnode, itemchildnodes[itemchildnodes.length-2]) use insertbefore method insert new created tag. demo: >>> xml.dom import minidom >>> content = """ ... <xml> ... ...

sql - i have two table find out only mismatch id -

sql - i have two table find out only mismatch id - table 1: id 1 2 3 5 6 table 2: id 2 3 7 i want mismatch id table 1 result should 1,5,6 . please help on this, in advance. try this: select * table1 id not in (select id table2) sql

web services - How return multiple values with SOAP in Java (javax.jws) -

web services - How return multiple values with SOAP in Java (javax.jws) - i'm using java 8 , eclipse tomcat 8. want write soap web service wich homecoming 3 integer each of them different field name (id, key , value) : <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soapenv:body> <getarrresponse xmlns="http://defaultnamespace"> <id>1</id> <key>1</key> <value>2</value> </getarrresponse> </soapenv:body> </soapenv:envelope> i wrote soap server in java , works : @webservice() public class mywebservice { @webmethod(operationname = "printname") public string printname(@webparam(name = "username") string username) { homecoming "hello " +...

Get a page's average number of posts / day using Facebook API? -

Get a page's average number of posts / day using Facebook API? - i'm trying figure out way calculate facebook page's average number of posts per day using api. problem api not show when page created. instead, i'm downloading posts , using oldest post sort of creation date (which not 100 percent correct...). the problem when page adds backdated posts. instance, might post image in 2012 that's dated 2008. post oldest, if page hasn't existed long. one solution go updated_time field instead of created_time, it's not great solution still may not correct. is there someway around this? sorry if question has come before, couldn't find on it. unfortunately you're looking isn't possible using api. for given post 2 dates returned - created_time , updated_time. as rightly pointed out created_time can updated add together post in past. updated_time not work gets updated whenever comments on post. https://developers.facebook.com/do...

javascript - How to encode ~ caracter to send in POST safely HTTP -

javascript - How to encode ~ caracter to send in POST safely HTTP - i using php post body data=a~b~c i wat this data=a~b~xx~c i want give 3 paramater a,b~xx , c reads a,b,xx,c . how encode it. tried url encode, html encode still fail! have tried %7e or &#126; ? what method using post data? javascript php jquery html sockets

python - How to cache query result in django? -

python - How to cache query result in django? - i trying cache query results on django app. however, seems caching whole app. tried next logi: def cacheview(): result = cache.get('key') if result none: result = model.objects.get(id=1) cache.set('key', 'result') i calling method when user logs in. however, if seek logout after login, keeps me on same page if still logged in. tried follow django documentation on cache @ http://docs.djangoproject.com/en/1.2/topics/cache/ no success. another thing tried if seek utilize cache decorator above view as: @cache_control(max_age=1000) def cacheview(): ... it gives error saying "response header not defined". new django , sure missed something. idea? rtfm :) official django docs: caching , querysets each queryset contains cache, minimize database access. (...) and: in newly created queryset, cache empty. first time queryset evaluated -- and, hence, database qu...

iphone - Is it possible to distribute a populated keychain with an application -

iphone - Is it possible to distribute a populated keychain with an application - i working on application uses private web service. utilize bundled client certificate enable 2-way ssl connectivity password certificate in code , concern de-compiled , used (trivially)extracted certificate file nefarious purposes. is there method can pre-load password application keychain distribution app password never left in open? no matter how set password binary, there someway exploit this, debugging tools, code analysis etc. you improve treat web service open... maybe unlikely not authorized requests in next future, give away access public. keychain should encrypted user specific key, , cannot - or able read everyones info anyway. if need protect it, need user accounts on server... if more secure obscurity you. iphone security keychain

terminal - Subversion: After svn commit how can I exit editor? -

terminal - Subversion: After svn commit how can I exit editor? - hi on mac using subversion via terminal add together file. m point need commit it. editor had opened , cant manage close , go terminal? necessary commands? thanks svn terminal editor commit

ios - Interface Builder Storyboard Error: Extra Content at end of Document -

ios - Interface Builder Storyboard Error: Extra Content at end of Document </document> - trying build ios app i've been working on. app won't build in xcode due interface builder storyboard error. error says following: line 1917: content @ end of document. not know xml i'm not sure means. went ahead , looked @ line 1917 , didn't see out of ordinary. i've pasted code below. ... <fontdescription key="fontdescription" name="avenir-medium" family="avenir" pointsize="17"/> <color key="textcolor" cocoatouchsystemcolor="darktextcolor"/> <nil key="highlightedcolor"/> </label> </subviews> <color key="backgroundcol...

mysql - database design for maintaining customer money detail -

mysql - database design for maintaining customer money detail - i have maintain business relationship balance customer for have create table customer(id,name,address,mobno,balance); balance field store amount. then amount deposited , withdrawl creating table transaction transaction(id,amount,type,adddate); type deposit/withdrawl, adddate timestamp , amount deposited/withdrawl. i performing calculation on amount deposited/withdrawl amount , 1 time again storing balance. with info client (1,'ajay'.'india',23324,400); transaction (1,400,d); balance 400 (2,300,w); balance 100 (3,700,d); balance 800 (4,200,w); balance 600 i facing problem if 1 wants update transaction. (3,500,d); balance 600 //new balance after other info not show proper value. i want know proper way store amount , transaction or there batter way. an after update trigger looks job: create trigger balanceupdate after update on transaction each row begin ...

How does params come into scope in Rails? -

How does params come into scope in Rails? - in illustration code below new user created based on result of calling method user_params . method uses params . how params variable come scope? not prefixed @ symbol nor user_params take argument. class userscontroller < applicationcontroller . . . def create @user = user.new(user_params) if @user.save # handle successful save. else render 'new' end end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end the params instance method of class actioncontroller:: metal . it extended by class actioncontroller::base . ruby-on-rails

mysql - Can I sub query this or not? -

mysql - Can I sub query this or not? - i've been trying query/subquery work stats have failed, started 1 time again scratch. can results want it's still in 2 separate queries. have little no experience sub queries after reasearching, heart tells me should able in 1 query. info in 1 table need utilize 2 separate grouping in order right data. i'm hoping can help me head around or @ to the lowest degree point me in right direction... in advance select month(bookadhistory)-1 monthnum, count(distinct bookidhistory) totalbooks, count(distinct case when bookddchistory = 300 bookidhistory end) breaches bookhistory bring together book on bookid = bookidhistory bookid = 44 grouping month (bookadhistory) order monthnum; select month(historycreated)-1 monthnum, count(distinct case when bookddchistory between 1 , 99 bookidhistory end) delays, count(distinct case when bookddchistory = 200 bookidhistory end) extns, count(distinct case wh...

php - Laravel - moving file causing error -

php - Laravel - moving file causing error - i trying re-create file 1 directory follows: $files = file::allfiles($temp); foreach ($files $f) { $f->move($destination, file::name($f)); } i getting error: call undefined method symfony\component\finder\splfileinfo::move() in next line: $f->move($destination, file::name($f)); it seems not observe $f beingness of type file because every time seek , utilize of functions getclientoriginalname() i error. i maintain getting error. seems not registering $f beingness file.. also thing maintain in mind don't know name of file why of files in directory (only ever 1 @ time) try this: file::get($f) let me know happens. php symfony2 laravel laravel-4

angularjs - Unable to call Angular directive method -

angularjs - Unable to call Angular directive method - i've got angular view thusly: <div ng-include="'components/navbar/navbar.html'" class="ui centered grid" id="navbar" onload="setdropdown()"></div> <div class="sixteen wide centered column full-height ui grid" style="margin-top:160px"> <!-- other stuff --> <import-elements></import-elements> </div> this controlled ui-router, assigning controller, fyi. the controller view looks this: angular.module('pcfapp') .controller('importelementsctrl', function($scope, $http, $location, $stateparams, $timeout, framework, officialframework) { $scope.loadofficialframeworks(); // other stuff here }); the <import-elements> directive, looks this: angular.module('pcfapp').directive('importelements', function($state, $stateparams, $timeout, $window, framework, ...

rest - Is it acceptable to pass json string in the http header to provide options to the server when doing PATCH request? -

rest - Is it acceptable to pass json string in the http header to provide options to the server when doing PATCH request? - in restful service, want allow users update fields of resource patch requests. however, there's requirement when updating fields have perform actions on back-end depending on provided options. don't want mix options primary info in body of request, came 2 possible solutions. pass options via query string pass options via http header json string. since, in cases options can contain relatively big text, decided pass options via http header. has done before? there possible issues can face later? practice @ all? if not, how else can accomplish same? i'd depends on how much of rest purist want be. i'd prefer pass options body, because patch method has defined semantics, no defined info format, so, there's nil preventing sending options in patch body, since have document payload format anyway. if that's not alterna...

django - Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers -

django - Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers - i have 2 separate server,one nginx node,and 1 django django-rest-framework build ding rest api,nginx responsible rest api request,node takes care of client request, utilize polymer frontend .below brief description: machine one: nginx:192.168.239.149:8888 (api listening address) forwards 192.168.239.147:8080 node:192.168.239.149:80 (client listening address) machine two: unicorn:192.168.239.147:8080(listening address) the process when request comes in,node server( 192.168.239.149:80 ) responses homecoming html,in html ajax request inquire api server( nginx:192.168.239.149:8888 forwards unicorn:192.168.239.147:8080 ),and unicorn( 192.168.239.147:8080 ) returns result. but there cors problem,i read lot article,and many people met same questions,i tried many methods,but no help.still error. what : that is: xmlhttprequest cannot load http://192.168.239.149:8888/arti...

c++ cli - Multidimensional array as argument in C++/CLI -

c++ cli - Multidimensional array as argument in C++/CLI - i getting bit desperate. :) there possible way create in c++/cli? it's c# code. void test(int[,] numbers) { ... } more trying create "universal" marshaller (as extension marshal_as ), able convert int[2,2] int** (by copy). something (which one-dimensional array): // cli::array<type> -> type* template <typename tto, typename tfromtype> tto marshal_as(cli::array<tfromtype>^ const from) { ... } multidimensional-array c++-cli

How to automatically set gmail filter via chrome extension? -

How to automatically set gmail filter via chrome extension? - i implement next utilize case chrome extension: user visits gmail exension checks current email body keyword if keyword present, gmail filter added , saved (adding label, archiving, details not of import here) the first part sounds easier: there gmail api work , gmail.js project should create easier. adding filter seems much harder. there email settings api doing exactly want sure usable business accounts (custom email domains, won't work gmail.com). want solution more universal. one thing thought of utilize browser automation - upon seeing trigger keyword, script automatically clicks 'add filter' link, waits ajax, sets filter parameters , confirms. an illustration of simulated user activity in this answer this happen either on gmail page behind popup ('please wait, adjusting filters') or in background tab maintain interfering user's flow. seems ugly workaround me, though. ...

encryption - simple encrypt/decrypt lib in python with private key -

encryption - simple encrypt/decrypt lib in python with private key - is there simple way encrypt/decrypt string key. somthing like: key = '1234' string = 'hello world' encrypted_string = encrypt(key, string) decrypt(key, encrypted_string) i couldn't find simple that. http://www.dlitz.net/software/pycrypto/ should want. taken docs page. >>> crypto.cipher import des >>> obj=des.new('abcdefgh', des.mode_ecb) >>> plain="guido van rossum space alien." >>> len(plain) 34 >>> obj.encrypt(plain) traceback (innermost last): file "<stdin>", line 1, in ? valueerror: strings des must multiple of 8 in length >>> ciph=obj.encrypt(plain+'xxxxxx') >>> ciph '\021,\343nq\214dy\337t\342pa\372\255\311s\210\363,\300j\330\250\312\347\342i\3215w\03561\303dgb/\006' >>> obj.decrypt(ciph) 'guido van rossum space alien.xxxxxx' pyth...

cmd - Loop over an interval of files -

cmd - Loop over an interval of files - i define for-loop (windows command line) iterates on (numbered) intervals of files in directory, 1..100, , 101..200, , 201..300 etc [edit: regardless of files names]. see next pseudo-code: for %workdir% %%f(1..100) in (*.htm) ( rem dosomething %%f ) %workdir% %%f(101..200) in (*.htm) ( rem dosomething %%f ) ...etc q: there way define "numbered intervals" of files command line? // rolf you can place each function in separate file: :1to100 setlocal enabledelayedexpansion set /a "file=1" rem skip 0 (skip=0 omitted because it's illegal) , process 100. /f %%f in ('dir %workdir%\*.htm /b') ( if !file! gtr 100 (exit /b) else (set /a "file+=1") echo %%f. ) endlocal goto :eof :100to200 setlocal enabledelayedexpansion set /a "file=1" rem skip 100 , process 100. /f "skip=100" %%f in ('dir %workdir%\*.htm /b') ( if !file! gtr 100 (exit /b) e...

delphi - How to get sms an event triggered when a sms arrives? Rad studio XE7 Android KitKat -

delphi - How to get sms an event triggered when a sms arrives? Rad studio XE7 Android KitKat - i'm trying understand how event triggered when sms arrives? i installed programme default sms/mms manager. when new message arrives, android show me error message! it's file manifest programm: ... <application android:persistent="%persistent%" android:restoreanyversion="%restoreanyversion%" android:label="%label%" android:installlocation="%installlocation%" android:debuggable="%debuggable%" android:largeheap="%largeheap%" android:icon="%icon%" android:theme="%theme%" android:hardwareaccelerated="%hardwareaccelerated%"> <!-- our activity subclass of built-in nativeactivity framework class. take care of integrating our ndk code. --> <activity android:name="com.embarc...

java - How to add a object to a sorted set that's within a hashmap of objects -

java - How to add a object to a sorted set that's within a hashmap of objects - i'm trying add together passenger object sorted set. sorted set in cruise object. of cruise objects within hashmap. i'm kinda new collections i'm having trouble. effort i'm doing. hashmap<string, cruise> cruisemap = new hashmap<string, cruise>(); sortedset<passenger> passengerset = new treeset<passenger>(); queue<passenger> waitinglist = new linkedlist<passenger>(); cruise cruise = new cruise("1", passengerset, waitinglist, false); cruisemap.put("1", cruise); passenger passenger = new passenger("smith", "j"); cruisemap.get("1").getpassengerset().add(passenger); the passenger's parameters strings lastly name first initial. cruise's parameters string date, sortedset passengers, there's queue waiting list , boolean variable determine if ship has departed. maintain getting tons ...

node.js - Testing Passport Twitter Strategy -

node.js - Testing Passport Twitter Strategy - i'm looking simple way simulate logging in twitter via passport , testing api calls twitter login information. is possible? there easy way? any help awesome! i don't easy can simulate login using http://phantomjs.org/. here node modules integerate phantomjs https://github.com/baudehlo/node-phantom-simple https://github.com/sgentle/phantomjs-node hope helps you. node.js passport.js passport-twitter

Rails 4: Joins vs Includes: Why different results with nested association? -

Rails 4: Joins vs Includes: Why different results with nested association? - in rails 4 app, have 2 models: merchant has_many :offering_specials offeringspecial belongs_to :merchant i want retrieve merchants , special offerings open (with status_code: "op") i tried this: @merchants = merchant.joins(:offering_specials).where(offering_specials: { status_code: "op" }) this query: merchant load (0.4ms) select `merchants`.* `merchants` inner bring together `offering_specials` on `offering_specials`.`merchant_id` = `merchants`.`id` `offering_specials`.`status_code` = 'op' but retrieved offering specials, both open ("op") , pending ("pn"). however, using includes worked: @merchants = merchant.joins(:offering_specials).where(offering_specials: { status_code: "op" }) this retrieved open offering specials. @ much slower query: sql (19.9ms) select `merchants`.`id` t0_r0, `merchants`.`name` t0_r1, `...