RSS

Back to blogging?

 
Leave a comment

Posted by on May 20, 2011 in Random

 

Open Source Contribution

I am officially in the credits for MonoDevelop!

http://monodevelop.com/index.php?title=Download/What%27s_new_in_MonoDevelop_2.6

 
Leave a comment

Posted by on March 16, 2011 in Random

 

MVC2

I started a side project over the weekend to bring myself back up to speed with what is going on with MVC2.

It’s a bit slow and has some kinks to work out, but here is what I have so far: http://www.tvscrobbler.com

 
Leave a comment

Posted by on October 12, 2010 in C#

 

XAML in VIM

In case you use vim ocassionally, add this to your vimrc file to get syntax highlighting:

au BufRead,BufNewFile *.xaml setfiletype xml

 
Leave a comment

Posted by on September 7, 2010 in Software, WPF

 

PerformanceCounterType.AverageTimer32 example

I recently had the need to use some performance counters. Overall, counters are extremely simple … but if you want to use a counter that provides an average it can be frustrating to figure out how to correctly use them. There are at least three different examples on how to do this. Of these examples they either don’t work or give non-sense values in the Performance Monitor.

Essentially, an AverageTimer counter type requires a second ‘base’ counter. The base counter represents the number of operations performed and the non-base counter is the amount of time it took.

So, to create an average counter do this:

CounterCreationDataCollection creationData = new CounterCreationDataCollection();
creationData.Add(new CounterCreationData("counterName", "blah", PerformanceCounterType.AverageTimer32));
creationData.Add(new CounterCreationData("counterNameBase", "blach", PerformanceCounterType.AverageBase));
PerformanceCounterCategory.Create("myGroup", "blach", PerformanceCounterCategoryType.Unknown, creationData);

The order in which the counters are created is important. Always add the base counter after the average counter.

Assuming you have the counters and have made them not ReadOnly.

PerformanceCounter baseCounter; 
PerformanceCounter averageCounter;

Stopwatch watch = new Stopwatch();
watch.Start();
// do work
watch.Stop();
averageCounter.IncrementBy(watch.EllapsedTicks);
baseCounter.IncrementBy(1);

It is important to first increment the average counter before incrementing the base and pass in the number of Ticks rather than number of Milliseconds. My initial tests showed that the values shown in the Performance Monitor, on Windows 7, ended up showing the values in Milliseconds.

Hope this helps!

 
Leave a comment

Posted by on September 1, 2010 in C#, Code Sample

 

Yahoo is now Bing

I saw in the news today that Yahoo is now powered by Bing. Its interesting this happened so quietly and I thinks its a good thing for everyone but Google.

 
Leave a comment

Posted by on August 25, 2010 in Random

 

xcode 4

Recently I’ve been diving into xcode trying build a iPad prototype. I’ve only used it for a couple of hours but xcode 4 is a definite improvement over v3. Most notably, I like that they pulled the interface designer into xcode to give a unified development experience. Overall I have found myself being more productive.

It still doesn’t come close to the experience Visual Studio gives developers for the Microsoft stack. I imagine they’ll always be playing catch up in this area.

 
Leave a comment

Posted by on July 27, 2010 in Mac, Objective-C, Software

 
 
Follow

Get every new post delivered to your Inbox.