MOZY backup - update

Someone higher up in MOZY support contacted me and put me in touch with a different support person. Here is a summary of how things went

01: He agreed that 50GB was a lot to download.
Not only did he agree to allow me to receive a DVD restore but also sent it free of charge to help compensate for the trouble I had experienced with their first line support.  Very kind I thought!

02: My DVDs turned up.
Being the sceptic I am I decided I would restore them to an alternate path on my hard disc.  I decided I would allow the download restore to complete and then do a directory comparison to see if both directories matched.

03: My restore failed.
I went to bed one night with an estimated time to completion of something like 2 weeks.  The next morning I awoke to the following status
"Complete.  Restored 3.3GB"


I reported this, but had decided not to persue it because I was now more interested in getting updates to my data backed up instead.

04: My next backup was big.
I started a backup only to be told that the estimated time until completion was about a month.  It appeared that MOZY wanted to backup all the files it should already have.

05: Backup only took a couple of days.
MOZY for some reason did upload some files that haven't changed (a video from 2005 for example).  In the end it took a few days to back everything up.  It was acceptible, but still wrong in my opinion as I had only altered a few text files so the backup at most should have only taken a few minutes.

What have I learned?
I have learned not to depend on a single backup strategy!

I decided to give LogMeInBackup a try.  LogMeInBackup copies my files to another computer of my choice, either on the LAN or the Internet, but a second computer I own or have control of.  I was very disapointed with this app.

I chose to backup to a laptop on my wireless LAN, the backup estimated 1 day (which is about right) but failed multiple times (probably about 8-10).  Once it finally completed I tested the restore only to be told it failed, testing it a second time told me it succeeded.  I'd expect a client/server app to work much better than this on a wireless LAN where both computers are in the same room and the router is only in the next room.  I am guessing that it failed each time my ISP went down (which has been quite a lot recently), although why I need access to the Internet to backup between two machines on a LAN I don't know.

External drive
I decided to buy a 500GB external drive for £50.  It took 11 minutes to copy my 50GB of data across.  I can do this any time I add a significant amount of data (new family videos).  The plan is that if I have a complete system failure again I can copy the files back from the external hard disc and then use MOZY to restore the minor changes.

In closing
Once I got through to someone with knowledge of their product my problem was solved very quickly (although not totally painlessly).  These are the steps I think MOZY need to take.

01: Train your support staff!
Better still, stop using Indian labour just because it is cheap.  I'd rather pay double and get better support.  Double $4.95 isn't much to pay!

02: Test your software properly!
I don't think MOZY has been tested in a "total failure" scenario for some time, or at least not properly.  You only need to install MOZY on a new Windows installation and try to restore to immediately find prominent problems

  A: No restore button unless you first do a backup, even though you have nothing to backup.
  B: Even after executing a redundant backup there is no backup history in the tab, which is very unnerving.

I have no idea why restoring my data when from 50GB at 1 month down to a few days at 3.3GB, and I expect it would be a much more difficult bug to reproduce, but this needs looking into.

03: Support the DVD option to non US addresses *on your website*!
I would only need this option now if my whole computer system was stolen and I had no external HD to restore from.  I do think though that the MOZY website should allow non US residents to order DVD restores. 

I was told that this is an option available to non US residents if you talk to support, but that was not my experience.  I was told quite categorically that it is available only to US residents.  Also, if it isn't on the website then it isn't "officially" supported, so just because you were able to get DVDs last week doesn't mean you can still get them this week.

"Oh no, person X shouldn't have done that.  We only ship DVDs to the US due to ........"

I will continue to use MOZY, but only rely on them for minor restores or in a disaster (computer + external HD both dead, or stolen).  Mostly I will depend on my external HD.

I would like to thank MOZY for making the extra effort to put things right.  My data is understandably very important to me!

Generation gap - update

Martin wrote to me and explained something I wasn't aware of. He doesn't catalogue best practises or only the ones he likes, he is cataloguing all patterns he can find.

He said he would rather someone made an informed bad decision than an uninformed good one. Not quite sure I agree with that either :-)


Generation gap

I have just read this blog by Martin Fowler. I like a lot of what Martin writes, but this is not one of them.

The article suggests using inheritance to separate code-generated classes and manually written classes. You would descend from a code-generated class instead of trying to modify the code-generated source.

The problems I see with this are


