Tuesday, October 27, 2009

DVDBurn.exe in Server 2003

I've just been battling for the last 30 minutes to try and burn an ISO as an image to a DVD. I have a version of Nero Burn and tried to line up the planets with this bit of not-so-great software and ended up creating a data DVD with the ISO as the single file on this DVD. I took a second attempt with Nero but just couldn't find the option to create it as an image.

Did I mention that I was burning this DVD image from Windows Server 2003?

I stumbled across this little gem of a utility that I must have installed on this server with the Resource Kit Tools. It's called dvdburn.exe and has a younger brother called cdburn.exe.

DVDBurn.exe takes 3 parameters:

dvdburn <drive> <image> [/Erase]

Worked like a charm:

C:\Software>dvdburn d: en_windows_7_ultimate_x64_dvd.iso
Media type: DVD-R
Preparing media...
Error setting timestamp; this error will be ignored, some drives can work without this
- 100.0% done
Finished Writing
Waiting for drive to finalize disc (this may take up to 30 minutes).............

Success: Finalizing media took 10 seconds
Burn successful!

Saturday, October 24, 2009

10GUI

The genius behind NinjaCamp recently sent me a link to 10/GUI. I try and follow the zero Inbox policy but for him I made an exception and allowed this email to languish in my Inbox so that I could take a relaxed 10 minutes out of the weekend to watch what he was so abuzz about. I have to agree with him, this is an amazing concept and I want one now.

From what I can work out this is as simple as a touch pad with up to 10 points that are recognized by it. Instead of the mouse you have a surface lying in front of the keyboard that will understand all your fingers including the motions now recognized by hand held devices such as the Android and iPhone.

The only thing missing, and I think this is just a matter of time, is for a keyboard to appear on there. If there were keys that could quickly inflate themselves on this device when you needed a keyboard and then disappear when you wanted the touch pad that would be the ultimate human interface.

Friday, October 23, 2009

C# Math.Round Banker's or Mathematical Method

I wasn't even aware that there was a banker's method to rounding numbers until I came across what I though was a bug in the Math.Round() function in the .NET library today.

If you call this function:

double x = Math.Round(.005, 2);

then you will discover that x is set to zero. If you call this:

double x = Math.Round(.0051, 2);

then x will be set to 0.01.

I was always taught that you round up from 5. This is still correct and is known as the mathematical method of rounding. However I have recently learned that there's another method and if the least-significant-digit is 5 and you're using the banker's method then you round down instead of up. This is the method that Math.Round() uses by default.

If you want to use the expected mathematical method for the round function then you need to add another parameter to the overloaded Round() function which specifies how you want it to handle midpoint rounding. AwayFromZero will do the trick:

double x = Math.Round(.005, 2, MidpointRounding.AwayFromZero);

This will cause x to be set to .001 as you would expect. The other value defined in the MidpointRounding enum is ToEven and this will do the default of round the midpoint down to zero.

Mystery solved!

1 Sep 2010, just discovered this:

Banker's Rounding

When you add rounded values together, always rounding .5 in the same direction results in a bias that grows with the more numbers you add together. One way to minimize the bias is with banker's rounding.

Banker's rounding rounds .5 up sometimes and down sometimes. The convention is to round to the nearest even number, so that both 1.5 and 2.5 round to 2, and 3.5 and 4.5 both round to 4. Banker's rounding is symmetric.

Predictably Irrational

I've just finished reading Predictably Irrational by Dan Ariely. This is a great book that applies to everyone and should be required reading before you leave school. Everyone is guilty of being irrational in their decisions and some of us continue to do it everyday even though we know that it's stupid and, yes, irrational.

One of the stories that I loved was the pen and the suit comparison. If you were buying a pen and saw it on sale for $30 and knew that you could buy it across town for $23 then you'd likely jump in your car, make the drive, and save yourself that $7. However, if you were buying a suit for $400 and the same applied you're highly unlikely to make the same trip to buy the suit for $393. Why would you do that.

One of my favorite experiments that they did was that with Lindt Truffles and Hershey's Kisses. They priced the Truffles and Kisses at 15 and 1 cents respectfully and found that 73% of customers chose the Truffles. They were willing to pay that extra 14 cents to get a superior product. However, when the dropped the price by 1 cent and made the Kisses free then suddenly everything reversed and 69% of customers took the free Kiss over the Truffle even though the price differential of 14 cents was still there.

