Monthly Archives: February 2017

Thoughts on the Dark Forest

I recently read Cixin Liu’s Three Body Problem and Dark Forest. This blog entry is a spoiler, so you may want to stop reading this if you plan to read these books.

Fermi’s Paradox is a key concept and plot element, particularly one explanation for it called the Dark Forest, tied to character Luo Ji’s axioms of life in the universe:

  1. Life’s goal is to survive
  2. Resources (matter & energy) in the universe are finite
  3. We can never be sure of alien life’s true intentions
  4. Distances between stars impair communication

Conclusion: (3) and (4) create a chain of suspicion making conflict inevitable.

I am not convinced. This is fixed-mindset, zero-sum thinking, similar to the flawed economic thinking behind Malthusian doomsday predictions and protectionist trade policies here on Earth. The above rules are not unique to outer space. The same could be said of different cultures here on Earth – every man presents a threat to all others as they must compete to secure the limited means of survival, leading to inevitable conflict. During some historical periods – primarily in pre-agricultural tribal societies – this was true. Yet today it is false. We have Human societies of size, complexity and interdependency that would be unimaginable to prior generations. Why?

Two key factors. First, the increased productivity of division of labor. Second (and a part of the first), Ricardo’s theory of Comparative Advantage. It was not love or enlightenment that caused Humans to stop fighting each other over the limited resources Nature provided (as animals do), and instead cooperate to create new resources making everyone better off. It was recognition of these fundamental economic facts.

The same applies to space exploration, even more so. Cixin Liu misses this point entirely and falls for the simplistic zero-sum thinking that has duped many before him. Items 1-4 are true, yet the conclusion does not necessarily follow. He’s missing an important 5th axiom: The potential benefits of cooperating with alien life are so tremendous they cannot be measured. When balanced against risks (3) and (4), conflict is no longer inevitable. The result may end in conflict or cooperation, depending on the situation.

Infinite Numbers

ℵ0 (Aleph zero, null or naught) is the smallest infinity, the size of the natural numbers. It is countably infinite, which means there exists some method of counting that will eventually reach each item in the set.

The rational numbers – all fractions of the form p/q where p and q are natural numbers, is also of size ℵ0. One way to prove this is to demonstrate a method for pairing each natural number with a rational number, and show that every rational number will have a pair. The classic proof draws a table of rational numbers and walks through it starting in a corner and marching along diagonals.

So we have the intuitive result that you can pair off the elements of 2 sets with each other, if and only if the sets are the same size.

To me it seems counterintuitive that the rational numbers are the same size as the natural numbers, even though this fact follows logically from the very simple and intuitive above proposition. It seems like there are a lot more rational numbers. However, what follows seems even stranger to me.

The irrational numbers – π, e, and myriad others, are more numerous. Their size is a bigger infinity called ℵ1. They are uncountable – which means there doesn’t exist any method of counting that will reach all of them. Every method you come up with will skip some. There is no way to pair them off with the rational or natural numbers – no matter how you do it, there will always be irrational numbers left over without a pair.

Despite being countable, the rational numbers are infinitely dense. Between any two of them lie infinitely many more. The irrational numbers are also infinitely dense. What is more, between any two rational numbers lie infinitely many irrational numbers. But we’d expect that, given there are more irrational numbers. Furthermore, and most strangely, between any 2 irrational numbers lie infinitely many rational numbers. How can that be, if irrationals outnumber rationals?

The proof is simple. Pick any two irrational numbers, n1 and n2. Take the absolute value of their difference, d = | n1 – n2 |. There are infinitely many irrational numbers smaller than d. If that’s not obvious, pick some natural number ε greater than both d and 1/d. Then 1/ε is a rational number smaller than d.

It seems strange that 2 sets, each infinitely dense, both in itself and in each other, can be of different sizes. But they’re both infinite,so this is probably just a manifestation of the intuitive difficulty conceptualizing different sizes of infinity.

Cyanogenmod Camera Bug and Fix

Good news: you’re running Cyanogenmod, the most popular open source version of Android. Pure Android, no bloatware crapplets from the carrier or manufacturer, and better device performance and battery life.

Bad news: Cyanogenmod has a bug in the camera driver. This is a well known bug; if you Google “cyanogenmod camera bug” you will find lots of info on it. Occasionally the camera won’t work and you have to reboot the phone to get it working again. There is no real fix to this bug.

Good news: there is a simple workaround that fixes it in a few seconds, no reboot needed.


Android has a background process called mediaserver. It is always running and one of the many things it does is control access to the camera. This process has a bug in which it locks or hangs the camera driver, making the camera inaccessible.

This mediaserver process is part of Android and starts automatically during boot. The neat thing is, if mediaserver is ever killed, Android detects this and immediately starts a new instance. When this happens, it clears the camera lock and the camera works again.

So, to fix this problem all you have to do is kill the mediaserver process. Android is Linux, so you could simply open a terminal and run the command killall mediaserver. But it’s not quite that simple. Since mediaserver is a system process, you must have root privileges to kill it. Fortunately, that’s easy with Cyanogenmod.

Enabling Root

Rooting Cyanogenmod is easy – root is already built in, you only need to enable it.

Go to Settings, About Tablet, and tap Build Number repeatedly. A toast will pop up saying, “X more presses to enable developer mode”. Keep tapping until Developer mode is enabled.

Hit back (to Settings) and you’ll see a new option: Developer options. Tap it. Scroll down to Root access, and enable it.

Reset in a Terminal

Now you can open a terminal and run the command su (to become root). A popup will appear asking whether grant root access to the terminal. Allow it – you’ll only have to do this the first time. Then (back at the terminal command prompt) run the command killall mediaserver. Alternately, you can do it all in a single command: su – c “killall mediaserver”. If the camera was stuck, it’s now working again. It only takes Android a couple of seconds to detect that mediaserver has been killed and restart it.

NOTE: if the terminal doesn’t have a killall command, install BusyBox. It installs a bunch of standard Linux command line tools, including killall and many others.

Reset the Easy Way

Opening a terminal and entering a couple of commands only takes a few seconds, but you might want an even quicker and easier way to reset the camera driver. How about an app that you simply touch, and it instantly kills mediaserver in the background? There are several versions of this app available if you google for them. I built one myself using Tasker. It runs standalone on any Cyanogenmod device – doesn’t need Tasker to run.

This app is an APK that you will be side loading. For security reasons, side loading is disabled by default in Cyanogenmod. To install this app (or any other APK) you need to go to Settings, Security, and enable Unknown Sources.

Now download this APK file and copy it to your device, for example in the “Downloads” folder. Just like you would for any other file like a JPG photo or MP3 song. Use the Cyanogenmod file manager to navigate to the Downloads folder and touch the APK file. This will install it.

After you’ve installed it, if you want to you can disable Unknown Sources. The app will continue working since it’s already installed.

The first time you run this app it will ask for root privileges (needed to kill the system mediaserver process). Grant them. It won’t ask again. When the app runs it will pop up a message saying “Camera Reset”, which will disappear in about 1 second.

NOTE: I built and shared this APK only to help Cyanogenmod users – it has no ads, no telemetry, no viruses, and is legal and free. However, it has no warranty. Know what you’re doing and don’t blame me if it doesn’t work, breaks your device, or makes your hair fall out. If you don’t trust me or this source, use a different app from somewhere else or write your own.