Thursday, March 08, 2012

Storing Text Digitally


Storing Text Digitally

An excerpt from "The Sydnie Emails", written Feb 4, 2008
Copyright (c) 2008, Kevin Farley

Ok, think about this, what you are calling "digits" and "letters" are nothing more than symbols that are used to represent concepts of numbers and language elements. The "numbers" or "digits" are the language-dependent symbols that are associated with quantity and counting while the "letters" are the language-dependent symbols that are associated with language utterances.
So when you think about it globally, there is nothing intrinsic to the letter "k" that denotes a "k" sound. We, as English speakers associate that letter to the beginning sound made when saying "k". And similarly we associate the letter "w" to a sound that has no relationship to its name, but merely represents a known sound. So then the "letters" of the English alphabet are used to represent some language-dependent sound.
And when we want to store some information in a computer, we need to be able to associate the language-dependent symbols with some computer-usable patterns of 0s and 1s. And really, that is all that is done. Each letter of the alphabet, some punctuation, the numbers, and a few other "characters" are simply associated with binary values in the computer.
Think of it like a look up table. You want to store the symbol "k" so you need to define a unique value for that symbol so that every time you see it, it will ever only mean  "k". Do the same for each letter of the alphabet, including both upper case and lower case characters (think about it, capitalization of a letter may not change the sound it makes, but it is uniquely different in meaning and what it represents).
The result is a map where you can look up a symbol (character/letter) to get its representation, or using the value of the representation, you can look up the symbol.
Now the most widespread of such mappings is the ASCII code. This is the world's most recognized standardized character map, but it only maps English characters (gee, I wonder who invented the entire computing industry). This mapping code has been around a long time. Google it sometime if you are interested.
The basic ASCII chart assigns 127 letters, numbers, punctuation, and some special characters to the values 0 through 127. There is an extended character set that uses the values 128 through 255 but that is another matter altogether. Also because they wanted to keep the range of values for characters to something that can be stored in a single "byte" (8 binary digits/bits), all character mappings must be less than or equal to 255 which is the maximum value you can store in 8 binary digits (equivalent to 11111111).


Note: The Unicode character mapping set contains what is known as "wide characters", meaning they can be larger than a single byte. Most often they are two bytes wide which allows up to 65536 unique values  as opposed to the 256 unique values used by the single byte wide ASCII characters. Some Unicode character sets are 4 bytes wide.
The first 32 values (literally 0, 1, 2... 31) are assigned to "control characters". Do you know what happens every time you press "control-c" to copy something? The keyboard generates a key scan code that is translated into the numeric value 3 by the keyboard device driver. The software interprets this value 3 to mean "copy the highlighted text to the copy buffer/clipboard". There is nothing magic about "control-c", its the mapping that makes the magic.
So starting with numeric value 32 (0x20) through 127 (0x7f) you have your "printable" characters. They are called printable because they result in some character you can see (with the exception of space and delete which are technically not seen). The base-10 digits, starting from 0, are mapped to values 48 (0x30) through 57 (0x39).  Upper case letters, starting from 'A', are mapped to values 65 (0x41) through 90 (0x5a). The lower case letters from 'a' are mapped to 97 (0x61) through 122 (0x7a).
So then, when the name "Sydnie Pye" is stored in the computer it is actually stored as a sequence of numeric values in binary digits. So it is actually stored like the following
01010011    <-- S
01111001    <-- y
01100100    <-- d
01101110    <-- n
01101001    <-- i
01100101    <-- e
00100000    <-- space
01010000    <-- P
01111001    <-- y
01100101    <-- e

Alternatively, I could have simply written:
0x53 0x79 0x64 0x6e 0x69 0x65 0x20 0x50 0x79 0x65

By standardizing on the way the characters (letters) are represented in the computer, all the computers in the world can accurately store and recall that name correctly.
There are other mappings of an alphabet and characters to numeric values. One of the older ones is EBCDIC, an old IBM standard still in use to some extent. The new modern standard starting to be adopted globally is called Unicode. In Unicode, characters are not a single byte, but instead each character requires from 1 to 4 bytes depending on the specific encoding, and there are several.
This was needed because some of the Asian alphabets (most notably Kanji) have no simple equivalents to our English letters. Also, because ASCII is tuned for English and related languages (most European languages but not Russian and Russian derivatives), its not suitable for encoding all the intricacies of more complex alphabets.
So then the answer is "yes, binary numbers are used to store textual information in a computer."
I do not say "letters" because that is a language-dependent attribute. Asian alphabets like Kanji do not have any letters, they have glpyhs. And technically speaking, the English alphabet has glpyhs too, we just call them letters.

Counting With Letters? No Way!


Counting With Letters? No Way!

An excerpt from "The Sydnie Emails", written Jan 31, 2008
Copyright (c) 2008, Kevin Farley


