Rubenerd logo

Rubenerd



The trap of using Unix find in ordered lists

Merlin Mann and Dan Benjamin have a newish segment on Back To Work entitled Things you already know, unless you don’t already know them. As they say, you’re definitely an intelligent computer operator, so you you already know about this topic. In which case, be quiet, and let those without your snark or obvious intellect learn something. I’m shamelessly ripping off this idea.

Logo for VideoCD

Today I was reminded of the fact find prints files as they appear in the file system, which is likely in alphanumeric order, but it’s not guaranteed.

Why is this important? Because this is a valuable word.

Conventional wisdom is you shouldn’t use ls in scripts, in large part due to the potential for filename mangling. This is especially true when copying your favourite K-pop songs with Hangul on an OpenZFS volume, cough.

Using find is generally preferable, but it does have consequences. If I run ls over this particular folder, like a gentleman:

$ ls -1 *DAT

Or use this shell script, while we’re at it:

for _file in *DAT; do
    printf "%s\n" "$_file"
done

And may as well go for broke:

#!/usr/bin/perl  
use 5.010;  
foreach my $file (<*DAT>) {
    say("$file\n");
}

The result is:

==> AVSEQ01.DAT
==> AVSEQ02.DAT
==> AVSEQ03.DAT

Sorted, done. But if I use find:

$ find . -type f -name "*DAT" -print
==> ./AVSEQ03.DAT
==> ./AVSEQ01.DAT
==> ./AVSEQ02.DAT

The order isn’t alphanumeric. This would explain why my concatenated VCD backups run through ffmpeg have segments in the wrong order! #derp

So just another reminder. If you use find, sort it after if order is important.


Fuji Xerox

There are certain names you take for granted. Or more accurately, that I take for granted. Though you might, too.

