Process older log files in AWStats

Published on 21 March 2013 - 7:22am
Look for your DataDir of your website and remove the particular month of the file. In our case, we are using Virtualmin that installs the AWStats and by default the DataDir of the site is stored in /var/www/awstats/[site-domain]. For example, if the site domain is gix.my, the directory that stores all the AWstats data files would be in /var/www/awstats/gix.my. You may want to backup that folder first before you start to do anything with the files. Make sure that you have the old log files that needs to be processed by AWStats.

Render a field view value in your custom module

Published on 3 September 2012 - 6:20am

In a theme's node.tpl.php, we can easily render a field view using Drupal's render().

For example, we have a field name field_integer with the label My integer. To display the field in the node.tpl.php, we can just call it out using render($content['field_integer']);, which will display like the following (Assuming it is the default manage display setting for the field):

My integer:3 200

However, what if you want to render the field in your custom module? You won't be able to use render($content['field_name']).

Fix corrupted filesystem in Amazon EC2

Published on 20 June 2012 - 8:36pm

Is your Amazon EC2 having the similar problem below?

fsck died with exit status 8
failed (code 8).
*File system check failed.
A log is being saved in /var/log/fsck/checkfs if that location is writable.
Please repair the file system manually.
*A maintenance shell will now be started.
CONTROL-D will terminate this shell and resume system boot.
Give root password for maintenance
(or type Control-D to continue):

Programmatically creating / deleting / modifying field-collection item for a node

Published on 10 May 2012 - 8:19pm
If you have use Field-Collection module (http://drupal.org/project/field_collection), you would know how useful it is when you need to create a node with grouped value. However, due to how field-collection utilizes Entity API, you will not be able to programmatically update its value directly. Here's a great example on how you could do so

MySQL Can't open file (Errno: 24)

Published on 17 March 2012 - 8:16pm
[ERROR] /usr/sbin/mysqld: Can't open file: './database/table.frm' (errno: 24)

If you are facing this irritating problem, which not only took me hours to figure it out but also caused a little panic because it wasn't fixed although I rebooted the MySQL and the server itself - do not worry as this can be fixed very easily!