Thursday, July 30, 2020

1st to Die - by James Patterson

“1st to Die” by James Patterson, featuring inspector Lindsay of San Francisco, first book of “Women’s Murder Club” series.


Rating: 3 stars (out of 5). I liked listening to this book as an audiobook, it was good entertainment, not terribly enriching, somehow clichéed. I see it’s got an average rating above 4, which is probably reasonably within it’s genre, and I guess if you’re into fast-paced mysteries/thrillers it will be a perfect fit. I will only give it 3 stars however, since I’m not that fond of the genre, and read it in order to ‘cross-read’ for other genres and also to read James Patterson for the first time. It was a good experience, but I will probably read a lot of other authors and books before reading another James Patterson book.


Plot: Inspector Lindsay investigates a brutal murder of a newly married couple, while juggling health and love challenges.


View point: Apart from the first-person view-point of Inspector Lindsay, we also follow other characters from a third-limited point of view. This works well, I think, as a mystifying device. 


Pros:

  • Inspector Lindsay, the main character, and first-person view-point of most chapters, has a catchy ‘voice’. She is likeable and I got emotionally attached to her, a few passages gave me misty eyes.

  • It’s a real page-turner, with a clever plot, with lots of between-chapter cliff-hangers. 

  • The short chapters, more than a hundred in total, gave it a really high pace.


Cons:

  • There were some cliches in the language of the book, particularly through adverbs and consecutive adjectives, sometimes too much telling instead of showing.

  • There’s not much of a story arc for the third-person view-point characters.

Wednesday, March 11, 2020

Reduction of coronavirus epidemic - a model

DISCLAIMER: I'm not a doctor, not a virologist, not a virus expert whatsoever. I'm just curious, and worried, and like to make models of the world.

Coronavirus (COVID-19) is here, and it is essential to slow the spread.

A very simple model, which is by no means correct, can however still illustrate the importance of reducing number of contacts in order to slow the spread of a virus.

Start input:

  • Number of people in the population (example: Denmark: 5.800.000)
  • Number of initially infected people (example: 1)
Model parameters:
  • Number of people in contact with infected person, on average (example: 5)
  • Probability of infection for a person in contact with infected person (example: 10%)
  • These values for the model parameters fits such that Denmark went from 1 infected on February 27th 2020 to around 400 infected on March 11th 2020. 
And then I created a simple Google Sheet, which calculates the new number of infected persons, one day at a time:


Explanation of the model, and the columns in the spreadsheet:
  • A: Day: The date, one day at a time
  • B: Population: The total population (constant)
  • C: Has or has had virus: People who currently have or have had the virus
  • D: Has not had virus: People who have not had the virus (D = B - C)
  • E: Has virus: I assume that the virus lives for 14 days in each infected, so it's the sum of H for the last 14 days
  • F: Number of people who is in contact with virus (F = E * Contacts per infected)
  • G: Number of people who has not had virus, and who is in contact with virus (G = F * D / B)
  • H: Gets people: Number of people who gets virus that day (H = Infection rate * G)
Very simple. And here is a chart of infected as time goes by:

It is seen that there is a peak in the number of people that has the virus at the same time.

I'm totally aware, that the model is not correct, and lacks things like not all people can get infected. However, I find the model interesting in the fact that, by changing the number of contacts per infected, I can see the impact on how many people get infected in total, and when the infections peak.


So, in this model, by reducing the average number of contacts per infection from 10 to 5, the peak date is delayed by two weeks.

The morale of this model, is just the same as the experts and politicians keep telling us:
  • We need to delay this as much as possible.
  • And we delay it by reducing contacts (low number for contacts per infected in this model).
  • And of course we need to have a good hygiene as well (low number for infection rate in this model).

Friday, February 28, 2020

Driving a car

For me, driving a car has been a learning process that has taken decades. I recently decided to seek inspiration from various articles online about what people think constitutes a good driver, and I took a few things from there, that I have practiced.


Reversing into a parking slot:

I used to drive forwards into a parking slot, and then reverse when leaving, but I read about some advantages and disadvantages, and has practiced reverse parking for some months now, making it my default mode of parking.

