Posts

Featured post

javascript - Image onload event not firing in firefox -

i'm creating image preloader. works fine in browsers except firefox (testing firefox 10.0). input array of images called image_list . these images appended dynamically body of document , load callback attached, calls function update_progress . code follows: $(image_list).each(function() { var x = $('<img />') .load(function() {update_progress(percent_loaded += step);}) .attr('src', this) .appendto('body') .css('display', 'none'); .each(function() { if(this.complete) update_progress(percent_loaded += step); }); }); in firefox, load callback , update_progress never called. yet exact same code works fine in chrome , other browsers i've tested. there way detect when image has loaded in firefox? i first check see whether image has height, checking height property. if (the_image.height > 0) { // image loaded (possibly cached) } if have cached ...

objective c - NSMenu update title -

i have created nsmenu dynamically created , lists hdd's attached computer. each of these submenu contains nsmenuitem created title "calculating size...". on thread enumerating through specific folders return string replace title. i have setup correctly if have 1 of these submenu's selected when enumeration finishes doesn't reflect change in title until either highlight item or select different submenu , come back. what correct way of achieving update?

web services - Postgres Java Webservice response issue -

i have webservice use execute postgres queries. problem response anytype{} nothing in it. checked server , seems there no errors in log files. webservice @suppresswarnings("unused") public string getinfo() { connection con = null; preparedstatement st = null; resultset rs = null; string url = "jdbc:postgresql://127.0.0.1:5432/uptondb"; string user = "*******"; string password = "******"; string query = ""; string response = ""; int size = 0; initialcontext cxt = null; try { cxt = new initialcontext(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } datasource ds; try { ds = (datasource) cxt.lookup( "java:comp/env/jdbc/postgres" ); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } try{ try { c...

javascript - how to make setTimeout refer to context of object? -

var myobj = { name:"mike", go:function(){ console.log(this.name); } } myobj.go() //logs out mike settimeout(this.myobj.go,200) //logs out (emptystring) define variable reffering object before: var _this = this; settimeout(function() {_this.myobj.go();}, 200);

javascript - Centering DIV Horizontally & Vertically on Page Load -

how can center div both horizontally , vertically when page loads? i using following solution: html: <div class="container"> <div class="visitorselect"> <a href="/visitorlog/boeing"> <div class="tile double icon bg-color-blue"> <div class="tile-content"> <i class="icon-plane"></i> </div> <div class="brand"> <span class="name">employee</span> </div> </div> </a> <a href="/visitorlog/guest"> <div class="tile double icon bg-color-orange"> <div class="tile-content"> <i class="icon-group"></i> </div> <div class="brand"> <span class="name">guest</span> </div> <...

ios - AVAssetExportSession ignoring videoComposition rotation & stripping metadata -

i attempting rotate video prior upload on ios device because other platforms (such android) not interpret rotation information in ios-recorded videos and, result, play them improperly rotated. i have looked @ following stack posts have not had success apply of them case: ios rotate every frame of video rotating video w/ avmutablevideocompositionlayerinstruction avmutablevideocomposition rotated video captured in portrait mode ios avfoundation: setting orientation of video i coped apple avsimpleeditor project sample, unfortunately ever happens is, upon creating avassetexportsession , calling exportasynchronouslywithcompletionhandler, no rotation performed, , what's worse, rotation metadata stripped out of resulting file. here code runs export: avassetexportsession *exportsession = [[avassetexportsession alloc] initwithasset:[_mutablecomposition copy] presetname:avassetexportpresetpassthrough]; exportsession.outputurl = outputurl; exportsession.outputfiletype = ...

java - Scanner not working correctly in Mac OSX terminal -

i have hacky ant command user can run stuff. command prompts user input. in intellij, when testing, works correctly. when run ant target terminal, weird behavior. here code: scanner userin = new scanner(system.in); printwriter writer = new printwriter(system.out); writer.println(error + " if continue load, data may in corrupted state. continue? (y/n): "); writer.flush(); string userresponse = userin.next(); while (!(userresponse.equalsignorecase("y") || userresponse.equalsignorecase("n") || userresponse.equalsignorecase("yes") || userresponse.equalsignorecase("no"))) { writer.println("invalid input. please specify if continue load. (y/n): "); writer.flush(); userresponse = userin.next(); } return userresponse.equalsignorecase("y") || userresponse.equalsignorecase("yes"); when running ant command terminal, error message displayed when use...