Posts

Angular-meteor ORM-like one-to-many relationship without infinite-digest issues -

i'm working on user-roles relationship, , code works except produces infinite digest error on angular side, think has performance implications. in user class (es2015), have: get roles() { return roles.findbyids(this._roleids).fetch() } and problem above getter returns new object every time, in angular's eyes, they're not equal. tried track by , follows: <ul> <li ng-repeat="role in user.roles track role._id"> {{role.name}} </li> </ul> which throws following exception: uncaught error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations: [[{"msg":"fn: regularinterceptedexpression","newval":20,"oldval":19}],[{"msg":"fn: regularinterceptedexpression","newval":21,"oldval":20}],[{"msg":"fn: regularinterceptedexpression","newval":22,"oldval":21}],[{"msg...

java - Tomcat application cannot see my $PATH variable -

there tomcat application thats been running on 1 of our servers (written else in our lab gone). know little tomcat , how works, i've narrowed problem down 2 solutions. the error i'm getting on webpage is: java.io.ioexception: cannot run program "hmmtop": error=2, no such file or directory server information tomcat version jvm version jvm vendor os name os version os architecture apache tomcat/6.0.26 1.6.0_65-b14-462-10m4609 apple inc. mac os x 10.6.8 x86_64 before os x update script worked fine. cannot find program called 'hmmtop'. program, 'hmmtop' located : /users/saierlab/bin/hmmtop, , exist. solution 1) tried changing file named 'myfile.java' use absolute path, looks this: string command = "/users/raven/bin/hmmtop -if=" + this.filename + ".fa"; this file located in "/usr/local/tomcat/webapps/avehas/web-inf/classes" however, when change nothing reflected. i'm not sure how c...

java - Securely Storing Keys in Android Keystore -

i making android application communicates server. i'm using token based authentication on server, , pass information client server, using asymmetric encryption. this how process goes generated public , private key exists before hand public key used encrypt information, , passed server client app uses private key decrypt information however, not know how securely store private key in keystore. if store during runtime, key out in code, , if send private key during rest connection, there's no point of having encryption because hacker can find both keys. can me on creating best possible solution? thx in advance!

javascript - Calling global function in Riot.js expression -

i trying call function declared in global namespace expression in riot.js. this not work: <strong>created { getdatestring(item.created) } { item.creator }</strong> i can call global moment() function (from moment.js): <strong>created { moment(item.created) } { item.creator }</strong> the overall javascript file containing function is loaded... if call getdatestring() this.on('mount') works: this.on('mount', function() { getdatestring(new date()); }); i don't understand how namespacing works in riot.js, , can't figure out why call getdatestring() failing in expression succeeding in mount function. can tell me i'm doing wrong? make sure globalfunction() declared @ global. scope of <script> tag inside tag definition not global. take care it. <my-tag> <p>{ someglobalfunction(message) }</p><!-- work --> <p>{ localfunction1(message) }</p><!-- won't w...

Use BatteryMeterView.java in android app -

i use batterymeterview.java aosp own app create battery icon responds level change, charging state, etc. i found source on github. possible integrate app create icon , percent text? i'm thinking .xml with <com.example.app.batterymeterview android:id="@+id/battery_icon" android:layout_width="8dp" android:layout_height="15dp" /> and batterymeterview.java file inside com.example.app also can use file in non open-source projects according current licence? time! this should be possible, need include resources , make decision on whether or not want have batterycontroller , ignore demomode . , make decision of whether want hasoverlappingrendering() . license details read more @ http://www.apache.org/licenses/license-2.0 , you're interested in redistribution part.

regex - A tiny template language -

i pass string "partial" sql statement like: "select %fields% ... %order% %limit%" then want replace %fields% either real list of fields (which array) or count(*) . likewise replace %order% either order ... (which generate) or empty string , %limit% either limit ... (which generate) or empty string. i want way prevent these sequences replaced. example may "turn off" replacing if percents doubled: %%fields%% should not replaced list of fields replaced literal %fields% . note not insist namely on syntax. instead of percent signs may use other escape syntax (for example ${fields} or {{fields}} ). i want easy , (what more important) efficient way this. note use perl. maybe, should not invent own template language regexps , use perl module template::tiny ? efficient? #!/usr/bin/perl use strict; use warnings; sub myreplace { ($tmpl, $hash) = @_; %hash2; foreach $key (keys %$hash) { $hash2{"%$key%"} = $hash-...

javascript - What is the scope of the callback on my vanilla JSONP -

a little backstory, i'm using twitch (game streaming service) api pull list of followers channel on site. in order around cors rules i'm using jsonp. personally, prefer use vanilla javascript on libraries learned how excellent article on over https://cameronspear.com/blog/exactly-what-is-jsonp/ . below simplified javascript (the actual code isn't extremely necessary, maybe it'll clarify question afterward): //function pull jsonp function pulljsonp(url) { var jsonpinstance = document.createelement('script'); jsonpinstance.src = url; jsonpinstance.onload = function () { this.remove(); }; var head = document.getelementsbytagname('head')[0]; head.insertbefore(jsonpinstance, null); } //end function pull jsonp function storecurrentfollows(offset) //function wrap entire operation { function pullstartsessionfollows(jsondata) //callback jsonp down below { function pushnameelements(followentry)...