Ham Check 1.10

Illustration

After a few months, a first update for my ham exam program is in order. Nothing much to see here, just a small refresh.

A new exam type has been added. Flash exam will provide you with an usual exam practice experience, the only difference being that it gives you the correct answer immediately. When learning for the first time, quick determination of the correct answer might be quite beneficial.

Useful for presentation is the ability to independently scale menu and content. This is a nice option to have when dealing with different resolutions - especially on annoyingly small projectors.

That is all for the first update, download the latest version from program’s pages.

73

Microsoft Accounts on NAS4Free Samba

Illustration

With Windows 10 you can get a certain advantages if you opt to use your Microsoft login. However, if you have something Unixoid (e.g. NAS4Free) for your file server you will quickly notice you need to remind it of your user name. And no, solution is not as simple as renaming your user to your e-mail address since at character (@) cannot be used.

What needs to be done instead is to create a simple mapping file (I named mine samba.map):

anita = anita@medo64.com
anita = anita
josip = josip@medo64.com
josip = josip

In that file you map user name received over network to the Unix user. Notice that multiple different names can be mapped to the same user.

Last step is getting Samba to actually use that file. How is that configured really varies with your system. For NAS4Free, you want to visit Services -> CIFS/SMB -> Settings and into Auxiliary parameters add path to the given mapping:

username map = /mnt/Config/samba.map

Now you can use your Windows 10 user e-mail to your heart’s desire.

[2018-07-22: NAS4Free has been renamed to XigmaNAS as of July 2018]

I've Got a Pebble in My Shoe

A month or so ago a new Pebble Time firmware came to the legacy Pebble devices - in my case the Pebble Steel. For something that is such a big change, installation process went better then expected. Only slightly annoying thing was installing new application on my phone but everything was smooth sailing from there. Until I started using it.

First, the good stuff. Application/watchface selection interface changed a bit to reflect possibility of having an infinite number of applications running. Yes, unlike the old firmware, the new one allows for dynamic swaps.

The new timeline interface was a pretty big change for me as I extensively used watchface swapping and now the same buttons brought different behavior. While I cannot say I am a big fan of the new interface, speaking with other people I will chalk this change to the improvement category. For myself, I still might not be using it much but at least I don’t actively hate it.

The bad stuff is that now you cannot use any application without your mobile phone. Before you had 8 applications but they were all available to you even if phone was dead. Yes, some of those applications might have had issues but standalone stuff worked (e.g. Authenticator). With the new firmware application is loaded only once you access it. If phone is dead, so are your applications. Yes, you might get some use of last running application but that is simply not enough. And lets me not get started about the time needed to enter the applications - it got much longer.

While slowness of the application access I can grudgingly understand, I cannot understand the freaking animation that take ages. And these animations are used liberally within the new timeline interface. Yes, at some places they might be needed to cover for bluetooth latency, but that just means application design is close to wrong if you need to chit-chat between phone and watch that much.

And forget about having multiple watchfaces if your mobile phone is dead. You will stay with whatever was last loaded. While I don’t change my watchface often under normal circumstances, I do so while traveling. As my travels are usually cross-atlantic, this also means I keep my phone turned off most of the time. Not being able to select between my standard watchface and one set at the destination’s timezone is annoying. More so because that used to work just fine with old firmware.

And don’t tell me this has to be like that due to the new interface. Even the first Pebble allowed for 8 applications in its memory. With Pebble Steel memory got doubled (while number of application slots remained the same). Even if we assume doubling of needs, we still could have at least 4 static application slots for the most important stuff (configurable).

And yes, even changing the menu order requires mobile phone as the new firmware removed on-watch menu editing too. Frankly, outside of slow and over-animated timeline interface, I cannot really think of the single thing new firmware actually improved. They just slashed mini features left and right.

I view this new firmware as a step backward whenever you need to use your Pebble as an independent device. Pebble used to shine when paired with mobile phone but it worked nicely even without it. New firmware ensures you need to have your phone turned on and next to you at all times. And even under the best of circumstances, the animations are going to seep the life out of you.

It might seem this text is harsh but I don’t think so. When compared to the other smart watches, Pebble excelled at being a comfortable thing you could use for prolonged amount of time (5 day battery) and not being dependent on a phone to work. With the new update only the long battery life remained. Yes, I am still fond of my Steel and I will keep it for a while longer. However, if it was to die today, I don’t think my next watch would be a Pebble.

File.OpenWrite Is Evil

.NET Framework is full of the small helper methods and I personally find this beneficial in general. They make code easier to read and most of the time they also make errors less likely. They also lend themselves beautifully to the quick troubleshooting one-liners as a nice, temporary, and concise solution. There is almost no greater example for that flexibility than File helper methods.

If you need to read the content of the file, just say

using (var fileStream = File.OpenRead(filename)) {
    //do something
}

Similarly, if you need to write something, equivalent code is

using (var fileStream = File.OpenWrite(filename)) {
    //do something
}

However, there is a trap in the last code chunk as it doesn’t necessarily do what you might expect. Yes, file is opened for writing, but existing content is untouched. To illustrate the issue, save first John in the file and then Mellisa. File content will be, as expected, Mellisa. However, if you save John again, the content will be somewhat unexpected Johnisa.

Once seen as an example, it is obvious computer did exactly what we’ve told it. It opened the file for writing and modified the content starting from the first byte. Nowhere did we tell it to discard the old content.

Proper code for this case would be slightly longer:

using (var fileStream = new FileStream(fileName, **FileMode.Create**, FileAccess.Write)) {
    //do something
}

This will ensure file will be truncated before writing the new content and thus avoid the problem.

Annoying thing about this helper is that, under normal circumstances, it will work most of the time, biting you only when you delete/shorten something. I believe there is a case to argue it should have been designed with FileMode.Create instead of FileMode.Write as a more reasonable behavior. However, as it goes with most of these things, decision has already been made and there is no going back.

QR Authentication Key

QR Authentication Example

Two-factor authentication is a beautiful thing. You have a key, apply a bit of TOTP magic and you’ll get an unique code changing with time. To use it just run a mobile application of your choice (e.g., Google Authenticator) and scan the QR code.

If you have a bunch of pre-existing keys in textual format (e.g., recovering after phone reinstall), wouldn’t it be really useful to generate a QR code based on them?

Fortunately, the key format is really well documented in the Google Authenticator repository. In its simplest form it is otpauth://totp/**LABEL**?secret=**KEY**. Simply swapping LABEL and KEY for desired values should do the trick - e.g., otpauth://totp/**Test**?secret=**HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ**.

To generate a QR code scannable by mobile phone application, any QR service supporting simple text encoding will do. I personally prefer goqr.me as they offer a lot of customization options and (supposedly) they don’t store QR data. Final QR code will be perfectly well read by any authenticator application out there and the key will be imported without any issue.

For the advanced scenarios, there are quite a few more advanced setting and tweaks you can do but this simplest format probably covers 90% of needs.