Apache Tuning

Technologies: 

Enable Mod Expires
Drupal states via .htaccess that if mod_expires is on, it caches all files for 2 weeks. This means that the browser would cache static content.

Set KeepAlive On For Apache to wait until all the elements of a page requests are provided.

MaxKeepAliveRequests -> How many download requests per page.. [Check with Firebug]

KeepAliveTimeOut 15 --> How many seconds required for the page to load completely in the browser. 4 sec is a good threshold.

Theming CCK Fields

Technologies: 

There may be some situations wherein one would like to dispaly each CCK field in particular way.For example by default you have a lot of free space available in the right hand side of the node.One can theme CCK Fields so that it appears in free space.

How to do this?

MySQL Tuning Best Practices

Technologies: 

Based on video from lullabot, the following settings in my.cnf file in mysql for drupal performance and handling:

Before beginning to start using MySQL it is recommended to run the script provided by MySQL to provide some security features.
The link is: /usr/bin/mysql_secure_installation . The location can vary. It basically requests for root password, disabling remote root login, remove anonymous users and other security setting.

Character Set: utf8. Drupal mostly expects the default character set to be utf8.
default_character_set=utf8

Display different home page based on User Roles

Technologies: 

Use Panels!
Create layout as you like and set the panel as the home page of the site in the Site Information section. Add content in the panels with view permissions for specific user role. This would ensure that a user would be able to view specific content based on their role.
Take care to ensure that a user does not have 2 roles :)

How to get the total number of nodes displayed by the view

Technologies: 

There are times where we would want to view the total number of rows or data rows displayed in a view. The best way to do is to add a PHP snippet in the header section of a view. Fortunately, drupal views allow for adding code snippet into header and footer of a view.

However, this code snippet will work only if pager is enabled in the view. The code snippet:

<?php
  $view
= views_get_current_view();
  print
"<h4> Total Blood Banks: ".$view->total_rows." </h4>";
?>

In-case, you would want to get data from a particular view, you can provide the snippet:

Update Comment Status of a Node

Just recently I had the issue where a list of nodes imported via user import as a content profile had comment status disabled.

There were thousand of nodes to update, hence the best way was to use VBO. However, there was no option provided for comment status update, hence the alternative was to execute "Arbitrary PHP Code".

The following snippet below can be used for updating node status for nodes selected in VBO:

Add Tab - A Simple Drupal Module

Technologies: 

addtab is a simple Drupal Module that adds a tab that provides links for adding same content type, ie whenever a content is viewed a tab would appear that would link to creating similar content.

The Create tab that you can see in this page being displayed is basically due to this module.

A drupal module consists primarily of two files .info and .module file.

addtab.info:

; $Id$ addtab.info,v 1.0 2011/02/20 01:26:00 amitsedai Exp $
name = addtab
description = Creates a new tab in a node view for adding same content type
core = 6.x

Apache URL Redirection on VPS

I faced an issue with redirecting a particular URL to another URL at the Apache settings. You can write an index.php(php based solution) file for redirecting the header to the required URL. However, this didnt seem to me like an apt solution hence I looked for a solution at the Apache Config itself.

Considering you have a VPS where you have configured the virtual host as follows:

ServerName pr.example.com
ServerAlias pr.example.com
DocumentRoot /sites/www/pr.example.com/public_html/
ErrorLog /sites/www/pr.example.com/logs/error.log

PiTiVi Video Editor - A Look

I wanted to try a Linux based video editor for editing video files which would do both video editing, converting and video compression using various encoding schemes. I had a hands on with ffmpeg command line video compression and conversion tool. I felt it was impressive.

I am not a very much versed in video editing. I needed a tool that would help me do the basic stuff without much fuss. Fortunately, I found PiTiVi as just the right tool I needed.

PiTiVi is a free, intuitive and featureful movie editor for the Linux desktop.