<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Geek is a lifestyle</title><generator>Tumblr (3.0; @amanjain)</generator><link>http://blog.amanjain.com/</link><item><title>Frontend AJAX in WordPress</title><description>&lt;p&gt;While working on &lt;a href="http://wpoid.com" rel="nofollow" title="One stop shop for all your WordPress related work."&gt;WPOID&lt;/a&gt;, I realized there are time where we use shortcodes in our plugin to display forms and we want to submit the form values using ajax. But since ajax functionality is by default only available for wordpress dashboard ie. the availability of &lt;a href="http://codex.wordpress.org/AJAX_in_Plugins" target="_blank"&gt;ajaxurl&lt;/a&gt; (admin-ajax.php) only when someone is logged in makes it really difficult.  So here is a piece of code which you can put in any file ex. ‘ajax.php’ and then put the file ‘ajax.php’ in your plugin’s directory and then use it as ajax url.&lt;/p&gt;
&lt;script src="https://gist.github.com/1575306.js"&gt; &lt;/script&gt;</description><link>http://blog.amanjain.com/post/15454031218</link><guid>http://blog.amanjain.com/post/15454031218</guid><pubDate>Tue, 25 Jan 2011 11:44:00 +0530</pubDate></item><item><title>Getting 403 error on HostGator when passing some parameters to the URL?</title><description>&lt;p&gt;Recently I was working on a URL shortner plugin for WordPress. The Plugin worked perfectly on our local machines, DreamHost and ServerGrove default installation too. There was a strange problem with HostGator, it was throwing error when ever the URL to shorten parameter had an URL with “.com” extension.

After a lot of research and coordination with HostGator Live Chat, we discovered that it was due to mod_security rules. The error log which I got was:
&lt;pre&gt;[Mon Jan xx xx:xx:xx xxxx] [error] [client xxx.xxx.xxx.xxxx] ModSecurity: Access denied with code 403 (phase 2). Match of "rx (/path-of-file)|(www/delivery/ajs.php)|(path-of-another-file)|(/wp-content/(themes|uploads)(?:/(\\\\w+))*/(tim)?thumb.php|/pl/download\\\\?file=http|/index\\\\.php/admin/system_config/save/section/payment/|^/b/ss/mxmacromedi ..." against "REQUEST_FILENAME" required. [file "/opt/mod_security/hg_rules.conf"] [line "69"] [id "xxxxxxx"] [msg "JITP:xxxx"] [hostname "xxxx.com"] [uri "xxxxxxx"] [unique_id "xxxxxxx"]
&lt;/pre&gt;
Which definitely is a mod_security rule. So just tell them about the same issue(otherwise they will take long time to figure out). And then you can ask them for a whitelisting.&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454030579</link><guid>http://blog.amanjain.com/post/15454030579</guid><pubDate>Mon, 10 Jan 2011 13:13:27 +0530</pubDate></item><item><title>Getting list of categories available in all wordpress NETWORK sites</title><description>&lt;p&gt;I was recently writing a wordpress network site plugin which required me to fetch list of categories in all network sites. After reading the documentation I figured out the following possible way: if we can get all the blog id’s in an array &lt;code&gt;$blog_id_list&lt;/code&gt; , then we can do:
&lt;pre class="brush:php"&gt;foreach($blog_id_list as $blog_id)
{
	switch_to_blog($blog_id);
	get_categories(); //use it as required.
}
restore_current_blog();&lt;/pre&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454029219</link><guid>http://blog.amanjain.com/post/15454029219</guid><pubDate>Sat, 08 Jan 2011 10:59:00 +0530</pubDate></item><item><title>Facebook connect localhost</title><description>&lt;p&gt;Building an application that uses Facebook Connect for login? Want you test the login locally? Here is how you will be able to use facebook connect locally:&lt;/p&gt;

&lt;p&gt;1. Go to your application page on facebook. &lt;a rel="nofollow" href="http://www.facebook.com/developers/editapp.php?app_id=xxxxxx"&gt;&lt;a href="http://www.facebook.com/developers/editapp.php?app_id=xxxxxx"&gt;http://www.facebook.com/developers/editapp.php?app_id=xxxxxx&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;
2. Select “Web Site” tab from the sidebar.&lt;br/&gt;
3. Add local.domain-name.tld to “Site Domain” field.&lt;br/&gt;
4. “Save Changes” on facebook.&lt;/p&gt;

&lt;p&gt;The next steps depends on your OS:&lt;br/&gt;
If you are on unix/linux type system:&lt;br/&gt;
5. Open the file  /etc/hosts, in your favorite text editor. (You will need root access to modify the file).&lt;br/&gt;
6. Add the “127.0.0.1  local.domain-name.tld” at the end of the file. For example. “127.0.0.1 local.magazinify.com”&lt;/p&gt;

