Drupal 8: How to write a simple custom “block module”

In this tutorial I’ll demonstrate how to write a simple Drupal 8 “block module.” By this I mean that I’ll show you how to write a simple Drupal 8 module that will display output in a block. When you’re done you will have created a new block that you can place in one or more theme regions.

Use Case best practice: Test your Use Cases with real data

Quite often when I’m asked to review a UML “Use Case” that someone else has written, I ask “Have you tested your Use Case with real data?” Sadly, the answer is usually “no.”

I don’t know why people don’t do this, but they don’t, and it seems like a very logical thing — essentially a unit test for Use Cases.

How to use ‘awk’ to print columns from a text file (in any order)

Printing columns of information from Unix text files is easy, especially using commands like awk, perl, and more recently, ruby. This short tutorial shows my old-school awk way of doing this.

awk column printing examples

Suppose you have a file named foo with contents like this:

1 2 3
a b c

You can easily use awk to print columns of information from this file. Here are a few examples that show how to print the data columns from the file:

A problem of late

I started an “autoimmune” diet a few weeks ago, and one thing it has done is to make my problems more consistent. This is one of my current problems: at rest my blood pressure is usually low and my heart rate is often in the 95-110 beats per minute range.

The Beatles: A Day in the Life

When I was younger I didn’t really like The Beatles, though I did like individual songs by John Lennon and Paul McCartney. Lately I’ve been listening to a lot of McCartney and The Beatles, and this quote from the Wikipedia’s A Day in the Life discussion is good:

“Paul and I were definitely working together, especially on ‘A Day in the Life’ that was a real ... The way we wrote a lot of the time: you’d write the good bit, the part that was easy, ‘I read the news today’ or whatever it was, then when you got stuck or whenever it got hard, instead of carrying on, you just drop it; then we would meet each other, and I would sing half, and he would be inspired to write the next bit and vice versa. He was a bit shy about it because I think he thought it’s already a good song. Sometimes we wouldn’t let each other interfere with a song either, because you tend to be a bit lax with someone else’s stuff, you experiment a bit. So we were doing it in his room with the piano. He said ‘Should we do this?’; ‘Yeah, let’s do that.’”

(Here’s a link to A Day in the Life on YouTube.)

The misconception that yoga is about exercising the body

There was a time when I had the misconception that yoga is about exercising the body.

Then one day my wise teacher (who studied directly under Iyengar) told me, “If you aren’t paying attention to your actions, all you’re doing is stretching.”

How to use the Android 7 split screen feature (tutorial)

Android 7 comes with a cool new “split screen” feature where you can look at two apps running at the same time. This little pictorial/tutorial shows how to use this split-screen feature.

Back to top

How to use the split-screen feature

Step 1: Open two or more apps

The easiest way to get started with this feature is to have two or more apps open. You may want to open more than two apps, because some apps won’t support the split-screen feature. For instance, at the time of this writing, Kindle and Netflix don’t support it. I recommend starting a browser like Chrome, and another app like Twitter or an email app.

Tip: When you’re first getting started, open a few Google apps. They are more likely to work in split-screen mode than other apps.

Step 2: Tap the “recent apps” icon

An accidental finding about meditation and sleep

What started off as an accidental finding resulted in me performing a test on myself the last few weeks. The results are in, and I think they’re pretty conclusive: right before going to bed, if I turn off the tv (or put down the book I’m reading) and meditate for a little while, I remember my dreams more, sleep less, and wake up more refreshed.