Fixing Sublime Text 3 Clojure Markdown Blocks

November 21st, 2018

Sublime Text 2

Today I was looking for a solution to a problem I saw in the syntax highlighting of Sublime Text 3's Markdown files when there were Clojure code blocks in the file. All the other coding blocks I had been using were highlighting with a different background, and the text in the block was highlighted according to that language's rules. But not so with Clojure.

So I asked on the Sublime Text Forums about the issue and to my amazement, I got a response! The response was clear about what I needed to do, and while there was a slight issue with the installation of a package, I solved that with a git clone in the directory, and I was in business.

At the time, I also submitted an issue with the Sublime Text GitHub group, and let them know I was having a problem. Very much like the issue on the Forum post. When I got an answer on the Forums, I updated the GitHub issue, and included the answer I got from the Forum guy. He didn't sound like he was tied into the GitHub group.

Mistake #1.

I then got a response on the Issue kinda poking me to make a PR because I have an answer that worked for me. And me, trying to be helpful to the folks that helped me, wanted to respond. It was just the tone of the request that was a little off. I should have listened to that voice.

Mistake #2.

So I made the Pull Request on the project and put in the comments, etc. and submitted it. At this point, I really want to thank GitHub for making a tool that has the most amazing workflow I've ever used. The ability to fork, and make a PR on a GitHub repo, and have the fork linked to the PR so that updating one updates the other is just amazing. I know it's not impossible - but it is very nice, and that's so nice to see.

The PR, as you can see, is really a very specific YAML file section, and there were, of course, no comments in it. I had no idea that the elements have changed, so when the reviewer chastised me for not looking at the rest of the file, and detecting the changes, I got a little prickly. But I said to myself "Take it easy... this is a simple mistake", and I apologized on the PR, and made the changes.

At the same time, the guy who helped me on the Forum chimed in and threw me under the bus - saying "Yeah, he didn't do the right thing - I gave him something that worked on the release version, but not master". I love it when people do this. It's such a comforting thought to be in an industry of people with such high integrity.

So that was fixed, and I thought "OK... enough of this, moving on..."

Mistake #3.

I then got a note saying that I hadn't read the rules of PR submissions, and that I needed to write rendering tests for this new code block. And believe me, these are not easy, and they are not trivial, and all this for something I should have just said "Sorry, I'm too busy, you can do the PR on your own."

But I read up on the tests. How to write them - and they are stupid. But I did it. And then I wrote the rendering tests and added those to the PR. And they all passed. Which was nice. So now I'm thinking "OK... this is finally over." But when will I learn?

Then a maintainer comes along and says this will have to be put on hold because they don't understand something about what's happening in the code, and that is causing an issue that is unrelated to the PR, but the PR would make things worse, or something.

So... I try to be a nice guy after someone has been nice to me... you know... passing it on... and for that, I get to deal with the Slashdot Kids living in their parent's basement and holding some power trip over poor saps like me that try to help folks out.

But I have a fix. I know what to do for subsequent releases, and I'll never do this again with these folks. Lesson learned.

It’s Christmas Music Season!

November 20th, 2018

Christmas Tree

I was walking to work from the train this morning, and heard a Christmas song in the Grand Hall at Union Station, and it got me to humming Christmas Songs on the walk into work. Now it's full-tilt Christmas Songs while I work. Good stuff!

It's just one of the wonderful ways of noticing the passage of time. Songs I haven't heard in nearly a year, and always remind me of the very best of what we can all be.

Published Cap’n Hook to Clojars

November 19th, 2018

Cap'n Hook

This morning, I wanted to get the first version of Cap'n Hook published on Clojars, but I needed to get a few things cleaned up. First, I needed to get the latest changes to durable-queue up to Clojars, as there were some dependencies I need to clear up - most notably in the nippy and byte-streams packages, so that was fixed up and a simple publish, and I'm up on Clojars.

At this point, I'm a little surprised that I have to type in my GPG passphrase each time I sign the jar for publishing. I can see the logic that I've read online - basically, signing is a fairly infrequent task, and needs to be done with care, so ask for the passphrase on those occasions. OK... I get it, but I'd still like to have it in my Keychain, and then just lock it up there. No need to keep typing it in.

I need to pay closer attention to the passphrase dialog on the next publish, and see if I can't get it to save the passphrase in the Keychain. But it's not horrible at this time - I don't publish all that often.

After I got durable-queue up, I could then clean up the capn-hook code a little and then publish it. Again, not bad - cleared out a few dependencies to streamline things just a touch, and then update the README.md for the folks coming to the GitHub page, and away it goes.

Not a bad morning - got a little more familiar with GPG, and published a few things. Good enough.

Shopping on Jet

November 15th, 2018

Jet

Today I was looking for my favorite mustard - French's Plain Yellow Spicy Mustard - online because I really do like it, and my local Jewel stores have stopped selling it. I'm not a fan of Amazon's treatment of it's employees, so I have not really become an Amazon shopper. Sure, I've bought a few things in the past, but it's not a company I want to support - but I don't judge people that use it all the time, because this is my choice, and not theirs.

