Thursday, August 25, 2016

Fitting Data in Excel and OpenOffice Calc

I've stopped installing Microsoft Office onto my home computers. Instead, I installed OpenOffice on my latest two computers. It does everything I need it to do. Or so I thought.

One day I decided I wanted OpenOffice Calc to perform a polynomial fit to some measurements I'd been taking. So I did what I always do in Excel: create a Scatterplot of the data, add a Trendline, choose Polynomial and its order, and then click the checkboxes to display both the equation and the R2 value on the chart. Except there was no polynomial Trendline!

According to the OO help forums, there really is no built-in polynomial trendline in Calc. But there is an extension called CorelPolyGUI that does the trick.

Unfortunately, I wasn't too thrilled with this extension. My measurements were accumulating every week. With Excel, I'd be able to add new data and watch the scatterplot update the polynomial. But CorelPolyGUI doesn't work that way. The result from CorelPolyGUI essentially is a snapshot that's disconnected from the input data. To get it to update, I found that I had to delete the result and then re-invoke the extension with new data ranges. And that was a big problem – I wasn't sure over what extent of my data I wanted to fit. Perhaps I could get a better fit if I omitted some measurements. So I needed to alter the input range a few times and compare the results.

There is another method, that if you're clever, you can program yourself. It's based on the following set of equations (for a second-degree poly fit):



To get the values of A, B and C, you simply matrix multiply the vector on the left side of the last equation with the inverted 3 x 3 matrix on the right hand side. Once you program this into your spreadsheet, you can alter the data and instantly get the polynomial function to update.

But it turns out there's an even easier way. I found it accidentally in the results from my search for how to fit a polynomial in OpenOffice. It involves using LINEST to operate on array data. The web page^3 describes using LINEST in Excel to perform non-linear curve fitting. It turns out that the OpenOffice Calc LINEST function works the same way, albeit with slightly different syntax. And the syntax is different because of how you define an array in Calc, separating the elements with semi-colons instead of commas.

In retrospect, I see now the same solution in the OO help forums. The user Villeroy attached a spreadsheet with an example that uses LINEST. But instead of raising the range of independent values to {1;2}, he added the X2 column and referenced it in LINEST. Same thing, really, but perhaps a bit less elegant.

Wednesday, April 13, 2016

Must-Have Extensions For FireFox and Chrome

FireFox is my favorite browser.  It beats Chrome in terms of usability.  But I'm curious to see if I could live with Chrome for a while.  So I'm taking it for a test drive.

First for safe browsing, I like to have...
NoScript (FireFox) // ScriptNo/ScriptSafe (Chrome)
Blocks all scripts from running.  Allows the user to add exceptions for scripts on any given domain, either just for the current session (temporarily) or also for future sessions (permanently).  I think I like ScriptSafe on Chrome better than NoScript on FireFox.  Why?  Because NoScript will reload the page each time a single host is enabled, whereas ScriptSafe will let you enable multiple host before reloading the page.  And ScriptSafe features color-coded buttons while NoScript differentiates between temporary and permanent whitelist with italics.

WOT (FireFox) // WOT (Chrome)
WOT, or Web Of Trust, warns you in advance when a link leads to a dangerous website, before you even click on it.  The database of dangerous links is maintained by the community of WOT users.  But this sometimes can lead to sites getting blocked when a user disagrees with a site's ideology.  Still, you can get more detail on each website's rating and decide for yourself.


For usability, try these extensions...
FBPurity (FireFox, Chrome, Safari, Opera)
Facebook could be useful if only _______ (fill in the blank).  Well, FBPurity fills in the blanks by filtering out the elements that you don't want to see.  I use it to block "food pron" (plus other annoying and recurrent topics), to keep videos from auto-playing, to hide the reactions bar, to always sort posts in Most Recent order, to hide the newsfeed, etc.

LastTab (FireFox) // CLUT (Chrome)
N either FireFox nor Chrome cycle through tabs with Ctrl-Tab the way Windows cycles through active programs with Alt-Tab.  These extensions alter how these browsers behave when you press Ctrl-Tab.  So rather than cycling tabs from left to right, Ctrl-Tab cycles in Most Recently Used order.  There is one caveat, though.  Chrome extensions are not allowed to redefine default keystrokes (such as Ctrl-Tab), so none of the MRU-type tab managers on Chrome can fix Ctrl-Tab.  However, you can bind CLUT to Ctrl-q and Ctrl-Shift-Q, which is just to the right of Ctrl-Tab and Ctrl-Shift-Tab.

Password Management
Both Chrome and FireFox come out-of-the-box with the ability to remember the username and password needed to log in at each unique website.  However, FireFox can remember multiple usernames and passwords for any given site.  After looking for a Chrome extension to get Chrome to work this way (and failing), I thought I stumbled across an experimental option to enable the behavior.  But perhaps not, since the setting I thought I discovered doesn't affect this at all.  Rather, Chrome (at version 49) just started behaving the way I wanted it to!

