Live HTTP Headers

This is one of those things I needed but never knew existed till I heard about it on a mailing list today. Live HTTP Headers is a Firefox plugin that enables you to view HTTP headers in real time. It even allows you to edit the request and replay it.

In the past, I’ve had to capture the network traffic with a packet sniffer such as Wireshark and analyse the dump. Now, it’s right there in my browser. Impressive.

There are other alternatives out there. Another app that got a mention is Fiddler. Fiddler uses a proxy-based approach. This means that it will work across a wide range of browsers and then some. Like its name suggest, you can fiddle with the incoming and outgoing data.

I now have Live HTTP Headers installed on my system. I’ve yet to try out Fiddler but you bet I will.

Permission denied to get property Window.tinyMCE

I was updating my site today and suddenly all the popups in Joomla failed to work. I get a blank popup and an Uncaught exception: Permission denied to get property Window.tinyMCE.

It turns out the problem has to do with a browser security measure, the Same Origin Policy.

The same origin policy prevents document or script loaded from one origin from getting or setting properties of a document from a different origin. The policy dates from Netscape Navigator 2.0.

I don’t know what exactly is happening under the hood but simply put, there are two addresses that can be used to access my site—www.unauthorised.org.nz or unauthorised.org.nz. As Joomla was setup using www.unauthorised.org.nz (as shown under Global Configuration > Server > Live Site), that is the address that must be used to maintain the site. I was being lazy and simply used unauthorised.org.nz; hence the problem.

HOWTO Setup a new website

This blog post focuses on setting up a proper website that is suitable for small or medium businesses, or individuals wanting to create a professional looking site. As you are here, I assume that you’re wanting to set a site up yourself. Otherwise, there are package solutions that covers everything from the design to a fully operational site.

There are four things you need to setup a website—a domain name, a hosting provider, the website itself, and some spare cash to pay for all the fees.

Domain Name

The first thing you should do is probably to secure yourself a domain name. A domain name is basically an address for a site. For example, the domain name for this site is unauthorised.org.nz. It is what users will have to type to get to your site. Therefore, choose something that uniquely identifies your business and is easy to remember. You can check if a domain name is available here.

If you’re tossing between .co.nz and .com, my advice is this. If your business operates in multiple countries, you may want to consider .com. Otherwise, use the top-level domain of your country. It helps your users identify where your business is based.

Once you have chosen your domain name, you should register it in case someone else is after that same name. The cost for a domain name registration varies depending on the registrar and starts from around NZD 28 per annum. The primary differentiating factor between registrars are the additional services they offer. Generally, I wouldn’t worry too much about the additional services. The cheapest option is usually sufficient. At the moment, the cheapest registrar I’m aware of is 1st Domains at NZD 24.95 excl. GST.

Domain names are typically renewed annually although some registrars allow you to register it for several years at a time.

Hosting Provider

Now that you have sorted out your domain name, you need to choose a hosting provider. A hosting provider provides the server for your website. There are many hosting providers to choose from. Each seems to offer something different.

You really have to do your homework here and figure out what you actually need. The main things to consider are:

  • scripting capabilities – what scripting language does your site use?
  • databases – what type of database does it need?
  • disk space – how much content do you have?
  • bandwidth – how much visitor traffic do you expect?
  • reliability – does the server have a lot of downtime?
  • fees – how much are you willing to pay?

If you are unsure about the disk space and bandwidth requirements, you generally have the option to upgrade at a later time. However, you do need to make a decision on what scripting capabilities and databases your site will be using, if any.

Hosting fees are generally charged either monthly or annually. Depending on what you require, you could expect to pay something between NZD 5 to NZD 25 per month. You should probably hold off on registering for your hosting service until your website is ready. That website may take longer to build than you think.

Website

Now for the last part, you just need to build your website. I assume you know what you’re doing here. If you need a suggestion on a good application to use, have a look at Adobe Dreamweaver (formerly Macromedia Dreamweaver). Otherwise, there is always professional web developers. A basic five page website will generally set you back around NZD 500.

Once you have everything ready, it’s just a matter of uploading you website to your hosting provider, and pointing your domain name at the hosting provider’s name servers. You now have a fully operational site.

The next thing you want to consider is probably search engine optimisation (SEO). It will ensure that your site gets a good ranking with the search engines. I’ll leave that for another time.

If you need a hand setting things up, my services are available for a very reasonable fee. Seriously. Please contact me for details.

Firebug to the rescue

As you may know, I’ve been spending quite a bit of time lately tweaking the design of my blog. It has made me realise just how useful a tool like Firebug is. What is Firebug you ask?

Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

With Firebug, you simply click on any item in the page, and it will display everything you’ll want to know about that element. In particular, I’ve had to debug numerous CSS issues with the blog. Firebug will show you the style inheritance, allowing you to determine where each CSS style value comes from. The real-time tweaking feature is just an additional bonus for me. I assure you Ctrl+Shift+C is a key combination that you’ll never want to forget.

Unfortunately, Firebug does not work with Internet Explorer. Microsoft does provide the Internet Explorer Developer Toolbar that has similar functionalities. It is not as powerful as Firebug but is useful if you need to work with IE. I find that debugging CSS issues is usually easier if done in Firebug. However, things like DIV layout issues need to be addressed in the respective browser due to the different layout handling between Firefox and IE.

In the short few years that I’ve been away from the web development scene, it seems that TABLEs are out, and DIVs are in as the element of choice for layout design. Oh well, you’ve got to keep up with the technologies.

Quick Links

prototype.js

Prototype is a JavaScript Framework that aims to ease the development of dynamic web applications.Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

I was working on a web application at work when a colleague of mine introduced me to Prototype. Boy, is this great or what! Prototype version 1.5.0 is approximately 70KB in size. Quite reasonable considering the size of web pages nowadays.

I find the CSS selector functions, such as getElementsByClassName and getElementsBySelector, to be really useful. I used to think of CSS as an excellent way of separating a document’s content from its presentation. Now, I learned that CSS classes can also be used as tags for the various elements in a page. This makes some tasks a whole heap simpler, especially with the CSS selector functions.

Prototype also has a nice Ajax library. It abstracts the browser specific implementations and provides a simple interface to code against. I’m looking forward to trying this out. I’ve been borrowing AJAX books from the library for the past few months but never seem to have the time to read them.

To learn more about Prototype, please visit the official website at http://www.prototypejs.org/.

Quick Links

Dynamic text files

Ever wanted to dynamically create downloadable text files on your website? It couldn’t be any simpler using a web scripting language, such as ASP or PHP. All that is required is to modify the response header of a dynamic web page. The text file does not actually exist on the web server. Instead, it is created and sent directly to the web client.

The following ASP code sample demonstrates how this can be achieved:

Response.ContentType = "application/text"
Response.AddHeader "Content-Disposition", _
                   "attachment; filename=greetings.txt"

Response.Write "Welcome to the Unauthorised Blog"

Response.End

Normally, the response header sent by a dynamic web page would be that of a standard HTML page. By specifying the application/text content type and adding the additional content disposition information, the web client now expect any subsequent data it receives to be the content of a greetings.txt file.

The same technique can be used to create any type of file, provided that you are able to create raw data for that particular file type.