WordPress Wednesday: CSS Compress

Published on Dec 2, 2009   //  WordPress

One of the best things you can do to improve the user experience on your WordPress blog is to improve its loading time. As good as your content may be and as attractive as your theme may be, some visitors will not want to put up with long loading times.

The faster you can get your blog to load, the better. There are plug-ins that can cache some of your content, some that will compress your image sizes, and others that perform similar actions. One plug-in that you may want to consider is CSS Compress. As its name implies, this will compress the CSS stylesheets associated with your blog.

This may sound like a rather minor change, since the CSS files aren’t particularly large compared to your image files, for example, but it can help to speed up the loading process by quite a bit. It will remove comments, new lines, and tabs. It will also compress the CSS file using the GZIP standard. There is no configuration needed, as the plug-in works automatically.

Go to WordPress.org to download CSS Compress and to read more information on the plug-in.

Moving Beyond SSH: Changing Content-Types

Published on Dec 2, 2009   //  Development

Moving Beyond SSH

When a server transmits a file to the user, additional “header” data is sent along with it. This header data contains various information about the session. One crucial part is the content-type, which contains an internet media type (commonly: “MIME type”) specification. This media type tells the browser what kind of file is being retrieved, and provides a guideline for handling the file (eg. display the file, offer to download, etc).

By default, Apache associates file name extensions to the appropriate media type. You can view these associations in the file /usr/local/apache2/conf/mime.types. However, what if you need to change how a file should be handled, or specify how an unspecified extension should be handled? It is recommended that you do not edit the mime.types file, as the file is likely to be updated during Apache upgrades, which will undo all your changes. Instead, we’ll use an .htaccess file to make our changes.

In our .htaccess file, we can add our own specifications, which will override the defaults. The syntax is as follows:

AddType media_type .extension

Where media_type is one of the defined media types and .extension is the file name extension of the files you want to modify the content-type on. For example, if we wanted MP3 files to be downloaded instead of played in the browser:

AddType application/octet-stream .mp3

This would change the content-type of MP3 files (within the directory scope* of the .htaccess file) to application/octet-stream (arbitrary binary data – browser will offer to download) instead of the default of audio/mpeg.

If you want to specify multiple extensions to be served with the same content-type, you can use a space separated list in the regular line. If we want to apply this to a single file, we can use a files section and use ForceType instead of AddType:


ForceType application/octet-stream

In future articles, we’ll be further talking about the uses of .htaccess files.

* – The directory scope of a .htaccess file refers to where its contents will be applied. The file will have an effect on the files in the same directory as well as files in (infinitely) nested directories. In these nested directories, the “root” .htaccess file can be overridden with a new .htaccess in that nested directory.

Business 101: Festive Decorations for the Holidays

Published on Dec 1, 2009   //  Business Topics

Many people say that Christmas has become so commercialized that it has lost much of its religious meaning. This can be a double-edged sword. On the one hand, Christmas may not carry the same level of religious significance for Christians as it may have had in the past, but it also means that non-Christians can join in on the festive spirit without having to convert to another religion.

How does this translate into how you should be running your business for this month? Different people will have different opinions when it comes to political correctness, so while you may feel that it is perfectly acceptable to wish everyone a merry Christmas, others feel that it is more appropriate to wish season greetings or happy holidays to the people who come in and out of your storefront.

Going further, unless your business is clearly catering to another religious group, it may be perfectly acceptable to make use of some festive decorations. If you are running a secular company, like an electronics store, most people will not be offended if you put up some Christmas garland in and around your shop. They may welcome the image of Santa Claus without concern. However, unless you are a distinctly Christian business, it may be best to avoid images of the baby Jesus or other religious symbols.

The “holiday spirit” does not have to be restricted to the Christian religion. There are other holidays that take place around this time of year too, like Kwanzaa and Hanukkah, but it may be best to stick with generic “holiday” themes for the most part. This way, your public image can be more inclusive of all possible customer groups.

Page 5 of 512345