Apr 212017

If one needs to fill dictionary with bunch of keys while tracking only last value for each, a generic inner loop code might looks something like this:

if (dict.ContainsKey(key)) {
    dict[key] = value;
} else {
    dict.Add(key, value);

Code checks if key exists, if not it is added; otherwise the old value is replaced. Pretty straightforward.

Surprisingly, this code can be simplified – a lot:

dict[key] = value;

Dictionary’s indexed property will do exactly the same thing as code above – but in less lines.

Apr 202017

Nineteen years after the StarCraft’s release, there is yet another patch. Alongside many bug-fixes, it also made StarCraft and Brood War expansion completely free.

While giving the old game for free could be considered a bit of a gimmick in the light of newly announced StarCraft: Remastered, an HD version of the original StarCraft, it is not only that.

Blizzard actually released new features within this patch and that is not the first time. They simply kept up the great customer care of the StarCraft saga. Frankly I wouldn’t be surprised if we see another patch or two for it in the future.

Without the further ado, download the new (free) version and have fun.

PS: And yes, StarCraft color issue has been resolved.

PPS: You can also check some other free games from Blizzard. My personal favorites being The Lost Vikings but also Warcraft II and Diablo are nothing to frown upon. :)

Apr 162017

I already wrote about using Mikrotik’s DNS to resolve a short name lookup in Windows. And there I noted that domain-name DHCP option seemingly has no effect on Linux. Well, let me introduce you to domain search option.

Most of the Linux/Unix based operating systems, whether it is Linux, FreeBSD, or MacOS support arguably a more proper way to define which domain we are referring to when using a single word host name.

To define suffix for domain search, just add option 119:

/ip dhcp-server option
add name="domain-search-option" code=119 value="'example'"

And of course add this option to DHCP network:

/ip dhcp-server network
set 1 dhcp-option=domain-search-option

PS: And no, you cannot use this instead of domain-name. Windows clients only support domain-name while Linux/Mac only supports domain-search option.

Apr 112017

If you download Windows 10 ISO files regularly it is more likely than not you cannot really tell for sure which build is which. However, determining the build number is fairly easy.

The first step is to mount the Windows .iso file which can be done by double-clicking it (or using VHD Attach). That will assign a drive letter to image so you can access it.

Second (and last) step is to right-click on setup.exe on newly created drive and select Properties. Inside Properties window we are interested into Details tab and its File Version field. It is this field that will tell you build number as third part of version.

For example, if File Version is 10.0.15063.0, that .iso belongs to Windows 10 build 15063.