Posts

Featured post

javascript - Routing doesn't work when in for-loop -

i building website using polymer (>= 1.2.0) based on psk (polymer starter kit) . i running (probably noob) problem attempting centralize and/or automatize router configurations. i have appended following code end of psk's app.js file: //note: app.baseurl set psk's original code earlier in file: app.baseurl = '/'; app.routemap = [ {name: "home", text: "home", icon: "home", url: app.baseurl}, {name: "about", text: "about", icon: "face", url: app.baseurl + "about"}, {name: "portfolio", text: "portfolio", icon: "build", url: app.baseurl + "portfolio"}, {name: "contact", text: "contact", icon: "mail", url: app.baseurl + "contact"} ]; i replaced original routing-configuration code in routing.html new version, uses routemap : page('*', scrolltotop, closedrawer, function (ctx, next) { next(); ...

python - Representing more than single object/list CRUD ops with Django REST Framework ViewSets -

i've been writing game picking style webapp django , decided implement views api endpoints drf, give me more flexibility when comes frontend approaches. have basic serializers , viewsets each of models, , can browse them (excellent) browsable api. here couple: class sheetserializer(serializers.hyperlinkedmodelserializer): user = userserializer(read_only = true) league = leagueserializer(read_only = true) picks = serializers.hyperlinkedrelatedfield( source='pick_set', many=true, view_name='pick-detail', read_only = true ) class meta: model = sheet fields = ('url', 'id', 'league_week', 'user', 'league', 'picks') class gameserializer(serializers.hyperlinkedmodelserializer): class meta: model = game fields = ('url', 'home_team', 'away_team', 'week', 'home_team_score', 'away_team_score') class pickserializer(serializers.hy...

java - How to make some Action dependent on another Action's finish? -

action pasteaction = new defaulteditorkit.pasteaction(); jpopupmenu popmenu = new jpopupmenu(); menuitem = new jmenuitem(); menuitem.addactionlistener(pasteaction); menuitem.addactionlistener(searchaction); menuitem.settext("paste & search"); popmenu menu shown up; on mouse right click on jtextfield pasteaction ready made. searchaction has code check if jtextfield empty or not. if not empty, search... the problem - think - pasteaction , searchaction invoked simultaneously. searchaction invoked no matter pasteaction has finished job. when searchaction invoked check jtextfield content; founds empty! how make searchaction dependent on pasteaction 's finish? one option make generic action implementation takes in list of actions take in serial. loop on list, calling 1 @ time. use new implementation , add action listener.

c# - LINQ to SQL - Checking the field length -

Image
i getting rows access db. need check fields length. got work, problem if field comes null. check fails. how made check length (array[0] column name checked), , works: results = query.where(p => p.field<string>(array[0]).length > 10); now problem if field null. screen shot displays field coming empty , fails check. field number 25. how can make ignore nulls , still check length? you can try avoid nulls. results = query.where(p => !string.isnullorempty(p.field<string>(array[0])) && p.field<string>(array[0]).length > 10);

ios - How to go back to main scene when my game paused in sprite kit -

when pause game have pause scene. i put there 3 buttons : rateapp button backtomain button. resumegame button. what happens: rateapp button working. resumegame button working. not working : backtomain button. why? because game still pause. pausegame function func pausegame() { ispause = true self.view?.paused = true pointslabel.hidden = true boocharacter.hidden = true pausebutton.hidden = true if #available(ios 9, *) { recordbutton.hidden = true } pausescreen = skspritenode() pausescreen.name = "pausescreen" pausescreen.position = cgpointmake(self.size.width/2, self.size.height/2) pausescreen.color = uicolor.blackcolor() pausescreen.alpha = 0.9 pausescreen.size = cgsizemake(1242,2208) addchild(pausescreen) pauselable.text = "pause" pauselable.fontsize = 75 pauselable.fontname = "fut...

dependencies - Official guidelines for using functions newly added to base R -

i writing package performs statistical analysis while handling missing values. using wonderful, life-changing function anyna added sometime after 3.0 ( commit ). added function people might want use olsonnames . so using function, package won't work on older versions of r. see 4 options dealing this. make whole package depend on r >= 3.1 in description. redefine function in source. redefine function if user using <3.1 , don't define if using >= 3.1 or make function check version each time e.g. anyna <- function(x) if(as.numeric(r.version()$minor) > 3.1){ return(anyna(x) } else { return(any(is.na(x)) } } or if(as.numeric(r.version()$minor) > 3.1){ anyna <- base::anyna } else { anyna <- function(x) any(is.na(x)) } i'm not sure second 1 work in package source code. rewrite code using any(is.na(x)) . my concrete question is there official cran preference 1 of these ? failing that, there reasons use 1 ...

Sorting objects in array within mongodb -

i've seen question on google/so/mongo docs, , i've tried implement solution, it's not working me. have following test database: > db.test.find().pretty() { "_id" : objectid("56b4ab167db9acd913ce6e07"), "state" : "helloworld", "items" : [ { "guid" : "123" }, { "guid" : "124" }, { "guid" : "123" } ] } and want sort "guid" element of items. running sort commands yields: > db.test.find().sort( {"items.guid" : 1}).pretty() { "_id" : objectid("56b4ab167db9acd913ce6e07"), "state" : "helloworld", "items" : [ { "guid" : "123" }, { "guid" : "124" }, { "guid...