Posts

Javascript - Finding in subarray by value from another array -

i have 2 javascript objects: var classroom = { "number" : "1", "student" : [ { "number" : 1, "items" : [ { "key" : "00000000000000000000001c", "date" : "2016-04-21t17:35:39.997z" } ] }, { "number" : 2, "items" : [ { "key" : "00000000000000000000001d", "date" :"2016-04-21t17:35:39.812z" }, { "key" : "00000000000000000000002n", "date" :"2016-04-21t17:35:40.159z" }, { "key" : "00000000000000000000002Ñ", "date" :"2016-04-21t17:35:42.619z" } ] } ], } and var items = [ { "fields...

sql server - SQL Error of Cannot perform an aggregate function on an expression containing an aggregate or a subquery -

i executing query in sql giving me error "cannot perform aggregate function on expression containing aggregate or sub query." there can me it. stuck. thank here query. select [id] ,[name] ,sum(case when [code] = 1 case when exists(select * [sampletab] [id] = [id]and [code] = 2) case when exists(select * [sampletab] [id] = [id] , [code] = 4) 100 else 100 end else 100 end when [code] = 8 200 when code = 2 100 when code = 4 100 end ) "totl" [test].[dbo].[sampletab] group id , name my data here's version of query should results. select id, name, sum(scorepercode) ( select id, name, case when code = 1 100 when code = 2 50 when code = 4 20 when code = 8 200 end scorepercode [test].[dbo].[sampletab] ) x group id, ...

Generic fluent Builder in Java -

i'm aware there've been similar questions. haven't seen answer question though. i'll present want simplified code. have complex object, of values generic: public static class someobject<t, s> { public int number; public t singlegeneric; public list<s> listgeneric; public someobject(int number, t singlegeneric, list<s> listgeneric) { this.number = number; this.singlegeneric = singlegeneric; this.listgeneric = listgeneric; } } i'd construct fluent builder syntax. i'd make elegant though. wish worked that: someobject<string, integer> works = new builder() // not generic yet! .withnumber(4) // , here "lifted"; // since it's set on integer type list .withlist(new arraylist<integer>()) // , decision go string type single value // made here: .withtyped("something") // we've gathered type info along way .create(); ...

css - 3-column layout with non-scrolling fluid-width sidebars (jsFiddle) -

i looking create three-column layout left column fixed width , middle , right columns each 50% of remaining width. want left , right columns non-scolling. i have achieved partial success in 2 different ways. the first creates fulfils dynamic columns goal right sidebar scolls page. did fixed position left column , fixed position container take whole page. put right sidebar in second container width set 50%. <section id=leftsidebar> <p> leftsidebar </p> </section> <div id=main> <section id=middle> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> ...

atlassian sourcetree - git - apply a commit on another branch to the working copy -

Image
so have commit has helpful code change, on branch. i apply commit in other branch working copy on current branch (not commit). is possible? how this? thought i'd share related previous question specific working copy: git cherry picking 1 commit branch how add desired commit(s) different branch. git cherry-pick <sha-1>...<sha-1> --no-commit apply change introduced commit(s) @ tip of master branch , create new commit(s) change. the syntax of ... commit range. grab commits start (exclude) last one. if want single commit use single sha-1 read out full git cherry-pick documentation options can use

sqlite - Having trouble saving image to entity field on IOS -

on server have table want on ios sqllite table. my server table has field called data of type image. way populated field wrote c# app converts image byte array , write byte array sql image column. in ios, make soap request wcf service , data table. made sure data received. problem writing received image data entity's binary data field. use following code that. nsstring *key = (nsstring *) [keys objectatindex:i]; // made sure key valid nsdata *data = (nsdata *) [rowdata getvalue:key]; // made sure data retrieved [tblrow setvalue:data forkey:key]; // after calling this, data key nil. portion of image data content /9j/4aaqskzjrgabaqeayabgaad/2wbdaaggbgcgbqghbwcjcqgkdbqndasldbksew8uhrofhh0ahbwgjc4nicisixwckdcpldaxndq0hyc5ptgypc4zndl/2wbdaqkjcqwldbgndrgyirwhmjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjl/waarcamda2odasiaahebaxeb/8qahwaaaqubaqebaqeaaaaaaaaaaaecawqfbgcicqol/8qatraaagedawieawufbaqaaaf9aqidaaqrbrihmuege1fhbyjxfdkbkaeii0kxwrvs0fakm2jyggkk...

javascript - Leaflet toggle buttons only work on the first click -

i have button want use toggle map layer on , off. click once , layer adds map, click again , goes away (and on). right button works on first click , none thereafter. i think has fact it's written if/else statement. condition satisfied, function ends, , that's end of it. looking guidance... how modify code make functional toggle button? my button: <button id="buttona" onclick=="onoff();">button a</button> then, within function $.getjson("mydata.json", function(data) {...}); have following: function onoff(){ currentvalue = document.getelementbyid('onoff').value; } document.getelementbyid("buttona").addeventlistener("click", function(){ if (currentvalue = "off"){ layera.addto(map); document.getelementbyid("onoff").value="on"; } else{ map.removelayer(layera); document.getelementbyid("onoff").value="off...