Author Archives: Adeel

jQuery Resize Plugin – Dynamically resize images

I finally managed to move my development code to Ubuntu and Git. So, lets kick start with the first Git Repository, jquery-image-resize. It includes example and minified version of the script.

Download the latest version:
https://github.com/adeelejaz/jquery-image-resize/releases

I’ll try my best to give support on my blog but if you find any issues, please report them to the Issue Tracker.

Flattr this!

Quick and easy way to make websites load faster

This is just a quick post to quickly get you to improve your website’s speed if you are running an Apache web server.

Create a .htaccess file (if one isn’t already present) and add the following lines at the end of the file:

# GZip
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css

# Setting longer cache time
ExpiresActive On
ExpiresByType text/css “now plus 1 month”
ExpiresByType text/javascript “now plus 1 month”
ExpiresByType image/gif “now plus 1 month”
ExpiresByType image/png “now plus 1 month”
ExpiresByType image/jpeg “now plus 1 month”
ExpiresByType image/x-icon “now plus 1 month”

The first statement enables compression for HTML, plain text files, XML, JavaScript and CSS. Enabling compression means that the data is compressed before being transmitted. Less data to move means things can move along a lot quicker.

The second set of statements enable caching by file types, namely on CSS, JavaScript, GIF, JPG and ICO. Now I’m using a cache expiry date of one month, but you can use anything that suits you.

For example, if you make a lot of changes to the CSS and images, you might prefer files to expire after a day, in which case you can change it to:

ExpiresByType text/css "now plus 1 day"

The ExpiresByType can take in a number of keywords like: years, months, weeks, days, hours, etc. For more info, check out Alternative Interval Syntax for ExpiresByType.

If you have anything to add, feel free to drop it in the comments and I’ll update the post.

Flattr this!

Stop Dr. Web Antivirus Update Emails

After months of painful emails about Dr. Web updates, I finally found a solution:

Log in as root (or you can use sudo) and open /etc/drweb/drweb32.ini:

Look for:
CronSummary = Yes

And change it to:
CronSummary = No

Do a restart for the Dr. Web daemon by (add sudo in the beginning if not using root):
/etc/init.d/drwebd restart
That should do it! Seems so easy once you know it.
Please do leave a comment if this works for you 🙂

The problem:

Just a bit of background about the problem. I have been using Plesk 8.4 and been really happy with it. I’ve gone through all the versions but the latest one Plesk 9.3 had been sending me these weird emails:

From: MAILER-DAEMON@example.com
To: anonymous@example.com
Subject: failure notice

Hi. This is the qmail-send program at example.com.
I’m afraid I wasn’t able to deliver your message to the following addresses.
This is a permanent error; I’ve given up. Sorry it didn’t work out.

<drweb@example.com>:

— Below this line is a copy of the message.

Return-Path: <anonymous@example.com>
Received: (qmail 22133 invoked by uid 100); 20 Mar 2010 19:00:10 +0000
Date: 20 Mar 2010 19:00:10 +0000
Message-ID: <20100320190010.22131.qmail@example.com>
From: root@example.com (Cron Daemon)
To: drweb@example.com
Subject: Cron <drweb@vps> /opt/drweb/update.pl
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <shell=/bin/sh>
X-Cron-Env: <home=/var/drweb>
X-Cron-Env: <path=/usr/bin:/bin> X-Cron-Env: <logname=drweb>
X-Cron-Env: <user=drweb>

Dr.Web (R) update details:
Update server: http://update.msk5.drweb.com/unix/500
Update has begun at Sat Mar 20 19:00:02 2010
Update has finished at Sat Mar 20 19:00:10 2010

Following files has been updated:
/var/drweb/bases/drwtoday.vdb
/var/drweb/bases/dwntoday.vdb
/var/drweb/bases/dwrtoday.vdb
/var/drweb/updates/timestamp

And you usually get one of these an hour! Thats 24 a day! Crazyyyy!

Flattr this!

Block access to .htaccess

Before I answer the ‘how’, let me answer the ‘why’.

.htaccess, now a days, plays a major role. It lets you re-write URLs, redirect traffic, and if you are really good with it, point people to different scripts on your website. It is also an excellent way to cloak your web space structure.

The problem occurs if someone is able to have a look at your .htaccess file and see how things are processed at the ‘back stage’. Or the reason could be that you have written a state-of-an-art .htaccess file and want those 16 year olds to stay away from it.

Just place this at the top of your .htaccess file and you can sleep peacefully, once again 😉

Flattr this!