‘code’ Archive

IRCTC disabled right click

Many readers of my post on booking tatkal tickets with Firefox’s autofill forms extension have reported that IRCTC has now disabled right clicks. Not only does this hamper saving the form, it is also very annoying. I’ve found a workaround for this. After you fill in the form do not directly go and right click [...]

How to programmatically create and log in drupal users

Creating a new user is very easy in Drupal 6. Here’s how. <p>> <p>$new_user = array(</p> <p>&#8216;name&#8217; => $username,<br /> &#8216;mail&#8217; => $mail,<br /> &#8216;pass&#8217; => user_password(),<br /> &#8216;status&#8217; => 1,<br /> &#8216;auth_MODULENAME&#8217; => $username<br />)</p> <p>$user = user_save(NULL,$new_user)</p> <p>// log the user in</p> <p>$user = user_authenticate($new_user)</p> <p> Now for the explanation. We create a [...]

How to dump or export all the table definitions in a MySQL database

So you haveĀ  a database with loads of tables. You want the table definitions of all of them. You don’t really need the data. mysqldump to the rescue! mysqldump -u USERNAME &#8211;password=PASSWORD &#8211;no-data &#8211;opt DB1 > DUMPFILE That’s it! Easy as a pie The key here is the –no-data option. It dumps all the table [...]

Firebug opens automatically for all pages

Faced this bizzare issue today in Firefox. Firebug was opening automatically for all pages. Even on closing firebug, all I had to do was click on a new link in the same tab for it to appear again. This happened for all tabs. Turns out I had accidently turned on “On for all Web Pages” [...]

Gravatar support in Drupal

If you’ve been using WordPress you probably know about Gravatar. Gravatar is an abbreviation for “Globally Recognized Avatar”. It’s a service which provides an avatar across sites. While Gravatar support is built-in in WordPress, it requires an external module to be installed in Drupal. Recently I had to use the module in a Drupal 5 [...]

Pirate tweet

September 19 is International Talk Like a Pirate Day.For this day, the Yahoo! Query Language (YQL) team announced on the YDN blog that they were bringing out a “pirate table”. This table would allow us to translate plain English to piratespeak using YQL. I had been meaning to play around with YQL a bit and [...]