Mini review: Stand on Zanzibar

I just finished reading (well, listening) Stand on Zanzibar by John Brunner. It won the Hugo Award, and has often been mentioned both by casual readers and by SF authors a must read, so I decided to give it a go.

I didn’t like it very much, but read till the end. Some minor spoilers included.

stand on zanzibar (audible thumbnail)

The Good & The Bad

The world building is pretty good, and the author uses the trick of having whole sections of jumbled up snippets, like zapping through TV channels, so that you get a bunch of advertisement, news reel and so on.

This is of course a common trope (my favourite Shaun of the Dead scenes plays on this) but it allows the writer to just give a ton of depth while avoiding character infodumping. It does not work too well on an audiobook, alas.

The plot lines are much of the same tho. We have multiple things happening, only tangential to each other.

There’s the megacorp that wants to develop something huge in Africa. There’s the afram (sic) manager which has risen quickly in the company ranks using his ethnicity. There’s the super-AI owned by the megacorp which is unable to approve the plans because they’re based on what it thinks are invalid assumptions. There’s the rising power of China with its own super-AI. There’s government-enforce eugenics, genetic manipulation, buying kids and baby farming in underdeveloped countries. The rise of a new power in south-east Asia. There’s the media controlling narrative and people living in their own bubble. There’s the truth-sayers which speak of the dangers of everything and are not censored, but they are basically ignored.

But, again: there’s so much stuff, and so little unity. I am not saying it’s badly written. It’s written perfectly. It’s just that I have not cared for this style since I hit 30.

The awesome

But wait, let’s go back to the worldbulding: it’s a really good world, and it holds together, and it feels very predictive, and modern and speaking a lot about our society.

But it was published in 1968. This means it is closer to World War I than it is to today. It’s a time when computers were in their infancy, and black&white TVs were still outselling the Color ones.

The author hit so many targets that it’s honestly mindblowing. And the writing still feels fresh and not dated at all.

So, I didn’t like this book very much, but I have to say: maybe read it anyway.

Vote: 6.5/10

PS

The AI, Shalmaneser, refuses to predict the economic results of the company’s projects in Beninia. I tried asking ChatGPT, and, alas, it also refused. So, mark one more point for the author.

Solving Advent of Code Day 21 using Z3 and Ruby

This year (2022) I decided to finally try to use Z3 to solve an Advent Of Code challenge, Day 21, to be precise.

Z3 is a theorem prover/SAT/SMT solver, which means “it will solve problems for you“. This is what computers are supposed to do, and I loved this stuff since I did an Operational Research exam in University.

Z3 can solve a variety of problems, but for this problem we just need to understand how it solves simple equations.

How to do algebra with Z3/Ruby

The Ruby bindings for Z3 are not as popular as, say, the python ones, but they work just fine. Install Z3 using your favorite tool (mine is MacPorts), and then the gem

$ port install z3
... compiling stuff
$ gem install z3
... compiling more stuff
$ ruby -r z3 -e 'p Z3.class'
Module

You can start coding now.

To solve an equation with Z3 you define a model composed of variables, values, and constraints, and then ask the solver to fill in the blanks.

The simplest thing you can do is a basic math expression

require 'z3'
solver = Z3::Solver.new

# the argument is the name of the variable in the model
a = Z3.Int('a')
b = Z3.Int('b')
x = Z3.Int('x')

solver.assert a == 1
solver.assert b == 3

solver.assert x == a + b

if solver.satisfiable?
  p solver.model
else
  puts "I can't solve that, Dave"
end

running this should give you

$ ruby additionz3.rb
Z3::Model<a=1, b=3, x=4>

Behold! You can do basic math!

The interesting bit is that Z3.Int is a Z3::IntExpr object, and when you mix it with numbers or other expressions you get back more of the same, you can explore this in irb

>> require 'z3'
=> true
>> a = Z3.Int('a')
=> Int<a>
>> a.class
=> Z3::IntExpr
>> b = a+1
=> Int<a + 1>
>> b.class
=> Z3::IntExpr

You can of course use other operators, such as relational operators. This is how you solve the problem of finding a number between two others

require 'z3'
solver = Z3::Solver.new

a = Z3.Int('a')
b = Z3.Int('b')
x = Z3.Int('x')

solver.assert a == 1
solver.assert b == 3

solver.assert x > a
solver.assert x < b

if solver.satisfiable?
  p solver.model # Z3::Model<a=1, b=3, x=2>
else
  puts "I can't do that Dave"
end

you can solve a system of equations in pretty much the same way. The classic puzzle SEND+MORE=MONEY where each letter is a different digit can be solved like this

require "z3"
solver = Z3::Solver.new

variables = "sendmoremoney".chars.uniq.each_with_object({}) do |digit, hash|
  # All variables are digits
  var = Z3.Int(digit)
  solver.assert var >= 0
  solver.assert var <= 9
  hash[digit] = var
end

# define the words in terms of the digits
send = variables["s"] * 1000 + variables["e"] * 100 + variables["n"] * 10 + variables["d"]
more = variables["m"] * 1000 + variables["o"] * 100 + variables["r"] * 10 + variables["e"]
money = variables["m"] * 10000 + variables["o"] * 1000 + variables["n"] * 100 + variables["e"] * 10 + variables["y"]

# the leftmost digit is never zero
solver.assert variables['s'] > 0
solver.assert variables['m'] > 0

# all digits are different
solver.assert Z3.Distinct(*variables.values)

# define the actual expression
solver.assert money == send + more

if solver.satisfiable?
  # get the values from the model, indexed by their name
  values = solver.model.to_h
  # map each letter to the variable and find each variable in the model
  "send + more = money".chars.map do |char|
    var = variables[char]
    print values[var] || char
  end
  puts
else
  p "Impossibru!"
end

should print

$ ruby smm.rb
9567 + 1085 = 10652

Solving Day 21 with Z3

