March 15, 2005
March 11, 2005
Order By and Oracle View Definitions
A question came up at work last week, and the answer wasn't present in the documentation or readily available when I checked my backup brain.
The question? "Why can't I add an order by clause to my CREATE VIEW statement?"
Luckily my many years of experience and knowledge of arcane trivia came to my aid in helping me form an answer. This answer involved the relational algebra and some basic theories of relational databases. Some knowledge that I worryingly find isn't well spread amongst my fellow IT professionals. So I thought I would share it with you dear reader.
The unit of operation in a relational database is a relation. For those of us seperated by a number of years from serious mathematical study a relation is a collection of similar items. According to this definition (and I'm asking you to trust me on this) a relation isn't ordered. You can apply an order to a relation after you have retrieved it. In a relational database a table is a representation of a relation, the results of any operation are a relation (for instance a query result set is a relation which is created on the fly), and a view is a relation which is assembled on request.
Whilst it's probably technically possible to order a view the nice people at Oracle don't support it because it breaks the spirit of Codd's rules. More practically they don't allow you to order a view because it is likely be a performance problem. To apply an order by to a query result you first to have fetch all of the data, and then order it. Without an order by clause you can just initially fetch as many rows as you like and then subsequently fetch more and more rows as they are required.
Other databases may vary, MySQL doesn't support views, at least not in the version I've got installed, I don't have Microsoft SQL Server, Ingres, Firebird, DB2 or PostgreSQL installed on any machine I have access to. If you do have any of these databases and want to pitch in leave a note in the comments.
For more reading, as ever, wikipedia is your friend. In addition to the sections I've already linked to there is a comprehensive overview of the relational model and hardcore maths nuts can read about the relational calculus.
Where Does Groove Want To Go Today?
Is it me, or is the recently announced Microsoft acquisiton of Groove a big thing? I've not used Groove, but I am subjected to Lotus Notes on my current project. The only real coverage I've come across has been Mark Pilgrim's less than complimentary coverage and the link dump (in both senses of the word, scroll down to the bottom of the page) he posted in 2001.
Has anyone used Groove since then? Does it do what it says on the tin?
Pracitcally thinking I'm convinced that the most important part of this announcement is that Ray Ozzie is going to become Microsoft's new CTO. What effect, if any, is that going to have on the technology strategy of the largest software company in the world? I think it's a good idea to bring a little fresh blood from outside and Ray certainly has the pedigree. It will be interesting to keep on eye on this.
Although I suspect having your main development taking place on the west coast (of the only country in the world) and your CTO on the east coast (Groove networks is staying in Beverley, MA) may be interesting. Unless Groove the product works as well as the marketing promises, and then the new CTO will be a great success and I'll be able to move to a beach shack and work from there. Or maybe not.
March 09, 2005
March Sydney Python Meetup
Don't forget, tomorrow is the next Python Meetup in Sydney. The topic this time is web frameworks, and I'll be attempting to explain what is so great about Quixote. All being well I'll put my slides on this site afterwards as well.
If you want to know about the web and Python please come along. If you're already an expert then you're equally welcome and a ten minute presentation is a small price to pay for attendance.
If you're not in the harbour city but instead gently freezing in London, then there's a meetup there as well. Go along and buy Simon a pint from me.
March 07, 2005
Tired of the constant "look what my phone can do" comments from TGChen I succumbed and got a new mobile phone. I kept the budget modest and didn't stretch to a smart phone, just one that works. I seem to be in good company though, like Sil I've got my hands on a new K700i (just two days after they announce it's replacement, the K750i, naturally).
Regardless, what I find remarkable about this new phone is it's connectivity. It just works. I charged it up, turned it on, made sure bluetooth was working and then fired up iSync. Approximately three minutes later my address book and calendar were copied onto my phone. This, people, is the way that technology should work.
March 02, 2005
Productivity and Plain Text Files
Well, they've done it again the smashers. Mike Harris' review of remind prompted me to download a copy and try it out. And it's brilliant. To call it a calendar and reminder program isn't doing it justice. Take a look at the tips and discussion that have accompanied Mike's article in the comments, and then take a look at the extensive man page if you don't believe me.
A nice useful feature is the ability to output your calendar as a postscript file. With this I can print out a month's calendar and pin it up next to my desk. Because I'm running remind on my Mac I can take this one step further. By opening the postscript file in Preview it gets converted into a PDF, which not only has a smaller file size but aids portability to boot. It's possible to do this at the command line as well - with ps2pdf, but I haven't found the right combination of options to make the output look as good as Preview does.
It's allowed me to ditch my Palm Pilot and fully embrace the geek credo (see http://www.lifehacks.com/) of storing all of my information in plain text files. My old PDA hadn't been pulling it's weight recently. I'd replaced the address book with an XML file and a simple Python script so it's only remaining use was as a diary. Remind, even in the few short hours I've been using it, has easily supplanted that function.
My to-do list is currently stored in Omni Outliner but I suspect that it will be making it's way to a plain text file any day now.
As a trap for young players, by slavishly following Mike's advice I discovered that GeekTool doesn't play well with Desktop Manager. It's the first time I've managed to seriously mangle my Mac just by running some simple software. You have been warned.