... all I'm offering is the truth. Nothing more. RSS 2.0
# Wednesday, January 20, 2010

I do not do nearly enough straight SQL these days, there is always a layer of abstraction between me and those db tables. Anyway I always forget how to reseed identity values for table. The following SQL statement ensures that the next insert on mytable will result in the seed value being 1.

DBCC CHECKIDENT (mytable, reseed, 0)

Wednesday, January 20, 2010 11:03:53 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Programming Note to Self | Sql
# Friday, January 08, 2010

I installed WinZip the other day, I was not ready to purchase a full copy yet but I was greeted with this message box …

image

Pretty harmless until I started to realize that they are switching the “Evaluation Version” button and the “Buy Now” every time you start it up.

 image

I decided to not purchase the software and uninstalled the whole thing on principal … shame on the developer that thought of this!

Technorati Tags: ,
Friday, January 08, 2010 10:34:33 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1] - Trackback
Minutia
# Wednesday, January 06, 2010

I have been reviewing some code where a clear appreciation of the difference between ‘&’ and ‘&&’ is not fully realized. The humble ‘&’ provides a distinct way to provide a logical ‘AND’. Let us take this simple class with a single string array associated with it. Lets ignore the obvious lack of properties for a moment…

public class SimpleClass
{
    public string[] SimpleString;
}

Now when we go to use this class we would want to ensure that the SimpleString array is not null before actually performing any operations on it. One way could be to nest the if statement as follows:

if (foo.SimpleProperty != null)
{
    if (foo.SimpleProperty.Count() > 0)
    {
        MessageBox.Show("Success");
    }
}

This might negatively effect your Cyclomatic Complexity and we could not have such an offense ;) So a simple AND (‘&’) would be useful but as mentioned before this is a logical AND, as a result both values are always evaluated. So the following code would actually fail in the event of a SimplyProperty actually being null.

if (foo.SimpleProperty != null & foo.SimpleProperty.Count() > 0) //this could give you a null exception!!
{
    MessageBox.Show("Success");
}

So to the use of ‘&&’. With this technique the JIT compiler always checks the validity of the first expression and if it is false will not even evaluate the second (or subsequent) expressions in the if statement.

if (foo.SimpleString != null && foo.SimpleString.Count() > 0) //this is safe from null exceptions!! 
{
    MessageBox.Show("Success");
}

Simple, basic and true!!

Wednesday, January 06, 2010 7:59:56 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
C# | Programming Note to Self
# Sunday, January 03, 2010

I have been on a real green\energy saving\eco friendly push recently. Last winter my energy cost went through the roof and I want to ensure that my house is better prepared. I started by simply placing weather stripping on all of the exterior doors, all the obvious stuff, then I happened to see a device that may help me. It is called the Ryobi IR001 non contact infrared thermometer, this hand held device shoots out a laser so you can accurately measure the temperature of very specific spots on your walls, windows, outlets, fireplace and vents. In fact this little device has already helped me eliminate two poorly insulated locations in my house and I am working on a third.

ryobiI am taking averages in the following location to see how effective the heating and insulation of the whole home is…

  • Average temperature of first floor register
  • Average temperature of second Floor register
  • Average north facing exterior wall temperature
  • Average south facing exterior wall temperature
  • Average north facing window temperature
  • Average south facing window temperature

If you want to do a comprehensive home energy audit (without the upfront cost) you can also sign up with Microsoft Hohm. You can see sample energy reports based on your area (where available) and see how your home stacks up. The initial questionnaire is kind of long but it is necessary to see what kind of home improvements you can do, and what improvements you may in fact need a professional to do.

My gas bill is already down significantly over last year so I am really happy with the device and my new green stance … oh and my wife and I bring our recyclable shopping bags with us everywhere we shop ;)

 

Technorati Tags:

Sunday, January 03, 2010 10:59:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] - Trackback
Energy Saving | House
# Wednesday, December 30, 2009

If you are working on a massive web project and the lead developer has no clue what Peter Blum controls are … pick up your ergonomic keyboard, mouse, and the spare monitor from home and get the heck out of Dodge!

Technorati Tags:
Wednesday, December 30, 2009 11:20:33 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Humor
# Sunday, December 13, 2009

I am a huge fan of WPF and more specifically Silverlight so when my wife took the opportunity to incorporate Expression Blend into a recent project I was eager for her to give the new Sketch Flow pattern a whirl. The Sketch Flow concept came across as the ability to mock up a complete application or website and transform that into a working production model. Effectively narrowing the gap between the client, designer and the developer. After working with my wife over the last couple of months it is clear that this particular idea was misrepresented.

My wife had created a prototype using the Sketch Flow concept and put together a very compelling, and partially functional, application. Unfortunately that fact that project was in fact Sketch Flow means that you just cannot simply open this application up in Visual Studio and start doing the complex software engineering work. In fact there a bunch of hoops (albeit well documented in Blends User Guide) that need to be followed in order to make this happen:

image 

It is just clear to me that the role of the Devigner (Designer and Developer amalgam) is not a cohesive as advertised.

Sunday, December 13, 2009 10:09:28 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Silverlight | Visual Studio | WPF
Blogroll
Statistics
Total Posts: 334
This Year: 22
This Month: 0
This Week: 0
Comments: 32
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Mark Downie
Sign In
All Content © 2010, Mark Downie
DasBlog theme 'Business' created by Christoph De Baene (delarou)