View Selection Source
In FireFox, you can select content, right click on it and then choose a command to view the source code for that extension.  Chrome provides an "Inspect" command, but it reveals only the CSS details and not the complete HTML.  The View Selection Source extension for Chrome (or its equivalent) is necessary to see the snippet of HTML that's rendered by the browser for that selected content.  Yes, you can press Ctrl-U to view the source of the entire page in a new tab.  But then you have to search for the content you're interested in.  That's awkward, and it works only if the content can be pasted into the search bar.  The weird thing about the View Selection Source extension is that it doesn't come up if you search for it on Google Play.  I found the link in a post on the Help Center.

Save As... / Print To... PDF
Chrome has a built-in PDF printer that it calls "Save to PDF."  It works great, and there's no need to install a separate printer driver.  But you'll have to choose at least one of these three options to get FireFox to save a page as PDF, too.
  1. Install on your computer a PDF Printer Drive, such as PDFCreator or CutePDF.  (Both are free to download and use.)
  2. Install in FireFox a PDF printer extension.
  3. Use an online Web page to PDF service.
I like the first option, since the extensions I've come across either save the web page as a image or send the HTML over the internet to a server to perform the conversion.  I like the ability to select and copy text from the PDF, which is not possible with an image.  And when I generate PDF, it's usually to record a financial transaction, the details of which I'd rather keep on my local hard drive.

At one point I couldn't get the PDF printer drivers to work with FireFox.  Before giving up and switching to Chrome, I came across this Mozilla support page.  It turned out that resetting the print_printer setting fixed it.  As well, I've had to delete the prefs.js in order to solve a problem with the PDF coming out with all blank pages.

What are your favorite Extensions / Add-ons?


2016-07-09 LG Added the section "Save As... / Print To... PDF"
2016-06-13 LG Added "View Selection Source" paragraph.





Tuesday, April 12, 2016

Notes on Setting Up Windows 7

Recently I had to set up fresh installations of Windows 7 on two computers.  Here are some tips to make that process go a bit smoother...

1. Windows Update #1 -- Microsoft has released hundreds of recommended and important updates for Windows 7 since it was introduced.  All that data is a burden for Windows Update, and the update process can bog down on slower computers.  To remedy this, you'll want to download the update associated with KB3102810 first before you even check for updates.  Adjusting your computer's Power Options so it stays awake during the long update process may also help.

2. Windows Update #2 -- I wrote about this before.  Unless you want to upgrade to Windows 10, you'll want to hide the update KB3035583, or uninstall it if it already got onto your system.

3.  Gadgets -- Third party gadgets are no longer supported due to "serious vulnerabilities" in the Windows Sidebar.  You'll still be able to add the default Microsoft ones, such as "Clock," "Calendar," "Slide Show" and "CPU Usage" (my favorites).  But I also liked the third party "Network Meter," which I'd use often to verify download rates.  Since Network Meter is no longer available, I figured out that I can use ResMon to do something similar.  To have ResMon (almost) mimic Network Meter I minimize the various components in the left pane of ResMon and resize the window so that only the network graphs show up.  And I add a shortcut to ResMon.exe in my StartUp folder.

Do you have any tips for setting up Windows 7?  Please share them!

Saturday, March 26, 2016

Taking the Plunge

Several weeks ago I took the plunge and bought myself a cell phone.  This leaves my brother as possibly the only person in the USA who doesn't have one.

Many years ago I bought cell phones for both my wife and daughter.  But I scoffed at the idea of using one myself.  "No one wants to talk to me," I'd say.  As for emergencies, I'd say, "Everyone else has a cell phone.  I can ask someone to call for help."  And I could send texts via e-mail for free to my daughter's cell phone from my tablet.

So why get one now?  My motivation was not self-interest.  I got one so that my chronically-ill wife could get in touch with me easily in case she had a flare up.  As well, the tablet could send e-mail only when connected to a Wi-Fi network, so I'd have to struggle to find free public Wi-Fi in order to text my daughter.  Now that I have a cell phone, I can exchange texts with her wherever I happen to be.

Which cell phone did I choose?  Which plan?  Naturally, this Luddite was compelled to look for the cheapest and most basic phone and service.  But the Geek in me tempered that with technological requirements.  For example, since we already had two cell phones in use at our home, I looked for a device that would connect to the same (GSM) network.  I also wanted a device that could be charged through a microUSB port so that I could use a generic charger.  And I wanted push buttons, not a touchscreen.

