Sleep Lessons Learned

Image by Noah Mugan

Insomniatic Cat, by Noah Mugan

When it comes to falling sleep, we’ve all seen the advice about not drinking caffeine after noon and not having screen time an hour before bed. In this post, I wanted to share four principles that I’ve discovered over the years that have helped me to be a little less insomniatic. Maybe they can help you.

Principle 1: Falling asleep isn’t like waiting on a train. I used to think that when you tried to go to sleep, you just waited for sleep to come, and it didn’t matter what you thought about while you were waiting. But after about 35 years (I’m a slow learner), I realized that some of my thought patterns can actively keep me awake. While I can’t always control what I think, I can run a little less enthusiastically down certain rabbit holes.

Principle 2: Trying to be comfortable is more conducive to sleep than trying to sleep. Falling asleep is stressful. Instead, I just try to be comfortable lying in bed, in the dark, with my eyes closed.

Principle 3: Being one step away reduces pressure. Another trick I use to reduce the pressure is to start my night one step away from how I sleep. I like to sleep with three pillows, but I find that if I start out with just one, it isn’t like I’m trying to fall asleep. Instead, it is more like I’m implementing Principle 2. Then, once I get comfortable, I grab the next two pillows. Similarly, one could start out with a light on or music playing.

Principle 4: Tossing and turning is surprisingly restful. This principle is the most important. I used to become stressed out when I couldn’t sleep because I kept worrying about how tired I was going to be the next day. At some point, I noticed that as long as I stay in bed and keep my eyes closed, I don’t feel terrible the next day. It must be that some amount of useful rest is happening while I toss and turn. This realization prevents me from spending anxious nights checking the clock every 40 minutes.

Thinking about sleep isn’t always helpful for sleeping. For instance, I’ve learned that I’m starting to fall asleep when I see random images and think nonsensical thoughts. Unfortunately, recognizing those nonsensical images and thoughts immediately wakes me up. On the other hand, I love how these thoughts seem to tie into the subconscious, random chaotic firings and patterns in my brain. I can almost hear phrases from the day and see the kinds of information my brain is trying to process and assimilate. But it’s like seeing a distant star; I can’t look directly at it and instead have to look just next to it. Otherwise, I become too conscious, and I’m back at Principle 1.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

Finding a way to win

We sacrifice truth for coherence, and our desire for an orderly world causes us to overlook the importance of luck. Our brain looks for patterns, even when there are none, and so we make up explanations for random events. For example, I love it when sports announcers proclaim that some teams just “find a way to win.”

Imagine a tournament like the “March Madness” college basketball tournament that begins with 64 teams. Our tournament is unique in that each team is represented as a coin. When two coins “play” each other, they are flipped together until one coin comes up heads and the other tails, and the coin that comes up heads wins. After the first round, there would be 32 teams left, then 16, then 4, then 2, and finally a winner.

The winner!

The winner!

Sports announcers watching this tournament would certainly declare that the winning coin, a plucky 1946 nickle, just knows how to fight through adversity and “finds a way to win.”

That nickel really came to play. I give credit to the coaching.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

The Dude Abides: Id, Ego, and Superego

A guy I work with hasn’t seen The Big Lebowski, which is like living in Plato’s Cave, as far as culture goes. The Big Lebowski is a profanity-laden epic poem that becomes a part of you and changes as you change. I identified with The Dude when I was young and my id was in control–the world took itself too seriously. But now that I’m older, my superego has taken over and I’ve become Walter, the tightly wound Vietnam veteran. I may not have seen my buddies die face down in the muck, but I now understand what it’s like to have a history and a strong sense of how things should be, and his outbursts are my outbursts. In a few years, my ego will hopefully learn to balance these competing forces, and I’ll be the cowboy at the bar, indifferently watching and telling the story.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

We have a long way to go

My daughter, age 2, throws out numbers without understanding their domains. If you ask her what time it is, she says it is “49”. Overhearing her mother adding up how much money was owed for a transaction, she began to imitate. She says, “9, 10, 11, 4 dollars.” She doesn’t understand how it all fits together yet, but she is working through concepts that will eventually form her adult understanding. This is the kind of learning we are working toward emulating in the field of Artificial Intelligence. We have a long way to go.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

How to teach your child math using programming (even if you don’t know how)

There are many educational apps, but the power of these apps to teach is limited by the imagination of the designer. A theme of The Curiosity Cycle is that learning should be driven by the imagination and creativity of the child. Programming is an ideal way to do this. Many parents may be drawn to using apps for education because they themselves don’t know how to program or how to use programming as a teaching tool. This blog post will show you how to do both using a free, interactive, and light-weight programming language called Python.

