Cinemateket: a personal failure to build habit

The new slimmer Cinemateket. It never really came together, my going there out of habit. Habit-forming failure, if you will.

Now that they’ve scaled it all back to a trickle of must-see films from the nowadays-much-smaller showable-as-analog past, it’s lost much of its previous smorgasbord charm for me. Choosing not to view a certain film isn’t so very charming when it’s the only film.

In unrelated habit-building: My quest to see all of Star Trek: The Next Generation, with the redoubtable Sir Patrick Stewart intoning the Federation‘s credo about not meddling where one should not meddle, continues. if a little abated. I’ve noted a tendency to fall asleep at the tail end of the story, in the late act II. Note to self: perhaps one episode is enough for a night.

Recently, I have met several trekkies, whereas before I seldom met anyone who professed to know the slightest thing about the Star Trek franchise.  Of these enthusiasts, one is a lawyer, one a nurse who speaks Chinese, and one works with computer gaming industry issues. All of them highly knowledgeable on matters Trek.

Onward, into the year. Habits will form. I’m sure of it.

 

Here, a random Star Trek TNG piece of gossip: That replacement doctor – Dr. Pulaski – won’t come back in later episodes, because of the following, passively-worded reason:

Maurice Hurley, head writer and showrunner, did not like working with McFadden, and McFadden was fired at the end of the season 1. Diana Muldaur joined the production as the Enterprise’s new chief medical officer, Dr. Katherine Pulaski, for season 2.

Series creator Gene Roddenberry admitted that the Dr. Pulaski character did not develop a chemistry with the other characters, so McFadden was approached to return as Dr. Crusher for the third season. At first, she was hesitant, but after a phone call from co-star Patrick Stewart, McFadden was persuaded to return to the role, which she subsequently continued to play through the remainder of the series.

Source: the Gates McFadden wikipedia entry

 

Export data from MongoDB 3.0 and import it into MongoDB 2.6

I just had the dream meeting with a dockerized app. This is a use-case for containerization.

I had to use MongoDB 3.0 to export some data and place it in a 2.6. Ouch: The 2.6 can’t connect to the 3.0.

A genius sat down at the exact moment of my complaining. “Just use Docker.”

So – to get and run the 3.0 Docker image of MongoDB – started with a bash shell:

docker run -ti --rm -v /Users/olle/slask/portal-test:/backup mongo:3.0 /bin/bash

(Related: this works because of the last line in its ENTRYPOINT script: entrypoint.sh (see 3.0/docker-entrypoint.sh))

When that pulls down and starts the shell, things are automated, and we land in a shell.

There, we can do the 3.0 invocation of mongodump:

mongodump -h ds012345-a0.mongolab.com:12345 -d portal-test -u portal-user -p secret -o /backup/portal-test

This gave me a dump folder at:

/Users/olle/slask/portal-test/portal-test/portal-test

I had been too generous with the wrapping folders. No biggie.

Then, the local 2.6 invocation:

mongorestore -d portal-test /Users/olle/slask/portal-test/portal-test/portal-test

Bam.

A disciplined method to fix Rubocop TODOs

Here, a listicle of advice you never asked for!

A method to locate and fix linting errors in Rubocop one at a time:

  • choose a “cop” from the .rubocop_todo.yml file
  • remove the line which includes the .rubocop_todo.yml
  • rubocop --only Lint/IneffectiveAccessModifier
  • fix issues and test fixes with the --only invocation
  • rubocop --auto-gen-config to regenerate the .rubocop_todo.yml file
  • git checkout .rubocop.yml to add back include line
  • commit this change with the name of the “cop” used

I really really tried to use it at FakeFS.

Game prep

See, this list of game preparation is soon a year old:

  • Buy skulls as game chits.
  • Invite players and nag them to confirm attendance.
  • Read the text of the scenario to play.
  • Try out the conflict system. Practice run.
  • Realize the rules are many but smart.
  • List game activities.
  • Figure out snacks and food.

 

Hold Elasticsearch back on 2.4 for Chewy on macOS

So, Elasticsearch 5.0.0 is out.

I’m using Chewy, a Ruby DSL gem that’s quite good. It’s not quite there yet with the deprecated Query APIs, (see Release Notes), so to keep using it you need to hold back to the Elasticsearch 2.4 series which is the last stable release. (Question about this, answered in the issue tracker.)

Smoky mountain top
Every upgrade is a damn climb. Yesterday was a good day. It was until 15:00 before I came upon package management issues.

Here are a couple of Homebrew invocations to stay on 2.4, with full data-loss, since the index version has been upgraded.

curl localhost:9200

The output for 5.0.0 is:

{
  "name" : "61mKC-n",
  "cluster_name" : "elasticsearch_olle",
  "cluster_uuid" : "EtOE3oHxQRSur5_qhRr-TQ",
  "version" : {
    "number" : "5.0.0",
    "build_hash" : "253032b",
    "build_date" : "2016-10-26T04:37:51.531Z",
    "build_snapshot" : false,
    "lucene_version" : "6.2.0"
  },
  "tagline" : "You Know, for Search"
}

This is the version 5.0.0 that we can’t use with Chewy.

brew services status elasticsearch

If you don’t have one of those services running, you can skip a few steps.

brew services stop elasticsearch
brew unlink elasticsearch 

Now, with a clean slate, we can ask Homebrew to install a specific version (actually, a release series, “2.4”):

brew tap homebrew/versions
brew install elasticsearch24 
brew services start elasticsearch24

If you now run curl localhost:9200 you’ll may perhaps not see JSON ouput: if your index has been running on the 5.0.0, its lucene_index version would’ve been bumped, so that 2.4 can no longer read it.

