Thursday, July 21, 2022

Count Selected Items in Outlook

The modern Outlook status bar no longer shows the number of selected items. So some folks suggest that you select items and simply press Enter in order to trick Outlook into thinking you want to open all of them. And if you have more than four items selected, Outlook supposedly will pop up a warning that opening X number of items could take a long time.

But what happens if you accidentally agree to open them, or if the instance of Outlook doesn’t warn you, as in my case? Then you’ve wasted time opening emails and failed to get your answer.

No, it’s never a good idea to rely on an operation’s side effect; it could be eliminated in the next version!

What I do instead is surprisingly simple.  I just call the Count property of Selection.  This returns the number of selected items. I call the property with a message box that’s wrapped in a subroutine, which I link to a button on the Actions Menu.

This is all you need:

Sub CountItems()

MsgBox ActiveExplorer.Selection.Count & " items are selected", vbOKOnly, "CountItems() Message"

End Sub


It would be nice if there were an easy way to add a link to this on my shortcut menu.

Monday, July 04, 2022

Simple Washing Machine Improvement

A medium load of laundry had been taking over an hour to finish.  When I watched the tub fill with cold water, it looked like effluence from a down spout during a gentle summer rain shower.

I knew the machine had filters for the water, and I suspected they needed to be cleaned, but I wasn't sure where they were.  It turns out that the filters were easily accessible; all I had to do was shut off the water and unscrew the hoses at the machine.  Then just pull out the filters with a pair of needle nosed pliers.

When I did this, I saw that the cold water filter was extremely clogged with metal bits.  I get a lot of this kind of debris from my well water; it gets trapped in the faucet aerators, too.

I submerged the filter in a small cup of vinegar, shaking it vigorously, until it looked mostly clear.

The next load of laundry went so much more quickly.  An added benefit was that the solid dark clothes no longer were left mottled with a sludge of gray lint.

Have you ever cleaned your washing machine's water intake filters?  Do an Internet search to see just how easy it is!


Sunday, May 15, 2022

Losing Faith in America

I’m losing faith in our institutions.

First example is how the Federal Reserve thinks it can get inflation under control by raising interest rates.  If prices are higher now than they were one year ago, it’s mostly because they were so low before.  Recall that low demand in 2020 caused prices to fall sharply.  (In fact crude oil prices were actually negative1 in April 2020.)  Now we’re seeing low supply as a backlash from that effect.  Thus prices climb as demand returns to normal.  The higher interest rates may placate Wall Street investors, but it hurts anyone who needs to replace an automobile or relocate.

Second there’s Justice Samuel Alito’s draft proposal to eliminate the right to an abortion2.  In it he claims that the decision was “egregiously wrong from the start.”  So even the Supreme Court of today has no faith in the Supreme Court of five decades ago.  Sure, personal opinions change.  But law is built on precedent, isn’t it?

Third, and most troubling of all, is how the Federal Court in April struck down the CDC’s public transportation mask mandate3.  The person who brought the suit before the court has anxiety and complained that exceptions to the mandate did not apply to her.  In fact the mandate provides for a variety of exclusions that the plaintiff could claim, including “to catch [one’s] breath after ‘feeling winded’”.  The court decision is a blatant attack on science.

It won’t be long before we round up all scientists and engineers and burn them at the stake.


1 https://www.marketwatch.com/story/oil-prices-went-negative-a-year-ago-heres-what-traders-have-learned-since-11618863839

2 https://www.politico.com/news/2022/05/02/supreme-court-abortion-draft-opinion-00029473

https://storage.courtlistener.com/recap/gov.uscourts.flmd.391798/gov.uscourts.flmd.391798.53.0_1.pdf

Sunday, April 03, 2022

Excel -- Copy Only Visible Cells

Here's the scenario...

You've put considerable effort into eliminating "outlier" rows from a data table.  Now, you want to put a static copy into another worksheet or document.  So, just copy and paste, right?

Wrong.

When you invoke copy, Excel will put the entire range onto the clipboard, including any hidden rows.  So when you paste, all the outliers will be present as if you did nothing to remove them!