Spoiler alert: this covers part 2 which is not visible unless you solve part 1.

The problem is: you have a set of monkeys shouting at each other, defined like this:

root: pppw = sjmn
dbpl: 5
cczh: sllz + lgvd
zczc: 2
ptdq: humn - dvpt
dvpt: 3
lfqf: 4
humn: ?
ljgn: 2
sjmn: drzm * dbpl
sllz: 4
pppw: cczh / lfqf
lgvd: ljgn * ptdq
drzm: hmdt - zczc
hmdt: 32

to the left of the : you have the monkey name, and to the right something they shout. A monkey shouts either a number, or the result of an operation based on numbers shouted by other monkeys, except for two of them: the monkey named root will check if the two numbers are equal, and humn represents you: you need to yell the right number so the equality check returns true.

My Clever Reader will have realized this is a simple algebraic problem, but the real input is large, to solve it you would have to think, determine the order of the operations, build a tree.. yeah I got bored already.

But executing instructions is what the Ruby interpreter does. And there is a clear mapping from the input a ruby+z3 instruction. So… let’s just transpile the input to a ruby program!

Each input line becomes an assert, we add a prologue, eval it, and then ask for a solution:

require 'z3'
input = <<~INPUT.lines
    root: pppw + sjmn
    dbpl: 5
    cczh: sllz + lgvd
    zczc: 2
    ptdq: humn - dvpt
    dvpt: 3
    lfqf: 4
    humn: 5
    ljgn: 2
    sjmn: drzm * dbpl
    sllz: 4
    pppw: cczh / lfqf
    lgvd: ljgn * ptdq
    drzm: hmdt - zczc
    hmdt: 32
  INPUT

# create a hash monkey-name -> variable 
# so we can look them up by name
env = Hash.new { |h, k| h[k] = Z3.Int(k) }

# convert the input to a ruby program 
prog = input.map do |l|
  # root checks equality
  l = l.sub(/root: (.*) \+ (.*)\n/, 'solver.assert env["\1"] == env["\2"]' + "\n")
  # this is our incognita, just get rid of it
  l = l.sub(/humn: (.*)\n/, "\n")
  # assert a variable as an exact number
  l = l.sub(/(\w+): (\d+)\n/, 'solver.assert(env["\1"] == \2)' + "\n")
  # assert a variable as the result of a binary operation
  l = l.sub(/(\w+): (\w+) (.) (\w+)\n/, 'solver.assert(env["\1"] == (env["\2"] \3 env["\4"]))' + "\n")
  l
end

solver = Z3::Solver.new
# ger the program in here
eval(prog.join)

# solve and show our solution
p solver.satisfiable?
# ask for a solution
p solver.model.to_h[env["humn"]].to_i

If you remove the input, this boils down to ~10 lines of code.

Is it ugly? Yes. Is it cheating? Probably. Is it running eval on random input I just downloaded from the internet? You bet it is.

But I had a lot of fun.

Cosa dicono i topi nella canzoncina di Kit & Sam?

TLDR: in “Misteri del regno animale” nella canzoncina dicono “File dei Fatti”

I miei figli hanno preso a guardare Kit & Sam – Misteri del regno animale su Netflix.

È un cartone animato simpatico, dove due detective animali risolvono casi mentre insegnano qualcosa su qualche specie. Hanno trattato alcuni dei miei animali preferiti, come la tartaruga azzannatrica e l’eterocefalo glabro (“talpa nuda africana”), e secondo me è un cartone carino..

Ma: c’è una sigletta in cui la “Squadra Topi” canta una sigletta con ritornello incomprensibile (in italiano).

Bill & Jill – La Squadra Topi

Perché dico che è incomprensibile? Perché né io, né i miei figli siamo riusciti a capire cosa dice. Fan dei botti? Fan dei topi? Fatti Fotti?

La curiosità mi stava uccidendo. Al che uno dice, vabè, cerco su internet.

Dai suggerimenti di ricerca di DuckDuckGo e Google è evidente che non sono la prima persona, ma è pure chiaro che non c’è risposta su internet. Ho provato pure con Netflix Italia su twitter, ma nessuna risposta.

Ma basta leggere i sottotitoli, diranno ora i miei lettori. Cal cavolo, perché ovviamente i sottotitoli italiani non corrispondono all’audio italiano, come spesso accade. Nei sottotitoli dicono solo “Dossier!

Grazie al cielo, si può sempre contare sugli adattamenti parola per parola di Netflix: in inglese è “Fact File“, quindi in italiano probabilmente dicono “File dei Fatti“.

Posso anche io unirmi al tormentone del cartone animato “un altro grande caso: risolto!”

Hello, ActivityPub World!

People are busy migrating from Twitter to Mastodon. I have had an account on mastodon.social for a while, but I don’t use it much.

But you know what I use ? This blog! And the nice thing about the fediverse is you can connect many things to it, including WordPress instances 🙂

You can see my ActivityPub feed here and subscribe to it in any software that supports it, in theory. In mastodon, you can also look it up as @[email protected].

So, how do you do connect a WordPress blog to mastodon, friendica & co? Use the sweet plugin to support ActivityPub by Matthias Pfefferle and that might be enough.

Sadly, for me it wasn’t. It seems to work the plugin publishes your ActivityPub stream through a URL which goes under the author profile, so to make it work, you need to have author profile pages enabled (stuff like this).

And I did not! As it appears some plugins such as Yoast will disable it for you.

To enable author profiles blocked by Yoast go to “Yoast SEO” -> “Search Appearance” -> “Archives“, and ensure Author archives are enabled.

Enable author archives to get ActivityPub to work with WordPress and Yoast

You can tweak the plugin to check what you post, but it’s pretty straightforward, and it will produce items like this .

Notice the plugin (ATM) allows you to post and be followed, but it does not allow you to follow and read other users (yet?).

Other than that, it works like a charm, and the author has a few other fediverse-related plugins, such as the one for WebFinger, go check them out.

