Programming

Everything that belongs to programming… snippets, experiences, rage, you know.. the usual.

Be kind to your eyes

Visual Studio + Consolas font = Happy Boris

iBrainer

Shameless plug:

iBrainer is now ready for public use. Feel free to give it a try, either on download.com or iBrainer.net

In a nutshell: fix your MP3 collection in a snap. No more Unknown Artist or fixing tags yourself.

I might be biased, but I use it all the time — and I’m loving it!

Unicode to DOS Filenames

DOS is a pain. .NET doesn’t get along too well with DOS either, since everything .NET is Unicode – just like everything, actually.

How to change from Unicode (aka, Kanji characters) to DOS Filenames:

[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern uint GetShortPathName([MarshalAs(UnmanagedType.LPTStr)] string lpszLongPath, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpszShortPath, uint cchBuffer);

public static string ToDOSPathName(String longName) {
StringBuilder shortNameBuffer = new StringBuilder(256);
uint bufferSize = (uint)shortNameBuffer.Capacity;

uint result = GetShortPathName(longName, shortNameBuffer, bufferSize);

return shortNameBuffer.ToString();
}