Thoughts on blogging (changes)

Status

Looking at my “online activity” for the past 5 years, I’ve been writing at:

  1. Twitter
  2. WordPress
  3. A Static Blog

Observations

  • Of these, (3) is basically dead, and is around merely as a a personal homepage for now
  • The use of WordPress consists of
    • Monthly curations
    • Periodic life updates
    • Occasional long-form “articles
    • Random one-offs
  • The use of Twitter consists of
    • Likes and re-tweets (duh)
    • Extracts (pics) from either books or online articles

Modifications

  • The static blog remains in its “homepage purgatory”; I don’t have time to migrate that content over, and I don’t have any other plans for it
  • I’ve been bringing “my whole self” to Twitter, but I might reconsider that in the current … er … environment. I’m a self-described “centrist liberal” (I think?) which has been been an un-interesting position for as long as I can remember, but which in the context of current polarizing sentiment amounts to roadkill (so maybe a new pseudonymous account? we’ll see)
  • I’ll consider hiving off a separate WordPress blog that will basically be “my own Twitter”, the same way my current one is “my own Facebook” (wait, isn’t this what Tumblr was supposed to be? Lol, plus ça change …)
  • As mentioned earlier, I’ll try out Medium again, as a “duplicate” for any long-form content

My favorite year in movies- 2006

There are a bunch of movies I’ve liked, over the years, in different genres, from different times. But there is an unusually large cluster of them around a single year, 2006 (about fourteen years ago now).

The Fountain

Trailer

Among Darren Aronofsky’s movies (I still haven’t seen Black Swan (trailer), but I remember the revelatory feeling of watching Pi (trailer) a long time ago), I like this one the most (perhaps The Wrestler (trailer) would be a close second).

The trailer isn’t as bad, but (with the explicit dates and sections) it gives an overly structured view of what is (or feels like) a layered, mixed up, overlapping, interwoven something.

I’m pretty sure I saw a poor-quality, poor-audio version all those years ago, but I’d recommend watching it at night with good headphones, alone1.

The Prestige

Trailer

The trailer for this movie was terrible; it makes the movie sound very gimmicky, focussed on merely some inter-personal drama between magicians (why should anyone care about that?) And yet, of the movies in this list, it is my favorite, and the one I have re-watched the most.

It is not at all, in my opinion, about the particular details in the story (though Hugh Jackman, Christian Bale, and Michael Caine give a magical performance), but something more. Of Christopher Nolan’s movies, I like this more than Inception (trailer) — if the latter is “a movie like a dream”, this one is “a movie like a magic trick”.

Fun fact: the novel it is based on won the World Fantasy Award2.

It seems as though Borden (Bale) and Angier (Jackman) embody two different paths. I suppose part of the reason I like this movie is that I identified with one of them.

Kingdom of Heaven

Trailer

This one is technically from 2005, but I watched it a few months late, so it gets to be in this bucket.

It was one of the first Blu-ray movies I watched3 on a then-new-and-exciting 1080p 50” TV, and it felt tailor-made for a giant screen.

