Upgrading Postgres 11.1 to 12.1 Using Homebrew

February 4th, 2020

PostgreSQL.jpg

It's time to make sure that my laptop has the latest version of PostgreSQL, as I was reading that Heroku was moving to Postgres 12 as their default database. And since I don't do it that often, I decided to write it all down so that it's easier to do next time.

The process isn't bad... dump all the databases into one file, stop the server, update Homebrew, update postgres. This gets us to the point that we are ready to rebuild the new database:

  $ pg_dumpall > dump.sql
  $ brew services stop postgresql
  $ brew update
  $ brew upgrade postgres

Now we need to move out the old database data, create a new structure, and restart the service:

  $ cd /usr/local/var
  $ mv postgres postgres.old
  $ initdb -D /usr/local/var/postgres
  $ brew services start postgresql

You then need to go back to the directory of the first command - the one where you dumped the databases, and reload them all:

  $ psql -d postgres -f dump.sql

and at this point, everything should be back and running:

  $ psql --version
  psql (PostgreSQL) 12.1
  $ psql -l
                                      List of databases
      Name     | Owner | Encoding  |    Collate     |     Ctype      |  Access privileges
  -------------+-------+-----------+----------------+----------------+---------------------
   health      | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII |
   inventory   | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII |
   northhollow | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII |
   postgres    | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII |
   template0   | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII | =c/drbob           +
               |       |           |                |                | drbob=CTc/drbob
   template1   | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII | drbob=CTc/drbob    +
               |       |           |                |                | =c/drbob           +
               |       |           |                |                | _postgres=CTc/drbob+
               |       |           |                |                | postgres=CTc/drbob
   test        | drbob | SQL_ASCII | en_US.US-ASCII | en_US.US-ASCII |
  (7 rows)

At this point you can remove the old data:

  $ rm -rf /usr/local/var/postgres.old
  $ rm dump.sql

and everything is updated. You can then use any of the normal tools, including the Apache/PHP/Postgres that Apple makes available, and Postico - a great GUI client.

UPDATE: a friend asked: "What's in 12?" and I had to say I really didn't know... so I looked it up. The big changes are all about under-the-hood performance, and so, as I suspected, it just "works better". Which is really the goal, right? 🙂

I know I will probably enjoy the JIT on by default, as there are plenty of times stored procedures are in my databases, and that makes them faster, which is always nice. But it's just a great database - getting greater.

Trying out a new Editor Font

January 21st, 2020

GeneralDev.jpg

A few days ago, I read about the new JetBrains Mono font that they had created for their IDEs, and it looks interesting with the increased hight of the lower-case letters, and the easily readable "1lI" combination... so I decided to give it a whirl on my editor, and in Xcode.

I have to say I like how Sublime Text and Xcode handles all the weights of the font, and the ligatures for common expressions makes it a lot easier to read the code - as if I'd written it on a chalkboard. Very nice indeed

JetBrains Mono for Clojure

I'm not sure how it'll play out, but it's pretty nice so far, and I'll play with it for a bit and see what I think. So far... nice. 🙂

Heading out to Seattle for Work

January 12th, 2020

cubeLifeView.gif

I'm all packed up and ready to head to O'Hare for my flight to Seattle. The Shop is having some off-site meetings, so I'm going to fly out today, have two full days of meetings and activities, and then a day there to visit with the teams in Seattle that I typically only get to see on Hangouts, and then fly back on Thursday. It's not bad at all... but the flight will be long, and I'll need to find my happy place and just relax for the 4+ hrs in the small seat.

For this trip, I put all my IMAP email accounts on my iPad so that I could take it with me for notes and essential emails, and it's not a lot more to carry in my bag. Yeah, I'll have to take it out at the security checkpoint, but that's worth it to be able to take everything it holds with me. I really think it'll work out well.

I've plotted the route to the O'Hare economy lot into my car, and should be able to just get things loaded up, and on the road. Just need to stay calm for the flight... 🙂

Finished Advent of Code 2019

January 7th, 2020

Christmas Tree

This morning I finally finished Advent of Code 2019. Most days weren't too bad - I think the ones that really caused me to work extra were Day 18 and Day 20 - both of which were the pathing problems that I had failed to really master in years past. Good or bad, I decided not to give up on these, and figured out how to solve these this year.

Dijkstra's Algorithm is interesting, but I really didn't see how to implement it in Clojure until I was walking home one day - and it hit me: the recursion really made it all so much easier. And that really helped me as I hammered on these problems this year to really get a solid understanding of how to work with Dijkstra's. I'm very glad I stuck with this.

