Archive

Archive for December, 2009

Waiting

December 19th, 2009 No comments

Seattle: Passed a fresh car crash. Three eco-units. A white, a silver and a black. The silver one was spun sideways in the middle of I-5. We were in the HOV lane and zoomed past it before traffic could congeal around the wreakage.

YVR: Arrived over 3 hours early. Flight delayed until 23:30. Arriving in Whitehorse at 02:00 tomorrow morning. Two small blonde girls are making me grit my teeth. This is why I don’t have kids. A screaming infant has appeared as well.

Yes. No children for me. The noise grates my nerves.

Self-assembling Gixxer

December 11th, 2009 No comments

Thx Noah!

Tags: ,

Remove items from a list.

December 9th, 2009 No comments

You have a list of “something” and you want to remove items from the list. I can think of a couple ways to do this.

Remove Items V1:
List myList = new List() { "one", "two", "three" };
// print out the original list
foreach (string item in myList)
Console.WriteLine(item); // one two three

myList.Remove("two");

// print out the new list
foreach (string item in myList)
Console.WriteLine(item); // one three

Remove Items V2:
List myList = new List() { "one", "two", "three" };
// print out the original list
foreach (string item in myList)
Console.WriteLine(item); // one two three

myList = myList.Expect(i => i == "two");

// print out the new list
foreach (string item in myList)
Console.WriteLine(item); // one three

Notes:
The rules for a foreach loop don’t allow you to delete or nullify an object in the collection during the looping, so you need to remove items more directly. For complete objects, this can be a bit harder. Leveraging LINQ can make the task much easier. With the second example, you could use any property/method within the complex object for your comparison. E.G.: IsDirty or ItemFlaggedForDelete().

Tags: ,

Figuring out where you are in an Excel 2007 range.

December 9th, 2009 No comments

Ever tried to debug a loop inside a listObject.Range? Use get_Address(). It makes the process a lot easier.

Code: Read more…

Tags: ,

Setting an Excel cell background color

December 9th, 2009 No comments

Description:
Set a cell’s solid background color using a single user-defined color.

Code: Read more…

Tags: , ,

Setting an Excel 2007 gradient background

December 9th, 2009 No comments

Description:
Set a cell’s background color to a vertical gradient using two user-defined colors.

Code: Read more…

Tags: , , ,

Formating a list of items into a sentence with commas and the ampersand.

December 9th, 2009 No comments

Description:
I need to link an list of (string) items into a sentence at runtime. Here’s a short and simple method to handle the commas and ampersand.

Code:

Read more…

Tags: ,

Scaling an Excel worksheet

December 9th, 2009 No comments

Description:
WinForm controls placed in a worksheet while it is not at 100% will be positioned incorrectly. Here’s a simple workaround to change the zoom to 100% then revert to the previous setting.

Code: Read more…

Tags: , ,

Examining an assembly through reflection

December 9th, 2009 No comments

Below is code loading and examining an assembly.

Problem:

You want to open an assembly to see what’s inside with as little effort as possible.

Solution:

I’m sure there are easier ways but this works…

Code:

Read more…

Testing execution timeout in Visual Studio 2008 Team System

December 9th, 2009 No comments

With Visual Studio Team System, the LocalTestRun.testrunconfig file controls execution parameters for running tests. The default timeout on individual tests is 30 minutes. Ouch!

Solution:

  • Double click on the ‘Solution Items\LocalTestRun.testrunconfig’ file.
  • Select ‘Test Timeouts’
  • Set the individual test time to your preference or set a total time abort if you prefer.

Exercising the LEGO Mass murderer

December 8th, 2009 No comments

There are days when I really wonder about people and their thought process. OK. I wonder every day, but that’s a different issue.

Please read: http://www.wired.com/geekdad/2009/12/swat-team-takes-down-man-armed-with-lego-gun/

First thought: I gotta get one of those!

Second thought: Why do people freak out so badly when there isn’t a problem yet act like total sheep when there really IS a problem? His own office mates didn’t think anything of it. They already know about his LEGO obsession. Yet some nosey woman spots his from outside the building and makes the mad dash to call 911. SWAT comes blazing in. It’s amazing to me that no one was shot. <sigh>

We can’t be bothered to take care of our children or create an open society where disagreements are allowed and even encouraged. Yet, we can narc on anyone without a single scrap of fact.

Wonderful.

Jumping to conclusions is the only sport we excel at. Maybe that guy with the LEGO gun needs to do a few laps for his shortsightedness. After all he was playing with a toy in his own office, with the door closed.

It is a crazy world.

Preparing for the next evolution

December 7th, 2009 No comments

Once again, it’s time for me to hit the road. Read more…

Life in Space: Email from the ISS

December 3rd, 2009 No comments