&lt;p&gt;If your are on Windows:&lt;br/&gt;
5. The file to edit will be:&lt;br/&gt;
(Considering your OS is installed in C drive)&lt;br/&gt;
Windows 95/98/Me c:\windows\hosts&lt;br/&gt;
Windows NT/2000/XP Pro  c:\winnt\system32\drivers\etc\hosts&lt;br/&gt;
Windows XP Home/Vista/7 c:\windows\system32\drivers\etc\hosts&lt;br/&gt;
6. Open the file with Administrative rights in your text editor.&lt;br/&gt;
7. Add the “127.0.0.1  local.domain-name.tld” at the end of the file. For example. “127.0.0.1 local.magazinify.com”&lt;br/&gt;
8. Go to command prompt(press win-key+r then type cmd and press enter)&lt;br/&gt;
9. Type the command “ipconfig /flushdns”&lt;/p&gt;

&lt;p&gt;Incase you get a SSL error, something like “Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed thrown in ……/facebook.php  on line 512”&lt;br/&gt;
Add the following in your curl options:&lt;br/&gt;
CURLOPT_SSL_VERIFYPEER =&gt; false and&lt;br/&gt;
CURLOPT_SSL_VERIFYHOST =&gt; 2&lt;/p&gt;

&lt;p&gt;Now you can use the Facebook Connect login on your local machine, just access your project from &lt;a href="http://local.domain-name.tld/path-to-project"&gt;http://local.domain-name.tld/path-to-project&lt;/a&gt; instead of http://localhost/path-to-project from your local machine.&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454029958</link><guid>http://blog.amanjain.com/post/15454029958</guid><pubDate>Fri, 07 Jan 2011 15:34:50 +0530</pubDate></item><item><title>PHPCamp 2010 - What/When/Why/Where?</title><description>&lt;p&gt;&lt;strong&gt;What is PHPCamp?&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
PHPCamp is a ‘ad-hoc gathering’ for PHP community. It similar to barcamp, but more focused towards PHP based web application development.&lt;br/&gt;
It is targeting all the PHP enthusiast and starters to join this technical extravaganza this means that anyone can come to PHPCamp and participate.&lt;br/&gt;
  &lt;br/&gt;&lt;strong&gt;Why attend PHPCamp?&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
Navin has the best answer: “&lt;a href="http://punetech.com/attend-phpcamp-9th-jan-because-learning-from-humans-is-much-better-than-google/" target="_blank"&gt;Because learning from humans is much better than Google&lt;/a&gt;”&lt;br/&gt;
  &lt;br/&gt;&lt;strong&gt;But I am a student and I have classes…&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;a href="http://punetech.com/why-students-should-bunk-classes-to-attend-barcamppune-projects-internships-recos/" target="_blank"&gt;Here is why you should bunk classes to attend PHPCamp / BarcampPune: projects, internships, recosBarcamp?&lt;/a&gt;&lt;br/&gt;
  &lt;br/&gt;&lt;strong&gt;What to expect at PHPCamp?&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;
Knowledge, Knowledge and Knowledge. Oh! did I miss Free T-Shirt, Adobe® Flex™ Builder 3 Pro (Licensed Copy)  along with “Getting started resources” ( CD also includes lot of “Raffles” ) and of course you could be an “&lt;strong&gt;Expert&lt;/strong&gt;” in 8 hours.&lt;br/&gt;
  &lt;br/&gt;&lt;strong&gt;When and Where?&lt;/strong&gt;&lt;br/&gt;
 &lt;br/&gt;&lt;strong&gt;Venue:&lt;/strong&gt; SCDL(Symbiosis Center for Distance Learning), Pune&lt;br/&gt;&lt;strong&gt;Time: &lt;/strong&gt;9AM - 5PM. ( Please reach 15 mins prior )&lt;br/&gt;&lt;strong&gt;Landmark&lt;/strong&gt;: 3-5 mins walk from OM Super Market(Groceries Shop) / &lt;a rel="nofollow" href="http://sicsr.ac.in/"&gt;SICSR College&lt;/a&gt;&lt;br/&gt;
  &lt;br/&gt;
Register ASAP: &lt;a style="color: #3c78a7; text-decoration: none; padding: 0px; margin: 0px;" href="http://phpcamp.eventbrite.com/" target="_blank"&gt;&lt;a href="http://phpcamp.eventbrite.com/"&gt;http://phpcamp.eventbrite.com/&lt;/a&gt;&lt;/a&gt; &lt;strong&gt;The number of allowed participants are limited, we have already increased the number twice.&lt;/strong&gt;&lt;br/&gt;
  &lt;br/&gt;&lt;strong&gt;Event Website:&lt;/strong&gt;&lt;span style="padding: 0px; margin: 0px;"&gt; &lt;a href="http://phpcamp.org" target="_blank"&gt;&lt;a href="http://phpcamp.org"&gt;http://phpcamp.org&lt;/a&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;
  &lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454028519</link><guid>http://blog.amanjain.com/post/15454028519</guid><pubDate>Wed, 06 Jan 2010 15:55:36 +0530</pubDate></item><item><title>Password protect your directory without .htaccess</title><description>&lt;p&gt;.htaccess is generally used for basic authentication of a folder/website. The data of users logging in using .htaccess is not stored or kept. It works untill the user’s browser remembers the credentials.  And it would really be very difficult to keep track of users logging in using this method.

