Ben Griswold on September 7th, 2007

We ran into the following issue two days ago.  In a nutshell, the “initialCategory” was not being selected in the Categories dropdown by default.  Yes, I recognize that the code itself may be written in fewer lines, but please only focus on the differences between the two code snippets below.  I haven’t had the time to [...]

Continue reading about C# Brain Scratcher of the Day

Ben Griswold on August 27th, 2007

My current focus is on stabilizing about a dozen applications which I recently inherited.  By “stabilizing” I mean I am in the process of cleaning up, documenting and fixing somebody else’s code. These applications have been in existence for years. They were first coded in Classic ASP, then rewritten in .NET 1.1 and finally ported over to [...]

Continue reading about Doing Your Dirty Work

Ben Griswold on June 20th, 2007

This question circulates through the office about once a year.  “Um, I have Windows service which processes requests which are queued in a database table.  Everything is working great, but I would like to add a second instance of the service and I need to know the best way to ensure the services don’t step [...]

Continue reading about What’s the Best Way to Manage a Database Queue?

Ben Griswold on February 7th, 2007

Out of the box, you can do a lot with the DataView.RowFilter property, but you can’t make use of the top clause. However, if the view contains a column with unique values, you can obtain the same results by setting the Sort property and then generating a RowFilter which uses the in condition. Here’s a [...]

Continue reading about DataView.RowFilter Top Rows

Ben Griswold on February 3rd, 2007

I brought attention to my dreaded mouse addiction a couple of months back.  For those of you with a similar problem, The Daily Grind made reference to a keyboard shortcut reference poster available for download here.  I printed out the C# shortcuts and paste the poster on my monitor.  I can’t see what I’m typing any longer, [...]

Continue reading about Visual Studio 2005 Keyboard Shortcuts

Ben Griswold on January 24th, 2007

If you like to drive your fellow developers mad, here’s something fun.  The next time you need to manage a bunch of dates, add them to a Hashtable AFTER converting ToString().  For example, DateTime holiday = new DateTime(2007,1,1); Hashtable htHolidays = new Hashtable(); htHolidays.Add(holiday.ToString(), holiday.ToString()); … Next, create a function similar to the following: public static [...]

Continue reading about January First is Not a Holiday

Ben Griswold on January 22nd, 2007

Disclaimer: If I were a betting man, I would bet there’s some code which does the following kicking around a forum, blog or two already.  Simply, I wasn’t lucky enough to find it.  Hence, the IF in “if I were a betting man.” I ran into a case today where I wanted to reduce unused [...]

Continue reading about C# RoundToInterval()

Ben Griswold on November 13th, 2006

Recently, we had the opportunity to do some clean up work on a legacy web app.  At the top of our list was to refactor PDF report rendering to the browser.  The typical application use case was as follows: User enters data.   User submits data.  User requests PDF report.   Application queues report.   Application processes report.   Application stores the [...]

Continue reading about Secure PDF Display – A Second Chance