Posts

Showing posts from June, 2015

Trouble with Google Maps Javascript API -

i new javascript , website, please bear me (and english) doing draft hsc project, project using google maps javascript api show location of area. unable find code disable sensor, old api thing had in it, instead of 'callback', disable user of website ability move map around. here able me issue? code using google's sample code. (i have not changed default location keep privacy) <!doctype html> <html> <head> <title>simple map</title> <meta name="viewport" content="initial-scale=1.0"> <meta charset="utf-8"> <style> html, body { height: 100%; margin: 0; padding: 0; } #map { height: 100%; } </style> </head> <body> <div id="map"></div> <script> var map; function initmap() { map = new google.maps.map(document.getele

Can we force a c# compiler to run constructor first? -

as c# field initializers run before constructor . there way force compiler run constructor first? thanks @jonathan, need know, why? no. if reason care order, initialize fields in constructor. caring order of initialization seems code smell .

ios - Setting UICollectionView frame at runtime -

i trying set frame of uicollectionview @ runtime. i tried using maincollectionview.frame = cgrect(x: 20, y: 20, width: self.view.frame.width-20, height: self.view.frame.width-20) in viewdidload unfortunately stay in ib . not yet using constraints . otherwise resizing cells working in cellforitem : collectioncell.frame.size.width = self.view.frame.width/8 * 3 try set frame in viewdidlayoutsubviews

android - Refreshing RecyclerView in a Fragment -