So, here is a very simple way of doing the same using HTTP authentication:

&lt;span style="color: #007700;"&gt;&lt;?&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;php
$myusername &lt;/span&gt;&lt;span style="color: #007700;"&gt;= &lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“amanjain.com”&lt;/span&gt;&lt;span style="color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$mypassword &lt;/span&gt;&lt;span style="color: #007700;"&gt;= &lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“amanjain”&lt;/span&gt;&lt;span style="color: #007700;"&gt;;
&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="color: #0000bb;"&gt; &lt;/span&gt;&lt;/span&gt;

&lt;span style="color: #007700;"&gt;/*The authentication technique can be different like using database or a key value pair file*/
if (&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$_SERVER&lt;/span&gt;&lt;span style="color: #007700;"&gt;[&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“PHP_AUTH_USER”&lt;/span&gt;&lt;span style="color: #007700;"&gt;] == &lt;/span&gt;&lt;span style="color: #dd0000;"&gt;”” &lt;/span&gt;&lt;span style="color: #007700;"&gt;|| &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$_SERVER&lt;/span&gt;&lt;span style="color: #007700;"&gt;[&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“PHP_AUTH_PW”&lt;/span&gt;&lt;span style="color: #007700;"&gt;] == &lt;/span&gt;&lt;span style="color: #dd0000;"&gt;”” &lt;/span&gt;&lt;span style="color: #007700;"&gt;||&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$_SERVER&lt;/span&gt;&lt;span style="color: #007700;"&gt;[&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“PHP_AUTH_USER”&lt;/span&gt;&lt;span style="color: #007700;"&gt;] != &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$myusername &lt;/span&gt;&lt;span style="color: #007700;"&gt;|| &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$_SERVER&lt;/span&gt;&lt;span style="color: #007700;"&gt;[&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“PHP_AUTH_PW”&lt;/span&gt;&lt;span style="color: #007700;"&gt;] != &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;$mypassword&lt;/span&gt;&lt;span style="color: #007700;"&gt;)
{&lt;/span&gt;

&lt;span style="color: #0000bb;"&gt;header&lt;/span&gt;&lt;span style="color: #007700;"&gt;(&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“HTTP/1.0 401 Unauthorized”&lt;/span&gt;&lt;span style="color: #007700;"&gt;);
&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;header&lt;/span&gt;&lt;span style="color: #007700;"&gt;(&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“WWW-Authenticate: Basic realm="This is my protected area"”&lt;/span&gt;&lt;span style="color: #007700;"&gt;); /*Replace  ”This is my protected area” with your personal message*/
echo &lt;/span&gt;&lt;span style="color: #dd0000;"&gt;“&lt;h1&gt;Authorization Required For Accessing Content.&lt;/h1&gt;”&lt;/span&gt;&lt;span style="color: #007700;"&gt;;/*If user cancels the authentication*/
die();&lt;/span&gt;

&lt;span style="color: #007700;"&gt;}&lt;/span&gt;

&lt;span style="color: #0000bb;"&gt;?&gt;&lt;/span&gt;

That’s it. Simple right?
&lt;/p&gt;&lt;div style="border-bottom: #aaaaaa 1px solid; border-left: #aaaaaa 1px solid; padding-bottom: 5px; margin: 10px; padding-left: 5px; padding-right: 5px; background: #ffffcc; font-size: 1em; border-top: #aaaaaa 1px solid; border-right: #aaaaaa 1px solid; padding-top: 5px"&gt;Check out &lt;a style="color: #008888; text-decoration: underline" title="PHP community where you learn something new every day " href="http://phpcamp.net/?utm_medium=blog_post&amp;utm_source=new_blog_at_amanjain&amp;utm_campaign=without_htaccess"&gt;PHPCamp.net&lt;/a&gt; a article sharing website relevant to our own PHP community&lt;/div&gt;</description><link>http://blog.amanjain.com/post/15454027872</link><guid>http://blog.amanjain.com/post/15454027872</guid><pubDate>Fri, 13 Nov 2009 15:29:21 +0530</pubDate></item><item><title>Taking screenshot of a website using PHP on windows os</title><description>&lt;p&gt;I have been trying to figure out a way using I could take a screenshot of any provided URL using PHP.
Finally I could find out a way of doing it and that is by using the COM object on windows os.

