COVID-19 Numbers in Canada

I was looking at the number of active COVID cases in Canada when it struck me that because our population density really is all over the place a simple breakdown of cases per province/territory is just not telling the whole picture. So I just threw together a spreadsheet and settled for a “cases per 100k population” figure to get a better basis for comparison.

The number of cases is taken from this tally, and the population numbers from here.

Here are the results:

Provincepopulationcasescases per 100k
ontario1467790013959.50
quebec84945008039.45
bc510350079115.50
alberta4472800117326.23
manitoba138190049836.04
saskatchewan119510036230.29
nova scotia96710090.93
new brunswick77560081.03
newfoundland522300397.47
pei15740000.00
nwt4500000.00
yukon4130087210.65
nunavut3930000.00

You can draw your own conclusions from that.

Life Lessons

When you face a life-changing decision and think “what’s the worst that could happen”, it’s very important to actually answer the question before going ahead with the thing.

Of fractures, splints and other unpleasantness

My fractured hand

Unless you live with me, work with me or have me as a friend on Facebook you won’t know that I have accidentally fractured a bone in my right hand (as opposed to *intentionally* breaking it I guess).

I knew it was serious pretty much right away but hoped it was just a sprain, but as my hand kept swelling more and more it was quickly obvious that something more serious had happened. I went to the hospital, got an x-ray, and was told I needed a splint. I’ve had a splint to heal a pinky finger before, it was just a metal bar with foam on one side. I wasn’t so lucky this time and this splint was made of a large, heavy piece of plaster covering the outside of my right hand.

Now, I am right-handed. VERY right-handed. I could probably lose my left hand and not have to adjust my life much. I have NO fine motor skills in my left. In fact I remember from my early 20s incidents where I went to a book shop, selected a book, picked it up with my left hand, then realized that I had grabbed the book next to the one I wanted. So, this past 10-11 days have been a real pain in the ass. For those of you who have never temporarily lost the use of your dominant hand, here are a few things this affects:

  1. Writing. I have tried to write with my left. It just doesn’t work. At all. In a pinch, if my signature is required, I can manage to grab a pen with my right thumb and index finger and sign by moving my whole arm, since my wrist is immobilized. Anything more than that and it looks like I fell asleep in the middle of writing a word. It’s completely ridiculous.
  2. Typing. My left hand can carry on typing, but the best I can do with the right is to bend my middle finger down and type with that. This works and is not too uncomfortable, but my typing accuracy has gone to sh*t and I have to look at the keyboard all the time.
  3. Eating. I look like someone who’s never handled utensils before, or perhaps have some sort of tremor issue, but if I take my time I manage, as long as I don’t have to cut anything.
  4. Cooking. Oh boy. I always handle knives with my right hand, so that’s not going so well. My brain knows how I should hold a knife, but that knowledge fades sharply as the command gets to my left arm.
  5. Driving. Good thing I don’t still have my manual transmission A4. Driving an automatic is at least straightforward. Getting into and out of the car is a little arduous.
  6. Hygiene. That one’s tricky. Because I have this plaster splint I can’t just jump into the shower carelessly, I must wear a plastic bag , but that’s not so bad. I can take the splint off for short periods too but it’s a pain getting everything back on so I try not to do it. The more difficult aspect, and no one talks about this because it’s not a comfortable thing to talk about, is that wiping is surprisingly arduous. After all I’ve been doing it for what, 45 years the same way, but suddenly I have to re-develop the skill with a hand that’s extremely *gauche*. It takes a long time everytime, and if you combine this with my mild claustrophobia it usually means that I come out of the washrooms sweaty and somewhat flustered. That’s definitely something that gets taken for granted in normal life.

This is all good and fine, but by far the aspect of life most affected by this is my mood. People think that having this fracture hurts physically, but that’s very minor and more discomfort (from being immobilized) than pain really. Along with the cast it feels like I’m carrying a dark cloud over my head all the time.

It all comes down to having to live the life of a 48 year old, father to two including a rambunctious four-year-old, with a shocking lack of fine motor skills.

While I can still do pretty much everything that was a normal part of my life a mere two weeks ago, it’s like someone’s turned up the difficulty level on every single task. And while the difficuty itself is not insurmountable, but every little thing takes a little toll on my state of mind. I end up at the end of every day frustrated, bitter and angry. My ongoing depression isn’t making things any easier either.

So, what’s the point of all this besides venting? It reminds me of how important it is to be patient with people, because inevitably you have no idea what’s really going on in their lives besides the obvious. All you really know is your own situation, and oftentimes you’re not even fully aware of that. Stop judging and cut others some slack. Someday you’ll realize how much you need that yourself.

