Archive for February, 2010

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 [...]

Helen Fry – Dilbert strip February 16, 2010

I didn’t really get this. Who the heck is Helen Fry? I had to read the comments in the site to realise “Go to Helen Fry” should be read as “Go to Hell and Fry”! There are other beauties in there as well – Sofa King, Helen Wait… PS : click on the image to [...]

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 [...]

How I recovered my Thunderbird mail from backup

So the best way to backup your mails from Thunderbird is to copy your complete profile directory. Follow these steps for restoring your mail. The fool that I am, instead of copying the full profile directory I ended up backing up just the Mail subdirectory in the profile directory. It took me a while to [...]