It shouldn’t do this, of course.  Or it’s totally unintuitive / lazy design.  But fortunately, "modern" Excel,1 provides a series of steps we can take to ensure only the visible cells get copied to the clipboard.

Here's what you do....

After you’ve selected the range that you’re interested in, choose Find & Select from the Home ribbon menu, then Go To Special, and Visible cells only.  OK your way out.  

Here’s a link to the page that offers Microsoft’s solution:

https://support.microsoft.com/en-us/office/copy-visible-cells-only-6e3a1f01-2884-4332-b262-8b814412847e

BTW, if you use LibreOffice Calc, you’ll need an extension to enable this behavior.  Here’s a link that describes the extension and how it functions, although it has mixed reviews:

https://extensions.libreoffice.org/en/extensions/show/copy-only-visible-cells


1 Version 2007 and later.

Saturday, July 10, 2021

Air Conditioning

I used to get head colds and sinus infections in Winter.  But now, thanks to modern air conditioning, I can  suffer from them in Summer, too.

Saturday, April 25, 2020

Measure Your Laundry Detergent

The cap on a bottle of liquid laundry detergent doubles as a measuring cup.

Most brands instruct the consumer to "fill to line 1 for medium loads." Line 1 on this cap is about 1cm from the bottom, as shown in the photo below.

As well, when you put the cap back on the bottle, the cap and bottle are designed so that any residual detergent that remains in the cup drains back into the bottle.

I thought everyone knew that until the day I saw my wife pouring the detergent directly into the washing machine. Not only do you waste money using more detergent than you need to, the excess detergent produces lots of suds that muck up your drain pipe.

If you want to reduce your ecological footprint, this is one way to do it.

Thursday, January 23, 2020

View Internet Header of an Email Message in Modern Outlook Client

One should always examine the Internet Header of a suspicious email.  Yet, when Microsoft upgraded Outlook, this has become more difficult than just right-clicking and choosing View Header.  Instead, you'll first have to open the message (a cringe-worthy action), and then navigate to File and Properties as described here.

I can never remember the procedure.  Besides, I want to see the header before I open the message!

So I wrote a macro that displays the beginning of the header in a message box.  Then it offers the choice of whether to copy the header content to the clipboard, which would allow for pasting into a new message to the IT department (for example).

Then I added a button to Quick Launch and bound it to the macro.  The upshot is that I can select the message in my Inbox list of messages, press the button, and see the header!

Here's the code, which I couldn't have completed without the help of the Slipstick code sample.  Please be careful of unintended wrapping of code, particularly for the value of PR_TRANSPORT_MESSAGE_HEADERS constant!

Sub HeaderReview()
' Copy Message Header contents of selected Mail Item to the Windows Clipboard.
' See: https://www.slipstick.com/developer/code-samples/outlooks-internet-headers/
' 2020-01-23 LG  Created from CopyToClipboard dated 12/13/04

Dim objCB As New DataObject ' Clipboard object
Dim ol As New Outlook.Application
Dim oe As Outlook.Explorer
Dim mi As Outlook.MailItem
Dim strMH As String ' Mail Header

Set oe = ol.ActiveExplorer

If oe.CurrentFolder.DefaultItemType = olMailItem Then
    Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
    Dim olkPA As Outlook.PropertyAccessor
    Dim i As Integer
    Set mi = oe.Selection.Item(1)
    Set olkPA = mi.PropertyAccessor
    strMH = olkPA.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS)
    Debug.Print strMH
    i = MsgBox(strMH, vbYesNo, "Copy Message Header to Clipboard?")
    Select Case i
        Case vbYes
            objCB.SetText strMH
            objCB.PutInClipboard
    End Select
Else
    MsgBox "Sorry, HeaderReview() supports only Mail items at this time.", _
    , "HeaderReview() Help"
    
End If

End Sub

Thursday, November 21, 2019

Open Org Mode Links With Default Windows Application

I've been using Org Mode for several years.

One Org Mode quirk is that the links in Org files always open in the Emacs editor, by default.  Click a link to Emacs_reference_card_v25.pdf on your hard drive and you might end up with a buffer that starts with this content...

