Sunday, October 30, 2016

Bash Programs, Task Scheduler, and Random Quote Notes

This is a brief extension to my last post with some implementation notes.

First of all, I use my flash drives mounted on my PCs to store certain portable or near-portable applications, including a launcher I've described in the past, Quick Cliq. It's fairly easy to build folders of applications and utilities in Quick Cliq. I can use a utility like Voidtools' Everything Search to quickly locate desired executables and drag/drop the executable to the command region of a new menu item. It's also easy to build a Microsoft utility folder. The command region has a set utility pull down region, with a System Shortcut option (about halfway down). Then you can pick and choose your key utilities through a pop-up selection, e.g., computer management, add or remove programs, services, and task scheduler. (Note that you can also script elevated privileges, e.g., on CMD prompt, by prefacing the command with RUNAS.)

To be honest, I never played much with Microsoft's Task Scheduler. I ran into puzzling issues in trying to schedule a Bash script as described in the last post. (By the way, it's not necessary to use the -c option.) Also, one of my licensed security software products identified my batch cover file for a Bash script as "malware" and expunged it from my system. Basically, I specify bash as the command and then type the Unix-style full path to the shell script in the parameter box, e.g., "/mnt/c/Users/Ro..../.../newquote.sh"  (note that there are sometimes issues with embedded spaces,  as in "Ronald Guillemette", so I'll typically include the fully qualified file name in double-quotes). After I created the task (with repeated intervals), I could run it manually from the scheduler, and it seemed to indicate an expected next scheduled run-time but didn't seem to launch at that time. It may have been one of those quirks which can be resolved by a PC reboot. However, I decided to use the system startup event option for the defined task and rebooted; the script is running without issue at expected intervals.

One of my gripes about the gmail signature feature is that I've got to change the signature manually.through settings. This is unlike the Mozilla Thunderbird client which more conveniently allows me to attach a (fixed) html page as the signature, e.g., newquote.htm, which my homegrown Bash script yields. I would obviously prefer functionality that doesn't require changing settings to generate an updated quote signature. However, there are ways to make the manual setting easier, e.g., launch the html file into one's browser and save it as a bookmark. Then copy and paste from your browser tab/page into the gmail signature block.

Finally, one can easily generate the html code needed for the formatted signature page through a full-fledged word processing program, like industry-standard Microsoft Word.  I then use Notepad++, a freeware text/programming editor, which reads and writes html code, to splice the code segments sandwiching the randomly selected quote in my shell script. I also use Notepad++ to modify my text quote file (one quote per line).

Saturday, October 8, 2016

Windows Update, New Bash Support, and a Qliner Quotes Alternative

If you read my last post, you knew I had installed the new anniversary update of Microsoft Windows on 3 of my 4 PC's (3 notebooks and 1 desktop), but the outstanding one is my workhorse PC. I tried downloading the patch and applying it manually (use of DISM and/or PkgMgr), Microsoft issued a fix-it script patch (which seemed to be tied to a class of users like previewers) which I downloaded but didn't help, and various tweaks suggested by others, including deleting a game folder and registry key. But after a couple of dozen or so attempts (and some of my experiences hauntingly paralleled others in forums (in my case the downloads would stop after about 10%, but in other cases update processes would complain of obscure corruption problems which I also attempted to track down)).

So finally yesterday I took up Microsoft's option of reinstalling a clean version of Windows 10 while keeping workfiles. (Nevertheless, I still took a system backup.) Of course, I had to spend considerable time reinstalling/configuring my applications.

One of the problems I ran into was reinstalling an application I've used in random quote email signatures, which I discussed in an earlier post. For some reason, I ran into a Net Framework compatibility issue. (The Qliner publisher, to the best of my knowledge, has abandoned the software with no recent updates.)

On the other hand, I discovered on a geek web post that Microsoft was implementing a (beta) subsystem for Linux (Windows features toggle switch via Control Panel) .  I've been professionally writing Unix shell scripts, a far more powerful, flexible alternative to Windows batch files, for over 20 years, and of course there have been PC implementations of Unix/Linux, including cygwin. This beta subsystem is not done by default; you also need to switch into developer mode via system settings (for developers section under Updates and Security). (Microsoft then downloads some of the Ubuntu Linux variant software and wants you to reboot thereafter.)

I'm not going to write a Unix shell script tutorial here. Let me simply outline a fairly simple solution. I took an html file with boilerplate before and after the random selection of a line from a quotes file ron2.txt (1 line per quote), which I had to used to customize quote selection in Qliner. I split the html file into two parts, test2 and test3. (Test2 includes the formatted signature header, and test3 has my name and contact information.) The key to my solution to selection of a random quote is the Ubuntu shuf.command.

I can call my Bash shell script newquote.sh  from a Windows batch file (newquote.bat):
bash -c "/mnt/c/Users/'Ronald Guillemette'/Dropbox/newquote.sh"
And here is the shell script newquote.sh:
#!/bin/bash
tpath="/mnt/c/Users/Ronald Guillemette/Dropbox"
cd "$tpath"
shuf -n 1 ron2.txt> nq
cat test2.HTM > new.HTM
cat nq   >> new.HTM
cat test3.HTM >> new.HTM
I have gone into Window task scheduler to have this task run every 15 minutes. I can easily modify the base source html file (for test2 and test3) and I maintain ron2.txt in Notepad++.

Sunday, October 2, 2016

Journal: 10/02/16

Embedding Podcasts in Blogger 

In my recent political post, I decided to embed an audio podcast of University of Chicago "grumpy" economist John Cochrane. Over the last 8 years I've used a number of alternative methods in html coding of players, etc. It's bad enough knowing that the source clip could be withdrawn without notice; I've dealt with Google player widgets suddenly unavailable.

It turns out the html code is quite simple (HT bloggerbuster):

<audio controls=""> 
<source src="http://files.libertyfund.org/econtalk/y2016/Cochranegrowth.mp3"></source> 
If you cannot see the audio controls, your browser does not support the audio element 
</audio>

Substitute your target source file URL in place of the red-typed example. Where did I find the link? In Chrome, I right-clicked/copied the file link from the play and/or download links at the Econtalk webpage.

USB Flash Drives Are Getting Cheaper

I suspect years from now today's prices for similar functionality will seem expensive, but I couldn't pass up 64 GB USB SanDisk flash drives selling for under $15 at Walmart and bought 3 for my backup computers. (The flash drives come with a limited version of EncryptStick (e.g., you are limited to a single vault); you can license the full license for about $12 the last time I checked; you can also make a conventional SafeHouse Explorer install portable by copying the binary to the stick. It's not just about transferring data between computers. I've configured a number of freeware portable applications to run off sticks. 

My Lazarus ASUS Went Into a Coma

There's some sort of a battery issue with my backup ASUS. I explained in a recent post that during my recent trip to Arizona, I had an issue with my primary HP laptop; I had booted up the notebook and was about to attach an external drive and make it my new primary when the ASUS went dead.

As I explained in a recent post, I saw a lot of customers reporting undoing the back cover and doing a hard reset (holding the power button for over 45 seconds) in conjunction with reinserting the battery. My brief unpleasant experience with ASUS tech support also focused on a hard reset.

I hadn't started the (fully charged) ASUS for a few days after starting it up for the first time in 2 months. I was discouraged to see it hesitate to come to life again and then a couple of brief flickers of light painting the screen. This time I held the power button for 45 seconds, briefly released and then gently touched the power button again, and the device sprang to life, as if the prior struggle had never happened. Although the laptop seems fully charged, it's clear to me the battery is a problem, but I still haven't purchased decent computer tools. Since then I've started up the ASUS daily without another. incident.

The Dreaded MS 0x80073712 Update Issue

It's truly annoying to find that the one of my PC's experiencing an issue with Microsoft's latest cumulative patch KB3194496 is my workhorse PC. It has repeatedly aborted at about 10% of the download. I still haven't resolved it  as I write; the usual techniques, e.g., deleting the files stored under Windows/Software Distribution, haven't worked, and the Windows Update troubleshooter has been unable to diagnose/fix the issue (oh, it reports that it's diagnosed and fixed maybe a half dozen issues, but same old same old). If and when I fix the issue, I'll address it in a future post.

Sunday, September 25, 2016

Journal: 9/25/16

Light Bulbs

Whatever happened to spiral (CFL) light bulbs? How I became aware of this is because my new apartment came without overhead lights for the living room and the bedroom. (I'm used to the former, not the latter; my last few apartments had a mounted ceiling fan/light fixture. So I had one floor lamp in my household goods but needed one for the bedroom. I went to Walmart yesterday and bought an inexpensive floor lamp, which of course did not come with any light bulbs; the package stated 33 W florescent spirals or 150 W 3-ways. It never occurred to me that Walmart wouldn't carry the light bulbs used by the floor lamps it was selling; in fact, I still have several spirals (different watts) in my home inventory, almost all of which I had purchased from Walmart or Sam's Club. (Now of course I know you can buy 33 W's online or perhaps from home improvement stores.) In my local Walmart, one side of an aisle is devoted almost exclusively to light bulbs, but incredibly I couldn't find a single spiral in the aisle. I tried looking in other aisles and finally flagged down a sales associate. He managed to fish out one spiral, a black shade light, in the aisle; another associate said some time back they had rotated out their spirals in favor of more conventional bulbs. I did find a small supply of compatible 3-way (standard bulb) GE bulbs and purchased 2 twin packs. (I was going to return the floor lamp until I noticed  the second alternative bulbs.)

My Lazarus Laptops

I have had some bad luck with laptops over the years, with an estimated lifetime of 2-3 years. Sometimes I had freakish water/coffee spill incidents. While in WV I had to buy a replacement HP after a splash wave from a spill (away from the laptop) messed up my electronics (it was still running, but after I powered it off, it wouldn't power back on). I needed to do some remote training/HR stuff via the Internet, so I went to Sam's Club. I had bought my ASUS laptop as a backup when I found my desktop, buried in self-storage from my move to WV, wouldn't start after my move to SC. I tried several times over to start up my desktop and was about to junk it when I noticed a sign of life from the desktop; I had some additional problems (including an issue with my copy of Rollback RX), but since then I deinstalled the software package, no issue. But I had the movers take the desktop on my recent move to Arizona.

On my first travel night (in Alabama), I noticed I could not start up my HP laptop. It had been in the laptop bag, but a spilled drink had seeped through the bag. Then to make matters worse, my ASUS, in my luggage, went dead in my Texas hotel room the next night. It booted up, but as I prepared to attach an external drive to work on converting the laptop to my primary, it went dead. (I mentioned in a post a few weeks back that I contacted ASUS support, but I was told my warranty had expired, and they would require at least $330 for a repair, while vendors priced a new machine for about $100 less.) I noticed in a Google search several people mentioned power issues with ASUS, which basically required extracting and reinserting the battery, easier said than done because the battery is not externally accessible.

So over the weekend, I once again took the HP out of its bag and tried again to power up. I was startled to see it power up; long story short, it is now operational although the battery won't charge up. I'm okay with that. The biggest pain was the Windows updates, including the big anniversary one. I've run into occasional stuck overnight issues with patches (what eventually works is deleting the software distribution folder contents after turning off 3 Windows services (update, background intelligent transfer, cryptographic) and then turning them back on). So that one failed a few times but finally worked yesterday.

Maybe pressing my luck, I looked at the ASUS again. I was startled to see a splash of light flicker over the screen; a couple of additional presses and another flash of light. Almost like lighting a campfire, I managed to stoke the notebook back to life. Just like the HP, I had to reinstall security software and do some catch up patching. I'm a little wary of  shutting down the ASUS, like a reawakened coma patient falling asleep again: will he wake up this time?

Playing More With Portable Apps

I recently purchased a 256 GB thumb drive and looked at some new launchers including Appetizer. I've written a prior post on Quick Cliq. One of the attractive things about Appetizer is you can import binaries comprehensively (you can then group the software icons into folders); QC provides a good way to configure system utilities (e.g., force shutdown) and it's easy to drag and drop executable files (e.g., via Search Everywhere) to new menu item command lines. In terms of portable apps, I've looked at services like Liberkey and PortableApps. (There is some overlap.) The nice thing is both services make comprehensive updates of downloaded applications a breeze.

Wednesday, July 13, 2016

Google Voice and the OBi200: Some Notes

There is an unwritten rule about dealing with Chrome and/or other Google technologies: when in doubt, deinstall/reinstall. For example, for at least the second time in recent weeks, I found my Remember the Milk gadget missing from Google Calendar over the weekend, and I had to log into my RTM account and click the link to reinstall the relevant gadget.

I've discussed Google Voice in a recent post.  To provide a little context, basically a Google Hangouts plug-in is installed/integrated with Chrome (you can also use Firefox) and appears as a green icon in your tray:

Without going into gmail (assuming Internet connectivity), you can double-click on the Hangouts icon and it launches into a Hangouts conversation search screen. I find if I click on "new conversation", the result reveals a phone icon to the immediate right in the search bar. At that point, I can search on partial/full names or phone numbers in Google Contacts (or enter a new number); Mousing over the selection reveals phone and message links.Click on the relevant phone icon, and it will launch a relevant phone keypad popup.

I've occasionally run into issues with Hangouts dialing. In some cases, calling the number seems to hang; in other cases, I've accepted an incoming call, but we couldn't hear each other.  I've found removing and reinstalling the Google Hangouts extension seemed to resolve my issue. (I've sometimes run into issues pulling information on certain contacts and found that I had to tweak missing Google Contact details, like missing name fields, so they can be searched.)

The functionality is, for most purposes, excellent; I occasionally run into annoying glitches like browser corruption issues or a disappearing Hangouts popup. But at other points I've missed the equivalent functionality of digital calling I had in my prior 2 residences: it's always on (assuming your Internet connection is live), and it's often easier just to dial a number than to go through a GV call setup. I just didn't think the Triple Play (cable, Internet, calling) cost was worth it in my latest move, since I don't do a lot of calls and the ones I do can usually be managed by my "unlimited" mobile package. As I described in an earlier post, this became an issue with some callers who disliked the quality of my mobile connection and frequent dropped calls. So Google Voice became my choice for a second, backup number. GV also has a nice feature of automatically messaging one's mobile phone with GV voicemail transcripts (and typically I can launch a return call from a voice number hyperlink).

CNET recently promoted a newegg featured buy on the OBi200; OBi200 is integrated with GV in a default setup. Recall that when you start up Google Voice service, you select a number in an eligible pool from a chosen area code. Three basic lines connect the device: cable to a network port on the back of your Internet router, phone line connection with your phone (I have a $20 corded speakerphone I bought at WalMart), and the unit power supply. You then set up an account at obihai.com and go through the documented process of configuring the device and integrating with Google Voice. (Note that GV does not provide 911 service, but there are workarounds.) You can also integrate other (non-Google) voice services.

The outgoing call feature worked like a charm: I click on my speakerphone button, and I got a welcome dial tone. However, the incoming calls didn't seem to ring my speakerphone (I tested with my cellphone). I did get one external caller on the speakerphone, but most I fielded through Google Hangouts. Other people seemed to have a similar problem, but I didn't see a resolution. I emailed obihai support.

In the phone configuration for Google Voice, there is a setup for Google Chat. It turns out you can delete this (there are buttons to edit and delete just below Google Chat), and GV will automatically regenerate the Chat setup. This seemed to clear up my issue with incoming calls.

Monday, July 11, 2016

Problem Solving: An Example of Using Tools To Enhance Software Usability

The context for this post is dealing with duplicate files. One of the add-ons I use for the Thunderbird email client is "remove duplicate messages". I've occasionally had hiccups, e.g., in downloading my core gmail account messages, to Thunderbird where the same messages apparently weren't purged on the server and get downloaded again. What the add-on does is checking for duplicate sets of messages and then provides a default filter which retains 1 email from each set and deletes the duplicates. (I've also discovered vendors may resend the same emails over time, so I also occasionally run the add-on in my other email folders.)

Now over the past several years I had retained over 200 CD's and later DVD's of various files I have saved over the years: family photos, pdf files, licensed software (e.g., my discontinued AskSam software), various audio files ripped from my CD collection, emails, etc, In many cases, I did not rename files, say 1.jpg downloaded from the Internet. Trying to manage my collections of files was difficult: I often had to use a tool like search everything to hunt for files. For example, after I had to migrate from a failed PC, I  needed to search for my license information to reinstall AskSam plus my backup copies of the software itself. (I maintain a couple of external backup drives which held individual media image contents.) (Yes, I'm aware I could maintain license information in a spreadsheet. In this case, the license number is maintained in an asksam ini file, which is what I actually stored.)

It took time and effort to consolidate the contents of the media images into two primary folders with subfolders. In the process, I ran into thousands of file name conflicts, which I resolved by a filefrogger rename utility on source files (e.g., on disk 200, I renamed 1.jpg to 1_200.jpg). I knew that I had perhaps hundreds, if not thousands  of duplicate files (not just names, but content).

The tool I chose to use in dedupping these massive folders is duplicate finder free. Now keep in mind that it's very possible there is functionality I may not know about in the free or paid versions, but I'm looking at what the design seems to suggest. I basically point to a file folder to do a search and initiate the scan/search. Eventually what pops up is a list of sets of duplicate sets, alternately color coded.  There are boxes to mark files for deletion. There didn't seem to be what I considered obvious default functionality, say, to retain the first record in each set, and if you are dealing with thousands of file sets, this is very tedious busy work. (After you mark files for deletion, you then trigger the delete functionality.)

In the interim, I was interested in how I could save in-process duplicate lists, e.g., if the generated duplicate list did not appear after a system bounce. I then discovered that in the File options there is export/import function for *.csv files. This was my aha moment, because I knew I could use spreadsheet functionality to manipulate the first (delete file mark) column.

The basic solution starts with the observation that the CSV file was in sequence by the set id column (I). This means that the problem is a variation of a control break program. For the purposes of this example, I'm using Open Office Calc, but similar steps can be adapted for your preferred spreadsheet product:

  • Open the exported CSV file in Calc by choosing the comma delimiter (which oddly enough is not default)
  • In cell A2 (the first data mark cell), enter a formula, e.g., =if (i2=i3; 1;0)  . Let me explain the logic: I'm intending to retain the last file of each set. So suppose record 4 (record 3 if you don't count the header record) is the last of the first set (ID 1). Record 5 would be the first of the second set (say, ID 2). So I4 != I5, which means A4 has value 0, while A2,A3=1.
  • Copy A2  and then paste it in A3:An  where n is the number of duplicate file records (including the header record). Suppose n=2000. Enter A3:A2000 in the selection box, right-click on highlighted cells and select paste.
  • Convert A2:An into values: using the same example, select A2:A2000, right-click Copy; right-click Paste Special (ensure the NUMBER and only NUMBER column format option is selected).
  • Save the revised spreadsheet in the original CSV format. Exit Calc.
  • Open up Duplicate Finder Free, import the revised spreadsheet. Now invoke the delete files option.

Thursday, July 7, 2016

When It Rains, It Pours

Literally. Like I had a 4-5 hour power outage earlier this evening. I did get a chance to use my Gooloo power bank described in an earlier post. I was initially confused when it didn't seem to charge my cellphone, but it had to do with a certain unwritten fact of life with my cellphone: if the phone is running too hot, it won't charge. When I run into a hot phone/charging issue, I'll power off the cellphone; if and when the phone sufficiently cools, it'll start charging.

It's amazing how the little details slip by until you're facing a problem. I had never put my electric utility's outage number in my contacts, and I couldn't get Internet services on my cellphone during the outage. (Obviously my cable Internet wasn't working.) I could find my utility's invoices in my email, but the invoices didn't include contact numbers.

But over the past day or so, I had been hit by a cluster of technical issues. One of them involved Google Voice which for some reason didn't seem to work: I was connecting to the call, but neither party could hear the other. I did a lot of checks on audio and tweaking of call properties, but for whatever reason, the problem wen away with a reboot.

I also ran into into a series of issues with my security software, including the same PC holding multiple licenses and certain functionality not working. Long story short, these problems reflected some trace files not purged by a simple deinstall. Now the vendor has a removal tool often referenced by security customer support agents in past chat sessions, but the Indian agents repeatedly ignored my complaints they were giving me invalid URL's. I eventually stumbled across a correct download link in some other user's post. These agents simply want to take over your PC and can't deal with deviations from their scripts.

In another case, I have licensed encryption software which works with USB sticks, like my 128GB one. The software has an option to install executables both on the PC and the stick. Somehow after an upgrade I ran into an issue trying to run the executable on the stick. Repairing, uninstalling and/or reinstalling didn't work; in fact, I would get cryptic error messages simply trying to start up the executable. Long story short, I used everything (desktop search) to look for encryption software  files not purged by the uninstall. After manually deleting all remaining trace files (post-deinstall), I was able to reinstall (including an option for the USB stick).

I had contacted tech support. They really don't reference uninstalls on their webpages other than a cryptic message about contacting them over upgrades. The support staffer finally emailed me a deinstall cleanup procedure AFTER I messaged him how I had resolved the problem.

Incompletely described uninstall/reinstall procedures are simply inexcusably bad usability problems. I managed to resolve both issues DESPITE tech support vs. BECAUSE of them. I have another freeware encryption software (Safehouse Explorer). I had seen references to using SE with USB sticks but was puzzled on how to install on the stick until I saw a brief reference on copying the executable from your PC install to the stick.