Posts

Showing posts from May, 2014

javascript - Math.random() and .replace() cross-browser -

i wrote code generate 10 characters randomly. math.random() gives decimal tostring(36) , numbers replaced. math.random().tostring(36).replace(/[^a-z]+/g,'').substr(1,10); does have hint why firefox (47.0) , chrome (51) don't handle equally? chrome tests: math.random().tostring(36).replace(/[^a-z]+/g,'').substr(1,10); "spkcirhyzb" "gcqbrmulxe" "sallvbzqbk" "pcdcufhqet" "knfffqsytm" firefox tests: math.random().tostring(36).replace(/[^a-z]+/g,'').substr(1,10); "zxntpvn" "hebfyxlt" "zclj" "ormtqw" "cfbsnye" live version: for (var n = 0; n < 5; ++n) { console.log(math.random().tostring(36).replace(/[^a-z]+/g,'').substr(1,10)); } update (string average): var test; var count = 0; (var n = 0; n < 1000; ++n) { test = math.random().tostring(36).replace(/[^a-z]+/g,'').substr(1,10); cou

Excel Finding average speed -

i have got 1500 rows of travels. in column have got total time on travel, in column b total km driven. in column c did calculation on average speed of specific travel. whats best way calculate average speed of travels? lengths 0 20 kms approx, time shorter 1 hour. first eliminated travels shorter 2 km managed frequency table , have written frequencies of speeds in 0-5,5-10,... km/h. can histogram, should eliminate more data or how approach problem? in cell enter: =sum(b:b)/sum(a:a) a common error try average values in column c .

Running .bat file before .exe automatically in Advanced Installer -

i'm new advanced installer. after installing file setup, need run ".bat" file before running ".exe" file every time. found add it, setting it's attributes (hidden, vital , system), need run every time before lunching application. please me, thanks if you're launching application finish action dialogs page, here steps: go custom actions page , add launch file custom action without sequence launch bat file enable custom action's "when system being modified (deferred)" , "run under system account full privileges (no impersonation)" options go dialogs page, select exitdialog first time install in install sequence select finish button go published events tab , enable "show events" option add "execute custom action" event passing in "launch file" created above argument set event's condition checkbox's name bat doesn't execute unless user selects checkbox launch applicatio

jQuery function not working for each selector -