The power of a song

You know how sometimes you’re just going about your day in an oddly light-hearted way, and then something innocuous happens that puts you down in the dumps in a way you just can’t shake off?

So this morning I’m driving along to work and things are going fairly well. There have been no irritating slowdowns, and I was just about to turn into work when *that song* came on. It was No Doubt’s It’s My Life. Not the worst song in the world or the best, it was the kind of cover I often feel uneasy about because it’s so close to the Talk Talk original that it seems a bit pointless, a bit like Weezer’s Africa.

In a heartbeat I was taken back to the first time I heard that song. Let me take you on that little journey. Well ok, not so little, in fact this is probably the longest post on this site, but whatever.

The year was 2004, late June. 15 years ago although it feels like a lifetime. I lived in Hoboken NJ at the time. It was league pool night in the square mile (Hoboken is a small place) and my team was having a home match at The Quiet Woman. As I had walked into the bar that night it was obvious that most of the team were ill at ease greeting me. We were mostly a coworkers team, and 6 hours earlier I had gotten fired.

[Rewind noise]

Yes, fired. The saga had started about 3 weeks earlier on a Friday afternoon around 5. I loved those Fridays – me and a bunch of guys from the office would get together downstairs at Dorrian’s and get tipsy, then head over to a bar in Hoboken, typically Mulligan’s Pub. Beer would flow freely and it was generally a great start to the weekend.

I don’t know why I felt like I was in a hurry to get to the pub that day. I’ve replayed that day’s events over and over in my head a million times and there’s no reason besides my eagerness to get drunk with my work buddies like on any other Friday. I had been working on this piece of Javascript (I was a web developer at that place), something stupidly minor. When I checked the code into our SCCS the diff looked wrong, but I decided to ignore it.

Little did I know that this little screw-up would basically tear apart the life I had become accustomed to over the previous 5 years. Even now I feel enraged at myself for it. I don’t think I will ever forgive myself for that day.

What happened was that I had been working on an old, outdated version of the file, so when the new build was tested the UI was broken. I tried to fix it as soon as I was made aware, but the series of events I had set into motion ended up snowballing — for a highly embellished version of the story read this post on The Daily WTF which is loosely based on the story I myself submitted to Alex — and on that aforementioned Wednesday at noon my supervisor took me into a side office and informed me that I now had, er, unlimited vacation and no pay.

So, six hours later, we’re at The Quiet Woman having a drink. At that point I was still experiencing the other-worldliness and “lightness” you feel when the ground has completely disappeared from under your feet. It was the last league night for the season. We played our matches — I don’t have any recollection of them really — then we stuck around and had a few drinks while exploring the jukebox. We were losing two of our team members, man and wife — I so wish I could remember their names now but it’s been many years, and many rough years at that — because she was soon starting a new job in California.

That’s when that song came on. My brain, desperate to find something to occupy it instead of keeping on reminding me of how badly I had fucked myself over, just latched onto it, but I was drunk and 80s music had not yet made a big comeback so I couldn’t replace it. Only when I got home and looked it up on Google was I able to trace back the original, and the lady who was off to California IM’d me the name of the original artist within 5 minutes of that.

The next day I opted to walk around Manhattan. I spent part of the afternoon in Bryant Park, listening to the mp3 of the song over and over again, trying to read but making no progress. 4 weeks later I was moving back to Montreal because $1800 US/month in rent was just too much.

All this was going through my head this morning as I drove onto my current company’s lot and parked my car for the day. It instantly reminded me of how much I have fucked things up for myself, not just that one time, but so many times. It reawakened the bitterness and self-loathing I had put aside and yet so richly deserve. Since that time I have not had a job that paid so well as that, nor has my social life ever recovered from that loss.

And it’s all down to me.

A Technical Writing Tip

As a technical writer myself I’m often in a situation where I need to take a Word document and turn it into a Framemaker or XML-DITA package.

This is not usually a huge problem, except when there are a lot of images in the document (screencaps mostly). You see, Word incorporates images by copying them right into the document (embedding); with Framemaker it’s preferable to simply link the image as you would on a web page, and with XML-DITA linking is the only way to include images. If you simply import a Word document into a Framemaker document the images become embedded, but then you are limited as to how you can interact with those images. Scaling, particularly, does not seem to be supported for embedded images.

So you’ll want to get the images out of the Word doc and into separate image files. One way you can do this is to go through the original file, and every time you see an image right-click on it, then save the image file. This can be really time-consuming (and boring).

