Tales from the jar side: Live Stream with Craig Walls, Java and Whisper AI, Java 21 released, More theme songs, and the usual silly toots and skeets
What do you call a reluctant potato? A hesitater. (rimshot)
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of September 17 - 24, 2023. This week I taught week 3 of my Spring in 3 Weeks course and my Managing Your Manager course on the O’Reilly Learning Platform.
Regular readers of (and listeners to, and now 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.
Live Stream with Craig Walls
This week, I interviewed Craig Walls, who is a long-time Spring developer, Alexa innovator, and the author of Spring in Action, the biggest selling Manning book of all time.
I’ve known Craig for years, so we had a lot to talk about, but the conversation really focused on the new Spring AI project. That project is in its infancy, but Craig has already made three separate videos about it. One of them introduced me to the idea of embeddings, loaders, and vector databases, which is how you add your own data to GPT so it can answer your questions about it. That capability isn’t in Spring AI yet, but it’s coming. Craig wrote his own version of it (which is pretty impressive, TBH), based on what he saw in the LangChain project from the Python / TypeScript world.
Speaking of that, a new book on this stuff appeared on the O’Reilly Learning Platform. It’s called Developing Apps with GPT-4 and ChatGPT.
Since I’m basically the target audience, I wound up devouring it in a few days. The examples are all in Python, but they weren’t too hard to follow even for me as a Java developer. The concepts were quite helpful. Of course, some of the information is already dated. Frankly, I can’t imagine writing a book like this without it becoming out of date almost as soon as it’s released, but the authors did about as good a job as it was possible to do.
Between that book and talking to Craig, I was able to put in a new proposal for a training class in Spring AI. Naturally I had GPT-4 write as much of it as possible. We’ll see how it goes.
Java and the Whisper AI
One of the features of the OpenAI library is that it provides an endpoint for generating transcripts from audio files. For the past couple of weeks I’ve been hard at work digging into it, preparing a new associated video for the Tales from the jar side YouTube channel, which I finally published right before sending out this newsletter:
Here are the main points:
There’s no JSON data to deal with this time. The request has to include the binary file containing the audio, and the response can be customized to return the text transcription directly. So in that sense, this endpoint is much easier than the others.
Java’s HTTP Client (added in Java 11) didn’t help this time. I need to send both binary data (the audio file) and text data (prompts and other info), and the Java client isn’t good at that. Instead I wound up using the Apache Http Client, which had its own learning curve. Fortunately, the AI Assistant in IntelliJ walked me through some of the complications, and I found examples for the rest.
The relevant tutorial at OpenAI does a transcription of a WAV file and then post-processes in four different ways. The problem is, the original transcription doesn’t work because their selected file violates their own size restriction.
That last point is crazy. I mean, why give a tutorial at all if the sample file you provide is already too big to work? You have to break that file into chunks to get anywhere, and you can’t just grab bytes as you go along — there are headers and other metadata to think of.
Once again, however, GPT came to the rescue. It turns out Java has had a package called javax.sound.sampled
since version 1.3 (!), and in all my years as a Java developer I’ve never had to deal with it. GPT knew what to do, though. It took some playing around, but it basically gave me a WavFileSplitter
class I could add to my system that worked just fine.
This is a great example of how much my life has changed since these AI tools came along. Prior to that, I never would have attempted to figure out how to do all this. Given the AI tools now, it’s just a question of keeping at it when it gives me code that doesn’t work, and eventually I get something I can use. For a one-person company, having that kind of pair-programming ally is a big deal.
(Unless I use Google’s Bard. I tried that again this week and again it was a disaster. I’m just amazed how bad it is. Prior to ChatGPT, Google had a reputation as the best AI company around, and now, ugh. Later this Fall they’re supposed to release their “Gemini” tool that’s supposed to be at least competitive with GPT-4, but I’ll believe it when I see it.)
The published video goes through all the steps, and ultimately does the GPT-4 post-processing using Java parallel streams, so that was pretty cool.
Java 21 Is Here
Java 21 was released on the 19th, which made me unhappy:
Silly, I know, but how hard would it have been to delay two days?
To be honest, it’s a good release. The full list of features is here. I like the fact that pattern matching for switch is finally done, and record patterns is basically Java’s version of Kotlin destructuring. The other features I can take or leave. The big feature the press is talking about is virtual threads, but I think that’s mostly just going to affect servers rather than anything I do.
Of all the announcements, though, I liked this one:
I didn’t even know there was a Java distribution with JavaFX support, which is what I assume the 21.fx-zulu distribution in the figure is all about. I installed it, so now I guess I’ll find out.
I use SDKman for everything, and I’m a financial supporter of the project through the Open Source Collective. After the initial release, I’m in the waiting period where all the tools I use slowly release versions that work with Java 21. I think IntelliJ has an early access version that works already, but Gradle still doesn’t run on it.
Once I have support everywhere, I’ll talk more about it.
A few more potential theme songs
Last week I talked about how I used the Chirp Bot from Suno.AI to generate some potential theme songs for the Tftjs YouTube channel. The lyrics (such as they are) came from GPT-4. I fed them into the Chirp Bot, selected a music style, and let it crank away.
Last week I included links to the theme song in emo style and pop style. This week I added a Short for the k-pop style:
Not bad, actually. I might use that one for a while.
Here are three more attempts which I have not yet made public. I’ll just embed them here, and see what, if any, reaction I get from the jarheads.
First, here’s the neo soul theme:
Next, here’s the result of asking for The Beatles, which sounds almost, but not quite, entirely unlike The Beatles:
Finally, here’s the Gregorian Chant version. Yeah, I’m not sure why I asked for that either, but here’s the result:
Take solace in the fact that I’ve almost certainly used up my credits for this month, so we’re done for at least a week or so.
Toots and Skeets
See what I mean?
Two responses come to mind:
Yeah, I can see (rimshot) why that might happen.
I see (rimshot) what you did there.
I hope this email finds you…
Variation on a theme from last week.
Fool me once
I love it, just like the first time I heard someone refer to cryptocurrencies as Dunning-Krugerrands.
The social media transition
Yup, it me.
Dated, but still great
“Pope Karen”. Perfect.
Dope Entrance
That is a pretty grand entrance, when you think about it.
Mansplaining FTW
Apparently some good can come from mansplaining.
Finally, CatGPT
Maybe it’s dinner time after all.
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 in 3 Weeks, on the O’Reilly Learning Platform
Software Design, my course for undergrads at Trinity College
This week:
Upgrade to Modern Java, an NFJS Virtual Workshop
Software Design, my course for undergrads at Trinity College