Posts

c# - Page lifecycle question -

i using dropdown menu , updatepanel filter out datagrid. datagrid has buttons redirect different page. when hit button or link on top of other page, redirects me page dropdown should...but gets rid of datagrid data , have make selection dropdown again. there way make sure dropdown selection remembered when both link pressed , button selected? help! the easiest thing in case save dropdown selection in session collection , on page load, check see if there saved selection , use reapply selection. protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { session["savedselection"] = dropdownlist1.selectedindex; } protected void page_load(object sender, eventargs e) { if(session["savedselection"] != null) { int selectedindex = (int) session["savedselection"]; dropdownlist1.selectedindex = selectedindex; } }

iphone - Calculating the cells contained inside a rectangle on an Isometric Grid -

consider given isometric grid (consider diablo) of tiles. have measures grid, grid height, grid width , tile height/width. (consider image: http://2.bp.blogspot.com/_bazwykf2fdm/si2gbwd7kji/aaaaaaaabvw/bcb-eamgez4/s1600-h/isometric_grid ). center cell of grid 0,0 extending iso-north (+y), iso-south(-y), iso-east(+x), iso-west(-x). let's draw rectangle @ arbitrary location on grid. not have isometric positions rectangle, rather have normal draw coordinates grid top left hand corner 0,0 , south y+, right x+. if had top, left, height, width of rectangle in question - how calculate array of iso-cells crossed bottom edge of rectangle. any language choose demonstrate suffice. in papers , books isometric programming (isometric programming direct x7, yes old gives overview problems , techniques) use mousemaps. also there technique render area of map covered rectangle image, each tile gets unique color (and color rendered). afterwards check colors in image , extract lis...

JavaScript arrays braces vs brackets -

what difference between each of following array definitions. var myarray = []; var myarray = {}; var myarray = new array(); the first , third equivalent , create new array. second creates new empty object, not array. var myarray = []; //create new array var myarray = {}; //creates **a new empty object** var myarray = new array(); //create new array

multithreading - How do I signal a sleeping thread in Java? -

i'm writing udp client-server pair networks class, , have hit on problem. rather unorthodox networks assignment, little background first: the goal create server implement push-based notifications. key point here server has contact client @ whatever address last seen, listen client's control packets. therefore, have thread running on client periodically sending out udp packets server, logs origin when needs send out response. technique busts through nat's, send refreshes address translation. so then, here dilemma: unless i'm mistaken, nat maps own address , generated port number onto it's clients address port combination. therefore, in order traverse nat, need move packets through 1 port on client machine. updater thread have listen time, push out update packet, , go listening. then here hairy. if original thread, wants perform action, wants port, has wake announcer, blocking while waiting response. how can pull off in java? p.s.: if turns out nat al...

Working with PDO object - MySQL -

i new pdo , have pretty simple question. have simple function connecting db: function connectdb() { try { $dbh = new pdo('mysql:host='.config::$db_server.';dbname='.config::$db_name, config::$db_login, config::$db_password, array( pdo::attr_persistent => true )); $dbh->exec("set character set utf8"); $dbh = null; } catch (pdoexception $e) { print "error!: " . $e->getmessage() . "<br/>"; die(); } } after calling function connect db. later when trying send query using $dbh->query got "call member function query() on non-object ". understand - don't have instance of class @ moment. think achieve use $dbh = new pdo("settings") again, kind of stupid isn't? function has no sense than. tried return $dbh in connectdb function (before null statement) wasn't working. how s...

c# - Reset WPF Datagrid scrollbar position -

when changing .datacontext property of datagrid (to new source) selected item gets cleared, scrollbar position retained. avoid call .scrollintoview(.item(0), after changing datacontext, move scrollbar upwards. displays wrong page fraction of second, , when scroll top before changing datacontext, have same problem. so how can change .datacontext , resetting scrollbar position @ same time? edit: should mention xaml looks this: <datagrid virtualizingstackpanel.isvirtualizing="true" virtualizingstackpanel.virtualizationmode="recycling"> so maybe virtualizing cause. have tried calling scrolltotop scrollviewer in datacontextchanged event? <datagrid virtualizingstackpanel.isvirtualizing="true" virtualizingstackpanel.virtualizationmode="recycling" datacontextchanged="datagrid_datacontextchanged" ...> private void datagrid_datacontextchanged(object sender, dependencypropertycha...

php - How to transform image over object -

example: http://gyazo.com/745e6912db5bf2c1dd05a7a7537bfca4.png i wanna put image on object... looks native picture on object. give key words of these image manipulation process can google ;) it's not php, client-side programming want into. try css z-index properties.