i having difficulties getting code work every selector. have made 2 accordions opening css animation. issue second accordion doesn't work, , animation doesn't work separately both accordions. here source: jsfiddle here jquery im using $('#accordion').find('.accordion-toggle').click(function() { //expand or collapse panel $(this).next().slidetoggle('slow'); //hide other panels $(".accordion-content").not($(this).next()).slideup('fast'); if ($('img').hasclass('moved')) { $('img').removeclass('moved'); } else { $('img').addclass('moved'); } }); try following code ,replace id class use find() find elements relative accordion-toggle $('.accordion').find('.accordion-toggle').click(function() { //expand or collapse panel $(this).next('.accordion-content').slidetoggle('slow'); //hide other panels $("

python - Polling a subprocess using pid -

i have django project in allows user start multiple subprocesses @ time. processes may take time , user can continue working other aspects of app. @ instance user can view running processes , poll 1 of them check if over. need poll process using pid. popen.poll() expects subprocess.peopen object while have pid of object. how can desired result? in models.py: class runningprocess(models.model): #some other fields p_id=models.charfield(max_length=500) def __str__(self): return self.field1 in views.py: def run_process(): .... p= subprocess.popen(cmd, shell =true, stdout=subprocess.pipe, stderr=subprocess.stdout) new_p=runningprocess() new_p.p_id=p.pid .... new_p.save() return httpresponseredirect('/home/') def check(request,pid): #here want able poll subprocess using p_id e.g like: checkp = pid.poll() #this statement wrong if checkp none: else: else i need valid statement i

python - Why doesn't `finally: return` propagate an unhandled exception? -

this question has answer here: python try-finally 1 answer why function not raise exception? it's apparently not caught. def f(): try: raise exception finally: return "ok" print(f()) # ok this explicitly explained in the documentation : if exception occurs in of clauses , not handled, exception temporarily saved. finally clause executed. [..] if finally clause executes return or break statement, the saved exception discarded

Predicting with function `arima` producing NaN values in R -

i using arima function intraday forecasting. data available every 15 minute in day. in code below, working fine except few values of in loop. output displayed i=223. predict function produces nan values. have checked dataset, there no nan value there. kindly suggest me how rid of problem. predict1=c() predict2=c() for(i in 1:456){ y1n=ts(nbl$nbp[(12385+(i-1)*4):(15356+(i-1)*4)],frequency=96) y1n[which(is.na(y1n))]=y1n[which(is.na(y1n))-96] arima1=arima(y1n,order=c(1,1,0),seasonal=c(2,1,1),method="css") predict1=predict(arima1,8) predict2[(((i-1)*4)+1):(((i-1)*4)+4)]=predict1$pred[5:8] } arima1 call: arima(x = y1n, order = c(1, 1, 0), seasonal = c(2, 1, 1), method = "css") coefficients: ar1 sar1 sar2 sma1 0.0241 -0.1122 -0.1068 -0.7830 s.e. 0.0188 0.0240 0.0224 0.0189 sigma^2 estimated 1490: part log likelihood = -14583.05 > predict1=predict(arima1,8) > predict1 $pred time serie

javascript - Datatables export buttons not showing, -

i want export data data table, i've tried could, i've read questions , answers of stackoverflow , documentation buttons issues till google's second page, i'm sure i've referenced required javascript's cdn , css required, no error in console, still export buttons not showing, here how initialized datatable, table.datatable({ dom: 'bfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ], "columndefs": [{ "defaultcontent": "-", "targets": "_all" }], bfilter: false, binfo: false, "bdestroy": true }); all functions of datatable required working fine except export buttons not showing up, last hope left on question, please me. for searching solution show buttons export excel spreadsheet or pdf or print view button when installing datatables through bower . you must install jszip ,

javascript - event prevent default not working within VueJS instance -

i'm trying disable form submission when enter key pressed. approaches i've tried listed below code , example demo. example of problem here desired outcome: focus on input, press down -> down -> enter , should log index of record have selected , stop there. what's happening: logs expected, reloads page form submits. html <form action="/some-action" @submit.stop.prevent="prevent"> <div class="auto-complete" v-cloak> <div class="ico-input"> <input type="text" name="search" placeholder="enter text" @keyup.prevent="handlekeypress"> </div> <ul class="raw auto-complete-results"> <li v-for="r in results" @click="loadselection($index)" v-bind:class="{'selected': selectedindex == $index}"><span>{{ r.name }}</span></li> </ul> </div> &

python - How to use dictionary for simpler invocation of attributes -

i exploring composition(has-a relationship) logic in python , have class student has address . trying store multiple student records using student_dict inside student. have graduatestudent subclass ing student . make use of dictionary , set id key , store corresponding details name, age, department value. later if try add student address becomes complicated when tried access them. example: student_dict.get(id)[1])[2] my question while adding address append existing details of student. adds address tuple , when accessing becomes tedious fetch additional indexing. can refer in add_address() method inside student , get_course() method in graduatestudent . below code , invocation. can have walk through , suggest way such can access values rather multi-dimensional indexing? class address(object): def __init__(self, street, pin): self.street = street self.pin = pin def __str__(self): return "address: {} {}".format(self.street, self.p

Check if a user is following me using Tweepy -

i using tweepy , want create script unfollow don't follow me back. i've created opposite ease: for user in tweepy.cursor(api.followers).items(): if not user.following: user.follow() but there seems not property holding whether user following me or not in api.friends . you can use api.exists_friendship(user_a, user_b) . returns true if user_a follows user_b . reference: http://docs.tweepy.org/en/v3.5.0/api.html#api.exists_friendship

How to insert int into Println method in C++ (arduino) SMS module -

how insert integer println method sms module. code doesnt work me sim900.println("your score : %d ", cel " point"); or i've tried one, wont sent integer. sent string. string point; int cel; string score; sim900.println(score); point = string(cel); score = "your score : ", point; shouldn't be: sim900.println("your score : %d point", cel); with int value after of quoted text?

split - django count specific rows in queryset -

class order(models.model): name = models.charfield(max_length=100) # other fields.. user = models.foreginkey(user) old = models.booleanfield(default=false) i want display orders of specific user, want split them "old" , ones not. so, in views.py : orders = order.objects.filter(user=user) in template: first table: <table> {% order in orders %} {% if not order.old %} <tr> <td>... </td> </tr> {% endif %} {% endfor %} </table> and table: {% order in orders %} {% if order.old %} <tr> <td>...</td> <tr> {% endif %} {% endfor %} this way have drawbacks, first, want count how many of orders "old", display number in template. can't, unless query. possible annotate(number_of_old=count('old')) ? or have query? so best? 1. 2 queries, 1 old=false, old=true, , pass 2 querysets template. , use |len filter on querysets 2. 1 query , split them somehow

angular - Angular2 RC - troubleshot disabled button -

these first question here, please tell me if i've done wrong fix :) i've got problem make [diabled] tag work correctly on button in form. here template : <form #loginform="ngform"> <label class="omwave">identifiant</label> <input type="text" class="omwave" [(ngmodel)]="login" placeholder="identifiant" name="login" required> <label class="omwave">mot de passe</label> <div class="input-group omwave"> <input type="password" class="input-group-field omwave" [(ngmodel)]="password" placeholder="mot de passe" name="password" required> <div class="input-group-button"> <button type="submit" (click)="gologin()" value="submit" class="" [disabled]="!isvalid"><img width=&qu

Updating Paypal Preapproved payment -

i've integrated adaptive payments preapproval option charge users periodically given amount of money. i'd give users option change amount they're paying - looking through paypal documentation can't seem find calls regarding modifying existing preapproval. is indeed not possible update preapproval, , option create new one? yeah, you'll have send user through sort of flow again anyway update options, pull current setup using preapprovaldetails , pre-populate update form user using details, let them adjust whatever want adjust, , submit new preapproval request create new agreement based on new options.

GCC ICU 57 static linking -

i trying link icu 57 binary file. not work thought (i think @ least) linking static lib files. here blunt example: gcc -static /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a /usr/lib/libicule.a /usr/lib/libiculx.a /usr/lib/libicutu.a /usr/lib/libicuuc.a /usr/lib/libicuio.a obj/ex.o obj/msg.o -o bin/ex this error message get: src/msg.c:5: undefined reference `u_fopen_57' src/msg.c:9: undefined reference `u_fgetfile_57' src/msg.c:10: undefined reference `u_fgetfile_57' src/msg.c:11: undefined reference `u_frewind_57' src/msg.c:18: undefined reference `u_fgetc_57' src/msg.c:17: undefined reference `u_feof_57' src/msg.c:25: undefined reference `u_fclose_57' linking dynamic libs works fine though. if can, i'd recommend using pkg-config recommended here , specifically pkg-config --static … explained here

onenote - Can groups be expanded when querying which students are associated with a class notebook? -

we query list of students associated class notebook via: /api/v1.0/me/notes/classnotebooks/{id}/students should group associated class notebook principaltype=group , id in form: c:0o.c|federateddirectoryclaimprovider|{id} so possible expand members of associated group(s) within call? if not, format of id? use via graph api requires id safe assume id 3rd piped element? thanks i ran application well. after conferring onenote team few months ago came down cannot expand these groups inside onenote api. must authenticate graph api , use groups functions there. downside of graph api permissions expand group require administrator grant them. in end recommend users create class notebooks using student email list rather azure group. (on final point format should remain consistent third piped element group id can pass graph api) specifically below endpoint groups members 'https://graph.microsoft.com/v1.0/myorganization/groups/' . $group_id . '/members'

Closing then opening standard input in C under Linux -

i have c console application under linux (raspbian - raspberry pi). program has character animation - prints out messages character character. example, text please give me name! is printed out after 5 seconds (char char). afterwards, user asked type in name, works fine if user waits message printed out. however, if user impatient , hits keys on keyboard randomly, input request later compromised. imagine user types in abc\nefgh\n while above text being echoed ('\n' means new line - enter). if happens, user not asked type in his/her name, array of characters 'abc' accepted input , gets validated. my question how disable input (buffering) temorarily (on linux). have tried several methods , read numerous posts doing so, none of them worked purpose. the function responsible asking input follows: int getline(char *s, int length) { int i; char c; (i = 0; < length && (c = getchar()) != eof && c != '\n'; i++)

sockets - Java - Error StreamCorruptedException: invalid type code: AC -

this question has answer here: streamcorruptedexception: invalid type code: ac 2 answers first of all, know , aware of duplicate question, in other answers, can't understand it! so, i'm doing client-server connection using java's sockets. have got class named listener, which, each time new client, assign client socket. repeatedly listening client, , if answer client, send method in interface "class"(this last thing isn't question, don't want asking it) code: while(!s.isclosed()){ ob = new objectinputstream(s.getinputstream()); try { handler.objectreceived(ob.readobject(), instance); } catch (classnotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } } where "s" socket, , "ob&q

json - JAVA Reflection - JoinPoint -

i'm trying use java reflection details execution , save in gray log. gray log methods accept join point parameters, can't information, i'd information cast json, can how ? this i've tried: methodsignature signature = (methodsignature) joinpoint.getsignature(); object[] args = joinpoint.getargs(); (object : args) { if (a.getclass().tostring().tolowercase().contains("request")) { method[] methods = a.getclass().getmethods(); (method m : methods){ if (m.getname().substring(0, 3).tolowercase().equals("get")) { object result = m.invoke(a); jarray = new jsonarray(); jobject = new jsonobject(); if (result instanceof list<?>) { ... } } } } } this implies have test instanceof same result, want info , parse json.

ms office - Evaluate a sub-formula of a formula -

after selecting cell having formula, select part of formula in excel formula bar , calculate (by pressing f9). need reproduce evaluation of sub-formulas javascript api. for example, let's assume values of cell a1 , b1 , c1 respectively 1 , 2 , 3 , , cell d1 contains formula =a1+b1+c1 . able evaluate sub-formula such a1+b1 , b1+c1 , , result 3 , 5 . in vba, under manual calculation mode, store initial formula of d1 in variable, , assign sub-formula (eg, =a1+b1 ) d1 result 3 , , restore initial formula d1 nothing happened; evaluation not raise calculation of other cells descendants of d1 (thanks manual mode). however, javascript api, re-calculation works under automatic mode. if assign sub-formula (eg, =a1+b1 ) d1 , cells descendants of d1 re-calculated ctx.sync , may costly. so there way or workaround optimise that? one possible workaround find isolated cell in workbook no cell depends on (eg, cell outside usedrange of worksheet, still need make sure no cel

android - Is there a way to group localised resources under same drawables folder and specify sizes inside? -

Image
i'm supporting several languages in application, result have image splash screen contains text, designed in special way (and because of can't use simple textview ). because of had provide image languages , sizes, results in huge , messy res folder: one thing thought , great if done group images lets under drawable-de same folder , there specify size. like: /drawble-de/hdpi /drawble-de/xhdpi does knows if done? thanks in advance.

java - How can I get the width and the height of a JavaFX Label? -

Image
there 2 methods getwidth , getheight return old label size if changed label text value. for example, in code, background not correctly resized: label speedlabel = new label(); rectangle backgroundlabel = new rectangle(); // initialization // change label text speedlabel.settext(connection.getspeed_bps()); // sets bigger number // adjust background backgroundlabel.setwidth(speedlabel.getwidth()); backgroundlabel.setheight(speedlabel.getheight()); after initialization, label that: and after text change , background adjustment, label that: i had @ post recommends deprecated method: how label.getwidth() in javafx the reason returning "old" size label doesn't updated on gui in moment when set textproperty of it, therefore size not changed. you can listen widthproperty , heightproperty of label , resize rectangle in listener: speedlabel.widthproperty().addlistener((obs, oldval, newval) -> { backgroundlabel.setwidth(newval.dou

gulp chown doesn't change owner -

i trying make build process, sort of, , seems gulp-chown doesn't give me correct results. this run: gulp.task('clientdeploy', function () { return gulp.src('client/dist/**/*') .pipe(chown('rf', 'rfids')) .pipe(gulp.dest('/var/www/html/dashboard')); }); the gulp script runs root, obviously. the result this: drwxr-xr-x 2 root root 4.0k jun 29 12:57 css/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 fonts/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 icons/ drwxr-xr-x 3 root root 4.0k jun 29 12:57 images/ drwxr-xr-x 2 root root 4.0k jun 29 12:57 js/ -rw-rw-r-- 1 root root 8.3k jun 29 13:15 events-panel.html -rw-r--r-- 1 root root 20k jun 29 13:15 index.html -rw-rw-r-- 1 root root 8.2k jun 29 13:15 main-panel.html i've read here on github problem might gulp.dest() doesn't read file's metadata, , uses user runs command. has ever come across , solved it? it bug in vinyl-fs . when writes file disk,

javascript - Socket.io client not receiving message event -

my project's skeleton of express-generator used workaround: here server: io.on('connection', function(socket){ socket.on('message', function(msg){ io.emit('message', msg); }); }); client:(src socket included) var socket = io.connect('//localhost:5000'); function op(){ socket.emit('message', $('input[name=yolo]:checked', '#myform').val()); }; socket.on('message', function(msg){ console.log("oo"); $("input[value=msg]").attr('disabled',true); alert($("input[value=msg]").val()); }); form form(action='' id="myform") ///form inputs input(type="submit" value="book" onclick="op()") connection made on both sides verified. message received server isn't emitting client side socket.on('message'... trigger. tested every step last socket.on('message'.. not triggering. cha

angularjs - Ionic framework Json data retrieving -

hai new ionic framework , frustrated implemented data dummy json . if know me. its simple. if content.js external file , located on root. follows. have embedded working plunker, play it. $http.get('content.js').success(function(response) { //whereever want put data }); here working plunker: http://plnkr.co/edit/hc3iy8hug23n7djis2hp?p=preview

How to access the 'rank' to a template which i have assigned for sorting objects in my Django views? -

Image
i have created rank attribute 'amount' object in django project views. page. tried {{ bid.rank }} in template. couldn't able rank particular 'amount' in template. please me how can rank value in page. here code: views.page: def bid_list(request): queryset = bid.objects.all().order_by('amount') current_rank = 1 counter = 0 bid in queryset: if counter < 1: # first bid bid.rank = current_rank else: # other bids if bid.amount == queryset[counter - 1].amount: # if bid , previous bid have same score, # give them same rank bid.rank = current_rank else: # first update rank current_rank += 1 # assign new rank bid bid.rank = current_rank counter += 1 context = { "bid.rank" : "current_rank", "object_list": querys

rest - processmaker's api ( how to get dynaform uid by process uid and task uid?) -

i can pro_uid , tsk_uid, how dynaform uid? http://wiki.processmaker.com/3.0/rest_api_designer#get_activity , get_activity's response have nothing dynaform. you can use url uids of steps of task. step dynaform, uid of dynaform specific task looking for. http://wiki.processmaker.com/3.0/rest_api_designer#get_steps_for_activity: .3c.2fcode.3eget .2fproject.2f.7bprj_uid.7d.2factivity.2f.7bact_uid.7d.2fsteps i encourage check out url: http://wiki.processmaker.com/index.php/processmaker_api it has full details of processmaker rest api related stuff.

assembly - Why EAX register content suddenly changed and leads to crash -

Image
in following screenshot can see disassembly of cstring function getlength() lead crash. taken dumpfile, post mortem. crash caused sudden change of register eax 0. how can 6a6a4547 6a6a4549 register eax changed. in 6a6a4547 should have been set 0x6a8e7054 (0x38324964 {0x6a8e7054}). can see in watch window. in 6a6a4549 eax "0". why , how? can find out cause? side information: call stack looks normal no problems in variables or threads its compiled vs2012 compiler target platform x86 its on virtual machine program runs many threads getlength called millions of times per hour it of wrote - a race condition . in more upper part of software object not locked sufficiently. therefore eax became 0 in first assembly line. after thread "corrected" memory , looks eax register has been changed. so of crashes homemade. thanks of you!

sql server - How can i set MySQL mode to 'ANSI' from an SSIS package -

i have ssis package transfers data mssql server 2008 r2 table mysql 5.6. set sql_mode='strict_trans_tables,no_auto_create_user,no_engine_substitution,ansi_quotes' in package, prior executing data flow task transfer, i'm first executing command above when real data transfer step reached i'm getting error similar below an exception has occurred during data insertion, message returned provider is: error: have error in sql syntax; check manual corresponds mysql server version right syntax use near '"mycolumn1", "mycolumn1") values (?, ?)' as investigated this, appeared though error can resolved setting mysql mode 'ansi' since i'm new mysql, thinking above command setting mode 'ansi', true? if isn't true, how can set mysql mode 'ansi' ssis package? also privileges need on mysql server? apparently, trick ssis run set session sql_mode= 'ansi'; command before inserting data wit

rust - Is there a fast way to check a Vec for an error result? -

i'm using rayon iterate on vector, producing vec of results: let coordinates = &[[38.5, -120.2], [40.7, -120.95], [430.252, -126.453]] let mut res = vec![]; coordinates .par_iter() .map(|pair| { match (check(&pair[0]), check(&pair[1])) { (ok(v1), ok(v2)) => ok([v1, v2]), (err(v), _) => err(v), (_, err(v)) => err(v), } }) .collect_into(&mut res); i'd check res error values, convert them string , return them using try!() this works, it's slow , inefficient, considering i'm allocating new vector aggregate results or pull out error: let errcheck: result<vec<_>, f64> = res.iter().map(|elem| *elem).collect(); try!(errcheck.map_err(|e| format!("error: {}", e).to_string())); this problem appears rayon-specific; if use .iter() , can collect directly errcheck using collect() , map_err() in match arms, can't seem using par_iter() . is there b

angularjs - Angular and Jasmine tests with mock $httpBackend -

i'm trying test method uses $http service mocking $httpbackend . method works fine in app, can't test work. here test code not work (i not result, , url correct: describe("authhelper", function() { var webhelper; var url; var $httpbackend; beforeeach(function(){ pingresponse = { principal: null, authenticated: false, servlet:true, timestamp:1468325333070 }; angular.mock.module('provisioning'); inject(function ($injector) { webhelper = $injector.get('webhelper'); url = webhelper.buildurl('/ping'); $httpbackend = $injector.get('$httpbackend'); $httpbackend.whenget(webhelper.buildurl('/ping')).respond(200, pingresponse); }); }); it("should pass if setup correct", inject(function(authhelper) { expect(true).tobe(true); console.log(url); au

speed up the process of import multiple csv into python dataframe -

i read multiple csv files (hundreds of files,hundreds of lines each same number of columns) target directory single python pandas dataframe. the code below wrote works slow.it takes minutes run 30 files(so how long should wait if load of files). can alter make work faster? besides, in replace function, want replace "_"(don't know encoding, not normal one) "-"(normal utf-8), how can that? use coding=latin-1 because have french accents in files. #coding=latin-1 import pandas pd import glob pd.set_option('expand_frame_repr', false) path = r'd:\python27\mypfe\data_test' allfiles = glob.glob(path + "/*.csv") frame = pd.dataframe() list_ = [] file_ in allfiles: df = pd.read_csv(file_, index_col = none, header = 0, sep = ';', dayfirst = true, parse_dates=['heureprevue','heuredebuttrajet','heurearriveesursite','heureeffective']) df.drop(labels=['apaye',&#

python - Different in List size -

Image
could explain me difference in list size ? once (x,1) , other (x,). think idexerror due that. thanks print(annotation_matrix) [array([[1], ..., [7], [7], [7]], dtype=uint8)] print(idx) [array([ true, true, true, ..., false, false, false], dtype=bool)] p.s. left 1 created with matlabfile.get(...) the right 1 in1d(...) an array of size (x,1) matrix of x rows , 1 columns (2 dimensions), differs a.t of size (1,x). have same elements in different 'orientation'. array b of size (x,) vector of x coordinates (1 dimension), without orientation (it's not row nor column). it's list of elements. in first case, 1 can access element a[i,:] same of a[i,0] (because has 1 column). in later, call b[i,:] causes error because array b has 1 dimension. correct call b[i]. i hope helps solve problem.

java - How can I get the list of all the items nested(hierarchy) within the item based on parent-child relationship? -

it's little bit difficult explain. in example code: public class someclass { private string id; private string parent; public someclass(string id, string parent) { this.id = id; this.parent = parent; } public string getparent() { return parent; } } list<someclass> somelist = new arraylist(); somelist.add(new someclass("test1", "none")); somelist.add(new someclass("test2", "none")); somelist.add(new someclass("test1mem1", "test1")); somelist.add(new someclass("test2mem1", "test2")); somelist.add(new someclass("test1mem1obj1", "test1mem1")); i want create function fetch objects containing object in it's hierarchy "parent" field. example if "test1mem1obj1", should give me values of "{test1mem1, test1}" , if "test2mem1", should give me values of "{test2}". fetche

watchkit - reloadTimeline() doesn't update complication -

i'm trying make watchos 3 app, , want update complication in background task. first, new data server in background task within handle() . after that, update active complications calling complicationserver.reloadtimeline(for:) . in console see message "update complication," code executed. yet after reloading, complication still shows old data. if switch watch face , switch back, complication reloads. have else reload complication background task? func handle(_ backgroundtasks: set<wkrefreshbackgroundtask>) { task : wkrefreshbackgroundtask in backgroundtasks { if (wkextension.shared().applicationstate == .background) { if task wkapplicationrefreshbackgroundtask { let dataprovider = dataprovider() dataprovider.getdata(station: "name", completion: { (data, error) in self.updatecomplication() self.schedulenextbackgroundrefresh() task