The only thing missing now is an ActivityPub social link icon, but hey, let’s give it some time.

Ruby, RVM, MacPorts and OpenSSL on macOS (Monterey)

This is not so much a blog post but a log for the sake of future Me:

I have been using MacPorts on macOS for many years and am 99% happy with it: it allows installing binary packages and source ones with custom options, allows multiple versions to live side by side, has a lot of packages, can dump the whole list of installed stuff so you can re-install it elsewhere easily and many other things. It’s great.

I have also for a long time used RVM as my ruby version manager of choice. Again, it just works.

An issue with installing older rubies in recent macOS is that the system-provided OpenSSL is version 3, and ruby before 3.1 cannot build against it.

You can get OpenSSL1.0 or 1.1 via MacPorts, but there’s another problem: when you try to install anything recent via MacPorts you will end up with OpenSSL3, and at that point you will have problems building old ruby versions or old versions of gems like eventmachine or puma, expecting to have OpenSSL1.

This problem manifests itself when installing ruby 2.7 via RVM with a build/install log that ends like this

/Users/riffraff/.rvm/src/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- openssl (LoadError)
        from /Users/riffraff/.rvm/src/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in `require'
        from /Users/riffraff/.rvm/src/ruby-2.7.6/lib/rubygems/specification.rb:2430:in `to_ruby'
        from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
        from ./tool/rbinstall.rb:279:in `open_for_install'
        from ./tool/rbinstall.rb:845:in `block in install_default_gem'
        from ./tool/rbinstall.rb:835:in `each'
        from ./tool/rbinstall.rb:835:in `install_default_gem'
        from ./tool/rbinstall.rb:799:in `block in <main>'
        from ./tool/rbinstall.rb:950:in `block in <main>'
        from ./tool/rbinstall.rb:947:in `each'
        from ./tool/rbinstall.rb:947:in `<main>'

the ruby binary is actually built correctly but the openssl extension failed to build, which you can tell by looking back in the build history

*** Following extensions are not compiled:
openssl:
         Could not be configured. It will not be installed.
         Check ext/openssl/mkmf.log for more details.

If you look into .rvm/src/ruby-2.7.6/ext/openssl/mkmf.log you will find

/Users/riffraff/.rvm/src/ruby-2.7.6/ext/openssl/extconf.rb:111: OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required

So it seems to have ruby use OpenSSL1 you should uninstall OpenSSL3 and everything that depends on it.

FWIW, I think that works, but it’s not ideal.

But fear not! There’s a better solution! You just need to tell RVM (and ruby) to use look for headers and libraries in the right place.

To do this you need to both specify where pkgconfig is and which openssl directories to use.

Luckily, this is not difficult, follow this incantation

$ PKG_CONFIG_PATH=/opt/local/lib/openssl-1.1/pkgconfig rvm reinstall 2.7.6 --with-openssl-lib=/opt/local/lib/openssl-1.1 --with-openssl-include=/opt/local/include/openssl-1.1

You effectively have to tell ruby how to configure itself, and how to find OpenSSL1 at compile time and at link time.

In theory --with-openssl-dir should be enough, but AFAIU MacPorts puts stuff in separate directories which does not play well with ruby-build. Which is fair, as ruby-build does not explicitly support MacPorts, but rather homebrew.

Anyway, once this is solved you may still encounter issues when installing gems that depend on OpenSSL, as those will also need to be told where OpenSSL is.

For example,. this is the error I get installing puma 5.6.4

compiling puma_http11.c
linking shared-object puma/puma_http11.bundle
Undefined symbols for architecture arm64:
  "_SSL_get1_peer_certificate", referenced from:
      _engine_peercert in mini_ssl.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [puma_http11.bundle] Error 1

make failed, exit code 2

The equivalent error for eventmachine would be something like

linking shared-object rubyeventmachine.bundle
Undefined symbols for architecture arm64:
  "_SSL_get1_peer_certificate", referenced from:
      SslBox_t::GetPeerCert() in ssl.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rubyeventmachine.bundle] Error 1

Luckily you the same technique works to install older gems that need OpenSSL1. Notice you need an extra -- to separate the arguments provided to the gem configuration script from the ones to the gem command.

$ PKG_CONFIG_PATH=/opt/local/lib/openssl-1.1/pkgconfig gem install puma -v '5.6.4' -- --with-openssl-lib=/opt/local/lib/openssl-1.1 --with-openssl-include=/opt/local/include/openssl-1.1

(also worth noting: puma 5.6.5 builds without problems, see this and this)

So, hopefully I will be able to forget old code that relies on OpenSSL1 at some point, but in case I need it again: hey future Me, this is how you workaround the issue!

A note on ruby 3.0

If you build ruby 3.0 with MacPorts it will not explode, but it will not build the OpenSSL extesion, in /Users/riffraff/.rvm/src/ruby-3.0.4/ext/openssl/mkmf.log you will find the same error you’ve just seen

/Users/riffraff/.rvm/src/ruby-3.0.4/ext/openssl/extconf.rb:113: OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required
	/Users/riffraff/.rvm/src/ruby-3.0.4/ext/openssl/extconf.rb:113:in `<top (required)>'
	./ext/extmk.rb:214:in `load'
	./ext/extmk.rb:214:in `block in extmake'
	/Users/riffraff/.rvm/src/ruby-3.0.4/lib/mkmf.rb:331:in `open'
	./ext/extmk.rb:210:in `extmake'
	./ext/extmk.rb:572:in `block in <main>'
	./ext/extmk.rb:568:in `each'
	./ext/extmk.rb:568:in `<main>'

and this in turn will mean you can’t build puma or eventmachine or other things that depend on the ruby openssl extension

$ gem install puma
ERROR:  While executing gem ... (Gem::Exception)
    OpenSSL is not available. Install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

But you’re good, the same solution as before will allow you to install that version of ruby too

