Programming Rants

WPF user controls: do not use merged dictionaries for shared resources
24 Nov 2014
Resource dictionaries in WPF are not shared, unless they are part of App.xaml. That is, if you have a user control that loads (and uses) some resource dictionary, new instance of the dictionary will be loaded for each instance of the user control. This can (and does) lead to increased loading time and memory footprint. […]

Checksum program that actually works
06 Nov 2014
Often when I download files from the Internet I need to verify the checksum. That is, calculate actual checksum of the file and make sure it matches the expected value. I used checksum calculator from Codeplex (checksum.codeplex.com), but I could not make it to compare checksums for me; -c option simply did not work as […]

One more time about Resource vs. EmbeddedResource
30 Oct 2014
In Visual Studio you can set “Build Action” for a project item to ‘Resource’ or ‘Embedded Resource’, among other things. The difference between the two is confusing, and exact up-to-date documentation is hard to find. (This StackOverflow post is probably the best, but not 100% accurate.) Today I became confused one more time, so I […]

The Git language
03 Oct 2014
I came to realize that Git is not only a “fast version control”, but also a language (lingo, slang) that sounds very obscure to the non-initiated. This is exacerbated by the feature of the English language where every noun can be verbed and every verb can be nouned. I collected a number of quotes from […]

Capturing unhandled exceptions in a mixed native/CLR environment
25 Aug 2014
Observing Unhandled Exceptions In .NET unhandled exceptions can be observed via AppDomain.UnhandledException event: AppDomain.CurrentDomain.UnhandledException += myHandler; // C# In Win32 unhandled exceptions are observed via SetUnhandledExceptionFilter call: SetUnhandledExceptionFilter(myfilter); // C/C++ Is native or managed exception filter called first? In a mixed native/managed environment it is possible to setup both filters, which begs the question which […]

Windows: Getting callback on child process exit in C++
07 Aug 2014
In my current capacity I sometimes descend into the virtually forgotten depths of C++ desktop programming. One interesting problem I needed to solve is how to get notified about a process exit. My program can create potentially unlimited number of child processes, and I need to know when they die. In the .NET world I […]

Program to restart Belkin – N300 Wireless-N Router
01 Jun 2014
Various Wi-Fi devices, especially mobile ones, started to “lose” the router. They can easily find the network, but then are stuck on obtaining the IP address. I guess this is some bug in the DHCP server. Restarting the router usually helps. I ended up writing a little C# program (binaries, full source, Program.cs) to automate […]

Android OS eats the battery
04 May 2014
My Motorola Droid RAZR MAXX suddenly started eating the battery much faster than it did just a couple of days ago. I went to System Settings->Battery and discovered that the main consumer of power is now the Android OS, which has left Screen, the traditional battery hog, far behind. I tapped on the “Android OS” […]

WPF: Editable ComboBox Text Disappears
30 Apr 2014
ComboBox looks like a simple thing, but it’s surprisingly hard to get right. Today I bumped into another bug (or feature) of the WPF combo-box. I am recording it here, so I don’t forget the details. Suppose you have a ComboBox. The user selects an item in the combo box. ComboBox’s ItemSource then changes. If […]

Staying on hold: why background music is better than chatter
21 Feb 2014
US Mail lost my package. Trying to call them, I am waiting on hold for 25 minutes and counting. But that’s not the most annoying part. The most annoying part is that they use constant chatter about their excellent services instead of background music. A male and a female announcer alternate talking about how priority […]