%PDF-1.5
%    
3 0 obj
<<
/Length 4340      
/Filter /FlateDecode
>>
stream

I finally figured out a way to tell Emacs to open such "external" links with the default Windows application.  The multi-part solution involves first specifying all such links with a Special Prefix.  I chose "file:".  It's lame, I know, but it's also how you'd prefix an address for your web browser to open a local file.

So, for the PDF above, the link would look like this:
file:C:\emacs-25.2_64\doc\Emacs_reference_card_v25.pdf

The second part of the solution is to figure out which application on Windows you'd like to use to open the file "properly."  Rather than specifying multiple programs, such as a PDF reader for PDF files, a spreadsheet program for XLS/ODS, a word processor for DOC/ODT, etc., I decided that the single Windows command START already knows how to open all the programs on my computer.

If you were to enter the following in a command prompt, the program associated with the PDF extension would open the target file (assuming the file exists).

START C:\emacs-25.2_64\doc\Emacs_reference_card_v25.pdf

But there's a slight complication.  If the link contains a space or other delimiting character, you'll need to surround the file path with quotes like this: "C:\Path With Spaces\My PDF.pdf".  Unfortunately, START interprets quoted content as the title specification. Therefore, invoking the following would merely open a command prompt window with the title C:\Path With Spaces\My PDF.pdf

START "C:\Path With Spaces\My PDF.pdf"

So to get START to work as intended, you'd want to invoke it thusly:

START "DUMMY_TITLE" "C:\Path With Spaces\My PDF.pdf"

So having figured out the proper way to open file links, we create a function to implement it:

(defun ludditegeek-open-ext (path-to-media)
 (shell-command (concat "start \"ludditegeek-open-ext\" " path-to-media)))

Note that I chose to use the function name as the text for the title.  No matter, if all goes well, START will close the command prompt after it carries out the command -- most likely you'll never see the window.  For debugging, you could include the /WAIT switch, in which case you'll see the window, and the application will be listed in Task Manager with the title included.

Another thing to note here is that strings are defined in Lisp as characters enclosed in double-quotes.  But the title also requires double-quotes!  So I used a backslash character to escape the double-quote characters that are used to define the title.

The third part of the solution is to employ org-add-link-type to define the "file" link:

(org-add-link-type "file" 'ludditegeek-open-ext)

I call it with eval-after-load.  Here, finally, is what you can put in your .emacs:

(eval-after-load "org"
  '(progn
     ;; Create links in Org thusly:
     ;; [[file:/path/to/ppt.pptx][name of ppt]]
     ;; [[file:"/path with spaces/to/pdf.pdf"][name of pdf]]
     ;; [[file:/path/to/video.mkv][name of video]]
     (defun ludditegeek-open-ext (path-to-media)
       ;; Use Windows start command to open default application.
       ;; Note that first parameter to START is the command prompt window's title,
       ;; necessary for links that are enclosed in "", such as links with spaces.
       (shell-command (concat "start \"ludditegeek-open-ext\" " path-to-media)))
     (org-add-link-type "file" 'ludditegeek-open-ext)
     ))

I hope you find this useful!

Thursday, October 17, 2019

Quickly Delete Many Excel Worksheets

In "Reverse the Order of Worksheets in an Excel Workbook" I show a VBA module that I wrote in order to reverse the order of several dozen worksheets in an Excel file.

Each tab contains a summary of data for a week.  After a few years, I had amassed over 100 worksheets.  So I decided I would split the workbook; each one would contain only one year's worth of data.  The workbook for 2018 would have only the 2018 worksheets; 2017 workbook, the 2017 worksheets; etc.

I copied the massive workbook to a 2018 workbook, from which I'd delete all but the 2018 worksheets.  Ditto for 2017, 2016, and, oh yes, 2019, as well.

Unfortunately I found this to be exceedingly tedious.  There didn't seem to be a way to delete multiple worksheets quickly and without many keystrokes and/or mouse clicks.  At best, I was able to select the six tabs that could be displayed at one time by clicking the left-most tab and shift-clicking the right-most tab.  Then I could right-click and delete the selected tabs.  But I'd have to do that about 20 times for each workbook!

So instead, I wrote the following VBA module to do it effortlessly.  Note that each worksheet is named with the date in YYYY-MM-DD format.  (So the worksheet for today would be named 2019-10-17. ) This module was used to delete all the 2019 worksheets.  Rather than write a nested loop to cycle through multiple years, I decided to change the year in the code manually.

  Sub DeleteNewWorksheets()
      ' 2019-03-24 TG  Created to clean up status records
      Dim Sheet As Worksheet
      Dim Book As Workbook
      Dim n As String
      Dim alerts As Boolean
      Dim i As Integer

      alerts = Application.DisplayAlerts
      Application.DisplayAlerts = False
      Set Book = ActiveWorkbook

      i = 0
      For Each Sheet In Book.Sheets
          n = Left(Sheet.Name, 4)
          If n = "2019" Then
              Debug.Print "Deleted " & Sheet.Name
              Sheet.Delete
              i = i + 1
          End If
      Next

      Application.DisplayAlerts = alerts
      MsgBox "Deleted " & i & " sheets.", vbInformation, "DeleteOldWorksheets Notification"
  End Sub


Saturday, June 15, 2019

Plunging Into Celsius

“What is that in Celsius?” asked my European coworker on the other end of an international conference call.  We had started the call by saying how cold it was in the Northeast, -21°F exactly, so I was already asking Google to convert it for me.

“About -30°C,” I replied, not missing a beat.

That’s when I asked myself, “Why do I still use the Fahrenheit temperature scale?”  I decided to switch the units on my favorite weather app and take the plunge to Celsius.

“Isn’t switching to Celsius hard for an old person like you?” you might ask.  Well, I know that water freezes at about 0°C and boils at about 100°C.  Also, I was already accustomed to using Celsius at work, so I knew that room temperature is about 25°C, at least for a warm room.  (I allow my house to stay much cooler in Winter.)

Given these three F-C equivalents, it’s easy to deduce temperatures that lie between 32°F (0°C) and 77°F (25°C) by using ratios.  For example, 12°C, a temperature that is halfway between 0°C and 25°C, is also halfway between 32°F and 77°F, and that’s 55°F.  Likewise, the “quarter points” are 6°C (44°F) and 18°C (66°F), a typical room temperature in Winter.

Below 0°C, I rely on the fact that for every one degree change in Celsius, there is a 1.8° change in Fahrenheit.  As well, for every 2°C change, we experience a 3.6°F change.  So -4°C would be about 7°F below 32°F, or 25°F.

On the upper end of the weather temperature scale, you might get a 35°C forecast, which is 10°C higher than room temperature, or 18°F above 77°F, or 95°F, which (unfortunately) my European coworkers experienced recently.

Have you guessed that I dislike warm weather?

I’m not sure I’ll bother using Celsius in cooking or baking.  First, if I change the units on the oven, my wife will be very upset.  But then I’d also have to convert all the recipes we’ve accumulated.  I don’t see any point in that.

So will you also switch the units in your weather app from Fahrenheit to Celsius?

Saturday, June 08, 2019

Pandora Music Streaming Tweak -- Change the Station Image

I've been a Pandora subscriber since 2006, and I have a couple of well-tweaked stations.  But one of my favorite stations was stuck with the ugly album art of the song that was used as the station seed.  I couldn't find a way to replace the image, and Pandora help had nothing to offer.  So here's how I changed the image:

  1. Log in to Pandora.
  2. Select the station from your collection.
  3. Click the icon to edit the station. (At this time, it looks like a pencil.)
  4. From here you can change the station Name, Description, and Thumb History, but most importantly, the "Seed" that the station evolved from, which is in the section called "Station Created From."
  5. (If there are multiple "seeds" in this section you can skip this step.)  Click "+ Add Variety" to add a new "seed" and choose a favorite song whose album cover you prefer.
  6. Delete the top-most "seed" to set the album cover from the next "seed" as the station image.
  7. You can continue this process until the "seed" that has your favorite album art occupies the top spot.
  8. At this point, you can add back the deleted "seeds" as described in step 5.  But for a mature station, you probably don't need to do this, especially if you've been diligent with the thumbs up button.

Thursday, August 09, 2018

Show Column in Outlook With Email Purge Date

If you're running Outlook in an Exchange environment, and the administrator has defined a Retention Policy, you can use the following kludge to configure Outlook to display a column of dates that the emails will be deleted on.  It's a kludge because the configuration doesn't actually retrieve the Retention Policy from Exchange -- it's up to you to find out what it is and then add it to the configuration.

Select your Inbox and then right click on the message list header and select Field Chooser.


Click the down arrow next to Frequently-used fields and scroll down to User-defined fields in folder.

Click New... and then enter PurgeOn in the Name box, and scroll down the Type box and select Formula.

Enter in the Formula box the DateAdd function that will return a date that's X number of days or months after the message Received date.  For example, if the Retention Policy is 18 months, enter this into the box: DateAdd("m",18,[Received]).  (The first parameter "m" specifies "Month" as the interval.  The number in the second parameter defines the number of intervals, or months in this case.  The third parameter represents the each message's received date.) Then click OK.