If I have a descendant of a code-generated class how do I attach .NET attributes to members? I’d have to override them and add the attribute in the descendant which would mean all of my members need to be virtual. Obviously this wouldn’t work for Private members.

I expect you’d have to attach all of your attributes in the tool which generates the source code, but I don’t like this idea. I will explain why later.

Sealed / final

What if we want to create a sealed/final class? We can’t. What if we want a specific member to be sealed/final? Then we couldn’t add attributes to the members.


Microsoft introduced Partial classes/methods to try to get around the problem of mixing code-generated and manually written code.

public class Person
  protected partial void BeforeSetName(ref string newValue);

  private string name;
  public string Name
    get { return name; }
      BeforeSetName(ref value);
      name = value;

The manually written part of the class can now optionally implement BeforeSetName

  public partial void BeforeSetName(ref string newValue)
    if (newValue == null)
      newValue = "";

and to decorate items with meta-data....

public class Person

public class PersonMetaData
  public string Name { get; set; }

I think the partial methods idea is a good one, but meta-data classes? Yuck! They violate the DRY principle, whenever I change the real Person class I have to update the PersonMetaData class too.


So, what is the solution? How about this?
Code generation tools should be good at what they do!

When I specified the code-generation for ECO MOdeler there were no partial classes/methods, everything had to be generated to a single file which had to mix manually written and auto-generated code together...

  //User code here
  #region ECO Modeler generated
  //User code here

The code-generator would only rip out and replace code within those regions, leaving the user written code intact. Now at the time partial classes didn’t exist so if I had the chance I would now most likely use BeforeX AfterX type partial methods instead of using *some* regions, but in places I still think they would be necessary.

For example I think that some attributes are quite valid to be entered into your code-generator and some aren’t. In such a case I would expect to see something like this

  #region auto-generated
  public string Name { get; set; }

One example of what is or is not relevant to your code-generator is interface realisation. The modeller I was using defined the business classes, from the point of view of the people within the business. Now if one of those classes needs to implement IComparable<T> this is an implementation detail and doesn’t belong in the business model (from which you generate source code) because it will just muddy the information presented to non programmers. ECO Modeler handled this nicely.

Step 1: Code is generated

public class Person : ICloneable, IRoleHolder

Step 2: Programmer implements IComparable<T>

public class Person : ICloneable, IComparable<Person>, IRoleHolder

Step 3: Model is changed so that Person realises the IStockHolder interface and removes the ICloneable interface

public class Person : IComparable<Person>, IRoleHolder, IStockHolder

ECO Modeler did this by storing information about which interfaces it added to the class last time it generated code. If they are no longer in the model they need to come out, any new ones in the model need to be added, and anything else needs to be left alone.

My point here really is this. Why should we be writing programming patterns which do not solve the problem at hand? Why develop programming patterns around holes in our technology? If it is causing us problems then our technology should improve! Code generators should be capable of parsing source code as well as generating it. They should be able to work in their own code arena without messing up ours!

So on this one I disagree, the problem lies in the tools and should be addressed there, not addressed in the coding of our applications.


PayPal are paying out!

I saw a blog post on Ayende's blog about PayPal where he said he had spoken to someone at PayPal.  I didn't know you could actually TALK to a PERSON.  He sent me the phone number (a USA number) and I called it.  I phoned that number today and the issue was resolved in about 15 minutes.

The lady on the phone said that PayPal should in fact return the exact amount of money taken from my account in cases of fraud, she apologised and said the difference would be paid in within 2 working days.

Yes it's only £20, but I don't like people stealing from me!

I've just ordered some books

Someone kindly gave me a £100 gift certificate for Amazon.  I posted a request for book suggestions to 3 groups where I would expect to receive good recommendations

I received a lot of recommendations (thanks everyone!) - here are the ones I have bought:

  Building Domain Specific Languages in Boo
  Writing Secure Code, Second Edition
  Analysis Patterns Reusable Object Models (OBT)
  How to Solve It: A New Aspect of Mathematical Method
  Object Oriented Project Design
  Extreme Programming Explained: Embrace Change
  Getting Things Done: How to Achieve Stress-free Productivity
Here are the books that made it onto my "future" list which I didn't have enough cash for this time around.


I generally went for the cheaper books first, so that I could get as much input as possible.  "The art of computer programming" looks good but I'd have hardly been able to get much else - especially as I considered Oren's book on DSLs a "must buy". 

The "Patterns of software architecture" series look good, although I suspect the 3rd in the series is the equivalent of "Nightmare on Elm Street 2" because the table of contents don't look too good and all the second hand prices are much lower :-)