(Arguably the name most taken for granted is Grant, particularly if he's involved in a financial bestowement. Vim is telling me that isn’t a word, and I’m reluctantly inclined to agree).

The example I often cite here is the embarrassing length of time it took for me to realise the pun behind The Beatles. It wasn’t that I hadn’t got the reference as a teenager, more that I never had a reason to think about it. They were just The Beatles, that’s it.

I can now add Fuji Xerox to the mix. I’d assumed, again without much thought, that it was a conglomerate etymologically grounded in its constituent former companies, akin to Square Enix, PriceWaterhouseCamelcase, and Konica Minolta. More on that in a second.

Turns out, it was a long-standing joint venture stretching back to the 1960s. According to this Wall Street Journal article by David Benoit, Dana Cimilluca, and Dana Mattioli:

Xerox and Fujifilm have a long history together. They struck a joint venture 55 years ago that is known as Fuji Xerox and sells copiers and printers in the Asia-Pacific region. Fuji Xerox is 75% owned by Fujifilm and now has about $10 billion in annual sales.

Their report is reporting… wow, how good was that writing. I should have Xerox’d a thesaurus! Hah HAH! Wait, what?

Their report notes — sweet save — that Fujifilm is mulling purchasing the remaining stake in Xerox, thereby rendering it a subsidiary. Given their declining business and profits, this armchair financial advisor believes it to be a solid business decision.

They’d already started divesting other key assets, as that earlier report reports – damn it, I did it again:

Last year, the company broke itself in half, spinning its business-services operations into a new company dubbed Conduent Inc. The legacy company returned to its roots of making printers and copiers, an industry facing upheaval and an uncertain future.

Why are spinoffs always saddled with uninspiring names? It’s as though they’re designed to fail.

And as for my comment about Konica Minolta? They’re owned by Fujifilm. Though they sold their camera optics to Sony, which now form their Alpha range.


The Intercity-Scala

When I saw this book cover, my first thought was what train was depicted. Not to get all Merlin Mann on you, but turns out it’s the SBB-CFF-FFS RABDe 500, a Swiss tilting train that tilts. At least part of that sentence was superfluous, much like this entire one. And this one.

Cover of Learning Concurrent Programming in Scala

I’d express the train’s attributes with Scala if I knew enough about either. Instead, have this article:

The RABDe 500, is a Swiss passenger train which was introduced in 2000, in time for Expo.02 held in western Switzerland in 2002. Its maximum speed is 200 km/h (120 mph), which can be reached on the Mattstetten–Rothrist new line; however, as of 2011 the RABDe 500 is not currently used on this line, except on the branch to Solothurn; the ICN reaches 200 km/h though in the new Gotthard Base Tunnel.

I thought this was fascinating:

It was a joint development by Bombardier, Swiss Federal Railways and Alstom, with an aerodynamic body designed by Pininfarina. The design of the driver’s cab was well as the electrical engineering was taken over from the SBB Re 460 locomotives.

I didn’t know Pininfarina designed trains! I can’t stand buses, but I always thought the SMRT (previously Trans Island) articulated buses designed by the studio were pretty swish.

You know how you do concurrent programming with tilt trains? Run two of them through the Gotthard Base Tunnel.



Rubenerd Show 372: The park episode

Rubénerd Show 372

Podcast: Play in new window | Download

28:58 – London taxis and scary doors, 33, New Year, sodium lamps and LEDs, melatonin, writing without a backspace key, blogging, finding a fitness magazine late at night, and a moose.

Recorded in North Sydney, Australia. Licence for this track: Creative Commons Attribution 3.0. Attribution: Ruben Schade.

Released January 2018 on The Overnightscape Underground, an Internet talk radio channel focusing on a freeform monologue style, with diverse and fascinating hosts.

Subscribe with iTunes, Pocket Casts, Overcast or add this feed to your podcast client.


Bitcoin spam and cheese

It has begun.

Screenshot showing four identical Bitcoin spam messages

For those using screen readers, below are each of the subject lines on those emails:

Let me tell you about one crypto currency that could turn 1000 bucks into 1 million

The pertinent sections of the emails are below, with the name of their penny stock bullshit redacted, in part not to give them publicity, but also so you don’t roll your eyes out of their sockets from the cliché name. See, I’m doing this for your personal health and safety:

My research shows that $REDACTEDCOIN is going to be the next big one to blow up this year. It has already doubled since yesterday and as the trend continues it could be 10 times as high before the end of the coming week.

$REDACTEDCOIN is one of the only coins approved by the government in Switzerland. It is 100% legal and useable in everyday life.

Whoa, legal and Swiss! It’s like a nice cheese, only the holes are in logic and sound financial advice. But how can I get me some $REDACTEDCOIN?

For the time being SIC only trades on one exchange: $REDACTEDSITE so you need to open an account there (takes about thirty seconds), and transfer bitcoin to it so you can make the purchase.

Seems legit.

In their defence, at least they called crypto currency and not just crypto. If I read one more person asking if you’re buying or selling crypto, they’d better buy themselves a helmet.

The contents of this junk mail aside, their name generator is fascinating. We’ve got an Emanuel Mayoh, a Colby Gillam, a Wendi Rouzie, a Fintech Sucker, and a Britt Lester. At least one of those was fake. Wait, they’re all fake.

Some Australian Bega Colby and Swiss Emmental

While I’m on the subject, Colby is also an eminently meltable cheese; not to be confused with eminently Emmental, which is suspiciously close to Emanual, and is even more eminently meltable. I sense a trend here. Did you get me my Cheez Whiz Bitcoin, boy?

In the interests of financial transparency, I’m holding onto my Dogecoin Clara bought me.


Sydney’s bubble tea, ranked

I got my first taste of bubble tea during the craze that swept Singapore during the early 2000s. It seemed for a while you couldn’t walk down anywhere from Orchard to Toa Payoh without bumping into someone slurping away at those large-strawed beverage apparatuses. Apperatii? Aiyo.

But it wasn’t till retuning to Sydney that I got well and truly hooked on the delectable concoction. The metropolis boasts no fewer than six chains, often situated directly beside each other! Below is a photo of such a longstanding rivalry outside the Chatswood railway station in — wait for it — Chatswood.

Photo showing a Sharetea and Chatime in Chatswood Interchange

Which has lead me to compile my own personal breakdown of the best chain bubble tea in Sydney, in descending order of preference.

  1. Happy Lemon
  2. Holy Shake
  3. Sharetea
  4. Gong Cha
  5. Chatime
  6. Easyway

Needless to say, is an overused phrase. This list also comes with a few caveats, which for your convenience I will include just as soon as I finish penning this pointless paragraph, complete with an observation that the word typing would have likely been more apt.

  • Happy Lemon closed down in Sydney, but it was where Clara and I had our first date, so much like the Eternal President, it shall remain.

  • The order of the latter establishments should not be construed to mean I wouldn’t partake of beverages from them. Far from eschewing (geshunteit) their wares, I’d still buy them. They’re all good.

  • I drink mine with half ice, no sugar, like a gentleman. Try it, the subtle sweetness from the cool tea is more than sufficient.


Stack Overflow survey omission

I just did the Stack Overflow developer survey; advertising, AI ethics, and employment were the big themes. Most of the questions were rote, but this one gave me pause:

Please rank the following advertising qualities in order of their importance to you: The advertisement is…

  1. relevant to me
  2. honest about its goals
  3. seems trustworthy
  4. offers something of value, like a free trial
  5. provides useful information
  6. avoids fluffy or vague language
  7. from a company I like

Where’s the mention of privacy? If we were feeling particularly charitable, we’d concede points two and three — honest about goals, and seems trustworthy — elude to it, but don’t mention it explicitly. I don’t think that’s good enough.

Relevent to me is the sinister option. We’ve been sold this idea that advertising can only be relevant if involuntary tracking is involved, so placing that highly on that list would be construed as an endorsement of that.

Online tracking is one of the biggest privacy issues of our time. Advertisements to me must respect our privacy, or I harbour no guilt blocking them. That’s the most important advertising quality.

If privacy is toasting it somewhere near Mercury, those other options would be orbiting in a tight, icy pack around Neptune. Not irrelevant, but close.

Security is also important. Third party advertising has been used as an attack vector before, and most online enhancements to security and privacy have come in spite of advertising tech, not because of it.

It’s possible to have privacy and security around these issues. They just need to be asked for and taken seriously. Stack Overflow’s survey was otherwise solid, but I was disappointed by that line of questions.


jOOQ SQL for Java

The jOOQ framework is pretty cool; it makes SQL look and work like Java.

This is an example from their page in raw SQL:

  SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, COUNT(*)
    FROM AUTHOR
    JOIN BOOK ON AUTHOR.ID = BOOK.AUTHOR_ID
   WHERE BOOK.LANGUAGE = 'DE'
     AND BOOK.PUBLISHED > DATE '2008-01-01'
GROUP BY AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME
  HAVING COUNT(*) > 5
ORDER BY AUTHOR.LAST_NAME ASC NULLS FIRST
   LIMIT 2
  OFFSET 1

And jOOQ-ified:

create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count())
  .from(AUTHOR)
  .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID))
  .where(BOOK.LANGUAGE.eq("DE"))
  .and(BOOK.PUBLISHED.gt(date("2008-01-01")))
  .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
  .having(count().gt(5))
  .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst())
  .limit(2)
  .offset(1)

Syntax highlighting would have made this better. But you get the jist.

At this stage, I’d normally comment about my brief history in Java. I’d mention that I did work as a Java developer in an enterprise setting briefly, and save from a severe bout of CamelCaseItis, it wasn’t altogether bad. Maybe something here about Scala and jRuby. I’d then identify my SQL as being tolerable, but enough to be dangerous. Finally, I’d mention this project being kinda cool, and its chaining of methods reminding me a bit of Ruby, followed with a pun about ActiveRecord.

But I won’d do that this time.


GitHub supported manifest files

GitHub has the concept of a dependency graph you can view in a public or private repo, to view relationships between dependencies and be alerted to security issues. According to one of my public repos, emphasis added:

To enable the dependency graph, your repository must define dependencies in one of the supported manifest file types, like package.json or Gemfile.

Interesting, I wonder what other manifest files are supported? Let’s click the link and find out:

To enable the dependency graph for your project, your repository must define Ruby or JavaScript dependencies in either a Gemfile or package.json file.

Huh, that was it?

The issue is like and either are not equivalent. The word like in this context suggests a partial subset; you wouldn’t say there are two condiment choices, like mustard and tomato sauce.

We have both kinds, country and western!