When you say "count with letters too", I assume you are talking about working with digits other than 0 through 9 and that means number bases beyond 10. Recall that binary has only 2 digits, 0 and 1.
Think about it. We have 10 "numbers" because we have a base 10 number system. In English, we have assigned the "symbols" 0, 1, 2, 3, 4, 5, 6, 7, 8,  and 9 to the number positions 10^0 through 10^9 respectively. Semantically we call the symbols we assign to represent numeric quantities "numbers". But that is more of a grammar thing and not a math thing. The math thing is to call them "digits".
In math, a symbol is used to represent a quantity, an operation on quantities, unknown quantities, and properties. But that is all these symbols are, representations of a concept. Digit symbols are used to represent powers of the base of the number system.
So then grammatically in English, using our base 10 number system we only have 10 symbols for the digits 0-9. But the symbols can be anything. If you look at ancient Maya number systems, their number system was based on 20 and their "numbers" were glyphs of combinations of bars and dots. I suppose they counted on their toes too hence the base 20 system ;)
So instead of being based on powers of 10 representing digit positions of 1, 10, 100, 1000..., the Mayans numbering system was based on powers of 20 which means that the digit positions (if they had them) would be 1, 20, 400, 8000, 160000...
Now we can still count in Mayan using their glyphs. But also we can count in Mayan using English "symbols" instead of the glyphs. We can start by using the "number symbols" 0 through 9, and then (borrowing from the computing world and hexadecimal) we can start with the "letter symbols" A, B, C, etc.
Thus our Mayan digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G, H, I, J
Now we also know from Deep Thought that the ultimate answer to the universe, to life, to... everything... is 42 (in decimal).
But the ultimate answer in Mayan is 22. Why?
Because 2 * 10^0 + 2 * 10^1 = 2*1 + 2*20 = 2 + 40 = 42
Now since I brought it up, lets talk about hexadecimal, which is to say the base 16 number system.
Though binary is used (conveniently enough) for computing because of the nature of electrical switching and the on/off detection of electrons in circuits, programmers rely most heavily on "hex" math. The reason is simple, strings of binary digits are simply too cumbersome to keep track of (how many 1s in a row can you look at before you lose track?). So a shorthand representation of the binary numbers is needed.
Why not just use decimal? Well for starters, 10 is not a power of 2. What do I mean by that?
Binary is based on powers of 2 and decimal is based on powers of 10. To convert between base 2 and base 10 requires some mental agility (or calculator) as the digits don't "line up". I will explain that.
If I have the decimal number 117, that is the binary number 1110101. Now I can't look at any sequence of those binary digits (bits) and "mathematically see" any digit of 117. Meaning, I can't look at the string of bits and see a substring of bits that mean 100 and a substring of bits that mean 10 and a substring of bits that mean 7.
Well technically I can look at 1110101 and see 117 because I have done this for over 2 decades, but that is an entirely different matter.
So then you want to use a numbering system that shortens the representation of binary numbers but is readily convertible. As a programmer, I want to look at the number and be able to immediately see the bits underneath.
Now if I use a number system that is in itself a power of 2 at some higher order, I can achieve that because the basis of the number system is still 2, but each digit represents larger values of powers of 2.
Early in the days of computing, programmers started using "octal" representation, which is based on the base 8 number system. In octal you only have the digits 0 through 7, because remember, you do not have the base number in your digit set.
Using octal that decimal number 117 becomes 0165 (and 01110101  in binary) . I prepended the number with a 0 because that is standard practice in computing to distinguish a number as being octal: it will have the 0 in front of the number which is not normally done for decimal numbers.
So if I look at the digits of 0165 I see 5 which is "101" in binary, 6 which is "110" in binary and 1 which is "001"in binary. Thus we have:
 1   6   5
001 110 101

See how you can visualize the bits? Each octal digit represents a string of 3 bits. I can look at the octal digit and I only have to do the bit conversion for 8 values total, which is represented in 3 bits. When you use decimal, the base 10 digits don't allow such simple visualization. You can't simply write the decimal digits 117 and have the underlying binary pattern fall out sequentially.
To see the failure of decimal, just look at the lowest digit of 117, which is 7. In binary, the 7 is represented as 111 because that is 1*2^0 + 1*2^1 + 1*2^2 = 1*1 + 1*2 + 1*4 = 7. But clearly the bottom binary digits are 101 and not the expected 111. This is because decimal is not a multiple of a power of 2 (the basis of binary).
If we were to simply use the decimal digits like I did the octal digits we would have the following:
 1   1   7
001 001 111 <<-- WRONG!

And that would actually be the value 79 in decimal, not 117. So clearly, decimal does not lend itself readily to binary visualization.
While octal is all well and good and an improvement on handling binary numbers, we want it still more compact and yet allow us to visualize the bits as in octal. So if we look to the next power of 2, we have 16 (we went from 2, to 8 - skipping 4, and the next is 16). That leads us to hex numbers in base 16.
So to use hex, I need 16 digits. English only has 10 "numbers", so we proceed on to the letters like with the Mayan example. So my base digit set in hex is:
0 1 2 3 4 5 6 7 8 9 A B C D E F

Which yields decimal values 0 through 15 inclusive.
Now, to distinguish a number in hex from those in octal and decimal, programmers typically prefix the number with "0x". This is the magic sign to tell us that we are looking at a hex number.
Now back to the decimal value 117. When we convert that number to hex we get 0x75 because 7 * 16^1 + 5 * 16^0 = 7*16 + 5*1 = 112 + 5 = 117.
Now remember the visualization thing? The hex digit 7 is "0111" in binary and the hex digit 5 is "0101" in binary. Thus we have:
  7   5
0111 0101

Now see again how we can visualize the bits?
So back to the original question of using letters, lets look at a much larger number, say 0x7EA6CF82.
In binary that is: 1111110101001101100111110000010
In octal that is: 017651547602
In decimal that is: 2124861314
In hex that is: 0x7EA6CF82
In mayan that is: 0m1D407D5E

Now for the hex visualization:
  7    E    A    6    C    F    8    2
0111 1110 1010 0110 1100 1111 1000 0010

With each hex digit, the programmer can "see" the underlying bit patterns. As a programmer, we instinctively know (now after doing it a while) that "F" is 15 and "C" is 12. We also know that 15 is "1111" and 12 is "1100".
Now the question that may have popped into thought: but who uses numbers that big?
Programmers do all the time. Its not the "data" that is usually that large, its memory addresses that are that large.
A regular PC has anywhere from 128 MB to 1 GB or more of RAM. A MB of RAM is actually 1048576 bytes. This is because 1 kilobyte (KB) is 1024 bytes, and a megabyte (MB) is 1024 KB. So 1024 * 1024 = 1048576. So then a gigabyte (GB) of RAM is 1024 MB or 1073741824 bytes.
Why 1024 and not 1000? Because 1024 is a power of 2 (it is 2^10 to be specific). Remember, computing uses a base 2 number system at its lowest level, and 1000 is  decimal concept. But since 1024 is almost 1000, we use the "kilo" prefix and instead of 1 million we have a little over that and use the "mega" prefix. The same for "giga" where a GB of RAM is actually more than 1 billion bytes.
So if you are talking about memory, the prefix kilo means 1024 and mega means 1024*1024. But when you are talking about CPU clock speed of a computer, that is a different matter. A 500 MHz CPU has a clock speed of 500 million cycles per second where the M for mega means 1,000,000. Also a 3 GHz processor is running at 3 billion cycles per second where G for giga means 1,000,000,000.