I wish I could just download this stuff straight into my head!  Reading is so time consuming.


MUMS - How good you are when things go wrong

I always say this so I have probably blogged it in the past, in light of my MOZY incident probably recently, but "It's not how good you are when things go right, it's how good you are when things go wrong".

My wife and I are (unexpectedly) expecting our 4th baby.  We paid for a private scan at MUMS last week.  Part of the package is a DVD of the scan.  The scan was a really good one, but unfortunately when we got home we realised our DVD was completely blank.

I phone them up and they offered a free scan.  I was still disappointed because there was a beautiful part of our previous scan that would be lost, where we were zoomed right into our baby's hand as she repeatedly clenched and reopened her hand, but I agreed because at least we would have something.

When we had our scan they gave us probably double the normal amount of time.  In addition to that they upgraded our scan from a plain ultra sound to one of those 4D scans.  We were given twice as many printed photos of the scan, and absolutely loads of still images were written to the DVD.  They more than made up for the initial unfortunate mistake.

MUMS is a good company, because they are good when things go wrong!


Bletchley Park

If you are unaware Bletchley Park played a vital part in World War II, it undoubtedly shortened the war (possibly by years) by decoding intercepted Nazi messages which had been encoded on the Enigma machine.  This site is credited with being the place where the first programmable computer was used to crack the more complex Lorenz Cipher Machine.

According to this petition number 10 Downing Street...

...the park is severly lacking in funds and has at best 2 to 3 years before it is forced to close down.  The idea that a site with such a historical significance could be bulldozed and redeveloped is astonishing!

Please help to preserve this computer related historical UK site by making as many UK residents as possible aware of this petition!


MOZY backup

Vista screwed up on me recently.  It totally refused to boot either in normal or safe mode.  I ended up having to delete my partition and re-installing Windows, I decided to move back to Windows XP.

I have 54.2GB of personal data backed up using Mozy Home.  This files are mainly photos and videos of my children growing up and are obviously irreplacable.  Imagine my shock when

  1. After reinstallation MozyHome showed that I have no backup history.
  2. MozyHome had no Restore button - it wasn't disabled, there just wasn't one.
  3. The web restore showed me as having 141GB of data to restore.
  4. When *I* worked out what caused #3 the support engineer said "I guess".
  5. The web restore then said I only had 16GB of data, then it said I had 42.8GB of data.
  6. MozyHome showed 0.6GB too little in my backup history, the file that was missing was nothing important - just an ultrasound scan of our unborn child - but it's okay, restarting my computer brought it back.
When the engineers I talk to say things like "I guess", and "Ooops" it doesn't fill me with a sense of security that my data is safe.  Needless to say I shall be finding a new provider.  iDrive looks quite interesting, I wonder if that is any good?

For anyone who is interested, here is a log of my support chat.  At first I had a guy named "Vinod" who thought it was okay to guess answers rather than checking them, so I didn't want to talk to him again....

Please wait for a site operator to respond.
You are now chatting with 'Chandra '
Peter Morris: **DO NOT** TRANSFER ME TO VINOD!!!
Chandra : Welcome to Mozy Live Support. May I have your account email address please?
Peter Morris: Please reassure me you wont transfer me
Peter Morris: I do not want to talk to Vinod
Peter Morris: (My email address)
Chandra : Peter, how may I assist you today?
Peter Morris: I have just re-installed Windows and want to restore
Peter Morris: The "Restore" context menu is not on "My computer" in Explorer after installing MozyHome
Peter Morris: And the "History" tab in MozyHome shows no history
Chandra : Which version of Windows did you install ?
Peter Morris: I was on vista, now I am on XP
Chandra : ok
Chandra : I understand that you wish to restore you data. Is that correct?
Peter Morris: Last time this happened to me someone had to associate my backups from my previous machine to my new machine
Peter Morris: Yes I do
Peter Morris: It's 54GB
Peter Morris: Which is larger than recommended for web-restore
Chandra : Please wait till I check your records.
Peter Morris: and I am concerned by my History tab having no history
Peter Morris: thanks
Chandra : Peter, I have checked your account and have found out that you have opted for a web restore that is now building. You will receive a email once the restore is built. Is there any concern you are having currently?
Peter Morris: The website says to use web restore for up to 20GB
Peter Morris: Mine is 54GB
Chandra : yes
Peter Morris: So I think it would be more efficient to restore through the mozyhome application
Chandra : How much data did you select?
Chandra : no.
Peter Morris: *and* I am concerned that it is not showing my backup history
Peter Morris: I selected all 54GB
Chandra : You have to choose DVD restore above 20 GB

