the corner office : tech blog

a tech blog, by Colin Pretorius

Caja File Sorting

I've been playing with MATE. Long story.

Caja does clever sorting of directories and files, so if you have a directory with an underscore, a la _todo, then Caja just sorts it inline. The reason I put the underscore there in the first place is to list it at the top. This annoyed me 10 years ago with Nautilus, has annoyed me regularly with Thunar, and annoyed me enough tonight with Caja to see if I could fix it.

Upshot: you can indeed fix it, by putting export LC_COLLATE=C into .profile.

Details: Caja sort order relies on the LC_COLLATE environment variable to determine sort order. The fancy sorting comes from the standard UTF_8 setting. Setting LC_COLLATE=C gives the more obvious strcmp() style sorting. This is covered in eg. this SO post and a few others.

The messy part was finding out where to set the environment variable. Some places which don't work:

  • .bashrc works for console sorting, where the same issue was happening, but not for Caja.
  • .gnomerc was mentioned in a few older online posts, but MATE no longer reads this.
  • I also saw mention of setting this in /etc/profile.d but that seems like overkill.

Update: after all that I discovered that setting the locale this way causes files and directories which start with capital letters to come before all files and directories starting with punctuation and lower-case. Grrr.

{2018.09.26 22:39}

Linux Desktops circa 2018

I spend most of my time in Windows but I do have a couple of Linux VMs which I fire up as and when I want/need them. I switched to Xfce when Ubuntu came out with Unity, and it's served me well ever since.

