Archive for the 'How Computers Work' Category

Everything Is Numbers

Monday, June 30th, 2008

I’ve started teaching a programming class to the non-programmers I work with and decided to write up some of the lessons here.  In the last installment, I discussed binary numbers. This time we’ll go a little further and explain how those numbers can be used to describe other things like pictures and words.

Computers are just a bunch of ones and zeros and you now know how those ones and zeros can be used to make numbers. But ones and zeros can be used to represent all sorts of different things, from words to photos to Ricky Martin songs… lots and lots of Ricky Martin songs.

So lets take a look at how binary numbers can be used to represent other data — for example, what you are reading right now.

Text
Perhaps you remember the scene from A Christmas Story where Ralphie finally gets his Little Orphan Annie decoder ring, locks himself in the bathroom and begins translating a string of numbers into letters. That is exactly how computers store text as well. Each letter is encoded as a unique number and each number is encoded in binary.

The most obvious way to encode letters as numbers is to set A=1, B=2, and then go through the alphabet until Z=26. This works okay, but what about punctuation, numbers, uppercase and lowercase letters, and this thing: §?

The standard system used to encode characters in computers is called ASCII. Originally it used 7-bits for each character, allowing for 128 unique values. It was then extended to 8 bits, bringing the total to 256. Here is a table showing how letters and other characters are actually encoded in ASCII.

Go ahead and decode this ASCII message:

89-111-117-32-115-109-101-108-108

And just for fun, here’s what it looks like in binary (using 7-bits for each character):

101100111011111110101010000011100111101101110010111011001101100

First one to decode it and post the answer in the comments gets a prize!

Read More »

It’s Easy To Count To One

Tuesday, February 20th, 2007

I work with computers for a living. Often when I tell people that, the response is, “I could never do that.” But, like many things, computers only seem confusing. Don’t get me wrong, a modern computer is a pretty amazing culmination of science, technology, invention, and manufacturing, but I’m convinced that anyone can understand how they work. So I’m going to start explaining it.

Computers aren’t magic. They don’t hate you and they don’t cheat at video games. In fact, there’s not all that much going on in that box. All computers really do is store and manipulate numbers. In fact, they just store and manipulate two numbers: 1′s and 0′s. They just do it really fast and with a lot of them.

Read More »