As a side note, disc drive manufacturers do not use 1024 as the order of magnitude, but they use the smaller 1000 instead. So that 60 GB hard drive is smaller than 60 GB of RAM because 60 * 1000 * 1000 * 1000 is less than 60 * 1024 * 1024 *1024.
Why do they do that? Marketing. Almost a bait and switch and most people don't know the difference. But in reality, a 100 GB hard disc drive has 7.3 GB less than one would think (100*1073741824 - 100*1000000000 = 7374182400). But I digress..



RAM is random access memory, and to use it, each byte must be individually accessible. To access memory, each byte has a unique address. That address is simply a one-up number. So the very first byte of RAM has memory address 0 and the last byte of a 1 GB RAM chip has memory address 1073741823.
That is supposed to be 1 less than the total locations because remember, despite how we all learned to count as children, the first of anything mathematically is really item 0, not item 1.
Another piece of this is that nearly all personal computers today use virtual memory, which is a really long discussion that is beyond what you need to get into at this time -- or ever ;)
Simply put, virtual memory means the computer can act like it has 4 GB or RAM even if it only has 64 MB, it just uses a hard disc to swap in and out sections of RAM.
To get addresses for 4 GB you have numbers in the range from 0 to 4294967295.
And because programmers are always looking at (virtual) memory addresses, we always, daily, perpetually, and in all other ways, have to deal with really really large numbers.
So that last virtual memory location, 4294967295, is 11111111111111111111111111111111 in binary, 037777777777 in octal, and 0xFFFFFFFF in hex.
And since each digit of the hex string is exactly represented by 4 binary digits (bits), the hex version is the optimal way of looking at really really large numbers in computing.
In summary, the point of having letters is just to get more digits than 0 through 9 which are need for number systems beyond base 10.
Now I am sure that all of this is well beyond your basic question. But I am the computer guy and the math guy and since I like this stuff, I like to explain it. Thanks for putting up with this long-winded explanation.



The Binary Number System


The Binary Number System

An excerpt from "The Sydnie Emails", written Jan 29, 2008
Copyright (c) 2008, Kevin Farley"On The Binary Number System"



