# Sunday, October 17, 2004

I'm just working on the membership part of the web site and as the user configuration is stored in a file I wanted to make sure it was going to be saved safely. Simple, just copy the file to a backup before saving. If anything goes wrong then restore the backup. The code is a little fiddly and I want to use if everywhere I save a file so I've created a little utility struct.

    public struct AutoBackup : IDisposable
    {
        private string file;
        private string backup;

        public AutoBackup(string file)
        {
            this.file = file;
            this.backup = file + ".bak";

            if (File.Exists(this.file))
            {
                File.Copy(this.file, this.backup);
            }
        }

        public void Dispose()
        {
            if (File.Exists(this.backup))
            {
                File.Copy(this.backup, this.file, true);
                File.Delete(this.backup);
            }
        }

        public void DeleteBackup()
        {
            if (File.Exists(this.backup))
                File.Delete(this.backup);
        }
    }

It's a struct because it should always be created on the stack. Initially I had some problems because I was trying to modify the fields after initialisation; something you can only do with reference objects. Usage is as follows:

    using (AutoBackup bak = new AutoBackup(membershipFile))
    using (FileStream fs = new FileStream(membershipFile,
            FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
    {
        serializer.Serialize(fs, membership);
        bak.DeleteBackup();
    }

The DeleteBackup() call is to stop the auto restore functionality from kicking in. If anything happens during the save that causes an exception to be thrown then the using block ensures the old file is restored.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, October 17, 2004 9:59:29 PM (GMT Daylight Time, UTC+01:00)  #    Comments [2] Trackback

A couple of days ago Somasegar announced that C# would have Edit and Continue support in VS 2005. Wow, great news... But hold on, haven't they been saying all year that they didn't have time to do both refactoring and edit & continue? What changed and more importantly, how has that affected the final delivery date? You don't just add in a major feature and expect everything else to stay the same. So I guess one of the following has happened:

  • They found a bunch of devs and testers who have nothing better to do
  • Yukon has delayed some more and since VS2005 shares the same CLR version they now have so much slack in the schedule that they can add the feature
  • The new feature has delayed the product

I don't expect the first option is correct. I suspect the second has happened. Even if it's the third then we have a schedule slip somewhere and an even longer wait. Come on guys, I thought Microsoft's 21 Rules of Thumb was all about begin schedule driven and not feature driven? I'm under pressure to use alternative technologies so if the wait is too long then I'm afraid you may lose your chance.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, October 17, 2004 10:38:44 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1] Trackback
# Saturday, October 16, 2004

I was just thinking about the overall architecture for the Golf Web application and whether or not it would be better to try and use existing products instead of trying to roll my own. I could use dasBlog and nGallery like this site does to provide pictures and allow members to update what they are doing.

This is the classic "buy vs build" decision that sometimes gets overlooked in software development. The cost equation is simple: will the purchase cost of the bought component + integration costs be greater or less than the cost of developing said functionality + support costs. Putting numbers in the equation is a little more difficult. Remember the purchase cost may include additional licensing fees. At Exony we have a simple rule for commercial components - if the component can't be redistributed royalty free or under OEM license then we don't use it. Open Source can be useful must don't forget to check the license especially the part about derivative works where the wrong license can commit your entire product to the public domain.

I'm not keen on using the two products mentioned above because they are complete overkill for what I want. There is a third way though, to use parts of the code base. The architecture will be mine but using code from the other two; sort of like a code snippet library. I've checked the licenses and this is allowed as long as I include the original license and copyright notices.

What I couldn't find though was any sort of .NET web contact manager. Does anyone know of one?

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, October 16, 2004 6:27:52 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Friday, October 15, 2004
I installed Desktop Google an hour or so ago. It's just completed indexing my entire hard drive and it's search speed blows everything else out of the water (bye bye Lookout). It indexes cpp and header files, but for some reason SQL and CS sources aren't. Shame, it would mean I don't have to use grep.
This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Friday, October 15, 2004 4:38:45 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Wednesday, October 13, 2004
My friend Brad on why you should (or not) "blog like no-one's reading".
This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, October 13, 2004 10:27:36 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1] Trackback

As promised previously, I want to dig a little deeper into the requirements and discuss some solutions. This post is going to be about the security and membership. The relevant requirements are:

  1. There system will only allow access to members, i.e. no public access
  2. The system should be simple and that includes registration
  3. Registration and security should be self maintaining wherever possible
  4. Lost password handling must be automatic

There are standard patterns for login and registration and you really want the users to feel in familiar territory whilst starting out with your application in otherwise they are likely to give up and never return. Also I want new users to be up and running as soon as possible.

First I have some choices to make so lets start with login id. Personally I find it difficult to remember my user names, particularly if registered with lots of web sites. I tend to try and pick the same one but obviously if someone else is using it then I have to pick a different one or a variation. I think using an e-mail address as a login is much more memorable and the chances of a clash are near zero. We will need the e-mail address as part of the registration process anyway so using it as a login id removes the need for choosing an additional login name or providing additional registration pages dedicated to telling the user to pick another name because it already exists.

Next the password. This is usually a weak point in any security system and I believe the best approach is to make it easy and secure for users retrieve a forgotten password. This way you can urge them to pick a more complicated pass phrase without them worrying about forgetting it. I need to allow for long passwords so there should be at least 100 characters available. Whilst we are on the subject of passwords, I intend to only store a salted hash so retrieving a password will be impossible. Lost passwords mean that the user will have to recreate a new one. There are two ways I could do this: either by generating a new password and e-mailing the result to the user or sending a special "one time" link instead which, when clicked on, allows the user to set a new password. As e-mail will travel unencrypted I prefer the second approach because the user is forced to select a new password and the link will only work once.

Finally, the registration process. This one is a little more complicated because I know Laura already has a list of contact details she wishes upload to the site. This means that contacts may already exist before the relevant user registers. I'm not sure if Laura intends the users to edit any contact or only their own details (I must remember to ask). If it's the latter then I'll need some mechanism for tying up the user to the contact. I could get the user to type in their address at registration and match that to an existing contact but there too much room for error when you consider things like "street" can be written as "st." etc. What I shall probably do is some sort of fuzzy match based on the post code and any other digits in the address. More on that at a later date. One benefit of matching the user to an existing contact is I can automatically validate a registration request saving Laura from a manual step. Any non-matches will have to manually verified unless I can think of some cunning way around the problem.

Thats all for tonight. As it's my birthday I'm going for dinner with friends tomorrow so the next installment will be at the weekend.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, October 13, 2004 9:54:11 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Tuesday, October 12, 2004

My step mother asked for a favour this weekend. She has a rather large Word document of unsorted contact details and pictures that she wants to publish on the web. She wants me to see if I can provide a solution. I should start by saying this is a classic request of a programmer similar to "will you help fix my computer" and "I can't read my e-mail". I'm happy to do this, particularly as it's a fun little project, but it can turn into a bit of a commitment.

So what is this application supposed to do? Lets review some of the requirements from Laura:

  • The application will support a membership of a virtual golf club; they meet up for social reasons and to play different courses in the US and UK
  • Manage contact details for golf club members
  • Each contact has name, address, phone, e-mail and a picture
  • Members should be able to update their own details
  • Members can search for other member's details
  • The system will only allow access to members, i.e. no public access
  • The members can add descriptions of what they are up to

After thinking about this for a while I can see that there are some additional unwritten requirements. It's usual for the customer to not fully understand what they want and as an analyst you have to use your experience and fill in the gaps. You do need to go back to the customer and check your assumptions are correct though. So what are mine?

  • Simplicity - the users of this application are in their 40's, 50's and 60's so I'm going to make a sweeping generalisation and say they aren't too comfortable around computers.
  • Manageability - Laura is a busy person with better things to do than continually login and manage the system
  • Registration - to ease the management burden on Laura, this should be as automated as possible
  • Lost passwords - this is not an every day application so the large gaps between logins will increase the chance that the members have forgotten their passwords. It also needs to be automated so Laura doesn't have to do anything.
  • Meet-ups. This was not in the original list from Laura but it's the primary reason the club exists. Would it be worth placing on the product backlog?
  • Notifications - do the members want to be notified if anything has been updated? This will save them from the burden of logging in frequently.
  • Logging - this one is for me because if anything goes wrong then I'm the one getting the call to fix it
  • Hosting - I'll need to find somewhere appropriate to host the application. Luckily we checked and a suitable domain name is free.
  • Data Storage - I don't have experience of using databases on web hosts, though I know it's possible, so I want to try and use a file based data storage mechanism

Next time I'll discuss some of the requirements in more detail with respect to some possible solutions.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, October 12, 2004 8:25:16 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Sunday, October 10, 2004

Last night was excellent. We were at The Fire House, a private members club just opposite the Natural History Museum. There was a good mix of people, mainly from public relations and fashion which makes a change from the computer and telecoms people I'm normally with. I had a very interesting conversion about crisis management with a PR guy. The principals are similar to software management - know the facts and act early.

Sometime later I was also talking to an IT teacher about the problems getting kids interested in computers (not games). We discussed blogging and how it could provide the kids with a chance to create their own online content. This would get them involved with something they could own and have a reason for wanting to do; certainly more interesting than home work. They would also be practising their writing skills at the same time.

Many drinks later, we left at about 3am and grabbed some food to soak up the alcohol. Head was a bit sore this morning but a late lunch at The Wolseley on Piccadilly helped a lot.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Sunday, October 10, 2004 8:38:38 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Saturday, October 09, 2004
Just a quick one before I go. I'm off to London today because a friend is emigrating to La la Land (Los Angeles) and she's having a party. Good luck in your new job Yasmine. It's also my birthday next week so a visit to my folks is in order.
This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Saturday, October 09, 2004 11:55:54 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Friday, October 08, 2004

A quick shot with my new camera of where I spend a lot of time. Somewhere I can go and geek out in peace and as you might expect it's full of things I've collected over the years. In fact, I never take anything off the pin-board, just put new stuff over the top. The most used item is well within reach - my MSDN discs (top shelf, blue case). I'm a big fan of O'Reilly books (third shelf) and the Addison Wesley "Object Technology Series" (second shelf). There are loads more - I have piles of books all over the house as you can see to the left of the laptop. There are also thousands of records (bottom shelf) mainly from the 90s when I was into mixing. On the wall to the left (out of shot) there is a huge map of the world which is great for getting some perspective and yes, that is a giant poster of Sarah Michelle Gellar - it was a leaving gift from Sony. The FHM calendar is replaced with whatever I get given each year. There is more to the right which you can see in the panorama.

Maybe this could start a new meme (assuming someone like Robert Scoble is kind enough to pass on the thought) - where do you blog from? (Send me a trackback so I can find you).

[Edit: I was about to post and remembered that there are two passwords and a couple of addresses on the pin-board so I've edited them from the picture here and in the gallery. Thats what the smudges are.]

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Friday, October 08, 2004 8:10:32 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1] Trackback

So I haven't had time to blog much. There are, however, a number of links on my desktop that I've collected and meant to take a look at. So I can tidy up I'll list them here instead.

Plus some useful articles on MSDN:

(*) The title is based on a quote by Jesse from the Fast Show. Spoken in a West Country accent.

This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Friday, October 08, 2004 5:12:28 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Monday, October 04, 2004

My old digital camera was starting to lose the technology race so I've bought a new Canon Digital Ixus 500:

 

Sorry for the poor quality image; had to use my phone camera to take a picture of it!

I bought it at Amazon because I didn't have to leave my seat and they delivered it in 2 days. The only problem I have is the "Customers who bought this item also bought:" part of the page - it's too easy... So in addition I now have:

  • 1 of: Tamrac TA5688 Sub-Compact Digital Camera Pouch
  • 1 of: Canon NB1LH Spare Li-Ion rechargeable battery
  • 1 of: ByteStor 1GB USB2.0 Flash Pen drive
  • 1 of: ByteStor Compact Flash Card USB Reader
  • 1 of: ByteStor 1GB High speed Compact flash
This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Monday, October 04, 2004 9:41:25 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback