Tuesday, 13 September 2011

Converting between Number Systems

I'm finally back from an extensive summer of military training. I am finally back in school. So now I can go back to blogging and teaching what I am currently learning. Both so you as the reader can learn some neat things; and I can remember what was taught. Call it studying maybe. So one of my computer science classes is "Intro to Computer Architecture". First day I learned to convert between 4 number systems.

I won't go into much detail about what exactly they are. But here they are.

Decimal: Can use any number between 0 and 9.

Hexadecimal: Can use any number between 0 and 9. Any number higher is represented by a letter. These letters are A to F. Where A = 10 and F = 15.

Octal: Can use any number between 0 to 7.

Decimal: Can use 0 or 1.

One thing i will mention which is important is these number systems use a base.

Denoted as (N)^what ever base

Decimal is base 10.  (N)^10

Hexadecimal is base  16. (N)^16

Octal is base 8. (N)^8

Binary is base 2. (N)^2

The base is represented by how many numbers are in the number systems set.

So as for converting between the numbers.

EX Decimal to Binary

Lets have our decimal number as 1411 as today is the 14th and the year is 2011.

So we write (1411)^10 ---> (N)^2   to show our decimal number and what base we are converting to.

Heres where the conversion starts. Take whatever the base is of the system you are converting two. Then divide the number you are converting by that base. Keeping the remainder each time and add it on top of your divided number. We are actually using the operator Modulo instead.

1411 / 2 = 705+1
705/2 =  352+1
352/ 2 =  176 + 0
176/2 = 88 + 0
88/2 = 44 + 0
44/2 = 22 + 0
22/2 = 11 + 0
11/2 = 5 + 1
5 / 2 = 2 + 1
2 / 2 = 1 + 0
1 / 2 = 0 + 1

When we get to zero as in bold above we stop. Note that this is also similar to Euclid's algorithm. Now this is the kool part. Starting from the bottom of that long series of modulo. Take the remainders of each modulo and write those numbers next to each other as shown below.

(10110000011) this is the binary conversion. To test to see if we did this right. Starting from the right hand side of our binary number. We go up the powers of 2 on each number.

2^ 0 = 1  ; 2^ 1 = 2 ; 2 ^ 2 = 4; 2^ 3 = 8 ; 2 ^ 4 = 16 ; 2 ^ 5 = 32 ; 2 ^ 6 = 64 ; 2^ 7 = 128 ;
2 ^ 8 = 256 ; 2 ^ 9 = 512; 2 ^ 10 =1024 ; 2^ 11 = 2048 ;

So to break our binary up into individual bits.starting from the right hand side. If it is a one you give it the power of two determined.

1 + 2 + 128 + 256 + 1024 = 1411.

EX conversion from octal to binary.

This starts to get a little different. Octal has a base of 8. Which means that for each octal number binary requires 3 binary numbers.

Lets pick good old 63.

(63)^ 8 ---> (N)^2. Same idea but now we do each number individually. So starting at 6 then 3.

6/2 = 3 + 0
3/2 = 1 + 1
1=2 = 0 + 1    if you notice there is our 3 binary numbers required to represent one octal number.

3/2 = 1 + 1
1/2 = 0 + 1

Now in this case if you start with zero. But you know you have to have 3 numbers keep going till you have three numbers.

3/2 = 1 + 1
1/2 = 0 + 1
0 / 2 = 0 + 0 

So taking our 6 binary numbers. we get (110) and (011)

Testing this out to see if we did it correctly.
(110) = 2+4 = 6
(011) = 1+ 2 = 3

Note that testing the two together will give you 51 and not 63. By together I mean 110011.

Hexadecimal to Octal

(FACE5) ^ 16 ---> (N)^8

For these conversion we either need to change hexadecimal to binary or decimal. If you change to binary for each hexadecimal requires 4 bits( 4 binary numbers, such as how octal requires 3 bits).

We will convert to binary.

(FACE5)^16 ---> (N)^ 2

F = 15 / 2 = 7 + 1
7 / 2 = 3 + 1
3 / 2 = 1 + 1
1 / 2 = 0 + 1

A = 10 / 2 = 5 + 0
5 / 2 = 2 + 1
2/2 = 1 + 0
1/2 = 0 + 1

C = 12 / 2 = 6 + 0
6 = 2 = 3 + 0
3 / 2 = 1 + 1
1/2 = 0 + 1

E = 14 / 2 = 7 + 0
7 / 2 = 3 + 1
3 / 2  = 1 + 1
1/2 = 0 + 1

5/2 = 2 + 1
2/2 = 1 + 0
1/ 2 = 0 + 1
0 / 2 = 0 + 0

Our binary conversion is (1111101011100101) Now becuase octal takes 3 bits per number we need to split our binary up into groups of 3 bits.

Since theres 16/ 3 =  5  Remainder 1 Let the one remainder be the first bit. The group the rest.

1  111 101 011 100 101. Now lets see what are octal number is.

101 = 1 + 4 = 5
100 = 4
011 = 1 + 2 = 3
101 = 5
111 = 1 + 2 + 4 = 7
1 = 1


Hope you had fun reading this. Have fun showing off to friends.


Friday, 3 June 2011

Deep Web

Every wonder how big the internet is? I have wondered this. Now the internet in it's size can never truly be determined. We can gather a rough approximation. But it grows to rapidly and unpredictable. Now here is a brain buster. All of us who use the internet has probably only visited less than 1%. Most likely smaller. his is partly in reason that web search engines only scratch what is called the surface layer of the web. This layer is all that a search engine can reach to find websites. The rest of the websites are lost down in a place called the dark web or deep web/net.

So i have a challenge for anyone reading this. Go find a deep net search engine and explore the deep net. There is all kinds of information undiscovered waiting for you.

Just be careful!!!

Majority of the deep net holds criminal activity such as identity theft, cp, scams.

So be safe and have fun

Wednesday, 1 June 2011

Doritos and why the kind I tried, hurt!

So while I was away on course. I had a weekend off and decided to skip to the next town over. This town being Owen sound, a nice beach city. I decided instead of sleeping on a cot I would buy a hotel room with some buds and sleep there. While I was staying there a younger fellow on another course came out with a bunch of weird Doritos chips. They were well weird because I have never seen them before.

They were Doritos 1st degree burn, 2nd degree burn, and 3rd degree burn. Each bag a totally different level of spiciness. I never got to try them then. But about 2 weeks later(now) as I write this I bought some. Needless to say my mouth is still on fire from 6 hours ago when I tried them. Starting with 1st degree.

The flavor was jalapeno.  Needless to say I am already weak for jalapeno's. So these chips were manageable, but I still had a nice face sweat going on along with the tip of my tongue for some reason burning. You will definitely want to try and finish this bag before continuing your quest of pain. 

Next up is fiery buffalo. Now this one was surprisingly not as bad as the first for me. I was pounding them back as they had a very calm sweetness to them. Then it hit me like a wall of death. There is mad after burn with these chips. It sucks, I thought i was going to die. I drank 4 liters of milk and it still hurt. After accomplishing both 1st and 2nd degree. You have earned to try 3rd. If your not dead yet.

Scorching Habanero. Now I did not have the option of buying these chips as they were out of order. But from what I have read online it was probably best that I did not. The chip bag is red and the chips apparently don't look any different. Each bite is like swallowing razors of heat. When I get the chance to buy these I will write about my trip to the hospital. As I will clearly be there.

To the reader this may have been very exaggerated. Still eat at your own discretion.  Have fun and challenge yourself with these chips. They may be hard to come by in Canada as I had a hard time finding them.

Saturday, 28 May 2011


So i am back for a few days before i head back to work. In my last post i did not mention what i was doing. I was currently finishing off my military boot camp course. The second portion of it. Also known as BMQ Land (Soldier Qualifications). So i will keep this post short, as my writing skill has diminished a little. "BMQ" stands for "Basic Military Qualifications". "Land" means what side of the military I am on. In this case Land is well land and not air or naval.

Course details(what i learned):

M72 Rocket Propelled Grenade (SRAAW (L))
C13 Fragmentation grenade
C9 Light Machine Gun
C6 General Purpose Machine Gun

