logo

Colemak - the slowest way I could write a blog post (for now!)

I am in the process of learning Colemak, an alternate keyboard layout. There are lots of great reasons to do something that seems so masochistic, but it would take too long to type them here (literally). I’ve gone from ~55 WPM, to about ~15-20, but my goal is ~80 COMFORTABLY by the time I’m done. The top of my right hand especially hurts after prolonged QWERTY use. A couple guys at work use Dvorak, which I tried to learn in 2005.
2 minutes to read

String or binary data would be truncated

This, in my opinion, is the most frustrating error you can get in SQL Server. It’s the error you get when you’re trying to do an "INSERT INTO (…) SELECT (…)" to push a bunch of records from a query result into a table. If one of your (n)varchar fields is too small to hold one of the values, you get this lovely error. It’s nice that SQL Server won’t truncate your fields for you, but frustrating that you get this sad little error with no details.
3 minutes to read

.NET DST Calculator

I have a common .NET library written in C# that I use everywhere. I call it mattmc3.Util, and it contains helper methods (static classes or extension methods) that correspond to Microsoft’s BCL. So, for example, I have a DateTimeHelper with static methods that corresponds to the System.DateTime class. The DateTime class is one of the most anemic in the .NET library, mainly because MS has to deal with international customers, so methods like DateTime GetMemorialDay(int year) are too regional and clutter the BCL, but are essential in the American business world.
3 minutes to read

C# Corner - fun with yield and extension methods

All .NET developers learn about IEnumerable and IEnumerator in their first day of development, whether they realize it or not. Every foreach statement written utilizes the .GetEnumerator() call to iterate over a collection of objects. The “For Each” concept is a really nice piece of syntactic sugar. However, one of its limitations is that it doesn’t give you a counter to track which loop iteration you’re on. If you want to do that, you have to keep track of it yourself in your own variable.
4 minutes to read

XHTML layout converter for ceTe’s Dynamic PDF library

At work, we are using ceTe’s PDF libraries for .NET . They have a pretty easy to use, versatile set of tools for building PDFs. However, after building a few of them, it became painfully obvious that assembling all but the most anemic PDF layouts was painful. The Tweak-Compile-Generate-View-Repeat method takes quite some time. Too much time. The Tweak-Refresh-Repeat model for HTML+CSS seemed to me to be a much better method of building a layout, but the Dynamic PDF API doesn’t support anything like that.
5 minutes to read

Source Control Managment

I spent most of my day at work today setting up a new development server. SQL Server 2008, IIS, msbuild server and finally, Subversion. Our dev box died a few months ago and we had cobbled together some things on a bunch of different existing boxes and basically hobbled along. So today I got a chance to consolidate everything onto a nice new box. And originally I wasn’t planning on moving our source control onto it.
2 minutes to read

Robocopy

Apparently I’ve been asleep at the command-line wheel. I was told today about a tool that Vista includes free, and I cannot figure out how I lived without it: robocopy . I’ve been using SyncToy with mixed results. No more. See this great article for some robust copying goodness. PS: yes, I do know about Cygwin + rsync.
One minute to read

Bad cache

We had some code break down today. Here’s the story. One of the great tricks in the object oriented world is late bound variables. When it’s expensive to initialize a variable, or you’re not sure you’re going to always use it, you don’t initialize it until first use. Public Readonly Property Something() As SomeObject Get If _someObject Is Nothing Then _someObject = DoExpensiveInitialization() End If Return _someObject End Get End Property Private _someObject As SomeObject Another great trick is caching data.
3 minutes to read

jQuery to the rescue!

I had a thought today as I was posting - I like to link out from my blog, but it’s really inconvenient for my readers to click on those links and have it open that link over top of the post they’re reading. And I don’t want to have to go back to my previous posts to update the links manually. Blogger should just handle it for me. A quick Google search brought me to these posts , but that isn’t quite what I wanted.
2 minutes to read

Preconditions

Google’s been doing some interesting things lately. Some attract lots of attention, some very little. One that you may not have heard of is Google Collections . It’s just a series of Java helper classes. At first it may seem like a non-event, and mostly for us .NET folks that’s true. But I read this post about a year ago, and my interest was piqued by their Preconditions class. It’s nothing significant - it just throws various argument exceptions if you don’t pass “true” to its methods.
2 minutes to read