I have written a class for taking the screenshot.
For using it, all you need to do is:
&lt;p style="padding-left: 30px;"&gt;Download the class file from &lt;a href="http://blog.amanjain.com/wp-content/uploads/2009/11/akjScreenshot.class.php1.txt" target="_blank"&gt;here&lt;/a&gt;.
Rename it and remove the .txt entention
Include the class file in the required script.
And then,
Create a new object:
&lt;/p&gt;&lt;p style="padding-left: 60px;"&gt;$s = new akjScreenshot(“http://amanjain.com”);&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;Resize if required:&lt;/p&gt;

&lt;p style="padding-left: 60px;"&gt;$s-&gt;toWidth(100);
$s-&gt;toHeight(100);
&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;Save:&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;$s-&gt;save(“screen.jpg”);&lt;/p&gt;
&lt;p style="padding-left: 30px; "&gt;You can also save it in different formats like:&lt;/p&gt;

&lt;p style="padding-left: 60px;"&gt;$s-&gt;save(“screen.png”, “png”);
$s-&gt;save(“screen.gif”, “gif”);

I hope it helps :) Please leave a comment if you find it useful.
&lt;/p&gt;&lt;div style="border-bottom: #aaaaaa 1px solid; border-left: #aaaaaa 1px solid; padding-bottom: 5px; margin: 10px; padding-left: 5px; padding-right: 5px; background: #ffffcc; font-size: 1em; border-top: #aaaaaa 1px solid; border-right: #aaaaaa 1px solid; padding-top: 5px"&gt;Check out &lt;a style="color: #008888; text-decoration: underline" title="PHP community where you learn something new every day " href="http://phpcamp.net/?utm_medium=blog_post&amp;utm_source=new_blog_at_amanjain&amp;utm_campaign=screenshot"&gt;PHPCamp.net&lt;/a&gt; a article sharing website relevant to our own PHP community&lt;/div&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454026951</link><guid>http://blog.amanjain.com/post/15454026951</guid><pubDate>Thu, 12 Nov 2009 23:52:19 +0530</pubDate></item><item><title>Making mail() function of PHP work under windows os</title><description>&lt;p&gt;&lt;span style="color: #800080;"&gt;mail()&lt;/span&gt; is a useful function in &lt;span style="color: #800080;"&gt;PHP&lt;/span&gt; for sending mails, but many developers face problems in making mail() work properly on Windows.
&lt;br/&gt;
In the section &lt;span style="color: #800080;"&gt;[mail function]&lt;/span&gt; in the &lt;span style="color: #800080;"&gt;php.ini&lt;/span&gt; file, you’ll find three settings:
&lt;span style="color: #800080;"&gt;SMTP&lt;/span&gt;, &lt;span style="color: #800080;"&gt;sendmail_from&lt;/span&gt;, and &lt;span style="color: #800080;"&gt;sendmail_path&lt;/span&gt;.
&lt;br/&gt;
If your server runs on a &lt;span style="color: #800080;"&gt;Windows&lt;/span&gt; machine, you’ll have to set the SMTP option to point to your SMTP server for sending mail using PHP.
&lt;br/&gt;
So, we must understand that PHP must have the address of some SMTP server where it would deliver the mail to be sent and that is all PHP can actually do.
&lt;br/&gt;
So, we need  to set SMTP to the SMTP server and the sendmail_from option to the required email address.
Now if we want to use &lt;span style="color: #800080;"&gt;localhost&lt;/span&gt; as the &lt;span style="color: #800080;"&gt;SMTP server&lt;/span&gt;, we must have some SMTP server running on our system, simple isn’t it?  So we can download and install &lt;span style="color: #800080;"&gt;hMailServer&lt;/span&gt; from &lt;a href="http://www.hmailserver.com/"&gt;&lt;a href="http://www.hmailserver.com"&gt;www.hmailserver.com&lt;/a&gt;&lt;/a&gt;/ for serving our purpose.
&lt;br/&gt;
After installing the mail server make sure that you&lt;span style="color: #800080;"&gt; switch off  SMTP authentication for connections coming from localhost / 127.0.0.1&lt;/span&gt; in hMailServer for your mail() function to work.
&lt;br/&gt;
And this is how &lt;span style="color: #800080;"&gt;[mail function] &lt;/span&gt;part of your php.ini should look:
&lt;br/&gt;
[mail function]
; Setup for Windows systems
SMTP = localhost
sendmail_from = me@mydomain.tld&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454026218</link><guid>http://blog.amanjain.com/post/15454026218</guid><pubDate>Tue, 08 Sep 2009 10:54:52 +0530</pubDate></item><item><title>About Me</title><description>&lt;p&gt;Hi I am &lt;a href="https://plus.google.com/113051977091216812268/about" rel="me"&gt;Aman Kumar Jain&lt;/a&gt;, a Pune based web developer. I like to experiment with anything and everything that comes my way. I love travelling, photography and swimming. I can be seen with my Laptop most of the time. Friends call me GEEK and I believe Geek is a lifestyle.&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454007398</link><guid>http://blog.amanjain.com/post/15454007398</guid><pubDate>Mon, 31 Aug 2009 14:19:53 +0530</pubDate></item><item><title>gnUnify 2009 - Ajax with PHP</title><description>&lt;p&gt;I gave a talk on ajax at gnunify’09. This is the slide I used to give the talk.
&lt;div align="center"&gt;
&lt;div style="width:425px;text-align:center" id="__ss_1027025"&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=ajax-1234603554874246-3&amp;stripped_title=ajax-1027025"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=ajax-1234603554874246-3&amp;stripped_title=ajax-1027025" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;View more &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/jainaman"&gt;jainaman&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454025609</link><guid>http://blog.amanjain.com/post/15454025609</guid><pubDate>Sat, 14 Feb 2009 16:36:47 +0530</pubDate></item><item><title>gnUnify - 2009 on 13th &amp; 14th Feb at SICSR</title><description>&lt;p&gt;&lt;div style="text-align: center;"&gt;&lt;a title="gnUnify 2009" href="http://gnunify.in" target="_blank"&gt;
&lt;img class="size-full wp-image-208" title="gnUnify 2009" src="http://blog.amanjain.com/wp-content/uploads/2009/02/poster1.jpg" alt="gnUnify 2009" width="378" height="501"/&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454024803</link><guid>http://blog.amanjain.com/post/15454024803</guid><pubDate>Fri, 06 Feb 2009 19:30:28 +0530</pubDate></item><item><title>Create database backup &amp; email using php</title><description>&lt;p&gt;It is generally difficult to backup our database regularly and store them. With more and more storage space being provided by our email providers, we can write a script that can be called when required and it will automatically create database backup and mail it to the specified email.&lt;/p&gt;