Drag the new PurgeOn field that you just created to the header in the position that you'd like the column to appear.


Close Field Chooser and resize the columns so that the dates in the new PurgeOn field display properly.


Note that the dates in the PURGEON column are 18 months later than the dates in the received column.

Unfortunately it seems that each folder (Inbox, Sent Items, etc.) requires its own User Defined Field. The [Received] field is appropriate for use in the Inbox. You might use DateAdd("m",18,[Sent]) in the Sent Items folder.

Again, this is a kludge. If an administrator changes the Retention Policy on the Exchange Server, your new field will ignore the change and blithely continue to show dates based on the old policy.  It may be possible to write a VBA procedure that would run on startup, retrieve the Retention Policy from Exchange and define the PurgeOn field programmatically.  Let me know if you get that working!


A subset of this solution appeared on Microsoft TechNet on 2018-08-09.

Friday, April 13, 2018

Too Much Soap – Too Much Trouble

The effect of using too much laundry detergent makes for a funny, suds-filled scene in the movies.  But the real problem occurs the next time someone does laundry.  All those suds fill the drain line causing turbulence during the rinse cycle, which leads to an overflowing filler tube and a flooded laundry room.

I’d been trying to get my wife to measure the detergent with the cap according to the label.  But she always felt the need to do it her way.  And her way has been to pour the detergent directly into the washer tub, as if adding creamer into coffee.  We’d usually get some overflow in the drain line, and suds would emerge in the adjacent shower.

It’s for this reason I would always buy the cheapest (most watered-down) detergent.  Unfortunately, one day she decided to buy some ultra-concentrated product.  The flood from repeated washings was significant.

I cleaned it up and then set up an electric heater to dry out what I couldn’t remove.  In order to plug in the heater, I unplugged the washer.  So my wife was prevented from running the washer for a few weeks.  That gave me time to snake the drain line (just in case) and run several wash loads with the correct amount of soap.  After a couple of loads, the machine drained better than it ever had before.  I left it this way for a couple of weeks.  In fact, she got mad about that – she wanted to do laundry herself.  Imagine, someone offers to do the laundry for you and you get mad because you can’t do it yourself!

Eventually she settled down enough that she was willing to show her the proper way to:
1. Read the label.
2. Pour the correct amount into the measuring cup.
3. Pour the measured amount from the cup into the tub.
4. Not rinse the cap under the running water.
5. Load the tub right away with clothes.

The last two points are also important.  If you place the cap under the gushing water, suds will form.  Also, if you don’t put the clothes in right away suds will form.  I actually add the detergent after loading all the clothes, making sure to pour it into the water farthest from the water source.