I decided that for my needs, a pay-as-you-go plan would be far cheaper than a contract.  So I researched the plans and found out which providers used the network we were already using.  And I kept my eyes open at drug stores for those providers' phones.  And then I found a push-button phone, discounted 50%, for $4.99.  I bought it, despite the fact that I couldn't tell how it connected to its charger, and despite the nagging feeling that it was already obsolete.

Well, it turned out that it was obsolete -- I wasn't able to activate that $4.99 cell phone.  The company's customer service explained that the device wasn't supported in my area, and that they'd send a different one.  And the phone didn't have a microUSB, either. But I hoped that the replacement device would have one.

I waited, and I waited, for the replacement phone.  Finally, after two extra phone calls to customer service, which involved promises that I'd get it in two days, I got it.

They sent me an LG touchscreen phone.  I was initially disappointed about the touchscreen, but I tried to maintain an open mind.  "At least the device charges through a microUSB port," I told myself.  Also, this device had a "3x minutes, texts and data for life" plan associated with it.

It activated easily enough.  But something seemed wrong.  Every time I tried to make a phone call, the keypad would disappear from the screen as soon as the call connected.  So I wasn't able to "Press 1 for English" or anything like that.  (See, that's why I want a push-button phone.  Real buttons hardly ever disappear.)  Eventually, I figured out how to get the display to turn on.  If I held the power button down as if to turn off the phone, the screen would light up asking if I wanted to turn off the phone.  I could then respond "No" and gain access to the keypad without the phone disconnecting.

Even though I was able to use the phone, I decided that the phone was defective and needed to be replaced.  First, I visited the LG website and quickly found a customer service agent to chat with.  She "talked" me through the steps of rebooting the phone and then asked me to retest the phone.  It continued to misbehave, so she suggested that the proximity sensor was faulty and encouraged me to contact the provider to get the phone replaced.

I saved the chat text and sent it to one of the provider's customer service contacts, who again asked me to reboot the phone and try it again.  Finally, I got them to agree to send yet another phone, which arrived quickly and worked properly.

All of the sending and returning of phones, although time-consuming, was paid for by the provider.  I probably could have asked to have some minutes refunded because of all that I wasted while testing the phone, but I decided I was still ahead.

Eventually I bought more minutes and extended the activation period out 2 years.  I figured that the phone and service cost about $6 per month, assuming the phone lasts the entire two years.  So overall I'm pretty happy about it.  The only issue I have now is this: how do I carry the thing around all the time?

Wednesday, March 16, 2016

How About Never?

A coworker had just bought a refurbished computer with Windows 7 OS and was dutifully applying updates.  He noticed a new icon in the taskbar tray and clicked it.  The program presented him with the opportunity to upgrade to Windows 10.  It implicitly asked when would you like to download Windows 10?  The dialog box offered two buttons labeled "Upgrade now" and "Upgrade tonight."

How about Never?  That was not an option.

The Gwx.exe and GwxUX.exe programs make it easy for users to reserve their free copy of Windows 10.  They appear after the user applies the update associated with KB3035583.  And they disappear after the user uninstalls that update.

This "How To Geek" article describes it all in detail.

My previous post discusses why you might want to avoid upgrading.

Friday, July 31, 2015

The Windows 10 Giveaway

As of Wednesday Microsoft started giving away Windows 10.  What would you be giving away if you upgrade?  Privacy?  Security?  Performance? #UpgradeYourWorld

According to the Free Software Foundation1:
  • Windows' 10's privacy policy asserts the privilege to sell almost any information it wants about users, even creating a unique advertising ID for each user to sweeten the deal.
  • Microsoft announced that, starting with Windows 10, it will begin forcing lower-paying users to test less-secure new updates before giving higher-paying users the option of whether or not to adopt them.
  • Microsoft is reported to give the NSA special security tip-offs that it could use to crack into Windows computers.

"What am I supposed to do about it?" I hear you ask.

Close Windows, Open Doors
Close Windows, Open Doors


1 https://www.fsf.org/windows


Thursday, June 25, 2015

Undo the Default App Selection in Android

Here's the scenario....  Your Android device presents you with a choice of apps to complete an action with.  You're supposed to select the app and then select either "Just Once" or "Always."  Either way the app opens to complete the action.

If you selected "Just Once" you'll have to choose again the next time you need to complete that same action.  That might seem annoying.  But what if it's the wrong choice?  If you choose "Always" you won't get to choose again, at least not easily.  And if the app cannot complete the action successfully, what then?

According to many lame blog posts and webzine articles, it's "easy" to change your mind after choosing "Always."  They say to just press the app's "Clear Defaults" button.  Here's one such article on AndroidCentral.

Fortunately AndroidCentral is swarming with brilliant users who are much more sophisticated than the folks who write the articles.  I say "fortunately" because when I needed to change the option of using Photos for downloading an image file attachment, the article's advice was useless because Photos' "Clear Defaults" button was greyed out.