Who? What? When? How? What do you want to know? It can be short or long, simple or overly complex. Let's try "overkill".
The basis of using the binary numbering system in computing is simple. At the lowest element of a computer you have a switch that is either on or off. If it is off, we call that "0". If it is on, we call that "1". Those are the only values we can count with, 0 and 1. Since there are only 2 values, all computer operations at the lowest level use a number system based on 2, called a base 2 number system, or simply "binary". The term "binary" simply means "two values" in this case.
In the binary number system, there are only 2 values, 0 and 1. To get any number you have to add combinations of 0s and 1s. The key to achieving this miracle sum is that you need to multiply the 0 or 1 by the right multiplier, which in binary will be the value 2 raised to an exponent just as in decimal (base 10) where the multiplier is the value 10 raised to an exponent.
This is why you see strings of 0s and 1s all over the place in computer programming. However, it is more common to see hexadecimal (base 16) but that is another story entirely.
So for example the decimal number 12 in binary would be 1100.
1*2^3 + 1*2^2 + 0*2^1 + 0*2^0
The value 37 in decimal when translated to binary is 100101.
1*2^5 + 0*2^4 + 0*2^3 + 1*2^2 + 0*2^1 + 1*2^0
By using a binary number system, the computer can make zillions of simple "yes/no" decisions that translate into certain values. It is this basic premise that all computers operate on.
One of the reasons why this is so key to computing is that at the heart of every digital processor, you have what is effectively a transistor that can switch an electric current from on to off or from off to on. By manipulating these transistors in patterns using circuits that compare and sum them, you can create a resulting pattern of electric current that represents a value.
Its just like cavemen laying out clam shells to count with, its just cooler now using electricity and lasers. And we have Geico.
Also note that most modern computers have normalized on the standard of using 8 binary digits (called bits) as the basic unit of storage/processing. What this means is a single "byte" of memory is essentially composed of 8 transistors created directly in silicon.
So what this means is that value 12 in decimal is normally represented in binary as 00001100 in computer bits and that would produce an electric current pattern in a typical PC's CPU of :
0v | 0v | 0v | 0v | 3.3v | 3.3v | 0v | 0v
If I were to add a positive current (3.3v) into the left most transistor it would yield the pattern:
3.3v | 0v | 0v | 0v | 3.3v | 3.3v | 0v | 0v
Which in binary is 10001100 which is equal to 140 in decimal. This is equivalent to saying "add 128 to 12" (because we are adding 10000000 to 00001100).
Note that in the CPU, these bits are stored and moved around as electric current. However because of the nature of binary systems (on/off values), you can use other ways to represent it. For example, on a typical hard disc drive, there is a metal platter (or non-metal platter coated in metal) that uses magnetic alignment (north/south) to represent 0 and 1. Also on a compact disc or DVD, each bit is represented as a "pit" or a "land", meaning "the laser light is lost in the pit" and "the laser light is reflected off the land".
It could also be "clam shell means 1" and "no clam shell means 0" to those Geico cavemen.
The importance of this all or nothing concept is that computers work because they have to very quickly measure these electric currents, magnetic directions, and laser reflection accurately (but not clam shells). It is much easier to determine if an electric circuit is at 3.3 volts versus 0 volts while it is much harder to determine if the circuit is at 3.3 volts versus 2.9 volts. The same goes for magnetics and light.
So because computers operate on the on/off electric circuit principle (simply put but it is enormously more complex in reality), it is extremely convenient to represent these electric patterns as sequences of 0s and 1s. It would be really verbose and annoying to have to say "on, off, off, off, on, on, off, off" when you really want to convey the meaning of "140".
Well that is a start let me know what else is needed.
And since I feel like it, and because I really do like math, lets have a little number theory to explain how those sequences of 0s and 1s work.
Here is a short number theory explanation, you can translate, and it makes most sense to describe it in decimal first as most people get blown away when you jump right to the alternate base numbering system.
A starting point. Regardless of all human experience, in mathematics, you do not start counting at "1", you start counting at "0". This point needs to be understood as the "first" instance of anything is instance number 0, not 1, regardless of what you think. Imagine counting your fingers, start with 0 and proceed to 9, you have 10 total fingers, but the first one is #0 and the last one is #9. This is actually an important aspect to remember.
In all number systems, each digit represents a value taken to a base number raised to an exponent. That sounds complicated but its not. When we count in decimal, which is what most normal humans do, the base is 10 (which coincidentally - not - we have 10 fingers). The right most digit is position "0", and then you go up by one as you move to the left.
So for the number "763" the 3 is in position "0", the 6 is in position "1", and the 7 is in position "2".
So to come up with the value of the number, you multiple the digit value by the base number raised to the exponent of its position, starting with position 0.
total_value = digit * base^0 + digit * base^1 + ... + digit * base^n
(where the ^ means "take the base to the exponent of")
So then the value 763 means "7 * 10^2 + 6 * 10^1 + 3 * 10^0"
Remember that a number raised to the power "0" is equal to 1, by definition. Always. That's just how it is.
So we have  7*10*10  + 6*10 + 3*1 = 700 + 60 + 3 = 763
This is the basis of base-N number theory and can be applied to any base value. If your base value exceeds 9, then you run out of digits and you substitute other letters or symbols. For example, in hexadecimal numbering, you use 0-9 for the first 10 digits, then a-f for the next 6 digits for values 10 through 15. Literally, in hexadecimal the digit "f" is equal to decimal value 15, always, forever, by definition.
Now when counting in decimal and you get to value "9", then next value is "10", but notice that it is no longer a single digit, but two digits. What we often take for granted is "10 comes after 9", but in mathematics, 10 is a linear progression from 9 using a systematic value increase that follows rules.
So what you really do when you go from "9" to "10" is you have to add a digit to the left that is now multiplied by the base raised to the next power of the base, which is 10. This means you have the following:
10 = 0 * 10^0 + 1 * 10^1 = 0 * 1 + 1 * 10 = 0 + 10 = 10
Ok, now that we have discussed the basics of base-n numbering systems, lets apply that to binary numbering systems.
In binary numbering systems, the base number is 2, which means each digit is multiplied by the value 2 raised to the power of the digit position, starting with 0. Now also, since by definition of being a base 2 number system, we start counting from 0 which leads to 1 and then to 10, not 2.
The reason there is no 2 is because you never have the base number in your numbering system.  Count your fingers starting from 0 and you end at 9, not 10, but you have 10 fingers. So then in the decimal numbering system you have 10 values (0-9) and in binary you have 2 values (0-1).
So if we take a modest decimal value, say 37 and convert it to binary, lets first look at it in decimal.
37 = 7 * 10^0 + 3 * 10^1 = 7 * 1 + 3 * 10 = 7 + 30 = 37
Now lets do figure out what it is in binary.
For starters, the digit positions and exponent values we need to consider are:
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
Now we can stop, because 64 is already greater than the number to convert. In other words, we don't need any multiple of 64 to come up with the value 37.
So starting with the largest power of 2 that does not exceed the number and working down, we can do some simple math. The largest value that is a power of 2 that is less than or equal to 37 is the value 32 which is 2^5. Remember, its exponent is 5 and that means it is digit "5" when counting from 0. So it is the 6th digit (numbering the digits right to left). Take the number to convert (37) and subtract the largest power of 2:
37 - 32 = 5
So we have a remainder of 5. Find the largest power of 2 that does not exceed 5. That would be the value 4 which is 2^2. Since the exponent is 2, there is a 1 put in digit "3". Again, take the difference and find the remainder:
5 - 4 = 1
Once you get a remainder of 0 or 1, you are done. There are no more powers of 2 to consider at that point. The remainder of 0 or 1 becomes the right most digit, which is digit 0. Just use that value for the digit.
So we used the exponents of 5 and 2 and had a remainder of 1. This means that digits 5, 2, and 0 each need to be value 1 while the other digits (1, 3, 4, and all digits beyond 5) need to be value 0. This gives us:
1 0 0 1 0 1
| | | | | |
| | | | | +-> digit 0, comes from remainder
| | | | +---> digit 1, uses no exponent hence 0
| | | +-----> digit 2, uses exponent of 2, hence 1
| | +-------> digit 3, uses no exponent hence 0
| +---------> digit 4, uses no exponent hence 0
+-----------> digit 5, uses exponent of 5, hence 1
Therefore the decimal number 37 is represented as 100101 in binary.
To convert it back, just multiply the digit by its position multiplier and sum up all the values.
1*2^5 + 0*2^4 + 0*2^3 + 1*2^2 + 0*2^1 + 1*2^0
which is
1*32 + 0 + 0 + 1*4 + 0 + 1*1
which is
32 + 0 + 0 + 4 + 0 + 1
which is
37
And that is the basis of base-n number systems with examples in decimal (base 10) and binary (base 2).
Overkill is underrated. :-)