&lt;p&gt;The following &lt;a href="http://blog.amanjain.com/wp-content/uploads/2009/02/ajdbbackup1.zip"&gt;zip&lt;/a&gt; contains two files:&lt;br/&gt;
1. ajDbBackup.class&lt;br/&gt;
2. backup.php&lt;/p&gt;

&lt;p&gt;ajDbBackup.class file contains the ajDbBackup class which can be used to backup the database. An example of usage is given in file backup.php .&lt;br/&gt;
To email backup create a php file in the same directory where ajDbBackup.class is kept with the following data:&lt;br/&gt;
&lt;?php&lt;br/&gt;
include ‘./ajDbBackup.class’;&lt;br/&gt;
$backup = new ajDbBackup;&lt;br/&gt;
$backup-&gt;emailTo = “email@domain.tld”;&lt;br/&gt;
$backup-&gt;emailFrom = “emailTwo@domain.tld”;&lt;br/&gt;
$backup-&gt;host = “mysqlHost”;&lt;br/&gt;
$backup-&gt;user = “mysqlUser”;&lt;br/&gt;
$backup-&gt;password = “mysqlUserPassword”;&lt;br/&gt;
$backup-&gt;dbName = “mysqlDbNameToBeBacked”;&lt;br/&gt;
$backup-&gt;ajMail();&lt;br/&gt;
?&gt;&lt;/p&gt;

&lt;p&gt;Give execution and read/write permissions to the files. Just call the file you have created through any web browser.&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454024074</link><guid>http://blog.amanjain.com/post/15454024074</guid><pubDate>Sun, 01 Feb 2009 21:10:33 +0530</pubDate></item><item><title>Skipping pass phrase requirement while restarting a server</title><description>&lt;p&gt;There are a lot of times we need to write automated script which can start/restart a server when ever required. Or generally if we are restarting the server quite a lot of time (maybe for testing purpose), we are prompted to enter pass phrase if we have installed  &lt;span class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: 'times new roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;libapache-mod-ssl&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;/span&gt;and have configured with any one of the domains on the server.&lt;/p&gt;

&lt;p&gt;So, sometimes we feel the need of skipping the pass phrase prompt. Here is what we need to do:&lt;br/&gt;
1. Remove the encryption from the RSA private key (we will also preserve the original file):&lt;br/&gt;&lt;strong&gt; $ cp server.key serverOld.key&lt;/strong&gt;&lt;br/&gt;&lt;strong&gt;$ openssl rsa -in serverOld.key -out server.key &lt;/strong&gt;&lt;br/&gt;
2. We should make sure that server.key is only readable by root by:&lt;br/&gt;&lt;strong&gt; $ chmod 400 server.key &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After this we won’t be prompted for pass phrase every time we restart the server.&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454023340</link><guid>http://blog.amanjain.com/post/15454023340</guid><pubDate>Wed, 28 Jan 2009 21:38:32 +0530</pubDate></item><item><title>Using BSNL EVDO modem on Ubuntu 8.10</title><description>&lt;p&gt;We will use wvdial for using EVDO. Wvdial dialer is PPP dialer, which dials a modem and starts PPP to connect to the Internet.&lt;/p&gt;

