A TEXT POST

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

Give execution and read/write permissions to the files. Just call the file you have created through any web browser.

A TEXT POST

Skipping pass phrase requirement while restarting a server

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 phrase prompt. Here is what we need to do:
1. Remove the encryption from the RSA private key (we will also preserve the original file):
$ cp server.key serverOld.key
$ openssl rsa -in serverOld.key -out server.key
2. We should make sure that server.key is only readable by root by:
$ chmod 400 server.key

After this we won’t be prompted for pass phrase every time we restart the server.

A TEXT POST

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 wvdial.conf file for these two entries:
Stupid Mode = 1
Auto DNS = 1
If they are not there, add them.
4. Save the file wvdial.conf and exit the text editor.
5. Now type sudo wvdial in the terminal and the EVDO should start working :)

FOR REFERENCE:
My /etc/wvdial.conf contains:

[Dialer Defaults]
Modem = /dev/ttyUSB1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = Analog Modem
Phone = #777
New PPPD = yes
ISDN = 0
Username = cdma
Password = cdma
Baud = 9600

A TEXT POST

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, 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.”

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.
This stands our one more contribution to the PHP community.

Just click on http://phpcamp.net/ and start reading the latest articles contributed by the campers.

I look forward to see you soon on PHPCamp.net

A TEXT POST

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 here.

So, now directly post a comment on his blog and ask him a question!

A TEXT POST

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 should have ‘proof of potential’ for our ideas.

When & Where?

January 17, 2009
SICSR
Symbiosis Institute of Computer Studies and Research,
7th Floor, Atur Centre, Gokhale Cross Road,
Model Colony, Pune - 411016.
Check for directions: http://www.sadakmap.com/p/SICSR/map/

Who all are attending?

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.

Did u find Lunch removed from the provided list and wondering what to do?

Here is a list of  nearby places where you can rush:

1. College Canteen
2. ELTIS Canteen (It’s again a symbi canteen, in the next building. It’s better than SICSR canteen.)
3. Just want to have bada pao, or bread pattis ? You can go to Siddhivinayak  (a tapri near om super market)
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)
5. Other places nearby are: Subham, Dragons (for chinese food), Shai(again near Pyramid Mall).

I guess that’s enough. I’m not here to advertise about the restaurants! huhhh! :)

What’s Next?
1. You can visit the IdeaCamp website and register yourself there.
2. You can follow the IdeaCamp twitter to have the latest informations.
3. You can continue reading my blog :) .

A TEXT POST

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 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 http://www.blogcampmumbai.org/ .

A TEXT POST

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?

  1. First of all download Tweetdates plugin
  2. Unrar the file.
  3. Open the file named tweetdates.php in any texteditor, and set $GLOBALS[‘twitterUserId’] = “twitterId”
  4. Finally, save the file and upload the plugin.
  5. Activate the plugin from the plugins configuration panel.
  6. Now write <!—TWEETDATES—> in any page or post where you want your twitter updates to appear.
Note: If you have problem using other plugin where cURL is used, you can use it.
A TEXT POST

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)
{
foreach($xml->channel->item as $tweet)
{
echo $tweet->pubDate.”\n”;
echo substr($tweet->description,10).”\n\n”;
}
}
else
{
echo “Error: RSS file not valid!”;
}
}
else
{
echo “Error: RSS file not found, dude. Username invalid or requires authentication”;
}
?>

Find the script live here: http://blog.amanjain.com/twitter