Because some posts just refuse to be placed into a bucket

Seattle Code Camp 2015 - Done

Illustration

A day has been a way too short today at Seattle Code Camp. With quite a few interesting talks and folks it passed a way too quickly. Many parallel tracks (nine!) ensured that there will be at least couple of talks not seen - especially if you like to discuss stuff with people.

Unlike last year, this year talk, this year I had a fortune to give two talks.

Git in the enterprise environment session, as name implies, dealt with the slightly different philosophy of the source control within a large corporations. Interactivity during talk ensured discussion to spill throughout the day and that is the best any speaker could wish. As promised, here are PowerPoint slides but for many things you had to be there. :)

Second session was more of an Q&A discussion about working with the .NET under Linux. Although originally discussion format was selected due to the lack of time to prepare examples (I somehow missed that two of my talks went in the conference program - doh!) I had a lot of fun and a really positive feedback. I am definitely thinking about intentionally doing the same next year - relaxed discussion with audience definitely got my blood flowing. PowerPoint slides are a bit raw but there is a link or two in them.

Great thanks to both organizers and sponsors and see you next year.

The Logical Song

Most of the time advertisements are pain-in-the-butt. They sell you things you don’t want in a way you don’t care about. This goes double for YouTube where awful commercials are only matched by annoyance of having them repeated time after time.

But occasionally there comes something worth watching. For me this happened with HP Sprout commercial:

While technology does seem cool and I am looking forward checking it out in person, it was the song that piqued my interest. It was both familiar and new at the same time and it just grabbed the attention. And HP ad agency knew it would happen as they made another video with an “origin story”. [2018-08-06: And some idiot removed it from YouTube.]

In the mass of the most boring ads, this one gave me a faith that ad industry still knows how to make stuff worth watching as it seems there is no escaping them anyhow. But then again it might be that this song stirred my inner optimist and I will get back to annoyed self after watching a daily dose of the usual crap YouTube serves. Regardless, I’ll enjoy it while it lasts.

PS: Those interested in song can also find it played by its composer.

[2018-08-06: Of course some idiot removed the original/official video. I swapped it for copy from some other channel.]

Books

Cover

Those more observant among you might have noticed there is a books tab up there. Yep, I am a published author now.

While both books are more of a reference material than what you would usually consider a book they did require quite a lot of work - especially getting formatting and publishing just right. Those interested in that aspect can view what raw sources looks like and what goes into making a proper e-book.

(73) AF7RG

Offline to Online Switch on a Minecraft Server

Illustration