Friday, March 02, 2012

Wrapped in Wax Paper

I recently started taking my lunch to work instead of going out (as I had done for years). I had a couple goals in mind: conserve money and conserve time. I managed doing it several days straight and then I needed Taco Bell. Yes. It was a need.

On the first morning of this experiment I opted to fix sandwiches made with white bread, ham, and mustard. Yes, it was white bread - thank you very much! I can hear the health nu... conscious... among us groaning at me even now, telling me that my white bread is "unhealthy". Well to that I say "I counteracted the unhealthy white bread by using mustard, the world's perfect condiment". Enough said.

So I fixed two sandwiches - I was expecting to be really hungry - and looked for Ziploc bags to put them in. To my shock and horror, we had very few of the right size bags. Since my daughter has been taking her lunch to school and she is only 10 and fixes it herself. I opted to leave the remaining bags for her. I was the adult. I would find another solution.

I looked around. I had plastic wrap, aluminum foil, and wax paper. I was about to grab the plastic wrap when an image from elementary school flashed through my head. I remembered sitting in the lunch room in fourth grade with my little U.F.O. lunchbox. Anyone remember that TV show? It ran from 1970 to 1973. And I had a lunchbox that proudly showed that I was a nerdling.

I distinctly remember my mother packing my lunch many times. She put just what I wanted in there. Usually it was a ham and mustard sandwich, celery (see? I liked celery as a kid, that's healthy!), a "mixed fruit" fruit cup (basically sugar water with bits of fruit), and a cookie or something. Oh yeah, and a thermos of grape Kool-Aid! 

I don't know why I remember these kinds of things. I stopped asking "why" a long time ago when I found that I could remember so many mundane things but forget important stuff. Like sometimes, instead of my fruit cup, mom would give me chocolate pudding cup. And Freddie got me mad at him one day in fourth grade because he said it "looked like poop". See? Why do I remember that stuff?

And the mundane thing that came to mind was the look of the sandwiches my mother made for me, wrapped neatly in wax paper. She folded the ends together a few times until they were snug against the bread, and then tucked the ends underneath. I remember distinctly how they looked. I wanted my sandwiches to look like that.

Pulling out the wax paper, I went to wrapping. I wasted a piece of the wax paper because I did not get the length right, but I figured it out soon enough. And in under 2 minutes I had both sandwiches wrapped.

I looked at them intently. The bread was nearly square for some reason. With the sandwiches wrapped in wax paper, they looked like something you would get at an old-fashioned deli. I was proud of myself.

I brought sandwiches so far every day, each wrapped in wax paper. Maybe that is why I needed Taco Bell. And even though I have more Ziploc bags, I think I will continue to use the wax paper. Mostly because I like the way they look wrapped up.

And to think, only recently I thought there was almost no use for wax paper anymore. I was wrong. Wax paper made me happy for a little while. And that makes it a good thing.

Wednesday, February 29, 2012

Fixing A Chair

So I went to use the office chair upstairs. I bought that chair a few years ago when the company I worked for was getting rid of some furniture. It was one of the last to go so I got it for $20. It was made by Haworth back in 1987. It's blue and weighs 4 and a half tons. At least it feels like it.

The chair weighs so much because it is a good solid chair. The fact that I was going to stand on a rolling, tipping chair to change a light bulb is not really the point. Yes, it seems risky. It probably is. But again, that is not the point.

The point is when I looked at the chair, the right arm rest was laying over to the side, someone had broken it. I don't know how they broke it, but they did. The other day, I knew the arm rest was a bit loose, but today it was laying down sideways almost.

To say I was miffed is an understatement. I was ticked off. And really, what bothered me most was not that the arm rest was broken. I was pretty sure it could be fixed, or I would simply throw out a $20 chair that I had used for about 3 years. The chair being broken was not my biggest annoyance.

What really ticked me off was knowing without a doubt that when I asked the kids about the chair, no one, not one would know anything about it. Each will swear they never saw it broken and had no idea how it happened. That is typical of problems like this. Apparently someone sneaks into my house and then breaks random things, leaving without ever being seen.

So I took the chair apart, found that 2 bolts, each 1/4 inch in diameter had sheared off. Whatever happened, it wasn't something light. Due to not paying attention, I had to disassemble and reassemble the chair twice. In the end, I had 3 bolts in my parts box that worked.

So 3 bolts, some sweat, 3 chunks of skin, and 2 hours of using a screwdriver and I had it fixed. And honestly it is better now than it was before.

I looked up the specs on this chair and tried to find an equivalent chair from the manufacturer just for grins to see how much it costs. The current generation equivalent Haworth chair goes for about $600 new, and about $200 used.

I asked the kids who knew anything about it. None did. Of course. Oh well. I guess I need to put up surveillance cameras and catch that guy that sneaks in to my house just to break things.

Thursday, February 23, 2012

Someone Open My Windows Please?

After 5 years of using Linux full time, I finally landed in an organization that really is Windows-only and I am now forced to use Windows full time again. So here I am with a Windows 7 laptop - a Dell no less, not one of my favorites.

So I was given a cryptic set of documentation that indicates there is certain software I need to install. It is scattered over a plethora of systems and servers. Each of them with their own installer and their own peculiar way of doing things. Sure they basically follow the same pattern, but each is different, and not by necessity. And not everything wants to install correctly into this Win 7 64 bit OS. Some things complain or require some tweaking.

But I need these things, these proprietary tools that only run on Windows. I need them because they represent the only way to compile and link the software I will be working on. I need them because some of the applications were chosen to support developers and testers and the software is very much Windows only.

And so I threw myself into making the best of things. After just a few hours I remembered how frustrating it is to work in Windows. To be fair, it's not hard to work in any one specific Windows based application. What is hard is trying to switch back and forth between applications in Windows. That is where frustration builds to new heights. That is where any ideas of "ease of use" do not apply to MS Windows.

First of all, some people may like the aggregation of application instances on the bottom bar, but to figure out the one you want to click on takes forever. Windows is slow to reveal the individual instances and then they are so small I have to wait longer for it to highlight the full window. Sure, I could alt-tab through a few dozen application instances, but that is not all that efficient either.

The second thing is the obvious lack of virtual desktops. I mean seriously? It's 2012 and MS still does not have native support for multiple virtual desktops?

Also there is no way to add "launcher groups" they way I was used to working in Gnome on Linux. I know I can drag a shortcut to the Taskbar and "pin it". But I have not figured out how - or if I can - create a "group" of items. So for now I create folders of shortcuts and then add them as Toolbars. It sort of accomplishes what I wanted, but the result is not all that great. For example, the toolbar pins to the taskbar but you have only a tiny >> thing to click on. And once you do that, sometimes it takes several seconds to display the toolbar. Not always, and not predictably, but sometimes it does.

So, I need command line access - yes people, I really do, developers have to do things that require command line tools at times and that is not a bad thing - but the Windows "cmd" box is really, really bad. That thing has not changed in years and has basically existed as-is for several major releases. Here is an example of its ancient roots: you can't drag and resize the width of the terminal window it provides. You can drag it down and up, but not sideways. It really is just a piece of crap. I also needed a real command line shell, not that weak, limited "cmd" shell. So I opted for the cygwin solution, as I have for many years when having to use Windows.

I installed cygwin and spiffed up the colors of the terminal window to make it easier to see. I decided to change the display font. I found a nice looking font called TTF Terminus which I downloaded and installed. Now when I look in the Control Panel at fonts, there it is. When I run any app and look for the fonts, it is not there. A minor nuisance but indicative of a problem if you ask me.

You know, I find it appalling that Microsoft is shipping brain-dead Notepad after all these years. Surely they have the talent to make something better than that marginal thing.  Notepad should be called "Notpad" because anything other than displaying and typing characters is something it can NOT do.

Well, needing a decent editor (or three), I installed some open source tools because they are not only what I know, they are excellent tools for free. I installed the Geany IDE, gVim (graphical vi editor), and Gedit (Gnome's default text editor, their "Notepad" if you will). All three of these have syntax highlighting for dozens (and more) of programming languages, support various add-ons and have many features Notepad will never have. The trick here was hooking these Windows executables into my BASH command line in cygwin. It wasn't hard, just had to figure out where Windows would break.

So back into my command line I go. Already having command line Vim, I added in cscope (mlcscope to be precise) so I could quickly look through C files using tags. I added in a few more tricks and tools in cygwin. Then I started going through source code files similar to what I had been doing for the last several years.

The problem is, even though I was able to just about mimic my environment, it still suffered from the ponderousness of Windows when it came to switching between windows. Being so used to middle-mouse clicks, being able to scroll any window under the cursor without taking focus, and segmenting work into virtual desktops, I felt like someone was dragging my arms backwards when I tried to work.

Actually, its worse than that. It feels like I was given stone knives and bear skins, placed in a straight jacket, and then told to perform fuel injector repair on a Buick. With some MacGyvering I can get the job done. But seriously, the work paradigm for Windows is so lacking for those of us that do a lot of multi-tasking and concurrent work flows.

Perhaps the real issue is that Windows is for "average users" that don't do serious work and that is why it seems to be tuned for full-screening apps and doing one thing at a time.  As far as I am concerned, Windows 7 is only moderately usable. Give me Linux Mint with Gnome 3 shell and MGSE any day, it blows the doors off the tired old Windows work paradigm.

No virtual desktops, no mounting of ISOs and other file systems, ancient Notepad, inconsistencies in how things are done (not everything has been updated over the years of versions), and the complete lack of a solid "applications center" make Microsoft Windows look like something that is still in the dark ages of computing.

Wednesday, July 20, 2011

7 Popular PC Games I Can't Play On Linux

As I have written about before, I am a Linux user, not a Windows user. I do not use Microsoft Windows nor do I miss it. However, as I pondered what it was that others were doing on Windows that I could not do, a few popular games came to mind. Granted, these are popular from the perspective that people play them weekly or sometimes daily on MS Windows, and they must really like them because they keep playing them. 

 

No, I am not talking about the mammoth titles like Halo or Call of Duty or something like that. These are more fundamental games that all Windows users play. No, it's not Solitaire either, we have a dozen or more of those on Linux. Here is the list of games I have found so far that are unique to Windows and I don't get to play on Linux:

 

1) Whack-A-Virus

 

This seems to be the most popular game. People spend hundreds of dollars on this game software they get form Symantic, McAfee and others. There are also freeware versions of the software to play this game as well. The basic premise of the game is that your computer is infected with a host of malware and you must eliminate all the little nasties. So you have to run, re-run, and re-run the "game" software again and again until you whacked all the virus baddies. In the end, it seems that most people end up giving up because they can't get past the boss bugs and they simply reinstall their beloved Windows operating system.

 

2) Lockup 2011!

 