We will focus on using programming to teach math.  In the modern world, math is implemented in programming, much like how hydrogen and oxygen implement the phenomenon of water. This embodiment of math in programming enables your child to poke and prod math like it is a living thing, allowing learning to happen through experimentation.

Your child can also use programming to build a math toolkit that will be useful  later. This toolkit can be used to check homework and do class projects. When your child learns a new algorithm in school, such as long division, he or she can program the algorithm in Python and use it to check intermediate computations. Having access to this toolkit and the ability to expand it will foster a habit of computational thinking. Your child can grow to be like a digital sorcerer casting spells and learning new ones.

Installing and Running Python

To install Python, go to and pick the link that corresponds to your computer. I use Python 2.7.7.

For a 32-bit Windows machine:
For a 64-bit Windows machine (most common):
For for Mac OS X 10.6 and later:
For Mac OS X 10.3 through 10.6:

You may have to set the path so Windows knows where to find Python.

Windows 7 and Vista
1. Start -> Computer
2. System properties from the menu up top.
3. Advanced system properties from the menu on the left.
4. Advanced tab -> Environment Variables button on the bottom
5. Under system variables choose “Path”

Windows XP
1. Start -> Control Panel -> System
2. Advanced tab -> Environment Variables button on the bottom
3. Under system variables choose “Path”

Then add “C:Python27″ to that path. Note that there are no spaces, and each entry is separated with a semicolon.

To use Python in Windows, click on the Start (Windows) button and type “cmd” into the little run/search box. When the command prompt comes up, type “python.” You will now be in the Python interpreter and can just start typing commands. (For a Mac, you similarly need to bring up a terminal window.)

If you followed my blog post here and installed Ubuntu, you already have Python installed. Just hit Cntl+Alt+t to bring up a terminal and type ‘python’.

Programming with your child

The interactive nature of Python is a big part of how we can use programming as a teaching tool. It makes it possible to turn learning into a game.  You can play “stump the kid.” You type in a command, and your child tries to guess what the computer will say. Then your child can take a turn at stumping you. To make it even more fun, you can hook up a laptop to a TV and see the action on the big screen.

Basic arithmetic

You can practice basic arithmetic with your child by just typing in math.

Fractions and decimals

When you try division, you may notice an odd thing. 5 / 2 = 2. That’s because Python thinks you want an integer answer (silly). You have to type “from __future__ import division”.

You can show for common fractions that you get decimals. You can quiz your child on what the decimal value will be.

Please Excuse My Dear Aunt Sally

One area where the implementation of math in programming may produce a fun surprise for your child is in the order of operations. When I was in 7th grade, I learned the phrase, “Please Excuse My Dear Aunt Sally.” This phrase was a mnemonic to help us remember what was evaluated first in a math expression: parenthesis, exponents, multiplication, division, addition, and subtraction. In reality, multiplication and division are done left to right (neither has precedence over the other), and addition and subtraction are also done left to right.

You can see this in action. If your child has not studied order of operations yet, he or she will likely say that the answer to 3 + 4  * 2 is 14. Python and Aunt Sally agree that it is 11.

Introducing variables

You can introduce variables, which gets your child started toward algebra.  In Python, a single equal sign ‘=’ is used for an assignment of a value to a variable; a double equal sign ‘==’ is an operator that checks if the two values are the same, as we will see in the next section. Note that your child may get confused between strings and variables. A string, such as ‘dog’, is in quotation marks.

Conditionals and logic

You can use the ‘if’ statement for conditional execution. If a command goes more than one line, just hit return to continue typing. Then, to evaluate, hit return twice.

You can also test for inequality, as shown below.

Now that we are using more syntax, it is a good time to point out that a tutorial of syntax can be found at

Errors and flapdoodle

My kids love when the computer says something crazy like when you divide 1 by 0.

You can also use a variable before it has been defined to get some more gobbledegook as output.

These kinds of nonsensical responses may lead your child to the wow-computers-are-stupid stage of learning programming. In this first stage of programming, the  literal mindedness of computers can be a significant obstacle.

The bad news is that you have to tell computers everything you want them to do in excruciating detail, but the good news is that you only have to tell them once.

Modules and functions

You can store your commands in a file so you don’t have to type the same things over and over again. You can also define functions to put in this file. In Python, this file is called a module, and it will end with the suffix “.py”. We will assume that your module is called

You can create with a text editor, such as Notepad, and save it in the directory where you run Python. (It doesn’t have to be in that directory, but having it there saves us from having to tell Python where it is.)

When you start Python, you can then type “from mymodule import *” at the command prompt.

Here’s an example of a function in python:

Note the indentation. Python uses indentation (a convention is to use 4 spaces) to determine the nesting of statements.

Every time you change, you will need to quit Python (do this by hitting Ctrl-z) and reload it using “from mymodule import *”.

