Daniel's Stuff

I write code

Month: February 2007

ASP.Net blows chunks

Really big nasty chunks! I guess I’ve been spoilt by working with rails, and to be fair it’s not really ASP.Net I don’t like, it’s ADO.Net. I mean really, who wants to write 12 lines of code to fill a grid with data from a database! 
1. construct a new SqlConnection object 
2. construct a new SqlCommand object 
3. construct a new SqlParameter object 
4. set the parameter name 
5. set the parameter value 
6. add the parameter to the select command 
7. construct a new DataSource object 
8. construct a new SqlDataAdapter object 
9. fill the DataSource using the SqlDataAdapter 
10. connect the DataSource property of the grid to the DataSource object constructed earlier 
11. call the DataBind method of the grid to actually load the data 
12. close the database connection 
I guess it’s all supposed to be used via the GUI editing tools which should build a lot of that stuff for me automatically. I assume the GUI built data binding can handle parameters for the select. 
Another feature of Rails that I’m missing in ASP.Net is partials. I’m using master pages to give me some of the things that I would have used a layout for in Rails, but there doesn’t seem to be anything quite like partials in ASP.Net 🙁 Fortunately for me it’s a simple application I have to build so there are only a couple of repeated sections of code. 
Also, what’s up with not allowing the TextBox control to be bound to a DataSource? I’ve got better things to do with my time than to write a line of code for each TextBox on my form to fill it with data and another to then put that data back into a DataTable so I can have it saved to a database. 
A word of advice to all ASP.Net developers who read this, don’t use Ruby on Rails. It will only make you realize how bad you’ve got it 😉

Songbird and multi-media keys under Linux

I’ve decided that under Linux I want to use Songbird as my music player. Unfortunately at the moment the latest developer release doesn’t support the multi-media keys on my keyboard 🙁 Not to be beaten I decided to do something about it and I’ve built my first XPCOM component along with some javascript glue to make it all work. Here is the Songbird extension, and here is the source. I won’t pretend it’s a great piece of work, but it does what I need it to do. The Play, Stop, Next and Previous buttons on my keyboard now work, but YMMV 😉


Working from Linux

I’ve been using Linux as my primary development environment in my day job for a couple of months now and for the most part I’m enjoying the change. It’s amazing that the same hardware running Linux seems to run so much faster than when running XP. Maybe I it’s just time for the semi-anual windows reinstall 😉 
I thought I’d go the whole hog and try using Emacs as well. I tooled up with all the various
Emacs bits and pirces I needed to make doing rails development under Emacs nice and off I went. It only took a couple of days to get used to the cursor movement and cut/copy/paste commands, but in the end I decided to go back to eclipse :(, and then spent the next day or so wondering why Ctrl-K and Alt-W didn’t do what I wanted 😉 I have to say I enjoyed the couple of weeks I spent with Emacs, but I’m still not ready to give up my modern UI addiction 😉 
Maybe one day I’ll give XEmacs a go…