zooming in on the mac

At my JavaOne Session on mutation testing, I needed to show both code and “other materials” to a large room on the Mac.

In Eclipse

Increasing the font size for the editor pane in Eclipse is easy. Cmd = makes the code bigger and Cmd – makes the code smaller.

Elsewhere

I also needed to show the problems view and the report. For this, I used the magnifying glass.

The initial set up was

  • Settings
  • Accessibility
  • Zoom
  • Check “Use Scroll gesture with modifier keys to zoom. I had mine set to control for the modifier, but you can change this.

Then I could zoom in on anything by holding control and moving two fingers away from me (up) on the trackpad.

To get rid of the magnifier is also easy; just hold control and two finger scroll down.

junit 5 and intellij

I use Eclipse at home for development. And mostly Maven (except for two projects that use Ant because some of the people working on them have less reliable internet connections).

After preparing to run JUnit 5 with Eclipse and Maven, I wanted to check the impact on IntelliJ. It’s been a long time since I’ve tried using IntelliJ. The internet says it supports JUnit 5 so I wanted to try it to confirm. I need to know this:

  1. So I know what IDEs people can use at my JavaOne JUnit 5 hands on lab
  2. So I know whether upgrading the CodeRanch JForum fork to JUnit 5 will be a problem for the developers using IntelliJ

Installing IntelliJ

  1. Download Mac version of free community edition from JetBrains
  2. Drag .dmg folder to Applications folder
  3. I chose not import settings. I don’t even remember the last time I ran IntelliJ on my Mac so those settings aren’t likely to be useful.
  4. After accepting the privacy policy, IntelliJ opens and I chose all the defaults.

Running the project

To run the project I migrated, I chose:

  • Check out from version control > git
  • https://github.com/boyarsky/oracle-java-cert-objectives-history.git and clone
  • IntelliJ asked if wanted to create a project based on the pom and I said yes
  • Choose command 1 for project view
  • Tried to open a Java class and got prompted to configure the SDK. I chose the latest Java 8 on my machine. No need to use Java 9 for what I’m doing. /Library/Java/JavaVirtualMachines/jdk1.8.0_xxx.jdk/Contents/Home
  • Build using build pulldown
  • Run using run pulldown

The result

IntelliJ was able to recognize the JUnit 5 annotations/methods and run them. It’s a bit ahead of Eclipse in this space so JUnit 5 won’t be a problem if they are using the latest version of IntelliJ.

recovering postgres from a time machine backup

Last night, I needed to do a full Time Machine restore on my Mac. I messed up installing things and made the problem far worse in my attempt to “fix” it. Then I tried to rollback a fraction of the disk. The laptop predicted 11 hours to rollback the files. It was easier to rollback to the state a few hours earlier. The only time I did a full Time Machine restore was when I got a new computer. That was going forward in calendar time though. This is the first time I went backwards.

For the most part, it was easy. The Mac prompted me on whether it was ok to erase the disk and restore. That took about two hours. My computer was pretty much set up on restore. It remembered lots down to my internet connection and github key. I got re-prompted from my Dropbox credentials (and for two factor.) No big deal.

Then there was Postgres. Every few seconds, I got the message “Do you want the application “postgres” to accept incoming network connections?” The message only appeared for about a second. Even if I was fast enough to click on it, it was back a few seconds later.

I tried signing the app based on some internet posts. No luck.

Temporary Relief

I got temporarily relief while I looked into the problem by blocking all connections:

  • System Preferences
  • Security & Preferences
  • Click the lock to make changes
  • My password
  • Click unlock
  • Firewall Options
  • Click “Block all incoming connections”
  • Ok

This is not helpful in the long run, but it let me look at things without going crazy.

The problem

I checked the database logs in /Library/PostgreSQL/8.4/datapg_log and found a file every few seconds with:

2016-04-25 20:39:15 EDT LOG:  database system was interrupted; last known up at 2016-04-24 09:18:51 EDT
2016-04-25 20:39:15 EDT LOG:  record with zero length at 0/5C42472C
2016-04-25 20:39:15 EDT LOG:  invalid primary checkpoint record
2016-04-25 20:39:15 EDT LOG:  record with zero length at 0/5C4246E8
2016-04-25 20:39:15 EDT LOG:  invalid secondary checkpoint record
2016-04-25 20:39:15 EDT PANIC:  could not locate a valid checkpoint record
2016-04-25 20:39:15 EDT LOG:  startup process (PID 2326) was terminated by signal 6: Abort trap
2016-04-25 20:39:15 EDT LOG:  aborting startup due to startup process failure

Ah ha! That makes perfect sense. I jumped around in time which would confuse a transaction log. Now,t hat’s something I know how to fix. I did a forced reset of the transaction log:

  1. sudo su postgres
  2. cd /Library/PostgreSQL/8.4/bin
  3. ./pg_resetxlog -f /Library/PostgreSQL/8.4/data

And all better! I turned the firewall connections back to the way they were before I started and good as new.