Posts

Showing posts from 2008

Data binding to strongly typed objects

A common source of error in ASP.NET development is mistyped data binding expressions. The reason for this, is that the expressions are not verified during compile time (together with the rest of our code), but first in runtime, when they are vastly more expensive to fix, time-wise. Just to bring everyone up to speed, I am talking about these: <asp:Repeater runat="server" id="attachments"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr> <td width="220" > <%#Eval("FileName")%> ( <%#Eval("MimeType")%> )</td> <td><asp:LinkButton runat="server" CommandName="delete" .../></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeatera> Now, if I were to misspell either of the public property names of my data bound object (an ins

String.GetHashCode

Swedish Social Security Numbers (personnummer): Successfully inserted 8395 rows into a unique column in my test database before stumbling upon a unique constraint violation. String.GetHashCode is not unique enough for this approach. System.Security.Cryptography.MD5CryptoServiceProvider worked better, as did the SHA512Crypto - 2 million hash values with no collisions. var generator = new System.Security.Cryptography.MD5CryptoServiceProvider(); ... var input = System.Text.Encoding.UTF8.GetBytes(reader.GetString(0)); var output = Convert.ToBase64String(generator.ComputeHash(input));

The Microsoft Team Foundation Server 2005 Power Tools

This is the second time the TFPT (Team Foundation server Power Tool), saves my behind. This makes me want to tell about it to the world. TFPT is your friend. Get to know it! Why TFPT? I've used the TFPT to rollback changsets - product fixes that were SURE to be released but that, somehow, close to the production date, where decided against. With multiple checkins after your product fix, this can be a real issue, since you cannot "rollback" to before your fix, because you'd remove the other fixes. TFPT to the rescue! With the TFPT, you can do the needed three-way merge to resolve your issue. For more information about the TFPT, check out this resource, or use your other good friend, Google.

My favourite tools

I have found the following tools being real productivity enhancers: XDesk (Virtual Desktop Manager (that WORKS!)) ClipX (Clipboard Manager) AutoHotkey (Windows Automation Tool) Launchy (Keystroke Launcher) NotePad++ (Lightweight Programmer's Text Editor) Evernote (Multi-platform notebook) Resharper (Visual Studio Add-In) For example, with AutoHotkey, I have made the following script: ^F1::Send {Control Down}{End}{Shift Down}i{Shift Up}{Control Up}Sub Page_Load({Esc} The script makes it so CTRL+F1 automatically finds the PAGE_LOAD-function in a Visual Basic 8 ASP.NET code-behind page. Very practical. I seldom have a use for ClipX, but since has a virtually non-existent footprint, i have it running at all times. If you ever need to copy more than one thing onto the clipboard, it's invaluable. XDesk took some configuration to be good (all GUI stuff), but once done, it's amazing. It's hard to explain what's so good about it, but I have found that it works fla