This is a very popular game it seems. The premise of the game is at random and unpredictable times, your computer completely freezes and you are then in Lockup! The goal is to get out of lockup as quickly as possible to get that work done or email sent or document printed before it is a real problem. You can still see everything on the screen, usually, but you cannot click on anything or do anything. You are to try multiple combinations of key presses to try to get the screen to change. Most people just reboot, which I consider cheating.

 

3) Blue Screens of Death!

 

This has long been a commonly played game on Windows that started in the dark ages of the operating system's life. The premise of the game is that you are someone using a computer and at completely random times your display goes completely blue, everything stops, and it prints some strange runes on the screen. These runes come from an alien race that wants to enslave you. Your task, if you choose to accept it, is to try to copy down those runes, interpret them, and find out what they mean. Only then can you avoid enslavement. Again, most people just cheat and reboot.

 

4) Fork It Over

 

This game is not played by everyone because it is expensive to play. Basically you are trying to do something on your computer and you find that you can't get it done because you are blocked by the Ogres of Dire Need. The Ogres need a special app, or a new version of an app, or a license for a feature of an app. So to get past them, you must go purchase said app/update/license and thus "fork it over" in cash to the Internet vendors. Only then can you appease the Ogres of Dire Need and get work done.

 

5) Blame!

 

This game is kind of tricky and is a kind of MMO. In the game, you are a computer user and randomly something will crash, either part of the operating system or an application. Once that happens, you then start the blame game. I say tricky because you have to establish contact with the Mystics of Windows or the mages that created the application and go through the problem with each and listen to the stories of "it's not our fault, it's theirs" to establish who think the blame belongs to. In the end you will always be wrong, because the secret of the game is the NPCs consider the fault is due to the user. With this game, you can even PUG by finding others with similar crashes. There is a cheat code, it's called "reinstall".

 

