Archive for the ‘Clojure Coding’ Category

Advent of Code 2022 is On!

Thursday, December 1st, 2022

Christmas Tree

This morning I did the first day of the 2022 Advent of Code. What fun it is to get back into Clojure - for a month. If I thought it the least bit reasonable, I'd be doing back-end Clojurescript as it gets generated into Javascript in the same way that Typescript does, so it would run on the same stack with the same speed, etc. But it's just too big a leap for most folks, and it's not worth the education cycles.

But still... the simplicity of the language, and it's ability to run in highly multi-threaded environments is a huge win, and so it will remain one of my very favorite languages.

Temurin 11 is on Homebrew

Tuesday, May 24th, 2022

Homebrew

This morning I decided to see if I could get the AdoptOpenJDK 11, now called Temurin 11, going on my M1Max MacBook Pro. In the past, they have had the AdoptOpenJDK 11 on Homebrew, but it was Intel, and I didn't want to bring in Rosetta 2 for any Clojure work, so I was willing to wait. I read on Twitter from the Eclipse Foundation that they had placed Java 11 and 8 for Apple Silicon on Homebrew, so why not?

It turns out, it's not bad at all:

  $ brew tap homebrew/cask-versions
  $ brea install --cask temurin11

and it's ready to go. Then I can use my setjdk function to switch between JDK 11 and 17 on my laptop, which is nice when there are some issues I've had to deal with in the past. Don't know when I'll need this again.

Sadly, the architecture for JDK 8 is still Intel:

  $ brew info temurin8
  temurin8: 8,332,09
  https://adoptium.net/
  Not installed
  From: https://github.com/Homebrew/homebrew-cask-versions/blob/HEAD/Casks/temurin8.rb
  ==> Name
  Eclipse Temurin 8
  ==> Description
  JDK from the Eclipse Foundation (Adoptium)
  ==> Artifacts
  OpenJDK8U-jdk_x64_mac_hotspot_8u332b09.pkg (Pkg)

that last line is the kicker: x64... so it goes. Still... I have JDK 11 for Apple Silicon now, that's good. 🙂

Merry Christmas!

Saturday, December 25th, 2021

Christmas Tree

It's another Christmas, and things have started out quietly... I was able to finish Advent of Code today - all 25 Days in 25 days. It's an unusually warm Christmas - so no snow, but that's not really unusual, but the temps being as warm as they are is a little odd. Still... the temps will fall, and the snow will come, and it'll be time to shovel snow, but for now it's just like an extended Fall.

The Christmas Music has been great this year, and I've enjoyed some really good Christmas Movies. I wrote a Christmas Letter yesterday and sent it to extended family, and it seemed to be appreciated. I like catching folks up with a little humor. 🙂

Life goes on.

The iPad Pro Really is Something

Wednesday, December 22nd, 2021

IPadPro

I have been using the iPad Pro for two generations now, and my current model is the M1 iPad Pro, and during the pandemic, it has really proven to be a great Zoom, Meet, etc. box. It has a nice camera, and with Front and Center in iPadOS, it really makes it easy to have a good presentation, or meeting. But it's really so much more.

With the GitHub app, I can get PR notifications, review them, and merge them. With the GitHub Workflow Actions, we have continuous deployment, and that is really quite amazing to me. Of course there are the shells to boxes, and that is great, but even offline, there is so much to like about this machine.

It's rugged - compared to my MacBook Pro, and the screen is a lot easier to clean. I'm not saying my MacBook Pro isn't nice... it's just that in some respects, the iPad Pro is nicer.

What a really amazing device. 🙂

The Nasty Log4j Business

Monday, December 20th, 2021

log4j.jpg

It's been a wild couple of weeks for the log4j team... I mean, the problem with a logger is that you don't really want to limit it, and adding the url handlers probably seemed like a great idea at the time, but once they started to be used, it was understandably hard to drop support for them. And then the exploit hit.

It's just one of those nearly universal components of JVM systems that is being supported by volunteers, and trying to thread the needle between keeping as much of the functionality as they can... while restricting the vulnerability to something that can't be exploited. It's clearly not easy, as they've had at least three releases of the 2.x codebase to try and correct the vulnerability, and each time, there seems to be more there is to do.

This is certainly going to shift how some open source teams function... it's great to be the author, or maintainer of something as used as log4j, but to have this kind of attention... well... I'm sure it's not what they were hoping for this Christmas. 🙂

Advent of Code Day 19 was Brutal

Sunday, December 19th, 2021

Christmas Tree

I just got Day 19 of Advent of Code, and it was brutal... I mean yes, the concept of change of axes, and then translation - that's not horrible, and while getting the individual translations right took a little time, the fact was, it worked, and I found the overlaps. What came next was the real challenge - Searching was not going to work.

This is not something new, as it's often that Part 1 is something that's reasonably direct, and can be solved directly, but Part 2 adds a much larger scope, and so can't really be solved in the same way. Not always... but often enough, that it didn't surprise me. So I knew I needed to thin the search space - I just didn't know I'd have to remove it entirely, and come up with an "execution plan" for the work.