Platoon Attacks
Section Attacks

Recce Patrols

Offensive and Defensive Operations

How to dig and man a trench and not sleep for a week straight

The last point was the highlight of the course. Now i will display a picture of myself and the killing tools I was trained on.

Thursday, 21 April 2011

Leave of Absence

Hi there fellow views and followers. I am sad to inform you that I will no longer be blogging for the next 3 months. This is mainly due to I need work to pay for school. Now your probably wondering and saying, "well i work and i can blog". This may be true, but for myself I will not have the privilege of internet and computer access.  In my line of work which I will not disclose with you.

On those regards, I shall be returning August 1st or sooner. Thus you can expect to read more programming math related posts around that time. Also for the voting post.

What Language to explain and possibly teach?

Total votes per language:

C: 0
Java: 7
CSS: 0
Javascript: 0
PHP: 2
Other(aka Ruby): 1

So as you can see it is a tie between Java and C++. Thus we need to take into consideration my vote.
I myself would like to learn and teach Java in the process. So in august before my object oriented programming starts. I will be getting a head start by learning java. So this is my last post. Have a good summer.

Tuesday, 19 April 2011

Portal 2

So finally Portal 2 came out. For those who have not even heard of Portal. You have to crawl out of your cave and game it. It has won all sorts of awards and is quite possibly the most original game I have played.

Here is a quick writeup from our good friend Wikipedia.

The game consists primarily of a series of puzzles that must be solved by teleporting the player's character and simple objects using the Aperture Science Handheld Portal Device (ASHPD, also dubbed the "portal gun"), a unit that can create inter-spatial portals between flat planes. The player character, Chell, is challenged by an AI named GLaDOS(Genetic Lifeform and Disk Operating System) to complete each puzzle in the Aperture Science Computer-Aided Enrichment Center using the portal gun with the promise of receiving cake when all the puzzles are completed.

In short summary for anyone who has played. The cake is a lie. This was quite possibly the best game of 2007.

So besides Portal being an awesome game. Such an awesome game as a sequel. Portal 2. Now i have not played the game yet. As i am waiting for my younger brother to get off the Xbox 360, and go to bed which should have been 2 hours ago.  I will soon be playing this game. I am extremely excited and I think after this post i will be kicking my brother off. Oh and obviously I will have to beat it all in one sitting.

The game description on the back of the game case.

The single-player portion of Portal 2 introduces a cast of dynamic new characters, a host of fresh puzzle elements, and a much larger set of devious test chambers. Players will explore never-before-seen areas of the Aperture Science Labs and be reunited with GLaDOS, the occasionally murderous computer companion who guided them through the original game.
The game's two-player cooperative mode features its own entirely separate campaign with a unique story, test chambers, and two new player characters. This new mode forces players to reconsider everything they thought they knew about portals. Success will require them to not just act cooperatively, but to think cooperatively.

Screenshot of one of the game's test chambers, showing the deterioration over the years (plant overgrowth, damaged panels and floors, etc.) Also demonstrates the crazed art left by the "Rat Man" character that reviews the events of the first game.

Monday, 18 April 2011

What Language to explain and possibly teach?

So starting this week, depending on how well comments go. I will be interacting with my fellow followers a bit. I want to see what you my followers want to see me talk about. To do this I will obviously ask you the reader to leave a nice comment/vote to determine what I talk about next. The topics I will be talking about will either be a programming language that i have not explored yet, or one that I am extremely familiar with. So this will be both a fun experience for myself and for the reader. I will hopefully brush up on some programming, or possibly learn a new language or at least better understand a language. I will also be referencing this post in my other posts so that you can get a chance to vote/comment. So I will now lay down the options for you to decide.

******* Please comment with the language you would like me to talk about*********
  1.  C
  2.  C++ 
  3. HTML
  4. CSS
  5. JavaScript
  6. PHP
  7. Java
  8. Other (state what language in comment)
Voting will be over by Wednesday or Thursday. 

 So I look forward to talking about one of these. Also even though school is over for myself. I have always wanted to learn Big "O" in math. So i think I will teach myself that and post it about that sometime.