&lt;p&gt;Steps to connect are:&lt;br/&gt;
1. As &lt;em&gt;root&lt;/em&gt;, in terminal, type :&lt;br/&gt;&lt;span class="input"&gt;# wvdialconf /etc/wvdial.conf&lt;/span&gt;&lt;br/&gt;
2. Now edit &lt;strong&gt;/etc/wvdial.conf, type:&lt;/strong&gt;&lt;br/&gt;&lt;span class="input"&gt;# vim /etc/wvdial.conf&lt;/span&gt;&lt;br/&gt;
2. Now enter your &lt;strong&gt;username&lt;/strong&gt;, &lt;strong&gt;password&lt;/strong&gt;, &amp; &lt;strong&gt;phone no&lt;/strong&gt; as:&lt;br/&gt;&lt;span class="input"&gt;Phone = #777&lt;br/&gt;
Username = cdma&lt;br/&gt;
Password = cdma&lt;/span&gt;&lt;br/&gt;
3.Check your &lt;em&gt;wvdial.conf &lt;/em&gt; file for these two entries:&lt;br/&gt;
Stupid Mode = 1&lt;br/&gt;
Auto DNS = 1&lt;br/&gt;
If they are not there, add them.&lt;br/&gt;
4. Save the file &lt;strong&gt;wvdial.conf&lt;/strong&gt; and exit the text editor.&lt;br/&gt;
5. Now type &lt;strong&gt;sudo wvdial&lt;/strong&gt; in the terminal and the EVDO should start working :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FOR REFERENCE:&lt;/strong&gt;&lt;br/&gt;
My &lt;strong&gt;/etc/wvdial.conf &lt;/strong&gt;contains:&lt;/p&gt;

&lt;p&gt;[Dialer Defaults]&lt;br/&gt;
Modem = /dev/ttyUSB1&lt;br/&gt;
Init1 = ATZ&lt;br/&gt;
Init2 = ATQ0 V1 E1 S0=0 &amp;C1 &amp;D2 +FCLASS=0&lt;br/&gt;
Stupid Mode = 1&lt;br/&gt;
Modem Type = Analog Modem&lt;br/&gt;
Phone = #777&lt;br/&gt;
New PPPD = yes&lt;br/&gt;
ISDN = 0&lt;br/&gt;
Username = cdma&lt;br/&gt;
Password = cdma&lt;br/&gt;
Baud = 9600&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454022655</link><guid>http://blog.amanjain.com/post/15454022655</guid><pubDate>Mon, 26 Jan 2009 21:15:59 +0530</pubDate></item><item><title>Announcing PHPCamp.net</title><description>&lt;p&gt;It is my pleasure to let you know that most awaited PHPCamp.net is now launched.&lt;/p&gt;

&lt;p&gt;I am happy to give you an early invite to &lt;a href="http://phpcamp.net/become-a-camper" target="_blank"&gt;join PHPCamp.net&lt;/a&gt;- a site dedicated to our PHP community.&lt;/p&gt;

&lt;p&gt;It’s just not yet another website for campers but much more to it.&lt;/p&gt;

&lt;p&gt;In words of Denham Grey:&lt;br/&gt;&lt;em&gt;“Knowledge is embodied in people gathered in communities and networks. The road to knowledge is via people, conversations, connections and relationships. Knowledge surfaces through dialog, all knowledge is socially mediated and access to knowledge is by connecting to people that know or know who to contact.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The aim of PHPCamp.net is to bring together all the PHP developers and share knowledge with each other by posting articles, comments, news, events, happenings and much more. It is easy to use, has a friendly UI and above all provides a platform where all campers could build contacts with each other.&lt;br/&gt;
This stands our one more contribution to the PHP community.&lt;/p&gt;

&lt;p&gt;Just click on &lt;a href="http://phpcamp.net/" target="_blank"&gt;&lt;a href="http://phpcamp.net/"&gt;http://phpcamp.net/&lt;/a&gt;&lt;/a&gt; and start reading the latest articles contributed by the campers.&lt;/p&gt;