$ PKG_CONFIG_PATH=/opt/local/lib/openssl-1.1/pkgconfig rvm install 3.0 --with-openssl-lib=/opt/local/lib/openssl-1.1 --with-openssl-include=/opt/local/include/openssl-1.1

From ruby 3.1 onwards, ruby will build just fine with the system-provided OpenSSL3, so you will be able to avoid these shenanigans.

You can still build against MacPorts’ version of OpenSSL1 or OpenSSL3 by using the right paths.

Happy hacking future Me!

On Adaptations and Empathy

Recently Netflix aired the first season of their adaptation of The Sandman, and I finally got a chance to watch it.

I loved the original comics, it’s one of my favourite works. I also listened to the audible production and I liked that one too.

So, like everyone on the internet, I am going to share my opinion on the tv series, and also on other adaptations, geopolitics, and everything else.

I mean, it’s a blog.

For those that don’t know anything about The Sandman, feel free to skip this part. Be warned, spoilers ahead.

Netflix’s Sandman

The important thing to know about the Netflix adaptation is that it saw the direct involvement of Neil Gaiman, the original author of the comics. This is, in theory, great.

The problem is: usually, when a work is adapted to a different media you can be angry at whoever ruined the thing you loved, but in this case that would be the same person who created it!

In particular, people got angry for a few specific reasons, and I’ll try to review them.

Woke casting

People accused the produces of changing characters to fit recent diversity-satisfying trends. This is the “Death was a goth with pale skin, she can’t be a black girl!“. This is, generally speaking, a pretty stupid objection, even if it is true.

The original comic was “woke” before the expression existed, sporting trans and non-binary characters, gays and lesbians, mixed ethnicities…

Generally having that typical ’80/90s “we should love each other even if we’re different” brand of good sentiments that you may remember from We Are the World or successful ads.

So, Gaiman did more of the same, intentionally. I don’t feel it’s reasonable to be upset about this.

But personally: we didn’t get John Constantine! I don’t mind that we got a Johanna, but I do mind that we went from a loser kind of guy with bad hair and a shitty trench coat to a fancy lady with a white immaculate one. Still, I don’t think it matters much.

Also, I didn’t particularly like Lucifer’s casting, nor Dream itself, nor Lucien. I did like Death a lot, and Desire, and John Dee, so I hope I’m not just being an old fart.

Plot changes

This relates to changes small and large, such as Dr. Dee not killing the lady who gave him a ride, his mother helping him, Dream recovering part of his powers by uncreating Gregory, the diner episode being vastly different, the battle with Lucifer instead of Choronzon, the Burgess story being somewhat different etc.

Overall, I don’t think these changes matter nor do they bother me much, but I feel many of them share a common trait: this version of Sandman, both tale and character, is kinder.

As an example, consider the Calliope episode. The original story is a lot more harsh, showing her always(?) naked and making the rape and abuse feel very real. I can understand why that might not fly on general audience TV. Also, using raped women as props is not great anyway, so she got more characterization for TV, which is good.

But then, at the end of the TV episode, she goes “to inspire the world anew” while in the comics she just goes on to fade from the world, the era of greek muses long gone. I liked the old ending more.

More importantly, the relation between her and Dream differs. In the original story Dream is very cold to her, as essentially he’s a dick.

The same is true for the story of Nada, which was omitted from the TV show. That story is great, because it shows Dream falling in love, and being angry and unfair and egotistical.

This was great, because Dream needs to be a piece of shit at the beginning of the story, or it will not matter to us that he needs to change.

Gaiman famously summed up the comic with the line

The Lord of Dreams learns that one must change or die, and makes his decision.

But in the TV show he’s just.. grumpy? By making the character less unlikeable, we automatically get a less interesting development. I don’t understand what the producers were going for.

Missing DC references

The original comics were firmly set in the DC universe. This meant that there were a ton of DC characters all over the place, some you may not even have noticed (Cain, Abel, Eve , Lucien…).

Many important ones, like Batman and Joker have been omitted from the TV adaptation altogether. This seems more a case of avoiding legal trouble than anything else, and I honestly didn’t miss them at all.

Am I lost in Translation?

So, yeah, I think the Netflix Adaptation is ok, but I do have a few gripes with it. But one may wonder: am I just an old fart who hates change, and I would never be happy with any adaptation?

Dear Reader, I think I am not. In fact, I believe the Audible’s audio adaptation is almost perfect. It has incredible cast, great production and is 100% better than Netflix’s, and in some ways better than the comics.

It only has 3 defects

  • some of the background sound effects are too loud
  • some of the special effects on voices make them too hard to understand
  • for some reason they dubbed Death so it sounds like a 13yo who can’t speak properly

Maybe I have a specific issue with screen adaptations? Let’s review some.

A triptych of screen adaptations

As evidence that I do like screen adaptations even if they deviate from the source material, I will list 3 where I liked both the comic book version and the screen one, as I (re-)watched or (re-)read these recently.

V for Vendetta

The 2005 movie is quite faithful to the source comics, and I love it. There are some fundamental differences (e.g. the Leader in the movie is an a-dimensional bad guy; V in the comic is darker, crazier and less likeable) but it’s pretty great anyway! In fact, I think I enjoyed the movie more than I enjoyed the comics.

Bu I have seen the movie before the comic, maybe that tinted my opinion? Let’s try another one.

All you need is kill

Here, I read the manga after I watched the movie The Edge of Tomorrow. Interestingly, they are both adaptations, the original source being a light novel.

I think they are both good, but the manga has a better plot, with a nicer ending. The movie devolves into standard hollywood good-kill-bad happy ending, while the manga/light novel keeps you on your toes with an ethical conundrum and leaves you once that is solved, the ongoing alien invasion remaining in the background. Once the battle for the character’s soul is done, we don’t really need to care too much about aliens.

But ok, this was a manga, what about western stuff?

Watchmen

I loved the Watchmen graphic novel, including the squid bit. But I loved the movie too!

