tag:blogger.com,1999:blog-45402093922013738352024-03-21T11:44:51.538-07:00PHP, Android, Programming & Other life hacks.n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-4540209392201373835.post-51713712152764928612016-12-23T11:25:00.003-08:002016-12-23T11:25:33.001-08:00TOP 10 COOL CMD TRICKS<iframe width="560" height="315" src="https://www.youtube.com/embed/TdWPEN_57mI" frameborder="0" allowfullscreen></iframe>n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-46291863523120608802016-07-06T11:40:00.001-07:002016-07-06T11:40:39.671-07:00Get Radius in Miles using Latitude & Longitude in MySQL <div dir="ltr" style="text-align: left;" trbidi="on">
Here is the trick to find the radius distance in miles directly from the latitude & longitude data store in your mysql table. This is a very helpful trick which i use while creating webservices for mobile apps.<br />
<br />
<br />
<pre class="lang-sql prettyprint prettyprinted" style="-webkit-text-stroke-width: 0px; background-color: #eff0f1; border: 0px; color: #393318; display: block; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; margin: 0px 0px 1em; max-height: 600px; orphans: auto; overflow: auto; padding: 5px; text-align: left; text-indent: 0px; text-transform: none; widows: 1; width: auto; word-spacing: 0px; word-wrap: normal;"><code style="background-color: #eff0f1; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin: 0px; padding: 0px; white-space: inherit;"><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">SELECT</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
id</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">3959</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">*</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> acos </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
cos </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">78.3232</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">*</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> cos</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> lat </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">*</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> cos</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> lng </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">-</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">65.3234</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> sin </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">78.3232</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">*</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> sin</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> radians</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> lat </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">AS</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> distance
</span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">FROM</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> markers
</span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">HAVING</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> distance </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"><</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">30</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">ORDER</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">BY</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> distance
LIMIT </span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">0</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: #7d2727; font-size: 13px; margin: 0px; padding: 0px;">20</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">;</span></code></pre>
</div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-86600025348566472832016-02-01T11:44:00.001-08:002016-02-01T11:45:06.612-08:00Circuit Scribe<div dir="ltr" style="text-align: left;" trbidi="on">
A new innovative technique to create electronics circuit with very low cost materials on the paper, checkout the video.<br />
<div>
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/e0NM1jJbjrM" width="560"></iframe>
</div>
</div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-86225337409614633692016-01-03T03:00:00.004-08:002016-01-14T00:07:37.929-08:00Know Your Provident Fund Balance.<div dir="ltr" style="text-align: left;" trbidi="on">
Ever wondered that how much money has been submitted by your employer, you can checkout your EPF (Employer' Provident Balance) just by the click of the mouse.<br />
Here is the link for checking the link for it.<br />
<br />
<a href="http://www.epfindia.com/site_en/KYEPFB.php"><span style="background-color: white; color: #0b5394;">CLICK HERE TO CHECK PROVIDENT FUND</span></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKrZkCOsMxYvwFqlPyCnsSOJ69GsCCdC9-etvlw7c2GuI6pnWUy46EkrYaE1JQFs8Tik-6TgSr0HKOLVz_AkrDSUtTRzmSSZm9-SdXhZ6X-FziTZdcIADPpFlOElRdNlDKnguWJbczd8VG/s1600/PF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="359" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKrZkCOsMxYvwFqlPyCnsSOJ69GsCCdC9-etvlw7c2GuI6pnWUy46EkrYaE1JQFs8Tik-6TgSr0HKOLVz_AkrDSUtTRzmSSZm9-SdXhZ6X-FziTZdcIADPpFlOElRdNlDKnguWJbczd8VG/s400/PF.png" width="400" /></a></div>
<br />
<br />
Just fill the form and you will get the provident fund balance to the phone number mentioned by your employer.<br />
<br /></div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-17984042050696208882015-11-09T04:07:00.000-08:002015-11-09T04:07:02.159-08:00Must Know PhoneGap CLIs<div dir="ltr" style="text-align: left;" trbidi="on">
In order to deal with phonegap, you should be very handy with the initial command line interface of phonegap, this is one of the cool feature of which lets you work very quickly and create apps with an ease, so I am going to write the list of some must know commands which are very helpful while developing a phonegap app<br />
<br />
<strong>Install Phonegap/Cordova</strong><br />
<br />
npm install -g cordova<br />
<br />
<strong>Create an App</strong><br />
<br />
cordova create my-app<br />
<br />
<strong>Create Platforms, which lets you run your code in different OS</strong><br />
<br />
cordova platform add ios<br />cordova platform add amazon-fireos<br />cordova platform add android<br />cordova platform add blackberry10<br />cordova platform add firefoxos<br />
<br />
<strong>Remove Platforms</strong><br />
<strong></strong><br />
cordova platform rm android<br />
<br />
<strong>Build App</strong><br />
<br />
cordova build<br />
cordova build ios<br />
<br />
<strong>Test App on Emulator</strong><br />
<br />
cordova emulate android<br />
<br />
<strong>Add a plugin to your app</strong><br />
<strong></strong><br />
cordova plugin add org.apache.cordova.camera<br />cordova plugin add org.apache.cordova.media-capture<br />cordova plugin add org.apache.cordova.media<br />
<br />
<strong>Remove a plugin</strong><br />
<br />
cordova plugin rm org.apache.cordova.camera<br />
<br />
<strong>List all the plugins added in the mobile app</strong><br />
<br />
cordova plugins ls<br />
<br />
<strong>Help</strong><br />
<br />
cordova help<br />
cordova info<br />
<br />
<strong>Update Platform</strong><br />
<br />
cordova platform update android<br />
cordova platform update ios<br />
<br />
<strong>Run Phonegap/Cordova app</strong><br />
<br />
cordova run android<br />
cordova run ios<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-90302137709439078552015-11-09T02:47:00.002-08:002015-11-15T23:02:09.736-08:00Get Started With PHONEGAP<div dir="ltr" style="text-align: left;" trbidi="on">
This is an very interested blog about creating a mobile app with one of the latest and noted technology called <b>PHONEGAP</b>. I was wondering that when i will get a chance to create a mobile application, Everytime probably i was stuck between the discussion of native VS hybrid everytime. As a Web programmer my strength was always server side programming language which is PHP & client side languages like HTML, CSS, JavaScript & jQuery.<br />
<br />
Every time i felt that learning android development using java is better than creating mobile app using phonegap's javascript's framework,because i felt the framework of phonegap would be little difficult to learn, then why not try out the android's java framework if you are giving the same effort for learning, also it has many supporting blogs now a days. One day i got a project from one of a client who was looking for an app to be developed using Phonegap and i was very excited to start it, and trust me it took me a little while to learn the initial things of framework, its damn easy and you can create big web based apps with an ease and with the same team which are creating web version.<br />
<br />
So Here are the pre-requisite things which is required if you want to kick start with phonegap.<br />
1).A Good Experience in HTML 5 tags.<br />
2).Good Exposure towards CSS 3.<br />
3).A Good Knowledge in Javascript Or jQuery, if you know any good javascript framework like angular or NodeJS then it will be awesome for you.<br />
4).And a little experience about the mobile environment, mobile development life cycles etc.<br />
<br />
Now to get Started just follow few steps and you will be ready to start.<br />
<br />
1).Install Git.<br />
2).Install Node Js command line tool, visit official site of nodeJs and download their tool.<br />
3).Download & Install JDK.<br />
4).Download Android SDK tools.<br />
5).Download & Install Apache ANT(Download the zip File and extract it somewhere).<br />
<br />
<br />
Now the next step is new environment variables.<br />
<br />
1). Create the environment variable for latest jdk bin folder, in my case it was C:\Program Files\Java\jdk1.8.0_65\bin<br />
2). Create the environment variable for latest Apache ANT bin folder, in my case I have just extracted the zip file in C: Drive and gave the path like this C:\apache-ant-1.9.6\bin<br />
3). Now give the path of the Android SDK folder.<br />
4). Now give the path of build-tools(folder) in the environmental variable.<br />
5). Now give the path of tools (folder) in the environmental variable.<br />
6). Now give the path of platform-tools (folder) in the environmental variable.<br />
7). Now give the path of platforms (folder) <br />
<br />
Add all the path one by one separated a semicolon<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEauCCdmkRIgHvX2lEj9IcLccVNRUOxA3u5w9bOTz6l4xfI1LoRYkUOQXTBjGy38OyaVICVVjgJ3z4ktmF3EaTBWg4o1I6ux_-KItd3_59ROJ84zEnBLcxtSv4RaVrQUMzpjY-alifiP3A/s1600/Slide1xxx.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="137" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEauCCdmkRIgHvX2lEj9IcLccVNRUOxA3u5w9bOTz6l4xfI1LoRYkUOQXTBjGy38OyaVICVVjgJ3z4ktmF3EaTBWg4o1I6ux_-KItd3_59ROJ84zEnBLcxtSv4RaVrQUMzpjY-alifiP3A/s320/Slide1xxx.png" width="320" /></a></div>
<br />
That's it now you are ready to go.<br />
<br />
Now to make sure, everything is set, open your NODE JS command prompt and write a command "java", if it gives any info reagarding java then, the environmental variable has been set correctly.<br />
<br />
Now we will install phonegap into our computer, to do that just write the command <br />
npm install -g phonegap <br />
<br />
OR <br />
<br />
npm install -g cordova<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii8vScPerSGVPYE6utAXpMtB70egWCzVK_QIyDqiCnAtw3Bn88fqiV3vJ7mlqBfFULWS_QVGbnun5G5MJPfNRO01EcSXhChk4iP0baFbX5xqWIox9_fvz7AnvTaev1lpbyQmkAuuNMpS74/s1600/Slide1xxsadax.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="81" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii8vScPerSGVPYE6utAXpMtB70egWCzVK_QIyDqiCnAtw3Bn88fqiV3vJ7mlqBfFULWS_QVGbnun5G5MJPfNRO01EcSXhChk4iP0baFbX5xqWIox9_fvz7AnvTaev1lpbyQmkAuuNMpS74/s400/Slide1xxsadax.png" width="400" /></a></div>
<br />
Cordova is the latest version phonegap engine, which is a collaborated open source version of phonegap & Apache, installing the cordova or phonegap would take few minutes or may be little more which depends on your internet connection, if you have installed cordova then always the word cordova in the command lines instead of phonegap.<br />
<br />
after this we can create our first project in phone gap as shown below.<br />
<br />
phonegap create MyFirstPhoneGapProject<br />
<br />
This command will create your first phonegap project in your computer. <br />
Now to run your first phonegap project, you have to add a platform in your phonegap project folder, if you are using android phonegap then add android platform or else IOS or whatever. To add a platform in your phonegap project you have to write the command like this.<br />
<br />
phonegap platform add android<br />
<br />
this command will add all pre-requisite dependency files for android app development, so that it would be ready to go for your android phone once you launch it.<br />
<br />
Now finally we have to run the project in a real device, so now just connect your android phone to computer, also make sure the developer options like USB debugging of your android phone is enabled. Now run a test command.<br />
<br />
adb devices<br />
<br />
<br />
This will show the list of mobile devices connected to the computer, if the list is empty then disconnect and connect the phone again.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRsm8iE77GShxgKykqqgOYLHP2G2u-ScSK05oWBGN09ol_-5WLELcKJ8zFbkhK-RlUYoqXWworg7CDMZLUvQ0wRDIxWoSm0XpoABOhB5ACSXXhU23BxaXqtrjaSmEHWI3dnKCn5ubwVKm7/s1600/Slide1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRsm8iE77GShxgKykqqgOYLHP2G2u-ScSK05oWBGN09ol_-5WLELcKJ8zFbkhK-RlUYoqXWworg7CDMZLUvQ0wRDIxWoSm0XpoABOhB5ACSXXhU23BxaXqtrjaSmEHWI3dnKCn5ubwVKm7/s320/Slide1.png" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Now Run your first app by running this code.<br />
<br />
cordova run android<br />
Or <br />
phonegap run android<br />
<br />
and this will install your phonegap app into your phone.<br />
<br />
If you have not connected any phone to your computer then phonegap will run the app in the android default emulator.<br />
<br />
<br />
<br /></div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-7745149339495707032015-09-24T22:27:00.001-07:002015-10-01T01:03:45.153-07:00Stored Procedures in MySQL<div dir="ltr" style="text-align: left;" trbidi="on">
Stored Procedures in MySQL <br />
<br />
<br />
The MySQL database supports stored procedures. A stored procedure is a subroutine stored in the database catalog. Applications can call and execute the stored procedure. The CALL SQL statement is used to execute a stored procedure.<br />
Stored procedures can have IN, OUT & INOUT parameters, depending on the MySQL version. The mysqli interface has no special notion for the different kinds of parameters.<br />
<br />
Usually stored procedures are not used in the PHP Development, but still its a useful option for reducing the query writing practice.<br />
<br />
Some examples of stored procedures with different types are as follow.<br />
<br />
<u><em><strong><span style="color: #0b5394; font-size: large;">IN parameter</span></strong></em></u><br />
<br />
To create a stored procedure with in parameter you can write a query like this.<br />
<br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">CREATE PROCEDURE p(IN id_val INT) </span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">BEGIN </span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">INSERT INTO test(id) VALUES(id_val); </span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">END;</span><br />
<br />
Now to call the stored procedures you can do something like this.<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">CALL p(1);</span><br />
<br />
<strong><em><u><span style="color: #0b5394; font-size: large;">OUT parameter</span></u></em></strong><br />
<br />
To create a store procedure with inout/out parameter you can write a query like as following.<br />
<br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">CREATE PROCEDURE CountOrderByStatus(</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> IN orderStatus VARCHAR(25),</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> OUT total INT)</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">BEGIN</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> SELECT count(orderNumber)</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> INTO total</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> FROM orders</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> WHERE status = orderStatus;</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">END</span><br />
<br />
<br />
Now to call the stored procedures you can do something like this.<br />
<br />
<span style="color: red;">CALL CountOrderByStatus('Shipped',@total);</span><br />
<br />
if you want to execute a php code, you can write like this<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;"><?php</span><br />
<span style="font-family: "Courier New", Courier, monospace;">$result=mysql_query("CALL CountOrderByStatus('Shipped',@total)");</span><br />
<span style="font-family: "Courier New", Courier, monospace;">?></span><br />
<br />
<u><em><span style="color: #0b5394; font-size: large;"><strong>INOUT parameter</strong></span></em></u><br />
<br />
To create a store procedure with inout/out parameter you can write a query like as following,<br />
INOUT exactly works like the OUT parameter<br />
<br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">CREATE PROCEDURE set_counter(INOUT count INT(4),IN inc INT(4))</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">BEGIN</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;"> SET count = count + inc;</span><br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">END;</span><br />
<br />
Now to call the stored procedures you can do something like this.<br />
<br />
<span style="color: red; font-family: "Courier New", Courier, monospace;">CALL set_counter(@counter,1);</span><br />
<br />
<br />
That's it, its damn easy to go on with.<br />
<br />
<br />
</div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-17497267505583082762015-08-28T07:42:00.002-07:002015-08-28T07:42:27.640-07:00Design Patterns in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "Trebuchet MS",sans-serif;">Patterns in php. Today we are going to talk about design patterns in web development, more precisely – in PHP. Experienced developers are probably familiar with this, but this article will be extremely useful for all novice developers. So, what is it – design patterns? Design Patterns aren’t analysis patterns, they are not descriptions of common structures like linked lists, nor are they particular application or framework designs. In fact, design patterns are “descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.” In other words, Design patterns provide a generic reusable solution to the programming problems that we encounter every day. Design patterns are not ready classes or libraries, that can be simply applied to your system, this is not a concrete solution that can be converted in to source code, design patterns are much more than that. They are patterns, or templates, that can be implemented to solve a problem in different particular situations.<br /><br />Design patterns help to speed up the development, as the templates are proven and from the developer’s position, only implementation is required. Design patterns not only make software development faster, but also encapsulate big ideas in a simpler way. Also, be careful not to use them in wrong places in order to avoid unpleasant situations. In addition to the theory, we also give you the most abstract and simple examples of design patterns.<br /><br /> <i><b>“Each pattern describes a problem which occurs over and over again … and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without doing it the same way twice.” – Christopher Alexander</b></i></span></div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0tag:blogger.com,1999:blog-4540209392201373835.post-46894381159546274922015-08-02T11:55:00.000-07:002015-08-04T04:46:32.146-07:00How to upgrade the XAMPP, without uninstalling the older version of xampp.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "Trebuchet MS",sans-serif;">I have been wondering around, like how to upgrade my xampp and i was using the older version of xampp which was 5.3 which i installed some what around like 4 years ago, when i was learning the PHP at Hyderabad from Swami Naidu Sir, but its very inimical sometime to work with certain project on the localhost where you have to work with API using CURL and in my case it was not working because the module was not enabled and likewise many were not, however there was no problem with the latest versions of the xampp almost all the modules like curl are enabled already in the localhost, also i do a lot of project with the latest cms like joomla3 or frameworks like laravel where you get all the die function errors if you are not using the latest version of php, hence i decided to update my XAMPP at any cost.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Now after digging a lot of blogs and stack-overflow, i came to know about two techniques which iam going to share right now and i hope someone will find it helpful whoever is facing the same situation.</span><br />
<br />
<b><u><span style="font-family: "Trebuchet MS",sans-serif;">Technique 1.</span></u></b><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">So </span><span style="font-family: "Trebuchet MS",sans-serif;"> t</span><span style="font-family: "Trebuchet MS",sans-serif;">he first is about not removing the older version and just upgrading the php folder, so in order to do that follow the instructions given below.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step-1: So just go to this link http://windows.php.net/download#php-5.6 and download the latest thread safe version of xampp.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step-2: Now i assume that your xampp is in your "C" drive, so just go to your "C:/xampp" and rename the old php folder as "php_old", create a new empty folder called "php".</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step-3: Now unzip the entire files of the new thread safe version of php into the newly created php folder.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step-4: Now in the newly created php folder search a file "php5apache2_4.dll" or "php5apache2_2.dll" copy that file and paste it in the folder "C:\xampp\apache\modules".</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step-5. Now the last step, go to "C:\xampp\apache\conf\extra" and open the file "httpd-xampp.conf" using a text editor, here you have to edit three things.</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">just provide/check correct path to these variable. </span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">#).<b> LoadFile</b> "C:/xampp/php/php5ts.dll" </span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br />#). <b>LoadModule</b> php5_module "C:/xampp/apache/modules/php5apache2_4.dll"</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">#). <b>SetEnv</b> PHPRC "\\xampp\\php".</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">thats it, you're done.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step - 6: Now just restart the apache and mysql using the xampp control panel, i hope it will work, if not like it happened in case of my colleague then please follow the second technique which is written below.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><u><b>Technique 2.</b></u></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Step: 1. Download the latest version of the xampp which would be a ".exe" file.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Step: 2. Stop your apache and mysql services using xampp control window, now rename the C:/xampp folder to C:/xampp_old.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br />Step: 3. Now run the newly dowloaded .exe file of xampp.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Step: 4. Now copy all the contents of "htdocs" folder from "C:/xampp_old" to "C:/xampp".</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Step: 5. No go to "C:\xampp_old\mysql\data" copy the entire content of this folder to "</span><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-family: "Trebuchet MS",sans-serif;">C:\xampp\mysql\data</span>".</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Step:6. Restart your apache and mysql services now through the new xampp control panel, thats it and your done, and you will get the working environment with the same set of files and data which was there earlier with the updated xampp version.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">Thanks a lot for reading :)</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
</div>
n.srinivas raohttp://www.blogger.com/profile/17098167903629899833noreply@blogger.com0