Posts

javascript - convert an image server side to CanvasPixelArray -

edit so looks have somehow convert image to https://developer.mozilla.org/en/dom/canvaspixelarray serverside my current attempts have been * pass base64 encoded image server ... converting binary atob() but stuck trying draw onto canvas without having like var = new image(); i.onload = function(){.....} i.src = "base64 string" so more general statement i trying bypass creating image object means display new image if goal avoid use of javascript , embed image in page, can do <img src="data:image/png;base64,uhhiaminbase64..."> if base64 obtained dynamically in ajax, way use decoding library create image object code made. an alternate solution send directly rgb values in binary array (base64 encoded if use json) , iterate client-side on array in order change canvas' imagedata. seems easy enough inefficient wouldn't have compression of png or jpeg.

android - Location network service -

i developing app display details on network provider, got errors can me clear it? logcat-file: d/androidruntime(308): shutting down vmw/dalvikvm(308):threadid=1: thread exiting uncaughtexception(group=0x4001d800) e/androidruntime(308): fatal exception: main e/androidruntime(308): java.lang.runtimeexception: unable instantiate activity componentinfo{com.locationtest/com.locationtest.locationtestactivity}: java.lang.nullpointerexception e/androidruntime(308):at android.app.activitythread.performlaunchactivity(activitythread.java:2585) e/androidruntime(308):at android.app.activitythread.handlelaunchactivity(activitythread.java:2679) e/androidruntime(308):at android.app.activitythread.access$2300(activitythread.java:125) e/androidruntime(308):at android.app.activitythread$h.handlemessage(activitythread.java:2033) e/androidruntime(308):at android.os.handler.dispatchmessage(handler.java:99) e/androidruntime(308):at android.os.looper.loop(looper.java:123) e/androidruntime(308)a...

Is it possible to debug JavaScript code in Visual Studio without running a browser? -

visual studio, @ least in v2012, supposed have first-class support javascript. however, haven't found "javascript project type", js not listed top-level language in file > new project dialog etc. javascript is, or @ least starting be, more scripting language web apps i'm wondering if there way / plugin / extension visual studio allow me type in javascript , execute language construct (e.g., on node console), not part of asp.net web application. vs2012 have support javascript, not in "pure js project" sense. if you're running vs2012 rc on win8 release preview, should see project types windows 8 metro style applications implemented javascript. these types of projects not available create on win7 , below (because run on win8). if you're working js inside web application projects, asp.net projects, etc. you'll see new rich features javascript editing , debugging.

PHP remove (conditional) duplicate row in text -

$string = "apple foo banana ... banana foo other text ... apple"; i have text single rows duplicated after row "...". the rows before , after can ("foo"), duplicate (without "..." "apple"). the "..."-row can appear multiple times without duplicate row after it. i want remove duplicated rows have "..." row inbetween. in other words: remove line after "..." if it's same above "..." how can match banana ... banana to remove duplicated row: banana so result is $string = "apple foo banana ... foo other text ... apple"; cheers! if task remove line following line 3 dots: echo preg_replace("/^(.+?)\r?\n(\.{3})\r?\n\\1/m", "\\1\n\\2", $string); the expression matches: a whole line comprising @ least 1 character (1) three dots on single line (2) a whole line comprising @ least 1 character (1) the /m modifier used select mult...

sql - WHERE clause returning incorrect records -

i'm using this declare @year_filter_start datetime set @year_filter_start = dateadd( dd, -1, dateadd( yy, datediff( yy, 0, getdate() ), 0 ) ) declare @year_filter_end datetime set @year_filter_end = getdate() insert table ( blah ) select blah other_table actissuedate null or actstartdate between @year_filter_start , @year_filter_end and it's returning records actissuedate not null , actstartdate not between year start , today. @year_filter_start supposed beginning of year, @year_filter_end supposed today. for example: a record actstartdate 2010-08-02 , actissuedate 2011-03-15 or actstartdate 2009-05-18 , actissuedate 2009-09-06 is there wrong statement? try following, need few more parentheses think: where ((actissuedate null) or (actstartdate between @year_filter_start , @year_filter_end)) the engine sees 2 statements way have it. need make one.

html - How to align two spans together ? -

i'm having problems aligning 2 spans together. second span starts lower first 1 causing mis-alignment of spans. essentially i'm trying align .cbtnsymbol , .cbtnlabel starting @ same height. here testcase: http://jsfiddle.net/dwgea/ here go: http://jsfiddle.net/dwgea/19/ just add line-height: 30px; vertical-align:middle; .cbtnlabel

ios - Coreplot: Setting length of global range not working -

to start with, have graph(coreplot linechart). have set x-range , y-range of defaultplotspace of graph. - (void) setupxrangeforplotspace:(cptxyplotspace *) plotspace { int rangelength = [self xrangelength]; plotspace.xrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(- 0.5f) length:cptdecimalfromfloat(rangelength + 1.0)]; } - (void) setupyrangeforplotspace:(cptxyplotspace *) plotspace { float maxvalue = [self maximumyvalue]; // length = maxvalue + (10% of maxvalue); plotspace.yrange = [cptplotrange plotrangewithlocation:cptdecimalfromfloat(0.0f) length:cptdecimalfromfloat(maxvalue + (maxvalue/10.0))]; } now task show portion (region) of graph along x-axis according user interaction. changing globalxrange of plotspace. i took 2 textfields getting location , length. btnaction: method fired when button pressed. - (void) btnaction:(id) sender { float txt1fl = [txt1.text floatvalue]; float txt2fl = [txt2.text floatvalue]; nsl...