So I found that Jet has my mustard, and I was quite excited. It wasn't Amazon, and the web site looked nice, and it seemed like a decent place. So I ordered the mustard, and downloaded the iPhone app, and felt pretty good about myself.

And then a friend told me that Walmart owned Jet.

Shucks.

I'm not a fan of Walmart, either. But I guess in the grand scheme of things, I can tolerate Walmart a little more than Amazon, and so I'll keep my order for the mustard. But I sure wish there were a way to support a non-mega-company, and get the few things I'd like to have. I was happy with Jewel, but they stopped carrying it. So I have to deal with one of these mega-corporations. And if that's the choice I have, I'll stick with Jet because they were once an independent company, and Walmart is a little less distasteful than Amazon.

But I wish there were another option.

First Cut of Cap’n Hook

November 14th, 2018

Cap'n Hook

This morning I've finally put the docs and a few tests on my Clojure library called Cap'n Hook - after the cereal, and the fact that it's all about making web hooks easier to implement in services. When I was looking for my current position, I was thinking what could I write that would be fun and useful at the same time. One of the things that I knew were really useful were the web hooks that allowed one-way, asynchronous, message passing from a service to a set of registered clients.

While it's not really a good replacement for a real messaging system like any of the messaging offerings from AWS, or Tibco, or even Java MQ - it is very easy to implement, and if you're in the world of RESTful services, it's a really handy thing to have, as it's super simple to implement.

Also, if you put in retries, as I have, then it's pretty close to reliable - but only if your receiver is online and taking POST messages on that URL. Sure... it's not perfect, but for dealing with simple messaging between data centers, it's hard to beat. There are a ton of services (GitHub, etc.) that are using this to fire-off events on the client-side of things.

So it's pretty simple to use - the key is that for most cases, you are going to need to have some persistent set of registered URLs, These are the "endpoints" for the HTTP POST calls that this library will be sending in response to the main application saying "Here you go!".

I was a little blocked for several months on this - because I wanted to be able to implement a shared, persistent, reliable storage for the registrations - and then yesterday I realized that was just a bad idea. Each application that uses this will want to implement their own registration their way - and while I implemented a simplified registration that wasn't shared or persistent, the ideas are there, and it's easy to slot in a different registration scheme at any time.

I can see using redis to store the URLs - it has all the primitives to do what's needed. And there's Postgres - or any database, really, and I even cover that in one of the examples in the README.md on the GitHub repo. So there's no need to really solve the registration problem for everyone. Just give the users a simple one to get going, and then they can get as fancy as they need to.

I spent a little time on writing some unit tests, but it's going to be hard to really test the sending as it really needs to hit something, but I'll spend a little time today seeing if there isn't an "echo" test site out there for just this kind of testing, and then I can test sending the POST messages to see if they work.

But it's been a lot of fun to get this done and into testing... The documentation was great fun, and it just was a great little thing to finish.

iTerm2 is Quite Impressive

November 13th, 2018

iTerm2

I've been using iTerm2 since it was forked from the original, as there were things in Terminal.app that I just didn't like at the time: forced scroll bars, difficult selection of words... lots of little usability and chrome things. Now it's true that since then, Terminal.app has gotten a lot better - and on each new macOS upgrade, I always give it a try for a little bit... just to make sure it's still not the tool I'd like to use. But for quite a while, it's been iTerm2.

So why write about it now? Well... with version 3.2, they have used Metal to make the text rendering amazingly fast and the scrolling super smooth. This makes the overall appearance a real treat. Just amazing, really.

Now I'm going to see what the status is for BBEdit and Sublime Text 3 - because this kind of scrolling and updating is really quite impressive!

UPDATE: Sublime Text 3 seems to be using the GPU for rendering! Great! No need to worry about that. I know that there are new MacBook Pros coming out this month with the new GPUs, and now may be the right time to look at upgrading!

The 2018 Mid-Term Elections

November 7th, 2018

PotUS.jpg

Well... I woke up this morning, looked at Twitter, and saw that Beto had won in Texas, and that made me very happy. I also saw that several of the younger, more liberal, candidates also won. And in Illinois, it was called a "Big Blue Wave" - which made me very happy.

Sadly, when I got to work, I re-checked on the Texas Senate race, and Beto lost. And that really made me sad. But in the end, the Democrats took the House, and that's hopefully enough to stop the insanity that Trump and the GOP have been doing.

Once again, John Oliver had a story on the family separation, and the cycle of hate that seems to be so easy for some to buy into. Immigrants aren't evil. They are people. The ability for so many to see other people as less than a person is really making me uncomfortable about the country.

This is a phase - like Germany in the 30's and while some will say that's an unfair comparison, but I submit it's all too similar. Nationalism, tariffs, hate... they all come from a very dark place, and we can't give into those feelings.

I have hopes that 2020 will be an amazing Presidential Election. Maybe Beto will run. That would be neat.

Running Clojure in CodeRunner

November 7th, 2018

Clojure.jpg

