January 2011
4 posts
Frontend AJAX in WordPress
While working on WPOID, 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 ajaxurl (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...
Jan 24th
Getting 403 error on HostGator when passing some...
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...
Jan 9th
Getting list of categories available in all...
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 $blog_id_list , then we can do: foreach($blog_id_list as $blog_id) { switch_to_blog($blog_id); get_categories(); //use it as...
Jan 7th
Facebook connect localhost
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: 1. Go to your application page on facebook. http://www.facebook.com/developers/editapp.php?app_id=xxxxxx 2. Select “Web Site” tab from the sidebar. 3. Add local.domain-name.tld to “Site Domain” field. 4....
Jan 6th
PHPCamp 2010 - What/When/Why/Where?
What is PHPCamp?   PHPCamp is a ‘ad-hoc gathering’ for PHP community. It similar to barcamp, but more focused towards PHP based web application development. It is targeting all the PHP enthusiast and starters to join this technical extravaganza this means that anyone can come to PHPCamp and participate.    Why attend PHPCamp?   Navin has the best answer: “Because learning...
Jan 5th
November 2009
2 posts
Password protect your directory without .htaccess
.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: <?php $myusername...
Nov 12th
Taking screenshot of a website using PHP on...
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: Download the class file from here. Rename it and remove the .txt entention Include the class file in the required...
Nov 12th
September 2009
1 post
Making mail() function of PHP work under windows...
mail() is a useful function in PHP for sending mails, but many developers face problems in making mail() work properly on Windows. In the section [mail function] in the php.ini file, you’ll find three settings: SMTP, sendmail_from, and sendmail_path. If your server runs on a Windows machine, you’ll have to set the SMTP option to point to your SMTP server for sending mail using...
Sep 7th
August 2009
1 post
About Me
Hi I am Aman Kumar Jain, 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.
Aug 30th
February 2009
3 posts
gnUnify 2009 - Ajax with PHP
I gave a talk on ajax at gnunify’09. This is the slide I used to give the talk. View more presentations from jainaman.
Feb 14th
gnUnify - 2009 on 13th & 14th Feb at SICSR
Feb 6th
Create database backup & email using php
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. The following zip contains two files: 1. ajDbBackup.class 2. backup.php ajDbBackup.class file contains the...
Feb 1st
January 2009
8 posts
Skipping pass phrase requirement while restarting...
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  libapache-mod-ssl and have configured with any one of the domains on the server. So, sometimes we feel the need of skipping the pass...
Jan 28th
Using BSNL EVDO modem on Ubuntu 8.10
We will use wvdial for using EVDO. Wvdial dialer is PPP dialer, which dials a modem and starts PPP to connect to the Internet. Steps to connect are: 1. As root, in terminal, type : # wvdialconf /etc/wvdial.conf 2. Now edit /etc/wvdial.conf, type: # vim /etc/wvdial.conf 2. Now enter your username, password, & phone no as: Phone = #777 Username = cdma Password = cdma 3.Check your...
Jan 26th
Announcing PHPCamp.net
It is my pleasure to let you know that most awaited PHPCamp.net is now launched. I am happy to give you an early invite to join PHPCamp.net- a site dedicated to our PHP community. It’s just not yet another website for campers but much more to it. In words of Denham Grey: “Knowledge is embodied in people gathered in communities and networks. The road to knowledge is via people,...
Jan 24th
Mr. L K Advani blogging
Yeah! you read it correct! 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 Mr. L K Advani’s blog. Please do add a comment here if you find the link to blog of other political people so that I can add ‘em...
Jan 13th
IdeaCamp Pune 2
What is IdeaCamp ? 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...
Jan 10th
BlogCamp Mumbai
Blogcamp, said to be the biggest blog unconference in India on the lines of barcamp, is going to be held at Microsoft Corporation, Windsor Building, Kalina, Santacruz (East), Mumbai on 17th January 2009 from 10:00 am - 5:00 pm . 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...
Jan 7th
Tweetdates - my first wordpress plugin
Download it from here. It is my first wordpress plugin. It is a simple Wordpress plugin to display tweets on your wordpress blog. What is does? It fetches your latest tweets from tweeter and displays it on your page. Requirements: This plugin is compatible with wordpress 2.7 and released under GPL agreement. How to use it? First of all download Tweetdates plugin Unrar the file. Open the...
Jan 4th
Fetch twitter updates via PHP
Want to display your (or maybe be someone else’s) public timeline using php? Ok, here’s the solution for it: <?php $username = “amanjain”; $rssUrl = “http://twitter.com/statuses/user_timeline/$username.rss”; $rss = @file_get_contents($rssUrl); if($rss) { $xml = @simplexml_load_string($rss); if($xml !== false) {...
Jan 3rd
December 2008
16 posts
Simple AJAX optimization
When ever we write an ajax code to create the AJAX objectwe tend to do it like: function createAjaxObject() { if(window.XMLHttpRequest) { ajaxObject =  new XMLHttpRequest(); return ajaxObject; } else if(window.ActiveXObject) { ajaxObject = new ActiveXObject(“Microsoft.XMLHTTP”); return ajaxObject; } else if(document.ActiveXObject) { ajaxObject = new...
Dec 30th
Picasa gallery on your webpage
Add picasa gallery slideshow to your webpage, by doing the following: Step 1: Copy the rss link of the album: Example: http://picasaweb.google.com/data/feed/base/user/Photogallery.Aman/albumid/5092510745304823985?alt=rss&kind=photo&hl=en_GB Step 2: Now replace the bold part ie. “base” by “api”. So, the link...
Dec 30th
Google's SEO starter guide
While reading about Content Analysis on google’s webmasters tools, I found that Google has recently released it SEO stater guide on 13 November 2008. The pdf can be downloaded from here.
Dec 29th
prevent openDNS from routing Google searches
I recently tried pinging www.google.com while using openDNS and came to know that openDNS redirects all the google searches through it’s servers that is  google.navigation.opendns.com. That is, if you do any search from your Mozilla or IE toolbar while using openDNS it will be redirected through openDNS. I don’t know the reasons behind it and have no valid reasons except for the...
Dec 27th
php code to get Google pagerank
While reading about SEO ( Search engine optimization ) on various blogs and forums. I found people willing to know the procedure of getting their website’s  Google Pagerank through php. Searching more about it and then following the Google toolbar which give’s the google pagerank, I got the way of getting google page rank of any website through php. You can download the script here....
Dec 26th
Apache2 php5 & mysql installation through ssh (on...
I have seen lots of forum where newbies face problem while installing lamp server. So, what they can do is directly file the following line of code and everything will be done automatically: sudo apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl...
Dec 25th
Location information using Google api
Google Code Blog – google.loader.ClientLocation tells you the city, country, region, longitude and latitude based on the IP address of the client. curl -i -s http://www.google.com/jsapi | grep ClientLocationgoogle.loader.ClientLocation =...
Dec 23rd
Google SearchWiki
Google SearchWiki — a new feature that allows you to move and comment on search results — has been out for less than a day, and it’s amazing to see how much confusion (as well as commentary) there is already developing. So below, some clarification on how it works, opportunities search marketers should consider, some privacy issues and ideas for improving it. What is SearchWiki? Go read our...
Dec 22nd
Batch download images from Flickr
I currently attended openSocial Developer Garage.Now most of the people who have clicked imaged have uploaded then to Flickr. And you must be knowing that flickr has no options to allow it’s user to download multiple images at one go. So while searching on the net I found a tool which allows to search and download multiple Images at a time. Here is the link to the application: Download. ...
Dec 22nd
Veganism - A new way
Today while I and Dexter sir were talking in SDRC, as usual a mama came with a cup of tea for me. I asked mama to bring one more cup of tea/coffee for sir. Arter the sir said he has left drinking Coffee/Tea. He said he has become “Vegan”.  I quickly googled for the same and found out: Veganism is a diet and lifestyle that seeks to exclude the use of animals for food, clothing, or any...
Dec 22nd
openDNS - What & Why ?
Firstly: What is DNS ? Domain Name System (DNS) is a database system that translates a computer’s fully qualified domain name into an IP address. Networked computers use IP addresses to locate and connect to each other, but IP addresses can be difficult for people to remember.  For example, on the web, it’s much easier to remember the domain name www.amazon.com than it is to...
Dec 21st
Section 49-0 of constitution
“right To Say No” It has been on lots of forum and blogs  that we can say “I VOTE NOBODY” when we go to vote… because, in a ward, if a candidate wins, say by 123 votes, and that particular ward has received “49-O” votes more than 123, then that polling will be cancelled and will have to be re-polled. Not only that, but the candidature of the contestants...
Dec 20th
Parse XML with php
Times may come when you want to parse an XML page with php .. or read feeds with php. “So, how to do it ?” .. is the question.. Here’s it: $fileURL = “./fileName.xml”;  //Specify the path(or Link of the xml file. ) $string = file_get_contents($fileURL);  //This will load the wole content of xml file into the variable. $xml = simplexml_load_string($string); ...
Dec 20th
GeoEye-1 Satellite Pic (Is that Your House?)
GeoEye-1 satellite sensor was successfully launched on Saturday, September 6, 2008 at 11:50:57 Hrs (PDT) aboard the United Launch Alliance (ULA) Delta II launch vehicle, procured from Boeing Launch Services, from Vandenberg Air Force Base in California. With the GeoEye-1 successful launch, GeoEye was ready to start full commercial operations for GeoEye-1 imaging products a few months after...
Dec 20th
Virtual subdomains
With the ever dynamic web world and to turn the web from a passive to an active entity , webmasters are fascinated with the idea of having subdomains for users like http://user.domain.ext.  Looks quite neat and tricky. Yes that can be done easily, just by some configurations in your website cPanel. The steps are: A. Login to cPanel 2. Then go to subdomains(… Dont worry u need not add...
Dec 20th
Opensocial Developer Garage'08
Opensocial Developer Garage’08 was an event organized by a  group of OpenSocial enthusiasts from pune have come together to bring this event. The event was aimed to unite all the OpenSocial Application Developers from all over the country and just share/code/have fun and maybe inspire a few wannabee. The event started late with 3 words introduction by all, followed by Rajdeep from...
Dec 20th