It all started with my kids learning about Minecraft skins and their dad not being able to get their new look working in the game. No matter what, they would stay Steve and Alex. Quick search told me skins are not supported in offline mode and my home server was setup as such. No worries I thought - I’ll just switch online-mode setting in [server.properties](http://minecraft.gamepedia.com/Server.properties) from false to true and that will be it.

However, after I restarted server, my whole family got to start from scratch. We were in skinned bodies but we were also in new locations. It was as if we logged onto the world for the first time. To make it worse, nobody had access to commands anymore. Our ops status has been effectively revoked.

As I added myself to ops again through Minecraft server GUI, I noticed that ops.json got two entries for my user name but each with different UUID. And I could find both UUIDs in my world’s save directory world\playerdata. That got me wondering. What would happen if I would delete file with new UUID and rename old UUID file to it. That is, if my old UUID was 76116624-b235-36a2-a614-ed79be1855ed and my new UUID was d8b2b4e0-1807-4177-a3ca-46afbd1d7538, would renaming 76116624-b235-36a2-a614-ed79be1855ed to d8b2b4e0-1807-4177-a3ca-46afbd1d7538 enable me to get back into my offline body?

Fortunately yes. Transplantation of player data succeeded without any issues. So I went through all save directories and changed played data from old to new UUID. But that wasn’t all. As we were all ops with different ops level for various worlds, I had to visit every ops.json and adjust for that. Simple search/replace was all it took.

And guess what, if you ever decide to make your server offline again, same annoyance in guaranteed since Minecraft has different UUIDs for online and offline mode. There simply seems no way around it. Later I found that people have even built tools to help them with rename.

As Minecraft requires you to verify your credentials at least once over Internet when you buy it, I cannot believe that there is technical reason behind this. Even more because this change was seemingly introduced only with version 1.7.6. My best guess is that it was added as some sort of anti-piracy measure. And as all such measures do, it ended up annoying more paying players than pirates.

In any case my, now online, server recovered from its temporary amnesia and digging could start again.

PS: Paranoid among us might want to check for UUIDs in whitelist.json too.

IPv4 Multicast Messing Things Up

I have a reasonable size home IPv4/IPv6 network with 10ish devices accessing it most of the time. And all worked in a perfect harmony until one morning when wife told me she cannot print on our wireless printer (cheap Brother MFC-J435W). While printer seemed fine, all computers seemed to think of it as offline. Without resolving problem I went to work only to be greeted with information that wife’s tablet (Asus Prime) isn’t working either.

After some debugging I pronounced network on both devices dead on continued working on a small utility that uses broadcast to share some basic data over network to whoever might be listening. As I upgraded versions from night before with new code, printer suddenly started to print again. For a minute or so and then stopped again. And few more times that evening. Whenever I restarted media server, printer would work for a while.

Well, I believe you get the pattern.

What exactly causes this particular issue is hard to say. My best guess is that something is wrong with IPv4 multicast packet parser (if it even exists) in both devices. Something in my packets is causing device’s network stack to go haywire. I know it isn’t address itself because I tried with a few other multicast addresses with similar issues. I know it isn’t bandwidth issue since total amount of messages was less that 2 KB/s. In any case, I didn’t have too much time to troubleshoot.

End solution was really simple - I stopped sending my packets using IPv4 addresses and relied on IPv6 multicast only. Not only that IPv6 multicast is a first-class citizen but many network stacks ignore it altogether. Regardless of the exact reason, that worked perfectly.

Minecraft Teleport in Survival Mode (Without Plugins)

Illustration

As my kids got old enough to play Minecraft we decided that our home server had it light for far too long and that it is time we create a Minecraft world on it. Of course I decided to add myself as an operator with special powers and I was crazy enough to inform kids I can even help them move around via teleport.

It didn’t took long before I was completely swamped with teleport request. Get me to sister, get me to my home, get me to my mine, get me to an island… Having to enter coordinates every time gets boring quickly. So I decided to figure way to make it simpler. Answer was in command blocks. Just add a pressure plate and you can make them do whatever you want. Including teleport.

First order of business was to modify server.properties and set

enable-command-block=true

After that I gave myself a block using

/give @p command_block

Next I tried to get block console so I can enter command and I failed. All YouTube videos seemed to get it so easy but for me there was no console. I tried everything but nothing seemed to work. Console would simply not appear. It took me few re-reads to notice that command block setup is restricted to creative mode - if you are in survivor as I was, nothing could be done. Or could it?

With

/gamemode c

I could switch to creative mode and set command block text to

/tp @p -16 72 186

After placing pressure plate right next to a block, I switched back to survivor

/gamemode s

and my teleport was working just fine.

PS: To get coordinates just press F3 and look at block. Its coordinates will be shown under “Looking at” (last line). Add 1 to middle coordinate and that is your destination.

In the Year 2014

Illustration

As always, first post of a year is reserved for a bit of statistics.

This year I published only 49 posts. I would like to tell it’s because they are of a higher quality but truth is that I got busy with other stuff and this blog got ignored in the progress. I highly doubt I’ll return to a new post every three days as it was when I started writing but once a week should be doable.

Since programming posts take most effort to do properly, their percentage has dropped to only 20%. About the same number of posts was related to Windows. Next up with 10% was Linux and another 10% was dealing with electronics. Rest is mishmash that I won’t even bother to categorize.

There was a slight decrease in amount of traffic site has been getting but that was to be expected due to a drop in posting frequency. As it became usual, about 65% of traffic is coming from unknown place so I’ll just ignore them. Out of known locations, United States were again most common source with about 35% of all visits and Germany came far second with 15%. India was third with 10%.

Same as last year, Chrome was the first browser of choice for viewing with 40% of traffic coming via it. Internet Explorer and Firefox basically share second place with about 25% each. Fourth honorable mention goes to Safari with 5%. Similar to last year, 95% of those visits were done via desktop and not mobile phone.

This year I also did a major site improvement - it became https-only. While average visitor probably doesn’t care and hopefully saw no difference, those more security conscious will appreciate this change. It is more of a philosophical move than anything else.

This year will also be remembered for me as the first year a page of my site was intentionally blocked by a search engine. Post in question was Installing Windows 8.1 (or 8) without a product key and it was DMCA’d due to comments as far as I can deduce. It is really difficult to know what exactly happened because every questions seems to get a black hole treatment.

That’s it - regular program will continue with the next post.

Captcha This

Illustration

A few weeks ago Google introduced No CAPTCHA reCAPTCHA. It is a new approach to recognizing whether we are dealing with robots or humans. It should be a modern alternative to good old CAPTCHA. And I say it was about the time.

Captcha was a good idea a few years ago. They give you garbled text and you write it down to prove that you are a human. State of OCR was such that no program could pass this with any meaningful accuracy. There was a further improvement with ReCaptcha where your input would be used to help with book OCR which also caused warm and fuzzy fillings.

But robots got smarter and captchas got more complicated to keep up. I don’t know about you but I average about 75% captcha accuracy on a good day. According to Google, most advanced robots reach 99.8% accuracy. If robots have a higher success rate than humans on a system that was designed to keep them out I believe it is a time for change.

New system aims to recognize behavior and to give various quiz tasks only if there is any doubt. This new API hasn’t been widely implemented yet so it is hard to know how good it really is. But, if it removes at least one stupid letter entering dialog, I will consider it a success.

So far I personally haven’t been presented by a single new dialog. However, I am not a robot so that is pretty much expected result by design. Based on examples Google has provided, it will be based on image recognition so hopefully robots will endure more pain than humans. Depending from where images are coming from, I also expect quite a lot of funny combinations.

Of course, there is a work involved for any site that is to support this. And my guess is that it will be a bit more difficult to implement than older ReCaptcha. Considering that even ReCaptcha didn’t take web world by storm although it was superior to self-created ones, it is pretty much safe bet that we will see old style captchas for a while.

But new captcha king is in town. May it stop our robot overlords.

PS: No, “abicl” was not correct answer for a picture above.

PPS: If 99.8% figure is for ReCaptcha captchas, I imagine that it is all but 100% for all those self-rolled captchas that think that having a line or two is protection enough.

Lollipop, Lollipop, Oh Lolli, Lolli, Lolli

Illustration

As I saw today Android 5.0 (Lollipop) factory images, I got a twitch going on. Yes, I could wait OTA a week or so or I could install the newest Android OS on my phone immediately at the cost of data. It took me a whole second to know the answer.

First step was to install Java. I took latest x64 Java Development Kit and got that pest (temporarily) on my machine. Next step was to get Android SDK Tools. I opted to get it as a standalone install.

Upon starting Android SDK Tools, I just installed all packages offered by default. Nitpickers might say that you only need Platform Tools and Google USB Driver but I find it much easier to click Next, Next, Next until cows come home or all needed gets installed.

Last part of puzzle was actual factory image for Nexus 4. All files from it I unpacked in the same directory where fastboot.exe was installed. Since I took all defaults this was at %USERPROFILE%\AppData\Local\Android\android-sdk\platform-tools.

Now I powered off my mobile phone and powered it back on while holding Volume down button. This brought me into the FastBoot mode and I connected my USB cable only to have device not be recognized. Therefore I had to go to the Device Manager and right-click Android device with a yellow question mark. Selecting Update Driver Software and then pointing dialog to the SDK directory (%USERPROFILE%\AppData\Local\Android\android-sdk in my case) allowed installation of Google’s USB Driver.

Now I could start cmd.exe and unlock my phone:

cd %USERPROFILE%\AppData\Local\Android\android-sdk\platform-tools
fastboot oem unlock

This gave me a warning prompt on my mobile phone. To select Yes I had to use volume keys for the movement and power key for the confirmation. First step done.

Next step was to actually flash the phone. Fortunately Google provided nice script for that so I just started it (still in the %USERPROFILE%\AppData\Local\Android\android-sdk\platform-tools directory):

flash-all.bat
 sending 'bootloader' (2264 KB)...
 OKAY [  0.076s]
 writing 'bootloader'...
 OKAY [  0.294s]
 finished. total time: 0.374s
 rebooting into bootloader...
 OKAY [  0.004s]
 finished. total time: 0.006s
 …
 sending 'cache' (10984 KB)...
 OKAY [  0.375s]
 writing 'cache'...
 OKAY [  0.602s]
 rebooting...
 finished. total time: 87.058s
 Press any key to exit...

After two minutes your phone was be rebooting with a brand new OS. First reboot took quite some time (eight minutes on my device) so have some patience was needed.

After setting everything up I rebooted the phone once more into the FastBoot mode (power off; VolumeDown+Power). Then I started cmd.exe one last time and brought the lock back:

cd %USERPROFILE%\AppData\Local\Android\android-sdk\platform-tools
fastboot oem lock
fastboot reboot

And with that installation of Lollipop was over.

PS: Interesting tidbit: during initial Lollipop setup I could only see 2.4 GHz wireless networks. As soon as I was connected, 5 GHz networks became visible too.

Livin' La Vida Https

I had SSL enabled on my site for a while now. My hosting provider had it available as an option and I hated having my password travel unencrypted. However, as Google pushed for https, I started playing with the idea to use https exclusively. As you can (hopefully) see, migration was successful.

First order of business was to sort out redirects. I wanted regular http domain 301-redirected to the https one. As my server was using Apache, following directives were added to .htaccess file:

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

In order to be compliant with HTTP Strict Transport Security, I also added new header just above conditions in the same file:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

My Suffusion WordPress theme kept using http to fetch ads and that caused browsers to omit them all together (you cannot load http scripts on https site). Therefore I also had to make a slight modification to it. In file ./suffusion/functions/shortcodes.php I had to change suffusion_sc_ad function to use https by removing protocol name from the URL:

function suffusion_sc_ad($attr) {
        $params = array('client', 'slot', 'width', 'height');
        $provider = 'google';
        $provider_type = 'syndication';
        $service = 'ad';
        $service_type = 'page';
        $ret = "<div id='".$service."sense'>\n<script type='text/javascript'><!--\n";
        foreach ($params as $var) {
                $ret .= "\t".$provider."_".$service."_$var = '".$attr[$var]."';\n";
        }
        $ret .= "//-->\n</script>\n";
        $service_url = "!!http:!!//".$service_type.$service."2.$provider$provider_type.com/$service_type$service/show_{$service}s.js";
        $ret .= "<script type='text/javascript' src='$service_url'></script>\n";
        $ret .= "</div>\n";
        return $ret;
}

Result of these three changes is that my site is now https-only without any functionality loss.

PS: Those checking the certificate will notice that I use CloudFlare and their Universal SSL. Do notice that using such service is actually one big man-in-the-middle attack since CloudFlare decrypts all traffic before encrypting it again when it contacts your site. It is not because they are evil but because they cannot provide you with their CDN services (and more) any other way. For any website traffic, I see no problem with such approach. However, for administration tasks, I would recommend having a separate https subdomain that leads directly to your server.