But I do like to look and play around occasionally. I was feeling a bit bored tonight and wasted a few hours playing around with the latest and greatest in Linux desktops.

  • (worth throwing in that I fired up a live DVD of the latest Ubuntu recently. Don't like Gnome 3 at all. Just no.)

  • I read about elementary OS and Pantheon. I installed it. I didn't like it either. Same thing. I don't like the dock on the bottom of the screen and the top of the screen seems a waste with a few widgetey things and the 'Activities' menu (iirc). No right-click on the desktop. Just no.

  • I installed Ubuntu MATE and Mint MATE. I tried Mint in 2012, fell out of love with it very quickly for some reason, and haven't made friends with it since. What about MATE itself? I liked it, it feels old-Gnomish (which is rather the point). At rest Mint used about 600MB and Ubuntu used about 660MB. I liked the feel of Mint slightly more (menu set-up etc), but there wasn't much between them. I could probably use and get to like MATE.

  • I tried Solus Budgie but didn't get far. The installer didn't give English UK as an option, and the interface felt a bit sluggish (moreso than others). I saw it was Gnome/Unity-ish from the outset, so didn't bother going further.

  • finally, I tried Bhodi Linux, which provides a fork of Enlightenment called Moksha. I installed it. The interface is interesting, with mouse pointers lighting up and the like. You get a sense that you could get into a parallel world of interesting user experience if you gave it the time. But... no.

{2018.09.15 23:40}

My PowerBook Time Capsule

I started up my old PowerBook 520C recently, for the first time in many, many years. It warrants a write-up which I'll probably never get around to, but the tl;dr is that I got it all started up again and connected to my PC via an Ethernet adapter I got on eBay a few years ago.

I stopped using this Mac late 1997, when it got replaced by a 200MMX at home. I loved my old Mac (as just about everyone did who used one at the time), but it's the last Mac I ever used.

Starting it up and using it again (even if just to Stuff all my old files and FTP them up my PC), was a blast from the past. I'd forgotten quite what the experience was like. I have no idea whether using a modern Mac is anything like this, but these were some of the things I'd forgotten about:

  • The Wastebasket bloats when you delete files, and then shrinks back when you empty it. (UK English I presume, the US version per my newly set up Mac emulator calls it 'Trash'). Incidentally, it's on the bottom right corner of the screen and to this day, one of the first things I do when using a new PC is move the Recycle Bin (just realised it's called 'Rubbish Bin' on Win10) to the bottom right corner.

  • Icons. Yes, you can set custom icons for files and folders in Windows, but I remember it being easy and commonplace on the Mac, and the icons were always so beautiful. I even designed a few of my own (not as beautiful). It's been ages since I bothered with icons and icon themes in Windows or Linux, though I remember doing it with old Win95 and Win98 machines (invariably trying to make them look more Mac-like).

  • Put Away - the desktop metaphor was that you dragged a file or folder onto your desktop (which didn't exactly move or copy it), and then there was a Put Away command to move it back to its original location when you were done.

  • The menu bar at the top is per-app, not per window. I'd forgotten what that was like. I remember being frustrated when I first switched to Windows (and Linux desktops). You had to move your mouse to the menu bar of the particular window, which required more precision, rather than just shunting the mouse to the top of the screen. Now I don't think twice about it, and working with the Mac, found myself annoyed about having to move the mouse so far away from the window I was working in.

  • No task bar to minimise to. You could 'hide' the app, but double-clicking on the title bar just turned it into a ribbon.

  • Extensions (features/widgets) were easy to add or remove - you just put them in an Extensions folder.

  • Old screen savers! Flying Toasters, Fish! and a heap of others.

  • StuffIt and Drop Stuff and friends. I started one of these apps and it moaned at me in a big red font that I had been using the Shareware for OVER A YEAR and it was time for me to pay for it. Make that 20 years, sorry! A quick Google shows that Aladdin Systems, which made StuffIt, got renamed and bought out ages ago and is now run by a small software company. Wikipedia and the Internet don't remember StuffIt with its proprietary format kindly, and given the hassle I've had trying to get these opened outside of the Mac I feel the same way.

  • Fetch for FTP (I'm uploading all my files to back them up). I see they're still going. Good for them!

  • Archie and Gopher. Long dead. Usenet? Mostly-dead? And Ircle. As of now, dead with a poll about whether it should return. When last did I use IRC? 2000, maybe 2001 at a stretch?

  • Netscape Navigator 2.01. When I got my PowerBook, it had Netscape 1.0, but I almost immediately downloaded NN 2. NN 3 came out, but it was a bit too resource-hungry for the PowerBook so I stuck with version 2.

  • Folders and file labelling. You could make a folder green, or add a blue tinge to an existing icon, say.

  • I forgot that unlike Windows machines, Macs (or at the least, my PowerBook) didn't have an eject button for floppy disks (in SA we called them stiffy disks to differentiate from the original really-floppy disks, I learned later we were about the only people who did). Instead, you could Put it Away, or you could drag it to the trash to eject it. I'm not sure that was the greatest desktop metaphor, but anyway.

{2018.08.11 08:07}

Windows Command Line Backgrounder

In-depth blog series about the Windows Command Line

{2018.07.25 21:09}

QOTD

I was better at Unix when I was younger, but at some point I decided that I could either work on important things or I could get better at Unix.

A commenter at Marginal Revolution

{2018.05.09 21:37}

GIS Coordinates

Links via:

{2018.04.09 19:31}

SSD vs Spinny Disks

My PC has an SSD main drive and a traditional HDD. Most of my files (code, music, videos, general documents and stuff) are on the HDD. I need no convincing about the read speed of SSDs - my machine boots up in a few seconds. I was wondering though, whether I could speed up day to day work (particularly, development).

So I copied my 'dev' directory from my HDD to the SSD, and with two cygwin terminals side by side, ran mvn clean package on some of my chunkiest projects, first A, then B, then A, then B, then A, then B, and so on. I didn't take exact measurements, but the results were interesting: the HDD versions built as fast, or faster (I'd say up to 10%) than the SSD versions.

Of course, I wasn't doing all the Right Things, like flushing and whatnot, but the clean meant at least some of the file I/O wasn't pre-cached. The fact is that at no time was the SSD build faster, and it was generally marginally slower. SSD is fast, but my belief that it was very good for random non-sequential reads was wrong.

(Or if it is, then something else is going when it comes to compiling on SSD versus HDD, or how the two copies of my various code directories were laid out on 'disk' matters more than I'd have expected).

Moral of the story: as far as software development goes, having $IDE fire up from the SSD is a big win, but an HDD seems fine for the actual code.

{2018.04.04 19:14}

AWS

I've moved my site to AWS. All the cool kids &c &c. After diving into the tutorials and working through the impenetrable-looking acronym and feature soup ("I just want a simple server dammit"), it wasn't too hard. Within an hour or two I had a running VM, my /etc/apache2 and /var/www were copied over, and within another hour most of the internet had picked up my DNS changes.

It marks the end of more than a decade of happy service from RoseHosting. I'd gladly recommend them for reliable VPSes, if you need one. Cancelling my subscription had a "creative destruction" feel which saddened me, but my requirements are modest, and the cost just wasn't worth it. Even after a year of free tier AWS usage, running a t2.nano EC2 instance will cost next to nothing, if I haven't moved on to something even simpler and cheaper in the meantime.

{2018.03.18 08:28}

Backups

I had great plans for doing interesting things over the Christmas break, but I ended up spending the time sorting out the household's backups.

Until now, my backup system boiled down to semi-regularly rsyncing to one of two external hard drives, and some of my most important directories being far less regularly dumped into encrypted tarballs and synced to a free cloud storage provider.

My main worries are not having data only at home (one fire, flood or burglary away from losing everything), and not tracking changes to important files - even more of a worry these days with the rise of ransomware. After a few false starts, this is what I've settled on:

  • I discovered BorgBackup. It does exactly what I wanted: de-duplicating backups, so your backup 'archives' don't waste space (and in fact, you save space if lots of your files are similar), and it isn't hampered by renaming files and the like. That, and the backup data files are encrypted, so I'm not worried about them being backed up to the cloud.

  • Note to self: send printed copies of encryption keys to friends and family on other continents.

  • I've used borg with WSL, and uploading files seems to work well enough. I haven't tried cygwin. I couldn't back up directly to an external hard drive (iirc, due to a not-yet-implemented system call in WSL which caused borg to choke), but worked around that by setting up some VirtualBox vms and getting the data to them via ssh.

  • for pushing data to cloud storage, I'm using rclone. Like borg, a great piece of free software.

  • I settled on plcloud for online storage. They had a Christmas special which made it pretty cheap to get 2TB for a year. I'm nowhere near that now but if I start ripping our CD collection to flacs, which I want to do in 2018, then I'll be glad to have the headroom.

  • I also looked at Backblaze B2; they're well regarded and I may yet use them for additional redundancy. Their monthly storage costs are only slightly more expensive than Wasabi, but downloads are cheaper, and if you're going to trust your whole life to some encrypted files in a cloud provider's data centre, I think it's a good idea to to download everything occasionally to make sure that restoring your data actually works.

  • Needless to say, Amazon Glacier and Google's equivalent (whatever it was called) have ridiculously complicated and scary pricing models for their cold storage options, so they were non-starters.

{2018.01.06 23:54}

Firefox caches

To move the cache dir out of your main profile directory, set

browser.cache.disk.parent_directory

More.

Note also comment about a vanilla Firefox separating the profile between Local and Roaming (mine isn't like that, but I've always pointed to a profile in another location.

{2017.12.30 11:08}

Windows It Is

I lasted a little over a month, but finally gave up on Linux and switched to Windows 10. I enjoyed using Xubuntu, but there were a few frustrations, like erratic support for my bluetooth headphones, a random crash (not something I'm used to with Linux), and fiddly printer set-up, and an overly sensitive wireless mouse, and finally, very disappointing Intellij performance that I just didn't have the energy to try and troubleshoot.

That, and despite me preparing the family for ages ("this is going to be a Linux PC, so your Windows stuff will stay on the laptop"), when it came down to it, I didn't feel that what I was gaining from using Linux was worth it, given what everyone else at home was missing out on.

(Ironically, after switching to Windows, Ronwen said 'I miss Xubuntu'. The eldest has his Roblox on Windows, so he's happy. So perhaps we'll switch the laptop over to Xubuntu instead).

Beyond that, I have to grudgingly admit that Windows 10 is pretty solid, and with VirtualBox, and the performance and memory on this machine, using Linux VMs is not an issue, so Windows doesn't prevent me from using as much Linux as I'd like.

{2017.11.28 21:40}

« Older | Newer »