6) Wheels of Time

 

This game is a very slow one. Kind of like playing chess by snail mail. The premise of the game is the system will get slower and slower over time. Your task is to put up with as much slowness as possible before you can't take it any further. It's an odd game, because the goal is to wait it out as long as possible, but the consequences get worse the longer you wait. Kind of a catch-22 situation. The reward for waiting long enough is you get to buy a new computer and avoid all the slowness. If you can't wait long enough, you are punished by having to get your computer tuned up by either doing it yourself or paying someone to do it. For some reason, most people end up being really patient and "win".

 

7) Needle, Haystack, Ghost

 

This game is really engaging I am told. The idea is you have a valuable item, call it a file, and you save it on your computer. Then a ghost in your computer moves the item, placing a trail of breadcrumbs in many folders.  If you get too close to finding it, the ghost may move it again. Ultimately it may even be hidden in the Trash Can. You usually realize this after emptying it, so it's not perfect.

 

So there you have it 7 "popular" PC games that are pretty much only played on Windows. There have been reports of minor variants of these games on Macs and Linux, but to be honest, the only one I find close is "Needle, Haystack, Ghost." Come to think of it, that game could be played on about any computer. It just seems to be real popular on Windows where not all applications store things in expected places.

 

I really don't miss playing those games. I am very glad those days are over. Now it's time to get back to work, which by the way really hasn't stopped. My Linux computer has been churning away building code, sorting files, and doing about 30 things at once all day. You can get a lot more done when you don't have those 7 games to play.


Tuesday, June 28, 2011

Living Linux In A Windows World

Yes, I am living Linux in a Windows world. If you don’t have any idea what this means, well, you are not geeky enough. If you are curious, then read on. If not, stop. It is as simple as that.

I do not use the Microsoft Windows operating system for anything other than playing games. My primary operating system for my computers is the Linux operating system. This is an operating system based on the design of Unix (which predates MS Windows quite a bit) and is available for free. It runs on almost anything with a CPU - not a joke, you can google “Linux on camera” or “Linux on a phone” or just about anything else - and has been ported to nearly every computing platform on the planet.

I use Linux because first and foremost, it frees the user to do whatever they want (regardless of how stupid it may be). Secondly, the architecture and design of the operating system is technically better in my opinion than that of MS Windows. This is not fan-boy blather, it is based on my 24+ years of software development experience using systems that pre-date even MS-DOS and an inside understanding how it all fits together within the operating system kernel and framework.

And finally, I use Linux because nearly all the software you could ever need for it is free. Yes, free. As in “no cost”. Seriously. Oh there are commercial applications and I have bought some from time to time, but generally I can get everything done with free software.

If I am going to be on a computer, I prefer to be using Linux. At those times when I am on a Windows machine, I just treat it like a toaster: it does its one thing and don’t ask it to do a bunch of other things at the same time. It often feels like I am in a straight jacket when I am on a Windows box. I encounter something odd and think “I could just pop into a command shell and …”, but alas, if you do that in Windows there is not a whole lot you can do at the command line. Well, recently MS has included a better shell, but still the venerable old command shell from the days of MS-DOS still seems to be the default. I don't get that feeling with Linux. I don't feel hemmed in at all.

However, in terms of personal computers, most people, at least here in the United States, typically think of some version of Microsoft Windows as the only operating system choices out there. Many people have heard of a Mac, but even among that set, they are only vaguely aware that the operating system is entirely fundamentally different in its inner workings. And even fewer have heard of Linux or have any clue what it is. I was once asked if Linux was some kind of prescription medication. This comes from years of PC vendors making deals (or being forced with deals) with Microsoft. And this is why it is difficult to find PCs that ship with something other than MS Windows.

What? You disagree with my “most people” and “many people” generalizations? Well, online polls and studies say that generalization is correct. Most people using a PC are not, to put it bluntly, all that technically savvy. They know enough to get online, check email, browse the web, share pictures of cats with bad grammar, post their “eating pancakes” morning status, and forward spam/scams to everyone on their contact list.

I admit that may be a bit harsh, still I think it seems correct. It appears that not only do most users start out technically inferior, but the industry actually encourages it by hiding more and more of the details of the computer beneath a glossy user interface. And that I believe is part of the problem and part of a solution all at the same time. But I am getting ahead of myself. Hold that thought. First something to consider.

Less than 10% of computer users can define what a “browser” is. Watch the following and weep:


Now for statistics fun. Hey, you are still reading this, you’re a geek, you should think statistics ARE fun, right? The world-wide statistics for operating system market share show that Microsoft Windows accounts for about 86% of all personal computers out there. I think if you look at just the US market that number may actually be closer to 90% but the rest of the world is not so MS-centric.

According to Wikipedia, at the time of this writing, the median estimates for OS usage are:

Windows 86.37%
Mac OS 7.4%
Apple iOS 2.8%
Linux 1.1%
Android 0.97%
Everything else 1.36%