A user called Siddhartha Gupta suggested that to remove Photos as the default app, it's necessary to change the setting for Google+.  That didn't work, either.

A user called ChromeJob pointed out that there's "a 'reset app preferences' in the action overflow button. This appears to reset ALL default app choices at once."  If only it were that easy for me.  It didn't work.

The thing that finally worked for me was to revert to the factory version of Photos by pressing the "Uninstall Updates" button.  After doing that, I was presented with a choice of two other apps to use.  The idea to alter Photos' version came to me after reading a comment byGrillMouster who stated that "when any of those apps receive an update the ["Just Once" / "Always"] dialog will pop up again, even if you had previously set an app as the default."

If you want the very gory details of why Photos didn't work, please read on to find out what I was trying to do.

I had used Firefox to log in to an Exchange Server using an Outlook Web Access (OWA) client hosted on a web page.  I then opened an e-mail that had a JPG file attached to it.  When I attempted to download the attachment, OWA again wanted me to provide my username and password.  Photos was unable to handle that request (and neither was Firefox).  It was only by completing the action with ES File Explorer File Manager that I found out about the need to provide username and password.  I've included this detail in case there are others who are having trouble downloading attachments with OWA.

Saturday, June 20, 2015

My Recent Repair of a Laptop AC Adpater

Yesterday, my laptop wouldn't charge when I plugged it in.  The battery had drained overnight, so the laptop was unusable.  I quickly figured out that the AC adapter has suddenly stopped working.

My nearby Staples had a universal adapter in stock at 20% off, so I picked it up and was soon back in business.

But then I wondered why the "old" adapter had failed. The technician at Staples said that most fail due to a broken wire near the connector that plugs in to the computer.  I know that if you flex any wire enough that it will break.  But this computer was kept in the kitchen at home, and the cable stayed in one place most of the time.  I decided to take it apart and fix it.

Most of the repair guides for Laptop AC Adapters resolve a break or short in the wire at one of the ends of the DC cable.  One even recommends that you cut off the connector, and splice a new connector on, which is silly given that no casual user has a spare connector lying around.  This same guide says that if there's no voltage after cutting off the connector, the adapter is dead and you have to buy a new one.  Turns out, that's not true at all.

My repair approach was different.  I decided that I would crack open the adapter housing and then verify continuity from the circuit board to the connector with a DMM.  But as soon as I removed the housing, I saw the problem: Cold Solder Joints.  Whoever soldered the wires to the circuit board failed to thoroughly heat up both the pad and the wire.  So the solder didn't flow down the via hole and fully coat the wire.  This never would have passed inspection at my company.

I fired up my soldering iron and reflowed the three connections in less than two minutes.  It took at least five times longer for me to break open the housing.  Message to manufacturers of consumer electronics: If you won't bother to assemble the electronics properly, at least design the housings so that they're easy to take apart and put back together!  I glued it back together with RTV, and it's curing as I write this.

I've fixed several items with this type of reflow repair, including a fairly expensive audio receiver.  A soldering iron and the ability to use it can keep you from throwing out perfectly good electronics.

Tuesday, June 09, 2015

Free Excel Tutorial

I'm still using Excel 2003 at work.  It does all we need it to do.

And at home, Open Office's Calc is so compatible that I can forgo Excel completely, although I still use the Excel Viewer.

But there are some really neat features of the latest Excel.  I especially like Data Bars and Color Scales.

To learn more about them, I studied this Excel Tutorial from Udemy.

Some of the other tutorial sections were helpful, too.  For example, Pivot Tables have been updated.  What used to be Page Fields is now Filter.  And unlike Page, Filter allows you to choose more than one value.

Monday, April 27, 2015

Reverse the Order of Worksheets in an Excel Workbook

Today I found myself wanting to reverse the order of sheet tabs in an Excel file.  The VBA code snippet below does just that.

Sub Worksheet_Reverse_Order()
Dim MySheet As Worksheet
Dim i As Integer

For Each MySheet In Worksheets
Debug.Print MySheet.Index, MySheet.Name
Next

For i = 2 To Worksheets.Count
Set MySheet = Worksheets(i)
MySheet.Move before:=Worksheets(1)
Next i

For Each MySheet In Worksheets
Debug.Print MySheet.Index, MySheet.Name
Next

End Sub


Background...
I had been maintaining weekly status updates as Excel spreadsheets, all grouped into one XLS document.  Each week I'd add a new sheet to the right of the previous week's worksheet tab.

But due to a change in workflow, I now have to copy the new sheet into that workbook rather than create it in the workbook.  In order to keep placing the new sheet after all the others, it's necessary to scroll to the end of the list of sheets and select "(move to end)".

"It would be so much easier if the sheets were in reverse order," I sighed to myself.  The thought of dragging them into reverse order manually was, well, unthinkable.  And thus this VBA macro was born.

