Posts

Showing posts from July, 2011

mysql - SQL Join issue with two tables -

select tablea.z, count(tablea.z), count(tableb.y) tablea join tableb on tablea.y = tableb.y group tablea.z; i'm trying count(tableb.y)/count(tablea.z) . each 1 works fine when find them individually when join tables shown above, count(tablea.z) turns count(tableb.y) . any tips? you need able evaluate 2 table counts independently of each other: i may have trying count wrong, hope helps give idea on going on select a.z, a.numrows / b.numrows calc -- perhaps error checking avoid /0 error (select z, count(*) numrows tablea group z) join (select z, count(*) numrows tableb group z) b on a.z = b.z

Select folder with current date in jBASE -

im stuck have created folder current date (e.g test.20160419) , want select folder , copy records in folder through jbase command. can me in this. you need use copy (jbase knowledgebase) command trying achieve. for specific scenario, assuming want copy records src.table table test.20160419, command should be: copy src.table test.20160419 if need copy of records in src.table can select (jbase knowledgebase) before so select src.table @id = "a]" 3 records selected >copy src.table test.20160419 this copy selected files (in case starting a).

angularjs - what's the difference for the controller arguments, one is wrapping services and return function in a array -

what's difference controller arguments, 1 wrapping services , return function in array, it seems type 1 obeys dry principle. i don't meaning of difference between following 2 syntax? type 1 app.controller("userctrl", ['$scope', '$http', '$resource', 'users', 'user', '$location', function($scope, $http, $resource, users, user, $location) { .... }]); type 2 app.controller("userctrl", function($scope, $http, $resource, users, user, $location) { .... }); difference how angular find dependencies. with type 1, angular uses string find dependencies, can have own parameter names. i.e. app.controller("userctrl", ['$scope', '$http', '$resource', 'users', 'user', '$location', function(s, h, r, us, u, l) { .... }]); with type 2, angular uses parameter names find dependencies, can't use whatever name like, otherwise, angul

azure - How frequently the Traffic Manager monitors endpoints -

Image
how traffic manager monitors endpoints? it's obvious it's not event driven (when endpoint down takes up-to 30 secs - 2.5 mins identify status of endpoint per observations). can configure frequency, cannot see configuration this. is there relationship between traffic manager monitoring interval , ttl? this may general question, real issue experience service downtime in fail on scenario (fail on of primary). understand effect in ttl until client dns cache expires calling cached endpoint. spent lot of time on , have narrowed down specific question. issue there delay in traffic manager identifying endpoint status after it's stopped or started. need logical explanation this, not find azure reference explains this. traffic manager settings i need understand delay , plan down time. i have gone through same issue. check link, explains monitoring behaviour traffic manager monitoring the monitoring system performs get, not receive response in 10 seco

Multi-line regex with multiple matches and negative conditions in python -

i reading text file , attempting capture 1 of arguments of each distinct tag, has not been commented out. more specifically, have following input... maybe there text \thistag[arg1=1,argtwo]{want0} % \thistag[arg1=1,argtwo]{notwant} % blah blah \thistag[arg1=1,argtwo]{notwant} \thistag[arg1=1,argtwo]{want1}\thistag[arg1=1,argtwo]{want2}\\stuff \sometag{stuff don't want}[{\thistag[arg1=1,argtwo]{want3}}]{more stuff don't want} \thistag[arg1=1,argtwo]{obv_want} i want following output want0 want1 want2 want3 obv_want so far have following code, doesn't accomplish want with open(target, "r") ins: f = re.findall(r'^(?:[^%])?\\thistag\[.+\]{(.+?)}(?:{.+})?', ins.read(),re.multiline) you regex line line filtering out ones start % : import re res = [] open('test.txt') f: res = sum([re.findall('\\thistag\[.*?\]{(.*?)}', line) line in f if not line.startswith('%') ], []) p

java - Loop prints output twice after initial loop -

