Posts

Light Interaction App

Check out this nifty little touch-screen-compatible, WebGL-powered application.

To test out the latest AI, I added GitHub Copilot to VSCode and asked it to build a simple web application that lets the user move three radiant lights (red, green, and blue) around a screen to see how adding colors works. (For example, if the three colors are right on top of each other it looks like a single white light.) Here’s a screenshot of that first app:

By default Copilot uses GPT-4o, but on a few examples I have found that Claude 3.7 Sonnet (another Copilot option) is capable of more sophisticated computer engineering, so with that selected as my Copilot “Agent” I began enhancing this app. The most significant change – and something I’ve wanted to try for a while – was to use WebGL to take advantage of the graphics processing features built into most modern electronics. Thanks to that hardware acceleration, this enhanced app supports lots of light sources, dithering to avoid color banding, and real-time dragging lights around the screen without noticeable lag. Then I added touch-screen support so that the app can be used on mobile devices.

It took some coaching from me to get this working: At several points I observed bugs and Copilot would essentially get stuck in a loop saying, “Oh, I see what’s wrong; this should fix it,” without successfully fixing it. I had to guide the Agent through more intentional debugging methods to resolve several confusing problems. But by the end I hadn’t written or even touched much of the code. I was the designer and tester, and Copilot saved me the trouble of:

  • Scouring API documentation and sites like StackOverflow for code samples needed to make it work.
  • Learning or remembering the exact syntax of the languages involved (WebGL, JavaScript, CSS, HTML).
  • Recreating common GUI tricks, like adding code to make sure that everything is visible on a screen regardless of its size or orientation.
  • Finding and fixing minor bugs.
  • Writing debug code to understand and resolve major problems.

Here’s a screenshot from the final app (shown here with all light inverted – one of the fun features accessible by right-clicking/long-tapping):

SpaceX Falcon 9 Flyby

I glanced out a window last night and saw this brilliant spectacle unfurl as the second stage of a Falcon 9 traversed the sky west of Phoenix at an altitude of 90 miles and ground speed reaching more than 10,000mph:

Since this was shortly after sunset, the exhaust plume was high enough to be illuminated by the sun from over the horizon. (Here’s SpaceX’s video and mission summary.)

Venus with Crescent Moon

Now in the first week of February 2025, Venus is approaching its peak brightness. Here is a picture of it near the waxing crescent moon while at a brightness magnitude of -4.8.

This makes it 23 times as bright as Mars, which had a magnitude of -1.4 in the photos following its lunar eclipse three weeks ago:

Mars emerges from lunar occultation, photo by David Bookstaber 20250113

Venus has almost twice the diameter of Mars (which itself has twice the diameter of the moon), and presently it is also only 75% as far from Earth as is Mars.

Martian Eclipse (Lunar Occultation)

Last night (13 January 2025), North American observers could see the nearly full Moon pass in front of Mars, hiding it for as long as an hour. I got some photos of Mars emerging on the other side:

As noted last week, right now Mars is relatively close to Earth and in nearly full phase, just like the Moon in these pictures, so we are seeing the entire “day” side of Mars. Mars is twice the diameter of the Moon, but presently it is more than 200 times as far from Earth.

Bright Planets: Venus and Mars

Coming into 2025, have you noticed that Venus and Mars are growing quite bright? Looking at a map of planetary positions it’s easy to see why Mars is approaching a point of peak apparent brightness (which it will reach on January 16): it’s on the same side of the sun as we are, so it’s relatively close; and we are aligned to see the full reflection of the sun-lit “day” side.

Inner planet positions on 16 January 2025

With Venus it’s not as easy to figure out when its apparent brightness will be maximized. When Venus is closest to Earth we are looking at its night side, so there’s no reflected light to see. When we can see the full day side of Venus it’s at its furthest from Earth on the other side of the sun, so it’s reflecting the maximum amount of light in our direction, but being so much further away the amount of light that reaches us is lower. In fact Venus goes through “phases” just like our moon does based on its position relative to the Earth and Sun, as shown in this diagram:

