Dropbox Alternatives?

May 21, 2021

I'm finally getting around to upgrading my increasingly ancient, first-generation Google Pixel smartphone. In so doing, I'm going to have to figure out what kind of file synchronization service I can switch to. Dropbox has been my go-to for this kind of thing for years, and it suits my relatively simple needs pretty well (I primarily use it to sync my KeePass password database). However, Dropbox now caps the free tier of service to a maximum of 3 devices. I have more than three devices that I use it on (they were all grandfathered into the new rules), and activating my new smartphone will mean I no longer have support on my phone.

The primary competition that I see to Dropbox is both Microsoft's OneDrive and Google Drive. The former has better OS integration than the latter (from what I can tell), and neither one has such strict limits on the number of devices that can be used. Does anyone have experience with either of these services in terms of syncing files between devices? If so, I'd enjoy hearing about your experience. Are there other similar services I should know about?

The Land the Car Built

May 12, 2021

As I write this we're in the middle of another gasoline shortage here in North Carolina. Our governor stupidly declared a state of emergency which, while technically required to change the rules for gasoline transportation, has caused people to panic and hoard gasoline. I have to imagine there's a better mechanism that we as a society could come up with for changing the rules that doesn't involve the word "emergency."

All this, of course, is thanks to the fact that the United States is the land the car built. Back when we visited Switzerland, one of the joys of travelling there was the ability to get around using only public transportation. You could go virtually everywhere by taking a train, bus, boat, or other random forms of transit. I'd love it if we had the same opportunities here, but it'll never happen.

AG Grid is the best JavaScript plugin I've ever worked with (I've been meaning to write about it, and I hope to soon). Oddly, one of the few features it doesn't support out of the box is clipboard support for cutting data with Ctrl + X. Copy and paste are provided, but cut support is not. Here's how I added support for this operation (we use the Enterprise variant at work, so this code is geared towards that flavor).

let gridOptions = {
    // ... other grid options ...
    'onCellKeyDown': function(e) {
        if(e.event.key == "x" && (e.event.ctrlKey || e.event.metaKey)) {
            e.api.copySelectedRangeToClipboard();
            e.api.getCellRanges().forEach(range => {
                let colIds = range.columns.map(col => col.colId);
                let startRowIndex = Math.min(
                    range.startRow.rowIndex,
                    range.endRow.rowIndex
                );
                let endRowIndex = Math.max(
                    range.startRow.rowIndex,
                    range.endRow.rowIndex
                );
                clearCells(startRowIndex, endRowIndex, colIds, e.api);
            });
        }
    },
};

let div = document.querySelector("#my-grid");
g_MyGrid = new agGrid.Grid(div, gridOptions);

The clearCells function looks like the following, and handles actually resetting the value of the cell to some default value (I set mine to 0, since I'm working with numerical data):

function clearCells(start, end, columns, gridApi) {
    let itemsToUpdate = [];
    for(let i=start; i<=end; i++) {
        let data = gridApi.rowModel.rowsToDisplay[i].data;
        columns.forEach(column => {
            data[column] = "0";
        });
        itemsToUpdate.push(data);
    }

    gridApi.applyTransaction({update: itemsToUpdate});
}

For the past two weeks or so, I've been using Microsoft Edge as my daily driver in the web browsing world. One of the primary motivators for my doing this was Edge's capability to stop auto-playing media, which I find highly annoying. Unfortunately, the advertised feature didn't work for me; at least not on the sites that bug me most (my preferred local news station's website being chief among them). That said, there were a few things I liked and disliked about my experience (note that I have since moved back to Chrome).

What I Liked

  • Migrating data from Chrome took one click, and everything came over: bookmarks, extensions, etc. This was a nice surprise and made transitioning seamless.
  • Since Edge is Chromium-powered, the same set of web developer tools were available. That made my debugging life easier.
  • Edge is very fast, and apparently a lot less resource intensive than Chrome. I'm not sure I perceived any differences, but I was happy to see that things were very snappy.
  • The "picture of the day" on the new tab page was a neat feature. There were some really beautiful photos featured while I used it.

