Tuesday, 2019-04-02

The Gun by C. J. Chivers

A technical, social and political history of the AK-47 assault rifle and derivatives.

Chivers does a good job tying the design of the gun into Soviet defense policy, and compares the development of the weapon favorably compared to the US introduction of the M16.

The author explores the issues with the massive proliferation of these assault rifles worldwide, but he seems to have a blind spot for the similar proliferation of semi-automatic weapons with large magazine sizes in the US. He has faith that the situations that lead to the widespread uses of the AK-47 will never occur in the USA.

Thursday, 2019-02-28



Hammarby sjö

Stairway to heaven

Feb 2018 | Feb 2017 | Feb 2016 | Feb 2015 | Feb 2014 | Feb 2013 | Feb 2012 | Feb 2011

Friday, 2019-02-15

Fotografiska, 14 Feb 2019

Jonas Bendiksen - The Last Testament

Magnum photographer photographs seven people around the world who claim they are Jesus Christ. Great reportage.

Anja Niemi - In Character

Self-portraits (sometimes doubled), with that “2-stops overexposed Portra” aesthetics that the kids like so much these days. It’s nothing we haven’t seen before.

Kirsty Mitchell - Wonderland

Exceedingly lush tableaux, backed by a tragic backstory (the memory of the creator’s deceased mother) and a hugely successful Kickstarter campaign. There’s no denying the craftmanship nor the quality of the work, but somehow it feels a bit weird for an artist to so publicly involve crowdfunding in something so private. On the other hand the work of Niemi (above) struck me as very cold and solitary, so what do I know about how artists get inspiration from others.

Thursday, 2019-01-31


The only image worth posting this month is in this post.

Jan 2018 | Jan 2017 | Jan 2016 | Jan 2015 | Jan 2014 | Jan 2013 | Jan 2012 | Jan 2011 | Jan 2010 | Jan 2009

Monday, 2019-01-28

Fotografiska, 27 Jan 2019

Arvida Byström - Inflated Fiction

Byström’s sui generis blend of selfie photography, feminist critique, and social media chops doesn’t translate well into one single room exhibit. It’s a shame but I’m glad she’s getting the recognition see deserves.

STHLM Forever

Every large city no doubt has its fair share of introspection but as a (relative) outsider to Stockholm I’ve always felt Stockholm’s has been a bit over the top. Probably because the entirety of Sweden’s population is hardly bigger than a “real” big city like London or Paris, the capital has to do double duty as something for locals and the focus of the nation.

Most libraries here have a section called Stockholmiana where books on street names etc are shelved.

So exhibits of photographs of Stockholm are usually a big hit. Here were the greatest hits from greats like Christer Strömholm and Lennart Nilsson, along with newer works. Weirdly there’s very little color. The genius loci of Stockholm is apparently only visible in B&W.

Under the bridges

This photo was taken under Skanstullsbron, the construction of which was subject of one of Nilsson’s images from the exhibit. It’s a nice connection I think!

Monday, 2018-12-31


NYE 2018 / Sjöstan

Dec 2017 | Dec 2016 | Dec 2015 | Dec 2014 | Dec 2013 | Dec 2012 | Dec 2011 | Dec 2010

Tuesday, 2018-12-25

Advent of Code 2018 wrapup

This year was a tough one. I believe the abundance of week-ends this December added to the number of quite tough problems. Day 15 seems to have been a really big stumbling block for many people.

I’m still not finished at time of writing, I’m at 38 of 50 stars. The TODO list is at the main entry for this year’s contest.

Despite miserably failing in completing each challenge in the day it was released I’m still happy I have some problems remaining going forward.

Saturday, 2018-12-01

Advent of Code 2018

This blog post is a work in progress

Project website: Advent of Code 2018.

Previous years: 2015, 2016, 2017.

I use Perl for all the solutions.

Most assume the input data is in a file called input.txt in the same directory as the file.

A note on scoring

I score my problems to mark where I’ve finished a solution myself or given up and looked for hints. A score of 2 means I solved both the daily problems myself, a score of 1 means I looked up a hint for one of the problems, and a zero score means I didn’t solve any of the problems myself.

My goals for this year (in descending order of priority):

  • match or beat last year’s score of 49/50.
  • solve all problems within 24 hours of release

Link to Github repo.


This year’s todo list:

  • Complete day 24
  • Complete day 23 part 2
  • Complete day 22 part 2
  • Publish day 21
  • Complete day 20
  • Publish day 19
  • Complete day 17
  • Day 16 - solve part 2 without manual intervention.
  • Complete day 15
  • Day 14 - faster part 2.
  • Day 12 - rewrite part 2 to find the answer programmatically.
  • General - implement blogging and listing publication using templates
  • Publish day 18
  • Day 8 - clean up and publish solution
  • Day 11 - faster solution

