Latest Publications

Prototype Cheat Sheet

I was previous using Prototype 1.5 Cheat Sheet, from snook.ca. Excellent design and user friendly guide, but a bit out of date. Stumble upon this today, Prototype 1.6 Cheat Sheet. Get it here or visit the blog. So time to update my quick reference folder.

Using FTP to Sync

Today, I discover a very exciting and useful tool, lftp. I was looking for a way to sync my client’s work on my development machine with client’s production machine. Even though the project is stored on SVN. I have no SSH access to the client production machine. The only access to the machine is FTP. After some searches, I found lftp. The thing I like about it, is that it is possible to script ftp to automate future synchronization. That is an excellent and important feature to have.

This is what I have in my lftp script file, lftp.script

open serverhost
user username password
lcd localdirectory
cd remotedirectory
mirror -R --only-newer

When I want to sync the directory, I just run the command “lftp -f lftp.script”. This will synchronize the two directory. Of course, this is the last option if client machine does not have SSH and/or SVN installed.

More information about lftp tool can be found here, http://lftp.yar.ru/

Speed up your Web Application with JS/CSS compression

Programmer all want their application to be faster and more responsive. This is specially important in Web environment. As we demand more functional and feature from our application, Javascript and CSS files will grow in size, this will impact the performance of the application.

I have discover a wonderful script that will compress JS and CSS on the fly. It uses RewriteEngine to redirect browser looking for JS and CSS file to a PHP script file. It is very easy to implement and transparent to the existing application. No change is required on the existing application. The script also cache compression result in cache directory. I manage to improve 50% vTiger CRM’s Main Page loading time. It is a huge performance increase with so little effort. The wonderful tool is located at http://farhadi.ir/jsmart.html

If you are developing your own application, it is a no brainer if you don’t compress JS and CSS files before sending it across the Internet to the user browser. It would gain better performance, if the compression is automatically in your application rather than using rewrite engine to redirect js/css to compression script on the web server.

Comparison between storing images/files in mySQL and on filesystem.

There was a discussion in regard to “store images in MySQL” in one of WebHostingTalk forum. Many believe that storing images/large set of data in mySQL will hurt performance, specially when you want to do query. Unfortunately I could not find any resource in regard to this or support this. So I set off to do my own performance test run. The test is written using PHP, since PHP/mySQL is such a popular combination.

Test run are ran on following specs:

CPU: Intel 4 3.06GHz
RAM: 1 GB.
Linux Distribution: Ubuntu 6.2 Server edition

mySQL version 5.0.45
PHP-cli 5.2.3

(more…)