Wednesday, October 21, 2009

SpamBayes performance on Outlook 2007

I installed SpamBayes for Outlook 2007 eight days ago and have been using it since then. I can understand the reluctance of users to installing this software because it's not trivial to understand how it works or exactly why it would be better than the spam software built into Outlook.
Before I installed SpamBayes, Outlook was catching about half of the spam emails that I received and putting about 5 or 6 legitimate emails into the Junk Mail folder. After SpamBayes took over it got a few wrong and put a number of emails into the Junk Suspects but once it had finished training in about 3 or 4 days it was getting almost everything right. Since then it's had about an average of 1 a day wrong or unknown and the gap between those is getting longer.
If you're an Outlook user and you haven't installed SpamBayes yet then I highly recommend that you do so. It's free and available here from SourceForge and it will repay your time-investment within the first week.
The key difference between SpamBayes and Outlook's default spam filter is that SpamBayes learns what spam means to you without you having to classify subject types and/or from emails as blacklisted. You don't have to setup rules. For example, I get a lot of spam email that purports to be from myself. I also send myself legit emails about things I want in my email. Spammers know this and that's why they spoof my email address because they know that I won't block my own email address. SpamBayes learns that it should place zero significance on who the email's from and instead focuses on other markers in the email to learn from you what spam and ham (good email) mean to you.
If, for example, you work in the porn (or anti-porn) industry then emails with the word "porn" may be legitimate emails that you want to and need to read. They may be from co-workers of yours. However, there may also be plenty of spam about porn that you don't want to read. SpamBayes takes care of that for you because it learns that distinguishing spam from ham based (in part) on the word porn for your email is useless and will therefore automatically ignore this word and focus on other words (and markers) in your email to make this distinction. In my personal email however it would probably classify the word "porn" as a red flag that the email is spam.

Ditto Clipboard Manager

For about the last year I've been using ClipX which is a clipboard manager. This worked well-ish with a few minor annoyances but seems to have been languishing in a vacuum of non-development and stagnation. Recently a friend put me on to the Ditto Clipboard Manager which I've installed on to a number of machines that I use and I absolutely love it and recommend that you install it immediately.
I've tested Ditto on Windows XP (32 bit), Server 2003 (32 bit) and Server 2008 (64 bit) and it works perfectly on all those machines. Today I was chastised by Ninja Camp for not blogging about this utility and spreading the wealth of knowledge so here is that post. Ninja Man tried to install it on Vista earlier today and he reported initial problems and I haven't heard back from him on this so not sure if he got it working or not. Hopefully he'll comment here on his progress.

One of the other utilities that I had running on one of my computers was Pure Text. This little applet allowed you to strip formatting from text when you paste it. You know when you copy something from a word document or a web page and you want to paste it without that bold and color? Well Pure Text does this for you. However, and this is a big however, you no longer need this utility if you're using Ditto. One of the features of Ditto is to paste any of your clippings as "Paste Plain Text Only" which is a real Godsend.
The default keyboard combination to launch Ditto is Ctrl + ` which I suggest you don't change even if you find it uncomfortable at first. I promise that this will grow on you very quickly.

Tuesday, October 13, 2009

Enabling SpamBayes on Outlook 2007 on Server 2008 x64

After installing SpamBayes Addin for Outlook 2007 on my Server 2008 x64 "workstation" I started receiving the following message when starting up Outlook 2007: "Outlook experienced a serious problem with the 'spambayes' add-in."
The fix was to disable DEP for that application. To do this on Server 2008:
  • Start > Computer > right click > Properties (System Control Panel)
  • Click Advanced System Settings
  • Under Performance click Settings...
  • Click on the Data Execution Prevention tab (have you worked out what DEP stands for yet?)
  • Click Add... and then navigate to the application that was causing problems and add it.
If you've already disabled the Addin on Outlook 2007 you're going to want to re-enable it:
  • In Outlook 2007 select menu Tools > Trust Center
  • On left panel click Add-ins
  • Under Disabled Application Add-ins select the Add-in that you disabled.
  • From the Manage drop down select Disabled Items and click Go...
  • Select the disabled item and click Enable.