Wednesday, June 30, 2004

Orphan Project

Sadly the face recogniser project has died.

There are a couple of reasons for this.

1) After I started coding it, I discovered it was more of a maths problem than a programming problem. Which would be fine, but it's just not the kind of thing I was planning on doing.
2) I got bored.

Not being a paid programmer, I have the dubious luxury of being able to start and stop projects at will. Which is kinda nice in a way, but kinda not in others. It's kinda nice because it means I'm not beholden to anyone or anything. I don't have deadlines to work to, and I can spend as muchtime as I like exploring and experimenting, which sometimes turns up something interesting. On the downside, it does mean that I've got nothing to push me to overcome something difficult/tedious. Difficult's not a problem. I like to think I'm driven enough to overcome, or even welcome difficult challenges. Boring's the killer. Being a mathematician at heart, I have a tendency to sometimes look at a problem, think to myself 'Hey, there is a solution. Cool.' and leave it there, rather than going through and actually finish what I'm doing. I must work on that, I think.

My new project is a little lightweight mini blogging app. It'll work offline and online, and synchronize either manually or automatically, depending on whether I'm connected or not. It'll have a facility for comments, as well as an RSS feed.

Osteensibly it's to make me get my head round working with XML, both as XML in isolation and the classes and tools surrounding XML in the .NET framework.

Haven't decided exactly how it's going to work, yet, but I think it'll have a few components to it:
1) Windows forms app to edit/add/delete blog posts
2) Webforms app to view online/add comments etc.
3) HTML modules to add simple tracking facilities

That'll keep me going for now, I think.

Tuesday, June 29, 2004

Via everywhere

Well, it's all over he blogosphere (well, at least my small corner of it) so I may as well sling in my tuppence worth.

Now some of it's quite self explanatory - SQL Server 2005 Express is (according to MS) pretty much a direct replacement for MSDE. Sorted. An updated cheapskates SQL Server engine. I'm all for that. I haven't seen it myself (yet) but Mike Gunderloy reckons it's a lot more functional than MSDE.

But what about the others? Apparently they're aimed at 'enthusiasts and hobbyists'. Now, don't get me started on being a hobbyist programmer, but where do they fit in with the rest of the VS line? Are they just completely standalone projects, kind of like WebMatrix, but with full support? Or are they replacements for the cut-down (cheaper) VB.NET, VC#.NET etc. MS reckons they'll be cheap, but how cheap, I wonder...

If they're completely new parts of the MS dev tools lineup, then that's really cool. Who knows. If it makes programming as easy as MS reckon, I might even manage to get Mrs Mawoo in on it!... Or not...

Anyway. That's all I've got to say about that. Time'll tell, no doubt. When I get a few hours to spare I'll have a look at downloading one of the betas, see how it fares. Need a few spare hours ,though. Darned dial-up connections!

Monday, June 28, 2004

Damned Bluetooth

Just spent an entire weekend trying to make my new Bluetooth Adapter work with my phone (Did I mention I got a new phone?). And my word is it difficult!

In theory, I just plug the adapter in, it sets itself up with a virtual serial port, and then I just point activesync to the virtual COM port and voila. Activesynch working over Bluetooth. Lovely.

Except it doesn't always happen like that.

I've tried everything. I've uninstalled and reinstalled everything a coupla times, I've tried every configuration under the sun to try and get it to work, and nada. Grrr. Looks like I'll be spending another evening doing more of the same. Mrs Mawoo's out tonight, so I'll be able to get really hostile about it.


It wouldn't be so bad, but Mrs Mawoo also got a new phone tis weekend, and you know what? It works a treat. We've been swapping files, ringotnes and pictures between her phone and my machine all evening. Grrr!

Friday, June 25, 2004

New toy!

Well, I haven't been doing a huge amount of .NET coding over the past few days (although I have been trying to argue my way around VBA this week). This has mainly been because I finally, after weeks of longing and waiting, have got my new sexy phone. And boy, is it sexy.

Just got to work out how the damn thing works, now!

Well. Looks like that'll be another few non-productive days...

Check this out. It certainly does rawk...

Monday, June 21, 2004

Cool stuff

I've just discovered something I didn't know I could do.

The bit nobody seems to write about when they're writing about data-driven applications is SQL Server's facility to produce query output as XML. In its simplest form, the T-SQL for getting the Authors table from the Pubs Database is:

Select * from Authors FOR XML AUTO, ELEMENTS
MSDN's otherwise excellent documentation gets a bit sketchy after that, although I do remember reading somewhere (although I can't remember where. I'm going to have to go through my books to find out) that the AUTO keyword essentially lets SQL Server arrange the data as it sees fit. The ELEMENTS keyword tells it to arrange fields and relationships as a nested set of elements.

Once that's been created as your SQLCommand object, you can then create an XmlReader object using the SQLCommand.ExecuteXMLReader() method. After that, the world is your XML-oyster. Having discovered this (I was dimly aware of it, but didn't think MSDE supported it) I think I'll have to have a play with it.

I think I just need to think of a few applications for it. One of the ones that shouts out at me is html-based reporting. Not only can I produce reports that look nice without creating too much of a load on the server (XMLReader's streaming nature means that the machine's not sitting with half a ton of DataSet in memory) dynamically, but I can create archived reports by feeding it straight through an XSLT transformation and saving it as an HTML page. Previously, all the archive reporting I've done uses hideously long and drawn out SQL Statements to try and guess the state of the data I was working with at the time in question - not any more.

And it's another thing that I know now that I didn't before, which is the main thing.

Friday, June 18, 2004

Trivial Applications

I've been re-reading through some of Rory Blythe's old posts, and one of them got me thinking about 'Trivial Applications'.

What makes an application trivial?

Is it the number of features or practical use?
One of the littl widgets I wrote was a batch importer for adding untagged MP3 files to Media Player's Media Library (OK, I know there are a million and one tools I could have downloaded for free, but that's a different story!). Okay, it's not overly complex. Just a form, some interop working with WMP's SDK and a bit of File.IO to name the tracks right. OK, as far as one-trick ponies go, it doesn't get much one-trickier than this. It does one thing and one thing alone. BUT I do use it all the time. I actually find it really useful (and I know it's quite sad, but I show all my friends when they come over to my house too). Would I consider this a trivial application? Not really. It's a simple tool, but it does the job and I like using it.

Is it the scalability?
As an exercise, I built a COM+ app that retreives and updates data from a database. It uses COM+, WinForms, COM+ Transactions, SQLConnection transactions, parameterized stored procedures, all the things that large scale developers talk about. It's got full error trapping and reporting, it has all sorts. In theory the only thing limiting the scalability is my network size (2 machines) and the database engine (MSDE - yes, I'm a cheapskate). Would I consider this trivial? Hell yes! I only did it to explore the tools and technologies a bit more. It has no practical use, and only does (at the end of the day) a really simple thing. It's quite complex, but still trivial.

Is it a question of whether it's been done before?
Everything's been done before. Don't pretend it hasn't.

