Morning routines

My morning routine when at home:

About half a liter of water before I do anything. That’s a start to my daily intake of 2-3 liters.

Then 2 cups of coffee in the first 45 mins. Usually fresh ground beans through a single cup dripper or French press. If I don’t have beans then Robert Timms coffee bags. Caffeine doesn’t affect me but I love the taste of those 2 cups of coffee first thing in the morning. And that’s all the coffee I have for the day.

I sit on the couch or balcony and read my email subscriptions and NYT news headlines while drinking my coffee, and while my wife gets ready for her day.This is “me” time when my mind is fresh from sleep.

The final thing I do is make the bed. This is important, not so much for the mental affect or for having achieved at least one thing in the day, as Admiral William H. McRaven says (https://www.youtube.com/watch?v=pxBQLFLei70), but because I learnt as a kid that coming back to a ruffled doona/duvet or sheets makes for a crappy sleep the next night. It doesn’t matter much nowadays as my wife loves to scrunch the covers up, but it’s nice to have flat, even covers start.

And, yes, I have achieved one thing for the day, and some days that may be all I do achieve.

 

See also, Tim Ferriss: https://www.youtube.com/watch?v=LHAyE0UC5I4

Command-line editors: there is no debate

It’s 2019.

Why the heck are we still having the vim vs emacs vs other command-line vs basic-text-editor debate for writing code?!

Don’t use either!

There are editors, IDEs and tooling today for a far superior writing, debugging and supported experience.

It is NOT “cool” or “good experience” to write in command-line editors. That’s like a modern mechanic having a Model T Ford in the workshop to use a reference for repairing a Tesla.

IT people and software developers are here to serve businesses and consumers in the best way possible, not scratch around in an old sandpit. We even have modern tools that give us a superior experience for FREE (I’m looking at you Visual Studio Code).

I certainly won’t hire someone if their tool of choice is command-line based or they use “grep” in conversation. That’s a time and financial loss waiting to happen.

Tips for non-English speaks in an English speaking professional workforce

One of the most important skills I’ve had to learn over the last 2 years as a remote manager, and now university educator, is reading poorly written communication from non-native English speakers.

I’ve adjusted because it has been necessary, but it frustrates me to no end with the amount of wasted mental energy and time it consumes in my day.

I’ve worked with plenty of people from many different countries over the last 2 decades and I’ve only experienced this problem in the last few years.

So here are 4 simple tips for non-native English speakers wanting to stand out in an English speaking workforce:

  1. Learn the fundamentals of English the language: use the correct words and phrases.
  2. Learn basic English grammar: when to use full-stops, commas, capitalisation and paragraphs.
  3. Proof read before you send.
  4. Ask yourself “have I provided all the information the recipient needs to understand what I’m saying”?

Poor written communication, especially if you have been doing it for a while without improvement, says one thing about a person: they’re lazy.

I’m not interested in working with lazy.

Safe advice for failure

Lesson:

Every single piece of advice I give is absolutely correct because I only give advice based on my actual experiences.

Yet any piece of advice I give may also not be right for you because your situation is different.

I don’t presume to think my experience fits your situation. People only truly learn from their own experience anyway.

I just hope my advice can be a guide and some small help to choose and navigate your way safely through your experiences.

Failure is good. Safe failure is what I want for you.

Interim (the correct spelling)

“Interim” is one of those words that I keep forgetting how to spell.
(https://www.dictionary.com/browse/interim)

Here are the ways you don’t spell it (I’m including this list so I can Google search my name and incorrect spelling to find this post):

intirum
interum
intrum
intrem
intram
intarum
interum

Once against, the correct spelling is

Interim

 

A Memory Mnemonic

Here’s a way I thought of to remember how to spell it:

Think “In term” but with an “i” in term.

The Cloud (is not the rose that it seems)

The Cloud doesn’t remove the need for infrastructure and operations people. Nor does it particularly make infrastructure easier.

It simply shifts where the hardware runs and who owns it.

And for small software teams it still means the developers and project manager are “the” operations and infrastructure people.

The big difference now is The Cloud makes it much easier to accidentally spend vast amounts of money on infrastructure you had no idea you deployed (or who deployed it), where you struggle to understand what it does or why you need it, and you can never seem to figure out how it is charged on your bill.

I know this because I live it.

 

(Also published on LinkedIn)

Get started with MongoDB and PHP with XAMPP on Windows

Getting started with MongoDB on Windows and developing it with PHP turned out to be quite easy.

You can create a MongoDB database “in the cloud” for free with MongoDB’s Atlas platform – https://cloud.mongodb.com. No credit card required and you’re up and running in under 10 minutes (most of that time is waiting) after filling in a simple form fill and a few button clicks.

Next you need to setup XAMPP if haven’t already. Follow my post Setting up XAMPP for WordPress Development on Windows for details on how to do that. That gives you Apache and PHP running capability.

Finally you need to install MongoDB drivers for PHP under XAMPP. I use https://www.configserverfirewall.com/mongodb/install-mongodb-php-driver-ubuntu-windows/#install-php-mongodb-driver-on-windows to figure that out. The steps are:

  1. Download the drivers for Windows from https://pecl.php.net/package/mongodb and extract the archive (select the “DLL” link for the version you want, scroll to the bottom of the next page, then download from the “DLL List” section for your version of PHP and OS architecture.
  2. Copy the extracted php_mongodb.dll file into <drive>:\xampp\php\ext folder.
  3. Open XAMPP php.ini and add the line: extension=php_mongodb.dll.
  4. Restart the Apache server in XAMPP. You’re good to go.

 

MongoDB Atlas connection string in PHP

If you run MongoDB locally you’ll have PHP code something link this to establish a connection:

<?php
$connection = new MongoDB\Driver\Manager("mongodb://localhost:27017");
var_dump($connection);
?>

If you connect Atlas use a connection string something like:

new MongoDB\Driver\Manager("mongodb+srv://<db-username>:<db-password>@azure-westus-1-fzl9p.azure.mongodb.net/test?retryWrites=true&w=majority");

Where <db-username> and <db-password> are the username and password you created in Atlas.
“azure-westus-1-fzl9p.azure.mongodb.net” is for my the specific Mongo instance – it will be different for you.

The connection string between the double-quotes is the same as was generated when you go into your collection, select the “Connect” button and follow the prompts.

JavaScript (.js) file interpreted as MIME type text/html

I had situation with a JavaScript (.js) file seeming to load OK but in reality it was a misdirect.

Using Chrome, I inspected the Network tab in Developer Tools and couldn’t see an error with the file load. But on closer inspection, I noticed the Status was a “302” and the Type was “text/html” as follows (I was expecting a “200” Status and “script” mime Type).

It was luck that I found the answer:

I was loading the JavaScript file using the path “/inc/assets/js/vueks/vue-2.6.10.js”.

But I had a spelling mistake in the path. It should have been: “/inc/assets/js/vuejs/vue-2.6.10.js”.

I changed “vueks” to “vuejs” and the script loaded successfully.

 

The strange thing is the incorrect path didn’t give me a “404” (Not Found) response. Instead I received a “302 Found”, where clearly the file was not found.

My guess is I was loading it in a WordPress site, and while the file was not found I do have code internally to redirect to a “/not-found” page that may have returned some form of response (even though it contained no content). That or some headers were returned which confused Chrome.

(I haven’t tried to replicate this other browsers yet.)