Posts

ios - How to get the Entity property from which an average is taken in CoreData -

i've fetched values coredata entity , averaged , groupedby date results. query works great. now... i've want know dates results come from. output shown raw result. how make query spit out date / groupby value (given groupby criteria date) averages taken from the output ( { averageweight = 36; }, { averageweight = 22; } ) the code: nsfetchrequest *request = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"exercisedata" inmanagedobjectcontext:context]; [request setentity:entity]; // specify request should return dictionaries. [request setresulttype:nsdictionaryresulttype]; // create expression key path. nsexpression *keypathexpression = [nsexpression expressionforkeypath:@"weight"]; // create expression represent function want apply nsexpression *expression = [nsexpression expressionforfunction:@"average:" ...

c# - Set default text in textBox on button click -

i'm wondering how set default text in textbox on button click. when users closes form , open again text in textboxes stay. if closes entire app. tried code below, think solution way far working one. thank time. private void btn_savetext_click(object sender, eventargs e) { this.textbox1.text = textbox1.text; this.textbox2.text = textbox2.text; this.textbox3.text = textbox3.text; this.textbox4.text = textbox4.text; } it depends default text is? if going same value each time can set text property in design view, value in textbox each time. if want textbox save value user has put in, need way store information. possible ways be: set sql data insert/update procedure, set textbox load saved value sql table each time form loaded. set xaml, see question guide through that. (this option preferred setting sql data table store 1 value may bit extreme you). if want sessions advise looking here from nikita's comment save value .txt document also, ag...

php - I have define a class and instantiate it and after that I am calling methods of this class but it is not giving any output? -

code here: $obj instance of class user.i calling methods not showing output <?php class user{ public $name; public $age; public function _ _construct($name, $age){ $this->name=$name; $this->age=$age; } public function sayhello(){ echo("hiiiii".$this->name."!!!"); } public function sayage(){ $a=time()-strtotime($this->age); echo " hello age is".floor($a/(365*30*60*60)); } } $obj = new user('xyz','16 july 1980'); $obj->sayhello(); $obj->sayage(); ?> just remove $var $obj. call $obj <?php class user{ public $name; public $age; public function __construct($name, $age){ $this->name=$name; $this->age=$age; } public function sayhello(){ echo("hiiiii".$this->name."!!!"); } public function sayage(){ $a=time()-strtotime($this->age); echo " hello age is".floor($a/(365*30*60*60)); } } $obj = new user('xyz','16...

android - Libgdx - Actions; adding one action to multiple actors -

i have defined set of actions , trying add multiple actors. here's code: parallelaction actions = new parallelaction(); rotatebyaction rotateaction = new rotatebyaction(); rotateaction.setamount(rotationamount); scalebyaction scaleaction = new scalebyaction(); scaleaction.setamount(-0.01f); delayaction delayaction = new delayaction(); delayaction.setduration(0.05f); repeataction raction = new repeataction(); raction.setcount(100); actions.addaction(rotateaction); actions.addaction(scaleaction); actions.addaction(delayaction); raction.setaction(actions); for(monster mon : mons) // mons arraylist of type monster (which extends image) mon.addaction(raction); but above logic adds action last actor in arraylist. why can't use same action multiple actors? need define many actions actors, or there other way it? i looked upon pool here https://...

arrays - How to check that is list of objects or list of strings in javascript? -

does know how check list contain objects or strings? in javascript arrays untyped, meaning: nothing take care of in it, if don't yourself. since array composite structure addressed integer value, can check every address exact type stored inside. if array created else. however, array type if find objects, strings , int's in it? other options: create own structure specify type on creation , throw error in add(item) method if items type violated create own structure in add(item) take care of type , write in property of structure

Git Command to know current repository -

any command know remote repository connected to? if browse directory contains .git folder. can run command know remote repository .git folder mapped ? there no 1:1 local:remote mapping git repos. every repo can have several remotes, or none @ all. you can use git remote -v list of remotes in local repo's config. note these aliases convenience, , can directly fetch , push remote repos using urls.

Deleting global references in JNI -

i not sure means: virtual ~optimizer() { jnienv *env = getjnienv(); env->deleteglobalref(mjavaoptimizer); mjavaoptimizer = 0; } what confuses me delete global reference , set 0. isn't deleting enough? why assignment 0 part? thanks in code, being in c++ destructor, has no practical use. it's programming pattern. in many contexts, variable accessible (visible) before or after holds valid value. during times, preferable hold known value chosen value can tested (a sentinel value) and/or misuse reliably caught in defined way (e.g., null pointer vs bad pointer). setting variable standard invalid value serves comment operation has invalidated previous value, might not obvious reading of immediate code.