Roll Your Own HTML in Clerk

23 April 2023

The clerk/table component automatically limits itself to only showing 20 results. Other presentation components, especially text, have configurable elision behaviors, but it doesn’t apply to the table.

After searching, guessing at ways to do it, and even asking in conference talks, I finally realized that we can render our own HTML with clerk/html and hiccup. That HTML is not limited to any size, and building a table is easy. We used to do it all the time.

I wrote my own simple function to render a table, and I used that instead of the clerk/table. It takes the same parameters I was already using.

^{:nextjournal.clerk/visibility {:code :hide :result :hide}}
(ns sample
  {:nextjournal.clerk/visibility {:code :fold :result :show}}
   [nextjournal.clerk :as clerk]))

^{:nextjournal.clerk/visibility {:code :hide :result :hide}}
(defn my-table
  "display a simple table in html.
  :head is the sequence of head labels.
  :rows is a sequence of sequences.
  :limit is the max to display of the rows. (default 100)"
  (clerk/html [:table
                 (for [h (:head params)] [:th h])]]
                (for [r (take (or (:limit params) 100) (:rows params))]
                   (for [c r]
                     [:td c])])]]))

  {:head ["x" "y"]
   :limit 100
   :rows [[1 2]
          [3 4]]})

Digital Archeology

04 February 2023


Nostalgia for Old Code

I’ve been coding for a very long time, so I’ve had lots of projects in various languages, on various platforms, and stored very differently.

I got nostalgic on and off over the past couple years and went digging around to recover the source for some of those old projects. I uploaded the more notable projects to my GitHub account.

Old Floppies

I spent money to buy a 3.5-inch USB floppy drive and an old 386 PC with a 5.25-inch and 3.5-inch floppy drive, so I could ultimately copy files from really old 5.25-inch floppies that I used in the late 1980s and early 1990s to my live storage of today. Among those old files were binaries and source in GWBASIC and QuickBasic.


I found one of the first games I wrote and sort of distributed, Gravity Blocks. I could play the compiled binary with DOSBox and read the main source file, but some of the source code for my common libraries is still locked up in a compressed format from QuickBasic 4.5. I may need to dig deeper into QB64, a clone of QuickBasic 4.5 that seems to be able to read, run, and compile those old compressed files.


I also found source code for the first software I wrote for the local fire company to help track statistics on calls and print reports to submit to the local municipalities we served.

It was written in GWBASIC, so I was able to decode the compressed source where needed to read it. I published my CALL-REP source, so I could go back and have a look at the simple, but useful, things I used to write as a kid.

Copies of Old Servers and Subversion

I continued to build stuff through college (and obviously beyond). Some of it was in C, PERL, and Java.

I recovered these bits of source code laying around in backups and copies of old Linux servers I’ve run over the years. This source was in old Subversion repositories that used old versions of Berkeley DB. Initially, This BDB version mismatch kept svn checkout from working, but the current Subversion tools have an svnadmin recover command that could fix the repository for normal reading today. I’m sure some of those old SVN repositories had previously been migrated from CVS.


I found the source code from my final project in the Java class in my last year of college in 2000.

Pop-a-Prof is a clone of my favorite puzzle game, Bust-a-Move. It’s a Java Applet that ran in Netscape allowing any number of players, and it coordinated everyone’s play with a shared public server, Each round lasted 5 minutes, and any time you topped-out, you’d lose some points, and start over, so no one needed to sit around watching the last people battle it out.

After school, I started on Pop-a-Prof 2. This one ran as a plain Java application, and implemented rebounding balls in the game. It was more of a proof-of-concept for the new game mechanics, and it never got network play.

Java ME

I liked running little bits of code, like applets did, so I continued into writing Java ME (J2ME) for my feature phones around 2005.

I did a gas-logging app that stored fuel-ups and drew graphs to show fuel economy.

I also wrote a quick little game called Ben’s Backhoe to give the kids a little something to do on my phone. By the time I was building this sort of thing, though, I’m a decent Java programmer, so it’s not the fun mess that we see in the other old project.

Still More

I spent most the day poking around at various old BASIC files and trying to tweak them a bit to run in PCBasic or QB64. I used lots of weird graphics modes from the Tandy 1000 and didn’t think much about portability. I may post more projects over time.

Podcast List for November 2022

03 November 2022

I have 73 feeds I currently follow. I have a whole system of prioritization, so I can listen to important things first. I’ve listed them alphabetically here:

Java Joyless

27 January 2021

Mr Haki has a Java Joy article about transforming a stream of strings into a map using functional Java. I’m having a bit of trouble embracing it enthusiastically, since each example is 81 lines of Java code and a pointy pile of type declarations!

I dashed out the same functionality in 4 lines of Clojure, and I can understand it a whole lot easier. I’m not even sure this is the fewest forms, but it’s still nicer.

    ["language" "clojure" "username" "john"]
    (partition 2)
    (reduce (fn [m [k v]] (assoc m k v)) {}))
  ;; => {"language" "clojure", "username" "john"}

Update 2021-04-14: It can be done in one line of Clojure.

  (apply hash-map ["language" "clojure" "username" "john"])
  ;; => {"language" "clojure", "username" "john"}

Written with Clojure 1.10.2.

All the Posts

April 2023

February 2023

November 2022

January 2021

November 2020

October 2020

August 2020

May 2020

December 2019

November 2019

October 2018

May 2018

March 2018

February 2018

January 2018

November 2017

September 2017

June 2017