To avoid having to type “from mymodule import *” each time you start Python, you can create another file, we’ll call it, that only contains “from mymodule import *”. And then you can set a special environment variable to run that startup module each time Python is loaded. To do this, set the environment variable PYTHONSTARTUP to point to your startup file (instructions for Windows are given below).

Windows 7 and Vista
1. Start -> Computer
2. System properties from the menu up top.
3. Advanced system properties from the menu on the left.
4. Advanced tab -> Environment Variables button on the bottom
5. Under system variables click “New”

Windows XP
1. Start -> Control Panel -> System
2. Advanced tab -> Environment Variables button on the bottom
3. Under system variables click “New”

Coming in Future posts

In future posts, I will discuss more about functions. We will also talk about loops so your child can multiply a number by 10 until it is so big it covers the whole screen. From there, we can introduce all kinds of concepts
such as factoring, identifying prime numbers, finding the greatest common denominator, and sorting.

We will also look at recursive functions (functions that call themselves) such as the one below.

If you have any trouble getting set up, feel free to contact me at

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

The right way to save money on customer service

Corporations work hard to minimize the costs of providing customer service. Often, their solution is to make it painful and frustrating to call them on the telephone. A great example of this approach comes from Bank of America.

Looking at my account online last night, I noticed a strange $100 debit with the description: 487092258003054 RCK EE ADJUSTMENT.Image

A Google search didn’t turn up much, but there were some vague indications that it might be related to an Eastern European pornography organization. I hate using the phone, so I tried their online chat help. After explaining the situation, the “online banking professional” provided the customer service number so I could call the bank. Thanks.

Calling the bank resulted in my first definitive defeat by a phone menu. Normally, I can find the right option to get to a representative, or dial 0, or something. But this time, I was clearly up against a superior foe. There was no way to get to a human. I tried all promising paths; I yelled and cursed, and nothing worked. Finally, satisfied that it had trampled me into submission, the menu said that a representative would be with me in 14 minutes.

The representative was very nice when she came on the line. I explained the situation and she put me on hold several times while she tried to figure out what it was. Finally, she said that the computers were down and connected me with her supervisor. Her supervisor was also very nice, and she was also stumped. She said she could see that the system had “generated a letter” about the debit to be sent to my house. A letter? That’s right. The plan was to mark patterns of symbols on a piece of dead tree and then to have someone carry that object across the country to my house. She couldn’t see what was on the letter, but after putting me on hold a few more times, she figured it out. My wife had written a check a while back for $350, and Bank of America had only deducted $250 from our account. The debit was to correct that mistake.

Not only had Bank of America stolen an hour of my life, they had to pay humans to talk with me for a good part of that hour. And based on the accents, those humans were making US wages. Instead of cutting costs by making it hard to get representatives on the phone, a better solution for companies would be design their products so that we don’t have to call them. This means both not making mistakes and making sure that communications with customers are clear.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

Higher taxes on the rich: a first step toward a post-capitalistic society

We are currently debating how much we should tax the rich. As automation increasingly replaces tasks once done by human workers, the owners of companies seem to be getting a bigger share of society’s resources. This trend of jobs being lost to automation may ultimately result in there not being enough workers left with money to buy the things that companies produce, and we may have to move to a post-capitalistic society. Before we get there, we will likely find ourselves in a transition period where the rich increasingly subsidize those who can no longer find adequate employment.

When much of human labor becomes unnecessary, how can we smoothly transition to a system where everyone can still contribute and maintain their entrepreneurial spirit? I imagine that we will move to a kind of hybrid system between capitalism and everyone being children of the state. Each person could get a sufficient allotment to survive and buy entertainment. If you wanted to go beyond your allotment by, say, making a movie or becoming a business owner and employing robots, you could potentially earn more, but you would have to pay significant taxes. The problem with this kind of system is that those being subsidized may no longer feel like they have a place in society, as we have seen with the periodic riots of the disaffected in France. How do we keep the social fabric from breaking down?


You can also check out: [new jobs pay low wages] [new jobs pay low wages] [income inequality] [income inequality] [automation replacing jobs] [periodic riots in France]

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

Computers all the way down: a free virtual machine for your child

The Curiosity Cycle emphasizes that tool use develops the mind. Tools are even better when they are your own. In this blog post, I’ll explain how to create a computer within a computer for your child.


This computer within a computer is called a virtual machine. Your real computer simulates every action of the virtual machine, so it appears just like the computer you normally run. Well, actually, the virtual machine described in this blog post will be different from your normal computer if that computer is a PC or Mac. This virtual computer will run an operating system called Ubuntu.

Ubuntu is free and open source. Open source means that you can look at the programming code for how it works. You can’t do this with Windows. With Windows, even forensic investigators have to guess at how the system works. Using Ubuntu is analogous to having an old car where you can look under the hood and see the moving parts.

