Request for testers – TabFern tab-at-a-time support

Three tabs open; two tabs closed but still saved!

My TabFern tab-management Chrome extension is ready for its next great leap and I need your help!  For years, TabFern has been all-or-nothing: all the tabs in a window are open, or none of them are.  Prerelease version 0.3.0-pre.1 removes that limitation.  If the instructions below are your speed, or you already know how to load unpacked Chrome extensions, would you please install TabFern 0.3.0-pre.1 and let me know how it works for you?  Please report problems through the GitHub issues page.  Once this release has had some testing, I will roll it out to the over 1,000 users of TabFern!  Thanks very much for your help, and for using TabFern!

(Reminder: as always — and especially when testing prereleases — backup early and often!  TabFern comes with no warranty of any kind!)

Installing

  1. Download the zip from here.
  2. Unzip it into a directory of your choice.
  3. In Chrome, go to chrome://extensions.
  4. Turn on the toggle in the upper-right that says “Developer mode”.
  5. Near the top left, click “Load unpacked”.
  6. Navigate to the directory where you unzipped the extension and hit OK.  (There’s no specific file to select — just go into the unzip location and then hit OK.)
  7. That’s it!  The TabFern popup window and the help window will open up.

Music of the Day

Cafe De Anatolia – Ethno Deep Summer Mix (by Professor)

2 hr. of music that is quite unlike my usual fare, but that I am enjoying! I am up to 1:09:03. So far, mellow with a nice beat and mostly instrumental.

Update: the section starting at ~1:09:43 reminds me very much of a Cyan Music album, though I can’t recall which one. Something by Fortadelis, maybe? Let me know what you think in the comments!

Happy Memorial Day!

Music of the Day

From the same group as last time, but at a slower tempo. There’s plenty of interesting material in this set — don’t plan to listen just before bedtime 😉 .

Repeating the last ‘:’ (Ex) command in Vim

Sometimes I run a complicated search-and-replace (:s/../../) in Vim, and I then want to repeat it somewhere else. In the past, I have always hit :, up-arrow to retrieve the command from the history. It should be no surprise by now that there is an easier way!

@: in normal mode (at-sign, colon) will repeat the last : command. Once you have done @:, you can hit @@ to re-run the command. Quick and easy!

This works because the : register, ":, holds the last Ex command. @ runs a macro, and knows that using the : register means you want to repeat an Ex command. @@ runs the last macro, so works for @: just as it does for @a or any other normal-mode macro.

I found ": in :help registers when I was looking for a register that held the filename of the file open in another window, as opposed to the alternate filename in the current window. Details of ": are at :help ": (believe it or not! 😉 ).

Lightweight Markdown-to-PDF converter: pfft

I just released the first version of my new Markdown-to-PDF converter, pfft.  It runs on Linux, at least as far back as Ubuntu 18.04.

Why yet another converter when pandoc and many others already do the job?  Size.  Pandoc uses TeX to generate PDFs.  All the other converters I found use a Web browser in one way or another to make the PDF.  Pandoc is 50 MB by itself, not counting TeX!  In less than 1.2 MB (a 5.25″ floppy 😉 ) and a single file, pfft will do the job.

Of course, there is a catch: pfft uses Pango and Cairo to make the PDFs.  Those have their own dependencies, but are installed on many Ubuntu systems by default!  So pfft itself does not add to the dependency load those systems already carry.

(By the way, I use and appreciate both TeX and Pandoc.  They are great tools!  But, like all tools, there are some use cases they are not great at.  I wanted a small converter, and now I have one! 🙂 )

Please give pfft a try and let me know how it works for you!  And, if you’re planning to do Hacktoberfest this year, know that I am happy to receive pull requests — there’s lots of room for features and polish in pfft.  Check out the issues list for some ideas, and feel free to add suggestions of your own.  Happy hacking!

Generating Roman numerals in Vala

I have recently been learning and enjoying the Vala programming language.  I am writing a lightweight markdown-to-PDF converter and wanted to be able to automatically number list items in Roman numerals.  Here, in case anyone wants it, is Knuth’s algorithm for producing the Roman numeral for a number.  I converted this to Vala from the original WEB source, part of TeX, as quoted by Hans Wennborg.  Enjoy!

string roman(uint num)
{
    // Knuth's algorithm for Roman numerals, from TeX.  Quoted by
    // Hans Wennborg at https://www.hanshq.net/roman-numerals.html.
    // Converted to Vala by Chris White (github.com/cxw42).  CC-BY 4.0 Intl.

    var sb = new StringBuilder();

    string control = "m2d5c2l5x2v5i";
    int j, k;   // mysterious indices into `control`
    uint u, v;  // mysterious numbers
    j = 0;
    v = 1000;

    while(true) {
        while(num >= v) {
            sb.append_c(control[j]);
            num -= v;
        }
        if(num <= 0) {  // nonpositive input produces no output
            break;
        }

        k = j+2;
        u = v / control[k-1].digit_value();
        if(control[k-1] == '2') {
            k += 2;
            u /= control[k-1].digit_value();
        }

        if(num+u >= v) {
            sb.append_c(control[k]);
            num += u;
        } else {
            j += 2;
            v /= control[j-1].digit_value();
        }
    }

    return sb.str;
} // roman()

(not extensively tested — use at your own risk. No warranty. License details here.)