There is, of course, a better way.

This is not common knowledge but Word files are made up of several different, smaller files compressed together using the ubiquitous .zip format. So the trick to getting all the images at once is simply to unzip the Word document.

Here’s how to do this:

  1. Find your Word document in the windows explorer and change its extension from .doc (or .docx) to .zip.
  2. Extract the files to a new folder.
  3. Open the folder and navigate to the word\media subdirectory, then open it.

You should see all the document’s images there. They will have generic names which is semantically not the best, but on the plus side it’s then easy to figure out the order in which the images should be shown.

Consensus

At its core the blockchain is about several actors reaching consensus on what a valid block is. Each blockchain must choose its way of deciding exactly how that consensus is reached, and who can contribute to the search.

One of the better statements about the blockchain — and the Bitcoin blockchain in particular — that I have seen, and I wish I remembered when I read it, was something like this:

People think that the blockchain is all about solving incredibly difficult and complex equations, but the reality is that it’s like millions of computer shouting numbers across the internet until most of them reply “I agree”.

This sums up what happens with the consensus algorithm known as “proof-of-work” or POW. This is how the Bitcoin blockchain operates, and why you may read articles warning that it’s a huge waste of energy. With Bitcoin every miner is trying to come up with a single solution in the quickest time possible. If there are a million miners (an admittedly high estimate) then one may say that 999999 of these miners are wasting energy because only one will be the first to reach the correct answer. 

Of course that’s an absurd oversimplification. All the other miners on the network are also verifying the one correct solution that has been found, and are an essential part of the process. The more miners are online, the quicker the solution can be verified, accepted as correct by 50% + 1 of the miners, and appended to the chain. And the more miners there are the more remote the possibility that a brute force attack (the 51% attack) can even be attempted, let alone succeed.

A What Attack?

The 51% attack is the most elementary attack on a proof-of-work (POW)  blockchain network. If the consensus is 50%+1, then you can simply throw more miners on the network until you control 50%+1 of the global hashrate, and then you could rig the whole operation to enrich yourself by cheating, double-spending tokens, or making the network useless. 

With today’s cloud infrastructure it’s easier than ever to create hundreds or thousands of virtual machines in a very short amount of time, so this is not just a theoretical threat. It’s the most common mode of attack on smaller POW blockchains.

When it comes to these attacks, greater network size provides more protection. There’s very little risk of someone coming along and suddenly generating more hashrate than the rest of the bitcoin network. That hashrate, FYI, is currently hovering around the 50 million terahash per second. A terahash is one trillion of hashes per second, or (if my math isn’t completely off) roughly 5 quintillion hashes per second.

That being said, POW is a first-generation blockchain consensus strategy.  Newer blockchains can use a number of different strategies to establish consensus.

Cryptocurrency as a Reward for Mining

At the core of the idea of cryptocurrency is the idea of reward for work. 

For example, miners in Bitcoin all try to solve the same problem at once because whatever miner discovers the solution first wins a block reward. That reward is a number of Bitcoins. Initially 50 BTC were awarded, then it became 25 BTC, and now that number has been halved again to 12.5 BTC.  That is a substantial reward, even at this time. All the other miners get nothing. 

Proof-of-Stake

A proof-of-stake strategy operates with different assumptions. Instead of miners, the network is run by people who have previously invested in the network by acquiring its cryptocurrency. The idea there is that you need to have “skin in the game” to share in the rewards. For the blockchains that implement this, there is no block reward. Instead, fees are paid on the transactions on the network which is then distributed to the nodes that have registered a stake. To register a stake it must be placed in some kind of escrow.

With the POS strategy nodes that have a stake collect, package and encrypt transaction data and push it to the blockchain. Any actor’s participation is equal to the actor’s stake divided by the total number of staked tokens.

Delegated Proof-of-Stake

The delegated POS strategy takes that concept to the next level. In this system the stake-holders (stake-hodlers?) elect a certain number of their own to be witnesses. This is typically a low, odd number to avoid possible deadlock. 21 is generally considered to be a good number of witness nodes. 

Witness nodes are the only nodes that perform work (bundling and encrypting transactions) under this arrangement. Instead of earning a reward, witnesses are paid to ensure that their nodes perform the work.

These are the “big three” strategies at this time. There are other, less currently popular but not necessarily less valid strategies, like mandating that any one node on the network can only do work at certain time intervals, or where a number of nodes are chosen by lottery to perform work, and many more. The implementation details of each strategy can be wildly different.

