Posts

php - validation for phone number in a form....Really Stuck -

before start flaming or @ all, read this! have regular expression verifying format of phone number entered in form correct. hoping find if knows way verify if number exists...so if number doesnt exist , user enters it, user error message phone number not exist , prompted enter working phone number.... i have looked on seas of google not find phone number validator not format checker regex... this last hope.. in order check if phone number exists (and belongs user who's filling form) , see 1 solution : try communicate phone. what's done sending sms validation code phone number -- , ask user type code once has received sms. this way, you'll sure : the phone number exists, and belongs current user. of course, make sure put security measure in place, prevent using form spam number : make sure 1 user cannot send more x sms per hour/day, make sure no more 2 or 3 sms can sent same number per day/week

How to select XML attribute - Converting MSSQL to MySQL -

i need convert mssql query below mysql. query selects value of "id" attribute out of "page" element in xpath. expect mysql query return 3 rows values 1,2,3 respectively. know how in mysql? please let me know. declare @inputxml xml set @inputxml = '<pages><page id="1"/><page id="2"/><page id="3"/></pages>' select node.value('@id', 'bigint') id @inputxml.nodes('/pages/page') tempxml (node)) edit: forget said earlier. courtesy of dave, want @ this: http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html (previous answer left in place reference): mysql doesn't xml. short answer is: "you can't". the long answer is, depending on context runs in, have few options. normalize data proper sql schema, instead of relying on xml inside sql. pull xml database plain strings, , xml processing in logic (php, c#, vb, whatever ...

c# - Binding to events in dynamically loaded user controls -

i constructing test project demonstrate (to me) how dynamically load user controls. works except wiring of control notify parent has happened. problem line tries connect event in user control event handler in parent page. "notifyparentevent" event not visible , compiler barfs on (the event not defined in system.web.ui.control). have tried using usercontrol instead of control, no avail. control control = page.loadcontrol(savedcontrolvirtualpath); if (control != null) { control.id = control.gettype().name; >>>>> control.notifyparentevent += new eventhandler(usercontrolnotificationhandler); controlplaceholder.controls.add(control); } code behind user control: public partial class usercontrols_webusercontrol1 : system.web.ui.usercontrol { public event commandeventhandler notifyparentevent; private void notifyparent(string message) { if (notifyparentevent != null) { commandeventargs e = new commandeventar...

java - how to run playframework FunctionalTest through Eclipse? -

and second question: is possible run them in bunch through eclipse? functionaltest , unittest extend basetest, annotated playjunit4testrunner, should find can run tests other test (i.e. run > junit test). you'll see play environment being initialised on console before tests run. one problem i've found running whole package of play tests in eclipse buggy, tend run 1 @ time in eclipse , use play's own testrunner verify whole suite.

version control - Mercurial - log the command executed -

we've been using mercurial while , working fine. the problem encounter when runs "bad command". an example be, merging unstable branch in stable trunk or pulling named branch on unrelated overwriting bunch of stuff... you've got hg log people won't believe output saying "i didn't that"...now in interest of public shaming :) , giving rightful priviledges "you broke built hat", i'm wondering, there way have mercurial log every command given text file give like: hg pull -b hg merge totallywrongbranch hg ci -m "i didn't it!" -u bsimpson ok, had few minutes on hand wrote exe , named hg.exe , renamed mercurial's original exe real_hg... an ugly hack don't mind code quality please works! public static streamwriter sw; static void main(string[] args) { sw = new streamwriter("hgcommandlog.txt", true); stringbuilder sbarguments = new stringbuilder(); if (args.length > 0) ...

segmentation fault - NGINX + PHP5-FPM segfaults under high load -

i have been dealing problem day , driving me insane. google results , searches here lead dead ends. hope can work me provide solution myself , future victims. here go. i running popular website on 3m page views day. on average 34 page views per second, more realistically, during peak hours, gets on 300 page views per second. think of these requests. i running ubuntu 10.04 64-bit server 2 e5620 cpus, 12gb ram, , micron p300 6gb/s ssd. during peak hours cpu , memory load average (20-30% cpu , half of memory used). the software powers site is: nginx, mysql, php5-fpm, php-apc, , memcached. ok, meat of post, here error logs. there bunch of these errors logged. /var/log/php5-fpm jul 20 14:49:47.289895 [notice] fpm running, pid 29373 jul 20 14:49:47.337092 [notice] ready handle connections jul 20 14:51:23.957504 [error] [pool www] unable retrieve process activity of 1 or more child(ren). try again later. jul 20 14:51:41.846439 [warning] [pool www] child 29534 exite...

html - Extract the contents of a div using Flash AS3 -

i have sfw embedded in php page. there div on page id="target" . i want access content of div (ie: characters inside it) , hold them string variable in as3. how can this? my attempt far import flash.external.externalinterface; var mydivcontent = externalinterface.call("function(){ return document.getelementbyid('target');}"); var mydivcontent2:string = mydivcontent.tostring(); test_vars.text = mydivcontent2; //dynamic text output you're there : var res : string = externalinterface.call("function(){return document.getelementbyid('target').outerhtml}"); if want content of target , use innerhtml instead of outerhtml .