First, it has gorgeous photography and great casting.

Second, it has one of the best intro ever made for a movie, managing to sum up an entire backstory in 5 minutes of stunning imagery and perfect soundtrack.

Third, the changes from the original material are there and not always good (Rorschach becomes a positive character, the sex scene is far too long, the lack of squids disappointing), but they don’t really impact the plot.

Is it the same as the original graphic novel? Nope, but it’s still good.

The problem with people

So, I don’t think I’m particularly biased against adaptations, but I just don’t think The Sandman on Netflix was very good. I would watch another season, but heck, I watched the Cuphead show too.

But the whole kerfuffle was interesting to me. A lot of people got pissed off by the adaptation, and Neil Gaiman has been kind of a dick to some of them, much like they were being dicks to him.

I have seen people get upset at adaptations for a long time, and I have been upset myself. When the revolution comes, people who produced The Dark Tower movie will be the first against the wall.

But why do people get upset? Some of the people who make noise about media products do it out of general politicking: they don’t care about the material, and are just looking for an excuse to spew their favorite opinions. Shit there’s people arguing about a homosexual couple in Peppa Pig these days.

Some others get upset because they love the material, and feel betrayed. It’s easy to frame everyone who got upset about Death being black as being a racist bigot, but I think some of them genuinely just loved the specific representation of the character and wanted to see that.

Did you notice it? I did the same about the audio version of Death.

If you spent a bunch of time with anything it becomes part of your identity, and when someone makes an adaptation which does not match your interpretation you perceive it as an attack on you.

This is essentially the reason why italians get mad at foreigners’ faux italian food.

Fans are people

And the thing is, it doesn’t really matter if the consumer of a work is aligned with the author. Alan Moore famously said

[Rorschach] is what Batman would be in the real world.

But I have forgotten that actually to a lot of comic fans, ‘smelling’, ‘not having a girlfriend’, these are actually kind of heroic!

So Rorschach became the most popular character in Watchmen. I made him to be a bad example. But I have people come up to me in the street and saying: ‘I AM Rorschach. That is MY story’.

And I’d be thinking: Yeah, great. Could you just, like, keep away from me, never come anywhere near me again as long as I live?

For those people, Rorschach is good, and he’s part of their identity. Changing it would upset them.

Dear Reader, I know what you’re thinking: but Gabriele, these are idiots, and we should tell them to fuck off.

Well, I agree in part. But I think it’s worth exercising some empathy anyway. Yes, some people hold opinions that I find reproachable, but I think we should try to be compassionate. It’s easy to be nice to those you like, but we should be nice to those we don’t.

As the saying goes, do not judge someone until you walked a mile in their shoes.

Authors are people too

At the same time, fans should try to show empathy to authors too. Yes, maybe an adaptation is not a good as the original, but have you considered the author’s reason?

This could be the best they could do, and you would have done the same.

Or maybe the author changed over time? I’m pretty sure Gaiman@2020 is very different from Gaiman@1980.

Or maybe, they were trying to stick to a theme, and they have just produced a different representation of the same message.

Yes, sometimes people just make money-grab adaptations of something, which basically only share a name with the original (looking at you, I Robot).

In those cases, i recommend keeping your hopes up, and just consider this stuff as random productions you don’t care about.

Understand this does not damage your self. The thing you loved is still there. They made a shit job, but they also had reasons, you just don’t know why.

The problem with geopolitics

I am too incompetent to discuss about big themes, but I wanted to share a last thought: in Europe, a lot of attention in 2022 went to the Russia-Ukraine war. Maybe now we will now start paying attention to the Azerbaijan-Armenia war.

Wars are a terrible thing, we should help the people who are being attacked in every way, and condemn the attackers. There is no argument about this.

I just have a thought on talking about the war. You may unintentionally upset someone, and be hurt in return. Try to be tolerant and empathic, you don’t know what the others experienced.

A lot of good things start from empathy, maybe peace too, in the very long term.

Building ruby 2.7 on macOS with MacPorts and OpenSSL3

Recently I got a new apple box (an M1 MacBook Pro, which is nice, if a bit bulky), and found myself in the need to re-establish my dev environment.

This meant re-compiling various old ruby versions which I need for some projects. The problem is old ruby releases before ruby 3 required an equally ancient version of OpenSSL

I have used RVM for many years and it has a nice integration with MacPorts, my favorite macOS package manager. Getting the ports I need on a new install is straightforward, you just get a list of installed packages from one machine and reinstall them on the other. And RVM knows how to get rubies when you encounter a .ruby-version file, so no issue there.

But there’s a catch: I am using OpenSSL3 for most of my stuff, but I need OpenSSL1.0 or 1.1 to build ruby 2.7.5 and older.

If you google this, you will find plenty of bug reports against RVM, ruby-install, puma and plenty of others, with varying suggestion to use --with-openssl-dir, or setting PKG_CONFIG_PATH, overriding LD_FLAGS, and other incantations.

These may work in some cases, but not all: it seems an underlying problem is that if you have multiple versions of OpenSSL the ruby configure script may end up overriding the openssl-dir setting, and still end up linking against the incorrect library.

Luckily, the solution is pretty straightforward if you ignore all those recommendations 🙂

Try this

  • Install OpenSSL3: sudo port install openssl3
  • Install Ruby 3: rvm install 3.1
  • Check that it works and it loads openssl fine, by running something like ruby -ropenssl -e 'p [RUBY_VERSION, OpenSSL::VERSION]'
  • Install OpenSSL1 sudo port install openssl1
  • Remove v3: sudo port uninstall openssl3 (keep things that depended on it if you want)
  • Install older rubies: rvm install 2.7.5
  • Check those work too
  • Reinstall openssl3

Everything should now work fine, because MacPorts has no issues with multiple library versions sitting next to each other, and each ruby is linked to the appropriate one. Packages that depend on V1 or V3 will also just be happy next to each other.