Gorgeous visuals, a sense of history (that moment when Sibylla watching4 from the castle wall whispers, “Salah ad-Din!”), and a great soundtrack (I like all the instrumental pieces, but especially the song5 at the end.

The Illusionist

Trailer

I think I like this for its “period feel” (Vienna, pre-WW1-ish) and high production quality more than the story itself. Also, I had first seen Paul Giamatti in The Lady in the Water earlier that year, which was a disappointment, and he was excellent in this.

(BTW if I had to drop a movie from this list, though, it’d be this one; not because it’s lacking anything, but because I like the others more)

Little Miss Sunshine

Trailer

One of my all-time favorites, both for the movie and the soundtrack, I’ve tried to find “more like this” — as in literally trying to Google for “movies like Little Miss Sunshine” — but failed to find anything. It is a one-of-a-kind, sublime experience. It feels fresh every time I watch it.

This has the most accurate trailer of this list, in the sense that it conveys exactly what the movie is all about 🙂

Also, the first time I saw Paul Dano (my favorite: Being Flynn (trailer)) anywhere.

Counterpoint

In those days I used to track movie reviews actively, and also watch movies immediately after release. These days, a year or more frequently elapses between release and viewing, and it’s very common for me to never watch and also never intend to watch the popular or critically acclaimed movies (or, tv shows) for a year.

It’s quite possible, then, that the reason these movies still appeal to me is simply because I was more engaged with movies at that time.

Still, it is my subjective list, and I do end up re-watching these, and re-listening to their soundtracks, so at the very least, I’m sure they are not bad movies.


  1. or not. I don’t actually know if it makes a difference; I think it does require some concentration ↩︎
  2. 1996 winners of science fiction and fantasy awards (scroll down to ”WFA”) ↩︎
  3. Rented from Blockbuster, back when they (a) were around, and (b) had the same rental rate for DVDs and Blu-Rays 🙂 ↩︎
  4. the meeting between Baldwin IV and Saladin ↩︎
  5. Light of Life” by Natacha Atlas; here is a version set to a montage of scenes from the movie ↩︎

My history with computers, Part 2- “Mid 90s

Context

Picking up where I left off last time: we’d got a first, new computer, the first set of simple games, and a first operating system (ye olde DOS).

QBasic

As I’ve mentioned, the only programming environment, programming interface, programming tool, programming editor I knew about or used, was the version of QBasic that came bundled with MS-DOS.

This might sound pathetic now, but felt very cool to me back then. I hadn’t experienced “programmable calculators”, so this was also the only “programmable thing”.

This beige box was the only thing that could compute at all. All this sounds redundant, because we have so many little computers all over the place now and they’re ubiquitous, but it’s hard to give an idea of how unique one of these was.

(Like this, except in black and white)

Everything was one giant file, with jumps all over the place. Incredibly messy, and IMO a terrible way to learn how to write anything (so much to unlearn later, sigh). But still, a great way to get started MAKING stuff.

Using it

Just to give an idea, here’s how a sample interaction might go (say I wanted to make some random patterns or drawing, in my “computer time” that day):

  • The computer is off, put it on (the idea of leaving it on all the time would have been crazy!)

     

  • It boots into the C:\> prompt, pretty quickly (no logins, single-user!)

     

  • I run QBASIC, see the screen above

  • I write some small fragment like

    SCREEN 1
    LINE (35, 50) - (100,150), , B
    
  • I hit run, and see a small rectangle (in the beginning, coming from LOGO, this is most of what I did)

     

  • I press a key, back in the editor, make some changes, repeat.

Game programming books

The installation of QBasic came bundled with an impressive game that gave the impression that a lot was possible (the code was very spaghetti-zed, but I supposed relatively okay).

(Like this, except in black and white)

At the time there were also a lot of books with games — by which I mean they had programs that you could type out and run (remember how I said everything is “just one large file”?)

I was fortunate my mother could bring these from the library of the school she worked at, and I learnt a lot (okay, questionable, but it definitely felt good) from reading through them.

I was also fortunate that my younger brother (with great patience!) would read aloud each line for me to type in, so we could play the game later.

One of these was a Star Trek game, the longest of the bunch, that we painstakingly typed in over several days, slowly making progress page by page (sounds ridiculous as I type this, but … yeah, you had to be there), and inevitably I must have made some small typo somewhere, that was then … impossible to track down, so we were quite dejected when it didn’t work.

However, the opening theme did play, with its signature tune, and that felt good. I should note that there were no speakers, so there was no sound, just a beeper with different frequencies.

I did try to read the source code, and it was essentially a “first RPG”, with an energy level that got depleted by actions, movement in a grid in space, ability to fire phasers and photon torpedoes, all that good stuff.

(I googled it, and … of course there’s a Youtube video for this: https://www.youtube.com/watch?v=gLKw4AU4KHU)

Windows

I had seen Windows machines at school, when I finally got a chance to play with one of two computers that had a mouse. All I did was use MS Paint, because moving the cursor, pointing and clicking and seeing dots of color appear was such a novel experience!

Finally, one day, my dad brought a stack of floppies (because that’s how anything got installed) for Windows 3.11. It required baby-sitting the whole install experience, removing and inserting each floppy in the precise order in which they were labelled.

GUI

Now, after starting up the computer, at the c:\> prompt, it was possible to run win, and then see a brief splash screen.

(Like this, except in black and white)

After which there would be, well, windows on the screen.

(Again: this, except in black and white)

Things were getting exciting.

Remember though, still no mouse (that would come a few months later). So we got really good at keyboard shortcuts for selecting windows, moving, resizing, whatever.

Apps

A big boost came from getting (in another long bunch of floppies) Microsoft Office (!)

Each app took about a minute to load up, but we could now use (still one at a time) Word, Excel, Powerpoint, and Access!

I remember Access has a dialect called AccessBasic that I read the manual for, tried to use, and failed. I wanted to make a “home library system”, but spent all my time prettifying the frontend and never quite got the flow of entering books and looking them up to work properly.

I vaguely remember repeating this painful install process a couple times, and using Norton Disk Doctor and a bunch of other tools that simply have no analogue today.

Games

Bundled games included Minesweeper and Solitaire, though I never quite liked them all that much.

At this time, windows was very much (until Windows 95, I think) a “shell within DOS”, so it was quite normal to play some games within Windows, and to exit Windows and play some games within DOS.

As far as I can remember (again, I wish I had written something down), there were better games in DOS, especially the ones my brother got from his friends.

One game stands out: Wolfenstein. Again, this was black-and-white without sound, but … it was the first-ever FPS. Let me repeat that: the first-ever first-person shooter (for me, at least). All I had seen were flat, 2-d games, maybe a few platforms, and … here was something totally different.

(Again, like this, except black-and-white, and no sound)

In today’s world of bloated “built on Electron” apps, it’s nearly impossible to appreciate the skill that went into creating an experience like this on a limited computing platform such as we had.

I do remember a visual Chess game on Windows, perhaps Chessmaster?

Transition

Time to stop again, so I can come back and write again later. Next time: an upgrade.

On “… the terrible beauty of maps”

This captures so well what I sometimes feel about visual note-taking (basic mind-mapping, as well as more flexible, powerful tools):

(Source)

I’ve gotten to the point where I generally use outline as my default. The problem I have with maps is that they cue an aesthetic response that overrides other concerns, and I have trouble setting that response aside. A map is either beautiful and this creates a barrier to revision, or it is ugly and making it attractive becomes my priority. If I leave it ugly, then I find it hard to work in the file unless I stop using the map. Outlines short circuits this enormous weak spot in my mental make-up.

(Also, a nice phrase!)

On Narration, Tinderbox, and other things …

It’s hard to say what is so good about this video. It is many things.

It is a generally well-made ensemble, a slice of art criticism, a slice of philosophical questions and concerns, it is a demonstration of “thinking through a tool”, it is a demonstration of “showing through a tool“, it is a demonstration of one such tool (Tinderbox), an autobiographical account, and probably more …

Lunchtime WSJ book reviews

I started a paper subscription to WSJ right as the pandemic started, and as we eat family lunch, with no phones allowed, I quickly skim the paper.

I wish I had done this earlier, but also, I know I couldn’t have, because this “15-minute window” is the only way that that I could physically read it — mornings and evenings are too rushed, and night is for doing uninterrupted work that the fragmented daytime doesn’t permit.

Also, I’ve found the reviews are surprisingly useful, I definitely didn’t expect to be reading and learning about new stuff this way.

Here, as an example, a book review excerpt from today’s (well, yesterday’s, I have a one-day reading lag) paper.

A simple calculator in Scala

Here1 (credits to Ben Lynn2) is a simple calculator in Haskell.

I decided to try porting it over3 to Scala. The original example also makes this work in Javascript using Haste; I’ve left this out for now (though I might come back and get this to work under Scala.js later).

The underlying basis is the same, using the awesome fastparse library to stand-in for Parsec/Megaparsec from Haskell, and the code feels quite concise and readable to me4.

This is the entirety of the parsing code we need:

  def numParser[_: P] = P( ("-".? ~ CharIn("0-9").rep ~ ".".? ~ CharIn("0-9").rep).!.map(_.toDouble) )
  def parenParser[_: P]: P[Double] = P( "(" ~/ exprParser ~ ")"  )  // needs explicit type because it's recursive.
  def factorParser[_: P] = P( parenParser | numParser )
  def termParser[_: P] = P( factorParser ~ (CharIn("*/").! ~/ factorParser).rep ).map(eval)
  def exprParser[_: P] = P( termParser ~ (CharIn(" \\-").! ~/ termParser).rep ).map(eval)

… along with a tiny bit of evaluation:

  def eval(ast: (Double, Seq[(String, Double)])): Double = {
    val (base, ops) = ast
    ops.foldLeft(base) {
      case (n1, (op, n2)) =>
        op match {
        case "*" => n1 * n2
        case "/" => n1 / n2
        case " " => n1   n2
        case "-" => n1 - n2
      }
    }
  }

That’s it.

That’s all you need to take in a String and convert it to a Double.

What Ben says about the evolution of parsing-as-it-used is true: it was completely normal to resort to lex/yacc and then flex/bison for these earlier, but Parser Combinators and PEGs take it to a whole other level, and once you’ve become comfortable with them, there’s no going back to the verbose old days.

Just to break down the parsing code a bit:

This parses a number: def numParser[_: P] = P( ("-".? ~ CharIn("0-9").rep ~ ".".? ~ CharIn("0-9").rep).!.map(_.toDouble) ). Or rather, it returns a function that can parse a number.

It’s possible to play5 with this within a repl; I use sbt console6 when something depends on a class/object within a project, but this is an independent enough chunk that you could use ammonite7 instead too.

agam-agam@ import fastparse._
import fastparse._

agam-agam@ import NoWhitespace._
import NoWhitespace._

agam-agam@ def numParser[_: P] = P( ("-".? ~ CharIn("0-9").rep ~ ".".? ~ CharIn("0-9").rep).!.map(_.toDouble) )
defined function numParser

agam-agam@ parse("45", numParser(_))
res263: Parsed[Double] = Success(45.0, 2)

agam-agam@ parse("4.5", numParser(_))
res264: Parsed[Double] = Success(4.5, 3)

Where it gets interesting is composing these parsing functions.

Given a function to parse a factor (a number, or sub-expression within parentheses), we can define a function to parse combinations of multiplying/dividing these as:

def termParser[_: P] = P( factorParser ~ (CharIn("*/").! ~/ factorParser).rep ).map(eval)

… which reads very “regex-like”, imo!

Anyway, I added a basic I/o driver around this, so it can be “run” as:

➜ sbt run
[info] Loading settings for project simplecalc-build from metals.sbt ...
[info] Loading project definition from /home/agam/code/simplecalc/project
[info] Loading settings for project simplecalc from build.sbt ...
[info] Set current project to hello-world (in build file:/home/agam/code/simplecalc/)
[info] Compiling 1 Scala source to /home/agam/code/simplecalc/target/scala-2.13/classes ...
[warn] there was one deprecation warning (since 2.11.0); re-run with -deprecation for details
[warn] one warning found
[info] running Main
Simple calculator


Enter an expression, or 'END' to quit: 5   6
Result: 11.0

Enter an expression, or 'END' to quit: 2 - 5.2 * 1.5
Result: -5.800000000000001

Enter an expression, or 'END' to quit: 1.8   2.3 / 4.5
Result: 2.311111111111111

Enter an expression, or 'END' to quit: 42   1 - 5
Result: 38.0

Enter an expression, or 'END' to quit: END
[success] Total time: 55 s, completed Aug 6, 2020, 11:36:47 PM

(Yeah, the weird decimal point behavior is just Double being a double; that is beyond the scope of this example 😐)


  1. ”Parser Combinators” ↩︎
  2. Indeed, Ben has a bunch of other awesome stuff like this, and I might just go Scala-ize more of them 🙂 ↩︎
  3. Repo (with this core code, as well as a Main driver and tests) is here ↩︎
  4. My subjective opinion is that Scala is a sweet spot between ↩︎
  5. I’ve taken a “shortcut” with my map(_.toDouble) bit there, so it doesn’t fail properly right now and you get java.lang.NumberFormatException: empty String, but normally you’d get a Parsed.Failure back ↩︎
  6. Console ↩︎
  7. Ammonite ↩︎

Why u no have footnotes, Medium?

Yuck, footnotes simply don’t render in Medium the way they do in WordPress.

I have no clue why this is so — it seems a terrible limitation in my opinion.

There are notes, which are a poor substitute. I … don’t think I’m going to change my use of footnotes, which means I have to be okay with the crappy way they render in Medium. 🤷‍♂️