Day 1 - Day 2 - Day 3 - Day 4 - Day 5 - Day 6 - Day 7 - Day 8 - Day 9 - Day 10 - Day 11 - Day 12 - Day 13 - Day 14 - Day 16 - Day 18 - Day 19 - Day 25

Day 1 - Chronal Calibration

Day 1 - complete solution

Capsule summary:

Investigate the properties of summing an infinite list of integers.

A nice start to this year’s puzzles.

I had planned on getting up at 6AM to start with this but I spent the night before playing Fallout 4 so that didn’t happen.

Score: 2.

Day 2 - Inventory Management System

Day 2 - complete solution

Capsule summary:

Investigate the properties of the strings given as input.

Another O(n^2) solution, but for the small sizes involved it barely matters.

Perl’s string munging is helpful as always.

Score: 2.

Day 3 - No Matter How You Slice It

Day 3 - complete solution

Capsule summary:

Investigate the properties of overlapping areas given as input.

Nice and clean. I was worried I’d have to do some complicated lookups to single out the correct swatch in part 2, but it turns out that there was only one possible solution in my input.

Score: 2.

Day 4 - Repose Record

Day 4 - complete solution

Capsule summary:

Given a list of activities, determine properties about the times these activities occur.

Getting the correct answer without resorting to an external run through sort -n was the hardest part of this problem!

There are some nice solutions using a Schwartzian transform out there but to be honest I’d rather have something straightforward and dumb that can understood later.

TODO: better variable naming.

Score: 2.

Day 5 - Alchemical Reduction

Day 5 - complete solution

Capsule summary:

Remove elements from a list, based on rules on which neighbors an element has.

A quick and simple problem.

Score: 2.

Day 6 - Chronal Coordinates

Day 6 - complete solution

Capsule summary:

Investigate areas on a grid, expressed in Manhattan coordinates.

Keywords: Voronoi diagram

This took some careful perusal of the text and example to figure out. I had a lot of problems with my solution when I tried to merge part 1 and part 2 into one solution. Unfortunately I had overwritten the code that actually gave me the first star, and I broke it.

I felt justified to check out other solutions and finally re-wrote using those (essentially using a representation of the board to keep track of the data). The day after I took the time to re-write it again into a version closer to my original idea.

Runtime is a dismal 16s.

Score: 2.

Day 7 - The Sum of Its Parts

Day 7 - part 1 Day 7 - part 2

Capsule summary:

Find a path through a graph, given that some steps must be done to proceed.

Keywords: DAG, directed acyclic graph, topological sort

I’m really happy with solving this. I’m graph-aphasic, as in I’ve never ever grokked them in code, and was dreading finding some random Perl module that I didn’t really understand. In the end I just found the “endpoints” and processed it using a queue.

This made part 2 reasonably easy to code.

Score: 2.

Day 8 - Memory Maneuver

Day 8 - complete solution

Capsule summary:

Investigate the properties of a tree structure given in the form of a string of integers.

Keywords: tree structure, recursive

I had a lot of trouble with this, which wasn’t helped by stuff like people coming over to visit, dinner to cook and eat, and wine to drink. After these distractions were done with I could revisit the problem with fresh eyes.

Score: 2.

Day 9 - Marble Mania

Day 9 - complete solution

Capsule summary:

A game is played by placing marbles in a circle. Investigate the end state given the puzzle input.

Keywords: double-ended circular list

This was a fun problem that was marred by some irritating off-by-one errors in the results. We were blessed with a wealth of example inputs, and I could make most of them work by taking the largest or the next largest value. This gave me my second star, but it was hardly repeatable.

Double-checking my logic against other solution revealed I was thinking correctly, but had a stupid overrun where I managed to take more marbles than were actually available…

Runtime for part 2 is 30s, but you need quite a lot of memory to run it. My wimpy VPS cannot run it natively.

Score: 2.

Day 10 - The Stars Align

Day 10 - complete solution

Capsule summary:

Given a number of points, their positions and velocities, investigate whether they form a coherent message when printed.

Keywords: visualization

A nice palate-cleanser after the horrors of the week-end.

Runtime: 4.6s.

Score: 2.

Day 11 - Chronal Charge

Day 11 - complete solution

Capsule summary:

Investigate the values of subsquares on a 300x300 grid.

Keywords: summed-area table

Trying to solve part 2 using brute force took 173 minutes. Implementing a summed-area table reduced it to 3s.

Score: 2.

Day 12 - Subterranean Sustainability

Day 12 - part 1 Day 12 - part 2

Capsule summary:

A number of plants grow in an infinite line of pots. The existance of a plant for the next generation depends on its neighbors. Investigate what plants remain after a number of generations.

Keywords: cellular automata

This was a fiddly one. I got bit by the shallow copying nature of Perl’s data structures, but implementing the Clone module took care of that.

Then is was just a question of dealing with the inevitable off-by-one errors.