Notice, I did this once already almost a year ago, and I had totally forgotten about it.

So here’s this small post, in the hope it may help someone, or at least my future self.

What’s an haiku anyway?

Some time ago, I discovered speculative fiction poetry exists, and there’s a huge and varied world of poets, magazines, awards, associations and so on.

This is poetry that plays with the what if scenarios typical of Sci-Fi, Fantasy, Horror, et cetera. As a long time reader of that genre, I thought I should read some. Heck, I thought, I should try writing some myself!

But actually, I never loved poetry much. I think it’s because of with my upbringing.

In Italian schools you are mainly exposed to three kinds of poetry

  • Dante Alighieri, and his Commedia. The thing is insanely good. It has a strict form, the terza rima, which means every line rhymes with two others in an endless chain. It also has incredibly moving passages, beautiful characters, great allegories, and imagery so strong that it has inspired basically half of the creative works that refer to the after life in the last 700 years§ . Movies, music, comics, videogames, programming languages. Another giant, T.S. Eliot, wrote

Dante and Shakespeare divide the world between them. There is no third.

Thomas Stearns Eliot 
  • “standard” poetry such as Leopardi, Foscolo, Pascoli, Manzoni etc. Each great in their own way, and of course there is infinite variety, but you know, it’s poetry as you imagine it should be.
  • “special effects” poetry. Ungaretti and Montale with their 1-4 lines poems are the chief examples here. And for the sake of example, this is one of Montale’s most famous works§

Everyone stands alone on the heart of the world

pierced by a ray of sunlight:

and it’s quickly the evening.

“Ed è subito sera” (and it’s quickly the evening) – Eugenio Montale

Students love and hate these. They love them, because they do get something out of them, without putting too much effort into it. At the same time, they hate them because they see little effort from the poets§.

Anyway, you see, I grew up not caring much about “standard” poetry, and liking strict forms. But give me special effects and an a-ha! moment and that works for me. Convey something great in less than 20 lines, and I’m with you. Otherwise I’ll let someone else read you. Which brings me to haikus.

In folk knowledge, haikus are a form that is traditionally Japanese, a three line poem with a structure of 5-7-5 syllables§ . The chief example is usually from  Matsuo Basho:

An old pond!

A frog jumps in

the sound of water.

Matsuo Basho

I like this! it’s a great image, it’s short, it has an a-ha moment, it resonates with minimalist me.

The chief counterpoint from modern English language haikus is§

Haikus are easy

but sometimes they don’t make sense

refrigerator

anonymous internet person

I like this one more! The form is there, the a-ha moment too, it’s self-referential and fun.

But turns out, no it’s not an haiku, really.

Haiku, senryu, hokku

You see, a traditional Japanese haiku is not a poem with 5-7-5 syllables. Japanese poetry does not count syllables, it uses something called on, which are close to morae in Latin.

The difference is mainly that you can have multiple morae in a syllable. A word like “strength” is a single syllable in English, but would be multiple morae.

So, you have a verse like

long cat is long

which can be 4 syllables, but possibly 7 morae. I don’t know how many! There’s no official way to count morae in English! Plus, it depends on where you put the stress, the same word may have more or less morae depending on pronunciation. But 17 morae are generally shorter than 17 syllables, an English haiku would sound longer than a Japanese one.

It’s not enough to have the 5-7-5 structure anyway, traditional haikus are expected to include a kigo, or seasonal reference. Our refrigerator joke-ku should be

haikus are easy

sometimes they don’t make sense

air conditioner

me

Now you know it’s about summer so we’re closer. But there’s more! The classical Japanese haiku is expected to have a kireji, or cutting word, which splits the poem in two. In our example this could be the em-dash (“—”), but in the original form it can be a suffix, part of a verb conjugation or any from a set of 18 very specific things, used anywhere in the poem.

The final detail is that an haiku should have a juxtaposition, it should have two things next to each other, to reflect or give meaning. This is our a-ha moment, I would say.

But you see, people like short poems and get bored with rules, so modern Japanese haikus don’t respect these rules. And ancient people didn’t either, and got bored talking of seasons!

So we have senryus, which have the same metric form, but are about people, and are typically satirical or darkly humorous. The chief example is from Senryū who launched this genre and got it its name

the robber

when I catch him

my own son

Karai Senryū

Finally, what is a 5-7-5 stanza which is neither haiku nor senryu? It’s usually called an hokku.

English language haiku

For all intents and purposes, I am now an english writer, so how does english use haikus?

Well, some consider the first english language standalone hokku or haiku the following one

The apparition of these faces in the crowd:

Petals on a wet, black bough.

In a Station of the Metro” by Ezra Pound

Yep, it’s not 17 syllables, nor is it three lines. I invite you to peruse the winners of the Haiku Society of America Awards and look for a 5-7-5 pattern. There is none! There’s even a single line micro-poem!

Winning writers did a survey of Haiku publications some years ago and discovered that none required the 5-7-5 pattern.

So, english language haikus do not need a precise form, nor have a specific topic. They are, by most rules, not haikus.

And yet.. they are? Beyond the formalities, there seem to be something shared there. The Academy of American Poets says something similar:

As the form has evolved, many of its regular traits—including its famous syllabic pattern—have been routinely broken. However, the philosophy of haiku has been preserved: the focus on a brief moment in time; a use of provocative, colorful images; an ability to be read in one breath; and a sense of sudden enlightenment.

Academy of American Poets

I like this, I like it a lot. I think there’s more tho. The haiku, classical or modern, requires effort from the reader. The Modern Haiku journal has this definition

Haiku is a brief verse that epitomizes a single moment. It uses the juxtaposition of two concrete images, often a universal condition of nature and a particular aspect of human experience, in a way that prompts the reader to make an insightful connection between the two. 

Modern Haiku

They also mention they stopped separating haikus and senryus because it was too hard to distinguish them, which I think deserves a short satiric poem on human nature on its own.§.

