Typological Error in Squirrelmail 1.4.0

If you install Squirrelmail as your webmail application, have you ever seen this following error messages?
Warning: preg_split() expects parameter 4 to be long, string given in /usr/local/www/squirrelmail/functions/imap_messages.php on line 806

Warning: Invalid argument supplied for foreach() in /usr/local/www/squirrelmail/functions/mime.php on line 53

I found this little bit irritating bug when I was replying an e-mail from my friend. For your information, I had installed Squirrelmail version 1.4.0 in my own server. Actually it wasn't only the core Squirrelmail application, but also the additional UI theme.

Actually, there was no functionality impact on writing/sending e-mail. The mail can still be sent and delivered successfully, but those error messages are just a bit annoying to me. So, I searched the bug fix via Google, and then I found the solution easily. Voila! Just a typological error, and here is the solution,

Open the file which is first mentioned in the error message, and go to the following line (806).
Replace this line:

$flags = preg_split('/ /', $regs[1],-1,'PREG_SPLIT_NI_EMPTY');


$flags = preg_split('/ /', $regs[1],-1,PREG_SPLIT_NO_EMPTY);

That's all. Thanks for viewing and have a good day!


Some Tips on VIm and UNIX Shell

VIm (VI Improved)

VIm (VI Improved) is probably one of the most powerful text editors in UNIX. Its latest version is 7.1, and you can download it on its official web site. One of the powerful features is syntax highlighting, which can make VIm users be able to recognize some keywords of programming or scripting language by just seeing the different color on each keyword. Now, VIm has supported many popular programming and scripting language.

In my server, which is using FreeBSD 6.3 as the operating system, I have installed VIm-7.1 via port. Just do this following action:
  1. Go to port installation directory of VIm
    #cd /usr/ports/editors/vim
  2. Execute the port installation
    #make config install clean
  3. Wait until port installation is finished. It is not too long. Probably it will just take about 1 minute.
  4. After you have finished your installation, create a file .vimrc in your home directory For example, my username is knightdna and my home directory is in /home/knightdna, so I create .vimrc in that directory and write these on my .vimrc:
    syntax on
    set tabstop=4
    set showmatch
    The first line is used to enable the syntax highlighting feature of VIm, the second one is to set the count of the space in a tab key while using the editor, and the last is to show the command in VIm that probably match by just pressing the tab key. (e.g.: while writing :set n in command mode, if you press the tab key, VIm will automatically recognize your writing as :set number command).
  5. Then rehash your shell by do this following command:

Now you can use your fresh installed VIm with its one of powerful features, syntax highlighting.

UNIX Shell Configuration

There are few types of shell in UNIX (e.g.: bash, csh, and tcsh). I prefer using csh compared to the others since it has more support on programming and scripting (correct me if I'm wrong).

There is a file in your home directory which specifies the configuration of your shell. If you are using csh, then the file is .cshrc. If you are using bash, then the file is .shrc. We need to modify .cshrc file to enable color mode while using ls command, and the shell will also print your working directory.
  1. Go to your own home directory (e.g.: /home/knightdna)
    #cd /home/knightdna
  2. Open your .cshrc file with VIm (you may use the other editor)
    #vim .cshrc
  3. Add the alias of ls command with ls -FG. Write it on the line where the command aliases is declared. This is to enable color mode while you are using ls command
    alias ls ls -FG
  4. Change the value of your set prompt parameter. This is to print your current working directory while using your shell.
    set prompt = '\n[%B%m%b]%B%~%b%# '
  5. Save your .cshrc file and then quit from your VIm editor :wq
  6. Rehash your shell

Now you can use the ls command with color mode, and you'll notice the difference on your shell, right? That's all my simple tip for VIm and UNIX Shell Configuration. Hope this information is useful for you to make you more comfortable and enjoy your work with UNIX environment, especially when you are working in command line interface mode. Just correct me if I'm wrong. Thanks for viewing and have a good day!


Activating the Wordpress Permalink

Hi all,

I have created permalinks in my blog. Previously, I didn't know how to make it works because I guessed that it would work by just adding a .htaccess file in my blog directory. But it still didn't work! So, here is the way to solve that problem (for your information, I'm using Apache 2.2.8 as web server with PHP 5.2.5 module installed here):
  1. When you activate your permalinks, make sure that you've set your .htaccess file to be writable (changing permission in command line interface with chmod 766 .htaccess). If your Wordpress application have permission to write your .htaccess file, its content will be:
    # BEGIN WordPress
    RewriteEngine OnRewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

  2. Make sure that you have defined rewrite module in your Apache web server configuration (httpd.conf):
    RewriteEngine On
    RewriteRule   ^/~([^/]+)/?(.*) /u/$1/$2  [R]
    RewriteRule   ^/([uge])/([^/]+)$ /$1/$2/  [R]

  3. Do not forget to change the value of AllowOverride parameter in <Directory "[root_directory]" /> tag from None to All and also your Options parameter from None to Indexes FollowSymLinks as it will pay attention to your .htaccess file. Here is actually the key, because if you do not change this value, your .htaccess file will be useless. [root_directory] is the directory where you put your Wordpress source. So, the content of <Directory "[root_directory]" /> tag in your web server configuration file will be:
    Options -Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

  4. Restart your Apache web server via command line interface
    #apachectl restart

  5. You could try to test your permalink now

If your permalink activation is successful, you do not have to access your blog post like this following URL http://blog.knightdna.com/?page_id=k2, but instead you could access your blog based on post date or category (it depends on your setting in permalink activation), for instance http://blog.knightdna.com/2008/02/27. In case you do not know how to activate your permalink, just go to your administration page. Select Options then select Permalinks. Afterwards, you may customize your permalink structure.

That's all about activating the Wordpress permalink, especially if your blog is not hosted on wordpress.com. Hope this trick could be useful for you. Thanks and happy surfing! :D