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. Perhaps you need the command cd followed by a space and then drag the folder. (Tip from commenter Dima. Thanks!)
  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

IndieWeb clubbery

Tonight, I made it to Homebrew Website Club hosted at inUse in Malmö. I was greeted by three kind souls, among them a proprietor of a Lego fan website with a 176 contributors – and Pelle and Emil.

The club format is the same every time: first an hour of social or at-your-computer time. Then an hour of show-and-tell explanations, demoing and showing stuff.

Emil showed us CSS and SVG techniques, some of them brilliant. SVG is a deep well to drink from. Read more at Sara Soueidan’s website.

Pelle made a very nice hands-on demo of a system of services he’s built, which involved commenting on any page using his telephone.

We had talked about Node.js a fair bit, and I showed what the private caching npm server sinopia looks like when installed. Its claim to fame is its file-based caching – don’t fetch packages from the central repository more than you need.

When I had showed that, we had used up our time, and it was time to put the crisps down and go home. How kind, to have time limit, so that people on tight schedules won’t miss stuff.

On the way out, I asked: “Pelle, do you have a exercise for me to take home?” He responded immediately: “Make your site receive or send WebMentions.”

I look forward to next time.

Aiga forward and left arrow, an example of a random SVG

Git Pre-commit hooks!

Not even once!

Run relevant code-checking tools on your code, before it is even checked in locally. Using the Ruby project Overcommit, you can set this up on your own machine in a jiffy. Or, read more about git hooks.

I took these steps:

  1. Install the overcommit gem in your active Ruby. gem i overcommit
  2. Install overcommit in your system Ruby, using this neat trick:PATH=/usr/bin:/bin:/usr/sbin:/sbin sudo gem install overcommit – This makes it available to tools like SourceTree! (On committing, it opens a bare shell, without your cool settings.)
  3. In your project directory, where you wish to begin using Overcommit to run Git hooks: overcommit --init
  4. Configure the resulting .overcommit.yml to enable/disable the checks you want run.
  5. Try committing a file which would fail a check.
  6. Profit!

PS: Here is an example .overcommit.yml:

PreCommit:
  ALL:
    problem_on_unmodified_line: warn
  CoffeeLint:
    enabled: true
  RuboCop:
    enabled: true

PolyConf experience report

Yesterday morning, the ISS was resupplied, in a textbook example of a great space-station docking. I had just woken up, and saw the last 2 minute of the docking. Very exciting. Then I began trying to finish this conference overview. It’s more stream-of-consciousness than report. You’ve been warned.

So, outside the bubble of conference again. My tweeting will be less frequent. The friendly #polyconf hashtag has lots of tweets. The weather will be less scorching.

https://twitter.com/ruk/status/617802200056786944

The place: Poznan is getting better and better every time. Weather, shopping, eating.

People, a very small sample:

Felix and Karolina. My people. Conferences are meeting points, folded in spacetime, so that when you meet again, it’s as if no time has passed. (Terms and Conditions apply.) Cheers, you magical unicorns.

Robert Virding. Gave me a short personal Get Started tutorial with LFE (in Swedish) after we’d lunched, and ruminated on How Much We Got Right when defining the core principles of Erlang (when he was designing the language). A generous, thinking, caring community member.

Virding runs the LFE – Lisp-Flavored Erlang – project. So, the small community of people using Erlang, cut to a smaller piece by removing anyone who wouldn’t use Lisp – those people must love this language. And I believe they do. Being confident about your choices and tradeoffs, is a wonderful thing.

(There are more little on-top-of the Erlang-VM languages. Some of them even go outside the Erlang semantics, against the grain. Luerl, for one. Wow, I didn’t realise that was his project, too. And Erlog, too. Wow.)

Alban & Julien. On the evening of the last day, we got to talking about films. The two Frenchmen with their real French accents, me with my Cahiers du Cinéma fake accent. Tips of movies to watch: Raise the red lantern, Still the waters, Departures, and The Saddest Music In The World. We talked of Jodorowsky, Virginie Despentes and Gaspard Noé. How some films make you angry.

Stefan Karpinski. A friendly programming languages person who could speak Swedish. Also part of making Julia. A pierogi-eater. Much exciting is going on with the Julia language, which is a quite modern way to write fast programs. It was interesting to hear about the formation of the Julia company. Heady times.

Stefan just before his talk
Stefan just before his talk

Brendon McLean. A pierogi-eater. Great story-teller with a big heart. His work involves some scientific computing. He made a show-and-tell of his S-expression-based communications channel between Ruby and Python, by way of IPython Notebooks. Very grounded, calm in his presentation, but a very lively and present human being in conversation.

“My four-finger swipe isn’t so good with this thing on my finger.”

Brendon lives in beautiful Cape Town, where he sits in front of a computer all day.

Alex P. A pierogi-eater and monoid monger. Fine Clojure talk on timeseries work.

Alex, explaining this image

Pierre-Yves Ritschard. A pierogi-eater and maker of cluster management software around Mesos. Programmatic access to the cluster made easier using Clojure. “mesos interaction in idiomatic Clojure” as the repository succinctly states. Great slogan: mesomatic: the cluster is a library.

Amir Chaudhry. Not a confirmed pierogi-eater. MirageOS’er who introduced that ecology of tools. Slides from his talk can probably tell you some of the story. We had friends in common, and said hello over the ether to them.

The very pleasant and generous miniKanren evangelist William E Byrd: a home computer hacker. We talked of the Commodore 64 and of the 1541 (William described with disgust the design failures of that drive; read the details in the wiki article). He also shared insight on racing the beam programming in the Atari 2600. And, his 3-hour miniKanren tutorial was just stellar. The people in the room got the hang of the lingo, the thinking, the machinery, just by following along Will’s session. Quite a feat.

On Will’s generosity: every Sunday, he records an “uncourse” Hangout, which he publishes for free.

(Interesting: A CoffeeScript miniKanren – in literate CoffeeScript! Written in 2013 by fogus, with a name to honour Will.)

I guess I now need to put the Reasoned Schemer onto my book list.

Notions:

Conference apps must be offline Web apps. No more fiddly App Store have-to-update-app-to-update-schedule. Hoodie could be used to kick off that Web app.

About marketing: Make Tweets linking to your website more visible: Any content surfaced as shareable links should have a Summary Large Image Twitter Card to be more visible. Perhaps something for public software documentation, too.

 

Different fantasy: Dying Earth quote

The typical inhabitant of the Dying Earth speaks and behaves differently from characters in other fantasy series or people in real life. He is arrogant, greedy, indolent, and rakish. He loves fine food to excess and can’t resist the urge to correct others on obscure points of fact. Your character will differ from the norm only if you spend creation points on Resistance ratings. A Resistance rating allows the character to disregard one of these universal temptations. Each of the six major temptations requires its own rating.

Sleep was overrated, the welcoming amazing

Thanks Nukomeet, for a chatty pre-conference event!

Thanks Alexander, Lukasz, Agnieska, Alban, Zaiste, Arsenia, Marcin, Johanna. And Robert and Christoffer. You are awesome, welcoming and interesting.

(Quickly ordering rhubarb desserts just before the kitchen closed – top of my good-life game. The place with the kitchen open was Nifty No 20.)