Internal Domain Name

Illustration

For the longest time anything was a good internal domain name. Yes, obviously you avoided .com, .net, .org, and other usual suspects but anything else was quite OK. While some people did go distance on this, most of networks sort-of settled on .local or .lan. And all was nice and dandy.

However, lately two things have happened lately to mess with fairy tale. First was of course that ICANN smarties decided to create a zillion new top-level domains. And then there was Apple and their kidnapping of .local suffix for the purpose of mDNS.

Just like that people found Apple devices no longer playing nicely on .local domain and all other domains got big on-sale sign with a potential for collision down the road. There was an RFC with a few reserved domain names but neither one of those actually fits the local LAN setup. And yes, there were some attempts at properly reserving the few most common domains (e.g., .lan, .home, .corp, …) but that RFC never went anywhere.

And ICANN did try to sell all three most common local names already but found itself in a bit of a bind due to a high usage of these domains in households and companies alike. Just imagine a mess some company’s network could be in if .corp gets delegated and someone buys login.corp domain. While ICANN has slowed process a bit for the most conflicting domains due to the security report, spammers are pushing to get those domains on market.

As a general rule, the only sure way not to have your domain clash with newly introduced spam domains is actually to buy your own domain. Even if you don’t want to ever have a website, you need to get a domain. I find this solution annoyance and a mini money grab at best. However, this seems to be the only sure way spammers won’t get to resolve your DNS requests. That is until you forget to renew the domain.

I personally have settled on .home for now for my own network. Based on the DNS query stats for the undelegated domains, it is among top 3 most abused domains and thus it is unlikely it will be sold for use as top domain without many feathers being ruffled. That should allow me enough time for the migration to some other domain.

CR2032 With Wire

Booting my NUC I noted the following message:

The following are warnings that were detected during this boot.
These can be viewed in setup on the Event Log Page.
WARNING : CMOS Time Not Set

Oldsters keeping their machine longer than a few years are probably already yelling CR2032. And guess what - I had those ready to go. After opening NUC (darn IR window is really annoying to get out) I got into trouble as battery wasn’t in the holder. Nope, it was on the wire.

While you can hack the solution by simply soldering wires to the battery, I would recommend thinking twice about it. I have done it multiple times and it is not only annoying to solder onto whatever alloy battery is made of (no, it is not pure aluminium) but heating the lithum batteries significantly decreases their life.

As I didn’t know the type of connector of the top of my head I went over to Intel’s support pages and of course they had an article ready. It went even so far to actually specify connector as Molex 51020-0200. I couldn’t actually find such Molex connector but I’ve found 51021-0200 looking exactly the same. I guess not even Intel is immune to typos.

Armed with knowledge of connector, I went on Amazon hunt and found a few of them. Of course, I went with cheapest which at $5 is not really cheap at all. I guess you pay premium for that sweet cable.

Moments before plugging it in I noticed something disturbing. Black and red wires were swapped on my replacement battery as compared to the one I pulled out. I am not sure which one is more standard but Intel and Dell like to play on opposite side of spectrum. Plugging Dell battery into NUC would almost surely damage it as CMOS battery circuits are rarely protected against reverse polarity. It was a time for surgery.

Using small blade (scalpel actually) I gently lifted plastic holding each terminal in the housing and pulled them out. Done gently enough this enables reinsertion of the terminals into the housing with the black wire at position #1 - the same as used in NUC.

This whole battery swap took way longer than it should have but at least my BIOS complains no more. :)

PS: Since computer was plugged in at all times, I find it really strange to have battery fail on me after only three years. I have way older machines with their original battery still working…

Parsing Double.MinValue

If you try converting double.MinValue to string and then back again, you will be greeted with OverflowException:

var text = double.MinValue.ToString(CultureInfo.InvariantCulture);
Console.WriteLine(text);
var number = double.Parse(text, NumberStyles.Float, CultureInfo.InvariantCulture);
Console.WriteLine(number);

Seemingly output string of -1.79769313486232E+308 is a bit lower than double would go despite the implicit promise minimum value makes: to be a minimum.

Reason for this is ToString() method not showing all the digits it can by default but actually a few less with a bit of rounding. This actually generally gives a better result (for example try 1.0/3). Last digit or two are noise anyhow due to the nature of double.

However, if we are emotionally connected to every possible digit or we need to parse stuff we give as output, there is a little thing called round-trip formatting. That works for Single, Double, and BigInteger data types and it consists of a single “r”:

var text = double.MinValue.ToString("r", CultureInfo.InvariantCulture);
Console.WriteLine(text);
var number = double.Parse(text, NumberStyles.Float, CultureInfo.InvariantCulture);
Console.WriteLine(number);

Now we get -1.7976931348623157E+308 as a text representation and parsing fails no more.

PS: Equivalent “issue” exists for .MaxValue.

Duplicates in Dictionary

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.

StarCraft 1.18 for Free

Zealot

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. :)

[2017-07-02: StarCraft Remastered will be available at August 14th and it will cost $15. You can preorder it now.]