Posts

Showing posts with the label Javascript

Setup environment for PhoneGap android with eclipse in Windows 7/8

Image
1) Download  a) JAVA from http://www.oracle.com/technetwork/java/javase/downloads/index.html b) APACHE ANT from   http://ant.apache.org/bindownload.cgi (under Current Release of Ant) c) ANDROID SDK from https://developer.android.com/sdk/index.html#ExistingIDE * This will contain  * Eclipse + ADT Plugin * Android SDK Tools * Android Platform-tools * The latest Android platform * The latest Android system image for the emulator d) If you want new version of Eclipse you can download from https://www.eclipse.org/downloads/ 2) Install all Software. 3) Now we will Set up environment variables * Follow the bellow images                       Under User variables for {YOUR NAME} JAVA_HOME     C:\Program Files\Java\jdk1.7.0_51\     Under System variables ANDROID_HOME  E:\Downloads\adt-bundle-windows-x86_64-20131030\sdk          (This is my source path) ANT_HOME      C:\apache-ant-1.9.3  (This is my source path) PATH      

How to install Node.js, npm, socket.io and use them?

1 Go to  http://nodejs.org  and click on Install button,  2.. Download node and install it 3.. Create an empty folder on your hard disk      3.1) check environment path of nodejs using command prompt             a) C:\>set %PATH%              If it is not showing any path regarding node then set the environment path             b)  C:\>set path=%PATH%;C:\Program Files\nodejs\ 4.. Create an package.json file with the following content       Ex: C:\Program Files\nodejs\package.json { "name" : "App" , "version" : "0.0.1" , "description" : "App" , "dependencies" : { "socket.io" : "latest" }, "author" : "developer" } 5.. Open windows's command prompt (press Windows key + R and type  cmd ) 6.. Navigate to your newly created directory with  cd  command 7.. Type  npm install  in that directory       7.1)

Basic CRUD operations using php, mongodb and knockoutjs with validation

Image
1) I used knockout simplegrid for table data with DELETE, EDIT action and pagination support 2) THE CRUD operations are using XHR/AJAX 3) I used Twitter Booststarp Framework. You can Download/Fork from the github.com  basics_of_php_mongodb_knockoutjs Before trying this we need to install PHP, Apache webserver/Any HTTP server and MongoDB second download mongodb.dll file (php mongodb driver) and keep this file extension if you are using windows OS. These are JavaScript files required <!-- Just for debugging purposes. Don't actually copy this line! --> <!--[if lt IE 9]><script src="js/ie8-responsive-file-warning.js"></script><![endif]--> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]>  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>  <script src="https://oss.maxcdn.com/li

Sanitize Phone no, if phone no length is more than 10 then, Remove 0, +91, 91 from phone no

Sanitize Phone no, if phone no length is more than 10 then, Remove 0, +91, 91 from phone no. All Indian phone no's length is 10 digits including with STD code /**  *  Sanitize Phone no, if phone no length is more than 10 then  */ function sanitizePhoneNo(phone){ if(phone.length >= 10) { if(phone[0] == 0) { phone = makePNo(phone, 1); }else if( (phone[0] == 9) && (phone[1] == 1) ){ phone = makePNo(phone, 2); }else if( (phone[0] == '+') && (phone[1] == 9) && (phone[2] == 1) ){ phone = makePNo(phone, 3); } } return phone; } function makePNo(val, cnt){ var a=''; for(var i=0; i<=(val.length)-1; i++){ if(i>=cnt){ a += val[i];} } return a; } /**  *  Validate Phone no with regular expression  */ function validatePhoneNo(phone){ if( /^[0-9\ \-]+$/.test(phone)){ if(phone.length==10){return true;}else {return false;} }else {return false;} }