Matt Brown content for you

How to run Java Mission Control and Eclipse Memory Analyzer on MacOS Catalina

I am not sure if it is MacOS or the state of the Java development tool ecosystem, but it seems to get harder and harder over time to use some common tools.

I had to bang my head a bit to get both Eclipse Memory Analyzer and Java Mission Control to actually run recently, so I wanted to write down the steps to easily remember them in the future. Hopefully this helps someone else too.

Eclipse Memory Analyzer

Downloading Eclipse Memory Analyzer from the official page gives you a mat.app (after unzipping) which won’t open on Catalina:

Screenshot

You have to remove the com.apple.quarantine attribute with:

xattr -r -d com.apple.quarantine ~/Downloads/mat.app/

After this when launching the app, you might get “Failed to create the Java Virtual Machine”:

Screenshot

In Finder, right-click on mat.app and select Show Package contents, and edit the Contents/Eclipse/MemoryAnalyzer.ini file. Add the path to your java binary by adding

-vm
<path to java>

Each argument (-vm, and the path to `java) have to be on their own line.

It is important to note that this has to be at the start of the file, adding these options instead to the end of the file seems to cause them to be ignored.

This should allow you to launch the application, but you may need to add an additional argument to Contents/Eclipse/MemoryAnalyzer.ini to tell Eclipse which workspace to use…

-data
<path to a directory to use as workspace>

… even though Eclipse Memory Analyzer doesn’t seem to put any files there.

I didn’t personally have this problem, but some questions on Stack Overflow about running EMA on MacOS mention needing to move the .app to the /Applications directory.

Java Mission Control

JMC is a mess since Java 8 and since Oracle open sourced it.

If you happen to visit https://openjdk.java.net/projects/jmc/, the project home page tells you that version 7 is in development without any download link. You have to know to visit https://jdk.java.net/jmc/ to actually find a download link for version 7 (which is now generally available).

After downloading the .tar.gz and decompressing it, simply double-clicking on the JDK Mission Control.app will give you the same

“JDK Mission Control” can’t be opened because Apple cannot check it for malicious software.

error, although this time right-clicking on the app and selecting Open seems to get pass the quarantine problem.

Next, you may get the same Failed to create Java Virtual Machine error from JMC:

Screenshot

The solution is to launch the jmc binary bundled in the .app package from the command-line so you can pass a -vm flag to your java binary, for example:

~/Downloads/jmc-7.0.1+01_osx-x64_bin/JDK\ Mission\ Control.app/Contents/MacOS/jmc \
-vm /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/bin/java

Migrating Spotify's backend to Kubernetes

A few months back I was interviewed on Google’s “Stack Chat” YouTube channel about migrating Spotify’s backend to Kubernetes.

Personalization at Spotify using Cassandra

I cowrote a blog article about things my team at Spotify has been working on the past few months, primarily focused on how we use Cassandra.

How to type the ⌘ (Command) key in OS X Mountain Lion

This was harder than I expected it to be:

  1. Press ⌘ ⌥ T to bring up the Character Viewer.
  2. Click the gear menu (⚙) to bring up options and choose “Customize List…”
  3. Under Symbols, check the box next to Technical Symbols
  4. The command symbol (⌘) should be the first in the list.

From here you can drag and drop the ⌘ to whatever text editor you want - although a keystroke to type it would be far easier rather than opening Character Viewer each time.

Screenshot

Is there an easier way to do this?

Update: Yes, there is.

Crazy git error message of the day

$ git submodule add https://github.com/derekwyatt/vim-scala.git .vim/bundle/vim-scala
fatal: You are on a branch yet to be born

Stackoverflow has a solution for this problem.

Graphing CPU temperature in OS X with Munin

Last week I made a plugin for Munin to collect the temperature of my Macbook’s CPU, hard drive, and GPU, for no real reason other than I thought it would be need to see how they change over time, and because graphs are irresistible.

Screenshot

The plugin is on github. It requires a free app called Temperature Monitor to be installed so the temperature values can be collected in a script (I could not find any way built into OS X to collect the data from the command-line, like you would read /proc on Linux).

How to get iCal to recognize recurring events in iCalendar (ics) files

Here is the solution to a problem I recently debugged which I had a very hard time finding any information on via Google. Hopefully this helps someone else in the future.

When programatically generating iCalendar (.ics) files, iCal on OS X (at least on my Snow Leopard version, 4.0.4) seems to refuse to recognize that the event is recurring if the VEVENT contains a RECURRENCE-ID element.

For an event that should repeat on the first Thursday of the month, iCal would only add the first event if the ICS file looked like this:

BEGIN:VEVENT
DTSTAMP:20120425T210028Z
DTSTART;TZID=America/New_York:20120503T180000
DTEND;TZID=America/New_York:20120503T190000
SUMMARY:This event should repeat on first Thursday of the month
RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=4;BYDAY=1TH
RECURRENCE-ID;TZID=America/New_York:20120503T180000

However, remove the RECURRENCE-ID element and iCal recognizes that this is a recurring event just fine - it adds events on the first Thursday of the month for four months:

BEGIN:VEVENT
DTSTAMP:20120425T210028Z
DTSTART;TZID=America/New_York:20120503T180000
DTEND;TZID=America/New_York:20120503T190000
SUMMARY:This event should repeat on first Thursday of the month
RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=4;BYDAY=1TH

Outlook 2011 and Google Calendar recognize the first example as hoped for (shows an event that repeats on first Thursday of the month four times). It’s not clear to me from the RFC which behavior is correct - the meaning of RECURRENCE-ID seems confusing.

Cool Mac trick of the day

Highlight a word in almost any app, press Cmd + Ctrl +D, instant dictionary lookup.

Screenshot

Email Privacy Tool

Cool tool that I found today, which tests how much of your privacy your email client leaks when it displays an email (by displaying remote images or other content). Some quick results of different email clients:

  • iPhone 4 iOS 5.1 native mail app, remote images enabled (by default): leaks 17 out of 32 categories
  • iPhone 4 iOS 5.1 native mail app with remote images disabled: leaks 0 out of 32 categories (the winner)
  • Outlook for Mac 2011, remote images disabled: leaks 2 out of 32 categories (audio and video)
  • Mac’s built-in Mail.app v4.5, remote images disabled: leaks 14 out of 32 categories

Required Code Reviews

Ben Kamens posted today about changing his opinion on required code reviews from the negative to the positive after a change in policy at Khan Academy.

Having moved within a company from a team that had nothing close to approaching a code review policy, to a team that almost-religiously does code reviews on changes regardless of size (with one caveat, it’s not required for someone to “OK” each review/change), I can safely say that having a code review process is a huge bellwether of the overall quality of a software team.

I would never want to work with a team in the future that didn’t already do code reviews. It makes such a huge difference in the quality of the code produced, the level of understanding of each person on the team as to how things actually work, and education among people on the team in all sorts of ways (on best practices, tips and tricks, cultural things the team prefers, etc). It doesn’t slow you down, or increase the amount of process - it just makes sense.

As a developer, looking at code all day is what you should be doing in the first place anyway.

Khan Academy’s official policy on code reviews is a good read too.