**removed code prevent copying ongoing assignment problem - loop prints output twice the problem s.nextint() command reads int value. when continue reading s.nextline() "\n" enter key. skip have add s.nextline() . hope should clear now. try that: system.out.print("insert number: "); int number = input.nextint(); input.nextline(); // line have add (it consumes \n character) system.out.print("text1: "); string text1 = input.nextline(); system.out.print("text2: "); string text2 = input.nextline();

java - Merge Sort on Object Linked List (ascending order) -

i working on homework assignment , after days of effort cannot figure out why, after mergesort implemented, list contains last object in linked list. not output entire linked list, last object. how can change code stop list turning null after 1 object. please note: though call them cubes, know not since have random lengths, widths, , heights. assignment specifies called cubes, these random data fields. please ignore this. public class sortingcubes { public static void main(string[] args) { system.out.println(" "); system.out.println("-----my linked list-----"); cube headcubell = new cube(); //create head cube int llnum = 5; //change number of linked list items desired here for(int = 0; < llnum; i++) { headcubell.length = math.random() * 99 + 1; //create random l,w,h each cube (between 1-100) headcubell.width = mat

java - Building a summation from analyzing code? -

i have midterm tomorrow, , supposed able analyze code. thing don't understand @ all. given this: consider java method comparing 2 strings. method has 2 inputs , should use 2 variables express running time. let n length of a , let m length of b . can express running time function of n and/or m . if assume without loss of generality n < m . private static int comparestrings ( string , string b) { int = 0; while ( < . length () && < b. length ( ) ) { if (a . charat ( ) < b. charat ( ) ) return −1; if (a . charat ( ) > b. charat ( ) ) return 1; ++; } if (a . length () < b. length ( ) ) return −1; if (a . length () > b. length ( ) ) return 1; } a) express worst case running time of method sum. b) simplify sum , state big-oh bound. the notation need in : n Σ i= 1 i don't understand how build sum out of code, or it's running time. step step in

sql - Query to add few fields in subquery -

select t0.docdate [grpo posting date], t0.docnum [grpo num] ,t0.cardname opdn t0 year(t0.docdate) ='2016' , (dateadd(day, 1, t0.docdate) in ( select odln.docduedate odln year(docduedate) = '2016' ) this query works fine.but need fetch other information. don't know how add existing query. for e.g. apart grpo posting date, grpo num, cardname, need fetch odln.docnum, odln.docduedate have using in sub query. please me amend query or new query requirements. what want inner join odln : select t0.docdate [grpo posting date], t0.docnum [grpo num], t0.cardname, t1.docnum, t1.docduedate opdn t0 inner join odln t1 on dateadd(day, 1, t0.docdate) = t1.docduedate t0.docdate >= '20160101' , t0.docdate < '20170101' , t1.docduedate >= '20160101' , t1.docduedate < '20170101' note: avoid using functions on columns in where clause

php - Counting number of children -

having 2 mysql table looking this: table parents +-------+-----------+-----------+ | id | name | birthdate | +-------+-----------+-----------+ | 1 | mary | 1974-05-02| | 2 | john | 1970-06-03| | 4 | james | 1984-07-04| table children +-------+-----------+-----------+-----------+-----------+ | id | parent | name |birthdate | gender | +-------+-----------+-----------+-----------+-----------+ | 1 | 1 | sara |2013-10-22 | female | | 2 | 1 | jack |2014-05-02 | male | | 3 | 1 | jill |2015-06-07 | female | | 4 | 2 | sam |2015-06-07 | male | | 5 | 2 | fred |2015-06-07 | male | | 6 | 3 | julie |2015-06-07 | female | | 7 | 4 | megan |2015-06-07 | female | how retrieve number of parents (count) have 3 children? +---------+ |total | +---------+ | 1 | use count , having :

ios - PHP MySQL request from Objective-C iPhone app not POST-ing to my table -

i'm trying make simple app posts data mysql server (wamp or mamp) @ home, when go our robotics competition in st. louis, able add scouting data teams database , pull later. i'm having trouble getting data post table have set up. here objective c code: nsstring *myrequeststring = [nsstring stringwithformat:@"teamnumber=%@&matchnumber=%@&autogoal=%@&autoreachedow=%@&autocrosseddef=%@&teleopoffense=%@&teleopcrosseddef=%@&teleophighgoalsmissed=%@&teleophighgoalsmade=%@&teleoplowgoalsmissed=%@&teleoplowgoalsmade=%@&teleopendgame=%@&teleopdefense=%@&teleopshotsdef=%@&teleopshotsdisrupted=%@&teleoppenalties=%@", teamnumber, matchnumber, autogoal, autoreachedow, autocrosseddef, teleopoffense, teleopcrosseddef, teleophighgoalsmissed,

Render html background image using itext in asp.net -

i parsing html string build pdf file using itext in asp.net. problem not unable render background image in div tag. html string string data=" hello<div style='background:url(http://localhost:64744/openings.png);width:200px;height:300px;'></div>" default.aspx document pdfdoc = new document(pagesize.a4, 5, 5, 10, 10); system.io.memorystream mstream = new system.io.memorystream(); pdfwriter writer = pdfwriter.getinstance(pdfdoc, mstream); /*****************************/ stringwriter swpdf = new stringwriter(); htmltextwriter hwpdf = new htmltextwriter(swpdf); hwpdf.write(session["data"]); // above string stringreader sr = new stringreader(swpdf.tostring()); htmlworker htmlparser = new htmlworker(pdfdoc); pdfwriter.getinstance(pdfdoc, response.outputstream);

android - Encryption failed in Marshmallow -

i trying encrypt , decrypt data sd card tried oon code , working proper in lower version devices getting 1 exception in marshmallow. 04-19 09:56:50.428: w/system.err(15137): javax.crypto.badpaddingexception: pad block corrupted 04-19 09:56:50.432: w/system.err(15137): @ com.android.org.bouncycastle.jcajce.provider.symmetric.util.baseblockcipher$bufferedgenericblockcipher.dofinal(baseblockcipher.java:1011) 04-19 09:56:50.432: w/system.err(15137): @ com.android.org.bouncycastle.jcajce.provider.symmetric.util.baseblockcipher.enginedofinal(baseblockcipher.java:849) 04-19 09:56:50.432: w/system.err(15137): @ javax.crypto.cipher.dofinal(cipher.java:1502) 04-19 09:56:50.432: w/system.err(15137): @ com.example.encryptaudio.cryptofile.decrypt(cryptofile.java:34) 04-19 09:56:50.432: w/system.err(15137): @ com.example.encryptaudio.mainactivity$2.onclick(mainactivity.java:116) 04-19 09:56:50.432: w/system.err(15137): @ android.view.view.performclick(view.java:5201) 04-1

java - Binomial Coefficients. Recursion tree. How to avoid calculating same values multiple times -

i working program called binomialcoefficients . i did box trace on c(5,3) , returns 10 correct, noticed in full recursion tree c(5, 3) , value c(3, 2) evaluated 2 times, , c(2, 1) evaluated 3 times. what modification avoids computing same values multiple times? here function show context. public static int c(int n, int k) { if(k>n) return 0; else if(k==0 || k==n) return 1; else return c(n-1, k-1)+c(n-1, k); } one modification use multiplicative formula . you'd have consider integer overflow.... ( edit: have @ @ ajb said in comment) i'd suggest using map caching result: map<string, integer> cache = new hashmap<>(); public static int c(int n, int k) { string cachekey=key(n,k); if (cache.containskey(cachekey){ return cache.get(cachekey); if(k>n) return 0; else if(k==0 || k==n) return 1; else { int result = c(n-1, k-1)+c(n-1, k); cache.put(cachekey, result); return r

Angularjs : Show the count of new messages -

i working on chat application , there want show count of new messages. <div class="people" > <div ng-repeat="user in allcompanyusers"> <div class="person" ng-click="activatechat(user); bubble=true" id="chat_{{user.id}}"> <img alt="" /> <span class="name" >{{user.firstname}} {{user.lastname}} <span ng-if="!bubble" class="noti_bubble">{{count}}</span></span> <span class="preview"></span> </div> </div> </div> <div class="chat active-chat"> <div ng-repeat="c in activeconversations track c.time| orderby:'time':false"> <div class="bubble" ng-class="c.type"> {{c.message}} &nbsp;

assembly - Nasm x86 modified char in array -

i have defined array section .bss : textlenght equ 1024 ; define length of line of text data text resb textlenght ; define array hold text then use getchar put char file using stdin : all getchar ; call getchar input stdin, char save in eax cmp eax, -1 jle done ; if return -1, @ eof mov [text+esi], eax; put char eax array add esi, 4 ; increase array index jmp read ; loop function so how go shifting char in text 1 letter 'a' become 'b' ? thank add 1 eax before move array. or, if have put in array, , register x 4 times index, can do add [text+x], 1

jquery - How to add meta tag on head and click through tags using edge animate -

so, noob here. designers have built web banners me using edge animate , media agency asking add click through tags per below: click-through tag requirements the html file must include meta tag indicating element in ad triggers clickthrough. specify click-through element ‘click.through’ meta tag. insert html file’s clickable element id says myclickableelementid: format: <meta name=”click.through” content=”myclickableelementid” > ensure html file contains element specified id. id should set on <img> , not on wrapping <div> s. <div id=”cta”> <div id=”cta_copy”><img id=”myclickableelementid” src=”button.png” ></div> </div> can provide instruction here on how can within adobe edge animate? can add header text original file, don't know how add right code in injected script banner link meta tag. you don't use edge animate this. you use edge animate create animation. use regular html editor create html do

How to work with real time streaming data/logs using spark streaming? -

i newbie spark , scala. i want implement real time spark consumer read network logs on per minute basis [fetching around 1gb of json log lines/minute] kafka publisher , store aggregated values in elasticsearch. aggregations based on few values [like bytes_in, bytes_out etc] using composite key [like : client mac, client ip, server mac, server ip etc]. spark consumer have written is: object logsanalyzerscalacs{ def main(args : array[string]) { val sparkconf = new sparkconf().setappname("logs-aggregation") sparkconf.set("es.nodes", "my ip address") sparkconf.set("es.port", "9200") sparkconf.set("es.index.auto.create", "true") sparkconf.set("es.nodes.discovery", "false") val elasticresource = "conrec_1min/1minute" val ssc = new streamingcontext(sparkconf, seconds(30)) val zkquorum = "my zk

java - Wrong Y coordinate from TextView on Bitmap using Canvas.drawText -

please me problem or @ least give me advice. have imageview overlayed textview. user can drag text position on image. after, want save image text @ chosen position. layout (textview add dynamically root element): <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_horizontal|center_vertical"> <framelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/root" android:padding="0dp" android:layout_margin="0dp"> <imageview android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:adjustviewbounds="true" android:scaletype="centerinside"/> </framelayout> </linearlayout> all pro

scala - Issues with datastax spark-cassandra connector -

before go ahead , explain question can please tell me difference between sparksql , cassandrasqlcontext ? i trying run scala code(don't want create jar testing purpose) on spark-cassandra cluster. so, have following code basic query on cassandra. every time run code following error : java.lang.classnotfoundexception: com.datastax.spark.connector.rdd.partitioner.cassandrapartition even though have mentioned same in build.sbt. moreover, have tried give explicit path of connector(in scala code using sc.addjar or using sparkconf.set() ) have created separately. still doesn't work. fyi, using spark-1.6, cassandra-2.1.12 , scala-2.10 import org.apache.spark.sparkcontext import org.apache.spark.sparkconf import org.apache.spark.sql.cassandra.cassandrasqlcontext object simpleapp { def main(args: array[string]) { val conf = new sparkconf(true).set("spark.cassandra.connection.host", "172.16.4.196").set("spark.executor.extraclasspath&qu

openssl - PayPal Error: IPN was not sent, and the handshake was not verified -

i trying information paypal using ipn (sandbox). when enter address: https://my.site.com:4576/script.py i error: paypal url port number not allowed ipn. according paypal ipn on port other 80 paypal not allow ports other 80 , 443. when change address to: https://my.site.com/script.py i error: ipn not sent, , handshake not verified. please review information. according paypal ipn simulator getting error? means ssl outdated when run command openssl s_client -connect api-3t.sandbox.paypal.com:443 -showcerts -capath /etc/ssl/certs/ in server verify return code: 0 (ok) means ssl date. how can make ipn work?

Youtube: How to get all video IDs to a Channel / User? [V3] -

i'm kinda lost in youtube data api v3. can guys give me hints on how video ids given channel / user? thanks in advance. check documentation search.list . videos channel get https://www.googleapis.com/youtube/v3/search?part=id&channelid=uciij33el2eakaxbzvelc2bq&type=video&key={your_api_key} if want videos authenticated user. doesn't appear can search videos user not authenticated . cant send users id example. get https://www.googleapis.com/youtube/v3/search?part=id&formine=true&type=video&key={your_api_key}

c# - Monitor.Exit() sometimes hangs -

i seem have concurrency problem when using monitor.enter , monitor.exit. code hangs on following monitor.exit statement: public void endinit() { monitor.enter(this.lockobj); this.initcount--; if (this.initcount == 0) { this.isinitializing = false; this.isinitialized = true; this.oninitialized(); } // sometimes, exit never return ... monitor.exit(this.lockobj); } there's 1 other place, lockobj used: public void begininit() { monitor.enter(this.lockobj); this.initcount++; this.isinitializing = true; this.isinitialized = false; monitor.exit(this.lockobj); } and that's how declare sync object: private readonly object lockobj = new object(); i'm tearing hairs off find out, going on here, no success. i'd expect monitor.enter() block until sync object gets released, why monitor.exit() blocked? can't find explanation behavior in msdn either. note can't reproduce behavior, occurs r

Yii2 change username on creation -

i want app detect when username taken , change it. in fact, when user register himself enter last , first name , username lastname.firstname. how detect username taken , how change (add number example) ? thanks. so should override beforevalidate() function, bellow sample code: /** * @inheritdoc */ public function beforevalidate() { /** code here **/ $isexist = static::find()->where(['username' => $this->username])->count(); if($isexist){ //count total rows similar username $total = static::find()->where(['like','username', "{$this->username}%"])->count(); //we add $total + 1 username have new unique username $this->username .= '-' . ($total+1); } return parent::beforevalidate(); }

sonarqube - SonarLint for Eclipse supports the C/C++ plugin? -

with version 2.0 of sonarlint plugin eclipse it's possible sync rules sonarqube 5.2+ server instance. by default there no c language support in sonarlint if server instance has installed c plugin , does mean sonarlint can analyze c projects? with version 2.0 can establish connection sonarqube server (5.2+) , bind eclipse project sonarqube project. ... sonarlint eclipse plugin provides on-the-fly feedback developers on new bugs , quality issues injected java, javascript , php code. source: http://www.sonarlint.org/eclipse/ (2016-04-19) sonarlint eclipse supports java, javascript , php. support other languages - including backed commercial plugins c/c++, in our backlog can't give eta yet.

aerospike - as_ldt_init failed to initialize -- C++ client -

just day before started work aerospike. have problem while writing 1 sample using ldt (large data types -- large list). want create key currdate appended key (20160419_2000_list) , later add raw data (byte array) list values. able connect database correctly, not able create key list. can please guide me on this. can refer following code idea of doing exactly. m_stfpkeystr.assign(datevalue); //datavalue consists datatime string m_stfpliststr.assign("list_"); m_stfpliststr.append(datevalue); as_key_init_str(&m_stfpkey, m_sinputnamespace.c_str(), m_sinputsetname.c_str(), m_stfpkeystr.c_str()); if (!as_ldt_init(m_stfplistkey, m_stfpliststr.c_str(), as_ldt_llist, null)) { memset(logmessage, 0x0, sizeof(logmessage)); sprintf(logmessage, "cdatabasemanager::savetfp fails initialize tfplist key %s", m_stfpliststr.c_str()); m_pcapturemanager->m_plogmgr->logmsg(logmessage);

Passing data thru RxJs operators -

while learning rxjs came problem. start operator chain object , use ooe of it's properties ajax request using flatmap need other object's properties passed along ajax result. came following solution, i'm sure there must way more elegant or efficient solution it. idea on how improve code? function fbinfo(ezfb){ const fbitems$ = rx.observable.from(lista) .map(item => object.assign( {}, item, {query: `/${item.page}/feed?limit=1`})) .do(x=>console.log(x)) .flatmap(item => { return rx.observable.frompromise(ezfb.getloginstatus().then((res)=>{return ezfb.api(item.query)})) .withlatestfrom(rx.observable.from([item]),(res, it)=> object.assign({}, res, it)) }).map(item => { return { mensaje: item.data[0].message, id: item.data[0].id, created: item.data[0].created_time, nombre: item.nombre } }) return fbitems$ } thanks in advance :) in terms of general

format - Rounding and formatting the nullable decimal in c# -

im using below code round decimal 2 decimal places. decimal? rtime = rtime.hasvalue ? decimal.round(rtime.value, 2) : 0; but converting numberlike 512->512.00 not working..how do that? decimal.round rounds value of decimal. example 512.123 512.12 . what want string representation . need format value instead of rounding . can use tostring() that: decimal? rtime = rtime.hasvalue ? decimal.round(rtime.value, 2) : 0; string rtimeasstring = rtime.value.tostring("0.00"); or string.format or string interpolation this: string rtimeasstring = string.format("{0:0.00}", rtime); string rtimeasstring = $"{rtime:0.00}"

sql server - How to set DENY permissions on a data user -

for .net application can store database connectionstrings <connectionstrings config="cnn.config" /> i trying little permissions possible there seems different way. info. i using settings because more secure 1 , 2 have other people working on application. so i've set use database_name; grant execute [security_account]; so user can execute commands that's fine. then i've got db_reader , db_writer can read , write , seems perfect marriage. still bad news user can login , see tables , store procedures definitions not alter them, however, can still see them. how can set permissions user can read, write. execute, , period!? being able see definition of tables, stored procedures, etc governed view definition permission. can do: deny view definition [youruser]; and user won't able see definition object in database. includes ability see other users.

java - Notify loop with up toolbar button android -

first of sorry horrible english, problem: i have mainactivity.class set alarmmanager, @ specific time alarmreceiver check on database if there specific record. if check result false, start service show notification. the notification open mealactivity.class give user's possibilities insert record on database (the same of alarmreceiver's check) , set new alarm (at least +5 hours). the problem begin when, on mealactivity.class, without insert record, click on "up button" on toolbar on father activity (mainactivity.class) , here, in mainactivity, receive new notification, same previous. why should not because next notification alarm has been set @ least 5 hours later, more few seconds. why? in mealactivity, if press "up button", want come mainactivity without notification. next notification should appear @ appointed time. how can resolve this? mainactivity.class: public class mainactivity extends appcompatactivity { private alertdialog aler

ios - "Share on facebook" opens my app -

my ios app integrates facebook login, , works fine within app. problem starts when tries share facebook using app (say, instagram) - in cases, attempt share opens app. i tried find references similar bugs online , couldn't. did encounter similar? the app written in swift, , integrates fbsdkcorekit 4.10.1, fbsdkloginkit 4.10.1. thanks :) check projects info.plist file lsapplicationqueriesschemes parameter.

Matching a complex expression in python regex -

i have create unique textual marker in document using python 2.7, following function: def build_textual_marker(number, id): return "[xxxcixxx[[_'" + str(number) + "'] [_'" + id + "']]xxxcixxx]" the output looks : [xxxcixxx[[_'1'] [_'24']]xxxcixxx] and have catch occurrence of expression in document. ended following regular expression seems not working fine: marker_regex = "\[xxxcixxx\[(\[_*?\])\s(\[_*?\])\]xxxcixxx\]" i wondering how should write correct regex in case? try using \[xxxcixxx\[\[_'.*?'\] \[_'.*?'\]\]xxxcixxx\] demo: http://regexr.com/3d887

Button not same width HTML & CSS -

i have issue buttons on website, not same width, have tried setting width no result. css .menulist{ text-align: center; margin-top: 2em; } .litem{ display: inline-block; margin-left: 1em; margin-right: 1em; max-height: 1em; } .btn{ text-decoration: none; color: white; margin: 0 auto; padding: 1em 4em 1em 4em; font-family: 'raleway'; border: 2px solid white; } html <ul class="menulist"> <li class="litem"><a class="btn" href="#">cooking</a></li> <li class="litem"><a class="btn" href="#">technique</a></li> </ul> css changes : .menulist{ text-align: center; margin-top: 2em; } .litem{ display: inline-block; margin-left: 1em; margin-right: 1em; line-height: 2.4em; max-width:184px; width:184px; border: 2px solid white; } .btn{ text-decorati

knockout.js - Set initial value of computed or supress the first evaluation -

[this seems impossible. answer question myself later] this question largely continues my pervious one . use "async computed" approach refresh parts of page. michael best solved issue updates of invisible parts of ui. 1 annoying thing still here. how can set initial (default) value computed observable? try avoid multiple ajax calls during page load. instead of embed json page load @ once. seems trivial (common)? can't supress first evaluation of async computed. ajax call made in case. use approach: var isfirsteval = ko.observable(true); updatecomputed = ko.purecomputed(function () { updatetrigger(); if(isfirsteval()){ isfirsteval(false); result(initialvalue); } else result(evaluator.call(owner)); }); but face the same issue, in previous question: computed never subscribe on evaluator changes, because of approach knockout uses reevaluate computed observables. suggestion similar question works because checks first evalu

javascript - AngularJS perform action after $scope.emit -

i need perform action after call $scope.emit(...) has finished processing (i.e. handlers/listeners have completed), how can that? $scope.$emit("nserror:setpage", { page: page, ele: ele });// tell page directive set current page errored item visible alert('here'); currently, alert happens before ui updated correct page. ' $scope.$emit has finished' not same thing 'ui has updated'. ui updated, digest cycle must complete. can wait happen using angular's $timeout function (don't forget inject in controller): $timeout(function(){alert('here');});

ruby - could not install rubygems that is required in the project -

i have projects git , cannot run them can sse require "rubygems" after command "gem install rubygems" can see enter image description here i can see tests failed when there projects "gemfile" file

java - Jumping pair lines using .readLine() method at a while loop -

i new @ java , having little trouble: i trying read chemical samples represent them @ x-y graph. the input file looks this: la 0.85678 ce 0.473 pr 62.839 ... ... my code stocks unpair lines value (0.85678, jumps line, 62.839 @ example), , cannot realize problem: public class procces { public void readree() throws ioexception { try{ ree = new bufferedreader (new filereader ("src/files/test.txt")); while ( (currentline = ree.readline() ) != null) { try { (int size = 3;size<10;size++) { string valuedec=(currentline.substring(3,size)); //char letra =(char)c; if ((c=ree.read()) != -1) { system.out.println("max size"); } else valued = double.parsedouble(valuedec); system.out.println(valuedec);

Android performance: place resources in common library or in each project -

i'm creating android project have 2 versions, , i'm planning use library place common code both versions. i not find info related performance of resources: better place images, logos etc in common library, or place them in each of projects? to reduce duplication, you'd put them common library. there's better way if you're using gradle(which android studio supports), build variant . with method, can build multiple various versions of single app.

java - Purpose of @Min.List annotation -

looking @ @javax.validation.constraints.min 's documentation: the annotated element must number value must higher or equal specified minimum. and looking @ @min.list see: defines several {@link min} annotations on same element. when useful define more 1 min annotation on same element? // example: defining more 1 @min on same element. @min.list(@min(1), @min(2), @min(3)) private int someint; what mean? unfortunately can't add comment...but think can read explain java bean validation: how specify multiple validation constraints of same type different groups?

mpi - MPI_Rsend:how to know that a receive buffer is already posted -

by mpi_rsend man papers ,in order use mpi_rsend,we need guarantee receive posted. error if receive not posted before ready send called.but how guarantee receive posted ???.i try find examples mpi_rsend,but can not find anything.and how error ? in link mpi_rsend_error ,finally 1 said : " simply not use mpi_rsend - archaism, behaviour not well-defined, , made obsolete of protocol optimisations in modern mpi libraries ".so,which mpi libraries implement rsend ? in fact,using mpi_rsend give better performance mpi_send in algorithms. example code: void allgather_ring_rsend(void* data, int count, mpi_datatype datatype,mpi_comm communicator) { int me; mpi_comm_rank(communicator, &me); int world_size; mpi_comm_size(communicator, &world_size); int next=me+1; if(next>=world_size) next=0; int prev=me-1; if(prev<0) prev=world_size-1; int i,curi=me; for(i=0;i<world_size-1;i++) { mpi_rsend(data+curi*size

reactjs - Webpack loads externals (and I wish it wouldn't) -

i'm starting react project es6 classes (and eslint airbnb config) , need webpack bundle them. i started react tutorial , tried using const react = require('react'); , const $ = require('jquery'); , realized bundle grew 15 kb 700 kb. decided include jquery , react , react-dom via <script/> tags. hash: 082980fb232d17977e55 version: webpack 1.13.0 time: 869ms asset size chunks chunk names bundle.js 13.3 kb 0 [emitted] app + 5 hidden modules but when remove const react = require('react'); , errors in code (e.g. : react must in scope when using jsx - react/react-in-jsx-scope). read docs webpack's externals , , tried doing : module.exports = { entry: { app: './main.js', }, output: { filename: 'bundle.js', }, externals: { jquery: 'jquery', $: '$', react: 'react', reactdom: 'reactdom', marked: 'marked', }, mod

php - Check chekbox when value of another element is changed -

i want check checkbox when value of "select" changed. no idea wrong code, maybe able see mistake: var selected; var div_id; $(".live_editor_test").focus(function() { selected = $(this).val(); div_id = $(this).closest("div").attr('id'); }); $(".live_editor_test").blur(function() { if (selected != $(this).val()) { $('#live-assigning_check_' + div_id).attr('checked', true); } }); live_editor_test class of select . div row element , parent of live_editor_test . live-assigning_check checkbox id. div_id increments there 1 row each mysql query. thanks in advance. .php : echo "<span class='content-row live-row-8' style=\"$colorcov\">"; echo "<select class=\"live_editor_test\" name=\"live_editor[$i]\" style=\"width:65px;font-size:10px;\">"; echo "<option value=\"\" selected></opt

javascript - Changing proportionally the size of a geometry when the window size changes using onWindowResize() function -

Image
i making first steps coding javascript. made courses , exploring webgl world using three.js i experimenting function used in examples of threes.org: function onwindowresize() { camera.aspect = window.innerwidth / window.innerheight; camera.updateprojectionmatrix(); renderer.setsize(window.innerwidth, window.innerheight); } with function can center geometry when reduce or increase width of browser's window , can make geometry smaller or bigger when reduce or increase height of browser's window. but thing when reduce height of window can see geometry because it's centered , smaller. when reduce width of window can't see geometry because it's centered not smaller. in example: http://codepen.io/gnazoa/pen/bjobzz tried avoid problem using object.scale.devidescalar(1.5); in onwindowresize() function, doesn't makes change. i searching solution because consider important correct experience, because mome