What I Disliked

  • I absolutely hate the way Edge does browser history. When you open your history, a fixed-height dropdown panel appears in the toolbar, which you then must scroll through. Entries pop into view as you scroll, and this part is surprisingly slow. There's apparently no support for opening history in a sidebar by default (though you can pin the view to a sidebar once the popup appears).
  • Auto-play blocking doesn't work. This is the primary feature I was after, but it didn't work for me. It also stinks that it's all or nothing, and not configurable (like I believe Firefox supports).
  • As you might expect, there are a bunch of links to Microsoft content (Office 365, Bing, etc.) all over the place. They're really trying to push their products, and it shows.
  • Bing search is a disappointment. I gave it an honest try, but more often than not I had to scroll way down in the search results to find a result of use. This seemed particularly problematic with technical searches. Google just seems to surface technical content better than Bing. Perhaps that's a function of the overall user base?

As I said previously, I've since switched back to Chrome, as Edge didn't feel different (or better) enough to get me to stay. I'm debating giving Firefox another try, but I've been really frustrated with how Mozilla has hobbled their browser over time with stupid decisions. Are there other browsers I'm missing out on that you like? A former colleague of mine used the Brave browser, which I haven't yet tried. I'm open to trying alternatives, so let me know if there's one I've overlooked.

The second installment of my Good Old Music series is The Snow Goose by Camel. An entirely instrumental album from 1975, the music here is phenomenal. I particularly like the instrumentation throughout this album; flutes, electric guitars, organs, woodwinds, The Snow Goose has it all. This is an album I listen to often while working. Check it out!

Monolithic Methods

Apr 14, 2021

One of my current projects at work involves adding new functionality to my oldest web tool. I inherited this Django-powered project way back in 2015 (the tool was in its infancy at the time), and have been the sole designer and developer for the project ever since. It's been pretty rock solid, humming along for the past few years without any major modifications or issues. However, this recently has changed, as management wants to track the tool's data using a new dimension that we weren't considering previously.

These new features require adjustments to the database schema, which means that corresponding front-end changes, for both data entry and reporting, are also needed. The end result is that a lot of code needs to be updated. Digging through this ancient code has been both embarrassing and humbling.

When I inherited this project, I didn't know Python. By extension, I knew nothing about Django, which was still in its relatively early days (Django 1.8 was the latest at the time). I had plenty of web-design and programming experience, which made learning both much easier, but I made a ton of mistakes with both the architecture and implementation of the application. I'm now regretting those mistakes.

One of the most egregious errors in this application, and something I honestly still struggle with to a degree, is writing monolithic methods. Some of the view methods in this tool are many hundreds of lines long. Amidst these lines are dozens of calls to various "helper" functions, many of which are equally as complex and lengthy. It has made figuring out what I was doing painful, to say the least.

I'm trying to remedy this situation by creating stand-alone classes to act as logic processors. The resulting class is easier to read, even if the length of code is nearly the same. So, a sample view using this methodology might look something like this:

class MyView(View):
    def get(self, request):
        vp = MyViewProcessor(request)
        response = vp.process()
        return JsonResponse(response)

The corresponding processor class would then look as follows:

class MyViewProcessor:
    def __init__(self, request):
        self.request = request
        # Other initialization goes here

    def process(self):
        self.load_user_filters()
        self.load_data()
        self.transform_data()
        return self.build_response()

Each of the calls in the process() method are to other methods (not shown) that handle tasks like processing incoming data (from a front-end form), loading data from the database using those filters, etc. This construct, while not perfect, at least makes the code more readable by breaking the work into discrete units.

There was a nice article at the Washington Post earlier this month on the joys of YouTube's "cab-ride" train videos. They mentioned one of my favorite YouTube channels, lorirocks777, which posts videos from Switzerland and surrounding countries. Videos like this make great "background" viewing while doing other tasks (like, for me, working).

Here's the recipe for auto-authenticating in SSH with a public-private key pair. I'm recording this here because I can never remember exactly how to do this (I do it so infrequently).

Assumption: You have already created a public/private key pair to use. In Windows, this is typically done with puttygen or kittygen (or something similar).

# On the server
cd ~
mkdir .ssh
chmod 700 .ssh

