Monday, December 26, 2011

Old Science Fiction: How well did they predict the future?

I've been reading my way through Project Gutenberg's Science Fiction bookshelf.  Much, maybe most, of the stories are short stories from the 1950s and 1960s. What stands out for me is that the big stuff has not happened and how much the mundane parts of our lives have changed.

Some of the "big stuff"[1] that has not happened:
  • Space travel between planets and solar systems[2].
  • Atomic powered rockets. And airplanes. And cars. And toasters (see next).
  • Ubiquitous, essentially free power, typically atomic. Mass to energy converters are popular in the stories. Fission/fusion reactors are extremely small and safe in the stories.
  • Flying cars.
  • Moving walkways.
What is really interesting is how many things that are written into the scenarios as "normal life" at the time the stories were written have changed:
  • The cold war (USA vs. USSR) is active.
  • Phones had wires and operators (and rotary dials). They typically had a video feed as well.  While video is available today it is not prevalent for everyday use (no thanks, I don't need to see my boss).
  • Smoking. Smoking. Smoking in spaceships(!). More smoking.
  • Computers are huge.
  • Typewriters, telegraphs, etc.
  • Phone booths.
Misses:
  • The concept of a cell phone is totally absent.
  • Data transfer between computers (e.g. the internet).
  • The computer power and size of todays computers is so much greater than the power of the (huge) computers envisioned is so far different as to be effectively a miss.
  • A recurring theme is that, due to the automated production of goods, it will be the duty for people to consume products in order to keep employment from collapsing.
  • Other planets in our solar system (primary Mars and Venus) are habitable and often have existing intelligent life forms.
My conclusion: speculating is fun, but the things that you think will be real in 20-50 years will still be will-o-wisps. On the other hand, a lot of the things you take for granted will be so different that it will make your grandkids laugh at you.

[1] Only considering things that don't violate known laws of physics.
[2] Well OK, interstellar travel either violates known laws of physics, or requires discovery of new laws of physics.

Monday, August 15, 2011

Serial wrap test using bash

And now, for something entirely different...

Doing a simple wrap test on a serial port should be a no-brainer in bash, but I could not find all the pieces in one place, so I assembled the pieces into a short bash script. This is not very stressful and, I am sure, could be improved, but it gets the basic job done: send a string, verify it wrapped and was received correctly, rinse and repeat.

Tip: View page source to get a better formatted copy.

#!/bin/bash # # Serial wrap test # PORT=$1 LOOPS=0 TIMEOUTS=0 MISCOMPARES=0 # Receive the wrapped string # \param $1 - port device # \param $2 - length of string that we should receive # # It works without knowing the length, but knowing the length # helps re-synchronize. # function receive { unset recv read -n $2 recv < $1 echo ${recv} > $3 } stty -F ${PORT} sane speed 115200 > /dev/null while [ true ] ; do send=`date +"%c %N"` receive ${PORT} ${#send} $$.tmp & sleep 0.1 # Block ourselves to let the receive run echo ${send} > ${PORT} sleep 0.5 # let the send complete if [ -f $$.tmp ] ; then recv=`cat $$.tmp` rm $$.tmp if [ "${send}" != "${recv}" ] ; then echo -e "\n${send} != ${recv}" let "MISCOMPARES += 1" fi else let "TIMEOUTS += 1" echo -e "\nTimeout" fi let "LOOPS += 1" echo -ne "Loops ${LOOPS} Timeouts ${TIMEOUTS} Miscompares ${MISCOMPARES}\r" done

Saturday, April 23, 2011

The Statistical Singleton Falicy

The generalization of applying statistics to an individual could be called the statistical singleton fallacy: people (almost universally) inappropriately apply statistics to individuals. Statistics are only valid over populations (in the general sense). As the number of "things" in a population diminishes to 1, the confidence interval goes to 100%, i.e. you can not apply statistical conclusions to a singleton.

A simple graphic illustration of this is smoking. A smoker's probability of dying of a smoking-related disease before age 65 is 15.6%[1]. However, my probability of dying of a smoking-related disease (assuming I smoked) is either 0% (I don't die of a smoking-related disease) or 100% (I die).

People don't understand why some people smoke when there is such clear evidence of the increased probability of death due to smoking-related disease. Well, for each smoker, the probability is either 0% or 100%. If the smoker believes his probability is 0%, he will continue to smoke. If he believes his probability is 100%, he is a hypochondriac.

Thus, smokers either believe they are untouchable or they are crazy.

This is why it is so hard to sell "it's good for you" things... they are almost invariably statistically good for a large population, but can make no guarantees of "goodness" when applied to a singleton.

This applies in spades to health-anything:

  • Individual's health: Lose weight and exercise - it's good for you... but then they advise you talk to your doctor first to make sure the exercise won't kill you before it becomes good for you.
  • Program's health: testing is not guaranteed to find any bugs - if it were, running testing a second and third time would always find more bugs.

[1] http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1646951/?page=3

Wednesday, January 5, 2011

I'm a "sled dog" developer

I have never been comfortable labeling myself a rockstar or ninja developer. Instead, I consider myself to be a sled dog developer.

The "rockstar ninja guru" epithets have a "lone hero" connotation for me, so I am happy to hear that that meme is worn out. The best developers are team players. Even when developers are "a team of one", they are still building with and on the works of others (languages, frameworks, libraries, OSes) and contributing back via Open Source software, email lists, knowledge bases, Q&A sites, blogging, etc.

There are two main qualities that are expected in sled dogs: endurance and speed.1 Sled dogs live to run the trail. They love to do Important ThingsTM like saving lives in a Great Race of Mercy, but they are just as happy running the Iditarod race.

Sled dogs work as teams. There is a lead dog, of course, but also point dogs, swing dogs, and the powerful wheel dogs filling out the team. These have different personalities and strengths, working together to make a team better than the individual components.

To a good sled dog, the worst thing in the world is not working hard, it is not running fast. What breaks his heart is being locked in a kennel and fed dog food.

[1] Sled dogs (Wikipedia)