Wednesday, December 7, 2016

AbiathRPC - Change password

Today I added a way for AbiathRPC client users to change their passwords on the server. There is a new "RPC" menu that is only visible when connected to an AbiathRPC server; currently, its only item is Change Password. The resulting form has the user enter the current and desired new password. The server verifies the existing password and updates the user record with the new password. The password changes along with other configuration changes are committed to disk when the server exits.

I noticed that the AbiathRPC client crashes when reopening a remote level set after having closed one, so something isn't quite right with the disconnection routine.

Tuesday, December 6, 2016

Reading Word document properties in PowerShell

Word documents include some extra properties like "total time spent editing." These properties aren't visible in Explorer because they're just data in the file. You could use COM to interop with Word and read them, but it's not super hard to grab the data directly from the file.

Modern Word documents are just ZIP files, mostly containing XML files, both of which PowerShell can handle. This little script outputs the total editing time of a given Word document:

$zip = [System.IO.Compression.ZipFile]::Open($filename, 'Read')
$propsentry = $zip.GetEntry('docProps/app.xml')
If ($propsentry -ne $null) {
    $stream = $propsentry.Open()
    $reader = New-Object System.IO.StreamReader $stream
    $content = $reader.ReadToEnd()
    $xmldoc = [xml]$content
    $xmldoc.Properties.TotalTime
}
$zip.Dispose()

The time is measured in minutes.

Based on my Super User answer.

Monday, December 5, 2016

Volunteering at another FTC meet

This Saturday, I volunteered at another qualifying FIRST Tech Challenge robotics meet. Like before, I was a Field Inspector, but I also got to do Field Reset this time.

I started out with field inspections. There were 11 teams, most of which got through without any issues. Since this wasn't a league championship, outdated software was acceptable, so I just warned teams that needed to update that it wouldn't fly at the big meet. I was apparently the only Field Inspector, so when multiple teams came over at once, the Control System Adviser helped inspect some. There were a couple instances of robots not driving due to hardware profile mismatches, but those got sorted out and they were all ready by the time matches started.

Field Reset is much easier with this year's game than last year's. Here, I just had to move some large exercise balls back into the middle and put the small wiffle balls back on the sides. (As opposed to last year, where I had to pick up dozens of cubes and wiffle balls and then hurl them onto the field at the start of the next match.)

Unfortunately, the electronic beacons started failing after being buffeted by the robots throughout the matches. We tried to simulate them with volunteers holding alliance flags to indicate beacon color, but that was always a judgment call as to whether the robot actually hit the button. After the first of two sets of 17 matches, the teams' coaches convened and decided to reschedule the second set. That was for the best, since we were already more than an hour behind from the beacon trouble. Hopefully a venue and date can be found for this meet's thrilling conclusion.

Sunday, December 4, 2016

Using Chrome's --disable-extensions-except

As of version 55, Chrome supports the --disable-extensions-except flag, which as you might expect, disables all extensions except the one specified. The trick is that it has to be specified as a path to a folder containing an unpacked extension. For an extension you're building, that's easy, but for ones you got from the store, you have to hunt down the folder where they're kept. Chrome unpacks installed extensions here:

%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions

Inside are a bunch of folders each named with an extension's ID. Inside those are folders for versions of the extensions, and those are the folders that have manifest.json. Pass that folder to Chrome like so:

chrome --disable-extensions-except="C:\path\to\versionfolder"

Based on my Super User answer.

AbiathRPC - Make sure the connection gets closed

When a remote level set is closed, it's important that AbiathRPC clean up and realize that it's no longer supposed to be talking to that server. I already had an event handler on the Close menu item, but a level set can also be closed in the process of a new one opening, which bypasses that event handler. Fortunately, the level label is updated during the close process, so I added a check for the current level set being gone to the existing handler. If the main level set is missing, it initiates AbiathRPC disconnection, which cleans everything up.

Friday, December 2, 2016

Version number strings aren't automatically sorted as versions should be

Let's say you have some strings describing version numbers, like 1.1, 1.2, all the way up to 1.11. If you try to do a newer-version check using only string comparison, it will appear that 1.11 is older than 1.2. Most sorts sort those texts that way because "1" indeed sorts before "2", so it stops checking. (It doesn't think about numeric value at all.)

Instead, you should do some number comparisons. For example, using the SMBIOSBIOSVersion WMI property (a string) will be more difficult than using the SMBIOSMajorVersion and SMBIOSMinorVersion properties, which are integers.

Based on my Super User answer.

Thursday, December 1, 2016

Unbanned from Dropbox public linking

A while back, my Dropbox account's public links stopped working and stayed that way for a good long while. Eventually, I got in touch with someone via e-mail and explained the situation as I had done in the original ticket. The ban was indeed automatic; as I surmised, one of the executables I was hosting (unlzexe.exe) was considered malware by their system. Again, it's not malicious, but it does modify other EXEs, so it could be used for bad purposes. Abiathar uses it to decompress the Keen games' executables.

On September 6, Dropbox manually lifted the block. I am no longer hosting unlzexe.exe there, but Dropbox has continued to work well for my other resources.