harriyott.com

Tuesday, June 19, 2007

Whitespace isn't always good

On occasion, it isn't useful having plenty of whitespace. Here's one example from my hometown:

River Uck Sign

Having discussed this with Leon, I've finally got round to taking a photo.

[Tags: ]

Monday, June 18, 2007

HackDay London - Part 12 of 12

In conclusion, HackDay was brilliant. I met some cool people, had great coding from 10am to midnight, catching up with friends from various places, writing AJAX, presenting my app in front of a few hundred people, and generally having an adventure.

The presenting was cool. I went on second, and then had to go straight away. It was nerve-wracking, but quite a buzz when my hack was voted as useful. I wish I could have stayed to see the others, especially the Hacked game (which I won).


[Tags: ]

Sunday, June 17, 2007

HackDay London - Part 11 of n

The presentations are about to start. I'm up early, which is good, as I want jet early so I can see my children as it's Father's day.

I've just seen a group hack on Jeremy Keith's laptop, which looks super good. There are some Jedi skills going on in that team. It's all gradients and graphics and stuff. I, however, merely changed the H1 title tag to orange, and introduced a beige line below the boxes. I'm glad it's not a competition...

Talking of which, it looks like I won the post-it game. Tom's hack was just about working right before lunch, and it showed my name at the top with 7 points, way above Cristiano's 3. [Look out John]

I'm rather nervous about standing up on stage and showing my hack to a large roomful of extremely talented hackers, especially as the API has pretty much kicked my server off for good.

[Tags: ]

HackDay London - Part 10 of n

Tom Morris told me about Firebug, which is (amongst other things) a JavaScript debugger for Firefox. It has step-throughs, break points etc. and helped me no end with the AJAX stuff.

I had a good long chat with Ian Forrester, who has done a great job of organising HackDay. We discussed the pitfalls of running geek dinners (Ian runs the London ones), and concluded that upcoming.org should accept payments for events, and forward the money on to the organiser. That would stop quite as many people signing up and not coming, and would ensure that the event would be paid for in advance.

HackDay London - Part 9 of n

I'd like to work on my del.icio.us hack today, but the API has stopped working:

Yahoo! Del.icio.us API not working screen shot

Had a little walk, followed by a good breakfast. Chris Alcock showed me his hack - choosing a picture from Flickr, adding a beach ball to it, and uploading it. Works really well.

Van without beach ball
Van with beach ball

[Tags: ]

HackDay London - Part 8 of n

After Doctor Who ended, I stopped putting post-it notes on people, as they were starting to pay attention again, and went to play werewolf.

HackDay London Werewolf

I did okay in the first game, although Natalie spotted that I was a wolf fairly early on. She also spotted one of the others. The second game I knew that Frankie was definitely a villager, but I wasn't sure about the others. Once I was disposed of, I saw that it was Frankie that was the wolf, and none of the others. Again, Natalie had spotted him. Derren Brown I am not. Great fun though.

I went to "bed" at around 3.00, where "bed" was a couple of bean bags. I got up at about 7.00 after waking up once or twice an hour. I went back to the table I spent most of yesterday, where a couple of the others had been up all night.

HackDay London Alexandra Palace

OK, I'm off to find breakfast.

[Tags: ]

Saturday, June 16, 2007

HackDay London - Part 7 of n

Doctor Who is on at the moment. A huge cheer went up when the Doctor said "... and you're busy blogging"!

[Tags: ]

HackDay London - Part 6 of n

If the del.icio.us thing can ever persuade the API to work, then the links display one at a time. I used AJAX (for the first time) to do this, and it was a great little app to use to learn how it works. I didn't use ASP.NET AJAX (or similar), as I wanted to understand what went on.

The first thing I understood was that you can't call an XmlHttpRequest across domains, so I had to write a proxy on my server to go fetch the data. I ran into authentication issues straightaway, so I had to do this:


NetworkCredential credential = new NetworkCredential(userName, password);
CredentialCache cache = new System.Net.CredentialCache();
cache.Add(uri, "Basic", credential);