It was amazing that my wife watched and listened to me patiently while I demonstrated the correct way to do laundry.  I didn’t think it was possible.  But it happened, and it felt like my birthday, Christmas and Father’s Day all lumped into one!  Even more amazing is that she’s been doing a lot of laundry over the past couple of weeks, and we’ve had no overflowing water or subs in the shower.  Still, I’m keeping the ultra-concentrated detergent out of sight indefinitely.

Saturday, November 18, 2017

How to Use Excel Pivot Tables to Summarize Continuous Data

Suppose you have a set of data points that represent some quantity in a volume.  It could be temperature in a solid, for example.  How can you use a Pivot Table find the average temperature in a region on the solid’s surface?

Well, if you’re lucky, the region is rectangular, bounded by some Xmin and Xmax and Ymin and Ymax.  Then you can use the built-in Label Filters.

I created a set of data for this article with -20<=X<=20, -20<=Y<=20, -20<=Z<=20.  The temperature is a function of X,Y,Z using the (arbitrary) formula =2.5*X+0.25*Y^2+2.5*SIN(Z).

First, set up the Pivot Table and chose the option to Allow multiple filters per field.


In the screenshots below, we define a Region with Label Filters in the PivotTable Rows within X=[-2,8] and Y=[5,7].  The function is not dependent on the Z coordinate – we’ll use a Page Filter to constrain Z to 0.  As can be seen in the status line of the fourth screenshot below, the average temperature in that region is 16.67 degrees C.






But suppose the region is more complicated than a rectangle, or you want to summarize multiple regions?

You can define a function in VBA to “discretize” the data, as shown in the code sample, below.
Option Explicit

Function Region(rngX As Range, rngY As Range, rngZ As Range) As String
Const regA_Xmin = -2#: Const regA_Xmax = 8#
Const regA_Ymin = 5#: Const regA_Ymax = 7#
Const regB_Xmin = -6#: Const regB_Xmax = -3#
Const regB_Ymin = 5#: Const regB_Ymax = 7#
Const regC_Xmin = -2#: Const regC_Xmax = 8#
Const regC_Ymin = -5#: Const regC_Ymax = -3#
Const regD_Xmin = 9#: Const regD_Xmax = 12#
Const regD_Ymin = 5#: Const regD_Ymax = 7#
Const regE_Xmin = 16#: Const regE_Xmax = 18#
Const regE_Ymin = -15#: Const regE_Ymax = -7#
Dim x As Double, y As Double, z As Double

x = rngX.Value: y = rngY.Value: z = rngZ.Value

If x >= regA_Xmin And x <= regA_Xmax And _
   y >= regA_Ymin And y <= regA_Ymax Then
        Region = "Region A"
ElseIf x >= regB_Xmin And x <= regB_Xmax And _
       y >= regB_Ymin And y <= regB_Ymax Then
        Region = "Region B"
ElseIf x >= regC_Xmin And x <= regC_Xmax And _
       y >= regC_Ymin And y <= regC_Ymax Then
        Region = "Region C"
ElseIf x >= regD_Xmin And x <= regD_Xmax And _
       y >= regD_Ymin And y <= regD_Ymax Then
        Region = "Region D"
Else
    Region = "NA"
End If

End Function

The function accepts three Range type parameters, each of which are intended to be the address of a single cell.  It returns one of five strings: Region A, Region B, Region C, Region D, NA.

The first four constants that are defined in the first two lines are minimum and maximum X and Y coordinates for the region that were defined in the previous example with Label Filters.  So the string “Region A” is returned if X and Y are within those X-Y intervals.

When we type in cell E2 =Region(A2, B2, C2) and then fill down, Excel calls the function for each of the cells that the formula occupies and then puts the result in that cell.  It can take several seconds for all the cells to be populated, even with an i5 processor.  And the calculation can increase the drain on the battery if you’re doing this unplugged / on the road.

But when it’s complete, you can set up your Pivot Table with the regions in the row.  The average of the temperature values for Region A is shown in cell B5 below as 16.67.



Wednesday, November 01, 2017

Introduction to CLCL Tools

CLCL is the clipboard manager that I prefer.  But it’s lacking in extensive documentation, at least for those who don’t know Japanese.  I figured out how to configure the Tools that it comes with, so I thought I’d share that with you.