The uptake on this is that while cryptocurrency saw the day thanks to proof-of-work blockchains, today the landscape offers many other possibilities which can be much more efficient than Bitcoin (which remains the gold standard). Less actors needed for consensus means less energy spent reaching that consensus, and also a much lower level of latency which allows for greater transaction throughput. 

To bring Bitcoin up again here, few people know that it’s a fairly slow network that has a typical ability to process maybe 5 transactions per second. Compare this to the Visa payment network, which can handle over 24000 transactions per second, and it becomes clear that if crypto is ever to see wide adoption as a means of transaction competing with Visa and other payment networks it needs to be a lot quicker.

And that’s today’s lesson.

What is a blockchain?

2018 is poised to be year when cryptocurrencies become mainstream. The original cryptocurrency, Bitcoin, has entered the common jargon of the modern world last year as its valuation hit record a record high of nearly 20k USD/BTC, and stayed in the news as its valuation dropped to more reasonable levels. Ethereum is also gaining recognition as it became the #2 cryptocurrency in terms of market capitalization. In short, a little over 8 years since the creation of Bitcoin cryptocurrencies are gaining recognition and acceptance in the “real” world.

Cryptocurrencies are created as part of something called a blockchain. And more than cryptocurrencies, it is the blockchain idea which is expected to have a huge impact on the computing world, at least for the next couple of years. As such it is a good idea to learn what a blockchain is, at both a basic and more advanced level.

The Basics

At its core, a blockchain is a distributed ledger. Those with an accounting background will immediately recognize what a ledger is — it is a record of transactions. A blockchain is distributed, which means that entries in the ledger are written by many parties, as opposed to by one centralized authority.

Like an ordinary paper ledger, blockchains are write-once. Once a block has been verified and added to the blockchain it cannot be erased or modified. This insures that transactions cannot be taken back.

The Nodes

All these “parties” are actually computers running a node for the blockchain’s network on the internet. This involves executing software which contributes to the blockchain network. Depending on the network involved there may be several types of nodes in a blockchain; this will be explored in depth later.

The Blocks

Nodes compile a number of transactions into a block. How large the blocks are, and how often they are verified, varies widely between blockchains. For example, the Bitcoin blockchain generates a block every 10 minutes. The Ethereum blockchain, in comparison, generates a block in less than 20 seconds, and Bitshares blocks are generated every 3 seconds at most. A number of factors affect block time; if you’re not intimidated by math check out this article for more information.

The Chain

Blockchains are so named because each new block is appended to the previous block, effectively forming a chain. In fact one can always look at certain information in the latest block of any given blockchain and trace the blockchain’s history all the way back to its very first block.

Hashing

Since blocks are appended to the blockchain by several different nodes, there needs to be a way to ensure that only the block with the right data can be added at any given time. Otherwise there would be no way of ensuring the continuity of the blockchain from the genesis block to the most current one.

This is where hashing comes in. Hashing is a cryptographical technique that is used to generate a unique code that can be used to identify a set of data, rather like a fingerprint. The hash is generated from the transactions contained in the block and recorded as data in the block, which also includes the hash from the previous block. This is one of the mechanisms used to verify any new blocks. If the previous-block hash does not match the previous block’s recorded hash, then the current block is invalid and cannot be added to the chain.

The actual library used to generate the hashes depends on the blockchain. SHA256 is a popular one and is used by Bitcoin. Other libraries include scrypt, X11, Cryptonight and ETHash.

Hashing produces a completely different string if there is any change whatsoever to the original hashed content. The SHA256 library can produce a very large number of distinct values (3.4028237e+38) so arriving at the same value from two different pieces of content is extremely unlikely. By comparison, the chances of winning the Powerball lottery in the USA is 1 in 2.92e8. One could win this lottery 4 times and that would still be less likely than generating the same hash from 2 different sources. Thus the use of hash values makes blockchains virtually tamper-proof.

This was a very basic overview of blockchains. We’ve barely scratched the surface. In my next few articles I will be providing more in-depth coverage on subjects such as concensus algorithms, blockchain node types, the relationship between blockchains and cryptocurrencies, and how the blockchain can be used by businesses to streamline processes and reduce processing costs.

For audiophiles only

Ever wondered what it’s like to put a pair of $55,000 headphones on and listening to your favorite tracks? This guy has experienced the Sennheiser Orpheus.

Gender bias?

An interesting article in the New Yorker raises the question: do gender stereotypes let some murderers get away with their crime(s)?

The best of Marty Feldman

Marty Feldman was not as well-known in North America as he was in the UK, and many here may think that his bulging eyes made him a bit of a one-trick comic but he was a comedy genius.

YouTube player