in fragment have refresh() method loads recyclerview in particular fragment after fetching data server using asyncdataclass extends asynctask . , in recycleview adapter using contextmenu calling test function of fragment responsible executing asyncdeleteclass extends asynctask deletes particular item remote server database. problem calling refresh() method in postexecute method of asyncdeleteclass gets delete confirmation.but recyclerview not refreshing if particular item deleted. oncreateview , reshdisplay() : public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { /* allow activity show indeterminate progress-bar */ view = inflater.inflate(r.layout.user_plcaes_card_list,container,false); ctx=inflater.getcontext(); //get calling activity call function mainactivity activity = (mainactivity) getactivity(); user_id = activity.getuserid(); // toast.maketext(activity,user_id,toast.length_long).show()

MS-Access 2007 query run-time error -

i have ms-query causes problem @ run-time error # 3071 message long, here begining: the expression typed incorrectly, or complex evaluated. the query has many columns , functions, , trial , error have isolated offending part of query be: ... , [component.serial])>=val(([forms]![frm_rptfilter_components].[fldautoseq])) , ([component.serial])<=val(([forms]![frm_rptfilter_components].[fldautoseq2]))) the name: frm_rptfilter_components correct name of form input comes , name: fldautoseq, fldautoseq2 names of fields on form. the expression forms... correct , used in other parts of query. spelling not problem. the column in database "serial" , integer. being compared form field (text field). i can execute offending part in: select * component (( [component.serial])>=val(([forms]![frm_rptfilter_components].[fldautoseq])) , ([component.serial])<=val(([forms]![frm_rptfilter_components].[fldautoseq2]))) so, confused. had offending p

How to implement basic authentication on github pages created by slate -

i created documentation site using slate , deployed on github pages. became public because github pages public. wondering if there way add basic authentication on github page? team can see documentation. any suggestions/hints appreciated! no, there isn't. github pages provide basic static hosting. all. there no (server side) dynamic options @ all.

angularjs - How to get date and time separtely -

this question has answer here: separate date , time 2 answers i'm beginner of angularjs. need half value input. this code. i'm using datetime-picker <input class="form-control" placeholder="choose date , time" name="datetime" value="datetime" ng-model="date3.data" datetime-picker date-format="yyyy-mm-dd hh:mm:ss" close-on-select="false" /> now 2016-06-29 12:14:00 i need separate date , time -like date = 2016-06-20 , time = 12:14:00 just use split method in string t = "2016-06-29 12:14:00" var = t.split(" "); var date = a[0]; var time = a[1];

php - How to Scrape all Url data with a same time..? -

<?php $send=$_get['send']; $delv=$_get['delv']; $weight=$_get['weight']; $postdata ='{"collectioncountry": '.$send.' ,"collectionpostcode":null,"collectiontown":null,"deliverycountry": '.$delv.' ,"deliverypostcode":null,"deliverytown":null,"requirescommercialinvoice":false,"collectiondate":null,"quotevalue":null,"parcels":[{"weight":'.$weight.',"length":null,"width":null,"height":null}],"columns":[{"header":"next day delivery","template":"grid_results_column","endpoint":"/quotes/api/results/column?deliverytimes=1","description":null,"feature":null,"includetags":[],"excludetags":[],"hasresults":true,"loading":true},{"header":"2 day delivery&qu

python - n_jobs don't work in sklearn-classes -

does use "n_jobs" of sklearn-classes? work sklearn in anaconda 3.4 64 bit. spyder version 2.3.8. script can't finish execution after setting "n_jobs" parameter of sklearn-class non-zero value.why happening? several scikit-learn tools such gridsearchcv , cross_val_score rely internally on python’s multiprocessing module parallelize execution onto several python processes passing n_jobs > 1 argument. taken sklearn documentation: the problem python multiprocessing fork system call without following exec system call performance reasons. many libraries (some versions of) accelerate / veclib under osx, (some versions of) mkl, openmp runtime of gcc, nvidia’s cuda (and many others), manage own internal thread pool. upon call fork, thread pool state in child process corrupted: thread pool believes has many threads while main thread state has been forked. possible change libraries make them detect when fork happens , reinitialize thr

html - Animate.css transition only when website loads -

for transitions on 1 of websites use animated.css. works fine except when apply transition on navbar, every time change page (clicking item on navbar), transition runs again. i run transition when website loads/reloads. not when change page. is there way accomplish plain css? or need implement javascript code? snippet of code: <div class="col-xs-6 col-xs-offset-3 col-sm-2 col-sm-offset-1"> <header id="masthead" class="site-header" role="banner"> <div class="top-header animated fadeindown"> <nav class="navbar navbar-primary" role="navigation" id="navigation"> //... </nav> </div> </header> </div> you can use session-only cookie in javascript. include following script @ bottom of page: <script> if (document.cookie.indexof('siteloaded=loaded') < 0) { [... act

unix - Basename command in shell script -

i trying run following part of application start script: for file in $template_folder/* filename='basename $file' echo "processing $filename" if [ -f "$conf_folder/$filename" ] echo "using existing $filename" else echo "creating $filename template $file" cp $file $conf_folder fi done but output is: processing basename $file creating basename $file template ../conf/templates/conf-test/log4j.xml the basename command not evaluated , printed out. when run command prompt works fine. bash version: bash -version gnu bash, version 3.00.16(1)-release (sparc-sun-solaris2.10) copyright (c) 2004 free software foundation, inc. can see doing wrong? thanks! since system has bash , , script works bash , first change line #1 of script #!/bin/sh #!/bin/bash . then change line: filename='basename $file' to this: filename=`basename $file`

android - Change position of Play video on item click in ListView -

Image
i have listview, contain number of videos when click on item, video playing when scroll or down video become stop, referred https://github.com/danylovolokh/videoplayermanager working fine when click on item not 100 percent visible on screen this: at time below item video playing, this: i checked position in log when click on item getting right position in log, can do? please guys solve it. faced issue many days my code below: public class playvideo extends activity { private activity mactivity; private static final boolean show_logs = config.show_logs; private static final string tag = playvideo.class.getsimplename(); private arraylist<basevideoitem> mlist = new arraylist<>(); private string videoid = ""; public static int isvideoplay = 0; public static progressdialog pdialog; private final listitemsvisibilitycalculator mlistitemvisibilitycalculator = new singlelistviewit

Ceilometer independently **WITHOUT OpenStack** -

i use ceilometer independently without openstack usage data vmware vsphere installation. can please guide me on this. ceilometer designed openstack , don't think fit usecase.

windows - Automate rename of .rdf files to .XML -

i have requirement rename .rdf files (report definition file) .xml , trying automate i'm having hundreds of files. actual purpose of exercise identify if there files generate error while converting .xml , list of files. i'm thinking of writing .bat file this. if has done similar thing or have idea kindly share me. thanks in advance. if want rename rdf files xml using bat, can use rename command. rdf not need converting xml, because xml---just different file name. from command prompt type rename /? see options. this command renames rdf xml in current directory: rename *.rdf *.xml to output errors of bat file log file, has been covered here: how capture stderr on windows/dos?

Creating a redirect from a different domain on the correct server with web.config -

i have created new site on new domain – have no control on old domain, former host has been kind change dns points correct ip. as set now, old url shows correct content, uri not change want to. unusual thing in case old url subdomain of domain still in use (but have 0 control over, 301 redirect there impractical). more concretely, http://subdomain.olddomain.com/ reaches correct ip , shows correct content, there on want redirect http://newdomain.com/ for content redirecting traffic root of new site, might specific page redirects later on. i've tried variations of in web.config: <httpredirect enabled="true" exactdestination="true" httpresponsestatus="found"> <add wildcard="^subomain.olddomain.com" destination="http://newdomain.com/" /> </httpredirect> i hoping work, unfortunately nothing. if change wildcard *default.htm , redirect, imagine it's not wrong. i prefer avoid messing iis etc. w

Android - Button behind seekbar -

how can if want click on button , button behind seekbar ? the use case is: have custom seekbar width=match_parent , thumb of seekbar rectagle height=300dp , width=10dp . have buttons behind seekbar, , want click on them. example image update: solved using onintercepttouchevent , dispatchtouchevent give seekbar id, in button do android:layout_below="@+id/yourseekbarid" it can else below.

go - How to make Sublime text build execute on numpad enter? -

i use gosublime inside sublime text golang development. pressing ctrl + b gives me build pane, need type command e.g., go run main.go , press enter . when want execute command using numpad enter doesn't work. how make work numpad enter too? i checked default keymap in sublime text provides following key bindings build tool { "keys": ["f7"], "command": "build" }, { "keys": ["ctrl+b"], "command": "build" }, { "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true} }, { "keys": ["ctrl+break"], "command": "exec", "args": {"kill": true} }, thank you! the suggestion can give try using numpad_enter both numlock on , off, , see if makes difference. i'm running os x , using standard wired apple keyboard numpad, , i'm running linux

hadoop - Group correspoding key and values -

i have used case write map reducing code have group values corresponding same queue: input: a,b a,c b,a b,d output: a {b,c} b {a,d} i have written below : import java.io.ioexception; import java.util.stringtokenizer; /* * org.apache.hadoop packaged can imported using jar present in lib * directory of java project. */ import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.longwritable; import org.apache.hadoop.io.text; import org.apache.hadoop.mapreduce.job; import org.apache.hadoop.mapreduce.mapper; import org.apache.hadoop.mapreduce.lib.input.fileinputformat; import org.apache.hadoop.mapreduce.lib.input.textinputformat; import org.apache.hadoop.mapreduce.lib.output.fileoutputformat; import org.apache.hadoop.mapreduce.lib.output.textoutputformat; public class groupkeyva

angularjs - Cannot find name 'headers'. in angular 2 -

enter image description here working on angular 2.this ts file called getrandomquote() method in constructor. when run project below error:- cannot find name 'headers'. did mean instance member 'this.headers'? import {component, viewencapsulation, injectable} '@angular/core'; import {paginatepipe, paginationcontrolscmp, paginationservice} 'ng2-pagination'; import { http, response, headers,requestoptions } 'angular2/http'; import {basictablesservice} './basictables.service'; import {bacard} '../../../../theme/components'; import {hovertable} './components/hovertable'; import {borderedtable} './components/borderedtable'; import {condensedtable} './components/condensedtable'; import {stripedtable} './components/stripedtable'; import {contextualtable} './components/contextualtable'; import {responsivetable} './components/responsivetable'; import {authhttp, authconfig, auth_provi

linux - Escape echo output from redirecting to a file -

this question has answer here: redirect copy of stdout log file within bash script itself 8 answers i have script following function long_proc() { #script1 generate output1 #script2 generate output2 .... } long_proc > /tmp/debug.log my requirement complete log should divert /tmp/debug.log output of script2 should go stdout log file. can 1 me? so think want do. to keep output on stdout go file long_proc(){ exec 4>&1 #redirect fd4(currently nothing hopefully) stdout exec 1>&3 #redirect stdout fd3(also unused) #note have 5 more choose if in use. echo log #script1 generate output1 echo log , stdout | tee >(cat - >&4) #script1 generate output2 # tee subproc cat data fd4 pointing stdout #the tee'd data goes fd3 exec 1>&4 # set fd1 stdout ex

db2 - DROP DATABASE fails -

i have db2 database (let's call mydb ) delete. however, when db2 drop db mydb back sql1035n operation failed because specified database cannot connected in mode requested. sqlstate=57019 what doing wrong? you should try following: db2 quiesce db immediate db2 force application db2 drop database mydb 'quiesce' forces users off specified instance , database , puts quiesced mode. ( https://www.ibm.com/support/knowledgecenter/ssepgg_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0008635.html ) 'force application' forces local or remote users or applications off system allow maintenance on server. ( https://www.ibm.com/support/knowledgecenter/ssepgg_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001951.html ) if doesn't trick, 'db2stop' , 'db2start' after 'force application' , drop database

objective c - White/Black screen appears instead of launch screen -

launch screen displayed in ipad. white/black screen appears when run app in iphone.i have locked portrait orientation.how set launch screen iphone? you can use launchscreen storyboard ios >= 7.1 http://useyourloaf.com/blog/using-a-launch-screen-storyboard/

c# - Fetch value from string expression like "Add Watch" feature -

public class ufmline { public ufmtemplate elementtag; public int posx1; public int posy1; public int posx2; public int posy2; public string property; public string hierstr = string.empty; public list<ufmline> ufmlines = new list<ufmline>(); // tricky nested class field } ufmline ufmobj = new ufmline(); this ufmobj populated @ window load. in button click of wpf window xaml code behind... string nthitem = "ufmobj.ufmlines[0].ufmlines[1].ufmlines[1].ufmlines[1].ufmlines[2].ufmlines[2].elementtag"; // tried reflection method, giving null exception var result = typeof(ufmline).getfield(nthitem).getvalue(ufmobj); so when opening watch window , fetch value nthitem name gives appropriate value. how in code behind or not using reflection? thanks. you may change fields of ufmline class public properties: public class ufmline { public ufmtemplate elementtag { get; set; } public int posx1 { get; set; }

java - Is it possible to have a 2D array with 2 different datatypes that still takes a {{,},{,}} constructor with typechecking? -

in our current code, have class called mastercodeview : public class mastercodeview implements serializable { private string code; private string description; //getters , setters } then, in each of our business objects, have 1 or more string[][] attributes: public static final string[][] connectionmodedescriptions = { { connectionmode_passive + "", mastercodedescriptionkeys.mc_ftpconnectionmode_passive }, { connectionmode_active + "", mastercodedescriptionkeys.mc_ftpconnectionmode_active } }; these mastercodeviews used i18n of object-specific data, use in radio button labels, grid table cells,... have around 60 of these. the translation string[][] list<mastercodeview> done using mastercodeserviceimpl singleton: private list<mastercodeview> connectionmodedescriptions = new arraylist<mastercodeview>(); // have bunch of these plain list, being // replaced generic lists above whenever possible remove wa

c++ - Reinterpret cast in c -

i have operation c++ code want convert in c89: return reinterpret_cast<uint8_t *>(stream.buffer) - buffer; how can replace reinterpret cast in c? nothing exciting, you've seen before: (uint8_t *)(stream.buffer) that's way cast in c.

c# - Show only Date in Column of DataGridView -

this question has answer here: show date in datagridview column 1 answer i have date store in mysql database format datetime . i want put only date in 1 datagridview when try date following hours, like: 29/06/2016 12:01:21 i tried find date directly mysql query using date() function, still not work because in datagridview see date formatted follows: 29/06/2016 00:00:00 finally tried side code set column, without result datagridview.columns[1].defaultcellstyle.format = "dd/mm/yyyy"; i use datasource "link" data datagridview . this code: var datatable = listofresult.todatatable(); //todatatable() function convert list datatable datagridview.datasource = datatable; datagridview.columns[1].defaultcellstyle.format = "dd/mm/yyyy"; the listofresult list of such dynamic , inside there dates. function todatatable(

Getting video title using video id in youtube api v3 (Android) -

i trying youtube video details using video id in youtube api v3. using url : https://www.googleapis.com/youtube/v3/videos?id=7lcdeyxw3mm&key=aizasyca-el5st5lcqnyaunmm2ku_pukvbcz6ms%20&part=snippet,contentdetails i return of : { "error": { "errors": [ { "domain": "usagelimits", "reason": "iprefererblocked", "message": "the android package name , signing-certificate fingerprint, null , null, not match app restrictions configured on api key. please use api console update key restrictions.", "extendedhelp": "https://console.developers.google.com/apis/credentials?project=861763996907" } ], "code": 403, "message": "the android package name , signing-certificate fingerprint, null , null, not match app restrictions configured on api key. please use api console update key restrictions." } } the api key key 1 got after registering app using sha1 co

javascript - Regular expression to not allow spaces anywhere in the email -

i trying validate email address using regular expression such throws error if white spaces added anywhere in email. current regex using this: <input type="email" class="form-control" name="username" ng- model="username" id="email" placeholder="email" ng-pattern='/^(([^<>()\ [\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/' required /> <span ng-show="login.username.$error.pattern">this email format invalid! </span> the problem allows me add white spaces in end. how can modify if add whitespace in end error message fired? the newest release of angularjs (1.5.7) includes email address validation improvements. you can check commit here . line 28 corresponds committed regex: var email_regexp = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/

android - can not read extra from intent when app startup from notification -

i using fcm receive messages , on onmessagereceived have code notificationmanager notificationmanager = (notificationmanager) getapplicationcontext().getsystemservice(service.notification_service); intent notifyintent = new intent(this,hellobubblesactivity.class); notifyintent.putextra("id",sender); notifyintent.addflags(intent.flag_activity_new_task | intent.flag_activity_single_top); pendingintent pendingintent = pendingintent.getactivity(getapplicationcontext(), 0, notifyintent, pendingintent.flag_cancel_current); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setcontenttitle("new message " + name) .setsmallicon(r.drawable.smalllogo) .setautocancel(false) .setcontenttext(text) .setcontentinten

php - How to convert 10MB PDF to SVG quickly with appropriate size for web -

good day, have read questions , answers "pdf svg", "pdf png, png svg" , had no success in accomplishing task. i have pdf 10mb (blueprints archicad) , after using pdf2svg convert svg, svg 70mb. conversion takes 14sec, web page load takes 150sec because of size of svg. my question - how can convert pdf in php svg appropriate size web without quality loss , without gzipping it? this code converts pdf svg 70mb: $filename = 'in.pdf'; $targetname = 'out.svg'; exec("pdf2svg ".escapeshellarg($filename)." ".escapeshellarg($targetname)); this 1 converts pdf 500kb svg huge quality loss, path loss, text loss, etc. exec("convert -density 200 ".escapeshellarg($filename)." middle.png"); exec("inkscape middle.png --export-plain-svg=".escapeshellarg($targetname)); ive tried imagemagick, autotrace, potrace, inkscape, pdf2svg. tried answer " convert pdf svg ". other questions (on so) weren

java - Capturing Android applicataion traffic using FIddler -

Image
so far managed capture traffic of local java programs & android browser successfully. however, failed capture traffic of android application (using httpsurlconnection ). while following steps in this guide configure wifi network on device, in step of downloading certificate faced odd behavior chrome raised error , firefox installed without opening expected dialog: but when try download again, says certificate installed. anyway, when running app (on real device, karbonn s203 api 19), there no requests nor tunnels logged in fiddler. tried lot including inspecting this thread no avail. in other articles read showing tunnels don't have them either. missing anything? thanks. edit : managed install "correctly" (with above screen) settings -> security -> install certificate after copying if pc. still cannot see requests in fiddler. looks app not use fiddler proxy. when call openconnection pass proxy object it? if so, how initialize proxy obj

java - Navigation bar not showing in kitkat -

this code involving navigation bar.the navigation bar gets displayed on android versions above kitkat no navigation bar shown in kitkat , below versions. toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardrawertoggle( this, drawer, toolbar, r.string.navigation_drawer_open, r.string.navigation_drawer_close); drawer.setdrawerlistener(toggle); toggle.syncstate(); navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view); navigationview.setnavigationitemselectedlistener(this);

javascript - how to disable click event on marker after single click -

after single click on marker, i'd to: disable click event on map wait 5 seconds re-enable click event on map m using ajax setinterval 3 seconds code: details = new google.maps.latlng(18.60301515,73.79623622); bindinfowindow(marker, map, infowindow , details); function bindinfowindow(marker, map, infowindow, description) { google.maps.event.addlistener(marker,'click', function() { var geocoder = new google.maps.geocoder(); geocoder.geocode({ 'latlng': description }, function (results, status) { if (status == google.maps.geocoderstatus.ok) { if (results[1]) { var location1=results[1].formatted_address; // set content marker @ click event infowindow.setcontent('location:'+location1+'<br>'); } } }); infowindow.open(map, marker); }); } thanks i this: javascript details = new google.maps.latlng(18.60301515,7

javascript - two dropdowns on one dependent dropdown codeigniter -

i have dependent dropdown function have dropdown , 1 depending on it, here html <select class="form-control" name = "prov_id" id = "prov_id"> <option></option> <?php foreach ($content2 $cs) {?> <option value="<?php echo $cs->prov_id; ?>"><?php echo $cs->province; ?></option> <?php } ?> </select> <select class="form-control" name = 'ct_id' id = 'ct_id'> <option value=""></option> </select> and here javascript jquery(document).ready(function(){ $("#prov_id").change(function() { var provid = {"provid" : $('#prov_id').val()}; console.log(provid); $.ajax({ type: "post", data: provid, url: "<?php base_url(

javascript - Redux thunk: return promise from dispatched action -

is possible return promise/signal action creator, resolved when redux thunk has dispatched action? consider action creator: function dopost(data) { return (dispatch) => { dispatch({type: post_loading}); source.dopost() // async http operation .then(response => { dispatch({type: post_success, payload: response}) }) .catch(errormessage => { dispatch({type: post_error, payload: errormessage}) }); } } i want call function asynchronously in component after calling dopost action creator when redux has either dispatched post_success or post_error actions. 1 solution pass callback action creator itself, make code messy , hard grasp , maintain. poll redux state in while loop, inefficient. ideally, solution promise, should resolve/reject when actions (in case post_success or post_error) gets dispatched. handlerfunction { dopost(data) closewindow() } the above exa

sqlite - Crontab java.lang.ClassNotFoundException with a jar file -

#!/bin/bash java_home=/library/java/javavirtualmachines/jdk1.8.0_60.jdk classpath=/users/sunny/crontest/out/production/crontest $java_home/contents/home/bin/java -cp $classpath ".:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar" sample.main exit 0 sqlite jar file in /users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar compiled java class file in /users/sunny/crontest/out/production/crontest/sample/main.class and i've set cron job schedule @ every 1 minute. java class getting exucuted getting java.lang.classnotfoundexception: org.sqlite.jdbc same command in script working in terminal. my question how can add jar file executed shell script. seems there space in between $class path , ".:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar" , missing colon(:). please try following export : export classpath=.:/users/sunny/crontest/out/production/crontest:/users/sunny/downloads/sqlite-jdbc-3.8.11.2.jar and call java command -cp $classpath

JavaScript access JSON message -

i found lot of ways access json data in javascript none of them seems working (for me): ws.onmessage = function(msg) { var stringmsg = msg.data.tostring(); stringmsg = '\''+ stringmsg + '\'' console.log(stringmsg); var jsonmsg = json.parse(stringmsg); alert(jsonmsg.sensorid); var outputtextarea = document.getelementbyid("outputtext"); outputtextarea.value += (msg.data + "\n"); outputtextarea.scrolltop = outputtextarea.scrollheight; } the console output displays this: '{"sensorid": "kali1", "msgvalue": "aa:aa:aa:aa:aa:aa:bla!box bla wlan 4000", "msgtype": "unknown ssid"}' and parser puts out error: syntaxerror: json.parse: unexpected character @ line 1 column 1 of json data but string seems valid json (thats think , json-validators used online) i tried access message directly with: alert(msg.sensorid) alert(msg.data.sensorid)

python - Can I create a class which can be unpacked? -

for example: x = (1, 2) a,b = x now i'd accomplish in case of x being instance of class isn't list or tuple. overriding __getitem__ or __getslice__ doesn't work: class test(object): def __getitem__(self, key): return 1 a,b = test() results in valueerror: many values unpack . can make work without inheriting list or tuple (or respective userx classes)? or under-the-hood magic cannot use? you need override __iter__ or __getitem__ . here's example using __iter__ : class test(object): def __iter__(self): return iter([1, 2]) a,b = test() be careful, __iter__ needs return iterator. easiest way either wrap data structure in iter , or have yield generator. for example of using __getitem__ , see jonrsharpe's excellent answer.

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -

hi new work on activemq, trying access messages send activemq in mdb onmsg() method unable things done here sample standalone-full.xml configuration. <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0"> <jms-queue name="favouritesqueue" entries="queue/favouritesqueue"/> </server> </subsystem> mdb configuration <mdb> <resource-adapter-ref resource-adapter-name="activemq-ra.rar"/> <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> </mdb> <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0"> <resource-adapters> <resource-adapter id="activemq-ra.rar"> <archive> activemq-rar-5.13.3.rar </archive> <transaction-support>xatr

ios - Abstract Factory method pattern -

i have gone through couple of video , blog tuts online. felt understood everything, still struggling implement abstract factory pattern. here requirement: i have user class should give user object. there 2 types of users in application e.g service provider (provider) , service receiver (consumer). there common properties between these 2 types of users name, email id , mobile number etc. provider type there properties. provider types of e.g. taxidriver or restaurant etc. i want implement abstract factory , factory method pattern user class application can decoupled user model , whenever application wants user of type provider or consumer should right object. what tried far: abstracuserprotocol.h @protocol abstractuserprotocol @required @property(nonatomic, strong) id delegate; @property(nonatomic, readonly, getter=isexist) bool exist; @property (nonatomic, strong) nsstring *name; @property (nonatomic, strong) nsstring *emailid; @property (nonatomic, assign) nsinteger

React-Native android: What are the persistent Storage options? -

what closest thing sqlite can react-native android persistent database storage storing tables etc. thanks! result realm (appears better option.) react-native-sqlite-storage realm excellent solution extended, relational storage in react native. it's got great apis number of rn components such listviews, , allows powerful querying of datasets within rn code. as website explains: realm react native true database react native, not key-value store. save regular objects full object relationships, , query them always-live results. none of means give on performance @ all. realm react native faster alternatives!

javascript - How to pass php code in this in label_htm i want to show count number in this filed -

"my tasks" => array( "title" => "my tasks", "label_htm" => '<span class="badge pull-right inbox-badge margin-right-13">2</span>', "icon" => "fa-slack", 'url' => app_url.'/my_task.php' ), just instead 2 value, concat string php variable, i.e.: '<span class="badge pull-right inbox-badge margin-right-13">' . $count . '</span>'

linux - How make directory to file in HDFS Hadoop (Cloudera) java -

i first work hadoop assembly cloudera. need make directory file in linux server hdfs. when use java in cmd linux not create diractory, create file. can me bad can me explain, near code java create diractory in hdfs , file.thank your. sorry bad english) import java.io.file; import java.io.ioexception; import java.util.scanner; public class filedemo { public static void main(string args[]) throws ioexception { scanner reader = new scanner(system.in); boolean success = false; system.out.println("enter path of directory create"); string dir = reader.nextline(); // creating new directory in java, if doesn't exists file directory = new file(dir); if (directory.exists()) { system.out.println("directory exists ..."); } else { system.out.println("directory not exists, creating now"); success = directory.mkdir(); if (success) { system.out.printf("successfully created ne

django - Looking for potential problems by setting session cookie for every user -

for business-logic reason, need set sessionid cookie each site visitor, if there no actual data stored session. it can possible setting session_save_every_request true , overriding https://github.com/django/django/blob/fc4b4fd5850989458d6e54de12a29b2e40e94ce8/django/contrib/sessions/backends/base.py#l153 return false . in case, session cookie not deleted because of https://github.com/django/django/blob/fc4b4fd5850989458d6e54de12a29b2e40e94ce8/django/contrib/sessions/middleware.py#l37 . can there problems if cookie remain? or maybe there way set sessionid every visitor?

sql - joining select statements? -

Image
i inner join in query don´t know how summarize 2 select statements 1 query. this first query: select machine , eventdefinition , duration , sum(duration) on (partition 1) total , duration/sum(duration) on (partition 1)*100 distribution ,case when eventcategory < 0.05 'not incl' else 'ok' end under3min ( select systemname machine , eventdefinition , eventdate , eventstartdatetime , isnull(eventenddatetime, getdate()) eventenddatetime , sum(cast(eventenddatetime - eventstartdatetime float))*24 duration ,sum(case when customevent = 'without stop' cast(eventenddatetime - eventstartdatetime float)*24 else 0 end) eventcategory tdatacategory eventdate >= @startdatetime , eventdate <= @enddatetime , systemname = '201' group systemname, eventdefinition, eventstartdatetime, eventenddatetime, eventd

android - Wait for completion of AsyncTask and Loading of Map -

i writing code takes input 1 asynctask(httpurlconnection) start asynctask(httpurlconnection) uses information add markers google map . the problem facing map has not loaded @ time when try add markers through onpostexecute . when try use onmapready data has not yet been downloaded. is there way can wait both data load , map ready before attempting place markers? synce question generic , provided no custom code, post "generic solution": boolean isstep1done = false; boolean isstep2done = false; private class exampleoperation extends asynctask<string, void, string> { @override protected string doinbackground(string... params) { thread.sleep(1000); return "completed"; } @override protected void onpostexecute(string result) { isstep1done = true; continuelogic(); } @override protected void onpreexecute() {} @override protected void onprogressupdate(void... values) {} }