Smiley Happy Coder

I'm a web developer with a love of technology and I'm a bit of an Apple geek

Aliases, how to configure them in your termial

If you develop on a mac or linux machine you will almost certainly enter the same terminal commands over and over again.
If you haven’t already you should probably set up some aliases.

Read On >

Add SSH keys to your Mac or Linux machine

If you’re using a server such as Github or Nitrous it stands a fair chance that you’ll have to add SSH keys and supply these services with your public key.

A good explanation of SSH keys can be found on Wikipedia

Before we add ssh keys, do you already have any setup?

Read On >

Find the ID of your home page in WordPress

Today I needed to find the ID of my home page in WordPress.

I spent a while looking in the codex and in the forums and all I found were a few unanswered posts.

It must be stored somewhere

Well as you’d imagine the ID of the home page is indeed stored in your database.

Logic dictates that it would be found in the options table and indeed it is.
Read On >

Configure Apache to manage multiple websites

Just after you have finished configuring Apache you are going to need to know how to set it up to handle multiple websites. After all you won’t be just hosting one site on that nice new shiny server will you?
Read On >

Why the need to advertise?

Well to but it bluntly, this website costs me money to keep running.

I offer tips and tutorials and I hope to offer more in the future and I don’t charge for it. I want the site to be a good source of tips and knowledge. I’m really hoping the site will grow and be of some real use but I need to support it somehow.

What is a HTTP request?

So whenever someone is talking about how fast your site is running or SEO (Search Engine Optimisation) you hear a lot about HTTP requests.

So what is HTTP?

Well lets start at the beginning. HTTP stands for Hyper Text Transfer Protocol and it’s how the internet works. You use it every time you browse the internet but you may not even be aware. Ever seen a website address that looks like this?

</p> <p>http://www.smileyhappycoder.co.uk</p> <p>

Of course you have, but did you see it? Did you see the HTTP? It’s right there at the start of the address. It’s the http:// bit and it tells the browser that it needs to visit the site www.smileyhappycoder.co.uk using the Hyper Text Transfer Protocol.

Ok, what’s a HTTP request?

The HTML of your website more than likely links to several different files. These links could be to CSS files or even to images and JavaScript scripts. The browser needs to be able to download these files in order to use them to display the page to you, so it requests them. See where we’re going now? Each file that the site uses means a HTTP request for that file. Take the following piece of code which is just the start of a bog standard web page.

<br /> <!DOCTYPE HTML><br /> <head><br /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><br /> <meta name="author" content="" /></p> <link rel="stylesheet" href="style.css" type="text/css" media="screen"/> <p></head><br /> <body></p> <p>&lt;</p> <p>div id=&#8221;wrapper&#8221;></p> <div id="header"> <img src="Logo.gif" alt="Logo" id="Logo"/> </div> <p>

In the above piece of code there are three HTTP requests to the server and that’s the most simple piece of code I could dream up. Now here comes the real problem. Browsers can only process so many requests at a time. This number ranges from 2 to 6 depending upon which browser you favour. So you could have a page that has say 20 HTTP requests and using the best browser you would be able to make 6 requests at a time. But that leaves 14 to go. So what happens? After the first 6 are done the next 6 start and so on until the page is fully loaded.

So what does this mean to you and your site?

Simply put the more requests, the longer the site will take to download. So now you see why largely image based sites may look the best but may not be best suited to your needs.

Conclusion

HTTP requests are a necessary evil, there is nothing that can be done to avoid them but there are ways to minimise them. For instance there is a school of thought that says you should have multiple CSS files each targeting a specific part of the design such as layout, typography and galleries. I can see the point here without a doubt, it makes the site easy to maintain but wait, that’s three requests not one. You could even use CSS Sprites for hover state images which will save yet more requests. The list is endless but this post is not…