Sunday, October 12, 2014

When Flourescent Lights Go Bad

Fluorescent lights produce a lot of light for little power.  My kitchen lights, which use two T9 bulbs, are rated at 32W, 2400lm and 22W, 1400lm1.  The bulbs are expensive and not easy to find, but they supposedly last five years.

The problem is that the performance and longevity of fluorescent lights depends on the ballast.  This is an electrical module that conditions the current, and it's not 100% efficient.  Also the ballast will degrade and eventually need to be replaced.  Sometimes a faulty ballast makes itself evident when the light flickers, or when the light doesn't turn on immediately and you need to flip the light switch off and on to get it to light.  At this point the bulbs will burn out quickly.

The ballast is even more expensive and harder to find than the bulbs.  And replacing the ballast isn't meant to be done by the consumer, although a home owner who can replace a light switch or electrical outlet will be able to replace a ballast in about ten minutes if the fixture is designed well.

I mention all this because I again find it necessary to replace the ballasts in the two kitchen lights.  In fact, I was thinking of replacing these fixtures with new fixtures that have multiple sockets for standard (Edison screw) bulbs.  I figured this was a better long-range solution because it would allow me to use Compact Fluorescent Bulbs today and then eventually graduate to LED bulbs.  Never again would I need to search for the expensive ballasts and replace them.

But I did manage to find the ballasts for quite a reasonable price.  So it didn't make sense to replace them this time.  But in ten years, if I'm still in this house, I think I'll be buying new fixtures.


1 For a comparison of the lighting efficiency of various types of bulbs, please see https://en.wikipedia.org/wiki/Luminous_efficacy#Lighting_efficiency.

Thursday, August 07, 2014

Trials with an Old Computer