Then when I had that understood, I ran into Day 20 where it wasn't the right approach, but I needed to understand a simple Breadth-First Search on the maze. This is much different than Dijkstra's in that it's a simple looping construct, and only finds the one shortest path - but that's OK... that's all that was asked for. But it's fast. Very.

I'm really glad that this year I didn't stop when the problems seemed to be too tough for me. I'm a better coder because of the new knowledge. 🙂

Welcome to the New Year!

January 1st, 2020

Path

Well... another year has arrived, and interestingly enough, I was awake when it arrived in Naperville. Not that I had stayed awake, but that I woke up in the night and saw the time, and then heard to festivities outside. It made me smile.

Tomorrow starts another year at The Shop, and there's plenty that's going on there, and I'm sure there will be lots and lots of things that will occupy my time. There's a big engineering meeting in Seattle in a week or so, and that will travel which isn't as bad as it used to be, but it's being away from home, and I do enjoy home.

I do hope that this year is a little more peaceful...

Happy Birthday to Me

December 31st, 2019

Cake.jpg

Another trip around the sun, and my birthday has arrived. I don't imagine I'll be doing anything all the special today... probably just watching the last three Mission Impossible movies - so good... and just staying home.

There is a little snow on the ground, and it's chilly, so the crazy 50s weather seems to have moved on, for now, and it's back to more normal December weather becore the cold stuff really arrives. Oh... it's coming, it's always coming...

No big plans for this year... just want a little peace. 🙂

Advent of Code Day 25 Adventure Map

December 25th, 2019

Christmas Tree

Today, the first part of Advent of Code was to run an Intcode program, and move a droid around the inside of Santa's ship. It was really just an Adventure Game, and after exploring the game, you needed to pick up certain items, and then bring them to the pressure plate to make sure you "pass", and get through to see Santa.

I remember doing something like this with the original Zork, on the machines back at Purdue in the early 1980s... and so I was used to the idea of making a map as I explored:

AoC Day 25 Adventure Map

Once I picked up all the things I could pick up - and there were plenty that I couldn't, I took them all to the room, and dropped what I couldn't carry. That was a lot easier than changing up the path each time to pick up only what I needed.

Now I need to go back and solve three more days to get all the stars... it's going to be challenging... but I've got a little time. 🙂

An Interesting Christmas Break

December 23rd, 2019

Path

It's been a very interesting Christmas Break - as I use up my use-it-or-loose-it vacation time at The Shop, and still... I attend the meetings on Hangouts, and I do what I can to help those that are working during the break... but it's been an interesting time - no doubt about it.

I've watched some interesting TV... I really enjoyed the first season of The Morning Show - but then I really don't like bullies... and I've really enjoyed watching the last three Mission: Impossible movies... and it's been fun to do as much Advent of Code as I can.

There are certainly problems I don't understand the background for, and while I could learn it - I'm not going to learn it now, in 20 min, for a single problem. That's not going to last. But I can come back to it any day, and dig deeper into things like inverse modulo... and some serious computational search space pruning... but in all, it's been fun.

Christmas in a few days, and then a week and it's back to The Shop and the New Year. Lots of changes ahead... lots of things to think about in the next week.

Advent of Code is Back

December 1st, 2019

Christmas Tree

Just finished the Day 1 puzzle to Advent of Code for 2019. And as expected, it was funny, and fun to do. I've been playing with the LeetCode examples - just to stay sharp, and one of the things that Advent of Code provides that LeetCode doesn't is the data files. Sure, I get it... they test after you write the code, but if, like me, you don't choose one of their languages, then you're really out of luck.

Still... I'll keep doing these as long as the authors make them, because they are fun and keep my mind sharp. I am very grateful for these folks... 🙂

UPDATE: some days are going well - others are computationally very hard, and I clearly need to figure out how to solve those. I won't get them all in the first go, but I'll keep at it... 🙂

Fantastic Lighthearted Javascript Graphing Package

November 18th, 2019

Javascript

This morning I was reading the newsfeeds, and came across probably my favorite Javascript graphing package: Chart.xkcd. The idea is that it can be used to create those seemingly hand-drawn charts the the xkcd comic so often generates as part of their work. But this is easily put into React and other web frameworks, and put on web pages for that casual look that brings a completely different feel to the data being presented.

From the simple docs on the web page, it seems pretty straight-forward... you have to set up all the data for the graph, and then it just renders it. There are some nice mouse-over features as you dig a little deeper, but it's the casual nature of the presentation that really appeals to me:

Example of Chart

I don't have a project yet that's in need of this, but I can feel that there will be something coming soon that could really use this less-serious approach to data presentation. After all, not everything is a publication-ready presentation.