NOTE: DVD restore would cost me £60, and is only available to USA addresses.

Peter Morris: I have to pay to get my data back?
Peter Morris: I didn't have to before
Chandra : If you have to select few files then client restore is efficient else web restore below 20 gb and DVD restore above 20 GB
Peter Morris: Last time this happened I spoke to someone on here and they linked my new installation with my old history
Peter Morris: then I did a restore through the Windows application
Chandra : Perer, You have to associate you computer with your old data
Chandra : I will assist you in doing so
Peter Morris: When given the option
Peter Morris: "Add new computer"
Peter Morris: "Replace PMORRIS-PC" (old computer)
Peter Morris: Vinod told me to choose replace
Peter Morris: is that incorrect?
Chandra : no, that is correct if you replace with your old machine, you will be associated with your old data
Chandra : If you add, then another comp will be added to your account 
Peter Morris: Good. So please do associate my backup history with my new installation
Peter Morris: So I can restore through Windows, and keep my history too
Chandra : Did you perform a backup after associating your computer/
Peter Morris: no
Peter Morris: My last was yesterday morning
Chandra : one moment please...
Peter Morris: and I have installed MozyHome today
Chandra : Please wait a moment....
Chandra : Peter, I am sorry to inform you that your old backup history will not be available to see since you have migrated your operating system from Vista to XP.
Peter Morris: I only need APPS and DATA
Peter Morris: the rest is irrelevant
Chandra : You have associated your computer but since there 
Peter Morris: but since there?
Chandra : I am unable to trace your requirement since I am unable to understand your requirement of History of backups.
Peter Morris: The windows application
Peter Morris: 1: Double click in the tray to bring it up
Chandra : ok
Peter Morris: 2: Click the "History" button
Chandra : ok
Peter Morris: Expected: All backup history for my account so that I can restore
Peter Morris: Actual: It is empty
Chandra : ok
Chandra : For restoring your data You have to go into Restore tab. History tab is just for your backup reference
Peter Morris: There is no Restore tab
Peter Morris: I suspect because Mozy thinks there is no history
Peter Morris: My history is missing
Chandra : oops....

NOTE: "Oops" is not a word I like to see when discussing how to restore my lost files!

Chandra : Peter, I suspect your installation is corrupt since it is not possible that you don't have a restore tab. Please cross check once again and if not available we have to perform a repair install of the client.
Peter Morris: This has happened before
Peter Morris: It is because there is no backup history associated with my account
Chandra : That's quite strange
Peter Morris: that is what it was last time at least
Peter Morris: you want me to uninstall the software?
Chandra : no
Peter Morris: Ealier you said "Perer, You have to associate you computer with your old data"
Peter Morris: That is what I need you to do
Chandra : Login to your account and download the latest client. Install over the existing and when it asks for repair install click OK
Peter Morris: just Apps and Data will do
Chandra : Peter, I think you have already associated you computer, I can find one comp by the name IMAC. is that the new comp?
Peter Morris: yes it is
Peter Morris: PMORRIS-PC was the name I used previously
Peter Morris: IMAC is this installation
Chandra : That means you have associated your comp.
Peter Morris: but there is no history
Peter Morris: I have done a repair, still no Restore button
Chandra : History is not at all a basic requirement, all you need is to backup and to restore your data
Peter Morris: History is important if like me you sometimes need an old file which was not present in your last backup
Peter Morris: but anyway, at this point I would be happy with a restore 
Chandra : Peter, just try running a backup.
Peter Morris: starting now
Chandra : good
Peter Morris: with a new folder called "DeleteMe"
Chandra : ok
Peter Morris: (Communicating with Mozy servers)
Chandra : It will take some time.
Chandra : Please wait and check what happens.
Peter Morris: Still waiting, I will tell you when it changes
Chandra : ok. please wait and see for some more time. If it is not connecting, then I would suggest you to send me the log file that is located in the following location:  C:\Program Files\MozyHome\Data\mozy.log

Approximately 10-15 minutes later.