Your child will love having a computer of his or her own. My oldest son really likes that his little brother can’t use his computer, and both he and his brother love customizing the look of their screens and setting their bookmarks. In addition, restricting your kids’ internet searches for ninja Pokemon badger-cats to be within the virtual machine helps to protect your main computer from rootkits and other malware.

Installing the computer within a computer takes three steps. These steps take some time, but the installation is like making a cake from a box–you can go off and do other things while you are waiting for it to bake. Note that for the virtual machine to be zippy and responsive, you need a fairly new computer (any computer purchased within the last two years or so should be fine).

Step 1: download and install the free VMware player from
(you may have to restart your computer, ugh).

Step 2: download the free Ubuntu operating system from
(this make take a while).

Step 3: follow the instructions at
You are pretty much done once you get to  “Installing VMware tools” because you can just follow the onscreen prompt to install VMware tools for Linux (Ubuntu is a flavor of Linux). At some point, VMware will ask you about an update to the paid VMware workstation; you can click “skip this update” or “skip this version.”

ImageOnce the install process is done, you are ready to go. You will probably need to install Adobe Flash at some point. Luckily, Ubuntu has a built-in app store called the Ubuntu Software Center, which has a version of Flash. You can go to the Software Center by clicking on it on the side, and then you search for flashplugin-installer.

You can also use this app store to install free games. My kids have fun looking through the games. As another activity, your child can create documents because Ubuntu comes with free software that is similar to Microsoft Office.

Interestingly, the whole virtual machine can be saved as a big file and moved to a different computer. On Windows 7 machines, the virtual machines are stored in C:\Users\<your profile name>\My Documents\Virtual Machines. We think of a computer as a thing, but it is really just a  collection of information running (eventually) on hardware.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

Teach your child to manipulate images with GIMP

The Curiosity Cycle emphasizes that your child can stimulate his or her curiosity by creating artifacts. Technology has enabled the physical artifacts that we can hold and the digital artifacts that exist on our computers to converge, and there are free tools that can introduce your child to the fun of moving between physical and digital representations. One such tool is the powerful image manipulation software called GIMP.

You can download GIMP at

When GIMP opens, you will see three parts. As can be seen in the image above, the part on the top left is the pallet where you pick your manipulation tool such as painting or erasing. The part on the bottom right is where you pick what your tool will look like, for example if your paint brush will be thick or thin. And the middle part is where you do your work.

A good way to get oriented in GIMP is to watch a tutorial such as

Using a scanner, you can convert a picture that your child has drawn into a digital image (keep it Imageas a “bmp” file). Then you can load that image into GIMP. The large image shown above is of a comic book cover my son drew. Zoom in and look at the pixels using the menu Tools → Zoom. You can draw a box around a small area to zoom in once you have done that. You should see little squares called pixels, as can be seen in the image to the right. We used to say that “pictures don’t lie,” but now we view pictures as being made up of pixels, which allows them to be anything. Pixels are the precise conversion point between the continuous, physical world and the discrete, digital one.

You and your child can then modify the image. The eraser tool on the left can be used to remove pixels. You can pick the paint brush tool to paint on the picture, and you can fill in areas of the picture using the bucket fill tool (as I have done on the large image shown above). After manipulating the picture, you can then print out the new image for your child to see the complete cycle from physical artifact to digital artifact and back to physical artifact.

Additionally, once you have played around with the tools, you can watch this great tutorial on how to manipulate images taken from a digital camera

Since movies are just sequences of images, understanding how camera images can be manipulated gives your child a sense of how special effects are done in movies. Another theme of The Curiosity Cycle is that we should give children as many such glimpses of the world as possible. These glimpses allow children to create model fragments that jumpstart curiosity by giving them a reason to reach out for new information.

GIMP is a powerful tool, and therefore it can be a little overwhelming at first. Fortunately, GIMP has a robust user community, and many questions can be answered by Google search and watching online tutorials. Learning how to learn to use tools such as GIMP is itself an important skill, and may be even more beneficial for your child than learning about GIMP itself.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest

Nature versus nurture

After having two boys and then a baby girl (age 2), people sometimes ask if I have any insight on the nature versus nurture question for why boys act like boys and girls act like girls. I usually say that I don’t since we likely subconsciously treat the girl differently, but I have noticed some interesting trends in how she plays with the boys’ toys. She often pulls cakes out of the hull of the aircraft carrier and sets them on the deck to cool. Also, the ferocious looking dinosaurs are all friends and have their diapers changed regularly.

Tweet about this on TwitterShare on Google+Share on LinkedInShare on RedditShare on StumbleUponShare on TumblrShare on FacebookPin on Pinterest