Advantages:

  • Safety: When I reverse into a parking slot, I reverse into a known space without any traffic. When I reverse out from a parking slot, I reverse out into an unknown space with other traffic, both cars and pedestrians. So there's less risk of accidents when reversing into a parking slot.
  • Convenience:  I now find it easier to reverse navigate into a tight parking slot than I usually did while driving forward into it.

Following the speed limit:


I have never been driving too fast, I have never received a speeding ticket. On the other hand, I have for many years strived to hold the needle of the car's speedometer right on the allowed number. However, cars are allowed to show up to 10% more than the actual speed, and most cars show at least 5% more. So I have effectively been driving 5-10% slower than the limit. This has both made me arrive later and waste some minutes every day. But it has also made my driving more dangerous, because other drivers who follow the actual speed limit, would find me very slow and maybe tend to take over, which can be risky business on smaller roads. So now I have found a simple speedometer app on my phone, which I can follow when driving. And it turns out that I can now add around 10% to my speed and still follow the speed limit.


Rehearsing catastrophe braking:

... on small roads without traffic, of course.


I believe it has improved my overall driving skills.

Learning phases

Three phases of learning:

Encoding:

  • How I understand the subject and translate it into something comprehensible for me
  • Can be enhanced by using all three major methods of learning: auditive (for example by listening to a podcast or a lecture), visual (for example by looking at a diagram, might also be through reading), and kinetic (for example by doing an exercise, writing, getting your hands into stuff)

Storage:

  • How I store the subject in my memory
  • Can be improved by various techniques, for example visualizing a house with various rooms, where I can put items to remember


Retrieval:

  • How I retrieve the subject from my memory
  • Can be practiced by thinking back after any learning experience, and trying to recall what I have actually learned
  • For example, when reading a book, after each chapter, write down the major things that I remember from that chapter

Wednesday, January 29, 2020

Mirroring

Mirroring: echoing other people's words, emotions, interpretations, intentions, or body language.

Types of mirroring:

  • Mirroring words:
    • Repeating back the last few words, or significant words, from what the other person just said.
    • Shows the other person that I listen, lets other person hear what I take from what they are saying, gives the other person the opportunity to reflect on how their own words sound, and allows the other person the chance to correct or expand on their words, if they feel that I have not understood it well enough.
  • Mirroring emotions: 
    • Internalize the emotion that I perceive from the other person, feel what it does to me, and let that guide me in my responses.
    • To supplement this, I can also put a label on the emotion, for example "It sounds like you are very upset about this". Similar to mirroring words, a label on an emotion, allows the other person to reflect and expand on it.
    • Makes it easier for me to connect with the other person, and through how I act or respond it can also shows the other person that I try to connect and understand on a deeper level than just words.
  • Mirroring interpretations:
    • This requires some more work from me: I have to reflect on how the other person sees the world operate, and try to formulate how the other person interprets the world.
    • For example, I can mirror the other person's words and feelings, and then I can say something like "when your sister says that to you, you get very upset, because you would like her to do X and when she said that you realized that she was not going to".
  • Mirroring intentions:
    • Trying to hear or anticipate the action that the other person would like to take, and simply formulate it, for example "so, you would like to call your sister".
  • Mirroring body language:
    • Show the same degree of energy, use the same kind of movements, sit in the same way. This can show the other person that I have tuned in to where they are, that I am willing to stay with them, that I am walking with them.
Some examples where I have had great success with mirroring:
  • A colleague came up to me and asked me about a problem. I repeated back, and he immediately got an idea about how to proceed.
  • My two-year old son getting to bed, he cried and called for his mother. I repeated what he said, like "mooother" and "oooh", mirroring the sounds and cries. I used labeling to say something like "you sound sad". And when he cried, I focused and listened intensely to the cry, instead of wishing it go away. This made the whole deal less stressful for me and for him, and now we have a nightly routine where there's either no crying at all or a little crying, which is mirrored by me and kind of absorbed and neutralized quickly.
Some challenges I have had with mirroring:
  • If I am too slow to formulate a mirror, especially in group settings, I end up being very passive.
  • I'm very inclined towards just mirroring words, which might be a good first step, but I believe it will be more efficient if it is quickly followed up by some of the other and deeper kinds of mirroring.