Peter Morris: 10May2009 20:05:11 mozybackup.exe: Setting encryption type on servers... 10May2009 20:05:49 mozybackup.exe: Retrieving manifest from servers...
Chandra : ok
Peter Morris: It's a large backup set, so might take a while
Chandra : ok
Peter Morris: oh no, the original backup set was large
Peter Morris: this is 1 folder and 1 file
Peter Morris: should have finished
Peter Morris: shall I cancel then retry?
Chandra : sure.. go ahead
Peter Morris: okay, says "Communicating with MozyHome servers"
Chandra : ok
Peter Morris: 10May2009 20:13:22 mozybackup.exe: Retrieving manifest from servers...
Chandra : ok
Chandra : I would suggest you to wait and check if the backup happens. If not, send me the log file that is located in the following location: C:\Program Files\MozyHome\Data\mozy.log
Chandra : Apart from that, I would request you to send me the screenshot of your backup console that is without a restore tab. It's quite wierd...
Peter Morris: where shall I send them to?
Chandra : We will create a case ticket and send it across to you. Please reply to the mail with the attachments. We will precisely look into the issue and will resolve the same at the earliest.
Peter Morris: email (a temporary email address)
Peter Morris: that's easier for me at the moment
Chandra : Peter, we cannot use the email address other than your Mozy account email address.
Peter Morris: okay, use that one then
Chandra : Thanks. 
Peter Morris: How long should this web-restore take?
Peter Morris: It hasn't finished generating yet
Chandra : It will take some time since you have almost 54 GB to download.
Chandra : You will receive a mail once the building of your restore is complete.
Chandra : The restore will have a number of parts that you will have to download one after the other.
Peter Morris: I am clicking Refresh in my browser
Peter Morris: requested 1 hour and 15 minutes ago
Peter Morris: Status = In_Progress
Chandra : Well, that will only refresh your browser.
Chandra : You will have to be patient since you have almost 54 GB to download that might have taken weeks to upload.
Peter Morris: I am not downloading it yet
Peter Morris: it is "preparing" it for me so I can download it when it has finished
Peter Morris: It has taken 75 minutes and there isn't anything for me to download yet
Peter Morris: I know it will take days to download
Chandra : Mozy is preparing your download and will subsequently make a number of parts that you can download easily.
Peter Morris: but 75 minutes to prepare the files for me to download?
Chandra : Peter... It does take that much time.

NOTE: With hind-sight, yes, it is probably zipping up my files or something so 54GB should take a long time. 

Peter Morris: Still no email from you, has it been sent?
Chandra : Email is being drafted. You will be receiving it soon.
Chandra : By the way, what  time is it now there?
Peter Morris: 20:36
Chandra : ok
Chandra : AM ?

Okay, NOW I am getting worried!

Peter Morris: 20 = 8pm
Chandra : Sorry about that. am not quite good in timings.
Chandra : Peter, mail has been sent. Please check and reply with the attachments.
Peter Morris: Why is the email from Vinod and not you?
Chandra : Peter, That won't make any difference, I will put my transcripts and will work accordingly.
Chandra : Peter, are you with me ?
Peter Morris: yes
Peter Morris: just sent your email
Chandra : thanks, let me check your mail.
Chandra : Peter, did you use the same subject line while replying?
Peter Morris: yes
Peter Morris: I just clicked reply, attached files....send
Chandra : ok, I haven't received yet. need to check...
Peter Morris: got it?
Chandra : It has not yet come. Please check if you have received any undeliverable message..
Peter Morris: no bounce
Peter Morris: would you like me to put the files on the web?
Chandra : If you don't mind let's wait for some more time.
Peter Morris: (Pasted 2 urls)
Chandra : I have checked the log and there seems to be a database issue along with the manifest. 
Chandra : Go to C:\Program Files\MozyHome\Data using Windows Explorer.
Chandra : 2. Remove / delete the file named "cache.dat" and restart the computer.
Chandra : 3. Now try to perform a manual backup.
Peter Morris: If I reconnec to support will I get you or someone else?
Peter Morris: I don't want Vinod back
Chandra : You can connect back to me.

Computer is rebooted.

