Tales from the jar side: Setting up Mockito, Reacting to Spring, and Tweets and Toots
Thieves stole 20 cases of Red Bull from my local supermarket. I don't know how those people sleep at night. (rimshot)
Don’t feel like reading this newsletter? That’s fine — I’ll read it to you on the Tales from the jar side YouTube channel. Today’s newsletter is tomorrow’s video.
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of February 19 - 26, 2023. This week I taught my Reactive Spring on the O’Reilly Learning Platform, which was far more interesting than I intended.
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.
Video on Setting Up Mockito Projects
I published a new video this week, entitled Setting Up A Mockito Project:
As with many of my videos these days, it’s pretty obvious I’m still going through a learning curve. You can see in the image that I can now create a decent enough thumbnail, as they say in YouTube parlance, meaning a first slide with a title and an image. I’ve now got my Tftjs logo in there. I can also take a picture and add it to the thumbnail, which is interesting.
If you watch any of the video, you’ll find that I’ve added another feature, which is some background music. There are many services that offer that sort of royalty-free music, either as a subscription or even for free. YouTube itself does that. Instead, however, I used a song from my son’s former band, The Tension. They only lasted long enough to make one (truly awesome) album, called The Rest Can Wait, which you can find on various services but has also been uploaded to YouTube.
I’ve wanted to find some use for those songs, but I didn’t want to add a song with vocals as background music while I was talking. Last week I found a recommendation, however, for the site called Vocal Remover, which does exactly what it says it does, for free. You upload a music file and it returns a file with all the voice parts removed.
(I wonder what would happen if I uploaded my 7-part a cappella Ave Maria? Would it remove everything? That’s such an existential problem I’m a little afraid to try it.)
I removed the vocals from one of the songs on that album and added it to my video. The advice that comes with doing that is to lower the volume more than you think you’ll need to, so I cut the volume of the song down to about 15%.
That worked, but with one slight problem: the video was about a minute longer than the song. I thought, “hey, that’s easy, I’ll just add it again,” and I did that.
What I forgot to do was to lower the volume on the addition. Oops. I didn’t realize that until I’d already published the video and sent out the links to it via Twitter, Mastodon, and LinkedIn. Once I found what I did, I fixed the problem and published it again, only to find that YouTube is quite happy to have two virtually identical copies of a video at two separate URLs.
I considered deleting the original, but three people had already watched it by that time and I didn’t want to leave the link I published empty, so I decided to chalk that one up to experience and leave them both up.
My post about that on Mastodon was:
That about sums it up. Way back when I tried my hand at writing fiction, I remember encountering the saying:
The first million words are practice.
Presumably the first dozen or so videos are practice, too, as I get to know the tools better. The advantage of having a small audience is that there aren’t too many people to get upset with my mistakes, and most of them don’t seem to care all that much. At this point, both videos are getting views, so I just mentally add the numbers together to see how it’s doing.
Now if can only figure out how to get a decent subscribe button with a transparent background…
Reacting to Reactive Spring
Periodically I teach a training course on Reactive Spring. Reactive is what they call asynchronous, or the opposite of blocking.
I often describe it this way. Say you go out to lunch at a fast food restaurant. You go to the cashier and put in your lunch order, which is sent to the kitchen. If the restaurant was purely blocking, both you and the cashier would then stand there, waiting until your lunch was delivered, and only then could you get out of line or the cashier could take orders from other customers. That’s called being blocked in I/O, because that’s the layer of the application taking in requests from clients and returning responses to them. The restaurant could improve performance a bit by adding more cashiers, but if you have four cashiers and more than four customers, you’re blocked completely again.
Of course, that’s not how real restaurants work. When you put in your order the cashier hands you a receipt with a number on it. That allows you to get out of line and prepare for your lunch to arrive, by getting your drink or napkins, picking a table, and so on, and the cashier is now free to take other customer’s orders. You have to keep an eye on the display to see when your number is called, so the situation is a bit more complicated (especially if the delivery is wrong in some way), but it’s a lot more efficient. Now three cashiers can handle the entire lunch rush.
The Spring framework is one of the most popular server-side systems used in the Java world for building applications like that, and they have an entire module, called WebFlux, for doing asynchronous applications like that. The design is pretty clean and straightforward, but it’s still a complicated topic because nothing asynchronous is ever easy, even if the code is relatively simple.
This week I taught my regular training course on Reactive Spring, but none of the complexity I just described explains why I ran into problems. The difficulty was that nothing in the IT world remains the same indefinitely. My course involves five extended exercises that I do along with the students. The first two involve accessing a free web service, first the blocking way and then using the reactive approach. The other three involve adding a reactive database and then putting your own reactive server in front of it.
When I opened the document for the exercises during class, I realized that I’d forgotten to check if it was up to date or not. Unfortunately, that external service we access for the first two exercises is no longer available, which happens with free services. They come and go. I meant to update the labs to use a different one, and I’ve already done that for my regular Spring course, but I’d forgotten to take care of that for this one.
I knew what the updates were going to be, so I was able to keep going. I just had to redo the labs on the fly, as it were, with the students participating. That was a bit of an adventure, but it worked in the end.
Then I went to the database exercise, only to discover that the database driver I always used no longer works with the current version of Spring. Ugh.
Again, it was a problem, but not a crisis. I backed off to the previous version of Spring, which I knew worked, and went from there. Most of it worked (there’s still a quirk I needed to fix that changed recently, but I knew how to deal with that), and the attendees were pretty laid back about the whole thing, or at least they didn’t complain about it.
Still, that’s not supposed to happen. I had time before the class to update the materials, if I’d only realized they needed to be updated.
I saw that the next time I was scheduled to teach that class is in April, so I figured I had a few months to fix everything. Then yesterday I noticed that, on the contrary, I have a similar NFJS virtual workshop on the same topic this coming Tuesday, so I had to get back to work on it right away.
Thank goodness I checked my calendar, or this week would have been fun, too.
Tweets and Toots
I should try this on my son
You might also ask them to fix the grammar on that image.
You Know You’re Old When…
The horror of realizing Walter Peck had a point.
Earworm Of The Day
I’m guessing most people will get the reference not from the original song, but from the Family Guy episode that used it over and over.
FYI, that video has over 87 million views. That’s way more than tomorrow’s video of me reading this newsletter on the Tftjs YouTube channel should get. (Like, 87 million more.) Still, the gag works.
Chess Cheating References FTW
I haven’t heard much about the lawsuit filed by Hans Niemann accusing World Champion Magnus Carlsen (among others) of defamation for implying that he was cheating, but this was clever:
This reply was even better, though:
In case it’s not obvious, that’s a reference to the ridiculous assertion that Hans used, er, a sort of vibrating beads that I won’t explain here to receive moves from a computer, which is all I’m going to say about that.
That Isn’t Funny
My week-long hospital stay was almost a year ago, if you can believe it, which is still the only time in the past four years I missed a week of publishing this newsletter. All I can say is my high-deductible medical plan did its job. In fact, when they did further tests later in the year (heart catheterization, which is not two words you ever want to hear together), I told the surgeon that my deductible was already paid, so if they wanted to remove 20 lbs of fat while they were in there, that was fine by me. No such luck, however.
(I’m fine, BTW.)
Finally, A Pun In Poor Taste
The only other song from Porgy and Bess I know is Summertime, and the growing (presumably of the veggies) is easy.
That was a weak pun, so I asked ChatGPT to rewrite the Summertime lyrics to be full of vegetable puns, and here’s what it gave me:
I wanted to tell ChatGPT not to give up its day job, but pot / kettle / black, etc.
(Okay, I’ll admit that the “hush little baby, don’t you fry” line was pretty good.)
(Wait, I should probably make a joke about pickles. Maybe something about how pickles are delivered, but no, that would be too jarring. Back to the end of the queue-cumber for me. Such a dill-emma.)
Have a great week, everybody! 🥕 🥒 🥦
The video version of this newsletter should be uploaded onto the Tales from the jar side YouTube channel tomorrow.
As a reminder, you can see all my upcoming training courses on the O’Reilly Learning Platform here and all the upcoming NFJS Virtual Workshops here.
Last week:
Reactive Spring and Spring Boot, on the O’Reilly Learning Platform (APAC time zones)
This week:
Making New Java Features Work for You, on the O’Reilly Learning Platform
Reactive Spring, an NFJS Virtual Workshop
The Bird video deserves one.