Archive for the ‘Uncategorized’ Category

Binding WPF to Dynamic Objects in the ViewModel tier

http://msdn.microsoft.com/en-us/library/bb613588%28VS.100%29.aspx#binding

WPF supports data binding to objects that implement IDynamicMetaObjectProvider.
For example, if you create a dynamic object that inherits from DynamicObject in code,
you can use markup extension to bind to the object in XAML.

This is very cool, and should dramatically simplify the creation of the ViewModel tier!  I’ll blog about this more later

Microsoft Linux: Why one free software advocate wants it – phoey

This is a response to:  http://www.networkworld.com/community/node/46840

There is an enormous difference between a lawyer and a software developer: lawyers charge hourly rates for thier expertise as applied to a specific individual while a software developer charges per product license.

Each legal case is unique, and each individual that requires a lawyer has unique needs and will pay a lawyer _hourly_ to help them in court, prepare those documents, etc.  I cannot imagine standing in front of a judge and saying, “Well, I didn’t want to pay for a lawyer so I’m just going to reuse these free documents that somebody else paid for your honour;  not being a lawyer myself I hope they’re relevant.  I will now rest my case”.  Lawyers do not charge you to produce documents, they charge you for their time and expertise.  The documents are a byproduct of that.

Convsely, a software developer can write a single piece of software (like an OS, spreadsheet, etc) that can potentially be used by millions of people.  It can easily take 1000s of hours to develop a single non-trivial piece of software.  For example, I’ve been working (more than) full time on my own software for over a year and its only 3/4 done.  However thousands of different people will be able to use it, and I certainly won’t be charging them all per hour.  Developers do not charge you for thier time, they charge you for their finished product.  Our expertise allows us to create that product.

So while a lawyer might spend 100s of hours for a single client (charging by the hour), a developer can spend 1000s of hours for hundreds , thousands or millions of clients.   Thus, the correct analogy between a lawyer and a software develoer would be if a lawyer got paid once for the first case and then volunteered for the 1000s of people that had an even remotely similar case.

6 days of recovery – day 6: Recovering security permissions after restoring data on a new hard drive

Okay, I’ve now got the Windows system drive (C:) back up and running and using my trusty backup I have restored all my data onto the new data drive (A Seagate 1TB 7200RPM 32MB cache – nice and fast).  However, I now had a security problem:  all my old file permissions were now incorrect, and in the directory and file properties windows on the security tab I was getting “Account Unknown”:

Windows Vista Security file properties: Account Unknown

The problem was that although my user name was the same in the new Windows install, the unique Security ID (SID) used by my old Windows install was different from the unique Security ID created by the new Windows install.  This makes sense because the ID is a unique identifier (and is probably created based on the current time in milliseconds and lots of other things).

BTW, It’s possible to copy-and-paste that long numeric SID rather than trying to type it out.  From the file security property dialog box above click on the “Advanced” button, and then double-click on the “Account Unknown” in the “Permission entries” pane.  Then, you can copy the long numeric SID from the “Name” text box.

How to copy the numeric SID for an Account Unknown

My first approach was just to remove all the “Account Unknown” entries completely with the iacls command but I got a VERY frustrating message:

D:\>icacls * /remove *S-1-5-21-671368754-1592612355-3076361259-1000 /T
Successfully processed 0 files; Failed processing 0 files

I tried about 50 different variations and got absolutely nowhere, which turned out to be very fortunate because I discovered that it’s possible to simply REPLACE the OLD broken SID with the working new one!  Phew.  A little Microsoft tool called subinacl.exe did the trick very nicely.  It requires installation (?!) and doesn’t put itself onto the path (which is good I guess) and after reading the help and trying a few different things I got it to work like this:

"c:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe" /subdirectories d:\
     /replace=S-1-5-21-671368754-1592612355-3076361259-1000=robert

So it took a little while to solve the problem but it worked!  It’s also the ONLY Microsoft Vista command line tool I’ve ever seen that actually had a “fancy” little GUI:

Subinacl at work

The red is a little scary (because I assumed something bad had happened), but it was fine and my new HDD with all my data had all the security backed up correctly, and I didn’t have to muck around trying to remember and manually reset folder permissions.  Very elegant, although it took me about an hour to figure this out!

Robert

6 days of recovery – days 1-5: Western Digital Caviar Green 1TB SATA (WD10EADS) Sucks (or I got a lemmon)

Well, it’s now Wednesday, a full 6 days after I bought a new hard drive after I decided to reformat my C:  (see  https://robertmccarter.wordpress.com/2009/10/22/ms-sql-server-2005-sp3-cumulative-hotfix-kb970892-painfull/ for all the gory details).

At first I bought a new WD Caviar Green 1TB SATA (WD10EADS).  I have NEVER had a brand new hard drive be such a lemon of a hard drive!  It was slow, but it was “green” so at first I thought that was okay.  Then I was using Image for Windows (which is a great product, I really like it) to restore my data drive and it took 24 hours to restore 200GB!!  It only took me 2.5 hours to create the image, so I started to worry.  So I let it run overnight.

But the next day when I tried to use it or defragment it things started going really, really wrong, and by wrong I mean SLOW.

So I started running speed tests on it, and sometimes the speed tests were abysmal and sometimes they were fine.  But then in Linux (I used the excellent SystemRescueCd) the speed tests were fine, so I kept trying to figure out the problem.  Then rebooting the computer started taking longer as the BIOS tried to find the drive the boot would pause for about 10 seconds.  At that point even the Linux speed tests started coming back slow, and so I knew the drive was bad.  Of course, because everything was highly intermittent and I was moving lots of data around and it was VERY slow (when it was slow) this entire discovery process took ages.

To make a long story short, I eventually decided the drive was a piece of crap, and that I would take it back.  Unfortunately, I first wanted to clean all my data off it, which is hard considering how slow the drive was.  I found this very helpful link:  http://linuxhelp.blogspot.com/2006/06/how-to-securely-erase-hard-disk-before.html.  This worked very slowly for the first 60GB, then it was VERY fast for the next 200 GB, and after that the drive gave out and never worked again.

I’ve never had a problem with a new Western Digital drive before (although I’ve had problems with older ones) so I was just unlucky and got a lemon.  So I took it back and got a brand new Seagate 1TB 7200RPM 32MB cache drive and life is good.  I restored all 200GB of my data in exactly 2:20 – nice and easy!  What a waste of 5 days.

Sigh.  As a small business owner I don’t have time to waste like this; I wish I could bill WD for lost productivity!

Robert