Posts

javascript - Preventing forge HttpRequests -

i've been searching throughout day find way figure out, without sucess , thought maybe here ? trying use secrete password in .js file can't write directly in file because see when accessing source code. e.g need send password using ajax page make sure httprequest website not forge httprequest . possible because i've tried else authentication forms didn't help. i'm using asp.net , httphandler page returns data . what can generate key valid set time using php so: $password = "some random string"; $key = md5($password . $_server['request_time']) . "|" . $_server['request_time']; this way know when key generated, , if it's been tampered because: function check($key) { list($hash, $timestamp) = explode("|", $key, 2); if ($hash !== md5($password . $key)) { throw new exception("naughty!"); } if ($timestamp < $_server['request_time'] < 60*60) { thr...

javascript - Using document.activeElement with an onChange event to validate a textbox only after textbox change is completed -

i have implemented version of code below on development system. function validatetextbox(textboxid) {   var textbox = document.getelementbyid(textboxid);   if(document.activeelement.id != textbox.id) {      do validation   } } the html similar to: <input type="text" id="validateme" onchange="validatetextbox('validateme');"/> the idea validation takes place after user has completed editing textbox , that, unlike onblur event, validation fires when value of textbox has changed. it seems work i'm leery of using without review , feedback. i haven't seen similar code examples. please give me thoughts on implementation , alternate ideas may have. thanks this fine solution. keep in mind onchange event typically fire when focus changes (ie. onblur) if want validation while user typing can use onkeydown/onkeyup/onkeypress that's quite ways harder. additionally can use this don't ...

asp.net - Jquery UI modal form example button click not working -

im using jqueryui modal form , since im new jquery figured first part integrate demo modal form application im working on , progress there. i have managed other simpler examples working, such basic modal popup box, when try work modal form popup nothing happens. the css / .js files in correct place , linked properly: <link type="text/css" href="../css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" /> <script type="text/javascript" src="../js/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.16.custom.min.js"></script> i took css provided , have placed within own css file know working correctly, can see style applied button etc. css is: /* ticket detail popup */ label, input { display:block; } input.text { margin-bottom:12px; width:95%; padding: .4em; } fieldset { padding:0; border:0; ...

ruby on rails - RoR Rake - database error about a gem -

i trying create db in ror application command: rake db:create and got error: could not find tzinfo-0.3.26 in of sources but when did "gem list" command, turned out had newer version of gem: tzinfo (0.3.27) what can sync gems more compatible? common problem? fyi using rvm manage gems. i did rvm install tzinfo-0.3.26 command , got output jruby-1.6.1-tzinfo - #fetching jruby-1.6.1-tzinfo - #extracting jruby-bin-1.6.1 /home/agenadinik/.rvm/src/jruby-1.6.1-tzinfo mv: cannot move `/home/agenadinik/.rvm/src/jruby-1.6.1-tzinfo' subdirectory of itself, `/home/agenadinik/.rvm/src/jruby-1.6.1-tzinfo/jruby-1.6.1-tzinfo' jruby-1.6.1-tzinfo - #extracted /home/agenadinik/.rvm/src/jruby-1.6.1-tzinfo building nailgun jruby-1.6.1-tzinfo - #installing /home/agenadinik/.rvm/rubies/jruby-1.6.1-tzinfo error: cannot switch 1.6.2 interpreter. jruby-1.6.1-tzinfo - #importing default gemsets (/home/agenadinik/.rvm/gemsets/) copying across included gems fetching: jruby-laun...

c# - Read (and write) Office document custom properties without automation -

i looking solution reading (and possibly writing) custom properties of office documents (both old , new formats) without resorting office automation. i have found dsofile.dll seems work old formats chokes on new ones "class not registered". kb remarks "office compatibility pack" needs installed work looking out-of-box solution. i not searching solution reads (and writes) custom properties without office installed. actually, considering office prerequisite. want solution not require office automation simple custom property handling. there "microsoft office metadata handler" windows explorer shell extension shows/manages custom properties office documents pretty way want it. dsofile.dll seem have 1 half of solution covering old office formats. dsofile use binary formats. for newer formats, can use xml (open xml sdk fine choice, can access docx/xlsx/pptx file formats system.io.packaging in .net if don't want heavy handed yet-anothe...

machine for developing/debugging android apps -

my current laptop has intel core2 duo p9500 @2.53ghz 4gb memory. running android emulator on eclipse quite pain (very slow). recommended/minimum system requirement android developers out there? right, not have stand-alone graphics card, has embeded intel graphics media accelerator gm45. a faster processor , hard-drive should help. honeycomb run slow on computer. but, no matter using, shrinking resolution of emulator/avd bit can help.

Python/Matplotlib - Colorbar Range and Display Values -

Image
when using matplotlib contour plot, i'm having trouble getting colorbar display want. i've read through numerous similar examples, have still not been able want. in image below, want 2 things changed. want minimum value , maximum values display on color bar (the max should 2.0 , min -0.1). these 2 values should @ edge of colorbar. also, want colorbar display value @ every color transition. example. in plot below, between 2.1 , 1.8, there color transition value isn't displayed. can please me? think may need use norm, hasn't worked me far. thanks, code: import numpy np import matplotlib.pyplot plt xi = np.array([0., 0.5, 1.0]) yi = np.array([0., 0.5, 1.0]) zi = np.array([[0., 1.0, 2.0], [0., 1.0, 2.0], [-0.1, 1.0, 2.0]]) plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k') plt.contourf(xi, yi, zi, 15, cmap=plt.cm.jet) plt.colorbar() plt.show() if understand correctly want, think should it: import...