Posts

Showing posts from April, 2010

c# - Windows Universal App - Launch CMD from app -

i'm building first win 10 app (in visual c#) , had quick question. (i'm java/ android guy) i want able run cmd line programs app. desktop app , need have ability shutdown, restart, lock, , abort restart app. know can use 'shutdown' cmd, how can launch it? thank you! any program can run command line program can run without command line. example, shutdown ; try opening run box ( win + r ) , typing: shutdown /r /t 60 you'll see windows warns system rebooting in 60 seconds (of course, shutdown /a abort shutdown). so, should able use process.start run command. no need launch full command line.

sql server - Merge the result of an Inner Join to a table SQL -

using sql query have result used inner join, results displayed underneath query. how can jot results down in existing table ie merge it? update curinghistorydata.dbo.curingdata set pressnumber = master.dbo.tagtable curinghistorydata.dbo.curingdata.tagindex = master.dbo.tagtable.tagindex; when execute error msg 4104, level 16, state 1, line 11 multi-part identifier "master.dbo.tagtable.tagindex" not bound. dont know going wrong. both tables exist way. update t1 set t1.pressnumber = t2.pressnumber curinghistorydata.dbo.curingdata t1 inner join master.dbo.tagtable t2 on t1.tagindex = t2.tagindex;

java - How to move a sheet with smartsheet api -

when create new sheet using smartsheet java api created in "sheets" folder under home. possible move sheet or create in different workspace/folder? below have listed example on how create sheet in new folder how copy existing sheet new folder. if want move sheet new folder can first copy sheet new folder , delete original sheet. please note, both sheet id , folder id can retrieved right clicking on sheet or folder inside smartsheet , clicking properties. create sheet in folder string token = "your_token"; smartsheet smartsheet = new smartsheetbuilder().setaccesstoken(token).build(); // define sheet copy sheet sheet = new sheet(); sheet.setname("new sheet"); // create columns new sheet list<column> columns = new arraylist<column>(); column column = new column(); column.settitle("column #1"); column.setprimary(true); column.settype(columntype.text_number); columns.add(column); column column2 = new column(); column2

nginx - ipython notebook server SSL error -

i have ssl certificate server (its .crt bundle) keep getting errors when trying use ipython notebook server i have nginx setup in windows. access ipython setup via reverse proxy. followed here thread here: how configure ipython behind nginx in subpath? i followed instructions on how set notebook server . i'm using /ipython prefix. changed location of certificate, .crt file , not .pem , else left same (besides password). whenever try access www.domain.com/ipython, error: [w 03:43:22.463 notebookapp] ssl error on 916 ('127.0.0.1', 1586): [ssl: wrong_version_number] wrong version number (_ssl.c:581) [e 03:43:22.463 notebookapp] uncaught exception traceback (most recent call last): file "c:\python27\lib\site-packages\tornado\http1connection.py", line 693, in _server_request_loop ret = yield conn.read_response(request_delegate) file "c:\python27\lib\site-packages\tornado\gen.py", line 870, in run value = future.r

java - JSON Replacing '.' with -

i want program takes json file input , results json file. input file contains like: {"empname":"surname.firstname","department.name":"production","salary":11254.42} the output file must replace '.'(dot) '_'(underscore) of input json. expecting output: {"empname":"surname_firstname","department_name":"production","salary":11254_42} i want program using java, without using serialization , deserialization. can 1 help? if using java 7+: string str = new string(files.readallbytes(paths.get("in.json")), standardcharsets.utf_8) .replace('.', '_'); files.write(paths.get("out.json"), str.getbytes("utf-8"), standardopenoption.write);

javascript - Fluid Packery Layout -

i posted yesterday there seemed confusion. posting again, , try clearer time around. i big fan of wordpress theme: http://prothemeus.com/demo/litho/ following reasons: it positions , scales content tiles fill browser window 100% when resizing browser window re-positions , re-scales these tiles still fills browser window 100% when resizing browser window, motion of tiles fluid. no gaps form between tiles, has nice action all. love. the tiles never smaller amount, 240px wide. once go smaller 240px, grid reshuffles tiles there less tiles in each row. (difficult explain this, play size of browser window , see mean) the things doesn't work me theme: cannot display content tiles of varying sizes. key me want draw attention posts. specific, featured post tiles double width , height of regular post tiles. so result have customised theme stripping out litho theme's javascript, renaming nodes , containers etc. , replacing packery libraries, position content tiles:

c# - WCF RESTful Service Error -

hi came accross error , cant figure out how fix it. have restful wcf service trying retrieve data sql server database. thanks. error 1 'restservice.restserviceimpl.getcompany(string)': not code paths return value my coding restserviceimpl.svc.cs public class restserviceimpl : irestserviceimpl { public string xmldata(string id) { return ("you requested product" + id); } public string jsondata(string id) { return ("you requested product" + id); } //error underlined @ getcompany public company getcompany(string compid) { company comp = new company(); { sqlconnection con = new sqlconnection(); con.connectionstring = ""; con.open(); sqlcommand cmd = new sqlcommand("select companyname tblcompany", con); con.open();

python - Converting jpeg string to PIL image object -

i've been handed list of files backend of application supposed jpeg files. life of me haven't been able convert them pil image objects. when call str(curimg) i back: <type 'str'> . have tried using open(), .read, io.bytesio(img.read() , doing nothing it, keeps seeing string. when print string, unrecognizable characters. know how tell python how intepret string jpeg , convert pill image can call .size , np.array on? you should able pass stringio object pil , open way. ie: from pil import image import stringio tempbuff = stringio.stringio() tempbuff.write(curimg) tempbuff.seek(0) #need jump beginning before handing off pil image.open(tempbuff)

PreBuildEvent and PostBuildEvent on Visual Studio 2015 Tools for Apache Cordova -

does know if there way use prebuildevent , postbuildevent on new visual studio 2015 tools apache cordova? i tried post, didn't work: setting post-build event commands? i faced similar issue , needed delete folder on build in cordova app build vs 2015 . found solution in link https://stackoverflow.com/a/10605248/581157 hope helps. to delete folder on biuld of cordova app added jsproj file <target name="beforebuild"> <exec command="cd $(projectdir) rmdir /s /q platforms"/> </target>

html - Div's appearing different (Firefox vs Internet Explorer) -

Image
i have footer included in register.php , ( simple registration page. ) the footer includes text section right , error reporting section left. my issue internet explorer not display code same way firefox does. here examples: firefox: internet explorer: here css left side ( error reporting ): #errors { float:left; margin-left:4.5%; text-align:left; color:red; } here css right side ( text area ): #footer p { text-align:right; margin-right:3%; } and, here css entire footer: #footer { width:100%; border-top:1px solid black; bottom:0; color:#838b8b; font-family:verdana; } this kind of hack, try: #errors { float:left; margin-left:4.5%; text-align:left; color:red; white-space: nowrap; }

c - pthread_rwlock_rdlock resulting in number of readers going as negative -

when can scenario happen? one of threads stuck on write , other keeps calling read_lock resulting in negative readers increase. write attempts done same thread , reads thread. the following lock definitions -> typedef sp_rwlock_t pthread_rwlock_t; int sp_rwlock_rlock(sp_rwlock_t *lock) { int status; if (lock->__data.__nr_readers > 1) { syslog(log_err,"%s:wierd readers :%d\n",__func__, lock->__data.__nr_readers); } if (lock) { if ((status = pthread_rwlock_rdlock(lock)) == 0) { return sp_ok; } else { syslog(log_err,"error in func: %s errno %x\n",__func__, status); return sp_error; } } /* if lock */ return sp_invalid_arg; } int sp_rwlock_wlock(sp_rwlock_t *lock) { if (lock->__data.__nr_readers > 0) { syslog(log_err,"%s:wierd readers\n",__func__); } if (lock) { if (pthread_rwlock_wrlock(lock) == 0) {

mysql - SQL query, two tables, multiple items -

i wish retrieve data 2 tables twist, need multiple values (prices different dates) second table. following works fine, not of sql jockey , have sneaking suspicion there must better way joining second table twice. there? select a.date, a.symbol, a.value, b.close, c.close potential left join stock_daily b on a.symbol = b.symbol left join stock_daily c on a.symbol = c.symbol a.date = "2015-08-05" , b.date = "2015-08-05" , c.date = "2015-08-04" order value desc limit 20; thanks in advance! it fine way you're doing it, expand bit more on comment, there potential issue query. since doing left join conditional logic in where clause joined table, transforming left join inner join . should there dates missing right-hand table not satisfy inner join , give incorrect results. i recommend changing query following avoid this: select a.date, a.symbol, a.value, b.close, c.close potential left join stock_daily b on a.symbol = b.symbol ,

java - Spring-Jersey : How to return static content? -

question : how expose css/ , images/ , js/ , other static files? how return jsp page in controller (not string method) index view? problems : in efforts solve question #1 other projects use filter jersey.config.servlet.filter.staticcontentregex (as seen here stackoverflow question ) haven't been able find dependencies work correctly/at project setup. in efforts solve question #2 attempted introduce dependencies use viewable . problem - transitive dependencies adversely affect webapp using appropriate classes spring & jersey (snowballs rabbit hole of nebulous errors) complete project > github project dependencies > complete pom file <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet</artifactid> <version>2.15</version> </dependency> <dependency> <groupid>org.glassfish.jersey.ext</groupid> <artifactid>jersey-spring3</ar

mongodb - Can not connect to Mongo docker instance via mono client on mac -

i have installed mongo docker image , run using commands (mac boot2docker installed) docker pull mongo and docker run --name some-mongo -d mongo but want connect via mongo client running: mongo --port 27017 --host 127.0.0.1 but error message: mongodb shell version: 3.0.4 connecting to: 127.0.0.1:27017/test 2015-07-27t14:22:24.088+0300 w network failed connect 127.0.0.1:27017, reason: errno:61 connection refused 2015-07-27t14:22:24.094+0300 e query error: couldn't connect server 127.0.0.1:27017 (127.0.0.1), connection attempt failed @ connect (src/mongo/shell/mongo.js:181:14) @ (connect):1:6 @ src/mongo/shell/mongo.js:181 exception: connect failed it clear me docker fails expose ports since telnet 27017 on localhost fails well. what hack doing wrong? you have 2 problems : like h3nrik said should connect boot2docker vms address. if don't know use following command : boot2docker ip and port isn't open in first place. your do

Transform SQL Server Data With Headers as First Column and the Data as New columns -

i want transform data: id empname empphonenumber empsiblings 1 jack 4444444 amy 1 jack 6666666 judy into employeeparamater value1 value2 id 1 1 empname jack jack employeephonenumber 4444444 6666666 empsiblings amy judy in sql server, when unpivot data get: empname - jack empname - jack

mysql - ANDROID STUDIO: Gradle does not build sql database -

i have program use sql store users credit. used work fine until 1 faithful day stopped running. here problem first occurs. package com.inc.nicky.tapit; mydbhandler dbhandler = new mydbhandler(this, null, null, 1); product product = dbhandler.findproduct("coins"); eee=(textview)findviewbyid(r.id.someid); if (product != null) { eee.settext(product.getquantity()); } else { product = new product("coins", 0); dbhandler.addproduct(product); eee.settext("0"); } logcat says cannot change text product.getquantity(). if remove line , future usage of sql problem still remains; cannot call product.getquantity() when not changing texts. here more detailed report of error: unable start activity componentinfo{com.inc.nicky.tapit/com.inc.nicky.tapit.mainactivity}: android.content.res.resources$notfoundexception: string resource id #0x0 @ android.app.activitythread.performlaunchactivi

bash - Using the first column of a file as input in a script -

i having problems using first column ${1} input script. currently portions of script looks this. #!/bin/bash input="${1}" name in `cat ${input}` size="`du -sm /faserver/na3250-a/homes/${name} | sed 's|/faserver/na3250-a/homes/||'`" datestamp=`ls -ld /faserver/na3250-a/homes/${name} | awk '{print $6}'` echo "${size} ${datestamp}" done however, want modify input="${1}" take first {1} within specific file. can run lines above in script , use file generated input. have output go out new file. so like: input="$location/disabledactivehome ${1}" ??? here's full script below. #!/bin/bash # script search through disabled users ou , compare list of # names against current active home directories. find out # how space home directories take , need removed. # must run sudo! # setting variables _adm , storage path. echo "please provide _adm account name:" read _adm echo "please state

Scala Constructor/Method Parameter Checking -

i wanted check best practices of scala programming, since new scala. read online how scala doesn't typically use exceptions except "exceptional" circumstances (which doesn't include parameter checking). right in project using lot of require , wondering better way of type checking be. for example, if have class class foo(string bar){ require(stringutils.isnotempty(bar), "bar can't empty") } what alternatives checking bar? create companion object so object foo { def apply(bar: string) = try[foo] { bar match = { case null => failure("can't null") //rest of checks case _ => success[foo] } } or should use option instead? in addition, scala methods, how check parameter of method? if return option, return empty option if bad parameter? wouldn't mean have check empty option when use return of method , wouldn't throwing exception allow more specific message? (e.g. runtime exception can't

c# - Two Reordering ListBoxes on Same page, prevent user from dragging and dropping between -

i have wpf c# application has window 2 reordering listboxes right next each other. used examples in this link make listbox user control. unfortunately allows user drag 1 box , drop in other. how can make sure doesn't happen? here code: public void setitems(list<string> values){ _items = new observablecollection<item>(); foreach (string s in values) { _items.add(new item(s)); } listbox.displaymemberpath = "name"; listbox.itemssource = _items; listbox.previewmousemove += listbox_previewmousemove; var style = new style(typeof(listboxitem)); style.setters.add(new setter(listboxitem.allowdropproperty, true)); style.setters.add( new eventsetter( listboxitem.previewmouseleftbuttondownevent, new mousebuttoneventhandler(listboxitem_previewmouseleftbuttondown))); style.setters.add( new eventsetter

php - PHPExcel: How can I use a combination of dynamic rows and fixed rows in PHPExcel? -

i looking advice on methodology here guess. i have excel spreadsheet areas require dynamic number of rows inserted, followed fixed areas require data added specific col/row fields. i want load existing spreadsheet due sheet having lots of styles applied. can done in phpexcel? i know phpexcel can dynamic insertion of rows in new sheet, , can insert data specific cells on existing sheet, can handle both? ok, looks can achieved little method called... insertnewrowbefore example $objphpexcel->getactivesheet()->insertnewrowbefore(7, 2); with this, 1 can insert additional rows in-between content, dynamically.

typescript - Polymer/PolymerTS: Pass object to custom element -

i'm creating web app uses typescript instead of javascript see how typescript feels. learning polymer kill 2 birds 1 stone. working, i'm using polymerts work, , until point it's been working fine. however, i've hit barrier. i have 2 elements, can call them 'my-foo' , 'my-bar': <link rel="import" href="path/to/my-bar.html"> <dom-module id="my-foo"> <template> <my-bar mybarproperty="{{myfooproperty}}"></my-bar> </template> </dom-module> now value 'myfooproperty' value has been deserialized json custom typescript class. can properties display if data-bind them, e.g. <h1>{{myfooproperty.name}}</h1> but passing second custom element not work, i.e. "mybarproperty" null or empty map. element loaded correctly (any html not data-specific loaded , displayed) value isn't set. insight on why is? maybe isn't possible?

core data - SWIFT: How do I create a predicate with an Int value? -

i hope no 1 tells me rtfm because have been struggling time here , on apple developer , doing lots of searching. i getting exc-bad-access error on statement: var thispredicate = nspredicate(format: "(sectionnumber == %@"), thissection) thissection has int value of 1 , displays value 1 when hover on it. in debug area see this: thispredicate = (_contiguousarraystorage ...) another predicate using string shows objectivec.nsobject why happening? you might try string interpolation swift standard library reference . this: let thissection = 1 let thispredicate = nspredicate(format: "sectionnumber == \(thissection)")

Android App - improve performance in ARM -

Image
my app heavy processing in background (using asyntask) , works fine in mobiles x86 in arm slow (i tested in both real devices , emulator , same performance). well, heavy background task comparing strings , numbers using 2 loops. so, wonder if there configure in compiler or somewhere in project. below screenshot of traceview , ask please take , me understand it.

formal languages - Z into Isabelle -

i trying input , prove z specifications in isabelle. say have vending machine specification written in latex format: \begin{zed} price:\nat \end{zed} \begin{schema}{vmstate} stock, takings: \nat \end{schema} \begin{schema}{vm\_operation} \delta vmstate \\ cash\_tendered?, cash\_refunded!: \nat \\ bars\_delivered! : \nat \end{schema} \begin{schema}{exact\_cash} cash\_tendered?: \nat \where cash\_tendered? = price \end{schema} i don't know if should put schema's lemmas or functions? this have far: theory vendingmachine imports main fact "~~/src/hol/hoare/hoare_logic" begin type_synonym price = nat type_synonym stock = nat type_synonym takings = nat type_synonym cash_tendered = nat function exact_cash "(cash_tendered:nat)" cash_tendered ≡ price; end the type synonyms work fine when exact cash schema have translated exact_cash functions keep getting errors. so in summary know how input sch

php - MySQL: If a column value is 2 THEN do X ELSE do Y -

the database working on right messy. have 3 potential tables, want join in cases may 2 tables. let's call these table1, table2 , table3. table1 has field called "type". if table1.type 2, need join table3. other values want join table2 , table3. how can achieve in 1 single sql query rather than: 1) having 1 query select type. 2) make php foreach-loop check type of current iteration , 3) perform new query according type value. edit: i'll try more specific. table1 has column named "pid" references whole other table, that's redundant question. tried working ways around unions , left joins couldn't manage achieve looking for. i want select results database "pid" value being "100". gives me 4 rows in return, 2 of them of type value "2" , others "1". so want achieve following 2 sql statements in one: (if "type" "2") select * table1 t1 inner join table3 t3 on t1.id = t3.t1_id t1

c++ - GP635T GPS-sensor output of data -

i have rather weird problem gp635t gps-sensor connected intel edison. use c++ , eclipse program it. if try receive data this message = serialgps.readstr(100); startposition = message.find('$'); endposition = message.find("\n"); std::cout << "complete message: " << message << std::endl; i long output consisting of types of supported messages $gpgga $gptxt (see datasheet --> http://www.cypax.dk/pdf/gp-635t-121130.pdf ). want work $gpgll -messages. adjusted code find index of beginning of message , end of it: message = serialgps.readstr(100); startposition = message.find("$gpgll"); endposition = message.find('$', startposition+1); std::cout << "complete message: " << message << std::endl; but code, variable 'message' consists of 1 single message of random type. don't know why happens, be

linux - cygwin startxwin, then ssh into a different machine -

i have batch file on windows following line in it: c:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin;" when execute windows, launches xterm window (with xwin enabled) , there can ssh our remote linux server. what add ssh command in batch file windows desktop, can click it, , end ssh'ing our remote linux server. have tried doing this: c:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin; ssh -y my-remote-server xterm" but doesn't seem work. advice appreciated. it should work following modifications: c:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin & sleep 5; display=:0 ssh -y my-remote-server xterm" first, startxwin doesn't daemonize itself, need start & ensure runs in background. then need export correct display enviornment, ssh know x11 server connect (my solution doesn't export variable, provides ssh only).

ios - Best solution for Swift Foursquare API -

i looking integrate foursquare project ios using swift. wiser solution use swiftyjson foursquare api or use das-quadrant api. ask because find little information regarding foursquare api. add question using swift2.0 better use bare swift? also can ask why swiftyjson makes mention of wrapping api called alamofire. both apis seem perform same task?

Hive-Hbase Integration issue -org/apache/hadoop/hive/hbase/HiveHBaseTableInputFormat -

i trying intgrate hive hbase. using pivotal vm add jar /usr/lib/gphd/hive/lib/hive-hbase-handler-0.12.0-gphd-3.0.0.0.jar add jar /usr/lib/gphd/hive/lib/guava-11.0.2.jar; add jar /usr/lib/gphd/hbase/lib/hbase-common.jar; add jar /usr/lib/gphd/zookeeper/zookeeper.jar; add jar /usr/lib/gphd/hbase/lib/protobuf-java-2.5.0.jar; my hive query below: create table hbase_table (age int, name string,id string,sal string) stored 'org.apache.hadoop.hive.hbase.hbasestoragehandler' serdeproperties ("hbase.columns.mapping" = ":key,personal data:age,personal data:name,professional data:id,,professional data:sal") tblproperties ("hbase.table.name" = "employee"); but gives error: execution error, return code 1 org.apache.hadoop.hive.ql.exec.ddltask. org/apache/hadoop/hive/hbase/hivehbasetableinputformat change hive_aux_jars_path environment variable /usr/lib/gphd/hbase/lib/ in /etc/hive/conf/hive-env.sh this should res

c# - Nested classes deserialized from flat XML -

if have xml file looks like <foo> <name>some data</name> <bar_data>other data</bar_data> <bar_moredata>more data</bar_moredata> </foo> and want turn in c# class looks like public class foo { public string name {get; set; } public bar bar { get; set; } } public class bar { public string data { get; set; } public string moredata { get; set; } } is there way accomplish simple data annotations ( xmlroot , xmlelement , etc.) or option implement ixmlserializable ? edit : note, ever need deserialize data. xml 3rd party source , not need ever serialize foo in xml (if makes easier). one option use xmlanyelementattribute below: public class foo { public string name { get; set; } public bar bar { get; set; } [xmlanyelementattribute] public xmlelement[] barelements { { return null; } set { bar = new bar(); var bartype = bar.gettype();

HTML / CSS height issue with IE -

Image
i'm trying update pfsense captive portal authentication page, , appears fine everywhere except ie (both desktop , mobile versions). issue upper table row (from table of 2 rows), extending large size can seen in image below. html is: <html> <link rel="stylesheet" type="text/css" href="style.css"> <body> <form method="post" action="#portal_action#" align="center" > <input name="redirurl" type="hidden" value="#portal_redirurl#"> <input name="zone" type="hidden" value="#portal_zone#"> <center> <table class="maintable"> <!--beginning of form title heading--> <tr class="tabletoprow"> <td class="tabletopcell1"> <img src="captiveportal-wifi_icon.png" width="50%" height="3%" al

python - Frames not disappearing when using grid_forget() - Tkinter -

i using radio buttons switch between frames in tkinter, using grid_forget(), advised in 1 of other questions, related switching between frames, but, reason, old frames not disappear. here extracts code: def zedpanel(self): global toolbarz self.toolbarz = frame(m1,bd=20, relief='flat', width=400) self.toolbarz.grid() self.toolbarz.place(x=1, y=850, anchor=w) def zcgapanel(self): global toolbarzcga self.toolbarzcga = frame(m1,bd=20, relief='flat', width=400) self.toolbarzcga.grid() self.toolbarzcga.place(x=1, y=850, anchor=w) def zdrapanel(self): global toolbarzdra self.toolbarzdra = frame(m1,bd=20, relief='flat', width=400) self.toolbarzdra.grid() self.toolbarzdra.place(x=1, y=872, anchor=w) the 3 functions above call frames buttons. function use switch between them is: def selected(self): global toolbarzdra global toolbarzcg

javascript - What this : document.reservation.submit(); is supposed to do? -

i reworking on code of old developer , i'm trying form reservation. i've looked across whole code thing called reservation name , id of form. form who's in style : display:none ... so 2 question in 1 : first of heck supposed document.reservation.submit(); suppose form name ? shouldn't document.getelementbyid('reservation').submit() instead ? and second question : how form can sent if value set display:none tough couldn't work , if want hide them shall use hidden property... i need bit of on guys pls :) form beter comprehension : <form name='reservation' action='http://xxxx/reservationformaction.to' method="post" id="reservation"> <input type="hidden" id="productlive" name="product" value="{$product.info.code}"/> <input type="hidden" name="complementaryparameters" value=""/> <input type=&qu

Infinite scrolling/data paging and out-of-sync page results -

i'm develop infinite scrolling of items (which specific ux of paged items) in web app, i'm bit confused how approach problem of new items being added while 1 user scrolls/pages through items. how deal such unsynced data? suppose when open page database has 100 items. user 1 navigates page request first 10 items , displays them user 1 starts scrolling , gets point when page requests next 10 items user 2 adds new item database has 101 items user 1 scrolls requesting next 10 items. what should happen on backend? if user scrolled down request 10 items last id on ok if user scrolled request previous 10 items there's 1 @ top now? how solved? maybe on stackexchange sites content being paged , stream cache changes while user navigates pages of questions? should question asked on programmers maybe? i'm not sure... this solved not doing paging traditionally providing page index and page size, but rather providing last displayed r

c# 4.0 - C# Suggestion for Data Structure -

looking data structure has below charecteristics navigate 1 node other in both directions. there can multiple parent (source) node node (destination node) search should possible , efficient memory usage , performance should efficient this needed parsing language , providing code completion.

c# - What is the best way to end a task to prevent run-away -

i have created function below wait tasks complete or raise exception when cancellation or time-out occurs. public static async task whenall( ienumerable<task> tasks, cancellationtoken cancellationtoken, int millisecondstimeout) { task timeouttask = task.delay(millisecondstimeout, cancellationtoken); task completedtask = await task.whenany( task.whenall(tasks), timeouttask ); if (completedtask == timeouttask) { throw new timeoutexception(); } } if tasks finished before long time-out (i.e. millisecondstimeout = 60,000), timeouttask staying around until 60 seconds has elapsed after function returns? if yes, best way fix runaway problem? yes, timeouttask hang around until timeout on (or cancellationtoken canceled). you can fix passing in different cancellationtoken new cancellationtokensource create using cancellationtokensource.createlinkedtokensource , cancelling @ end. should await completed

Function to download data from the EIA's API via R stopped working why? -

i'm trying figure out why function download data eia stopped working. why did following code stop working? getwdeia <- function(id, key) { id <- unlist(strsplit(id, ";")) key <- unlist(strsplit(key, ";")) url <- paste("http://api.eia.gov/series?series_id=", id, "&api_key=", key, "&out=xml", sep = "") doc <- xmlparse(file = url, isurl = true) df <- xmltodataframe(nodes = getnodeset(doc, "//data/row")) df <- arrange(df, df$date) date <- as.date(df$date, "%y%m%d") values <- as.numeric(levels(df[, -1]))[df[, -1]] xts_data <- xts(values, order.by = date) names(xts_data) <- sapply(strsplit(id, "-"), paste, collapse = ".") assign(sapply(strsplit(id, "-"), paste, collapse = "."), xts_data, envir = .globalenv) } getwdeia(id = "pet.w_epc0_fpf_r48_mbbld.4", key = key) it seems did not @ raw x

android - Click element next to some element in java using appium -

Image
refer above image, want click on off/on button shown under map legend. in page, there 3 off/on buttons present here. confusing me how click on particular. i using uiautomator inspecting android app. using it, don't see xpath avail here. if provide solution or xpath it. helpful proceed details:- java appium uiautomator android in linux you can finding index. use this: public void tap(int index){ list<webelement> li = driver.findelementbyid("put id"); li.get(index).click(); } i guess index 1. way can tap on off button per requirement.

ios - Unified response/error handling in swift -

im wondering how tackle such problem: i have application lets user log in username , password. application sends credentials api server , in response gets logged user data in model defined user class class user { var id: string var firstname: string? var lastname: string? var email: string var permissions: string? var birthday: string? var subscription: string? init(id: string, firstname: string?, lastname: string?, email: string, permissions: string?, birthday: string?, subscription: string?) { self.id = id self.firstname = firstname self.lastname = lastname self.email = email self.permissions = permissions self.birthday = birthday self.subscription = subscription } then in class called apiconnector, have (using afnetworking): func loginuser(mainaddress: string, additionaladdr: string, email: string, password: string, callback: (success: bool, data: user) -> void){ let fulladdress = mainaddress + additionaladdr var parameters =

php - validation and data add to a db table -

the questions have asked earlier pdo retrieve data , populate record input mask need validate user input , add has been entered db table , last step. my mistake can see in below code misinterpret insert into , update set using pdo . furthermore far concerned insert into use bindparam in order attempt data entry, while update set use execute(array) . matter of fact code validates user data input , whether input correct php attempts connect db , should insert or update table. strange part no error returned , no data added <?php error_reporting(-1); ini_set('display_errors', 'on'); ?> <?php $servername = "xxx"; $username = "xx"; $password = "xxx"; $dbname = "xxxx"; try { $dbh = new pdo("mysql:host=$servername;dbname=$dbname", $username, $password); // set pdo error mode exception $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); echo 'connected d

r - Combining variables in a data frame based on factor levels from another data frame -

i have dataframe: head(diets) sp1 sp2 sp3 sp4 sp5 1 0.4 0.4 0.1 0.2 0.0 2 1.4 0.1 0.1 0.3 3.4 3 0.5 0.6 0.1 0.4 0.0 .... i create new dataframe sums these values based on membership in groups (factor) dataframe: head(groups) spname groupname 1 sp1 grp1 2 sp2 grp1 3 sp3 grp2 4 sp4 grp3 5 sp5 grp3 .... to this: grp1 grp2 grp3 1 0.8 0.1 0.2 2 1.5 0.1 3.7 3 1.1 0.1 0.4 you using base r's aggregate function step1 put both data.frames data = data.frame(cbind(df1, t(df2))) step2 perform summation of values corresponding each group out = aggregate(cbind(x1, x2, x3) ~ v3 , data, sum) step3 put output desired transposing , setting column names using setnames setnames(data.frame(t(out[,-1]),row.names = null), out[,1]) # grp1 grp2 grp3 #1 0.8 0.1 0.2 #2 1.5 0.1 3.7 #3 1.1 0.1 0.4 data df1 = structure(list(v1 = 1:5, v2 = structure(1:5, .label = c("sp1"