Phases of Venus: How much of the “day” side of Venus we can see at different points in its orbit relative to Earth.

Next is another diagram that shows two significant points in the relative orbit of Venus: “Greatest Elongation” is when (from our perspective) the angular distance between Venus and the sun is largest. It turns out that the peak apparent brightness for Venus occurs when it is just inside its points of greatest elongation, with slightly less than half of its day side facing Earth.

Venus is at greatest eastern elongation on January 10, which puts it at its highest point in the evening sky. Its brightness will peak on February 14, at which point it will be more than 20 times brighter than the brightest star we can see (Sirius). This is so bright that it can be seen during broad daylight, if you know where to look.

Alcohol is more efficient than sugar

Centuries ago, when bulk transportation was expensive and raw foods were at risk of loss to spoilage or pests, distant farmers might prefer to convert sugar-bearing grain and fruit into ethanol, distill it to concentrate it, and transport that concentrate to distant markets. (This fact was a primary cause of the Whiskey Rebellion in response to the imposition of a tax on distilled alcohol.)

I was surprised at how much more efficient ethanol is as a source of energy, even though energy is lost through fermentation! The chemical equation for fermentation of sugar (glucose chosen here) is:

C₆H₁₂O₆ (glucose) → 2C₂H₅OH (ethanol) + 2CO₂ (carbon dioxide) + Energy

Considered by weight: For every kilo of glucose fermented, we get half a kilo of ethanol and 300 calories of heat (which is typically wasted). But ethanol is more energy dense than sugar: Humans extract 3700 calories per kilo of glucose but 7000 calories per kilo of ethanol! I.e., the metabolic energy available in a kilo of sugar is mostly preserved when converted to alcohol, but its weight is cut in half.

100 Free 4k UHD Background Photos

I went through my landscape photos and picked the best hundred, then spent time enhancing each one to make a good background image at 4k resolution (3840×2160 pixels). I have shared them through this Google Photos album under the CC BY-NC-SA license so you can save your favorites. If you simply save the images to an album in your own Google Photos then you can set that as your “Screensaver” for any Google-connected TV or device. Enjoy!

Today’s LLM Challenge: Create a diagram

Ask an LLM to create a technical diagram and they’ll use a diffusion generator, which produces funny but mostly nonsensical results. But they tend to be pretty good at writing code, so I thought I’d see how they can do with the following prompt:

Describe a diagram suitable for a textbook that illustrates the definition of “cross-sectional area”. Then create SVG code to render that.

The description is easy, so I’m only going to show the SVG images they produced.


ChatGPT 4o

Claude 3.5 Sonnet


Perplexity

Bing

Bing also volunteered four diffusion images, first of trees like this:

Then I asked it to try again using a simple cylinder and got these cool but not usable results:


The smaller models available through HuggingChat were worse, and Cohere didn’t even get the SVG namespace into the XML. Here’s what I got from the top three:

Privacy.com to thwart subscriptions

Businesses love the recurring revenue from subscriptions. And they love the fact that people tend to be so lazy and forgetful that customers don’t reliably cancel subscriptions that they wouldn’t otherwise keep. As a conscientious consumer, I dislike subscription services because businesses have a disincentive to make cancelling subscriptions easy. I disapprove of the roach motel business model. My favorite countermeasure: Privacy.com.

Privacy.com lets you create credit cards with all sorts of constraints, as shown in this screenshot:

Screenshot of Privacy.com credit card limits.

I particularly like the single-use card, which I create for subscription services. If I forget about the service they can’t keep sucking money from my bank. If I want to cancel the service, I don’t have to find and navigate their arbitrary cancellation processes … and keep records of cancellation attempts to dispute recurring charges from those businesses that are either incompetent or downright fraudulent when it comes to cancelling subscriptions. If I do want to continue subscribing, I have found that every business goes above and beyond to make that as easy as possible!