Lisplog

Blogging in Lisp

Search

Lisplog is a templating system that blends Apache and Hunchentoot to aid in the maintenance of a blog-like web site.

It is open source, written in Common Lisp, and the code is at github.com/billstclair/Lisplog

I'm looking for work. My resumé is at lisplog.org/resume.html

Haskell Joke

Submitted by Bill St. Clair on Mon, 04 Dec 2017 14:18:05 GMT

"Haskell, the programming language maintained by Scots, in Glasgow. We Scots do nuthin' until we have t', but then we do a fookin' good job." -- Bill St. Clair

Add comment   Edit post   Add post

Twitterrific

Submitted by Bill St. Clair on Thu, 23 Nov 2017 16:50:01 GMT

I recently started using Twitterrific, a Mac and iOS Twitter client. I like that it syncs between my iMac and iPhone, and its "Delete and Edit Tweet" feature, something that I occasionally do by hand in Twitter's interfaces, to fix a typo. But I'm missing a few features:

  1. Link previews.
    I follow some accounts that link to meme images, and seeing at least part of the image before clicking on it is handy.
  2. List retweeters of a Tweet. Twitterriffic shows a retweet count, but, unlike Twitter's clients, has no way to show the list of people who retweeted.
  3. List likers of a Tweet.
    Again, Twitterrific shows a like count, but has no way to show the list of likers.

I tweeted about the second and third issues above, and received this reply:

I can find no API for listing who likes a post, but there is definitely an API for reposters.

The examples below use twurl, Twitter's curl-like command line tool, that sends raw URLs to the Twitter API, does all the OATH validation for you, and returns the raw JSON.

First, show a recent Tweet from President Trump (long lines elided):

$ twurl '/1.1/statuses/show.json?id=933692459351265280&trim_user=1&include_entities=0'
{"created_at":"Thu Nov 23 13:43:24 +0000 2017",
 "id":933692459351265280,
 "id_str":"933692459351265280",
 "text":"Will be doing a live Thanksgiving Video Teleconference with Members of the Military...",
 "truncated":true,
 "source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" ...",
 "in_reply_to_status_id":933662564587855877,
 "in_reply_to_status_id_str":"933662564587855877",
 "in_reply_to_user_id":25073877,
 "in_reply_to_user_id_str":"25073877",
 "in_reply_to_screen_name":"realDonaldTrump",
 "user":{"id":25073877,"id_str":"25073877"},
 "geo":null,
 "coordinates":null,
 "place":null,
 "contributors":null,
 "is_quote_status":false,
 "retweet_count":5122,
 "favorite_count":28375,
 "favorited":false,
 "retweeted":false,
 "lang":"en"
}

Look up the retweeters, limited to 5. The default, and maximum, is 100, though you can use a 'cursor' to fetch additional pages of 100.

$ twurl '/1.1/statuses/retweeters/ids.json?id=933692459351265280&count=5'
{"ids":[742479627592052736,2209081703,140410587,848195164673855490,3854255787],
 "next_cursor":0,
 "next_cursor_str":"0",
 "previous_cursor":0,
 "previous_cursor_str":"0"
}

Lookup details on one of those user IDs:

$ twurl '/1.1/users/lookup.json?user_id=140410587&include_entities=0'
[{"id":140410587,
  "id_str":"140410587",
  "name":"Trump supporter",
  "screen_name":"EdMendez1969",
  "location":"",
  "description":"El comunismo no debe existir en el planeta...",
  ...
 }]

I don't know why Twitter has no API to fetch the users who liked a post (which are called "favorites" in the API docs). You can get the posts liked by a user, but not the users who like a post. Unless you screen-scrape the web UI, which is fraught with peril, and no fun.

I hope this post will encourge the Twitterrific people to add to their clients the ability to show retweeters for a post.

Add comment   Edit post   Add post

iPhone X Ad Swirling Colorful Sand

Submitted by Bill St. Clair on Sat, 04 Nov 2017 04:09:03 GMT

I finally found the artists responsible for the swirling colorful sand animation in the "iPhone X Is Here" ad.