Part 2 was found by reasoning that the pattern would stabilize, and after that is was just a matter of finding the pattern and identifying the offsets.

My Part 1 code can either give the answer to the question with no input, or output some useful metadata if given another argument.

Part 2 answers the question by default, and gives the value for an arbitrary input if that’s given as an argument.

Score: 2.

Day 13 - Mine Cart Madness

Day 13 - complete solution

Capsule summary:

Carts move along a track with turns and junctions. Determine whether they collide.

I’m both proud and ashamed of this one. Proud because my basic code determining how the carts move was correct from the get-go. Ashamed because it took me all day to figure out the collision detection.

Runtime: 0.4s

Score: 2.

Day 14 - Chocolate Charts

Day 14 - part 1 Day 14 - part 2

Capsule summary:

A list is generated programmatically. Investigate its properties as it grows.

Keywords: pattern matching, brute force

Not my favorite problem, not least because my brute-force solution is killed by my VPS.

Runtime for part 2: 2m14s.

Score: 2.

Day 16 - Chronal Classification

Day 16 - complete solution

Capsule summary:

An obfuscated register manipulation routine is presented. Solve the program.

Keywords: registers

This years Register Rodeo! It was fun apart from the horrid input parsing.

Score: 2.

Day 18 - Settlers of The North Pole

Day 18 - complete solution

Capsule summary:

Investigate the properties of a Game of Life setup.

Keywords: game of life

A scruffy solution. I had no problems with part 1, but part 2 was plagued by off-by-one errors.

Day 19 - Go With The Flow

Day 19 - complete solution

Capsule summary:

Decompile a deliberately inefficient algorithm.

Keywords: registers, decompilation

Decompilation problems are not my favorite problems.

Day 25 - Four-Dimensional Adventure

Day 25 - complete solution

Capsule summary:

Investigate points in 4D space.

Keywords: union

Last problem this year. Figured this out through brute force.

Friday, 2018-11-30


The Rocks (Argyle St.)

Blue Liks Mars (Garnisonen)

Nov 2017 | Nov 2016 | Nov 2015 | Nov 2014 | Nov 2013 | Nov 2012 | Nov 2011

Saturday, 2018-11-10

A Trilogy of Trilogies: re-reading William Gibson


NeuromancerCount ZeroMona Lisa Overdrive


Virtual LightIdoruAll Tomorrow’s Parties

Blue Ant

Pattern RecognitionSpook CountryZero History

It’s hard to overstate the effect Gibson’s fiction had on me as a young person. While I never went as far as dressing as a cyberpunk (like some people I hung out with), the ideas and images from Neuromancer were permanently burned into my brain.

Re-reading all of these books on a holiday was instructive. I’ve re-read some of them multiple times (probably Count Zero most often, but I’ve only read Zero History once) and that makes it pretty easy to re-read quickly.

One thing that stands out is that while the Sprawl and Bridge trilogies have protagonists who are from the underclass of society, Blue Ant makes a sharp swing into the upper middle class for its main characters. This, in conjunction with them being in the employ of the unimaginably wealthy Hubertus Bigend, lead to the books resembling some sort of technothriller Sex in the City (except there’s very little actual sex).

I think Gibson realized this and the next novel The Peripheral returns to the theme of the underclass confronting tech and society.

I like the second books in each trilogy better than the first or third. Idoru especially is good with its discussion of celebrity culture.

Technology - Gibson is credited with inventing “cyberspace”, but the “shared consensual hallucination” as depicted in the Sprawl books makes no goddamn sense from a user perspective. It’s a bit like the famous “I know Unix!” scene in Jurassic Park - great eye candy for someone who doesn’t know how a computer works, but not really productive.

But there’s so much else in the Sprawl books that’s just there, standard SF for the time. Orbital space platforms. Super-fast SST planes. No global warming. Sure, the US seems to have collapsed and the Eastern Seaboard is one vast shantytown, but the reasons for that are more because Blade Runner is cool, not really explained. And people still smoke, and read papers, even if it’s delivered by fax.

And a secondary plot point - the ability to virtually inhabit someone else’s entire sensorium - is so far away from anything we have now, it’s not even funny. Come to think of it, so are orbital space stations.

Sadly as Gibson nears the “real world” in the later books, the tech gets less gee-wiz and more dated. Sure, cyberspace is useless but it’s so goddamn cool. The later books are instantly anchored in time with specific Apple products and forum software versions.

That’s why the earlier books have aged better. Sure it’s funny to point and laugh at the things Gibson “got wrong” - but why not see them as an alternate future that diverged sometime in the 1970s? (This is explored in Gibson’s short story “The Gernsback Continuum”, so it’s a propos.)

In summary, I actually think the Bridge trilogy is where Gibson is at his best - lucid writing, telling stories about hard-luck characters trying to do good in a crapsack world, and a great mix of plausible and sensawunda SF.