Please wait for a site operator to respond.
You are now chatting with 'Chandra '
Peter Morris: hi
Chandra : Hi Peter.
Chandra : What is the status now ?
Peter Morris: Now I see a restore button
Peter Morris: but I am VERY concerned
Chandra : Great !!
Peter Morris: I have logged into the web
Peter Morris: and it now says I am using 16GB
Chandra : ok
Peter Morris: and not 54GB
Chandra : ok wait a moment..
Chandra : I am looking into your account...
Chandra : Peter, I would suggest you to perform a web restore and while doing so you will find an option to select the date of restore. Please browse through the dates and you should find your data. 
Peter Morris: when I log in
Peter Morris: to the website
Chandra : Yes
Peter Morris: before I did this 1 file backup it said "In use, 54GB"
Peter Morris: then I did this 1 file backup
Peter Morris: and now it says "In use, 16GB"
Peter Morris: that's 38GB of data missing!
Chandra : ok just login and click on web restore and browse through the dates.
Peter Morris: I have already done so, I am just waiting for it
Chandra : ok
Peter Morris: 53.82GB that says
Chandra : ok
Peter Morris: So I have 16GB on the main site, 53.82GB on the restore page, and neither are right
Peter Morris: it sould be 54.2GB if I recall
Peter Morris: or 52.4
Chandra : Anyway, we will look into it later, I would suggest you to start restoring your data. I may have to escalate the data mismatch happening.
Peter Morris: ok
Peter Morris: thanks
Chandra : Is there anything else I can assist you with?
Peter Morris: I don't think so no
Chandra : Thank you for choosing Mozy, Have a nice day !
Peter Morris: yes
Peter Morris: there is
Peter Morris: I can see a missing file
Chandra : ok
Peter Morris: 2009-01-15 Baby Scan 2.wmv
Peter Morris: Slightly important, just a video scan of my baby
Peter Morris: I want this escalated immediately
Peter Morris: and I want someone to phone me
Chandra : Peter, my recommendation would be to start restoring your data right away, I will put across this issue and get it resolved.
Peter Morris: There is a problem with that
Peter Morris: if the data is incorrect
Peter Morris: I may end up with old or corrupted data
Peter Morris: and not realise a file was wrong/corrupt until 12 months from now
Chandra : yes.
Peter Morris: and by then it will be too late
Peter Morris: It needs to be fixed BEFORE I can trust the data that is sent to me
Peter Morris: I have wasted enough time on this now
Chandra : I will right away escalate this issue and they will get back to you.
Peter Morris: I want a phone call
Peter Morris: (My telephone number)
Chandra : Peter, MozyHome customers do not have the telephone facility. The escalation team will do whatever possible from their end to resolve your issue.
Peter Morris: tough
Peter Morris: Mozy has messed up
Peter Morris: my baby scan video is missing
Peter Morris: do you realise how important that is to me?
Chandra : I will put across your request and they will take it to a conclusion.
Peter Morris: These are exceptional circumstances, make an exception
Peter Morris: Please talk to them now before I disconnect
Peter Morris: then tell me what they say
Chandra : We don't have direct interaction with them, all we can do is to forward your ticket with all our transcripts and they will come back to you at the earliest.
Peter Morris: There is a number that mozy-pro users can phone right?
Chandra : yes, but MozyHome customers will be re-directed to chat support and will land back to us.
Peter Morris: then you please phone that number, explain who you are, explain that mozy has messed up and lost some of my very important data
Peter Morris: and tell them that to resolve the issue you would like them to treat me as a pro user
Peter Morris: to fix the error that has taken place
Peter Morris: When a company does something wrong, it should do its best to put it right
Peter Morris: I am not after pro support because I do not understand something. I understand how to use your application fully
Peter Morris: Your company has lost some vital data
Peter Morris: which was there only minutes ago
Peter Morris: so now it needs to take exceptional steps to rectify this mistake
Chandra : I would suggest you to wait until the escalation team responds back to you. I have put your issue on high priority and they will get your issue fixed without any concerns.
Peter Morris: and how will they contact me?
Peter Morris: by phone?
Peter Morris: and how long will I wait?
Chandra : No, by mail and it will be done soon
Peter Morris: So I have to sit here refreshing my email until I get a reply
Peter Morris: How long is "soon"?
Chandra : Peter, you have to allow me to escalate the issue. They are our next level of support. They will get back to you at the earliest on priority basis. You can rely on these statements.
Peter Morris: please escalate it
Peter Morris: I am on the phone to mozy-pro support now

I explained the story to the guy on the phone, he agreed to give me telephone support (first positive action of the night).  We restarted my machine, tried doing a restore again and the missing file was there!

This whole episode took over 4 hours, that's 4 hours JUST TO START doing my restore.  Shocking!  I have no confidence in Mozy at all after this, they write software which hides user interface elements instead of disabling them, the app wont show you restore history unless you do a backup first (which is pointless after a fresh installation as there is nothing to restore), and then they let staff lose on their support system who obviously do not understand the product fully.