XmlTextReader xtr = new XmlTextReader(path);
XmlUrlResolver resolver = new XmlUrlResolver();
XmlDocument doc = new XmlDocument();
resolver.Credentials = cache;
xtr.XmlResolver = resolver;

doc.Load(xtr);


to get it working.

[Tags: ]

HackDay London - Part 5 of n

I've "finished" my first hack. Using the del.icio.us API, I get all the bookmarks for a user, and then visit each link in turn. Once visited, the status is displayed alongside the bookmark, and the dead links are counted. I'm having some trouble with the API breaking, but it works beautifully with the XML saved from a previous call.

Anyway, here it is.

[Tags: ]

HackDay London - Part 4 of n

Tom Scott gave us a challenge to write a post-it note with the word "Hacked" on it, stick it on someone's back, take a photo of it and post it to Flickr. The person with the most is the winner. [John, this is so much easier than a clip!]

Tom Scott Hacked

I think I'm winning so far, largely because I'm less grown up than other people in some areas.

[Tags: ]

HackDay London - Part 3 of n

The lack of WiFi has been pretty frustrating this afternoon. Fortunately I had saved the results of one API call for my hack, so I can fake the call using the XML file. The connection has been back for a few minutes now, so it might go again. Quick! Post!

[Tags: ]

HackDay London - Part 2 of n

Lightning does strike twice, at least it did here at Alexandra Palace today. There was a very loud bang, followed by panels opening in the roof, causing rain coming into the main hall, where we were all sitting with our laptops, and where lots of PA equipment was set up. The fire system automatically opened the roof when the lightning discombobulated it.

We all went into the entrance hall, and sat around on the bean bags for an hour or so until we could come back in. Wireless access is still sporadic, which makes coding against public APIs rather difficult. Despite this, I've nearly finished my hack,

I've uploaded some photos on Flickr.

[Tags: ]

HackDay London - Part 1 of n

Little and often today, I think.

I was met outside the station by someone in a HackDay t-shirt, who asked if I was attending. I don't know how he knew that I was a geek...

This is a first - I was asked what size t-shirt I wanted. Usually they're huge.
Listening (kind of) to Kent Brewster talking about creating apps using the news API.

Wireless signal has stopped working half an hour in. Working again now, so I'll post while I still can...

[Tags: ]

Wednesday, June 13, 2007

ASP.NET themes and hosting multiple sites from a single app

I'm currently writing several sites with the same functionality. Hosting them all from one directory is straightforward, by adding virtual directories in IIS.

Changing the images, CSS and colours is easy enough using themes. Web.Config settings are a different matter. As themes support XML files, a config file can be added to each theme. Once added, they can be accessed by using the theme name:

ExeConfigurationFileMap exe = new ExeConfigurationFileMap();
exe.ExeConfigFilename = Server.MapPath("~/App_Themes/" + Page.Theme + "/SiteSettings.config");
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(exe, ConfigurationUserLevel.None);


The application settings can be accessed thus:


config.AppSettings.Settings["SettingName"];

Tuesday, June 05, 2007

With Ties - SQL Server Tip

Consider the following table of data from my database:

NameScore
Brenda42
Maureen41
Edwin41
Terry40
Rupert39
Arthur39
Paula39
Eric38


These are my fictional students from my fictional cooking class, with their fictional scores from my fictional washing-up exam.

Suppose I wanted to find the top five students. I would do a SELECT TOP 5 statement, thus:

SELECT TOP 5 Name, Score
FROM Scores
ORDER BY Score DESC


This results in the following:

NameScore
Brenda42
Maureen41
Edwin41
Terry40
Rupert39


Note that although there are 3 students with a score of 39, only Rupert made it onto the top 5. To get Arthur and Paula too, then one can use WITH TIES as part of the TOP clause:

SELECT TOP 5 WITH TIES Name, Score
FROM Scores
ORDER BY Score DESC


Which gives:

NameScore
Brenda42
Maureen41
Edwin41
Terry40
Rupert39
Arthur39
Paula39


I only found this one out today. Interesting.

[Tags: ]