Designers should love this windows download. Instead submitting your design into a web site that generates images for you in different web browsers, you now have a windows app that allows you do this and interact with the site on your desktop.
I listen to a mix of science and technology podcasts with a few entertaining shows mixed in for some variety. Here’s my list:
.NET
- .Net Rocks!
.NET Rocks! is a weekly talk show for anyone interested in programming on the Microsoft .NET platform. The shows range from introductory information to hardcore geekiness.
- dnrTV
dnrTv is a fusion of a training video and an interview show. Training videos are typically sterile and one-way. Let’s face it, you can only take so much. But you need to see the code! In this format, you get the spontaneity of an interview talk show, and the detail of a webcast or training video.
I picked up a post on Lifehacker about Windows Live Writer Tweaks, Tips, and Updates and decided to give it a spin. In fact I’m writing this blog post with the latest CTP (12.0.1366.1026).
For my past posts I have been trying out ecto and MarsEdit on OSX since I’ usually blog when I’m at home and predominantly use OSX for my everyday needs. I only pop into windows at work (through VMWare Fusion) to do .NET development in Visual Studio 2008.
I’ve recently joined the dark side and implement a black theme on my Visual Studio IDE.
It makes the code nice and easy to read because of the contrast.
I noticed something in the code of the project I was currently working on. It manifested itself in a crash with exception type FormatException. The problem was caused by the developer using code like this:
double percentComplete = Convert.ToDouble(tbProgress.Text);
or
double percentComplete = double.Parse(tbProgress.Text);
The problem with this is that there are potential exceptions lurking if the string value is null or malformed (which was the case)
Instead of just coding like the above the developer should have at least tried to catch the exception like so and handle it (in this case it was best to give back a default value of 0):
double percentComplete; try { percentComplete = double.Parse(tbProgress.Text); } catch (FormatException) { // Handle the error or return a default value percentComplete = 0; }
To be an good developer you should use TryParse instead
double percentComplete = 0; if (!double.TryParse(tbProgress.Text, out percentComplete)) { // Handle the error }
In the situation above, I didn’t need to handle the error as I wanted to return a default value of 0 if it couldn’t parse it. So the following would have sufficed:
double percentComplete = 0; double.TryParse(tbProgress.Text, out percentComplete);
Why is TryParse better?
Remember, exceptions are expensive to deal with. So avoid it if you can.