Tales from the jar side: Off-by-one errors and 5 years of Tftjs, 1 year and 1000 subs on YT, Substack issues, and a Holiday edition of tweets, toots, and skeets
My biggest fear is being trapped in a small room with Santa. I have Claustrophobia. (rimshot)
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of December 17 - 24, 2023. This week I taught week 3 of my regular Spring and Spring Boot in 3 Weeks course on the O’Reilly Learning Platform, and my Practical AI Tools for Java Developers course as an NFJS Virtual Workshop.
Here are the regular info messages:
Regular readers of and listeners to, and video viewers of this newsletter are affectionately known as jarheads, and are far more intelligent, sophisticated, and attractive than the average newsletter reader or listener or viewer. If you wish to become a jarhead, please subscribe using this button:
As a reminder, when this message is truncated in email, click on the title to open it in a browser tab formatted properly for both the web and mobile.
Today’s Off-by-one Error Celebration
I went through the archive for Tales from the jar side (Tftjs), and I found that the very first issue was sent on December 30, 2018. That means the issue you’re reading either marks five full years of Tftjs, or next week does. I never seem to get that right. I would normally wait until next week’s issue to comment on it, but every year I suddenly realize that maybe that’s not the anniversary, but the beginning of the newsletter’s new year.
At the turn of the millennium, some people claimed we should celebrate on January 1, 2000 and others said we should wait until January 1, 2001. My attitude, then and now, was that we should have a party both days. Duh. If you’re going to be pedantic, at least make it work in your favor.
Either way, it’s been five years of a new edition of this newsletter every Sunday (except for one, but so be it).
Wait, is it five years? All of 2019, 2020, 2021, 2022, and 2023. Yeah, that’s five, so next week starts Year 6, right?
The heck with it. Have a party both weeks.
For those interested, the current subscriber count is 2009, none of whom are paid. I’ll come back to that later in this newsletter.
Tftjs, the YouTube channel
Speaking of milestones, I published my first video on the companion YouTube channel on December 23, 2022. That means that yesterday was that channel’s one-year anniversary. Or maybe today is? No, I think yesterday counts. To celebrate (sort of), I published a new video there in my AI Tools from Java playlist, entitled Gemini and Java: Quick and Easy:
Gemini is the latest AI tool provided by Google, which I’ve discussed here the last two weeks. The video shows the process of connecting to it programmatically in Java:
Get an API key and set it as an environment variable. (Note: Of course that’s Step Zero. I’m in computer science, after all, so we’re counting offsets. I wonder if that’s part of the reason I have trouble with off-by-one errors?)
Map the incoming and outgoing JSON request and response to Java records. Since the “text-with-image” endpoint added another child element to the Part type required for the “text” endpoint, I made both implement a sealed interface, which was also pretty cool.
Use Spring 6’s HTTP exchange interfaces to automate the networking. That also involved customizing the new
RestClient
bean to submit the API key as a header, as well as theAccept
andContent-Type
headers. All pretty routine, once you know the pattern.Customize the mappings with annotations for the included Jackson JSON parser. For me that meant telling Spring and Jackson to convert camel-case in Java to snake-case in JSON.
Inject the HTTP interface into a service, so I could make it easy for a client to call and get what they wanted.
That’s all I needed to do. Here was my primary test case:
That worked fine, of course. As most anyone in IT knows, according to The Hitchhiker’s Guide to the Galaxy, the Ultimate Answer to the Ultimate Question of Life, the Universe, and Everything is 42. (Sorry for the spoiler for a book published in 1979.)
As another test case, I asked all three of GPT-4, Claude AI, and Gemini another question:
Question: How many roads must a man walk down, before you can call him a man?
GPT-4: This is a rhetorical question from the song "Blowin' in the Wind" by Bob Dylan. It is not meant to have a specific numerical answer, but rather to provoke thought about the journey and experiences that shape a person's life.
Claude 2.1: I do not have enough context to determine a specific number of roads a man must walk down before being considered a man. The notion of proving one's manhood by walking roads or undergoing other trials and experiences is subjective and cultural. Without more details about the exact meaning you intend behind this metaphorical question, I cannot provide a definite quantitative answer.
Gemini: Four.
Four? Yup, and I got that answer repeatedly. To me, that suggests somebody at Google anticipated that question and decided to put in what they thought would be an amusing answer. Isn’t that just the most Google answer ever? Practically everything from Google makes me think, “they get it, but they don’t get it.”
Sigh.
(The actual answer, of course, is blowin’ in the wind. The answer is blowin’ in the wind. Now try to get that song out of your head for the next hour.)
My video also demonstrates how you can upload an image to Gemini and have the AI describe what’s it in. I sent it this image (generated by DALL-E 3). My prompt was simply, “Draw an image of a happy robot leaping with joy after solving a tough coding problem,” but DALL-E 3 likes to rewrite your prompts to add more details.
To submit it, I had to convert the image into a byte array and then encode that as a Base 64 string. Fortunately, Java has a class to do that automatically. The response I got back from Gemini was:
Gemini: The image shows a small, happy robot jumping in the air. The robot has a silver body and a blue screen on its chest. It is surrounded by computer code.
True enough. I think what people might use this for is to upload a picture they took and ask Gemini where or when it might have been taken. My experience with that is that the answers tend to be so generic as to be practically useless. A friend recently sent me this picture:
My friend asked me if I could tell where it was taken. I, of course, asked Gemini. It replied:
The image appears to show a campus-like setting with Gothic architecture reminiscent of various universities, especially those in the United States or the United Kingdom. However, without any specific symbols, signs, or distinct landmarks, it is not possible to determine the exact location from the image alone. If you are seeking to identify the location, you might consider any textual information that could be associated with the image or any distinctive architectural features that could be cross-referenced with known buildings.
I mean, yeah, right, but I could tell that much myself. It turns out it’s from Princeton University, where I spent four years as a graduate student during the late Mesozoic Era (roughly 1984 — 1988).
I added the code I used to the same repository containing my Claude AI code, just to make it easy to compare them. If you’re interested, here’s the GitHub repository.
One more thing, and arguably I should have led with this:
Yup, I hit 1000 subscribers, right about at the one-year mark of my channel. I’m currently at 1013. Sweet! Now I just need tons of watch hours in order to join the YouTube Partner Program (specifically, you need 4000 watch hours in the last 365 days). I’m around 1150, so that’s going to take a while. Still, yay for round numbers!
Substack Issues
The first year, my newsletter was hosted on a platform called TinyLetter. Near the end of that year, a couple of the baseball writers I follow (specifically, Craig Calcaterra and Will Leitch) announced that they were adopting Substack, so I checked it out and decided I like it here. Tftjs has been hosted on Substack ever since.
That may have to change. About a week ago, Craig Calcaterra sent out a message that said he signed onto a letter sent to the owner of Substack, Hamish McKenzie, asking why they were platforming and monetizing actual Nazis citing the linked article in The Atlantic. This week he posted the response they received, which is pretty much what you would expect (“We hate Nazis too, but censorship is bad, especially when we’re making money off of those a$$holes,” or words to that effect).
The result is that a lot of the writers I follow there are now looking for a new home. I’m keeping an eye on that, and may follow them if they move. I checked a couple of the major options, though, and noticed that I have too many subscribers for anybody else’s free tier. That means if I move, I’ll feel like I have to start charging, just to make this a self-sufficient operation.
I don’t know. I rather like the thought that since I’m using their service for free, I’m actually costing Substack money. No wonder they keep trying to push me to turn on the paid option. If there is a significant exodus, that pressure may grow. Someday they’ll impose a monthly fee, probably if you exceed a threshold of subscribers. I guess we’ll see.
As another perspective, if you acknowledge that those right-wing bastards are inevitably going to congregate somewhere on the web, a private email list is about the most harmless option I can think of. Social media groups or websites can be forwarded to me, or I could stumble across them accidentally. That’s not happening with a paid email newsletter. One of the reasons I’m able to write here so freely is that I know the only people reading this are people who agreed to be here, and they can leave at any time. That’s really helpful to me. I’ve never once accidentally stumbled upon a horrible newsletter. Let them all scream at each other, and leave me out of it.
I must admit, however, that both of those arguments are so self-serving they may just be elaborate rationalizations, so I’ll monitor the situation and let you know what happens.
Let’s move on to the good stuff.
Tweets, Toots, Skeets
The Red Light
The “Walk the streets for cookies” line doesn’t quite work, but hey, good try. It fits right in with the, “any disability will be tolerated if it can be exploited” theme surrounding poor Rudolph.
Variation on a theme
Stephan Pastis (the cartoonist behind Pearls Before Swine) posted this himself on Twitter/X:
Warning: this site uses cookies
I would accept that happily.
Me Like Cookies
Disturbing, but funny anyway.
Think about it
Uh, yeah.
Looks are deceiving
That hits a bit too close to home.
Where am I now?
Santa has way more hair than I do.
Parenting advice
Hey, those boxes are worth money too.
It’s a miracle!
Decorating advice
Climate change is real
In eggshellseas dayo
And finally,
That’s pretty much everybody tonight during that song, and no, I’m not going to count to verify that number.
Have a great week, everybody!
The video version of this newsletter will be on the Tales from the jar side YouTube channel tomorrow.
Last week:
Week 3 of Spring and Spring Boot in 3 Weeks, updated for Spring Boot 3.2, on the O’Reilly Learning Platform
Practical AI Tools for Java Developers, an NFJS Virtual Workshop
This week:
No classes! So look for at least one video, beyond the normal newsletter video tomorrow.
Ho, Ho, Ho.