The data files used by your Elasticsearch resides in /usr/local/var/elasticsearch. My node was called elasticsearch_olle and I decided to move all of its data out to a non-important folder on my harddrive:

mv /usr/local/var/elasticsearch/elasticsearch_olle ~/slask

After that, I could

brew services restart elasticsearch24

and then curl localhost:9200, to see the following 2.4 output:

{
  "name" : "Miss America",
  "cluster_name" : "elasticsearch_olle",
  "cluster_uuid" : "ym_Ovns4RHWqh-ZRcHWxcw",
  "version" : {
    "number" : "2.4.1",
    "build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
    "build_timestamp" : "2016-09-27T18:57:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}

“Winning.”

Photo credit: Kamil Szybalski

Pep before PolyConf 2016

I sat down to prepare to get to this year’s PolyConf. I trawled last year’s photos, and found these shots.

(All these photos were taken by polyconf. They’re also All Rights Reserved. So, just links instead of using the awesome paste-a-link-with-oEmbed-support.)

Me having coffee – hair-styling is remarkably difficult in high summer heat.

Will, author of Reasoned Schemer, having coffee sadly, this is the most flattering shot of hime in the collection. The spirited Salt Lake City hacker, whose infectious enthusiasm warmed many conversations was a kind soul and a C64 alumnus. Since then, I’ve bought his book, read half of it, perhaps. It’s mind-bending and kind at the same time. Progress must be slow, as I’m doing this on my own.

Portrait of Robert Virding, author of LFE is tending his language and its community at lfe.io, a decidedly sub-cultural website. For instance, by translating other people’s blog posts on Erlang to be about LFE. My computer still has an LFE install.

Robert Virding directing Joe Nash (Joe, who presented many a hackathon the world over)

Alban, conf org is a French cinéaste as well as a person who computers a lot

The Bodil birtday cake happened during the closing party

Portrait of Stefan Karpinski, Julia author who’s so genuinely nice that I believe he can run a programming language community. I also believe that community can open “fast execution” to many more people.

Portrait of Leah Hanson, Julia hacker who is working on Learning Julia for O’Reilly (to be published in 2016).

Portrait of Amir, MirageOS hacker who was also kind and nice. This community of communities is incredible like that. See Amir’s homepage and the MirageOS Marrakech Spring 2016 hackathon reports. for more notes and inspirational links.

Portrait of José Valim, Elixir author is someone I never spoke to, but his output is consistent and excellent.

Portrait of Jessica Kerr, functional programming hacker made (and makes) great talks. See her talks page.

 

 

KTHXBYE!

Around town in May

Peter visited Malmö, and we sat down to decompress at Simpan.

At Simrishamnsgatan 3
At Simrishamnsgatan 3

A fancy poster for a reading of a book by Swedish genius author Birgitta Stenberg.

A reading circle in Malmö, at Inkonst
A reading circle in Malmö, at Inkonst
For your safety, the sign claims
For your safety, the sign claims

 

Architecture Decision Records

adr-tools is a set of command-line tools by Nat Pryce that allows people in software projects to record their design decisions, as they go along, a bit like the captain’s log on the Enterprise. (Much more on such log entries at this wiki for trekkers.) You type adr new Use Postgres, and it creates a formatted Markdown file, with headings in place, ready for you to fill out, fleshing out your reasoning for the decision.

Computer book author Michael T. Nygard explains ADR in much more detail in this 2011 blog post. (Book tip: Release It! Nine years old, now. It’s about the things you have in production.)

That library, I had the good fortune to be able to make a Homebrew package (a tap, in the parlance) for it, making installation of the tool a one-liner. This is such a package: homebrew-adr-tools. That’s all there’s to it, just a homebrew-prefixed GitHub repository with that file in it.

I tried adding a feature to the tool, which led me to its outout-expectation-based test suite with its attendant Makefile. Pretty decent experience using them!

Convert character encoding of a CSV file for InDesign Data Merge

InDesign’s Data Merge feature is great. This is a video I return to, when I need to use it.

There is a catch, though: the data must be in the right format for this to work with Swedish text, which has å, ä and ö.

  1. Use a spreadsheet app to make a dataset (columns and rows)
  2. Use column names without spaces, and only lower-case characters. Do not use any “special characters”. So: only between a-z.
  3. Export it to CSV format
  4. Open the Terminal app in your Mac
  5. Change to your directory where the file is by dragging its folder into the Terminal window and hit ENTER.
  6. Type the following text command and press ENTER to change the file filen.csv to the target format (which is called utf-16):
    iconv -f utf-8 -t utf-16 < filen.csv > filen2.csv
  7. A new file filen2.csv is created in the same directory.
  8. Use this new file in your InDesign data merge!

Nerd notes:

  • Typing man iconv will bring up a text manual for the iconv command. Try it! (Quit the manual by typing q.)
  • the < and > are “output redirection” symbols, used in two directions in this so-called pipeline

The manual taught us that the command can be expressed as:

iconv --from-code utf-8 --to-code utf-16 < filen.csv > filen2.csv

This may be easier to read.

  • Changing directory can be done using the text command cd (“change directory”), followed by the path you want to navigate to.
  • pwd is a text command that reads “print working directory”. Try it!

Ruby: Rubocop-friendly Hash pretty-printer

You’re desperate. Your legacy code-generation code outputs a Hash using hash#to_s. You’ve flouted many Rubocop rules to get to where you are. Suddenly, it gets too much. You search the Web for a pretty-print function that you want: a Rubocop-friendly Hash pretty-printer.

Empty-handed, you cough up blood, while a police car’s red-blue lights flicker in through the blinds of your run-down office.

sethw-cop-car-lights

With tired fingers, you type out something like:

Then, you faint, blessed sleep converges on you and envelopes you in a colorless void.

Photo credit: sethw