It's WeAreColorful. There's a contact form at the bottom of that page. If enough of us ask them to package it as an app, for a dollar, maybe they'll do it.

https://youtu.be/wmEqgjT61FA

1 comment   Edit post   Add post

Archmage Is Done!

Submitted by Bill St. Clair on Mon, 09 Oct 2017 22:10:12 GMT

When I visited my son in Tennessee in late August, he taught me two new board games that he invented. I really like one of them, which he calls Archmage, so I've been working since then on building a webapp, in Elm, to play it. I just finished that today.

Check it out at https://gibgoygames.com/archmage/

Should it become wildly popular, I could be convinced to add score tracking and full game history, assuming I can come up with a business model to pay for the server, but I sorta doubt that's gonna happen.

Archmage

Add comment   Edit post   Add post

MacOS High Sierra

Submitted by Bill St. Clair on Wed, 27 Sep 2017 15:00:55 GMT

Early in the morning of September 27, 2017, I installed MacOS High Sierra (10.13), on my 27" 2017 iMac. Just worked, almost entirely.

MacOS High Sierra About Box

Doesn't work:

Gutenprint printer drivers - didn't even remember I had this

Does work:

Emacs, 25.1.1 and 25.3.1
Brave, 0.18.36
Mailplane, 3.7.0 (3238)
XQuartz, 2.7.11 (xorg-server 1.18.4)
  Gnumeric, 1.10.17 (don't remember where I got this, possibly Homebrew).
EasyCrop, 2.6.1
Slack, 2.8.0 (App Store)
Elm, 0.18.0
Clozure Common Lisp (CCL), 1.11-r16789M (DarwinX8664)
Nimbus (IRCCloud wrapper), 0.7.5 (13)
Skype, 7.54 (409)
MenuMeters, El Capitan Port 1.9
GPGTools, 2.0 (Build: 887)
SoundSource, 3.0.2
Gimp, 2.8.14
Audio Hijack, 3.3.5
Node.js, v6.11.0 (for elm-repl, elm-test, and my Archmage server)

Apple Apps:

iTunes
Calendar
Contact
Photos
TextEdit
Messages
XCode, 9.0 (9A235), and its Simulator

My biggest problem was getting my Time Machine backup, stalled on "Preparing Backup...", to complete, before the upgrade. I deleted the "... Cache ..." files from ~/Library/Calendars/, rebooted, and ran First Aid on my boot and backup disks (both were fine). The backup eventually completed, but I'm not sure what I did to make it so.

I did the installation early in the morning, while I went back to sleep. Around 10:15am, a dialog popped up, which took me to help.apple.com/macOS/high-sierra/whats-new, for a pictorial introduction.

Add comment   Edit post   Add post

Going Supersonic in Elon Musk's Test Hyperloop Tube

Submitted by Bill St. Clair on Mon, 28 Aug 2017 12:43:10 GMT

Elon Musk tweeted that it "Might be possible to go supersonic in our test Hyperloop tube, even though it's only 0.8 miles long." This post computes the acceleration necessary for that.

Speed of sound: 767 mph = 1125 feet/second
1/2 test track length = 0.4 * 5280 feet = 2112 feet

t = time in seconds
a = acceleration in feet/second

1. 1/2 * a * t^2 = 2112 (distance from acceleration and time)
2. t * a = 1125 (speed from acceleration and time)

3. t = 1125 / a (divide both sides of 2 by a)
4. 1/2 * a * (1125/a)^2 = 2112 (plug 3 into 1)
5. 1/2 * a * 1,265,625 / a^2 = 2112 (do the square in 4)
6. 632812.5 / a = 2112 (do the arithmetic in 5)
7. a = 632812.5 / 2112 (multiply both sides of 6 by a and divide by 2112)
8. a = 299.6 feet/second
9. g = 32 feet/second^2 (acceleration due to gravity)
10. a = 299.6 / 32 = 9.4 g (divide 8 by (32 feet/second)/g)
11. t = 2 * 1125 / a = 7.6 seconds (time to accelerate AND decelerate)

So a Hyperloop vehicle could accelerate to the speed of sound and decelerate back to a standstill in 0.8 miles by accelerating at 9.4 g for 3.8 seconds and then decelerating at 9.4 g for 3.8 seconds.

Wikipedia's G-force page says that untrained humans can survive 10 g horizontal, eyes in or out, for 1 minute, so it's survivable.

Add comment   Edit post   Add post

2017 iMac

Submitted by Bill St. Clair on Sat, 05 Aug 2017 13:15:54 GMT

I got a new iMac last Wednesday. lisplog.org/2017-imac contains photos of its birth.

28-on-my-desk

Add comment   Edit post   Add post

Spokes is Done!

Submitted by Bill St. Clair on Sat, 29 Jul 2017 11:19:08 GMT

I have only worked on it occasionally since getting a new full-time, paying Lisp gig, but this morning, I fixed the last known bug in Spokes, the board game that my son invented, and that I've been implementing in Elm. There are still some desirable features to add, but I'll wait until users beat down my door with requests before spending more time on it. For now, I'm going to switch my spare-time Elm programming back to Xossbow.

Spokes now has chat, voting on impossible resolution (it was too time-consuming and difficult to do that automatically), public games, and a textual game state representation that allows you to restart a saved game.

You can play at gibgoygames.com/spokes.

Spokes

Add comment   Edit post   Add post

Spokes

Submitted by Bill St. Clair on Mon, 12 Jun 2017 00:11:43 GMT

Spokes is a board game invented by my son, Chris St. Clair. I've been working on an Elm implementation of it for almost a month. It works, and there are only a few issues left before it's feature complete.

The rendering is based on Elm's SVG package, much like Kakuro Dojo. But it has a server, written almost entirely in Elm, and running on my Xossbow droplet, in Node.js. I've always considered Node.js to have a brittle architecture, but my jsMaze Amazon AWS machine just runs and runs, with nary a problem.

Check out Spokes. Click on the "Help" and "Rules" links near the bottom of the page to learn how to play, try it out in "local" mode, or with a friend or three, and let me know what you think.

Spokes

Add comment   Edit post   Add post

Mirroring a Blogspot Site

Submitted by Bill St. Clair on Thu, 13 Apr 2017 10:58:31 GMT

William Norman Grigg died yesterday. RIP.

When an important blogger passes, I often mirror their web site(s). I've been doing that with Mr. Grigg's Pro Libertate. site. It's on Blogspot, so doing a simple "wget -mk" pulls a separate file for each comment to each post, even though all those copies are identical. I finally figured out how to tell wget to NOT keep those files. It still downloads them all, scans for links that it already knows about, and then deletes them, but at least they don't stay to waste disk space. I have found no way to tell it to completely ignore those files. Mirroring would be much faster if that were possible. It took a few minutes to pull the 1,030 html files, and then a long time to pull and discard all the "?showComment" files.

I named the script that does this mirror-blogspot. The important line is:

wget -mk -R "*?showComment*" -pH
 -D "$DOMAIN,1.bp.blogspot.com,2.bp.blogspot.com,3.bp.blogspot.com,4.bp.blogspot.com" $1

-m is the standard wget mirror command. It enables recursive download, disables limits on that, and ensures that no links outside of the initial argument will be followed.

-k is --convert-links. It causes internal links to be changed from absolute to relative, so <a href='$1/foo'> becomes <a href='foo'>, with all the right stuff done to make that work correctly. Unfortunately, there's no way to tell wget to do that process on an existing mirror, so if your mirror quits before it's done, you're SOL.

-R is --reject. It's the important thing I learned yesterday. It tells wget to reject files whose names match the argument, which is either a list of file types or a pattern (not a regular expression).

-p is --page-requisites. It tells wget to download inline images, but will NOT by itself make it download from another domain.

-H is --span-hosts.

-D is --domains. If not specified with -r, then only files from the domain mentioned as the final argument will be downloaded. It allows you to add other domains, but also requires that you include the domain on the command line; hence $DOMAIN in that list. The *.bp.blogspot.com domains are where Blogspot stores images.

1 comment   Edit post   Add post