I think a takeaway is that we cannot judge modern english language haikus by the rules of classical Japanese haikus. They share something, what Wittgenstein may have called family resemblance, but they are not the same thing.

The 5 pillars of an haiku

I think we can have 5 rules.

  • an haiku is short, generally 3 lines
  • an haiku shows a clear picture or focus
  • an haiku has a minimalist aestethic
  • an haiku has an a-ha moment
  • an haiku relies on the Reader’s effort

I recall reading once a list of rules on how to make an horror movie, by Dario Argento§. The last rule was “you can break the rules“, and I think the same applies here. But I still like the 5-7-5 form. It may not work in english, but I like the challenge of sticking to a format, so if I wrote haikus I may try to follow it.

Back to school

You know what’s fun? We have stretched the definition so much that a bunch of random lyrical musings are now valid haikus. Montale’s poem for example, matches some of the rules (especially in the original). One of Ungaretti’s most famous poems would work too, if I re-format it

soldiers

we stand as in Fall

on branches, leaves

“Soldati” (Soldiers) – Giuseppe Ungaretti

I like this. It makes me feel like I was enjoying Japanese literature all along.

And you know what else sounds good, with a bit of rephrasing

halfway down life’s path

in a dark wood

I got lost

“Commedia” – Dante Alighieri, more or less

PS

there’s also something called an haibun, which is a mix of prose and haiku. This blog post does not probably classify, but it would be cool if it did.

On Culture, Food, Games

Today, I realized I have lived abroad most of my adult life. Yet, I feel as much Italian as I always did.

Culture, in the sense of one’s heritage, language, customs and so on, is such a weird thing. For example, some things we just consider old, or passé, while some others are traditions.

Nobody gives a damn about last year’s clothes, but people will happily wear traditional clothing for special occasions, even tho there’s nothing that makes them particularly different from the clothes of a hundred year before or after.

But some things get frozen in time, and become a paradigm of something, and then people start considering them as the real thing, and deviations are bad.

As an Italian, I see this all the time with food. As most of my countrymen I will be annoyed if I order a carbonara and you put cream and dill in it§. I will cringe at some of the ready-made “italian” monstrosities sold in foreign supermarkets, and of course there’s the Japanese spaghetti napolitana (with ketchup and wurstel) which could make people from Naples punch you§.

But beyond the immediate disapproval, I’m open minded enough to understand that it does not matter. Sure, I would prefer if people named things differently to avoid confusion, but I also understand that our strictness with food is a very modern development. Until a few years ago nobody would give a shit if you made carbonara using pancetta rather than guanciale, for example. The modern pizza napoletana has as little to do with the pizza from 100 years ago as an american deep dish thing, but now the recipe has been written down, and it can’t be changed anymore.

So I see this crystallization process happen in real time, and I find it so, so interesting. But change will happen, anyway.

My kids are italo-hungarian, and mostly I like to think of them as european but it is clear their culture will be mostly magyar. They’ll think it’s normal to take off shoes when you enter someone else’s house§, or that it’s reasonable to have only sweets for a meal§. At the same time they also expect latte e biscotti for breakfast rather than eggs and sausage. And hungarians have decent pizza and coffee these days. The kids will be their own culture and will be alright.

Food is a clear story of homogenization and globalization too: every big city has access to decent curry or sushi these days, if not khinkali and injera§. Yet a bunch of older hyperlocal recipes are disappearing. I have never seen any Italian pastry place make sweet ricotta ravioli as my grandma made them.

And the rest of culture is the same. Probably these days a youngster in Brazil has more shared culture with one in Norway than 20 years ago. They played similar videogames, watched the same blockbusters, have similar comics and books available, hanged around in the same online communities. They may have enjoyed different porn, tho.

But I would guess, when they were little, they played different games, cause children games are not as heavily internationalized yet. But careful, those are being homogenized too. I remember my dad teaching some of the games they played as kids, such as Lippa. I have never seen anyone else play it.

Hungarians kids play a shitty version of hide and seek where you hide and someone finds you and that’s it, you just take turns counting. Italian kids play a hyper-competitive version where once you spot the other person you have to race them to a base point and that captures them, but then the last one to be found still has a chance to free all the others, forcing the counting person to go again. You also have cheats and counter-cheats, such as standing behind a person to touch the base as soon as they are done counting, or having special rhymes that preventively capture those standing behind you. It’s an arms race. It’s a much more entertaining game, and I hope it survives for the sake of future children.

Anyway, culture is drifting, and becoming less diverse overall by becoming more diverse in every single place. Which begs the question: should we care? Should we make an effort to preserve some of our ancestors’ culture, and pass it on to the newest generations? Should we reject novelty? I am pretty sure the last question’s answer is a resounding no, but I think the others are tricky.

For example, should I teach my kids the sort of games my father thought me? What for? Some them made sense in a place when urbanization was mild and dirt roads where more common than asphalt, what would my kids do with them?

I think in a sense it’s always worth preserving something. But we all have limited learning capacity, teaching my kids the child rhymes I knew as a kid would come at the expense of not teaching them something else, and I mean, why would I chose 70 year old italian children rhymes?

When you are physically detached from your parent culture, you feel some need to stick to it, I think. This might be why the USA has this thing of saying “I’m Italian/Irish/Whatever!” meaning “some of my ancestors ended up on these shores coming from there!“. Immigrants felt nostalgia, and passed it on.

It’s also worth considering what is the culture you want to keep or ditch. Italy has a traditionally macho culture, which probably we should not keep in the next century. But it also used to have a very welcoming culture, which we should strive to keep. Hungarians are not particularly friendly and extrovert, we should probably change that. But they also are not very inclined to damage public property, which is good. At the same time, everytime we harmonize the behaviour towards some average expectation of “good” we’re losing something. But I still I hope we won’t have infibulation and the death penalty anywhere in the future. I am not sure what we should do with holy mountains forbidden to women but I have to say, I personally hope they stick around, because I like weird things.

