Wednesday, 8 October 2014

Geek Chic: To binary or not to binary?

So this week I've embarked on my journey to become a Cisco Certified Network Associate. I'm attending the "Interconnecting Cisco Network Devices Part 1" (ICND1) course in Wokingham, which is the building block for any budding CCNA. For those that don't know, the CCNA qualification is Cisco's first step on their staircase to the computer networking promised land.

In December, I'll have been working in IT for 7 years. There are a few skills that various exams and qualifications require you to know, but when it comes to the working world, you rarely use them either because its a method to help prove the theory behind something, or simply because there are calculators and tools that do it much quicker! An example of this is the ability to convert between the Decimal number system (the one you and I use to count the number of pints consumed at the weekend) and the Binary and Hexadecimal number systems.

This example in particular is one that I've had to revisit a few times over the past 7 years for exams, but can count the number of times I've needed to convert between the systems in real life on the fingers of Davos Seaworth's left hand. And guess what dominates chapter 2 of the book I'm reading on the ICND1 course? Buggering binary.

So what is Binary and Hexadecimal, and why do so many exams in IT touch on this? Well, the short answer is that the majority of the time, a computer's language of love is Binary. The decimal system we know and love (you certainly love it after a day of Binary and Hexadecimal conversions) is known as a base-10 numbering system. Put simply, when we write a number in decimal format, the value of each position is multiplied by 10 (which is convenient, as most of us have 10 fingers). Its probably easier if I show you:

Take the number 132. To prove our numbering system is base-10 we can write it like this:

100    10    1
---------------------
 1       3     2

As you can see, each position is worth 10x more than the previous.

Compare this to binary, which can be described as a base-2 numbering system, and you'll soon see why so many people panic when they are first asked to learn this (I did!):

The number 132 in binary format is 10000100. What the fluff?? That looks nothing like 132, what sort of numbering system is this I hear you ask? As I said, it is base-2, so like our example above, we can also write this as:

128     64     32     16     8     4     2     1
------------------------------------------------------------
  1        0       0       0      0     1     0     0


Is it starting to make more sense? Understanding that the basis of binary is that a value is either ON (1) or OFF (0) can help. Now take the values that are ON (have a value of 1), add them together and you'll have your decimal number. Simple when you put it like that right?

So computers talk in binary (as do lots of other digital electronic equipment) by sending combinations of its on-off signal. But for us humans, its a bit cumbersome for us to take a string of 1's and 0's and know what it means (though if we grew up learning the binary system in school, maybe not so much).

The binary numbers I've used so far all have something in common. They all have 8 digits, or 8 bits. And in computing terms, 8 bits make a byte. But, as humans, writing a byte takes 8 digits. You can guess that this could be painful if we are looking at A LOT of bytes. So, along came Hexadecimal (Hex = 6, decimal = base-10), a base-16 numbering system. Converting binary into hexadecimal allows us to display a byte in 2 characters rather than 8! But how does it work?

Hexadecimal, as I said, is base-16. It uses the normal decimal numbers 0-9, but then the values for 10-15 are substituted with the first 6 characters of the alphabet, A-F respectively.

So to convert a binary number to hex, firstly we split it in half, 8 bits into 4 bits which is called a 'nibble'.

11000100      would become:     1100     0100

We then find the value of those two nibbles using the first 4 values of the binary system:

8      4       2      1
---------------------------        =     12
1      1       0      0

Remember, hex only has numbers for 0-9. So when you get to 10, substitute in A and keep going through the alphabet. 12 =C, therefore, the first nibble is C in hex.

8      4       2      1
---------------------------        =     4
0      1       0      0

Therefore, the binary number 11000100 can be written more simply in hex as C4.

Excellent Alex. You've taught me how a normal every day number can be written in two other number systems. What's the point? Well, the point is, I've hijacked this blog post to help re-enforce my own knowledge in preparation for my exam. If you're interested, knowing binary is the first step to mastering an interesting procedure known as subnetting. Another topic that is required for many exams, but is rarely done manually in real life. And that is also a topic for another day.

More to the point, you're one step closer to being able to read The Matrix.


The Robins' Nest Re-Launch


Wow, I haven't blogged since June 2011. Over 3 years on and so much has changed. In short, I'm getting married, I've moved out of my parents' home, I'm looking at moving again and I'm in a new job.

I'm re-launching The Robins' Nest as I've recently had the urge to blog about a few things that I have going on. You'll notice that previously the theme was football, Swindon Town FC in particular. Going forward, I'm not going to be restricting myself to that, you will be seeing more about the other things in my life; technology, music, scuba-diving, wedding planning, house-buying and whatever else gets thrown into the mix.

So sit tight, as I my next post is work in progress.


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCCKt4lQygpkV8HfFm0lezh6mKWFWAyuPjP5xZwZpVESbXNReZZrKSqEUqE68bjNHNjXTHYPkeqSZeD2Naxr2EtS2Ii_f4hfa37HZjdxruak2_oq9_ECSkwv7tYlEry6eF1NmoFYfKmR8/s1600/egg_hatching_light1.jpg