Locking in ECO 5

Jonas has just added the following feature to ECO 5 which should turn up in the next build.

Let's say you have a package with a single class LockObject in it. This LockObject must have TimeStamp locking, but you use this package in many applications.  In ECO 5 you can set the default locking mode for a package.

Now let's say you have multiple packages that you use in many applications and the locking type is different per app.  App 1 uses AllMembers locking, App 2 uses no locking at all; how can you specify the locking type?  Now you can add a .NET attribute to the top of your application specific EcoSpace class....

[UmlTaggedValue("Eco.OptimisticLocking", "AllMembers")]
public class Application1EcoSpace : DefaultEcoSpace

Locking is determined like so:
  1. The kind specified on the class itself.
  2. The kind specified on any super class.
  3. The kind specified on the package.
  4. The kind specified on the EcoSpace.
Someone I know recently got stung by this, so I thought I’d mention it...

static void Main(string[] args)
  int a = 1;
  int b = a;
  Console.WriteLine(AreSame(a, b).ToString());

static bool AreSame(object a, object b)
  return a == b;

What’s the output to the console? Does a equal b? Even if you didn’t know the answer you will have guessed it is False otherwise this blog would be totally pointless!

It’s false because the parameter types of AreSame are both "object". For a value type such as "int" to be passed as an object it needs to be boxed, so a new object instance is created which stores the value "1", but this is done for both parameters so we end up with 2 new instances both holding the value 1.

1 equals 1 for value types but the default comparison for System.Object is to compare references. If they are not the exact same object (and in this case they are not) then the result is false. Now if we typecast both a and b back to integers this would pass, but the fact that we are using System.Object parameters suggests we don’t know the true type. Instead we need to use Object.Equals, because no matter what the original type is it should have a correct implementation of Equals().

static bool AreSame(object a, object b)
  if (a == null && b == null)
    return true;
  if (a == null || b == null)
    return false;
  return a.Equals(b);

So the moral of the story is this. If ever you are passed "object" references make sure you check for equality using Equals!


I don't like AccuRev

A company I have been contracting for decided to use AccuRev as its source control solution. I've not liked it from the start because it is too much work, the terminology in it is quite frankly stupid, and it is far too "chatty" when you work remotely.  Anyway, for some time now I have suspected it has been losing source code. On a few occasions I have found myself looking at source code and thinking "I could swear I have already done this!".

Well, last week I wrote some pretty nice code which used multiple threads in a test case to ensure I experienced expected behavior when multiple users update the same objects in a database.  Today one of the other programmers said to me "Didn't you write more tests than this?" and showed me the tests.  My multi-threaded tests were gone!

I knew it all along, but now it is indesputible, AccuRev has been losing my work!


The Pragmatic Programmer

My copy of this book has just turned up. I am book hungry these days, can't wait to read it :-)



I’ve just finished reading What every programmer should know about object oriented design. The first couple of sections are a bit useless really, but the 3rd section is very good.

I particularly liked the section on the difference types of connascence in software. There’s some basic information about it here if you fancy a brief overview of what it is about.

It’s a really good book, I recommend you read it! Should only take a day if you only read the 3rd section.

I've just ordered a Java book


It was only $0.41 used in the USA, came to about £6 with posting to the UK. I don't write Java and at the moment have no interest in learning it, but I expect I will be able to read it without problems (never really looked at it).

So why did I buy this book? Because it is about this...


That's why :-)

Prism - Invariants, and pre/post conditions - update

Just found out that I can do this too

public invariants
  Overdraft >= 0 : ’OverdraftGreaterThanOrEqualToZero’;
  Balance + Overdraft >= 0 : ’BalancePlusOverDraftGreaterThanOrEqualToZero’;

Then in my handler routine I get that message!

if not IsValid then
  throw new Exception(ErrorMessage);

Excellent :-)

Prism - Invariants, and pre/post conditions

I’ve been looking at Prism some more recently. I’m a bit annoyed with myself really because someone has been telling me to look at it for years but I wanted to concentrate on C#. Now that I am looking at

it I see things in there which I really like.

Recently I am looking at invariants, pre-conditions, and post-conditions. First let me show you the invariant support. An invariant is like a class constraint, it specifies a condition which must be true

