Links: The Great IP Shortage of '11
By: Simon Pitt | Written: Monday 18th January 2010
In the last article, we had reached the end of the web address. What now? Well, in actual fact, all we've done is pointed to a folder, much like "My Documents" on your computer. We haven't loaded a file. So how does the browser know to show us a file and not just a list of the contents of the folder?
By default, most servers are set up to look for a page called "index" and display that. When you go to:
You're actually going to:
That is, you're going to the folder "www" on the subdomain imagedissectors. You're not specifying a file, you're just saying you want to look at that folder. The server automatically hands you a file called "index.php", because when you don't say what you want, it gives you an "index" file. Right now you're looking at:
That is, you're looking at a file that is just called "55" in a folder called article. At least that's the principle. In this case, you're not, because I've used a special piece of code to tidy up and redirect the URIs, creating virtual URIs. What's actually happening is when you type in
you're being shown the page at:
(Click it, and you'll see it's exactly the same page as this one).
Now, let's have a closer look at that URI. The file is called "article.php" and it's in a folder called "www" on the server that is reached by going to the domain imagedissectors.com
But what, you may be asking, is all that "?q=55" junk at the end? Well, here's where things get more complicated.
Like many websites Image Dissectors runs with a database backend. That is, each article in the site is stored in a database (yes, even this one). In the database, each article is given a unique ID number.
When you load a page, the first thing the code does, is look at the URI and ask "what does q equal?". In this case, it finds the answer 55. It then goes to the database and says "find me an article with the ID number 55, and tell me what it is, who it's by, when it was written and what category it's in." The database then sends back all that data, which appears on this page. Like this.
The question mark, like my Uncle Ernie, is what's called a "reserved character". In my Uncle Ernie's case, it means he doesn't go out very often and when he does, he doesn't say much. In the case of the question mark, it means you can't just go around using it for anything. These characters define special cases in the URI. For example, here, this question mark means the domain and file has ended, and the following is for a script on the page.
The "q" is a variable that I have picked. I could have picked anything, but I picked q, partly because it stands for "query" and partly because "q" is the standard letter for a variable (Google uses "q" for search words for example). The equals sign, like the question mark, is a reserved character, which means you can't go using it willy-nilly. And the final number is the value of q. In this case 55.
You can, of course, have more than one variable. In fact, you can have as many as you want, as long as you don't go over the maximum number of characters your browser can support. So, as long as I stay under the Internet Explorer 2083 character limit I'll be fine.
That's not too much of a problem in this case; with my labelling, I'd have to write 9 x 102037 articles (or 9 with 2,037 9s after it) before I ran out of space. I'd have to employ everyone on the planet to write a billion articles a second, and it would still take longer than the age of the Universe. So I probably don't need to worry about that too much. And even after that, they could always use Firefox.
It's worth pointing out that while the number of possible websites and domains is virtually limitless, the number of possible IP addresses is not limitless. That is, we could keep on creating names for domains for pretty much ever, but, at some point, there wouldn't be anywhere for those domains to go.
Under the current system (which is called IPv4) there are 4.3 billion possible IP addresses. Quite a lot, you might say, but these will probably run out in 2011 and all the existing unallocated ones will be used up in 2012. If you don't have enough things to worry about, try these words of David Conrad, general manager of the Internet Assigned Numbers Authority
"We are actually beyond a reasonable time frame where there won't be some disruption. Now it's more a question of how much."Luckily, there is a new system that is already being phased in that allows for 3 x 1028 IP addresses, so that should last a little while longer. Nevertheless, we await to see what changes and disruptions this will bring.
But, back to URIs. In recent years, it has become increasingly popular to use text rather than numbers as a link. For example, if I post this link for the Guardian you can sort of work out what it'll be about:
That was from a September 2008 (as you could probably work out from the address). It's a bit tricky to read because they've just run all the words together. A little while after this was published, The Guardian webdesigners discovered the hyphen. Now they can do something like this:
Which is a bit clearer. Nevertheless, even when all the words were in one block, it gives you some idea of what the article is. As opposed to this:
You haven't a hope in hell's chance of knowing what this article is going to be about (although it's on the news site, it's January and it's been snowing, so you can probably take a guess).
But, back to the question, what do you do if you want to have two variables in a title? Say you want to search for a category called film. Simple, you can add several variables, separating them with an ampersand symbol like this:
The script now knows that the URI contains two values:
a (which equals "Category") and
q (which equals "Internet")
To be continued. In the next part we'll have a look at what you can do with variables, and learn why you should never call your child anything with a semi-colon in it.
Share on Facebook Share on Twitter Delicious Digg Reddit Stumble Upon Google Bookmarks