October 2005 Entries

What is your code really doing?

I was reading this blog entry about optimizing too much and the author makes a very good point. When he wanted to know which of two options was faster, he followed the number one rule of code optimization: He measured it. This may sound obvious, but many people just skip this step. They look at the code, and for what ever reason, make a judgment as to which one is faster. But without measuring you will never know, and whats worse, you might even make your code slower! Another thing I wanted to point ......

Survey: How do programmers discover an unknown API?

I recently read a blog entry that was talking about why some programmers have problems using an API that makes use of the factory pattern. The entry tries to break programmers down into categories based on how they go about the task of programming, how they investigate APIs, and how tight or broad their focus lies. This got me thinking. How do most programmers discover a new API? What is the first thing you do when you realize you need to use the ABC class (or group of classes in a namespace)? Do ......

Connection String generation Visual Studio macro

Speaking of usefull macros, this is one I've used for a a few years and thought might be usefull. It calls the ADODB Data Link Properties dialog (shown below). After you go through the dialog picking your data source, database, and connection settings, it dumps out the connection string for your configuration into code window where your cursor is located. Here is the code for the connection string macro: Public Sub ConnectionStringWizard() Dim args() As Object Dim linkType As System.Type = System.Type.GetTypeFromProg... ......

Totally Useful Visual Studio Macro: Search Google for any highlighted text in Visual Studio

Coding Horror posted a blog entry with this great macro.  It will do a Google search for whatever text is highlighted in an window in Visual Studio

Multithreaded K-Means Clustering

I've been playing around with K-Means clustering lately and found an example in C# here. I worked on some optimizations to this code and made the clustering work on multiple threads which gave it a 40% - 60% decrease in execution time depending on how many vectors are being clustered, how many clusters are generated, and how many dimentions there are per vector. Here is the source for the optimized K-Means algorithm ......