Thankfully, I expect each translation to need the working rotation function, and offset so that once I had two sensor data matched, I could then move any point on one sensor to the other. But I then needed a faster way to find the overlaps, and then an order with which to collect all the beacon locations.

As it turns out, the unique set of inter-beacon distances is a nice "fingerprint" for a sensor data list, and we can use that to identify the "pairs" of sensors that overlap. Then it's the matter of order of mapping - and there we had to start at 0 and work up. If the pair had a sensor that we'd already mapped, then add it, and put it in the list. If not, put it at the back of the list, and try again. Eventually, all the pairs will be put in order, forming a chain of translations.

To get this, I worked on so many variations it's crazy. I easily spent over 10 hours on this day's puzzle. But in the end, the feeling of seeing the quick response was just fantastic! 🙂

Advent of Code 2021!

Wednesday, December 1st, 2021

Christmas Tree

It's December again, and that means 25 days of some of the funniest, most frustrating coding problems of the year. Yes, Advent of Code is back, and it'll be interesting to see how things work out. I will confess that today's problem wasn't too bad, but that's how the month always starts out. 🙂

We will see how things progress as we go through the month, but it's always fun to play along with the puzzles as they put you in the middle of the action to help Santa and the elves. It just makes me smile.

Interesting Pattern Matching in Clojure

Wednesday, August 18th, 2021

Clojure.jpg

I was reading IRC this morning, and saw that someone was asking about pattern matching in Clojure, and there were two suggestions: core.match and fnl-match. The first seems to do a pretty nice job, and it's got a lot of examples of the different kind of sources, and patterns. In all, it's an excellent example of a really super-charged case statement.

The second is written by technomancy - the author of Leiningen, a really good build, version, project tool for Clojure, so I was very interested in that as well. It looks like there is a lot of overlap in the design and capabilities, and that's nice - and it also means that there are options if I ever really need to use this.

The examples for core.match really make it clear how useful this is, and how much effort went into making the code efficient. That's where I'll likely start, as soon as I need something.

Sublime Text 4 Build 4113 is Out

Wednesday, July 14th, 2021

Sublime Text 2

This morning I saw a tweet that a new version of Sublime Text 4 is out - and given the few little issues I've seen, I was quick to upgrade and see what the release notes said. What I read was that there were significant speed improvements, along with improvements in the OpenGL rendering, and several fixes in the specifics of the UI rendering. There was only one Mac-specific issue, and that was related to the Dark/Light scheme, which is fine, but doesn't worry me.

When I started using it, I was pleased to see that I didn't see any of the problems I'd seen before, and the editor seemed zippy - so what's not to like? 🙂 I have a new TypeScript project I'm about to start, so we'll see how it handles that load as well.

Nice Updates to GitHub Codespaces

Friday, June 25th, 2021

GitHub Source Hosting

When last I looked at GitHub Codespaces, it had a few issues that meant I couldn't really do all the development I needed because it couldn't yet forward ports on the web-based UI. I found a way to run Postgres on a Codespace, so I'd have a built-in database, and it was persistent across restarts - which was marvelous. And I could customize the UI to be pretty much exactly what I needed to get work done.

But it was that nagging port forwarding that really meant I couldn't get real work done - not like I could on my laptop. And then I decided to give it another look... and they have not been sitting idly by. 🙂

The latest update to Codespaces has a much improved UI in the browser. It seems nearly native on my iPad Pro, and handles both the touch and trackpad gestures. Very nicely done. It also has a slight difference on the mounting of the work, so I had to update the cleanup() script in my .bashrc file:

  #
  # This is a simple function to cleanup the GitHub Codespace once it's been
  # created. Basically, I need to remove the left-overs of the dotfiles setup
  # and clean up the permissions on all the files.
  #
  function cleanup () {
    pushd $HOME
    echo "cleaning up the dotfiles..."
    rm -rf dotfiles install README.md
    echo "resetting the ownership of the /workspaces..."
    sudo chown -R drbob:drbob /workspaces
    echo "cleaning up the permissions on the /workspaces..."
    sudo chmod -R g-w /workspaces
    sudo chmod -R o-w /workspaces
    sudo setfacl -R -bn /workspaces
    echo "done"
    popd
  }

and with this, all my new Codespaces will have the right permissions, and the terminal will look and act like it should. Not too bad a change. But the real news is in the forwarded ports.

It appears that what GitHub has done is to open the port(s) on the running Docker image so that you can easily open a browser to the jetty port 8080 service that's running. It's really just as good as the port forwarding, and it completes the last needed capability to use Codespaces for real development.

If there was one more thing I'd wish for - it's that this would be included in the GitHub iPad app - so that the files are held locally, and edited locally, and the connection to the Docker instance is remote, but you can work locally.

Maybe soon. 🙂