I am officially in the credits for MonoDevelop!
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
In case you use vim ocassionally, add this to your vimrc file to get syntax highlighting:
au BufRead,BufNewFile *.xaml setfiletype xml
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!
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.
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.