# Here's the magic
ssh-keygen -i -f mykey.pub >> ~/.ssh/authorized_keys
chmod 600 authorized_keys

Once the server-side stuff is done, add the private key to the connection setup in the Kitty/Putty session configuration.

Is it just me, or has the pin density on Google Maps been upped considerably? Take a look at the following image, centered on the I-540 / I-40 interchange here in Raleigh:

Google Maps pin density example

There must be close to 50 or more pins in this (fairly zoomed out) view. The vast majority of these pins are places I've either never visited or don't care about. Maybe this is a way that places can "advertise" with Google? I would argue that this density of pins makes the map incredibly hard to read. I feel as though Google Maps used to be way less busy than this.

I stumbled upon a really interesting article last night on the history of Mahavishnu Orchestra, one of the greatest jazz-fusion bands of all time. The article points out some of the influences they had on other groups, and reveals some interesting history I didn't know (like lead guitarist John McLaughlin being asked to join Weather Report, a band that would go on to make some terrific jazz-fusion of their own). It's definitely worth a read if you're familiar with the group, or even if you aren't!

Logitech M585 Wireless Mouse
I can no longer recommend this mouse; more in this post

Since late 2017, I've used the Logictech M705 Marathon wireless mouse at work. I loved everything about this mouse. It had great battery life, even when only using 1 AA battery (it supports two batteries for even longer life, at the expense of extra weight). The weight of the mouse with one battery was terrific; not too light and not too heavy. To top it all off, it had great extended button placement at my thumb, allowing me to quickly browse back and forward in my web browser with a quick click.

This past December, however, I started noting phantom double clicks when single clicking, a problem that quickly got annoying. Searching around the internet informed me that this is a common problem with Logitech mice, and is a sign that the physical switch under the left mouse button is failing. I immediately headed to Amazon to pick up another M705 when I discovered a ton of negative recent reviews. Apparently, Logitech has actually changed that product, dropping some features and cheapening the body, while keeping the same model number (how can any company rationalize doing this, by the way?).

Persuaded to stay away from the newer model, I opted instead for the Logitech M585. Having had this new mouse for a few months now, I'm fairly pleased. The mouse is smaller physically, and not as sculpted as the M705, which is a minor drawback to me (the M705 had a real nice feel in the hand). However, this new one still fits my hand well. Pointing accuracy is dead on. The 585 supports moving between multiple machines, but it requires external software (on both systems), and that was enough of a barrier that I didn't bother.

Time will tell if the mouse holds up to daily driving, but so far so good.

Photos from Space

Mar 25, 2021

I've been following the ongoing saga of the ship stuck in the Suez canal, and I find it very interesting. It's pretty clear that we're building boats that are too big. Anyways, a post from The Verge today linked to an incredible photo taken from space. The resolution on this photo is really mind blowing. The more I think about this, however, the more I've got to believe that this capability has existed for a long, long time. The US military has likely had photographic capabilities like this since the cold-war days. I wonder what kind of photos they can take today?

Regardless, it's really amazing that you could take a photograph of stuff on the ground, from outer space, and be able to see even small details in said photo. Incredible!

Here's a fascinating video on the history of the man that started the Chef Boyardee brand. I had no idea!

One of the well known tenets of Python is:

There should be one (and preferably only one) obvious way to do it.

There are plenty of places in the Python universe where this tenet is blatantly ignored, but none tickles me quite like shutil.copy and shutil.copy2. Both methods copy files from one location to another, with one (and apparently only one) difference, as the documentation for copy2 spells out:

shutil.copy2(src, dst, *, follow_symlinks=True)
Identical to copy() except that copy2() also attempts to preserve file metadata.

I'd love to know what motivation the author of the (very poorly named) copy2 method had for adding it to the library. Was adding a preserve_metadata argument to copy() not sufficient for some reason? That's what any sane developer might have done.

The Jubilant Gardener

Mar 18, 2021

If you're interested in gardening, or know someone who is, my wife has started a website aimed at providing gardening advice: The Jubilant Gardener. New posts drop twice a week: gardening articles on Wednesdays, and Christian devotionals on Sundays. Her latest post on how to prune plants is solid. Follow the feed if you're so inclined, and feel free to share with those who might enjoy gardening related articles.