Geeks With Blogs


Add to Google

Tim Hibbard CEO for EnGraph software June 2010 Entries
Use Preprocessor Directives for better debugging
The most common use for Preprocessor Directives is to intelligently group your code using the #region … #endregion tag (sidenote: Ctrl + M, M is a great keyboard shortcut to expand and contract your regions). Preprocessor Directives can also be used to tell the compiler which code should or should not be compiled based on the configuration environment. Wrapping code in an #if DEBUG … #endif block will only execute if the environment is in debug mode. This proved to be a handy way to debug a situation ......

Posted On Monday, June 21, 2010 1:08 PM

Hibbard family is growing
On Jan 16, 2011, we are expecting a new addition to our family. Ben is going to learn words like “share” and “don’t put that in the baby’s nose”. We expect he’ll do great ......

Posted On Sunday, June 20, 2010 9:43 PM

Get to No as fast as possible
There is a sales technique where the strategy is to get the customer to say “No deal” as soon as possible. The idea being that by establishing terms that your customer is not comfortable with with, the sooner you can figure out what they will be willing to agree to. The same principal can be applied to code design. Instead of nested if…then statements, a code block should quickly eliminate the cases it is not equipped to handle and just focus on what it is meant to handle. This is code that will ......

Posted On Thursday, June 17, 2010 9:46 AM

Use Extension Methods to find first and last day of the month
A lot of reports work on data from last month. It is a nice touch to have these dates pre-populated for your users. Using extension methods, the code can look cleaner too. Extension Methods: public static class DateHelper { public static DateTime FirstOfTheMonth(this DateTime dt) { return new DateTime(dt.Year, dt.Month, 1); } public static DateTime LastOfTheMonth(this DateTime dt) { return dt.FirstOfTheMonth().AddMon... } } Consuming Code: void Prepopulate() { startDateBox.CurrentlySelec... ......

Posted On Tuesday, June 8, 2010 8:41 AM

Declaring variables in SQL
I would like to blog more about the problems I encounter on a daily basis. I find that taking 10 minutes or so to write a simple solution to my problems helps me retain that information. I always forget the specific syntax to declaring variables in T-SQL. declare @startdate datetime; declare @enddate datetime; set @startdate = '04/01/2010'; set @enddate = '04/30/2010'; select count(id) from triphistory where tripdate between @startdate and @enddate ......

Posted On Monday, June 7, 2010 9:46 AM

Copyright © Tim Hibbard | Powered by: | Join free