but when must it be true?

  BankAccount = public class
    property Balance : Decimal read write;
  public invariants
    Balance >= 0;

The invariant is enforced each time a public method exits. Actually it is enforced after the post-conditions of a public method exits but we don’t have any post conditions yet.

class method ConsoleApp.Main;
  var account : BankAccount := new BankAccount();

  //The next line throws an assertion error
  account.Balance := -1;

Property getters and setters are considered methods, so as long as you aren’t publically exposing a field (which you should never do) then you are protected. In the following example the setter for Balance is Private but it is set via a public constructor, so the assertion is checked when the public constructor exits.

  BankAccount = public class
    constructor (OpeningBalance : Decimal);
    property Balance : Decimal read private write;
  public invariants
    Balance >= 0;


constructor BankAccount(OpeningBalance : Decimal);
  Balance := OpeningBalance;

class method ConsoleApp.Main;
  var account : BankAccount := new BankAccount(-1);

Obviously we can’t set a balance for an account directly because its setter is private, so let’s add another feature we could use instead. Next I will add a Withdraw method with overdraft facility.

  BankAccount = public class
    constructor (OpeningBalance : Decimal);
    property Balance : Decimal read private write;

    method Withdraw(Amount : Decimal);
    property Overdraft : Decimal read write;
  public invariants
    Balance + Overdraft >= 0;
    Overdraft >= 0;


constructor BankAccount(OpeningBalance : Decimal);
  Balance := OpeningBalance;

method BankAccount.Withdraw(Amount : Decimal);
  Balance := Balance - Amount;

As you can see the invariants of this class are that the Overdraft must be >= 0 and the Balance plus the Overdraft must be >= 0. The following program illustrates use of this.

class method ConsoleApp.Main;
  var account : BankAccount := new BankAccount(10);
  account.Overdraft := 10;

  //Outputs -10
  Console.WriteLine("Balance : " + account.Balance.ToString);

  //The next line throws an assertion error

So that’s an invariant now let’s look at pre-conditions. The Withdraw method would currently accept an Amount of zero which obviously makes no sense, what’s worse though is that it could accept a negative number and actually increment the balance so let’s add a pre-condition to prevent this.

constructor BankAccount(OpeningBalance : Decimal);
  OpeningBalance >= 0;
  Balance := OpeningBalance;

method BankAccount.Withdraw(Amount : Decimal);
  Amount > 0;
  Balance := Balance - Amount;

Now if I try to create the bank account with a negative opening balance, or if I try to withdraw an amount of money that is not greater than zero I will experience an assertion. It’s possible also to add post-conditions by using the "ensure" keyword.

method BankAccount.Withdraw(Amount : Decimal);
  Amount > 0;
  Balance := Balance - Amount;
  Balance = old Balance - Amount;

Note here that I use "old Balance", which is the value that Balance was when the method was called. The combination of pre/post conditions say that "If you pass me a positive amount of money I will decrement the Balance by that exact amount".

I haven’t finished yet! The default behaviour is to use Debug.Assert whenever an invariant is broken, a pre-condition is not met, or a post-condition is not satisfied. It is possible to change this behaviour for a Release build so that your invariants are not only checked during debugging. This is particularly useful when you are persisting and retrieving objects’ state in a database, if another application bypasses your business classes and writes directly to the database your invariants ensure that your application fails immediately rather than working with an invalid state and possibly causing more invalid state elsewhere. To do this create a static class like so

  ClassContractChecker = public static class
    class method Check(IsValid : Boolean; ErrorMessage : String);


class method ClassContractChecker.Check(IsValid : Boolean; ErrorMessage : String);
  if not IsValid then
    raise new Exception(’Unexpected class contract violation ’ + ErrorMessage);

Then in the project’s properties look on the DEBUG tab and enter

  Assertion class name : MyNameSpace.ClassContractChecker
  Assertion method : Check

NOTE: This is a separate setting for each build configuration, so set it to RELEASE

Now instead of using Debug.Assert any time something goes wrong the Prism compiler will execute this static method so that we can throw an exception instead (currently this doesn’t work for RELEASE builds, I have reported it as a bug so hopefully it will be fixed).

This kind of programming allows us to identify errors in our objects’ states early on. Using this approach will cause an app to "fail hard" at the first sign of something unexpected happening. This may sound harsh at first but the app failing immediately and prominently is better than it being wrong for a long period of time and causing weird side effects in your logic which could end up with nonesense data - that would be a much worse situation.