Sunday, February 27, 2011

How to list contents of a .tar.gz without unzip

This one should be included in the UNIX system administration FAQ as it is very handy and a common request...More than often we end up with a filled up disk or partition but while deciding whether deleting that massive zip file we forget its real content. Of course, unarchiving it is impossible due to lack of space, and to make things worse FTP and SCP are disabled! A nightmare...But worry not - there is an easy way to inspect the content of a zip, gzip, tar, or bzip archives in Unix.

# To show content of a tar file
tar -tvf foo.tar
# To show content of a gzip file
tar -ztvf foo.tar.gz
# To show content of a bzip file
tar -jtvf foo.tar.bz

Saturday, February 26, 2011

Sharing one single database across multiple Drupal installations

More often than not, Drupal users get confident and enthusiastic and start creating more than one Drupal website. But there is one big problem - their hosting service only provides one database! Instead of paying more bucks for another database, there is another way to use multiple Drupal installations on the same database...

The solution to this problem is by using a technique called 'Prefixing' whereby you prefix all the table names for that Drupal installation. In other words if you have multiple website, you can share their tables within the same database by naming them as follows:

site1_drupal_table1
site1_drupal_table2
site1_drupal_table3
...
site2_drupal_table1
site2_drupal_table2
site2_drupal_table3


The prefix can be set for each Drupal site installation by editing the file 'settings.php' and setting the $db_prefix template. So for the above example you can set the prefix for site1, but adding this line in settings.php:

$db_prefix = 'site1_';



What happens is that once you run the Drupal installation wizard for site1, all the newly created tables will have the 'site1_' prefix appended to them. This will make tables from different Drupal installations to co-exist within the same database!

Note that you can use the same trick for existing sites which have already been installed. The difference is that you need to manually rename each existing table (ex. through scripts).

Monday, February 14, 2011

Nice sunday ride!

Fitted new GPR exhaust on my CBF 500, and tested it this morning with my brothers! Awesome rumbling sound!! teheheh..