This procedure assumes that you already know how to download, install and run the main program.

Download the Tools from http://www.nakka.com/soft/clcl/index_eng.html .  There are two ZIP files (tltxt002_eng.zip and tlutl002_eng.zip, as of this writing) that provide DLLs with the functions that serve as tools.  Copy the DLLs from those ZIP files into the directory in which the CLCL executable resides.  While you’re at the Nakka website, you might as well download the other ZIP files that provide ability to manage as wider range of file formats.  Copy their DLLs, too.  As of this writing, there are two: fmtrtf002_eng.zip; fmtmeta002_eng.zip .

Invoke Tools from the Viewer menu, then choose Tool Setup…


Click the Add… button.

In the DLL textbox, enter the path and filename of one of the tool DLLs, for example, C:\Program Files (x86)\CLCL\tool_text.dll .  If you click the Browse button, you can use a File Dialog box to navigate to and select the DLL.

Now choose one of the Tools to add.  I find &Edit to be useful, so choose that.  OK your way back out.

Now when you press your hot key to call up the clipboard list, you can right-click on a text entry, then click on Edit to open a simple editor to modify the text.  When you’re done, you can click OK to put the edited content onto the clipboard, replacing the original entry.





Use the same procedure to try out the other tools.

Tuesday, October 31, 2017

Where Should You Stick Your Function?

Let's say you need to create a VBA function to use in a spreadsheet. Where do you put it? Quick answer, put it in a module.

In Excel, press Alt-F11, Ctrl-R (to set focus to the Project Explorer). Right click on VBAProject (xls_name), where xls_name in the file name of your workbook. Select Insert Module.

A blank code window should appear and the cursor should be positioned in it.  This is "Module1" where you can enter your code, such as...

Option Explicit
Function FortyTwo(r As Range)
If r.Value = 42 Then
    FortyTwo = "Forty-Two"
Else
    FortyTwo = r.Value
End If
End Function


If you enter 1, apple, and =6*7 in cells A1, A2 A3, here's what you get as output if you enter =FortyTwo(A1) in cell B1 and drag down to B3:







Of course, if A3 contained =6*9 you should also get Forty-Two, but that's a programming challenge for another day.

Sunday, July 02, 2017

The Dreaded Non-Disclosure / Non-Compete Agreement

If you work in the USA tech industry, you've probably been asked to sign a non-disclosure / non-compete agreement with a new employer.  It may be that even your current employer asked you to sign a new one.

If you're not familiar with it, let me describe it for you in a nutshell: Anything you witness or produce on company time becomes the property of your employer.  Even if you think of something, if you thought of it on company time, that idea is your employer's property.  This explains a lot of what I've observed during my career -- many coworkers are so poignantly aware of this that the second they clock in, they empty their minds completely of thoughts and go about their duties thoughtlessly.

If asked to sign a non-disclosure / non-compete agreement, what should you do?  This ebook from IEEE should help:
https://www.ieeeusa.org/members/IPandtheengineer.pdf

Good luck!

Sunday, June 04, 2017

Hard Drive Thrashing? Maybe It's Windows Update

In a previous post, I wondered if my computer problems were due to AntiVirus interfering with Windows Update.

Perhaps.  But there's definitely a problem with Windows Update. The following seemed to get rid of the excessive and endless thrashing of the hard drive:

http://www.cagedrat.com/microsoft-windows/microsoft-windows-updates-cab-files-filling-up-hard-drive/

And yes, I plug in my computer and set it to Stay Awake before downloading and installing updates.

Wednesday, May 17, 2017

Some Things Never Change

For over two thousand years, engineers had to contend with manufacturing issues.  We're still doing that today...

"... its design conception exceeded the engineering precision of its manufacture by a wide margin—with considerable cumulative inaccuracies in the gear trains, which would have cancelled out many of the subtle anomalies built into its design."

From the Wikipedia page "Antikythera mechanism," Google's feature for today, 2017-05-17.
https://en.wikipedia.org/wiki/Antikythera_mechanism