&lt;p&gt;I look forward to see you soon on &lt;a href="http://phpcamp.net/" target="_blank"&gt;PHPCamp.net&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454021750</link><guid>http://blog.amanjain.com/post/15454021750</guid><pubDate>Sun, 25 Jan 2009 11:23:54 +0530</pubDate></item><item><title>Mr. L K Advani blogging</title><description>&lt;p&gt;Yeah! you read it correct!&lt;br/&gt;
After seeing the effect of web media in election, now Indian politicians are also following the same path. It’s good to know that! I don’t have much idea about other politician’s blogging. But here is a link to &lt;a title="Mr. L K Advani's Blog" href="http://blog.lkadvani.in" target="_blank"&gt;Mr. L K Advani’s blog&lt;/a&gt;. Please do add a comment here if you find the link to blog of other political people so that I can add ‘em here.&lt;/p&gt;

&lt;p&gt;So, now directly post a comment on his blog and ask him a question!&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454021012</link><guid>http://blog.amanjain.com/post/15454021012</guid><pubDate>Wed, 14 Jan 2009 00:46:02 +0530</pubDate></item><item><title>IdeaCamp Pune 2</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style="color: #3366ff;"&gt;What is IdeaCamp ?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IdeaCamp, is a self-organized gathering to share ideas and see them shape by applying divergent thinking. The objective of the camp is to get people from different roles like designers, entrepreneurs, financers, creative minds, technology evangelists, product managers and marketers together to bandy ideas from everyone’s viewpoint. Ideally by end of the gathering we should have ‘proof of potential’ for our ideas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style="color: #3366ff;"&gt;When &amp; Where?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;January 17, 2009&lt;br/&gt;
SICSR&lt;br/&gt;&lt;a title="SICSR" rel="nofollow" href="http://www.symbiosiscomputers.com/v5/home/index.php" target="_blank"&gt; Symbiosis Institute of Computer Studies and Research&lt;/a&gt;,&lt;br/&gt;
7th Floor, Atur Centre, Gokhale Cross Road,&lt;br/&gt;
Model Colony, Pune - 411016.&lt;br/&gt;
Check for directions: &lt;a title="SICSR Driving direction" rel="nofollow" href="http://www.sadakmap.com/p/SICSR/map/" target="_blank"&gt;&lt;a href="http://www.sadakmap.com/p/SICSR/map/"&gt;http://www.sadakmap.com/p/SICSR/map/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style="color: #3366ff;"&gt;Who all are attending?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As the description of IdeaCamp says people from different roles like designers, entrepreneurs, financers, creative minds, technology evangelists, product managers are a part of it. And not just from Pune, people form different places get together here at IdeaCamp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style="color: #3366ff;"&gt;Did u find Lunch removed from the provided list and wondering what to do?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is a list of  nearby places where you can rush:&lt;/p&gt;

&lt;p&gt;1. College Canteen&lt;br/&gt;
2. ELTIS Canteen (It’s again a symbi canteen, in the next building. It’s better than SICSR canteen.)&lt;br/&gt;
3. Just want to have bada pao, or bread pattis ? You can go to Siddhivinayak  (a tapri near om super market)&lt;br/&gt;
4. Ah! are you a pure veggi ? no problem! Go to Akshay pure veg restaurant . You can even  have good juices and shakes here. (It’s near Pyramid Mall)&lt;br/&gt;
5. Other places nearby are: Subham, Dragons (for chinese food), Shai(again near Pyramid Mall).&lt;/p&gt;

&lt;p&gt;I guess that’s enough. I’m not here to advertise about the restaurants! huhhh! :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style="color: #3366ff;"&gt;What’s Next?&lt;/span&gt;&lt;/strong&gt;&lt;br/&gt;
1. You can visit the &lt;a title="IdeaCamp Pune 2" href="http://barcamp.org/IdeaCampPune2" target="_blank" rel="nofollow"&gt;IdeaCamp&lt;/a&gt; website and register yourself there.&lt;br/&gt;
2. You can follow the &lt;a title="IdeaCamp Twitter" href="http://twitter.com/IdeaCampPune2" target="_blank" rel="nofollow"&gt;IdeaCamp twitter &lt;/a&gt;to have the latest informations.&lt;br/&gt;
3. You can continue reading my blog :) .&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454020535</link><guid>http://blog.amanjain.com/post/15454020535</guid><pubDate>Sun, 11 Jan 2009 10:19:27 +0530</pubDate></item><item><title>BlogCamp Mumbai</title><description>&lt;p&gt;&lt;strong&gt;Blogcamp&lt;/strong&gt;, said to be the biggest blog unconference in India on the lines of barcamp, is going to be held at &lt;span style="color: #3366ff;"&gt;&lt;strong&gt;Microsoft Corporation, Windsor Building, Kalina, Santacruz (East), Mumbai&lt;/strong&gt;&lt;/span&gt; on &lt;span style="color: #3366ff;"&gt;&lt;strong&gt;17th January 2009&lt;/strong&gt;&lt;/span&gt; from &lt;span style="color: #3366ff;"&gt;&lt;strong&gt;10:00 am - 5:00 pm &lt;/strong&gt;&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;It is a must attend for the bloggers who wish to know more about the blogsphere. It is a place where you would you find a geek, a software engineer, cricketer, may be a chessmaster,  journalists and even photographers  come together and discuss something in common.  For those who want to check and register for the event can visit the official website &lt;a title="BlogCamp Mumbai" href="http://www.blogcampmumbai.org/" target="_self"&gt;&lt;strong&gt;&lt;a href="http://www.blogcampmumbai.org/"&gt;http://www.blogcampmumbai.org/&lt;/a&gt;&lt;/strong&gt;&lt;/a&gt; .&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454019624</link><guid>http://blog.amanjain.com/post/15454019624</guid><pubDate>Wed, 07 Jan 2009 16:22:29 +0530</pubDate></item><item><title>Tweetdates - my first wordpress plugin</title><description>&lt;p&gt;Download it from &lt;a title="Twitterdates Download" href="http://tools.amanjain.com/wp/tweetdates.rar"&gt;here&lt;/a&gt;.

