Matthew Lindfield Seager

Enjoyed another Aussie crime novel by Chris Hammer: The Tilt 📚🎧

Well written as always and liked the way he introduced a new main character by crossing over with some supporting ones from the previous books.

Thoroughly enjoyed reading The Last Devil to Die by Richard Osman 📚

Finished Silver by Chris Hammer 🎙️📚

I’m enjoying listening to audio books while working on the house and grateful for our local library making the service available.

Finished reading: Scrublands by Chris Hammer 📚🎧

Changing the starting ID in a Rails app

While procrastinating working on a new Rails app, I didn’t want object IDs to start at 1 but neither did I want to deal with the various hassles of using a UUID instead of an integer for the ID. My compromise was to start the ID numbering with a multiple digit number.

This requires adding an execute statement (which is technically non-reversible) to your create_table migration:

class CreateUsers < ActiveRecord::Migration[7.1]
  def change
    create_table :users do |t|
      t.string :name, null: false
      t.string :email, null: false

      t.timestamps
    end

    reversible do |direction|
      direction.up do
        # Set the starting ID on the users table so IDs don't start at 1
        execute <<-SQL
          INSERT INTO sqlite_sequence ('name', 'seq') VALUES('users', 2345);
        SQL
      end

      direction.down do
        # Do nothing (entry is automatically removed when table is dropped)
      end
    end
  end
end

Note: The relevant sequence row gets dropped when the table gets dropped, so in this case there’s no need to define a down action. I’ve included an empty one anyway to make it clear this isn’t an oversight.

Now when I create my first user, their ID is 1 higher than the sequence I assigned… app.example.com/users/2346.

You can choose whatever starting number you want. If you’re running this on a different table, replace the ‘users’ portion with your own table name:

INSERT INTO sqlite_sequence ('name', 'seq') VALUES('<table>', 1734);

The above example is specific to SQLite (I’m using Litestack to simplify deployment) but presumably you could do something very similar with other databases.

I haven’t tested this but for PostgreSQL it should be as simple as changing the execute command above to:

SELECT setval('users_id_seq', 2345);
--            '<table>_id_seq' for other table names

If you try this with PostgreSQL, make you sure test the migration works in both directions.

Couldn’t figure out why ruby debug was crashing on one machine but another “identical” machine was fine. I was about to redact my username from the crash reports when I started to wonder about its length.

Sure enough, a username longer than 20 characters triggers the bug 🐛

Can sleep easy now 😝

The Voice

Australia will vote tomorrow on a modest proposal to give Aboriginal and Torres Strait Islander peoples a voice to the parliament and the executive “on matters relating to Aboriginal and Torres Strait Islander peoples”. Unfortunately, it looks like the No campaign has sown enough fear, uncertainty and doubt to prevent us from taking this small step forward as a federation.

Australia has a long and dark history when it comes to our treatment of our First Peoples. It wasn’t until 1967 that they were included in the census and it was just 40 short years ago, in 1983, that our First Peoples finally received equal voting rights and responsibilities, after more than 80 long years of being denied a fair go and pushed to the margins. The No campaign say that this proposed change introduces race into the constitution, while conveniently ignoring the fact that racial prejudice has been baked into our constitution and our culture from the very beginning.

Our First People’s have spent years gathering consensus on a reasonable path forward towards reform that might go some way towards a more just and equitable future after centuries of injustice. They are asking for voice, treaty and truth and more than 80% of First Nations people support the change we are voting on (according to the only large-scale, representative survey that has been published).

Tomorrow we have a chance to vote yes and do what Proverbs 31:8 says:

Speak out on behalf of the voiceless, and for the rights of all who are vulnerable.

In 1903, a member of the first Australian National Parliament stated that “it is impossible for the average aboriginal to understand any political question, or to vote with intelligence”. If the No vote succeeds tomorrow, I fear it will be because, 120 years later, that sentiment carries the day amongst a majority of Australians.

I’m enjoying the conversation, talks, food and location of RubyConf Thailand. Rubyists may even recognise a certain someone who gave the keynote talk, 30 years of Ruby History 🤩

Love that the organisers leaned into the “competition” with Rails World 😉

#rubyconfth

It’s not much to look at but I’m very glad for this little national treasure park just 5km from where we are living.

Final day (day 30) of #mbsept

(Is it cheating to use a collage?)

Collage of 3 photos of the tracks, pond and picnic shelters in our local national park

There’s a bit of a contrast between the undeveloped parts of our suburb and the new estates popping up

Day 29 of #mbsept

A small rural-looking road lined by trees leading up to a new(ish) housing estate

Combining a workout with a commute

Day 28 of #mbsept

Cyclists riding along the bike path towards Redfern station

This little guy just wants an embrace.

Day 27 of #mbsept

A small plush toy Dumbo sitting on a pillow

I love it when people build useful, thoughtful and bookmarkable tools like this highly configurable countdown timer. I was looking for a timer that would continue into the negatives; this one does that and so much more.

Don’t be put off by the plain appearance of the configuration page.

Treated myself to my beverage of choice in honour of today’s prompt.

Day 26 of #mbsept

A half-finished bottle of Coca Cola in front of a lawn and a hedge

Today’s prompt is flare, suggested by me. I suggested it because it has multiple meanings and I thought I might be able to take a creative shot but this is the best I could manage today.

Day 25 of #mbsept

The sun shining through the leaves of a native Australian tree above a terrace house in Redfern

Belt drive for the alternator (I think 😉) in our 2009 Hyundai Tucson.

This is the first time I’ve had a phone with more than one lens so I had some fun experimenting with different angles and zooms.

Day 24 of #mbsept

Internal shot of car engine compartment with tubes, pulleys and two belts

A Day/Date in the Life of Micro.blog:

Just finished at my local Parkrun. Pretty happy with a sub-24 time on a hilly course.

Day 23 of #mbsept

A selfie of me (41 year old male with a goatee wearing black running clothes and a white running cap) standing in front of Parkrun banners and other parkrun participants and volunteers

This new road near me seems to be nearing completion, although there’s still a lot of work to be done connecting it to the intersection.

(Took this photo before I saw today’s prompt 🙂)

Day 22 of #mbsept

A photo of an under-construction road, seen through the wires of a temporary fence

Fall, water, fall. (Can you tell I really struggled for inspiration today!? 😉 This was my backup photo in case I couldn’t think of anything else 🤷‍♂️)

Day 21 of #mbsept

Water falling from a shower head

A minor disruption

Day 20 of #mbsept

A line of orange road barriers used to set aside a construction area that is normally available for parking

Starting with the edge.

Day 19 of #mbsept

A jigsaw puzzle in the early stages of being solved, with all the edge pieces in but little else

Woollen moquette fabric on my Waratah commuter train.

Day 18 of #mbsept

Fabric train seat cover in a mottled design mixing 4 shades of blue and some yellow, partially in shadow, partially in bright sun.

Intense Sunday afternoon run. Pace was slow but my heart rate was right up there!

Day 17 of #mbsept

Action photo of my Apple Watch during a run showing a heart rate of 174bpm

Oof! Sun is beating down! 33°C (91°F) is pretty unpleasant weather for spectating the netball grand finals! Even more unpleasant for the players though!

Day 16 of #mbsept

A cloudless blue sky with the hot sun framed through a netball ring.

Red: A red book I have not yet read

Day 15 of #mbsept

A red book (The Five Dysfunctions of a Team) on my desk with two strips of sunlight either side of it