Tuesday, January 28, 2020

Multi tasking

Pattern:

  • Multi tasking

Definition:

  • Multi tasking is when one entity performs two or more tasks at the same time.

Anti-pattern:

  • Task switching, where an entity frequently changes back and forth between two or more tasks, but actually does not perform the tasks at the exact same time.

Advantages of multi tasking:

  • When done right: Getting more tasks done in the same amount of time.

Risks of multi tasking:

  • Not doing the things properly.
  • When done wrong: Getting fewer tasks done in the same amount of time, due to a drastically lower focus or concentration.
  • If not really multi tasking, but task switching instead, then the focus or concentration can also be very low.

Scenarios where I believe that I have benefited from multi tasking:

  • While walking: Listening to podcasts
  • While driving car: Doing peptalk to myself. Doing breathing exercises. Doing voice exercises. Eating an apple
  • While eating (alone): Checking emails
  • While writing or coding (alone at home): Listening to music (occasionally, for a limited period of time)
  • While watching video or movie: Practicing guitar
Scenarios where I do not enjoy or benefit from multi tasking:
  • When doing fitness
  • When running
  • When coding in my company's office

Thursday, January 23, 2020

Children tips

Some techniques that have worked well with my children:

  • Non-violent communication, mirroring and labeling: When they appear sad or angry: Mirror or label their state by saying something like "you are sad" or "you are angry" or "it sounds like you are angry" or "it looks like you are tired". Then they typically connect and might say something like "yes" or actually speak out the reason for their mood. If there's a conflict, I have had some success with NVC statements like "When your brother took your toy, you got angry, because you'd like to use it". Sometimes the tension has just disappeared by saying it. Both in them and in me.
  • Even when there's no drama, mirroring and labeling are gold, making them feel alive and heard, connecting and sharing life.
  • Games at the dinner table: In order to activate and do something fun together. It can be "guess what I'm thinking", or guessing a riddle, or telling dad jokes, or 'knock knock' jokes.
  • Doing other things while they're activating themselves. Actually getting a lot of housework done, while the children are around. And meanwhile encouraging them to play with toys, play with each other, watch a movie, read, practice, play a game, or maybe even help doing something practical.
  • Following up on a conflict or a drama, by speaking about it maybe five minutes after they (and I) have calmed down.
  • Yin: Directing any negative energy towards something creative. Instead of resisting and fighting against negative energy, then speak to or show possible creative directions. 
Some things that have not worked with my children:
  • Rewards for behaviour. Keeping track is just too tedious. And I think it teaches the wrong kind of attitude
  • Time-outs for 'bad' behavior
  • Getting angry. It just makes me feel worse, and it definitely does not solve anything

Friday, January 17, 2020

The Drive of a Lazy Developer

When I think of the term "Lazy Developer", I think of cliches such as:
  • If it ain't broke, don't fix it
  • You ain't gonna need it (YAGNI)
  • Code monkeys
And the last one, "Code monkeys", contains an important point for me, but in reverse:

A Lazy Developer is not a code monkey.

A Lazy Developer is not happy to just code.

A Lazy Developer wants to achieve something, and write as little code as possible in the process.

To a Lazy Developer, a backlog of tasks is a horrible sight. Tasks here meaning "things to do".

A backlog of ideas, however, makes more sense. Ideas here meaning "ideas of how to achieve some goal".

A Lazy Developer is driven towards achieving a goal, not towards implementing some feature.

Do business owners and product owners want to hand over a backlog of tasks, things to do, to developers?

Maybe, but they risk shooting themselves in the foot.

Especially if the developers, just do it, and don't understand the value from doing it.

If developers don't understand the value, don't understand the goal, don't share the goal, then they might not be able to make the right solution, that actually gives the desired value. Or they might not take responsibility for making the right solution, because they don't feel ownership for the goal.

Wednesday, January 8, 2020

Git vs Subversion

A version control system makes it possible to keep track of changes and go back and look at the history of changes.

It can be used for keeping track of your source code if you are a software developer.

