Strange Windows 10 / MS Paint Bug

My arrow keys were moving my mouse pointer. And, unlike all of the search results which said I had turned on some ease-of-use feature …

It seems like there is an odd bug between Windows 10 build 1903 and MS Paint. I had a pbrush window open and had selected some of the image (something I was pasting into a usage document). Somehow the “arrow keys move this selection around in pbrush” translated into the arrow keys moving my mouse pointer around everywhere else. Simply closing pbrush sorted the problem.

It’s not something I can reproduce at will — opening pbrush, pasting in whatever screen shot I’ve got in my clipboard, selecting and grabbing a section of it … and the arrow keys are not moving the mouse pointer. But some combination of this process has, twice today, caused the arrow keys to move the mouse pointer. At least it’s an easy fix 🙂

Git: Using Soft Reset To Clean Up Un-pushed Commits

I missed a file when I was cleaning up debugging lines. I made the change and included it in a second commit, but I’d rather not have two commits for the same purpose. I hadn’t pushed my changes yet, so these commits only exist on my workstation … which means I can reset and bundle the changes into a single commit.

Find commit number that is one before the duplicate debug logging cleanup — this is the point to which you want to reset. In my case, it is the commit start with b443348c

Reset there with “–soft” — this doesn’t change anything on the file system (i.e. I don’t have to clean up those debug lines again) but puts the changes back into the staging area.

Now those files are staged again, so I can make a single commit for removing debug logging from my code.

Voila! I can push these changes and not clutter our history with my error.

 

No Durians

We stopped by CAM International Market on Saturday to see if they’ve got bat nuts, find fruit I don’t find at the local supermarket, and pick up a few expensive-elsewhere items (sesame oil!). Scott spotted a large, pokey looking fruit and asked if we should get one of those. Durian, the sign said … and I had to stop for a second because I don’t think I’ve had those before. And then I remembered where I’d heard the name …

The Singapore subway banned them because the odor was so offensive. And some people loved the things. We did not get the big durian fruit. Or the smaller vacuum sealed pack of durian flesh. He spotted durian-stuff a few more times and kept asking if we should try that. Finally, we happened across some mochi balls with durian ice cream. If you’re going to eat something with a stench awful enough that a subway system would bother banning it … a bit of it in ice cream is probably the way to go, so yeah … we’ll try it. There were four balls, just enough for each of us to have one.

I diced up a few persimmons — something that I knew was sweet and tasty — as a chaser. One ball out of the package in a bowl, and it smelled floral with a hint of not-so-good onions to me. But my nose doesn’t pick up a lot of chemicals and I figured, honestly, I’d be among those who don’t notice the smell. Scott tried a bite. He gave Anya a bite (and why didn’t we think to record this? She make an incredible YUCK face before and after trying it). I tried a bite. It was not good. The flavor was very onion-y with a sweetness like caramelized onions. But onion and ice cream isn’t really something that goes together in my mind. Maybe durian with roasted pork, but dessert? Nope. And then the half-a-ball sat in its dish. It got stinkier as it warmed up. Until it was voted off the island and into the city sewers (sorry gators!).

None of this prepared me for the horror of durian burps. A terrible combination of sewage and onions coming back to haunt me. Or sitting next to someone with a durian burp and thinking the stench has somehow lodged itself in my nasal passages. It was a good twelve hours before I wasn’t experiencing durian again.

Which makes me wonder … What in the world does a durian plantation smell like? I have fond memories of driving along the Nile at sunset and smelling sugar cane on the air. Even if the smell is significantly reduced in the whole fruit, a whole plantation of the things baking in the sun?!? And what does this stuff smell like if it’s gone bad? Does it rot and smell better? Or is it sewage and gym socks without the floral undertone?

But it was an entertaining experience. We’ve all had our lifetime supply of durian. And there are still three of these things in the freezer 🙂

Displaying An Image Tooltip

JQuery developers seem to have put a lot of effort into filtering HTML components out of tooltips … which, as someone who visits a website … is A Good Thing. But what’s a good security consideration can be a massive pain when building a website. I have a form which takes an internal ID number, and I have an image showing people how to find that internal ID number. I want a little question mark after the field name that pops up the image as a tooltip on mouseover events. And clears the image on mouseout.

