Thursday, May 27, 2004

TDD for amateurs...

I do like Test Driven Development. I really do. I can see how it (along with the other aspects of agile programming, eXtreme programming and the like. I can see how it can create quite a clear focus, expected outcome --> test --> code to pass the test. It sounds great.

I really can't get myself motivated to do it, though. The problem with being a hobbyist developer is that you never have a properly specced project. It's always something focused on what you know/what you're interested in/what you want to do. Because there's no 'client' to satisfy, you end up with a very organic development process. There's rarely a clear outcome at the beginning, and so, you can't write the tests to produce that outcome. Now I guess you could argue that if you're ultra disciplined or ultra skilled, then that doesn't matter. You can write your code, and you'll be able to make sure it fits nicely and all the rest. If you're not, though, it can be a it frustrating.

Not too bad, though. I've discovered that there are very few coding mistakes that can't be brushed under the carpet with an inherited class.

Test Driven is really good, though. The few times I've managed to keep myself disciplined enough to write the tests and develop from there have been really good fun. I'm focused, and there are a whole load of really quick wins. Which is nice.

I guess I really should start writing the tests and coding around them again. Of all the things I miss, NUnit's big green bar really does fill me with joy!

Wednesday, May 26, 2004

What to do next...

Now that ASP2WMP is running more-or-less bug free, what next? Obviously there'll be a bit more testing - I haven't got ana ctual mobile device to test it with yet, so there might be a few bugs that need a bit of an ironing out.

I think I might try doing something with a web service. Although I might add a couple of comlplications to the mix.

First, I think all the SOAP messages are going to be encrypted. Good. That'll give me a chance to play about with encryption. It'll also give me a chance to play about with Web Service Extensions. I think I might build an encryption/decryption extension. Keeps it nice and independent of the web service itself, which can be written any old how, and then the appropriate extension attributes can be added to the service (and the client app).

I think I might use the existing code etc. from ASCO to do it as well. I'm bored with ordering, though. I think I'll do some sort of client picking/packing app. I haven't got the .NET CF SDK or anything, so it'll be a desktop based app for now. But I'll still use encrypted web services to do it, I think. Who knows. might even get all excited and build a little automatic logging/auditing/recording feature.

Imight not do any of those things, though. Going away for the weekend tomorrow, so I might find some inspiration in sunny Plymouth.

Saturday, May 22, 2004

ASP2WMP

Quite a long one. Sorry about that.

Got my remote control for Windows Media Player working. It's put together like this:

  • Shared Class (inherited from MarshalByRefObject) that essentially just contains a Media Player object (using the Primary Interop Assemblies from Microsoft)

  • Remoting server app (just a console app that registers a remoting service exposing the class created above via a tcp channel)

  • Mobile Web page (just a .aspx page) with 2 forms

The forms at the moment are pretty basic. There's a main form with the currently selected Album and Artist displayed, along with buttons for next track, previous track, stop and select new album. The second form lists all the albums in my media library, and allows you to select one to play before taking you back to the main form.

It's far from perfect. I need to have a further look through the docs for mobile web forms - there doesn't seem to be a mobile equivalent for a LinkButton. I suspect, although I've got no way of checking, that when it's actually rendered on a WAP phone all the commands are rendered as plain text, like menu options. Just browsing to it in IE, however, makes it look pretty ugly. I've either got a big stack of buttons, or a funny menu thing which takes you to a page with further details of the album object. That's why I need to look into the list controls etc. Although having said that, it might be kinda useful. I'll have to see how it looks on a real phone.

The remoting class returns the album list as an array of AlbumDetails (AlbumDetails is implemented as a small class with just 2 properties, Name and Artist). This array is then put into an ObjectList. This was the only way I could find of producing a list of albums which could be used to send a command back to the server.

I guess I could just sling them all in as links, posting the page back to itself and adding a parameter to the URL. It's worth a look. I might just end up doing it that way. Who knows.

I think I might also have a look at adding a volume control to the page. It'll only be 2 buttons, one for up, and one for down. Don't think it'll be terribly tricky to do. Just add the volume changy function to the remotable class and hey presto! Volume adjustment ahoy.

I might also develop the remoting server into a proper Windows Service. Shouldn't take too much work, and it'll look more impressive (to me, anyway...) not having to start a console app to make the web page work.

Other than that, there's just a few polishing bits to do. I'd like to develop a bit more error handling in there. At the moment it's a bit fragile. I've been seeing plenty of those nice buff-and-red pages pop up if I haven't done something right.

I need to have a look at array comparison stuff as well. WMP doesn't have a built-in function for getting a list of all the albums in the media library, so I've got an iterator going through every track and putting the album name into an array. If the name's not already in there it's added. If not, then it goes onto the next one. However, the comparison's case-sensitive, so there are a few duplicate entries in the list. I can either clean up my media library, or clean up the code. I know which one's going to be more interesting!

It's still a tad limited. Since I haven't got full-blown VS, I haven't got native .NET CF support, but I'm sure I'll be able to find some sort of workaround. If I do, then I can build something with a bit of a richer interface and a bit more interaction. Until then, I'm just happy to get it working over WAP. My first foray into the wonderful world of remoting objects and mobile computing.

I love this book.

Once again. Sorry about the length.

Friday, May 21, 2004

Would you credit it...

The Register reported 5 whole years ago SETI was launched.

I kinda like the idea of SETI. Over the past 5 years I've seen more geeks with the SETI screensaver running than anything else - One of my mates even forced all the PCs in his company to run it. Best of luck to 'em.

Thursday, May 20, 2004


This is a can of Special Woo. More importantly, it's my first time posting a picture using BloggerBot

Exposing WMP

Need to look into how to expose an instance of Windows Media Player running on the webserver to an ASP.NET web app. Not too sure whether the best route's going to be through a separate service or via a class within the web app. A separate component seems to make the best sense to me. I can expose it as a remoting object, running either in a little server app or in a full blown windows service. Which of those 2 is academic. Once the app is written to host the player, to develop that into a service isn't too difficult.

Need to read through the WMP SDK documentation, though. The only implementations I've seen of media player in an app is through a windows application (with incumbent UI elements). Having had a quick play last night, it seems that the WMP activeX control doesn't like being put onto a component design service. I'm sure I'll figure it out, though.

Once that's done, it's just the UI to do. Which should be fairly simple. I'm not planning anything spectacular. Just the ability to play songs or albums etc... Who knows where it'll go! But to quote Hannibal Lecter 'I'm sure it's gonna be a lot of fun!'

Wednesday, May 19, 2004

My Next Project

After much deliberation, and having chosen the new phone I'm getting next month (a rather natty little SPV e200, I've plumped for a mobile web app.

I even know what I'm going to do with it, too! Inspired by this article I'm going to see about putting together a little mobile web based media player remote. I'm hoping that the joys of IR or Bluetooth are going to let me browse to my PC with pocket IE without going throught the internet. Then it's more-or-less a case of putting together a server app and web front-end.

Who knows how it'll turn out. It'll be fun trying. No doubt I'll keep you posted.

Tuesday, May 18, 2004

Very Slack Blogger

Yes, I have been slack this week. The main reason being that I haven't been up to much, either in terms of learning, or inded in terms of writing (reminded by this).

Got my hands on VB.NET 2003. Like it. Although it's not hugely different from 2002, there are more projects 'n' stuff available from the developer community. And intellisense is quite cool - it now guesses which option I'm most likely to need when it pops up and pre-selects it. OK, it gets it wrong half the time, but certainly for now it's quite amusing.

Been reading and playing about with .NET remoting. Quite interesting. I can certainly see some practical applications for this, just haven't had the opportunity to exercise it yet...

Having a bit of a motivational crisis at the moment. Need to think of a mini-project to work on. Although ASCO, my shop project is interesting, and at the moment there's a lot of things to do to it (I've barely even started putting front-ends on anything) it's really difficult to keep it interesting. I need a break. On the up-side, I can have one whenever - I'm not doing it for a client. I'm not doing anything for a client. I can pick things up and put them down again whenerver I darned well chose. I just need something to occupy myself for a bit. Hmmm. Creating problems to solve. I'm sure I'll write an entry about this one day. In the meantime, go see secretGeek. He's kinda groovy. Although I think he needs to check out these hints on getting your keyboard clean.

Monday, May 10, 2004

Cancel Cancel Cancel

Note to self: THere is nothing more annoying than a form with hotkeys for everything except cancel, a la Raiser's Edge

Very mature...

No matter how many times I hear the term 'movement sheet' it still makes me giggle...

Friday, May 07, 2004

The Stix...

I made a key decision last night. As is usual with my decision making, it looked like it was a decision never to be made, until one single moment of epiphany when it came to me.

I'm buying VB 2003. £90 (or thereabouts). Bugger.

I was trying to put it off for as long as possible (Newby that I am, I bought VB 2002 about a week before 2003 came out!). Perhaps even waiting until 2005 comes out (although I've been thinking about thyis since Whidbey's release date was estimated at about now). But no.

I wouldn't mind, but there seems to be opportunity after opportunity to get it for free. The most recent one I've seen is here. As with all of them, though, the key to getting your free stuff seems to be 'Available to residents in USA and Canada only'. Oh the curse of living in far flung outskirts of the world (UK)!

Why is this? Is it a tax thing? Or are the European wing just too tight to make frivolous offers like that on their patch? Or are they out there, just nobody tells me about them? Hmmm. Oh well, to Amazon, Mastercard in hand!