About six years ago, I mused about what to do with an old computer, a 500MHz Pentium III.  My idea was to reformat the hard drive (20GB) and install one of these operating systems: Windows 2000 (already obsolete); Windows XP (facing obsolescence); and Linux (Ubuntu, although I don't recall why I decided on that flavor).

I tried all three plus Dyne:bolic, a Linux variant specialized for music and video production on under-powered computers.  Here's how I fared....

Dyne:bolic was easy to try out, and I didn't have to reformat the Window NT drive to do it.  So I tried it first.  After downloading version 2, I burned the ISO image to a CD.  It booted up just fine and I ran it from the CD.  It performed well, but it was set up for a single root-level user, and it wouldn't "play" Flash content.

Next was XP.  The first problem I had was that I couldn't activate the OS, even though I had a valid key.  But I played around with it anyway during the evaluation period.  Just twenty minutes was enough to know it would be way too slow.

Then I installed Windows 2000.  This involved a lot of tedious business with multiple CDs for the OS itself, then Service Pack 6 and then more CDs with security software and utilities.  Everything went well until I installed the antivirus program and updated it.  After that, the OS would not start.

Finally I decided to give Linux a try.  Rather than download images files, I decided to search the local public library system for Linux books that had accompanying CDs.  And I limited my search to old books, too, since I really needed the installer to be on CD-ROMs and not a DVD.  There were some Red Hat Linux books, so I got one and tried it.  It installed and ran really well except for the web browser, Mozilla, which had me pressing Ctrl-Alt-Del and longing for Task Manager to come up so I could kill it.

Of these four options, Dyne:bolic was clearly the best.  Unfortunately, by the time I got around to realizing it, Jaromil released version 3.0.0, whose 1.6GB image now must be burned onto DVD, not CD.  (I can't find the CD that had version 2 on it. And booting from USB is not an option in this computer's BIOS.)  This latest Dyne:bolic is totally awesome -- I tried the Live CD on my main home desktop (a P4), and I created a small virtual machine on my work computer, which boots the image file.

In order to run D:B3 on my PIII, I need a DVD drive.  Since I had two on my main desktop, I removed one and installed it on the PIII.  But, alas, it didn't work.  The computer detected the drive, but it won't boot from it, and Linux won't mount it.  So I think the laser is shot.  I've encountered a few non-functioning DVD drives in this manufacturer's computers, so I really do think the drive is defective.  In fact I wasn't able to boot from the drive recently when it was in the P4 that I took it out of.

So this is where I am now.  I need a working IDE DVD drive, which are expensive and/or refurbished.  There are adapters that can convert a SATA drive to IDE, but that's an extra expense I didn't want to pay.  Plus, I'm not sure this small form factor case will have any room for it, although I can put the new SATA drive with IDE adapter into the main desktop and move the working IDE DVD drive from the main desktop to the PIII if I really had to.

If / when I clear this hurdle I'll check in again.  Hopefully D:B3 will still be available!

Sunday, July 06, 2014

Creative Door Repair

The back door of our home never quite opened and closed smoothly. It was necessary to lift the doorknob while closing it in order to prevent the bottom from scraping the threshold.

Very recently the upper hinge pulled completely away from the door frame.  My wife and daughter couldn't finesse the door closed any more.  I re-tightened the screws, but the holes for the screws had widened, so the screw threads no longer had enough wood to bite into.  The hinge wouldn't stay secure for long.

My first impulse was to replace the screws with longer ones of the same diameter.  But not finding any in my collection, I realized I would have to visit the hardware store.

I really enjoy going to the hardware store.  Not the big, nation-wide chain stores like Home Depot or Lowes, though.  I prefer the small, neighborhood shops that seem to carry the odd-ball bits of fixture parts that were used in our neighborhood over fifty years ago when our homes were built.  Our stores are usually staffed by a retired handyman or engineer.  Or maybe the guy just likes hanging out there, giving out free advice without even getting paid for it.

Alas I was too busy to make the trip.  So I busied my mind, thinking of alternative repair options while carrying out the many tedious chores I had to deal with.

My next idea was to plug the screw holes with wooden dowels.  In fact I had many ¼ inch dowel pins left over from an old wood-working project.  I could use those.  But because they were much larger than the screws and the holes, I'd have to drill out the holes first before inserting the pins.  And then I'd have to drill pilot holes into the dowels themselves so that I could get the screws into the pins.  And I'd probably have to use carpenter's glue to hold the dowel pin in place before drilling.

If I had much smaller dowels, I could simply stick them into the holes and jam the screws in.  This would certainly be enough to keep the screws fastened tightly.  But because I didn't have the smaller dowels, I'd have to go to the hardware anyway.

Finally the solution came to me.  I had all the dowels I needed right outside my door!  All I had to do was stroll through the wooded area of our yard to find the right size twig.  Which I did.  It took about 30 seconds.

One oak twig about four inches long was enough to fill all four screw holes.  I broke the twig into four pieces and inserted them into the holes and tightened the screws.

And now the door opens and closes easily, without needing to be lifted, and without scraping the bottom.

This to me is what makes home repair an art form.

Friday, June 13, 2014

Execute Text in MS Word Using the System Shell

I was writing a tutorial in Microsoft Word that describes commands that the reader is supposed to enter at the command prompt.  I thought it would be neat if I could run those commands from within Word to validate them as I entered them.

And so I came up with a surprisingly simple VBA subroutine that sends selected text to the shell.  It is quoted, below.  The code should be placed into a module in Normal.dot.

Note that I invoke two statements in the Shell.  They are separated by the double ampersands.  I combine them into a single string (strCmd) that I pass to the shell.

The first statement is to change to the current working directory, which I assume is the same directory that the Word document resides in.  This isn't fool proof, however.  One failure mode would be if someone were to start Word and create a new document without saving it to the hard drive before calling the routine.  Another failure mode would be if the Word document were to reside on a remote share through a UNC path, such as \\FileServer\ShareName\tutorial.doc -- it's not possible to CD into a UNC path.

The second statement is merely the selected text.

Also note that strCmd  is preceded by the Win32 command prompt CMD.EXE.  The "/D" switch makes sure that no "AutoRun" commands get executed.  The "/C" switch terminates CMD after the command is finished executing.  CMD is included because Shell isn't able to find DOS commands such as CD.

Sorry for the small font on this source code, but I wanted to ensure it wouldn't wrap.

Sub InvokeWithShell()
' Executes the selected text to using the shell
' 2014-06-09 LudditeGeek Created
    Dim strCmd As String
   
    If Selection.Characters.Count <= 1 Then
        MsgBox "Nothing Selected!", vbExclamation, "Invoke With Shell Macro Message"
    ElseIf Selection.Paragraphs.Count > 1 Then
        MsgBox "Multiple Lines Selected!", vbExclamation, "Invoke With Shell Macro Message"
    Else
        strCmd = Selection.Text
        Debug.Print "Invoking " & strCmd
        strCmd = "cd " & ActiveDocument.Path & "\ && " & strCmd
        Shell "cmd /D /C " & strCmd
    End If
   
End Sub

Saturday, March 01, 2014

Blackphone and Webroot

Friday on NRP, Morning Edition featured the Blackphone, a smart phone with privacy as its number one priority.  Also mentioned were Black, Boeing's super secure smart phone, and Webroot, a security application.

Read more at http://www.npr.org/blogs/alltechconsidered/2014/02/28/283523473/a-smartphone-that-tries-to-slip-you-off-the-grid.

Saturday, February 01, 2014

Disable Outlook's Junk Email Filters

After upgrading to Outlook 2010 over a year ago, it became apparent that its junk email filter continued to work even after we disabled it.

It took so long for me to notice because I use Popfile to categorize the email I download from my ISP's POP3 server.  Popfile would catch the most obvious spam before the Outlook junk email would process it.

But occasionally a message that Popfile marked as valid would end up in the Deleted Items folder.  Outlook's occasional false positive would make me wonder what was going on, but it happened so rarely that it was easier just to check for these false positives than to research the issue.  Besides, the corporate bulk mail filter running on the Exchange serve would stash things into the Junk Email folder, and I needed to check for false positives from that filter.

But then there was an incident that triggered an intra-departmental1 outcry about the issue.  It was the day that several messages from our Content Management System got flagged by Junk Email and then deleted, causing folks not to notice updates on a few project files.

We all dutifully set Outlook's Junk Email filter to Disabled.  But I continued to see valid messages from my ISP placed into Deleted Items.  Recently I obtained a few spare moments2 and quickly found a solution to the issue.  It was my favorite Outlook/Exchange website that I landed on.  Here's the link:

http://www.slipstick.com/outlook/how-to-disable-outlooks-junk-email-filter/

The text says to change the value in a registry key, but in my case, the key didn't exist, so I created it, first.

Only time will tell whether this works.  I will know for sure only if it doesn't.  I suppose I can find an old message that triggered a false positive and send it to myself, but the header of that message would be different from the original header.


1 The emphasis is on the part of the word that contains "mental".

2 A good way to obtain spare moments is to schedule a meeting right after another meeting, so that if the other meeting runs late, the participants will be milling around outside the meeting room.  After a while, you get a sense of which meetings will run the longest based on the topic and especially on whether certain coworkers will be in them.  Some meetings can run so late that the folks who mill around will disperse and take an additional five minutes to reassemble, assuming they haven't gone off to lunch or embarked on an early vacation or retirement.

Friday, October 18, 2013

Excel Hyperlinks -- Relative vs. Absolute Path

I rarely insert hyperlinks into an Excel spreadsheet.  So every time I do, I get burned by Excel's predilection for turning Absolute paths into Relative paths.

Here's the scenario...

I'll use Excel to create a flat file database on my local hard drive.  I'll include links to the file server on the network using UNC paths, such as \\File-Server\Share-Name\Path2File\MyFile.ext.  (The Ctrl-k keystroke is really handy for creating hyperlinks, BTW.)

After building the table by adding fields in columns, adding formatting, and entering a few records in rows for testing, I'll consider the database to be production ready.  At this point I'll upload it to the same file server that my links point to.

The next time a user opens the network version of that spreadsheet, Excel will convert those carefully-entered absolute links to relative links.  So if the spreadsheet resides in \\File-Server\NewShare\Reports\Databases\LG.xls, the links to MyFile.ext turn into this: ..\..\..\Share-Name\Path2File\MyFile.ext.  They work just fine while the spreadsheet remains in that location.

But suppose the user saves the database and then e-mails it someone else in the organization, or copies it to his or her local hard drive.  The links are broken.  Furthermore, there's no easy way to fix them.  Search and Replace (Ctrl-h) won't find the ..\..\..\ in the hyperlinks.  You'll have to either fix them manually or write a program to do it.  And then the same thing could happen again, anyway.

But there is (thankfully) a trick to keep Excel from bastardizing your carefully designed links.  But it's a preventive measure -- you have to know about the trick before you get stuck with the link conversion.

The trick is to open the File Properties dialog.  Choose the Summary tab and enter C:\ in the text box next to the label that reads "Hyperlink base:".  Be sure to OK your way out and save.  These instructions are for Excel 2000 and 2003.  Later versions probably have the same properties dialog, but the way to open it might be different.

Really, it's best to do this before entering any hyperlinks.  Ideally, Excel would have an Option for this.  But alas, all I could find was a checkbox to enable Excel to prompt for workbook properties.

Hopefully, by writing this post, I've seared this information into my brain so that the next time I'm tempted to enter a hyperlink, I'll remember to set this property.

Hmmm, it just occurred to me to code this property using VBA....

Saturday, September 28, 2013

Brain Games

What kind of Geek could resist an opportunity to improve his or her mind?  If there is such a geek, I am not that kind.

So when I heard the advertisements sponsorship acknowledgments on NPR for Lumosity, I decided to check it out.

Lumosity develops and offers online games that improve mental function.  Their aim is to enable anyone to achieve his or her full potential, brain-wise, at least.

Lumosity provides two tiers of service: free, and subscription.  Users of free accounts are restricted to just three games per day, while subscribers have access not only to unlimited games, but also Personalized Training, Performance Tracking, and comparisons to other Lumosity users.

Since I joined way back on June 1, I've improved slowly and steadily to match the ability of someone half my age, assuming that someone is a slug.  Haha.  Just kidding.  Actually I have no idea because I'm using a free account.  All I know is that four weeks ago my score was 1025 and now it is 1111.

See?

Here's my Brain Performance broken down into various categories:


So check out Lumosity. It's free. It's fun. And you might just gain enough improvement to survive the upcoming Zombie Apocolypse.

Monday, August 05, 2013

Outlook 2010 Macros -- Adventures in Getting Them to Work

In a post that included Outlook VBA code, I mentioned that I stopped using the macro because of Outlook's tougher security.

Today, I decided to try to eliminate the main problem that I had, namely an inability to run the macro except from within the VBA Project IDE.

Here's the scenario:  I have code that worked on Outlook 2000.  I assigned a toolbar button to call it.  But the toolbar button doesn't work in Outlook 2010.  Nothing happens.  Pressing Alt-F8 and clicking Run opens the VBA macro in the IDE and displays an error "Subroutine or Function not found" (paraphrased).  But then I can run the macro by clicking the play button.

One aspect of my solution was to make sure macros were not being disabled.  I choose to self-sign the macro rather than enable all macros.  First I used SelfCert.exe, which I found in the Outlook program directory (C:\Program Files\Microsoft Office\Office14).  SelfCert.exe can be used to create personal certificate -- it would work for me on my local computer.  After I created the certificate, I signed the macro (Tools | Digital Signatures | Choose).  After clicking OK, I immediately pressed Ctrl-sto save the macro.  And then I closed Outlook.  But when I did, it asked me whether I wanted to save VbaProject.OTM.  Odd.  First I responded No.  But when I reopened the VBA editor and checked for digital signatures, it reported that the macro was unsigned.  But answering Yes to the prompt to save didn't help either.  The macro still wasn't signed.

I wondered if the Read Only attribute had been set on VbaProject.OTM.  But no, I had Full Control rights on the file.  Yet, the file's timestamp was old!  It wasn't getting saved!  Ahh, but the old timestamp was a trick, an undocumented "feature".  According to this support thread, it was normal for the timestamp and file size of VbaProject.OTM to remain unchanged after a save.  (This is why the phrase "WTF?" was invented.)  I verified that the save was taking place by adding a comment to my code, saving, closing Outlook and then re-opening the macro.

After that little detour, I found that it was necessary for me to install the certificate in the "Trusted Root Certification Authorities."  This can be done deep within the bowels of the VBA editor.  Tools | Digital Signatures | Choose.  Click the link that says "Click here to view the certificate prope..."  Click the button "Install Certificate..." then Next.  In the next dialog box, click the radio button for "Place all certificates in the following store" then Browse.  Select "Trusted Root Certification Authorities" and then OK / Next your way out.  Save and close Outlook again.

BTW, every time you close Outlook, you should use Task Manager to verify that the Outlook process is not running.

Still the macro would not run except from within the editor.  But I found the solution in another thread.  My code was in a module.  After I moved it to ThisOutlookSession, I was able to assign an actual functioning toolbar button to it.

Whew!

It is very nice that even though I have other macros working that access the From and To properties of a message, I no longer get the annoying message box that warns me that my address book is being accessed and asks whether I want to allow that.


Saturday, May 25, 2013

Android Tablet Possibly For Sale

So far my tablet is leading me to the conclusion that it's not worth buying one.  While the portability of it is really neat, it's still not small enough to fit in any pocket, except perhaps a generous jacket pocket.  Sans jacket, I've stowed it inside my button-down shirt by opening one button, slipping it in, and then closing the button.  But during bouts of warm T-shirt weather, I'm forced to either hold the tablet or put it down somewhere when I'm not actually using it.

For example, when I went grocery shopping last week, I placed the tablet in the "seat" of the shopping cart.  When I was done shopping, and I had loaded the car, I returned the cart to one of the spots set aside for the empty carts.  As I walked away, I glanced back to make sure I didn't leave anything behind in the cart, and then I drove home.  And as soon as I got home, I wondered where my tablet was.  I realized I had left it in the cart.  And the reason I didn't notice it when I walked away from the cart was that it lay atop a store circular that had been folded over it by the wind.  Luckily it was in the same spot I left it.  But had I not been able to find it, I'd've not bothered to replace it or even miss it.  I might've felt a bit relieved.  In fact, right now I'm wondering how much I can get for it.

I like having a computer.  It enables me to communicate through e-mail, blogs, message boards and even social media.  And the mobility of it would be extremely fantastic if: 1) Free WiFi were accessible everywhere; 2) It didn't take ten times longer to compose meaningful content.  BTW, I'm typing this right now on a public library computer, even though I have my tablet with me and have access to free WiFi.  Even with the Nexus' Speech-to-Text feature and the Hacker's Keyboard, I still prefer to enter content through an "old fashioned" keyboard.

The marriage of location-aware note-taking and image capture that Evernote provides would be useful if the Nexus had a good-quality rear camera.