I needed a piece of code to manage list-view controllers. I needed to use ListView controls in the details mode, which automatically sort its contents when I click on the header, and also pastes the content in a tabular format when I press Ctrl+C or Ctrl+Insert on it. So I created the following classes. The code that carries out the sorting stuff when the header is clicked is taken from this following MSDN article.

Continue reading

Recently I upgraded my currently installed Synaptics touchpad driver to version 15.x, and I found that I cannot emulate the middle-click effect by pressing both right and left click buttons. I found no options in the settings to enable that functionality. Finally after searching the web I found a workaround here [+]: Run the registry editor (regedit) Go to key: HKEY_LOCAL_MACHINE\Software\Synaptics\SynTP\Defaults\ Here create a new key as a DWORD and name it HasBothButtonFeature and set the value to 1.

Continue reading

The following pieces of code help figure out how two intervals overlap, and provides helper methods to represent them in a way that is useful for debugging purposes. This job is quite easy to accomplish, but since I’ve written it too many times from scratch, I put them in the following gist. The IntervalOverlapKinds.cs file defines the IntervalOverlapKinds enumeration. The interval detection is carried out in the static methods of the IntervalOverlap class.

Continue reading

Suppose that you intend to find a string or a token (i.e., whole word, instead of a substring) and change their color in some Windows Forms RichTextBox. The following code snippets will help. The FindStringAndSetColor method looks for instances of an arbitrary string in the contents of the RichTextBox, while the FindTokenAndSetColor method looks for whole words (tokens).

Continue reading

In normal situations you cannot view the content of special folders, such as Windows/assembly or Windows/fonts, and so on. The way these folders are shown are set through the desktop.ini file in each of these folders, which is normally hidden and protected. One trick that I learned from here [+] is described below. Open a command prompt and type: cd /d %windows%\assembly attrib -r -h -s desktop.ini ren desktop.ini desktop.bak Using the above commands, we kill the desktop.

Continue reading

Author's picture

Sina Iravanian

Movie music junkie, insomniac, daydreamer, procrastinator, hard-determinist, introvert, and a bit into software.

Software Developer

Melbourne, Australia