Interestingly if you look at mobile devices, the median estimates for OS usage are:

Android 33%
Symbian OS 31%
Apple iOS 16%
Blackberry RIM 14%
Other 6%

I think it is more interesting if you look at supercomputers, the median estimates for OS usage are:

Linux 91.8%
IBM AIX 3.4%
Unstated 3.2%
MS HPCS 1.0%
Other 0.6%

The numbers are harder to pin down in the server and mainframe markets but generally when you use installation counts and not revenue, Linux dominates the server market and has a good chunk of the mainframe market which is essentially owned by IBM’s System Z operating system.

Ok, so what does all this mean and what does it have to do with “Living Linux in a Windows World”? I am glad you asked.

What it means is that I am in a very clear minority. Because I am not using Windows, I generally cannot run Windows applications. I say generally because there are ways to run Windows applications unmodified in the Linux operating system, but not all of them really work. But I have found that there are very, very few Windows applications I really want to run. Usually just games, but there are a couple things I miss. And yet, I alternatives in the Linux world that are as good, better, or close enough (depending on the tool) that are available freely from the “software center” (something like the fore-runner of an “app store”).

It also means that the world of viruses, trojans, and malware is to me “something that happens to Windows users”. In 12+ years of running Linux, I have never had any virus or malware attack. I still have to take care about information leaking out of web sessions and web sites, but that is more of a user behavioral factor than a technology factor. There is anti-virus software available for Linux, and it is mostly there to scan files from Windows systems. There are many IT people who keep a Linux box on hand to scour and clean infected disks and files.

So I sit here writing this on my Linux laptop using Google docs as my editor on the web while I have a zillion other things going on at once across multiple virtual desktops. I am not confined to a single desktop. I am not confined to just doing things the way it was designed. Linux allows combining apps and tools in many unique ways, allowing for really creative and quick solutions to problems.

Yes, I am in the minority. But as I think about it, I have been all my life. I could just abandon all hope and join the Windows herd and graze among what is offered. But I have never been like that in my life and I am too old to start now. I don’t mind being in the minority. Especially when the minority is essentially the top 1% of techies and geeks.

Yes, I am in the minority, but I sit with my geek brethren at the top 1% of users.

So in practical terms. how do I go about living Linux in this Windows world? How do I get along without MS Office, Outlook, Internet Explorer, and oh let’s not forget the favorite software title to toss into the mix, the one Windows users think is the “killer app”: Adobe Photoshop.

So here is how I live Linux in a Windows world, at least according to the software applications I use. I will only touch on the main apps at this point.

  1. Office Suite - LibreOffice (formerly OpenOffice)
You do realize that even on Windows there are several alternatives to Microsoft Office don’t you? LibreOffice is just one of them. It is mostly compatible with all MS Office files, though it still has some issues with .docx files. But nearly everything else is spot on.

  1. Email Client - Thunderbird
I know a lot of people really love MS Outlook, and hey, it has some excellent features. But there are alternatives, even alternatives that will connect to MS Exchange servers for email. Thunderbird is from Mozilla, the guys that brought you Firefox. Thunderbird is an excellent piece of software in its own right and when coupled with the calendar plugin available for it, is an excellent replacement for Outlook.

  1. Web Browser - Chrome or Firefox
Sorry, but Internet Explorer really just sucks. Well at least up until version 9, it did. It seems to have improved quite a bit. But still, the fact that Microsoft does not correctly implement the web standards just makes it mediocre. I use Google’s Chrome browser mostly. Often I will use Firefox just for some sites. But both are in my opinion tied for the best browser on the whole planet.

  1. Photo/Graphics Editing - The GIMP
I have said it before and I say it again, not everyone needs Adobe Photoshop. That is a professional grade tool that most people get lost in. It is like buying a battleship to go fishing in a pond for most users. The GIMP is an excellent alternative to Photoshop. I allow that professionals will have different opinions, and that is ok. Just remember though that I am a computing professional, so a lot of my opinion is backed up by technical understanding. The GIMP also can be daunting for most average users. It does a lot, but it also may be overkill for most users. Still, I prefer it and have used it for years.

  1. Instant Messaging - Pidgin
My use of instant messaging has dropped off considerably in recent years. But when I want to get onto the IM systems, I use Pidgin. It allows you to connect to multiple systems at once - AIM, Yahoo, MSN, ICQ, IRC, and many others.

  1. Media Player - Banshee
I know iTunes is really good. I know a lot of people really like iTunes. But I cannot run iTunes on Linux. Nor do I want to. I don’t have an iPod, I have an MP3 player (actually my Android phone). Also, I think Windows Media Player is really awful and it also is not available in Linux. So I have been using Banshee and find it an excellent alternative to iTunes and many other media players. It is simple yet has enough features to make it very useful.

There you have it, a basic set of alternatives to the most common Windows apps used by users. Besides running on Linux, what other characteristics do those apps have in common? Care to guess?

Well, yes they are all free. But something else that most Windows users don’t think about is that LibreOffice, Thunderbird, Chrome, Firefox, The GIMP, Pidgin, and Banshee are all multi-platform.

“Multi-platform? What does that mean?” I can hear the questions already forming.

What it means is all those application run on multiple operating systems, even MS Windows. So anyone could run those apps on nearly any personal computer around.

Well not only does “living Linux in a Windows world” mean that I am in an elite minority, it means that I am universal. My application set is supported on all current PC operating systems.

So in summary (yes I know you are glad to read that bit), living Linux in a Windows world means that
I am not bound by the controls the software designers try to impose to protect their systems. They create walled gardens because if you were free to wander around in their systems, you would most likely break something, and then you would complain, and call tech support. So they protect themselves by restrictions. I don’t like that.

I am free: http://www.youtube.com/watch?v=nR7bBEBIC9g

Have a great computing experience, use Linux.