c pound

I reject your reality and substitute my own!
posts - 46, comments - 46, trackbacks - 40

My Links

News

Archives

Image Galleries

Blog Communities

Blog is a stupid word

Lunch Hour

Resources

October 2005 Entries

Regex 101 (promoting the proliferation of weapons of mass confusion)
Eric Gunnerson is starting a series of posts entitled “Regex 101” which, judging by the first installment, looks to be an excellent introduction to regular expressions in C#. Eric is a very smart dude who understands this stuff at a base level and also seems to know how to teach effectivley (so far). A rare combination, and highly recommended. Go, read, learn... but try not to proliferate, for there tends to be a High Bus Factor where regular expressions are concerned...

Posted On Friday, October 28, 2005 6:13 AM | Feedback (0) |

Does Visual Studio Rot the Mind?
"My coding has become a constant dialog with IntelliSense" Truer words could not previously have been uttered. So, “Does Visual Studio Rot the Mind?” (via Hannes Pavelka). Before long we may sit down at our computers, much like the brainwashed drones of 1984, to find that Visual Studio has already started itself, generated the code we were just thinking about, and made us a latte’. Nothing left to do but press F5 and enjoy the ride. Anyways, I have only read the part on IntelliSense...

Posted On Thursday, October 27, 2005 5:18 AM | Feedback (0) |

PocketMod
I like to keep a folded piece of paper containing a few post-it notes in my pocket. You never know when you are going to need to leave someone a message or take notes for a phone conversation. It’s nice to have the post-its that you can stick on a wall while you write, and the folded paper for longer term notes. I have a PDA but I’ve found that while it’s great for scheduling, it sucks for taking quick notes... especially when you have a cell phone in one hand! Behold the little...

Posted On Wednesday, October 26, 2005 4:23 AM | Feedback (1) |

Essence of Yak
My rental car smells like someone switched the can of “New Car Smell” with “Essence of Yak”

Posted On Tuesday, October 25, 2005 7:12 AM | Feedback (1) |

The Zen of the Ride
One of the reasons I want to get a bike: The Zen of the Ride

Posted On Monday, October 24, 2005 1:23 PM | Feedback (1) |

Finding all the tags of a specified type in an HTML document
Say you want to find every instance of a specific type of tag in an HTML or XML document. The following code is one way to do that. It is, of course, not the most efficient way but its straight-forward and it works. I like that. So anyways, the first version of this code used the string.IndexOf (string, int) method to find image tags by searching for the static string “<img” but that ignores such aberrations as “< img” and this could cause you to miss some tags if the...

Posted On Monday, October 24, 2005 5:32 AM | Feedback (0) |

Getting the first day of the month
I want to find out what day-of-week the first day of the month falls on. For example, the first of October falls on a Saturday. DayOfWeek firstDayOfMonth = DateTime.Now.AddDays((DateT... - 1) * -1).DayOfWeek; It seems to me like there should be a better (built-in) way to do this. Am I just missing something obvious...

Posted On Friday, October 21, 2005 12:05 PM | Feedback (2) |

Otis is watching
So, it happens often – too often – that when I am coming into the building in the morning, the elevator doors will open up before I press the button. In fact, the doors open as I am walking towards the elevators not yet even thinking about the button. Thus, I don’t think I can claim this remarkable ability as a super power. It’s like the elevators themselves know. They’re watching. Weird. Back to technical posting soon… I promise

Posted On Friday, October 21, 2005 4:04 AM | Feedback (0) |

Complete nonsense
There are two doors in this stairwell with this sign (the red one). Complete nonsense

Posted On Thursday, October 13, 2005 8:59 AM | Feedback (0) |

Ghetto performance measurements
This is not, by any means, the most accurate way to measure the execution time of a block of code. That said, it’s very simple and it works great when a rough idea is close enough. I think I originally got this code off CodeProejct. If I can find the article again, I’ll credit the original author here. public class DebugTimer : IDisposable{ private DateTime start; private string label; private static int level = 0; /// <summary> /// Start a new DebugTimer which will run until disposed...

Posted On Thursday, October 13, 2005 6:58 AM | Feedback (0) |

Side effects may include...
Programming by side effect is a practice I generally dislike with and tend to avoid when there’s a choice. What I mean is creating functions that take no parameters and return no value. The only way for these functions to accomplish anything is through side-effect. I will almost invariably choose the more explicit option, especially for public functions. In the example below, I would definitely use the GetGreenishColors function. I feel that the first function, LoadGreenishColors, is too ambiguous....

Posted On Tuesday, October 11, 2005 9:51 AM | Feedback (0) |

On the acquisition of images
So, one of my little side projects involves getting images from websites. Surprisingly, one of the easiest parts is actually requesting and receiving the Image. (note: exception handling code removed for your viewing pleasure.) private Image GetImage(string url){ HttpWebRequest req = (HttpWebRequest)WebRequest.... HttpWebResponse resp = (HttpWebResponse)req.GetRes... Image image = Image.FromStream(resp.GetRe... resp.Close(); return image;} Now, you can just as easily get...

Posted On Monday, October 10, 2005 10:50 AM | Feedback (0) |

Well, actually...
It was pointed out to me last night that an integer is, in fact, a value type and not an object. Well, yes and no. In C#, an int is an integral type that gets you a System.Int32 structure, as you can see [here]. Further, a System.Int32 structure derives from System.ValueType which, in turn derives from System.Object. As they say, “This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.” Everything is an object. Ha! Additionally, any...

Posted On Thursday, October 06, 2005 4:54 AM | Feedback (3) |

Making Things Happen
I just read a very good article (chapter from a book, actually) on project management. I'd highly recommend this article to everyone, especially to the developers out there, who have ever worked on a software project. If you're lucky enough to have a good project manager, this might just help you get inside their head a bit better. Read on: The Art of Project Management: How to Make Things Happenby Scott Berkun...

Posted On Wednesday, October 05, 2005 11:15 AM | Feedback (0) |

Mostly generic
So I was reading this long and enlightening article, written by someone waaay smarter than myself, about variance for generics and I encountered a cool new feature in C# 2.0. Simply put, when you define a Generic method, you can apply restrictions (constraints) to the kinds of types that client code can use when it calls your method. For example, you run into a problem if you want to copy a List<int> into a List<object>. This seems like a reasonable thing to do because an int is an object,...

Posted On Wednesday, October 05, 2005 7:17 AM | Feedback (0) |

Powered by: