May 2005
Monthly Archive
Fri 27 May 2005
One of the thngs I like about my job is solving problems. In particular problems where there is a bit of thought involved. The particular problem I had is that for a search interface I’m building a requirement is the ability to page result set. This is easy using MySQL as it has a LIMIT keyword that limits the results to a certain number, and allows an offset, so for example you to retrieve results 16-20 you would use LIMIT 15,5.
Unfortunately, SQL Server does not have an equivalent to the offset argument. Its nearest is TOP n, which returns the first n rows.
This puzzled me for a few days, but then the answer came to me in a flash of inspiration: Results 20-16 would be the first 5 rows of a TOP 5 statement, with a nested query with a TOP 20 statement in the opposite order. Then I could just reverse the order to get the result the right way around.
So here’s what I came up with:
SELECT * FROM (
SELECT TOP x * FROM (
SELECT TOP y fields
FROM table
WHERE conditions
ORDER BY table.field ASC) as foo
ORDER by field DESC) as bar
ORDER by field ASC
x is the number of rows you want returned and y is x+offset.
After looking at this in Query Analyzer, it appears that the extra nesting does not add very much to the load. For the queries I was running it was only about 2%.
Mon 23 May 2005
If you visit this site rather than just the RSS you will have noticed a change in the theme that I am using. I’ve switched to a modified version of Connections, which won the recent WP Themes Competition.
I’ll be working on gradual improvements, otherwise it would never be released as I want it. The header image is what I see standing on the platform at Wellington Railway Station. It’s about 5 photos taken with my phone and then stitched together with Autostitch. I’ve added my del.icio.us links to the theme. I’ll slowly fix the colours to match the header over the next few days. Also, I’ll have a go at converting it to Strict XHTML, just for fun.
Fri 20 May 2005
Posted by Joe under
Music[3] Comments
I’ve stolen it from the Aussies and am passing it to Kiwis.
- Total volume of Music on my Computer
- 4.7GB
- Song playing right now
- Azzido Da Bass - ‘Doom’s Night (Timo Maas Remix)’ (Thanks Mike)
- Last CD I bought
- Chemical Brothers - Push the Button
- Five songs I listen to a lot/mean a lot to me
-
- Five people to whom I am passing the baton
-
Keeping it Kiwi
Wed 18 May 2005
Following on from Mike Brown’s presentation about Web Standards and the Web Standard Group, I gave my presentation on Semantic HTML at the GOVIS conference.
Public speaking is not my forté, but I managed to pull it of, even with a chuckle or two in what can be a very dry topic, especially after lunch. The anticipation and nervousness made me feel really drained afterwards.
Fri 13 May 2005
I went with my daughter’s class to Ngā Manu Nature Reserve (map on Multimap). We got to see a whole lot of different native birds, some of which only exist in small populations on predator-free offshore islands.
The highlight for me was getting up close with a tuatara, a native reptile, that appears on the New Zealand 5 cent piece. It surprised me to learn that despite it’s appearances, the tuatara is not a lizard.
Wed 11 May 2005
My home email address gets a huge amount of spam, as does my Gmail. The great thing about Gmail is that all of its spam filtering is set up already. I don’t have to mess around and configure all sorts of folders and filters, tag all of my mail so that Thunderbird know that it’s spam etc.
Instead of filtering it with email headers, I just forward all mail sent to joe@kapiti.net.nz to my Gmail account, which has a filter that returns it to [secret-nonsense-phrase]@kapiti.net.nz and set thunderbird accordingly.
One disadvantage of this method is that mail sent directly to [secret-nonsense-phrase]@kapiti.net.nz would get through without being filtered. This is only a ’security through obscurity’ type of thing, which is in general a bad idea.
Sun 8 May 2005
I saw a guy break his leg on the soccer field in a tackle. Both tibia and fibula about eight inches above his ankle. Made me slightly reluctant to commit to a front-on tackle, especially when I’m playing guys that are mostly my size or bigger, and I’m big for a soccer player: same size as this guy, just not as hard.
Fri 6 May 2005
I’m itchin’ to start studying again. I finished a PGDipBusAdmin (Management) at the end of 2003. I’ve had 2004 off and wasn’t going to do any more this year, but I’m getting that feeling again that I’m starting to forget what I’ve learnt.
I’ve had breaks from study before. I took two years off during my undergrad degree, something I don’t recommend, and then it was another three years before I started doing post-grad stuff. If you’re a full time student now, stay at it for as long as you can, and go as far as you can because it’s hard to give up work to go back to being poor.
I’ve set myself a goal: by 2010 I will have a Master’s degree, ideally sooner. Most likely a Master of Management from Massey, although I’m sort of considering an MPM at Victoria. Now I just have to figure out how to pay for it…
Next Page »