Is it non-trivial if it uses real cutting edge technologies?
I also wrote an app (with Media Player again) that allows me to run WMP and control the music playing on my computer from a little desktop APP, and through a mobile web interface. It uses .NET Remoting, it uses mobile web forms, it uses some of the pretty new components and things that .NET has for controllings services and stuff. It's quite swanky. I really like it, and use it a lot. Does that make it a non-trivial application? I dunno. It certainly has absolutely no business use. There's no way anybody could make money off it. It's just a bit of frivolity. However, it's (again) something I use every day. (In some ways I prefer it to using WMP from the desktop, but I'll not go into that now. So is it a trivial app or not? I still can't decide.

So what does make an application 'Trivial'? I still don't really know. And to be honest, I don't really care. As a Hobbyist programmer (something I'll probably write about one day) I've really enjoyed writing all of them, so they're quite important to me, so that's alright.

Maintaining the Myth

Just read this over at secretGeek.

This kind of mollycoddling that gets me all riled up. It's this kind of stuff that perpetuates the constant snobbery from C-derivative users about VB users. It's pointes out here that it doesn't happen in C# at all!

How could hiding members make writing anything other than really really confusing. Picture the scene, you're doing something. You go to use a property, and then trusty intellisense tells you that it's not there!

Okay (thinks you) Maybe it's not a Shared member (maybe) maybe I need to create an instance of the class, and then it'll appear. So you go ahead, tweak your code, create a new instance of widget and lo and behold, it doesn't appear in intellisense. Bugger.

Check the object browser. Yup, it's there. Nope, it's not private, so I should be able to use it, right?

So (really damned counter intuitively) you go against what intellisense is suggesting to you and you bung the member in the you now KNOW is there (after relatively extensive research) and see how it turns out.

Okay, so it compiles and runs fine. Good. But wouldn't it be easier if it came up in the options in the first place?

Grrr. I got tripped up by this one when I first started using VB!

Thursday, June 17, 2004

Coupla interesting links

I don't usually post links on their own. It's not a conscious thing, it's just that normally when I blog it's not because I've found something interesting online, normally it's just because I've done something that (I at any rate) find a bit interesting, or overcome a bit of a problem.

However, I've found a couple of really quite nice blogs in my miscellaneous wanderings.

  • Sikko2Go seems at a glance to be in a similar boat to me, certainly in terms of .NET development. Bit of a newbie, but he's got some interesting things to say about some of his experiences.
  • Cathi Gero has probably forgotten more about data widgetry than I will ever know. She's posted some really quite cool tips and tricks when working with ADO.NET.
That is all.
PS - Just found something that made me chuckle -'s spelling checker doesn't include the word 'blog'.

Wednesday, June 16, 2004

Typical Benjimawoo...

As usual, I'm having trouble at the vey first stage of writing my little face recogniser. I do this every time. I've got stuff written in my head for parsing and identifying face elements fine. Not a problem. I can take a character map (if that's what it's called) and split it down into individual faces, and further down into individual elements (Noses etc.)

What I can't figure out how to do (at the moment) is convert the file from a text file to a bitmap. I've had many thoughts on he best way to do this, but they all seem not only a bit long-winded, but also a bit overcomplicated.

I'll keep thinking...

Monday, June 14, 2004

My Next Project

Inspired by this sample problem from an IPSC programming competition, I'm going to write an app that solves it.

Hopefully (just thinking the problem through over a cigarette) I'll be able to create something quite flexible. The published solutions depend on a certain degree of manual checking, and comparing. The 'best' solution published iterated through each type of face, and essentially produced a count of each type, as well as a graphical representation (I think). The user could then go through and add together the numbers of smiling faces. Fine.

Not my style, though. I think I'll have a go at writing something more fully automated. I'm thinking it'll work something like this:

  • Takes a file as input ( as published)
  • Some sort of algorithm parses the file into regions of faces (One of the knowns is that faces are all bounded by a continuous line)
  • Each face is rendered graphically (i.e using GDI+ to draw lines to join the dots)
Once each face is rendered as a set of graphics elements, the noise can hopefully be filtered out (some of the faces have wrinkles etc.). Once the face has been broken down into its key parts (Eyes, Nose & Mouth) then it'll be a simple(ish) task to pick out the mouth and determine whether or not it's smiling.

Should be fun. I've got a rough idea of how it'll work, and it'll give me an excuse to use a bit of GDI. Never used it before!

"Using" Statement in Whidbey

I just read here that the 'using' statement is going to be implemented in the next version of VB.NET.

I also read somewhere else that 'Using' is a really useful statement, and something that's been missing from VB for years (Apparently it's been about in the C variations for ages). What it does is this:

"The using statement obtains one or more resources, executes a statement, and then disposes of the resource."
This makes it pretty mich equivalent (apparently) to using a try..Catch..Finally block to ensure that Dispose() is called for any resources that implement it.

It might just be the example they chose, or it might just be me, but I can't see a huge amount of use for it - Using (pardon the pun) 'Using' ensures that resources are freed up when they're out of scope, but it doesn't have the error handling capability that a try..Catch..Finally has. If everything works fine, then that's OK, but if it doesn't, then the app'll fall over.

One rule of thumb I read (can't remember where, but it makes sense to me) is that every time you use a resource external to your app (Disk Files, Databases etc...) then that should all be wrapped in an error handling block. Kind of negates the need for 'Using' in my view...

Although having said that, I suppose it depends to a certain extent it depends how many resources you're using, and when the CLR actually disposes of them. Picture the scene:
Public Sub Go()
Using sw As StreamWriter = New StreamWriter("C:\hey.txt")
End Using
Catch ex as Exception
'Handle ex, notify user etc.
'Does anything need to go here?
End Try
End Sub
If the line sw.write("Hey") throws an exception, the execution steps out of the Using block and into the Catch block. Does the CLR dispose of sw at that point, or does it need a call to sw.Dispose in the finally section? Does it really add that much benefit? If it frees up resources regardless or not of whether the code within the Using block throws an exception or not, then it'll make the code more readable and certainly shorter, allowing you to do away with the Finally block altogether, but there are few examples that I can think of at the top of my head where this would be particularly desirable over a normal Try..Catch..Finally block.

I'm sure there are times when resources need to be disposed of, and yes, 'Using' does handle that for you, but in my (Ok, limited) experience, it doesn't seem to make a huge impact on the language. I'm sure that'll all change though, when I start 'Using' it (Boom Boom!).

Just a thought. Don't horsewhip me for being ungracious...

Thursday, June 10, 2004

Another project...

Hmmm. Time for another project. Since ASP2WMP seems to be working fine (Although I still haven't got my sexy phone yet, so can't really try it in real life. Darned stock shortages!) I think I need to move on to something else.

But what, though? In my quest for knowledge (I'm determined to get certified, even if it kills me!) I find it difficult to do another project similar to what I've done before - Half the reason I'm doing them at all is to get experience using a wider range of technologies that .NET has to offer. Doing the same thing over seems a bit naff.

At the same time, though, I'm too lazy to do something I see no practical use for. ASP2WMP came from a bit of lazyness, a bit of an article I read, and a bit of wanting to do something new (Remoting, Services etc..). MediaTagger (a little batch importing tool I wrote for adding MP3's to my Media Library was borne from wanting to add loads of files to my Media Library. What next, though? Hmmm. Tricky. I thnk I'll have to have a bit of a think on that one. I'll keep you posted...

Wednesday, June 09, 2004


Got turned down for a job today. Got I hate interviews.This made me laugh, though.

So that's alright.

Wednesday, June 02, 2004

vbasic @ the movies

All hail msdn. The 101 Visual Basic Movies have been put online to download locally. A lifesaver for the likes of me with my dodgy intermittent 56k connection. Bah. Time for Broadband. Still takes an hour for each batch, though.

Either way, I've just spent the past 2 hours watching them. Fantastic, particularly if, like me, you have no coder friends and just learn everything from books.

Just wanted to share. Although the link came from Mike Gunderloy's site.

Tuesday, June 01, 2004

Sorted... ish!

Well I managed to get my ASP2WMP service running properly. One thing nobody ever told me, however, was that blank passwords aren't allowed for a few interesting things. Yes, yes, yes, I know it's needed for security, and yes, I know it would be computer doom, but a littel warning would have been nice.

Until today my account wasn't password protected. I didn't reckon I needed it to get onto my computer at home. I trust myself and I trust Mrs Mawoo not to do anything nasty. However, when I tried to install the service, it would either prompt me for a password if I set it like this:

Me.ServiceProcessInstaller1.Password = nothing
Me.ServiceProcessInstaller1.Username = "COMPUTER\Ben"
and kick out an error during installation, just saying that the password was wrong, or when put in like this:
Me.ServiceProcessInstaller1.Password = "
Me.ServiceProcessInstaller1.Username = "COMPUTER\Ben"
it installed fine, but then I couldn't start the service. It said there was a logon problem.

It was only through finding an app, selecting 'Run As...' and trying to run it as a different account that it helpfully told me that I couldn't do things like that with non-password protected accounts. Aha!

Created a password, installed the service using that password (yes, I know I could have done it through MMC, but I daresay I'm going to be reinstalling it some point) and now it works like a beauty. So when I get my sexy new phone, I can navigate through my music etc. from that without even logging in. Cool eh?

Still means I have to type in my password every time I log in, though, which s a bit of a pain. One day I might look at creating a user account that works with it, but isn't mine. I'll leave that until another day, though.

Aha! And erm...

Back from sunny Plymouth yesterday. I might even get some pics up shortly.

I did, however, find this post that answers all the questions I've been trying to find answers to re. developing applications for devices on the cheap.

I need to do some more researching as well on running Windows Services on a different acount, or at least try to find out more about WMP's media library. The ASP2WMP remoting object works fine and dandy if I run it as a console app. That's great for development and testing, and also gives me a chance to use it now and again (just to feel all warm inside!) but now I want to develop it a bit further so I don't have to run that app.

I guess there are several ways I could do it. I could look at running the service as me, thus (hopefully) getting access to my version of WMP's media library. I could see about setting up the shared media player object so it specifies a library to check out. I could even look at an alternative to listing and selecting tracks from WMP's in-built Media Library. Hmmm. Much to think about.

And I've got to go to Plymouth again next weekend too!