Friday, June 24, 2022

Where is that Perl module installed?

 Out of the box Perl comes with a 'standard library' of modules. You can use tools like cpan, cpanm and ppm to install additional modules. 

To find out whether a module is standard or an add-on, run the command instmodsh to find out.

Tuesday, February 22, 2022

Canadians! How to turn off that annoying "Control-Shift" Keyboard Switch

No offense to mon copains Quebecois (did I say that right?), but a particular quirk affects PCs for a unilinguist Anglo like me when the Region setting in Windows is set to Canada (or I suppose any bilingual country). 

I've had the annoying experience of holding down "Control-Shift" for more than a couple of seconds, say while I'm trying to decide if I want to paste plain text into a Google Chrome field (using Ctrl-Shift-V), then suddenly I'm getting accented characters all over the place. 

This is Windows being helpful to us Canucks, by switching the keyboard layout from Canadian English to Canadian French, which would be great, if a) I had a Canadian French keyboard, and b) I knew how to write in Canadian French on that keyboard, and c) I actually wanted to write in Canadian French!

Well, I discovered how to turn off that 'helpful' keyboard shift:

  1. Open Settings and search for "advanced keyboard settings":

  2. In the Advanced Keyboard Settings panel, click on Language bar options:
  3. In the Text Services and Input Languages control panel, select the "Advanced Key Settings" tab and click the "Change Key Sequence" button:

  4. Finally we are there: click the "Not Assigned" radio buttons for either or both "Switch Input Language" or "Switch Keyboard Layout" options:
And that I think is it!

Wednesday, June 23, 2021

Using Windows Command Line to make a dummy file

Echo 64 bytes to a seed file: 

C:\Temp>echo This is just a sample line appended to create a bi wefhwef weh> dummy8.txt

Then call 'type' in a for loop to append the contents of the file to itself:

C:\Temp>for /L %i in (1,1,8) do type dummy.txt >> dummy.txt

Makes a  32,768 byte (32Kb) file.


Tuesday, June 8, 2021

Formatting Time and Date with Perl

# timestamp examples
use strict;
use warnings;
use v5.10.0;

use POSIX qq(strftime);

my $timestamp = strftime("%Y-%m-%d_%a_%H-%M-%S",localtime);

say $timestamp; # 2021-06-08_Tue_11-54-28

# ------------------------------------------------------------------------------

use DateTime;

my $today = DateTime->today();

say $today; # 2021-06-08T00:00:00

say $today->date; # 2021-06-08

Wednesday, November 4, 2020

Extensions for Perl in VS Code

Extension for Perl that work reasonably well in Visual Studio Code

Sunday, June 7, 2020

The Safe Way to test Thermal Runaway Protection on 3D Printers

  1. Disconnect the heater cartridge from the main board
  2. Start heating the hot end
  3. Expect machine to error out after ~10 seconds and shut down 

Thursday, May 28, 2020

Writing useful commit comments

Some thoughts on writing useful [concise, descriptive, contextual] commit comments. Applies to all SCM systems (Git, Subversion, etc.)

A properly formed Git commit subject line should always be able to complete the following sentence:

  • If applied, this commit will your subject line here
For example:
  • If applied, this commit will refactor subsystem X for readability
  • If applied, this commit will update getting started documentation
  • If applied, this commit will remove deprecated methods
  • If applied, this commit will release version 1.0.0
  • If applied, this commit will merge pull request #123 from user/branch
Chris Beam