This morning, I really wanted to see if I could get Clojure running in CodeRunner. It's a pretty nice lightweight development environment which is really targeted at scripting or prototyping ideas. The docs say it can do a full IDE for web development, and that's certainly possible - but I'm not sure that I'd use it for that, as there are likely far more dependencies - like the RESTful service, that need to be included, and that's just too much.

While CodeRunner has a lot of language support built-in, it doesn't handle Clojure, and that's the one language that I really wish they would have. So much so that I emailed the author to ask about adding it. When I didn't get a response, I decided to see if I couldn't do it on my own.

Turns out, it's not that hard.

Start by having Leiningen installed, and that you can get from Homebrew - which is a good idea to have installed on a Mac anyway. Assuming you have Homebrew installed, you simply need to say:

  $ brew install leiningen

and it'll be downloaded and ready to go.

Then you can look at the lein-exec GitHub page for the rest of the instructions as to how to get it going. You need to update your ~/.lein/profiles.clj file to include:

  {:user {:plugins [[lein-exec "0.3.7"]]}}

and then in your ~/bin directory, or really any place in your PATH you need to create the following two files - copied from the GitHub repo. First is lein-exec containing:

  #!/bin/bash
 
  if [[ $1 =~ ^[~\/] ]]
  then
    # its already an absolute path
    lein exec "$@"
  else
    # This is a relative path, so make it absolute,
    # using the current directory as the base.
    lein exec "`pwd`/$@"
  fi

and the second is lein-exec-p, which contains:

  #!/bin/bash
 
  if [[ $1 =~ ^[~\/] ]]
  then
    # its already an absolute path
    lein exec -p "$@"
  else
    # This is a relative path, so make it absolute,
    # using the current directory as the base.
    lein exec -p "`pwd`/$@"
  fi

At this point, you can make a script that looks like:

  #!/bin/bash lein-exec

  (prn (* 4 6))

and when you run it, you will get 24 on the console. Not bad.

In order to get this running in CodeRunner, we need to add a new language to the preferences. I chose to duplicate Perl as that's very close to what I needed. I changed the settings to look like:

Settings for Clojure

and the Templates I deleted, and the Docs I added the Dash docs, as I have that installed on my mac, and it is very good:

Docs for Clojure

Once I had that, I could create a script and run it:

CodeRunner and Clojure

While not perfect, it's exactly what I wanted to be able to do, and it does it perfectly.

Flickr is Changing the Free Service

November 5th, 2018

flickr.jpg

This morning I read that as of February 2019, Flickr's free service will not be 1TB of storage, as it has been - but only 1000 images. The change, they say, is focused to make it more in line with photographers:

First, and most crucially, the free terabyte largely attracted members who were drawn by the free storage, not by engagement with other lovers of photography. This caused a significant tonal shift in our platform, away from the community interaction and exploration of shared interests that makes Flickr the best shared home for photographers in the world. We know those of you who value a vibrant community didn’t like this shift, and with this change we’re re-committing Flickr to focus on fostering this interaction.

Now as someone who uses Flickr for both pictures and for blog posts with screen shots, I can understand that storage isn't free, and 1TB per free user is probably a cost the new company couldn't bear - and they knew it from Day 1. This is how they get back in the black.

The only alternative is Pro, at $49.99/yr and that's unlimited storage. So there's not going to be a low-cost version where the old 1TB limit would be. Nope. It's go big - or not. Maybe 1000 photos is enough, but I'd really like it if we could use iCloud storage to vend pictures out of, but I know why that's not possible. So we'll have to see how things pan out,

It's not like I can't figure something else out for my blog.

Finished an Online Course

November 5th, 2018

cubeLifeView.gif

This is interesting... I just finished an online course about Data Science, covered by The Shop, in an effort to be able to reach across the divide that currently exists between the science group and the engineering group. It doesn't need to exist, but it's there, and I was hoping that by taking this course, I'd be seen as trying to reach out. Maybe help things a little.

The class was meant to be 5 weeks, and from the sound of it, it was going to be mentored by some folks here in the science group. Again, sounds like just what I want - bonding experiences in class, and all that. Good. But when I signed up for the class, it was clear that it was offered from a larger institution and it wasn't really mentored by folks here - as much as we would have 1 hr meetings each week about the content of the course for that week.

So not at all what I was hoping for. But I couldn't really get upset about the course - it was exactly what it said it was, I had just assumed facts without checking them first. That's all on me.

The course was focused on understanding the basics of Data Science work, installing and running R and RStudio. Working with Git and GitHub, and a few shell commands. Not bad - given that each week of work was about 25-30 mins of videos to watch. That's not a lot if you want to teach someone shell commands. So it's not bad.

But it got me thinking about a real Data Science class for The Shop. These developers all understand math, calculus, all that... and they know the tools... so what about really teaching them something? That would be something to sit in on. So I sent it to my group just as a "This would be nice..." thought.

I guess this will be my first grade after my PhD, which is in a way, very funny to me, but it's done, and now it's time to see what'ss next.