Posts

javascript - Why isn't the else block firing? -

i'm making html canvas game (tron), , i'm want game detect when player hits border of canvas. have if statement checks if player in contact either own trail or opponents, , works fine, parameter being outside of canvas ( y >= 780 ) doesn't seem doing anything. added snippet. there's library key event handling in there, that's not code (the library no longer necessary after made changes shouldn't have problem). time. /*! keydrown - v1.2.2 - 2016-03-23 - http://jeremyckahn.github.com/keydrown */ !function(a){var b=function(){var b={};b.foreach=function(a,b){var c;for(c in a)a.hasownproperty(c)&&b(a[c],c)};var c=b.foreach;b.gettranspose=function(a){var b={};return c(a,function(a,c){b[a]=c}),b},b.indexof=function(a,b){if(a.indexof)return a.indexof(b);var c,d=a.length;for(c=0;d>c;c++)if(a[c]===b)return c;return-1};var d=b.indexof;return b.pushunique=function(a,b){return-1===d(a,b)?(a.push(b),!0):!1},b.removevalue=function(a,b){var c=d(a,b);r...

sorting two times based on status and title java android -

well have class named data: public class data implements comparable<data>{ public string title; public string description; public string inststatus; public int imageid; data(string title, string description, int imageid,string inststatus) { this.title = title; this.description = description; this.imageid = imageid; this.inststatus = inststatus; } @override public int compareto(data another) { if(this.inststatus.equals("present")){ return this.title.compareto(another.title); }else // not present return this.inststatus.compareto(another.inststatus); // ascending } } now if see class comparing based on title in ascending order want sorting on 2 rules inststatus has 2 values :- "present" , "not present" 1. inststatus = "present" should come on top , after that, of them should sort in ascending order 2. inststatus = "not p...

c# - Asp.net Core + Entity Framework 7 optimizations? -

have few questions how ef7 + asp.net core works... 1) assume following tables: users pk=id, etc. roles pk=id, etc. userroles fk=users.id,roles.id when (pseudo) _context.users.where(x => x.username == "bob").include(...userroles...).theninclude(...roles...) , debug output, appears ef7 doing optimization , pulls minimal stuff needs populate user poco bob , roles? going hit database every time run statement? i.e. lets first time run it, bob has role of "user". if update table give him role of "admin", going re-pull everything? if delete roll, next time run query, going re-sync everything? 2) appears, in ef7, can't scaffold stored procs, correct? have schema similar this: tablea tableatob tableb tablebtoc tablec if catch drift, tablea has m:m relationship tableb (tied tableatob) , tableb has m:m relationship tablec. what i'm after tablec.name values tablea.name="blah", need join 5 of tables together. if in ef7 table scaff...

linux - Move directories Excluding file -

i have 40 directories , 1 shell.sh file in directory. want move directories other directory excluding shell.sh file. 40 directory move other directory , shell.sh don't move remain same directory. there solution ?? go mentioned directory , run in terminal: find . -maxdepth 1 ! -path . -type d -exec mv '{}' destination_path \; this work directories spaces in name

node.js - Debugging in Loopback (Node) -

Image
i'm running issues , question when debug in loopback (probably same node server/node inspector). for reason in node inspector (slc debug or node-debug) when try use console option or add watch expression, hitting return doesn't process command returns cursor next line. have bad version of node inspector? in loopback able have access full application object when running in debug mode (which thing) , can use application object perform domain functions - e.g. m.models.accounts.count(function(err,returncount) { console.log(returncount) }; ); above i'm getting count of number of accounts in database. i'd prefer not deal promises , write m.models.accounts.count(). is there library or way this?

rest - Stripe API: What's my account ID? How to default it in GET /v1/accounts/? -

i'm beginning play stripe api, , i've hit don't understand: how determine identifer (e.g., acct_abcd1234blablabla ) of own stripe account? i'm not seeing sort of account identifier in temporary stripe test account (although maybe i'm not looking under proper tab of account settings pane). now, documentation " retrieve account " says: arguments account [optional] identifier of account retrieved. if none provided, default account of api key. and seems omitting account identifier uri would be reasonable way of getting one's own account identifier, since should property of returned json object. can't figure out how omit argument in way causes account object returned. given example invocation, explicit account identfier argument, looks like: curl https://api.stripe.com/v1/accounts/acct_abcd1234blablabla -u sk_test_foobarbaz: my expectation omitting final element of uri me default. if that: curl https://api.stripe.com/v...

node.js - Mongoose: Sort by latest Comment.creationDate in comments array of a forum post -

i have following object let threadschema = mongoose.schema({ author: { type: mongoose.schema.types.objectid, required: true, ref: 'user' }, title: { type: string, required: true }, content: { type: string, required: true }, id: { type: number, required: true, unique: true }, answers: [{ type: mongoose.schema.types.objectid, default: [], ref: 'answer' }] }) like can see, array of answer objects: let answerschema = mongoose.schema({ thread: { type: mongoose.schema.types.objectid, // article required: true, ref: 'thread' }, author: { type: mongoose.schema.types.objectid, // user required: true, ref: 'user' }, creationdate: { type: date, required: true }, content: { type: string, required: true } }) and want is, in mongoose query db, sort threads ones latest (newest) answers in them. i tried stupid as: th...