JavaScript:

// Show finding equipment ID image "tooltip" 
$('#ShowEquipmentIDTip').hover(
	function(){
        	$('#FindingEID').css({ "display": "block" });
    	}
	,function(){
        	$('#FindingEID').css({ "display": "none" });
    	}
);
HTML:
<div class="col-md-2 col-sm-2 col-lg-2 col-xs-2 text-left">
	<span><strong>Equipment ID(s): <a id="ShowEquipmentIDTip" href="#">(?)</a></strong></span>
	<div id="FindingEID" style="position: relative;top: 20;left: 60;width: 100%;height: 100%;z-index:99;display:none"><img src="/groomsGenerateCircuitReport/images/Tip-FindingEquipmentID.png" /></div>
</div>

Moving your mouse over the ShowEquipmentIDTip a element displays the div which contains my image “tooltip” and moving the mouse away sets the display back to none.

Simplified Outage Reporting

We’ve lost power the past few days — I think that’s because the forestry crew is clearing a few trees that are down on the power lines, but I don’t know so we report the outage. First Energy has a really cool way of reporting outages — you use SMS to register your phone with your account. Once the phone is registered to an account, you can text “OUT” to their short code. There’s a short code to register for outage notifications, status alerts. So when the power went out today, it took about three seconds to report the outage. No walking through the IVR to report the outage online. I hope to see more companies doing this in the future.

Recovering a bricked Netgear router

Netgear provides instructions for using TFTP to write firmware to a basically bricked router (it boots into a recovery mode, indicated by a flashing power light). The instructions are, unfortunately, specific to Windows. To use a Linux computer to recover the router

 

(1) Plug your computer into the router & unplug everything else, as in the instructions. Hard-code an IP address. Then verify that the router shows up in your arp table:

arp -a

If the router does not appear, add it — you’ll need to get the device MAC address from the sticker on the back of the device.

arp -s 192.168.1.1 ??-??-??-??-??-??

(2) If you don’t already have a TFTP client, install one. Once you have a client, follow the instructions to get the router into recovery mode. On the Linux computer, run “tftp 192.168.1.1”

You’ll be in a TFTP console. Type binary and hit enter to set the transfer mode to binary. Then use put /path/to/file.name to upload the firmware file to the device. Wait and proceed with device setup.

 

Shell Script: Path To Script

We occasionally have to re-home our shell scripts, which means updating any static path values used within scripts. It’s quick enough to build a sed script to convert /old/server/path to /new/server/path, but it’s still extra work.

The dirname command works to provide a dynamic path value, provided you use the fully qualified path to run the script … but it fails spectacularly whens someone runs ./scriptFile.sh and you’re trying to use that path in, say, EXTRA_JAVA_OPTS. The “path” is just . — and Java doesn’t have any idea what to do with “-Xbootclasspath/a:./more/path/goes/here.jar”

Voila, realpath gives you the fully qualified file path for /new/server/path/scriptFile.sh, ./scriptFile.sh, or even bash scriptFile.sh … and the dirname of a realpath is the fully qualified path where scriptFile.sh resides:

#!/bin/bash 
DIRNAME=`dirname $(realpath "$0")`
echo ${DIRNAME}

Hopefully next time we’ve got to re-home our batch jobs, it will be a simple scp & sed the old crontab content to use the new paths.

Understanding the law

It irks me how many government officials fail to understand the law (or, at least, make statements that are legally absurd). Today, Devin Nunes says he will sue CNN for defamation. Why? Because CNN reported that a lawyer for Lev Parnas said Parnas knows something about some meetings Nunes scheduled with former Ukrainian prosecutors (and Parnas is willing to testify before Congress).

What’s the requirement for a defamation case? (1) False statement and (2) malicious intent. If Nunes said he intended to sue Parnas, that would be reasonable — still have to prove that the statement was false and uttered with malicious intent, but at least Parnas could have made a maliciously false statement. But a defamation suit against CNN would be an assertion that CNN made up a conversation with Parnas’ lawyers and did so maliciously to harm Nunes.

I’m certain Nunes statement was dramatization — and a way to avoid answering when asked if he did have involvement with the whole Ukraine fiasco. But someone who is responsible for writing laws shouldn’t demonstrate such ignorance of those laws.