Finally, it’s probably worth thinking about what happens when a culture buds off another one, and becomes separate, and you should stop evaluating it in the same terms. Italian poetry is not read in terms of Latin forms. Espresso should not be considered a bad arab coffee, nor italians should complain about third generation coffee being hipster bait. When does that the split happen? Does it even matter? I have a whole different post to write on english language haiku vs japanese haiku.

I am not sure there’s an answer to any of the questions here, I’ll just keep doing what I feel is best, every day, cause that’s the best I can do. Maybe everyone.

I did build my kids a rubber band gun, as my father did for me. Because it was fun, and because I loved my father and I miss him a lot. Maybe that’s why people stick to their culture, because they loved their parents, and grandparents, and wish they were with them.

Go tell your parents you love them, and your children too. That is some culture all mankind seem to share. And humbly, I think we should keep it.

On Luck

This isn’t a well structured essay, but I haven’t written in a while and I had promised I would, so I’ll put it in words anyway.

Some people claim they have been successful because of hard work, or because they always had a polar star, a dream to follow and did their best to get there.

I believe this is true, at least for some. But I am not one of those.

I am, in some sense, a successful person. I own the place where I live, have a family, and a job that pays well. I can and do travel (worldwide pandemics aside), I have had an education, and as Pearl Jam say,  “I’m a lucky man, to count on both hands the ones I love§.

But I got here by luck, and I didn’t aim, nor worked hard to get here.

You see, I was good in school, mostly because I liked to read, so most of what I was told to study, I already knew. And I was naturally good at math, which meant I basically got through 13 years of school making no efforts to get good grades§.

When I finished high school, I hadn’t decided what to do next, but a friend of mine was going to sign up for the engineering exam (you need to take a small mandatory exam, tho the grades don’t matter) and I went with him.

So, I got in Ingegneria Informatica (Software Engineering, more or less) by chance.

I didn’t really know computers. I had owned a C64 when I was a kid, but it broke before I could learn anything useful, and we had gotten a PC at home only when I was 18 or so, which I used to write some stuff for school, play games, and download pixelated pictures of naked ladies.

I just thought it was a potentially good education for a future job, and I thought AI was cool, so I may have fun studying that§.

But see, at the university I was a terrible student, but I was lucky to become friend with people who loved computers, got me into using IRC, and opened up various avenues of being a script kiddie. I started writing scripts and C, learned linux/*nix stuff, read the stuff from the hacker/FLOSS subculture. It was a lot of fun!

These were the days of 56k internet where you had to pay by minute, and one of my greatest achievements was coming up with a way to steal credentials to connect to the internet to ISP which where unmetered§: scan the ISP subnet for Windows 98 machines with an open SMB share, and copy their credentials§.

Anyway, you know what’s better than a 56k modem? Access to the GARR network, thick fiber cables with speeds you could only dream of.

So me and my friends were spending a lot of time at the department’s computer lab, chatting, playing Worms, and downloading MP3s. We thought to ask the department to set up an IRC server for the university.

They told us we couldn’t do it for the university, but we could do it for the department. They gave us a domain, an old pentium box, an ethernet cable and we were online. Apparently people in dusty university departments are much better at cultivating enterprising people than we give them credit for. And we were lucky, of course.

This was one of the most educational times in my life: we learned how to use Linux and FreeBSD, learned something about security, some more coding. Once, I caught a guy using ettercap in our lab, I wanted to be angry at him because he might be trying to hack into our box, but actually we just became friends, because we found someone else§ had hacked one of the other servers in the network 🙂

So we told the network admins, who were always thankful to us, and then they let us do even more crazy stuff.

Anyway, I met more smart people on the internet and I learned Ruby. I also learned english better by chatting with people on Freenode and reading newsgroups. At some point, I blogged a bit about Ruby, which got me a few odd jobs, because I had been lucky, and I had picked a tech that was growing fast.

Then, in my last year of studies, an internet friend wrote me about the chance to do my master thesis in Ireland, cause I knew Ruby and they used it for some project there. So I got to do my thesis there, in something semantic web adjacent.

At the end of the semester, when I was flying back to Italy, I stopped by in Milan to meet some more internet friends who had a company there, and during some late night chat a guy I just met told me about this startup which had something to do with semantic stuff. And he told the founder of the company, who offered me a job, and I ended up working on cool stuff for a few years. Luck again!

Then, at some point, I was wasting time on the internet, and I think I replied to some guy on HackerNews, and I think he mentioned me to their HR department, and I got another, even better job.

I am intentionally omitting a few of the most fortuitous things that happened between these steps, such as how I got better salaries than I expected, how I met my wife, how I managed to buy an apartment before prices spiked, how we got lucky having two kid etc etc. Unlucky ones too, but those don’t matter.

Still, my point: I got where I am through an incredible list of lucky events, and not aiming to be here at all.

But I don’t mean say one just has to be lucky. One should strive to be ready when luck strikes. Had I not been a good student, I would not have embarked in Engineering studies. Had I not been sociable, I’d not have had such good friends who offered me opportunities. Had I not put in effort to learn Ruby and blog about it I’d not have gotten my first chances, and so on.

As the quote goes

“I’m a greater believer in luck, and I find the harder I work the more I have of it.”

 Thomas Jefferson

But still, Lady Luck lurks behind that too: I would not have had chances to study and own a computer, had I not been born in a family with loving parents, with enough wealth to get me a PC and an education, in a wealthy country, in a time of peace, in a time of economic prosperity, in a region that allows me to travel abroad with ease.

And you know, I just got myself tested for melanoma, and they found me some basal-cell cancer, which is generally not very bad, but can be, and it’s better to treat it sooner rather than later.

I was lucky, I caught it early, cause I went looking for it.

PS: I won’t mention all your names, but all of you folks who have helped me along the journey know who you are, and I will be forever grateful.