Ten years ago Subversion was probably the most popular.

Today Git is probably the most popular, in part due to github where you can share your stuff with other people.

Here are the main differences:

Subversion:

  • Is a centralized version control system, where the repository is located on a server, and you pull down a working copy to your machine
  • All operations, like commit, branch, merge, happens on the server and require network operations
  • You have to pull the latest changes from the server before you can commit
  • The history on a given branch is linear
Git:
  • Is a distributed version control system, where the entire repository is both on the server as well as on the computers of all the users that are working on that repository
  • Many operations run locally on the computer of the user, for example commit, branch, and merge
  • You can commit locally a lot, even though other users on other computers have made commits on the same branch and pushed those commits to the server
  • The history on a given branch can become, well, branched, when multiple users are working on the same branch, or when merging changes from other branches
These differences mean that there are some benefits in using Git over Subversion:
  • Branching and merging and working on the same branch as other people is usually painless in Git, whereas simple branch and merge scenarios on Subversion could give a lot of trouble (well, even git is not idiot-proof: if you have been working on a branch for a long time without integrating your changes with other people, and if other people have made significant changes to the same files, then you might be in for a big surprise, and potentially a lot of rework, when you merge)
  • Git is just faster than Subversion (since many operations are local in Git)
  • You have the entire history locally, which can give you faster access
  • With Git you have several copies of the entire repository, making you less vulnerable to the server crashing
Here's a little example of how the history can look on a branch in git, after merging in changes from the master branch:

Monday, January 6, 2020

A personal journal and goal tracker - almost out of the iPhone box

I have created a micro journal/goal setup on my iPhone, built with stuff already on my iPhone, on my Google account, and connecting them through a site called IFTTT (If This Then That).

Here's the work flow for keeping track of different activities in my journal:
  • On my iPhone I click on a "Journal" icon on my homescreen
  • I select a topic from a list, for example "Run", add a count (for example of how many kilometers) and can also enter some notes if I like
  • Every early morning I get an email, either of celebration if I have achieved a goal, or of encouragement if I'm still not quite there


How this journal/goal setup works:
  • Go to IFTTT, sign up and create a webhook that triggers a google sheet
  • It is very well described in this article how to do that: iOS Shortcuts for Data Capture (go down to the section called "Via IFTTT")
  • So, by following that guide you'll now have a shortcut icon on your iPhone that adds a row to a Google sheet
  • To create an email notification with some stats, open that spreadsheet
  • I have named the first tab where the rows are added "Hændelser" (Danish for "events")
  • I have created a second tab called "Mål" which contains my weekly or monthly goals

  • In your spreadsheet, go to the menu bar and select Tools and then Script Editor
  • Enter the following script, which will aggregate your data and send you an email:
  • Google app script that creates status mail from journal
  • Remember to change the names of your sheets, if you have named them differently than I have
  • In the script, go to Edit and then Triggers For The Current Project
  • Add a new trigger that calls the top level function "sendGoalStatus"
  • I have set it to run every morning
Every morning when I wake up, I have a fresh status of what I've done, and how far I am towards reaching my goals.

Saturday, January 4, 2020

Rewriting git history

Git makes it possible to edit documents (typically code files) in a number of ways.

(I will use the following terminology: A git repository contains commits, where each commit contains changes to one or more documents. A commit is a container for changes, and has a unique ID and an associated commit message with a description of what/why changes were made.)

Scenarios where I modify commits, and particularly where I modify the history of commits:
  • Undo a particular commit, but leave the history of that the commit has been there and that the commit was undone later.
  • Undo a commit, and remove the history that the commit was ever there.
  • Reorder commits, in order to push selected commits to other people, but leave some commits for me to continue working on and refining.
  • Reorder commits, in order to make the sequence of commits more logical.
  • Split a commit into two or more commits.
  • Collect two or more commits into one commit.
  • Move a commit from one branch to another, if I would like to use it for coming release or on some other feature work.
  • Apply my commits on top of new commits from other people, such that I can base my commits on a version that is known to work.
  • If I started committing on top of a version that is later shown to have errors, I would like to change and instead put my commits on top of a version that I know has no errors.