Whenever anyone visits me in London they want to know the best places to go, the best things to see and the best things to eat. I’m not a fan of the traditional tourists traps. Places like Madame Tussauds and The London Dungeon are ok, but not worth wasting your time on for a short visit – they’re expensive, busy and nothing special. Instead, this is my perfect one-day trip out in London, local style.
Get on the DLR at Bank towards Greenwich
Bank is on the Central or Northern line (see tube map) and is pretty easy to get to from anywhere in London. Aim to get there about 10am – any earlier during the week and you’ll hit rush hour. Get on the DLR (Docklands Light Railway) towards Lewisham. Try to sit at the front.
The DLR journey to Greenwich gets you great views of the commercial part of London, past Canary Wharf. There’s not much to get off for around there, but it’s worth seeing from the train. Get off the DLR at Cutty Sark for Maritime Greenwich – you’ll end up in central Greenwich.
Grab brunch in Greenwich
In Greenwich, have a good look around the market, and check out the views across the river. The market has a number of good stalls selling tasty food, but there’s another smaller and less glamorous market near the Ibis Hotel which sells some of the most tasty Thai noodles on London.
After brunch, wander down the road to Greenwich park. The view from the Greenwich observatory in the park is one of the finest views in London – you can see for miles across to central London, St Pauls, the Gherkin and Docklands. If you have some time and have any interest in boats, the Maritime Museum within the park grounds is worth a look.
Once you’re done in Greenwich (aim for about 4pm) get the 188 bus to North Greenwich and the The O2. The O2 is the final stop on the bus, so you don’t need to get out until it terminates – you can find the route map here.
From the O2 to Waterloo on Clipper
The O2, formerlly the Millennium Dome, is the most popular concert venue in the world. It’s got plenty of shops and restaurants inside, but there’s not too much to see there during the day. Have a quick look around, but after you’re done head towards the pier, where you can board a Thames Clipper.
The Thames Clippers are a river commuter service, and zoom down the Thames from the O2 to Chelsea Pier and back. They give you a brilliant view of all of London – on your way to Waterloo pier you’ll see the O2, Greenwich, Docklands, Gherkin, London Eye and houses of Parliament. It’s a great way to get back into central London.
From Waterloo to China Town
From Waterloo, wander up to China town. It’s about a 15/20 minute walk, and will take you up through Westminster, Trafalgar Square and Leicester Square.
China Town has some of the best Chinese and Japanese restaurants in London. My personal recommendations are:
Red n Hot – really tasty and authentic Chinese hot pot (map)
Tokyo Diner – delicious Japanese bento boxes (map)
Misato – cheap and tasty Japanese food, including wonderful Katsu Curry (map)
New China – more familiar British-style Chinese food, but still authentic and delicious (map)
After you’ve eaten, walk the 10 minutes to Covent Garden and check out some nightlife. There you’ll find bars, clubs and entertainers in the central arcade:
Livedrive (the company I work for) launched their iPhone app today that lets you access files you’ve backed up with Livedrive from anywhere. I think it’s genuinely really cool – checkout the intro video below…
Have you ever wanted an easy way to get all of the contents of a directory into one array, regardless of how many levels of subfolders there are? This is a task for my favourite kind of programming – nested loops!
The following function will do the job nicely:
private static void listDirectoryNest(string path, ref List<string> currentList, bool includedirs)
{
foreach (string dir in Directory.GetDirectories(path))
{
listDirectoryNest(dir + "\\", ref currentList, includedirs);
if (includedirs)
currentList.Add(dir + "\\");
}
foreach (string file in Directory.GetFiles(path))
{
currentList.Add(file);
}
}
This function takes the string path which defines where the nesting is to start, for example e:\documents. It then takes the reference currentList which is a generic string list. After the function is run this string list will contain all of the files within the original path (including those in subfolders). The final variable, includedirs defines whether or not to include directories in the currentList output. If you set this variable to true then you can determine which entries in currentList are directories by checking if they end with the \ character.
This is an example of how to call the function above:
List<string> output = new List<string>();
listDirectoryNest("e:\\documents", ref output, true);
After running that code, output will contain all of the contents of e:\documents\, including subfolders, in a format like:
I had the honour of photographing a friend’s wedding this weekend. These are some of my favourite shots, but the rest can be found at Tim and Jane’s Wedding.
Although I found this article on C# sorting algorithms very useful, I think I found one flaw:
[Rolvin] has seen alot of girls around the area, met and chatted with some of them, got their numbers but he never thought about courting or asking some for a date up until now. Rolvin is smart.. he decided to pullout a tissue paper and listed all the names of the girls he met and some basic information about them. There are 3 things that he thought were important. First, the girl should have a name. Second, the girl that he will down on his list should have an age. And lastly, the “cuteness factor”. He thinks that he is a very handsome guy and he deserves somebody equal or greater than his looks(talk about ego;)).
Ok, now this is our chance to help Rolvin. We need to create the Girl class first.
It was all going so well until the last sentence. I think Rolvin probably needs to give in now.
Creating an Atom feed manually in PHP is fairly easy – it is just like generating HTML. However the Atom specification is quite strict on the date format required:
A Date construct is an element whose content MUST conform to the “date-time” production in [RFC3339]. In addition, an uppercase “T” character MUST be used to separate date and time, and an uppercase “Z” character MUST be present in the absence of a numeric time zone offset.
Unfortunately this is very different to the default date format that MySQL exports, so you need to convert it. Thankfully this is very easy. Assuming $line contains your MySQL record array then this code will work:
The only other awkward task when exporting an Atom feed is making sure that you send the correct Content-type declaration in the header. The default header Content-type for PHP output is text/html. For an Atom feed this should be application/atom+xml instead. To do this, include the following line at the top of your code, before you have output anything to the client:
header('Content-type: application/atom+xml');
Your feed should now return the correct content type, and contain dates that conform to the Atom specification.
When displaying photographs or other multimedia, a toolbar is a great way to manage the navigation – its simple, intuitive and unintrusive. It’s even less likely to detract from the experience if it hides itself automatically when not in use, and it looks cool if it does this in a slick, smooth way. For a simple example, see my Street Photography page.
Although you can do this quite easily in Flash, I prefer to work in JavaScript as it gives you much more control over search engine behaviour, and you can use the same components for users without JavaScript enabled – you don’t need two versions of your site. The following scripts work for all of the main browsers – IE, Firefox, Safari and Chrome.
The first stage is to make sure that you turn the scrollbars off on the page – the interface for displaying your photos is going to be all on one screen, with no need for the user to scroll up and down. So in your main CSS file:
body {
overflow: hidden;
}
Now in your HTML you want to define the DIV that will make up the toolbar. This can be anywhere in your HTML code:
<div id="topbar">
</div>
In your CSS file, position this block as you would like it for users without JavaScript enabled:
Notice that I’m giving it an absolute position of 0px x 0px – so top left. I’m also describing its width as 100% – all the way across the screen, and its height as a set 34px. I’m giving it a background, which is simply a PNG with a basic gradient.
Now create a text file called nav.js – this is going to be the JavaScript file that controls the showing and hiding of the top navigation bar.
var mode="none";
var toppos = 0;
function getMouse(ev) {
var ypos = 0;
var xpos = 0;
if (!ev) {
ypos = window.event.clientY;
xpos = window.event.clientX;
} else {
ypos = ev.clientY;
xpos = ev.clientX;
}
if (ypos<100 && toppos<0 && mode!="show") {
mode="show";
process();
}
if (ypos>100 && toppos>-30 && mode!="hide") {
mode="hide";
process();
}
}
function process() {
if (mode=="hide") {
if (toppos>-30) {
toppos = toppos - 1;
document.getElementById("topbar").style.top = toppos + "px";
} else {
mode="none";
}
} else if (mode=="show") {
if (toppos<0) {
toppos = toppos + 1;
document.getElementById("topbar").style.top = toppos + "px";
} else {
mode="none";
}
}
if (mode!="none") {
setTimeout("process()",20);
}
}
To break this down a little:
The first two variables are called mode and toppos. mode defines what should be happening right now - whether the toolbar should be retracting into the top of the screen (hide) or dropping down into the frame (show). toppos gives the current position of the toolbar.
The getMouse(ev) function (which we'll come to later) gets the current x and y position of the mouse within the browser window. If the mouse is under 100 pixels from the top of the window then we'll start dropping the toolbar down. If it is over 100 pixels then we'll start hiding the toolbar.
The process()> function is a self-repeating function that actually manages the movement in a smooth way. It calls itself every 20 miliseconds while there is work to do, and increments the toolbar by 1px either upwards or downwards, depending on the current mode. When the toolbar is fully hidden or fully shown, it changes the mode to "none" and stops calling itself.
We now need to call this nav.js file from your HTML file. So between the </head> and <body> tags put the following script declaration:
Finally all you need to do is call the getMouse(ev) function from the HTML file. So in the HTML file change your <body> tag to something like this:
<body onMouseMove="getMouse(event);">
This will cause getMouse to be called everytime the mouse moves within the browser window, along with position information, allowing it to determine whether the toolbar should be shown or hidden.
You should now find that you have a nice toolbar box that moves in and out of the top of your page. The next stage is to start filling that with content and buttons (just put them with in the DIV). If you ensure that you use SEO-friendly JavaScript function calls then you should have a nifty-looking JavaScript powered site that is completely compatible with SEO best practice and users without JavaScript.
In iTunes it’s very easy to change the location of your music folders – simply change the “iTunes Music folder location” option in Preferences:
However this only tells iTunes where your music is stored – it does not tell iTunes where to put your iTunes Music Library.xml file. This file and its associated itl files store extra information about your music library – such as your ratings, play counts etc. This information is almost as vital as the music itself, but unfortunately cannot be moved from your Windows My Music folder.
To work around this you need to move the location of your My Music folder. To do this (assuming you’re using XP), close iTunes and then go to Start -> Run and type “regedit”, then press Enter.
Navigate to the following section in the Registry Editor:
HKEY_CURRENT_USER
-> Software
-> Microsoft
-> Windows
-> Current Version
-> Explorer
-> User Shell Folders
You’ll see in the right Window a list of folders such as “AppData”, “Cache”, “Favourites” etc. The Data column will tell you where these folders are located on your hard drive. Have a look and see if you have an entry for “My Music”. If you do, simply right click on it, select Modify and enter a new path to where you want the “My Music” folder to be.
If you do not have a My Music folder then go to Edit > New > Expandable String Value. Enter “My Music” as the name of this value, and then right click on it, select Modify and enter the path as above.
You should end up with something like this:
iTunes will now look for its XML file in [the path you've entered]\iTunes\, so its import that you copy your existing iTunes folder to the new location before starting iTunes.
This is a really simple topic, but something so many developers get wrong. Lets imagine you have a page showing photographs. When you click on the next button, you want some nice friendly JavaScript to take the user to the next photo. You develop a function to do this called “showNextPicture()” and put this on your Next button:
<a href="javascript:showNextPicture()" title="Show Next Photo">Next Photo</a>
The problem here is that users without JavaScript (and search engines) cannot follow the link to the next photo. Instead, a link like this works so much better:
<a href="link-to-next-photo.php" onClick="showNextPicture(); return false;" title="Show Next Photo">Next Photo</a>
In this case when the user has JavaScript enabled then their browser does the following when clicking on that link:
See’s the onClick event, runs the showNextPicture() function.
See’s return false, which tells it not to follow the href
If the user has JavaScript disabled (or is a search engine) then it does the following when clicking on that link:
It doesn’t understand onClick, so it ignores the NextPicture() function
Instead it just directly follows the href link
All users get a great user experience, and you end up with your pages properly indexed in the search engines.