rubocop and rufo

I’ve been writing in the Ruby language since sometime in 2002, but if I was looking for a job, I don’t know enough to call myself a ruby programmer. I don’t know rails or anything of the other cool things people do with ruby. I’ve learned to use gems, but haven’t bothered to learn how to write them myself.

But I’m not opposed to learning. I just haven’t gotten around to it yet.

Or so I thought. Then I ran into rubocop, which is a sort of linter and style cop. Those can be helpful, so I thought I’d give it a try. And it’s mostly good. Except it’s opinionated, and some of their opinions are wrong. For example:

  • the indentation should be four spaces, not two as they suggest
  • parallel assignment is the bomb, despite what they say
  • I use double quotes (") pretty much everywhere I’m not forced to use single quotes ('). They want to save time for the compiler, I guess.
  • You need space inside parentheses (although I will grant the extra whitespace is less important with syntax highlighting than without it).
  • And if I’m declaring a RE that’s so complicated I’m using /x flag, then don’t tell me to use /.../ instead of %r<...>.
  • And speaking of which, go ahead and use $1 and $' when retrieving the results of an RE match. (In moderation.) Honestly, this is a tie. Go ahead and use named groups if you want to.

But you can’t fight city hall. If some younglings want to make Ruby over in the style of Python, well, that’s a crying shame. Ruby is supposed to occupy the perfect spot between Perl and Python. But these kids today! If they’re on your lawn, you might as well go along with their misguided project. And that brings us to rufo, the ruby reformatter. You can use it to do like 10% of the things that rubocop whinges about.

App Store Perils

Despite its undeniable convenience, I dislike Apple’s “App Store” for several reasons. The first is that Apple uses it to make developers dance to whatever tune Apple is playing that day. (This is part of their general philosophy of totalitarian control of everything, everywhere.) As a former developer myself, my attitude is “Screw them.”

But the other reason is that it sometimes breaks, and then the recovery mechanism is utterly opaque. Case in point.

Apple App Store Bug

This was the fourth time I downloaded 1.20 GB of Garageband content only to receive this useful message:

Apple App Store Bug

I don’t know who the intern was who coded this feature into the App Store, but they should have run this diagnostic message past someone who can speak English.

So. Google to the rescue. It turns out that not only is this a well-known bug, it’s one that’s been around for a long time. That Apple quality shining through as always.

Apple Sucks (Part 33,704 in a series)

A year ago, I wouldn’t have guessed that they could make iTunes worse. But they did. They took out useful things (like managing the apps with a mouse rather than a fingertip, and managing the order of screens). To be sure, it was always a crappy interface, more interested in showing you pictures than giving you useful data, or, better yet, a grid-based sortable interface. But that’s iTunes for you. Now it’s worse.

Obviously, there’s nobody at Apple who has more than a dozen apps on their phone. Or more likely, they’ve got some secret tool that the general public can’t use.

Oh, but they did tart up the app store (both the Mac and iOS versions) so you have to wade through commercials every time you use it. Want to find how monumentally huge that iMovie update you don’t want will be? It used to be on the first screen, but now it’s helpfully like four screens deep.

Thank you so much, Apple. You SUCK. But you knew that.

Pandoc for Word Document conversion

I just discovered pandoc. Well, I first bookmarked it in 2008, and again in 2016, so I guess I rediscovered it. But what I mean is that I finally discovered what to use it for: converting Word files to Markdown. It’s dead easy:

$ pandoc -f docx -t markdown sample.docx > sample.md

I’ve been using Antiword for years to convert Word 2006 (DOC) files to text, but it doesn’t do DOCX, and, instead of producing Markdown or something more neutral, it tries to recreate the DOC experience in text by centering lines, etc. Not complaining: it gets me plain text and I can take it from there, but Markdown is a big improvement. DOCX is even better, since, apart from pandoc, the only way I knew to read those at the command line was via Libre/OpenOffice:

$ libreoffice –headless –convert-to “txt:Text (encoded):UTF8” sample.docx > sample.txt

(I see — now, when it is too late — that there is also code to do this in ruby: antiword-xp-rb. I hope that’s an awesome tool, but it took me 9 years to figure out what to do with pandoc so don’t wait for me to tell you.)

I wouldn’t take it gift-wrapped

Office 2016 for Mac now available as stand-alone software. I’ve been exposed to Office 2013/Windows, and to get anything done, I have to use Office 2011 on my Mac.

I wouldn’t even install Office 2016 on my Mac for $100 even if it left the old version intact. More likely, though, it clobbers the previous version. In that case, I’d only do it for the cost of a new computer—so I could throw out the old computer with Office 2016 on it.

Software Update

In the mid-1990’s I worked for a telecommunications firm that was trying to make a set top box for interactive television. (This was even as the internet was exploding. Read Michael Lewis’ The Next Next Thing to find out what the “B Team” was working on.) One of the things I spent a lot of time on was “software update.” We needed a way to securely update the operating software in the device, and we wanted to do it while connected to our network, because the cost to roll a truck and have a technician do it was prohibitive.

A few years later, I was working for a different company trying to innovate in the electrical power industry. (I know, it was hopeless. But I was young and naive.) Anyway, we had the exact same problem: securely updating the software in a networked device. It’s a problem that’s fraught with difficulties.

As it happens, both of those ventures flamed out, so I never got to be part of solving that problem. But this morning, as I was eating my oatmeal, I saw that someone else seems to be doing it:

iphone-software-update

Not only solved, but untethered. Yay Apple.

XFCE

I quit using Linux (except as a file server) almost 10 years ago, so I completely missed the Desktop wars. Apparently KDE and Gnome won, with Gnome winning the part of the Linuxphere known as Ubuntu. Which leads to all kinds of out of date help pages telling you how you used to administer a Ubuntu system (“From System Administration choose Disk Utilities”). Along with a fair few pages complaining how Gnome 2 was better, or Gnome 3 was bad but 3.6 fixed most of the problems, or whatever.

As may be. I’m a crusty old bearded Unix user, from the era of Window Managers rather than Desktop Environments. (Well, CDE begat KDE, so I guess there were Desktop Environments even back in those days, but I never worried about them.) For me, it was a big deal (with no small amount of editing config files) to move from FVWM to WindowMaker.

So what do I do? I don’t know. But I’m thinking about Xubuntu and XFCE. How’s that for rebellion? You say you want a revolution!