Posts

Showing posts from March, 2010

algorithm - Java Tries : Need a better approach -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i new tries , testing how works. right building contact list. add 'prashanth' , 'pradep' trie , when search 'pra' should receive count two. approach having variable size in each node , returning when string of same length found. there unnecessary things/variables payload etc used debugging. problem found when store character , node in hashmap, empty node getting stored. getting 0 answer time. public class tries { public static class node { hashmap<character, node> children = new hashmap<>(); boolean endofword = false; int size =0; int payload = 10; public void setnode(char c, node n) { children.put(c,n); } public node getnode(char c) { return children.get(c); } public void addnode( string s,

java - How to read webserver environment variables using Apache TomEE? -

i planning use shibboleth sso service provider in application, explained here . mentioned, after successful login, user information can "read webserver environment, e.g. $_server['mail'] in php". how accomplish in java tomee? i using apache web server in combination tomcat, such servlet requests forwarded tomcat. possible access apache environment? according documentation of mod_proxy_ajp: environment variables names have prefix ajp_ forwarded origin server ajp request attributes (with ajp_ prefix removed name of key). so assuming configure shibboleth sp decode saml attribute webserver environment variable "mail", in application code can value using request.getattribute("ajp_mail")

android - Realm migration from one app to another app -

i migrating code 1 app another. is possible migrate current realm database new app? there user preferences stored inside realm database such bookmarked page, , html stuff. i wondering possible new app able realm database via sharing same app id?

javascript - Getting nested data from firebase database by "onchildchanged" and "onchildadded" returns something unrecognizable -

Image
screenshot of console displays output i.e. child added in messages directory of 1 of users. , must noticed have displayed short portion of console, console displaying similar output each , every messages. if more screenshots required clarification, please tell me, add them! json code: { "tf42gluiuvbf1ygmx1cseyd6evc3" : { "intents" : { "intentfields" : "", "intentname" : "" }, "messages" : { "-kvivgc7zg051emxp0-5" : { "name" : "ed", "photourl" : "https://cdn1.iconfinder.com/data/icons/user-pictures/100/male3-512.png", "text" : "hello, i'm ed, personal assistant cum friend", "timestamp" : "1476880306" }, "-kw3c8azybp_-bilwmnv" : { "name" : "aakash bansal", "photourl" : "https://lh5.googleusercontent.com/-oqya4hxv

.net - Cannot be opened because its project type (.csproj) is not supported by this version of the application. VS 2008 -

Image
here's files installed related vs 2008 in program , features in control panel. not sure whether vs has been installed ? also application trying open has created in vs 2008 still getting above error.

php - Yii 1.1.13 dies with error 500 after using addError -

i'm working on tool uses yii version 1.1.13 , after addig new error messages adderror method, despite worked fine on page used it, threw strange, long error message on index page error 500 . missing argument 1 cmodel::geterror(), called in /var/www/html/framework/base/ccomponent.php on line 111 , defined (/var/www/html/framework/base/cmodel.php:371) stack trace: #0 /var/www/html/protected/models/testcases.php(132): testcases->__get() #1 /var/www/html/protected/views/site/index.php(189): testcases->search() #2 /var/www/html/framework/web/cbasecontroller.php(126): require() #3 /var/www/html/framework/web/cbasecontroller.php(95): sitecontroller->renderinternal() #4 /var/www/html/framework/web/ccontroller.php(869): sitecontroller->renderfile() #5 /var/www/html/framework/web/ccontroller.php(782): sitecontroller->renderpartial() #6 /var/www/html/protected/controllers/sitecontroller.php(295): sitecontroller->render() #7 /var/www/html/framework/web/actions/cinlinea

Document sharing from google drive demo in android -

please 1 me in demo have created demo https://github.com/googledrive/android-demos i'm not able download file google drive gives message "file not openable"

ios - Xcode8 ld- framework not found -

Image
after migrating swift 3 having problem hockeysdk pod. few hours ago worked unable build it. getting match-o linker error, framework wasn't found. having same issue, when work previous commits, ok. have tried delete derived data , restart system without results.thanks answer! these steps may help: close xcode delete deriveddata open xcode, wait indexing build project

c++ - Client Certificate in fastCGI? -

i have implemented simple fastcgi in c++. server using nginx. have problem when trying implement https in nginx , setting certificate. server certificate have created server certificate , embed nginx config as: ssl_certificate /home/nilav/certificates/ssl/server.crt; ssl_certificate_key /home/nilav/certificates/ssl/server.key; now client certificate not figure out how send client certificate fastcgi nginx. offcourse there way verify client certificate in nginx as: ssl_client_certificate /home/nilav/certificates/ssl/ca.pem; ssl_verify_client on; the client certificate works when installed in browser. want certificate send code code hits request , act client. not figure out how send client certificate fastcgi code in c++. below code: #include <stdlib.h> #include <stdio.h> #include <sstream> #include <iostream> #include <string> #include "string.h" #include "fcgio.h" #include <fcgi_stdio.h>

powershell - How to determine a command output object? -

i understand concept of pipeline , fact powershell returns objects (as opposed text) , commands further down pipeline can access properties of these objects name or value. what i'm struggling - how can find out object (and properties) returned specific powershell command? example, following valid powershell command: get-azurevm -name "vmname" | select-object name,instancesize,location how know, without running it, get-azurevm returns object has name, instancesize , location properties? without running use get-command cmdlet , query outputtype property @ least return object type. otherwise can pipe get-member cmdlet retrieve available properties , methods way recommend you. get-azurevm -name "vmname" | get-member

python - Django View with ForeignKey model -

i've got following in models.py: class articlecategory(models.model): category_name = models.charfield("category", max_length=200, unique=true) slug = models.slugfield(null=true, blank=true, unique=true) def get_data(self): return { "id": self.pk, "category_name": self.category_name, "slug": self.slug, } class article(models.model): category = models.foreignkey(articlecategory) ... def get_data(self): return { "id": self.pk, ... } views.py: def articles(request, *args, **kwargs): context = { 'categories': articlecategory.objects.all(), 'articles': article.objects.filter(category__id=2) } return render(request, 'wellness.html', context) and works fine. however, want category__id dynamic, i'm changing function def articles(request, id, *args, **kwargs

r - Creating a function to replace NAs in the column that calculate the session -

i have data frame, sample dataframe below: #sample data frame clientid actual_time session 1 2016-11-01 00:00:00 1 2 2016-11-01 00:05:00 1 3 2016-11-01 00:35:01 2 4 2016-11-01 00:40:00 na 5 2016-11-01 01:10:01 na 6 b 2016-11-01 01:00:00 1 7 b 2016-11-01 01:05:00 1 8 b 2016-11-01 01:30:00 1 9 b 2016-11-01 01:40:00 1 10 b 2016-11-01 01:50:00 na 11 c 2016-11-01 02:00:00 na 12 c 2016-11-01 02:35:00 na 13 c 2016-11-01 04:35:00 na i fill nas in column ’session’ values logic defined as: for same “clientid”, if time difference between 2 subsequent row >= 30 minutes, newer row in new session (which equals session of older row plus 1); if time difference between 2 subsequent row < 30 minutes, both row in same session same session number. the session number cumulative number starting 1, i.e., new clientid, session number

c# - “There is already an object named 'temp_Students_636136759476987970' in the database.” -

getting error “there object named 'temp_students_636136759476987970' in database.” in entity framework(6.2). these tables automatically created , causing error. why table created ef , why not dropped automatically. i´ve found links may you: there object named in database , entity framework automatic migrations existing database .. in general bugfinder said: guess you´ve deleted/edited table manually, causes error. i dont had error before, had different ones. if delete class , create again same name, can happen, vs can´t create name. if delete folder of class @ storage, error wan´t come again. to find source of ef-objects can harder.. if able find source of either object, or creation of object, there possibility rid of error. bst rgrds

javascript - Hide "null" result -

i've working searching function embedded html website search informations on sharepoint site. working when have result without "description", result show "null". so, want hide null value :) , don't know how can that. here function search/result : <script> function searchlistener(text){ var count = 0; $(".result").empty(); var queryget = "my url"; $.ajax({ url: queryget, method: "get", headers: { "accept": "application/json; odata=verbose" }, success: onquerysuccess, error: onqueryerror }); function onquerysuccess(data) { var results = data.d.query.primaryqueryresult.relevantresults.table.rows.results; var title,url, index, id, desc; console.log(results); $.each(results, function () { $.each(this.cells.results, function () { if(this.key == "title"){

sql - How to get data from postgresql json array field -

i have table field jsonb type , having below data. {"roles": ["7", "73", "163"]} i have check "73" present or not postgresql. i have search gives solution object of object not object of array. i have tried below query not work select * table field->'roles' ? array ['73']; --updated-- also need record have exact value {"roles": ["7"]} {"roles": ["7", "73", "163"]} i.e. field have "7" not else in it. by documentation https://www.postgresql.org/docs/current/static/functions-json.html#functions-jsonb-op-table cases: does –single– key exists in json array: select * table field -> 'roles' ? '73'; does -any- of keys @ right exists in json array: select * table field -> 'roles' ?| array[ '7', '163' ] ; does -all- of keys @ right exists in left json ar

anychart - How to change slider range on chart load -

Image
i working on anychart investment portfolio dashboard anychart investment portfolio dashboard . how can minimize date range of slider 1 month only(on chart load) , should resizable. use selectrange method: you can specify given dates: http://playground.anychart.com/api/7.12.0/charts/anychart.charts.stock.selectrange-plain specify interval start or end using anchors : http://playground.anychart.com/api/7.12.0/charts/anychart.charts.stock.selectrange_set_asunit-plain or use preset range types : http://playground.anychart.com/api/7.12.0/charts/anychart.charts.stock.selectrange_set_as_type-plain easy sample showing "one month only": chart.selectrange("mtd"); is here: http://jsfiddle.net/97kc1jpw/ as sample itself, decided idea upgrade it, use latest version , add option describe right in it, along new nice range selector, please pull latest changes https://github.com/anychart-solutions/investment-portfolio-dashboard you interested in

ElasticSearch 5.0 - NEST - how to combine AND and OR statements -

i trying write nest statement in .net create dynamically match query elastic db multiple fields (and multiple queries inside specific field) so need kind of container can add him match query (might , or or match query) , @ end send whole build query elastic client. i using elasticsearch 5.0 thank in advance

jdbc - Jasperstarter: Unable to load driver -

i using jasperstarter 3.0.0 in linux follows: sudo /home/name/jasperstarter/bin/jasperstarter pr prueba_1.jrxml -f pdf -t generic --db-url jdbc:sqlite:/home/name/data/basename.sqlite --db-driver /home/name/jasperstarter/jdbc/sqlitejdbc-v056.jar i running folder have report (prueba_1.jrxml), error message: unable load driver: /home/name/jasperstarter/jdbc/sqlitejdbc-v056.jar what see in posts must have drivers in jdbc file, , have it. i check path of driver , written. time ago same command working (with same files etc.), not now. thing changed definition of path of java in etc/profile, because wrong. now when typing echo $java_home , echo $path ok: pointing last java folder (jre1.8.0.101) could tell me doing wrong? effectively, matter of writting class name of driver, not path. i did , error dissapeared thank asnwers!!

c# - LUIS Bot framework won't call Intent from external call -

Image
i implemented external login bot. when external site calls bot callback method need set token , username in privateconversationdata , resume chat message "welcome [username]!" . to display message send messageactivity activity never connects chat , won't fire appropriate [luisintent("userisauthenticated")] . other intents, out of login-flow, works expected. this callback method: public class oauthcallbackcontroller : apicontroller { [httpget] [route("api/oauthcallback")] public async task oauthcallback([fromuri] string userid, [fromuri] string botid, [fromuri] string conversationid, [fromuri] string channelid, [fromuri] string serviceurl, [fromuri] string locale, [fromuri] cancellationtoken cancellationtoken, [fromuri] string accesstoken, [fromuri] string username) { var resumptioncookie = new resumptioncookie(tokendecoder(userid), tokendecoder(botid), tokendecoder(conversationid), chann

php - htaccess rewrite rule for loading image from another domain -

i developing multidomian admin panel in laravel. domians on same server. upload images specific domain inside admin panel example.com image: example.com/uploads/domainname/image.jpg now inside domainname.com want use <img src="domainname.com/uploads/image.jpg" > instead of <img src="example.com/uploads/domainname/image.jpg" > approach using have controller responsible getting image content domainname.com/image?path=uploads/domainname/image.jpg and using htaccess aliasmatch "^/uploads/$" "/home/dir/public_html/example/public/uploads/$1" rewriterule ^uploads/(.*)$ image?path=uploads/domainname/$1 but it's not working. appreciated. thanks

retrieve values of rows (from Postgresql) in a list in java -

i used hashmap handling resultset queried postgresql using code suggested rht public list resultsettoarraylist(resultset rs) throws sqlexception{ resultsetmetadata md = rs.getmetadata(); int columns = md.getcolumncount(); arraylist list = new arraylist(50); while (rs.next()){ hashmap row = new hashmap(columns); for(int i=1; i<=columns; ++i){ row.put(md.getcolumnname(i), rs.getobject(i)); } list.add(row); } return list; } i did beacuse wanted shuffle collection afterwards. now each row that: {owner=22172613@n07, count=2} i not know how can for/each loop retrieve each owner id , corresponding number !! so have arraylist each element of hashmap contains in key column names of results , in values values of columns. a loop following: //call method resultsettoarraylist here list<map> list = (list<map>) resultsettoarraylist(rs); //loop list for(map r

Javascript sort array using two keys -

hi working on chat application, want sort new messages plus keeping history order according time. for example, have chat messages in array this [{"user":"a", "msg":"hi ", "msg_count":1, "unix_time":"1474476800000"} {"user":"b", "msg":"hi ", "msg_count":1, "unix_time":"1478776800000"} {"user":"c", "msg":"hi ", "msg_count":5, "unix_time":"1479276800000"} {"user":"d", "msg":"hi ", "msg_count":1, "unix_time":"1478416800000"} {"user":"e", "msg":"hi ", "msg_count":3, "unix_time":"1478476800000"}] how can sort them using "msg_count" key greater values should come on top remaining objects should sorted "unix_time" key.

javascript - Arrays and Objects In Prototypes - Not Treated as References -

i have prototype object in javascript, when initialise new instance of prototype , update properties in prototype, updates elements. understand arrays , objects passed reference , wondering of solution around this? let test = function () {} test.prototype = { array: [], add: function (value) { this.array.push(value) } } let test1 = new test(); let test2 = new test(); test1.add(1); test1.add(2); // prints [1, 2] console.log(test2.array); one solution be: class test { constructor() { this.array = [] } add(value) { this.array.push(value) } } let test1 = new test(); let test2 = new test(); test1.add(1); test1.add(2); // prints [] console.log(test2.array); but not looking es6 approach, more "native" javascript. thanks help! that's thing: are treated references. when this: test.prototype = { array: [], // <- creates new array , it's being used in instances add: function (valu

node.js - How to stream mp4 file with fluent-ffmpeg? -

i trying stream video file fluent-ffmpeg. could't it. here code var filepath = null; filepath = "video.mp4"; var stat = fs.statsync(filepath); var range = req.headers.range; var parts = range.replace(/bytes=/, "").split("-"); var partialstart = parts[0]; var partialend = parts[1]; var start = parseint(partialstart, 10); var end = partialend ? parseint(partialend, 10) : total-1; var chunksize = (end-start)+1; var file = fs.createreadstream(filepath, {start: start, end: end}); res.writehead(206, { 'content-range ': 'bytes ' + start + '-' + end + '/' + total, 'accept-ranges' : 'bytes', 'content-length' : chunksize, 'content-type' : 'video/mp4' }); ffmpeg(file) .videocodec('libx264') .withaudiocodec('aac') .format('mp4') .videofilters({ filter: 'drawtext', options: { fontsize:20, fontfile: 'pub

c# - Updating values in gridview is not working -

there row in gridview in there column name poa_no value 899 . but deleting value , updating blank. still getting updated 899 only. here code protected void grddetail_updatecommand(object sender, gridrecordeventargs e) { if (session["viewinfo"] != null) { dtviewinfo = (datatable)session["viewinfo"]; } else { return; } datarow[] drviewinfo = dtviewinfo.select("sr_no = " + e.record["sr_no"]); if (e.record["type"] != "") { drviewinfo[0]["type"] = e.record["type"]; } else { drviewinfo[0]["type"] = "null"; } if (e.record["ref_no"] != "") { drviewinfo[0]["ref_no"] = e.record["ref_no"]; } if (e.record["ref_date"] != "") { drviewinfo[0]["ref_date"] = e.record["ref_date"]; } if

sqlite - How to secure android database file? -

i have problem. using xyz.db file , stored in asset folder. copying data xyz.db application db stored in data/data/com.xyz/abc.sqlite in storage folder. want secure asset's xyz.db file. because can extract apk reverse engineering. please me secure asset folder's database file. you can perform following make relatively difficult access data in db. password protected zip file contain db @ runtime should extracted. encrypt file symmetric key , again @ runtime decrypt it. utilize sqlcipher performs encryption data @ rest. in both above cases need worry storing password or key. there no sure shot way protect file above require more effort , should added basic protection.

javascript - Number.toLocaleString() with custom separators -

i need format number in javascript separators may defined @ runtime. the combination of thousand , decimal separator may not match specific locale. is there way provide thousand , decimal separator in javascript tolocalestring() ? or use numberformat explicitly values define? i see examples using locale codes, , using other values ( https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/number/tolocalestring ) these don't cover use case. one option format string known separators, , find/replace unknown separators. function formatnum(num, separator, fraction) { var str = num.tolocalestring('en-us'); str = str.replace(/\./, fraction); str = str.replace(/,/g, separator); return str; } formatnum(12342.2, "a", "x"); //12a342x2

javascript - Set cookie while loading remote js in the domain where js is hosted -

below scenario looking at: i remotely loading js file site hello.com . the js loaded jsfoo.com . i want set cookie domain jsfoo.com in users browser when user visiting hello.com ? is possible within js file loaded or have write server side logic when loading js? the objective retarget user visited hello.com when user vists jsfoo.com later. update based on comment below: possible if js loaded dynamically? example if load js via dynamic url jsfoo.com/getjs.php?js=sample.js. wouldn't possible code set , cookies jsfoo.com via php code? the js code executed under domain, can not set cookie client-side. possible if script resource loaded other domain sets cookie domain via http response header. and won’t able access cookie of jsfoo.com in hello.com. if need existing value, script on jsfoo needs read when request domain happens, , return value in way js can read (f.e. outputting js variable.)

git - can not execute arc diff, can not comprehend error -

Image
i'm new arc diff. , cannot find error code or solution anywhere. has else faced it? have configured arc wrong? let me know if more info required. the problem php, had older version. though arcanist site said supported version had, couldn't execute arc diff command, works fine after getting latest php version.

objective c - iOS Unable to play custom sound for remote notifications -

Image
i have been trying implement custom sound notifications on ios. according apple's documentation in example 3 here . need ensure push notification payload should like: { "aps" : { "alert" : "you got emails.", "badge" : 9, "sound" : "bingbong.aiff" } } and bingbong.aiff has placed in application bundle. also if app in active state advised add following code: - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { if (application.applicationstate == uiapplicationstateactive) { nsstring *path = [[nsbundle mainbundle] pathforresource:@"bingbong" oftype:@"aiff"]; theaudio = [[avaudioplayer alloc] initwithcontentsofurl:[nsurl fileurlwithpath:path]error:null]; theaudio.delegate = self; [theaudio play]; } } "bingbong.aiff" placed in "supportingfiles" i s

bluetooth lowenergy - Develop Android App With Smart Bracelet -

i studying possibility of developing android app using "fitness smart bracelet", want access data device etc. the problem find smart bracelet not provide open api or sdk developing purposes. brief of found till now: fitbit , jawbonew provide sdk find devices spensive, sme happens microsoft device we found resources developing using mi band bracelet these libraries not official , developed third party sources, despite of see people have published apps using these methods, totally legal? another option in touch bracelet manufacturer , check if interested in provide device meet our requirements , provide appropriate sdk achieve our purposes, not seems n easy task, know company can provide these kind of service. we checked out in alibaba there lot of devices have sdk not find more information them, have experience these suppose sdk?? last question found official resources access bluetooth low energy devices link: https://newcircle.com/s/post/1553/bluetooth_smart_le

java - Should single thread scheduled executor be used to schedule two tasks with different delays? -

in java program call executors.newsinglethreadscheduledexecutor(); create executor subsequently use schedule 2 tasks. these tasks have different fixed delays, this: executor.schedulewithfixeddelay(task1, 0, 5000, timeunit.milliseconds); executor.schedulewithfixeddelay(task2, 0, 100000, timeunit.milliseconds); i tested portion of program smaller delays , worked expected. in production, however, stops after day, after week or without logging exceptions. on safe side , following advice given in related questions enclosed both tasks in try { dostuff(); } catch (throwable th) { logstuff(); } the problem remained , checked if logging configured correctly. was. in documentation of newsinglethreadscheduledexecutor() method mentioned that tasks guaranteed execute sequentially, , no more 1 task active @ given time. this suits me , don't understand why program exits without visible problems. is type of executor suitable mentioned scenario? the

Index Seek vs Index Scan in SQL Server -

Image
please explain difference between index scan , index seek in ms sql server sample example, since helpful know, what's real use of it. in advance. here text showplan (slightly edited brevity) query using scan: |–table scan(object:([orders]), where:([orderkey]=(2))) the following figure illustrates scan: here text showplan same query using seek: |–index seek(object:([orders].[okey_idx]), seek:([orderkey]=(2)) ordered forward) have on sql server plans : difference between index scan / index seek

ios - Swift3 - '[String : AnyObject]' is not convertible to '[HTTPCookiePropertyKey : Any]' -

i'm new swift , have taken on project written in swift 2.2 xcode 7.4. converting xcode 8 , swift3 , have single compiler error left. please fix this. '[string : anyobject]' not convertible '[httpcookiepropertykey : any]' here offending line of code. let cookie = httpcookie(properties: dict as! [string : anyobject] as! [httpcookiepropertykey : any]) would fix it? let cookie = httpcookie(properties: dict as! [httpcookiepropertykey : any]) anyobject has been replaced any in swift 3 unspecified dictionary values. since httpcookiepropertykey type alias of (ns)string can cast type directly let cookie = httpcookie(properties: dict as! [httpcookiepropertykey : any]) maybe let cookie = httpcookie(properties: dict) could work.

transform - CSS error, "Invalid Property Value" -

Image
in css, error, "invalid property value" when inspect transform element of service section of wall street theme. can please me steps correct it? you can safely ignore "invalid property value" errors in css when you're using vendor specific prefixes since validation of these values not accurate. note you're rotating 360deg, doesn't :)

android - SkImageDecoder::Factory returned null with Glide -

i trying load images glide, skimagedecoder::factory returned null error, can wrong here? on screen looks have small white squares instead of pictures. edit private giphygifdata getgif(string jsondata) throws jsonexception { log.e("josn",jsondata); jsonobject giphy = new jsonobject(jsondata); jsonarray datalist = giphy.getjsonarray("data"); list.clear(); (int i=0;i<datalist.length();i++) { log.e("url",datalist.getjsonobject(i).getstring("url")); list.add(datalist.getjsonobject(i).getstring("url")); } giphygifdata gif = new giphygifdata(); gif.seturllist(list); log.i(tag, "gif json data - gif url: " + gif); return gif; } public class myrvadapter extends recyclerview.adapter<myrvadapter.myviewholder> { private context context; arraylist<string> urllist; @override public myrva

javascript - Only detect click event on pseudo-element -

my code is: p { position: relative; background-color: blue; } p:before { content: ''; position: absolute; left:100%; width: 10px; height: 100%; background-color: red; } please see fiddle: http://jsfiddle.net/zww3z/5/ i trigger click event on pseudo-element (the red bit). is, don't want click event triggered on blue bit. this not possible; pseudo-elements not part of dom @ can't bind events directly them, can bind parent elements. if must have click handler on red region only, have make child element, span , place right after opening <p> tag, apply styles p span instead of p:before , , bind it.

Retrieving a value from a SOAP response (Java) -

i have following soap response: <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> <ns0:helpdesk_querylist_serviceresponse xmlns:ns0="urn:nn:hpoo:hpd_incidentinterface_ws"> <ns0:getlistvalues> <ns0:incident_number>itinc0003968505</ns0:incident_number> </ns0:getlistvalues> </ns0:helpdesk_querylist_serviceresponse> </soapenv:body> </soapenv:envelope> how retrieve , store string ns0:incident_number? <ns0:incident_number>itinc0003968505</ns0:incident_number> i began creating message, attempting replicate xml structure of response above: // create soap message messagefactory messagefactory2 = messagefactory.newinstance(); soapmessage soapmessage2 = messagefac

matlab - finding a comma in string -

[23567,0,0,0,0,0] , other value [452221,0,0,0,0,0] , value should contineously displaying 100 values , want display sensor value in first sample 23567 , in second sample 452221 , these values have display . have written code value = str2double(str(2:7)); see here attempt i want find comma in output , display value before first comma as proposed in comment excaza, matlab has dedicated functions, such sscanf such purposes. sscanf(str,'[%d') which matches ignores first [ , , returns next (i.e. first) number double variable, , not string. still, idea of using regular expressions match numbers. instead of matching zeros , commas, , replacing them '' proposed sardar_usama, suggest directly matching numbers using regexp . you can return numbers in str (still string!) with nums = regexp(str,'\d*','match') and convert first number double variable with str2double(nums{1}) to match first number in str , can use regexp nums =

ajax - Django acts like user is logged in but isn't -

i have ajax login in django project. ajax_login view gets post, authenticate user , returns jsonresponse . seems work correct user isn't logged in. the weird in view, i'm testing whether user logged in , are. view @csrf_exempt def ajax_login_(request): username = request.post.get('username') password = request.post.get('password') user = authenticate(username=username,password=password) if user: if user.is_authenticated(): print 'is logged in' #this being printed console user logged in return jsonresponse({'status':0}) return jsonresponse({'status':1}) ajax $(document).ready(function () { $('.login-form').find('.submitbutton').click(function (e) { var next = $(this).closest('.login-form').find('input[name="next"]').val(); var password = $(this).closest('.login-form').find('#id_password').val(

Why does this simple python program not work? -

class f: 'test' def __init__(self, line, name, file, writef): self.line = line self.name = name self.file = file def scan(self): open("logfile.log") search: #ignore part line in search: line = line.rstrip(); # remove '\n' @ end of line if num == line: self.writef = line def write(self): #this part not working self.file = open('out.txt', 'w'); self.file.write('lines note:'); self.file.close; print('hello world'); debug = f; debug.write it executes no errors nothing, tried many ways, searched online 1 issue. indentation part of python syntax, you'll need develop habbit of being consistent it. methods class methods, need indented such anyway, here's modified version of script have ran, , works. class f: 'test' def __init__(self, line, name, file, writef): self.line = line self.nam

c# - Bot Framework - Botstate between Dialogs loses values -

i'm trying pass state between different dialogs, , seem either a) not calling dialogs correctly or b) not using botstate correctly (or both). can tell me losing when open second dialog? opened using context.forward(); in messagescontroller able set state; stateclient stateclient = activity.getstateclient(); botdata userdata = await stateclient.botstate.getuserdataasync(activity.channelid, activity.from.id); userdata.setproperty<bool>("sessionactive", true); await stateclient.botstate.setuserdataasync(activity.channelid, activity.from.id, userdata); i open dialog controls access other dialogs; await conversation.sendasync(activity, () => new dialogcontroller()); this separate class; public class dialogcontroller : idialog<object> within dialog can access value set 'true' - works; stateclient stateclient = new stateclient(new uri(message.serviceurl)); botdata userdata = await stateclient.botstate.getuserdataasync(message.channeli

How to read uploaded xml file using javascript? -

i want read uploading xml file , show in textarea client-side. facing problem in javascript code using string variable instead of url. not correct way use url? if not how can use it? of query have found using fixed file url file can changed. here code: function filltextarea() { var text = document.getelementbyid("connectionname").value; document.getelementbyid("recentdevices").value += text + '\n'; var filename = $('input[type=file]').val().split('\\').pop(); var xml = new xmlhttprequest(); xml.open('get', filename, false); xml.send(); var xmldata = xml.responsexml; document.getelementbyid("xmlfileinfo").value += xmldata; } <div class="row"> <div class="col-md-6"> <div class="input-group"> <div class="input-group"> <span class="input-group-addon" id=&quo

ios - AVPlayerItem from URL not playing -

i'm trying play mp3 data file downloaded alamofire. song fine, can play avaudioplayer(data: data). how should play same data file avplayer? not find how create playeritem data or avasset data. also, i've url song path, url not work avplayer somehow. music not playing. func startsong(withindex: int) { if let item = getitem(atindex: withindex) { { try avaudiosession.sharedinstance().setcategory(avaudiosessioncategoryplayback) print("avaudiosession category playback ok") { try avaudiosession.sharedinstance().setactive(true) print("avaudiosession active") } catch let error nserror { print(error.localizeddescription) } let playeritem = item self.player = avplayer(playeritem: playeritem) } catch let error nserror { print(error.localizeddescription) } } } func getitem(atindex: int) -&