MS Access Crashes on TreeView.Nodes.Clear

I found a specific situation where MS Access always crashes to desktop.  Here are the ingredients:

  1. A bound Form with a Microsoft TreeView Control, version 6.0.
  2. Form’s “Allow Additions” property set to “No”
  3. TreeView populated using the Form_Current() event.
  4. Prior to populating the TreeView, calling .Nodes.Clear on the TreeView object.
  5. To set up the crash, filter the form to an empty recordset.
  6. Click on the Home ribbon and the Toggle Filter button.

Download Testcase File: treeview-testcase.accdb

Workaround

In the Form_Current() event, add a DoEvents command immediately before Nodes.Clear.

Set MyTree = Me.TreeView0.Object
DoEvents
MyTree.Nodes.Clear

InStr Performance for VBA

I solved a mysterious bottleneck last night while working with large string values in MS Access. My VBA code was reading a file to a string variable, checking several values near the beginning of the string, and then manipulating and saving the string to the database.

Oddly, one of the slowest parts of my code was the several InStr calls that were only checking the first few hundred bytes of the string. I could alleviate part of the problem by copying the beginning of my file to a shorter string value, but in so doing I also noticed unexpected results from the InStr return value.

Continue reading InStr Performance for VBA

Forcing PHP to Sort Like MySQL

If you ever have to do a case-insensitive array sort in PHP, you will eventually notice that the results don’t match the MySQL latin1_swedish_ci collation. They just aren’t the same. The difference comes from a set of six characters that fall between the upper-case and lower-case alpha characters of ISO-8859-1.