It is my first wordpress plugin. It is a simple Wordpress plugin to display tweets on your wordpress blog.

&lt;em&gt;&lt;strong&gt;What is does?&lt;/strong&gt;&lt;/em&gt;

It fetches your latest tweets from tweeter and displays it on your page.

&lt;em&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/em&gt;

This plugin is compatible with wordpress 2.7 and released under &lt;a rel="nofollow" href="http://www.gnu.org/copyleft/gpl.html"&gt;GPL&lt;/a&gt; agreement.

&lt;em&gt;&lt;strong&gt;How to use it?&lt;/strong&gt;&lt;/em&gt;
&lt;/p&gt;&lt;ol&gt;&lt;li&gt;First of all download &lt;a title="Twitterdates Download" href="http://tools.amanjain.com/wp/tweetdates.rar"&gt;Tweetdates&lt;/a&gt; plugin&lt;/li&gt;
	&lt;li&gt;Unrar the file.&lt;/li&gt;
	&lt;li&gt;Open the file named tweetdates.php in any texteditor, and set   $GLOBALS[‘twitterUserId’]  = “twitterId”&lt;/li&gt;
	&lt;li&gt;Finally, save the file and upload the plugin.&lt;/li&gt;
	&lt;li&gt;Activate the plugin from the plugins configuration panel.&lt;/li&gt;
	&lt;li&gt;Now write &lt;!—TWEETDATES—&gt; in any page or post where you want your twitter updates to appear.&lt;/li&gt;
&lt;/ol&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/em&gt;

&lt;em&gt;&lt;strong&gt;If you have problem using other plugin where cURL is used, you can use it.
&lt;/strong&gt;&lt;/em&gt;</description><link>http://blog.amanjain.com/post/15454019017</link><guid>http://blog.amanjain.com/post/15454019017</guid><pubDate>Mon, 05 Jan 2009 01:26:21 +0530</pubDate></item><item><title>Fetch twitter updates via PHP</title><description>&lt;p&gt;Want to display your (or maybe be someone else’s) public timeline using php? Ok, here’s the solution for it:&lt;/p&gt;

&lt;p&gt;&lt;?php&lt;br/&gt;
$username = “amanjain”;&lt;br/&gt;
$rssUrl = “http://twitter.com/statuses/user_timeline/$username.rss”;&lt;br/&gt;
$rss = @file_get_contents($rssUrl);&lt;/p&gt;

&lt;p&gt;if($rss)&lt;br/&gt;
{&lt;br/&gt;
$xml = @simplexml_load_string($rss);&lt;!--more--&gt;&lt;br/&gt;
if($xml !== false)&lt;br/&gt;
{&lt;br/&gt;
foreach($xml-&gt;channel-&gt;item as $tweet)&lt;br/&gt;
{&lt;br/&gt;
echo $tweet-&gt;pubDate.”\n”;&lt;br/&gt;
echo substr($tweet-&gt;description,10).”\n\n”;&lt;br/&gt;
}&lt;br/&gt;
}&lt;br/&gt;
else&lt;br/&gt;
{&lt;br/&gt;
echo “Error: RSS file not valid!”;&lt;br/&gt;
}&lt;br/&gt;
}&lt;br/&gt;
else&lt;br/&gt;
{&lt;br/&gt;
echo “Error: RSS file not found, dude. Username invalid or requires authentication”;&lt;br/&gt;
}&lt;br/&gt;
?&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Find the script live here: &lt;a title="Aman's Twitter Updates" href="http://blog.amanjain.com/twitter" target="_blank"&gt;&lt;a href="http://blog.amanjain.com/twitter"&gt;http://blog.amanjain.com/twitter&lt;/a&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;</description><link>http://blog.amanjain.com/post/15454018379</link><guid>http://blog.amanjain.com/post/15454018379</guid><pubDate>Sun, 04 Jan 2009 12:10:51 +0530</pubDate></item></channel></rss>