Specifically, [ \ ] ^ _ ` are the troublemakers. A simple example would involve sorting the phrases “Hello” and “[Hello]”. In MySQL, “Hello” comes first. In PHP, “Hello” comes last.

If this is driving you crazy, all you will need to do is trick PHP into using an upper-case sort instead of a lower-case sort.

$strings = ['hello', '[Hello]', 'Hello'];
usort( $strings, 'mysql_simulator' );
var_dump( $strings );

function mysql_simulator( $a, $b ) {
return strcmp( strtoupper( $a ), strtoupper( $b ) );
}

I hope this will save you some of the research in solving that pesky little difference.

Cannot Use Dynamic Class Name

It seems I’ve discovered a new kind of PHP error that isn’t documented anywhere on the web yet. Here is a simple example and explanation to help correct your code.

class MyClass {}
$obj = new MyClass;
$test1 = MyClass::class;    // Right
$test2 = get_class( $obj ); // Right
$test3 = $obj::class;       // Wrong

That last line in my code sample produces the following error in PHP 7.4.

Fatal error: Cannot use ::class with dynamic class name in […][…] on line 5

This is the PHP way of saying that you have to switch to the get_class() function when retrieving the fully qualified class name of an object.

Note: An existing RFC proposes to change this behavior in PHP 8, so this particular error message might not exist in some future versions.

Server Crippled by Updates Again

February update cycle again sent my server into a reboot loop, shutting down all services until I could diagnose the problem on site.

Following the same steps as in my previous post, I switched the boot choice to Safe Mode, and observed another boot failure. This time instead of getting into the weeds of troubleshooting the update system with a second Safe Mode boot, I decided to let the server go back to the normal boot mode, because some other websites have reported this as a good solution.

In this case, the failed Safe Mode boot followed by no other action did successfully restore the server.

After reviewing the Event Viewer logs, I could only find a repeated Event ID 1074, “TrustedInstaller.exe has initiated the restart”. KB2992611 and KB890830 both installed successfully before the loop, then KB4502496, KB2822241, and KB4537814 installed after the loop.

My current recommendation is to disable automatic updates for Windows servers and only perform update checks while on site. Also, run the update check twice in a row. The servicing stack update from December didn’t show up until after recovering from the reboot loop and then checking again for more updates.

Reboot Loop After KB4525246 Update

Several other sites confirmed recent server failures after running Windows Updates. Here are the basic steps I used to recover.

Attach a keyboard and enter BIOS setup. Make sure Quick Boot is disabled.

Press F8 while restarting the server to open the Advanced Boot Options menu.

I tried Safe Mode, but did not see a successful boot there.

Next I tried Repair Your Computer, which brought me to the “Choose an option” screen.

Select Troubleshoot, then select Command Prompt. Follow the instructions to log in as one of the administrators.

Continue reading Reboot Loop After KB4525246 Update

External Link Security Broken in Excel

Excel Security Warning About Linked Workbooks

After linking two local Excel files by a simple reference to a cell in another workbook, I began seeing an ominous error:

SECURITY WARNING  Links to external sources could be unsafe. If you trust the links, click Update. Click for more details.

This behavior was observed in version 1907 of Excel from the Office 365 software package.

Warnings of this nature should be taken seriously.  In this case, however, the message has been seriously mislabeled.  Clicking into the details brings up an ancient Help page for Excel 2007.  Searching for similar situations online brings up some misleading instructions.

If you are experiencing the situation described above, continue reading below for a simple workaround and more background information.

Continue reading External Link Security Broken in Excel

Text File Viewer for ownCloud

This is a little website tool I put together for ownCloud users.

If you enjoy retrieving text files from your cloud server through your phone, it helps to be able to see the text in as few steps as possible.

My viewer App solves two problems:

1. A context menu item provides one-click access to view the file in your browser without the awkward text editor app in the ownCloud website.

2. A text-only directory browser is also provided for situations where the infinite river of file listings takes forever to scroll through on a mobile device.

The app is currently available at github.com/miqrogroove/files_textviewer and I am working on adding it to the ownCloud Marketplace.

OpenVPN tls-auth Option is Critical

Someone attempted a very noisy attack against my router’s built-in OpenVPN server today.  While there was no chance this person could guess my encryption parameters to gain access, he or she did manage to cause a denial of service.

The log excerpt looks like a whole lot of these:

Sep  6 12:40:15 vpnserver1[535]: 148.163.126.72:22475 TLS: Initial packet from [AF_INET]148.163.126.72:22475 (via [AF_INET]%eth0), sid=6a22eb44 5adb63fe
Sep  6 12:40:15 vpnserver1[535]: 148.163.126.72:57036 TLS: Initial packet from [AF_INET]148.163.126.72:57036 (via [AF_INET]%eth0), sid=6a22eb44 5adb63fe
Sep  6 12:40:17 vpnserver1[535]: 148.163.126.72:20089 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sep  6 12:40:17 vpnserver1[535]: 148.163.126.72:20089 TLS Error: TLS handshake failed
Sep  6 12:40:17 vpnserver1[535]: 148.163.126.72:20089 SIGUSR1[soft,tls-error] received, client-instance restarting
Sep  6 12:40:18 vpnserver1[535]: 148.163.126.72:35987 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sep  6 12:40:18 vpnserver1[535]: 148.163.126.72:35987 TLS Error: TLS handshake failed
Sep  6 12:40:18 vpnserver1[535]: 148.163.126.72:35987 SIGUSR1[soft,tls-error] received, client-instance restarting
Sep  6 12:40:19 vpnserver1[535]: 148.163.126.72:55183 TLS: Initial packet from [AF_INET]148.163.126.72:55183 (via [AF_INET]%eth0), sid=6a22eb44 5adb63fe
Sep  6 12:40:19 vpnserver1[535]: 148.163.126.72:12142 TLS: Initial packet from [AF_INET]148.163.126.72:12142 (via [AF_INET]%eth0), sid=6a22eb44 5adb63fe
Sep  6 12:40:20 vpnserver1[535]: 148.163.126.72:50926 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sep  6 12:40:20 vpnserver1[535]: 148.163.126.72:50926 TLS Error: TLS handshake failed
Sep  6 12:40:20 vpnserver1[535]: 148.163.126.72:50926 SIGUSR1[soft,tls-error] received, client-instance restarting

Continue reading OpenVPN tls-auth Option is Critical

How to Filter Xfinity Script Injections

Is your Xfinity ISP injecting horrible scripts and dialog messages into every unencrypted website that you visit?  It might look like this:

Xfinity XSS Garbage

We’ve increased Internet speeds in your area.

Update your modem to start enjoying them.

We’ve noticed you have an older modem that can’t keep up with faster Internet speeds now available in your area.

To start enjoying faster Internet, you can:

Buy from a retailer

Before you make your purchase, visit mydeviceinfo.xfinity.com to view a list of modems certified on our network.

Lease an XFINITY Gateway (Comcast lease fees would apply)

Call 1–855–242–2876 to order a Wireless Gateway and we will send you everything you need to get set up.

Thank you for choosing XFINITY. Ensuring that you get the most from your Internet service is part of our commitment to improving your overall experience.

In the Chrome web browser, you can block this with the ComcastBlocker extension.  The Xfinity script still loads, but its effects are minimized by removing all the display elements.