Archive for the ‘Uncategorized’ Category

Computer Math Part 5: Octal

Monday, June 23rd, 2008

Octal, or base-8, is commonly used in Unix style operating systems. This number system, being base-8, uses digits 0-7. It’s easily translated to binary, but hex and decimal are a little harder.

Each digit in octal is 3 digits in binary, so 08 is 0002, 18 is 0012, … 78 is 1112. Because it is simple to convert octal to binary, I would suggest that you convert octal to binary and then to decimal or hex.

Unix style operating systems use octal to define file permissions. Each file has a 3 octal digit code. The first digit defines the user’s permissions. The second defines the group’s permissions. The final digit defines everyone else’s permissions.

These permissions are based in binary. The first digit is to allow reading of the file. The second digit is to allow writing to the file. The third digit is to allow execution of the file.

A file with permissions of 777 allows everyone to do everything, while 664 allows the owner and group to read and write, but everyone else only gets to read the file.

Check back Wednesday for a discussion of binary truth tables.

Home work:

Convert the following from octal to decimal:
7778
3778
6648
12345678
76543218
1118

Computer Math, Part 4: Hexadecimal

Wednesday, June 11th, 2008

Now that you understand binary, let’s move onto hexadecimal, or base 16. This is the numbering system most programmers use, because it translates easily to and from binary. Also, 2 hexadecimal digits make up a byte, or 8 bits.

How do we have 16 digits? Simple, hexadecimal uses the digits 0-9 and the letter A-F. 0-9 is the same in hexadecimal as decimal. The digits A-F in hexadecimal are 10-15 in decimal. Here is a conversion chart of single digit hexadecimal:

Hexadecimal Binary Decimal
016 02 010
116 12 110
216 102 210
316 112 310
416 1002 410
516 1012 510
616 1102 610
716 1112 710
816 10002 810
916 10012 910
A16 10102 1010
B16 10112 1110
C16 11002 1210
D16 11012 1310
E16 11102 1410
F16 11112 1510

Hexadecimal, sometimes simply called hex, is very easy to translate to and from binary. This is because each digit in hex is 4 digits in binary. All you have to do is replace the hexadecimal digit with the binary equivalent. For instance, the number FF16 is 111111112.

Converting a binary number to hex works just slightly different. When you convert a number from hex to binary, you can work from left to right or right to left. When you convert a number from binary to hex, you must work from right to left. This is because a binary number might not be the correct length to work from left to right.

That’s all for today, check back Friday for Octal, or base 8. Here’s some homework:

Convert the following hexadecimal numbers to binary and decimal:
A216
FFFFFF16
10016
CCCCCC16
A2B16
FA6F16
12316
32116
100016
1000016

Computer Math Part 3: Adding Binary numbers

Monday, June 9th, 2008

Since it is Monday, I won’t ask you to think too much today. Adding binary numbers is actually easier than adding decimal numbers, if you can believe that.

Here’s how to do it. Write 210 binary numbers down, say 11112 and 1112. Make sure to align them on the right, same as you would to add decimal numbers. This should be on your paper/notepad:

 1111
+ 111

Starting from the right, add the first two digits. 12 + 12 is 102, so write 0 as the right most digit and carry the 1.

Moving on to the next digit, 12 + 12 + 12(carried) = 112, or 310, so write 1 as the next digit and carry the 1.

Third digit is the exact same. 12 + 12 + 12(carried) = 112, or 310, so write 1 as the next digit and carry the 1.

For the Forth digit, 12 + 12(carried) is 102, so write 0 as the right most digit and carry the 1. Drop down the carry, because 1 + 0 is 1 no matter what base you are working with. There’s the answer.

 1111
+ 111
-----
10110

Checking the solution is as simple as opening Windows calculator. If you’re not in scientific view, switch to it from the view menu. Select “Bin” for binary mode. Then put in the math problem, same as any other. Now that you know about calculator, try not using it.

Vocab: A digit in binary can be refered to as a bit, so 64-bit, means 64 binary digits.

Homework:

Create 8 or 9 random binary addition problems. If you want to make it hard, write out 64 digits, or bits, for each binary number.

Computer Math Part 2: Converting Decimal to/from Binary

Friday, June 6th, 2008

Wednesday, I discussed the very basics of binary and how to count, or increment, in binary. Today I’ll be discussing converting decimal numbers to and from binary numbers.

Before I cover conversion, let’s talk for a second about bases. That’s what this series boils down to. I’m not talking about military bases, but number bases. Binary is base 2, meaning that there are 2 digits. Because decimal uses 10 digits, it is base 10.

When a number is of a certain base, you denote that by putting a subscripted 2, or 10, immediately after the number. So 1002 means 100 in binary, while 10010 means 100 in decimal. If you don’t fully grasp this, I’m sure you will once you finish the exercises for today.

So, we all know that 12 is 110, but what does 102 equal in base 10? It’s 210. Check out this chart:

Binary Decimal
12 110
102 210
1002 410
10002 810
100002 1610
1000002 3210
10000002 6410
100000002 12810
1000000002 25610

For every extra zero on the binary side, the decimal side doubles. This is because binary is base 2. You can say that, counting from the right in binary, each digit placement is worth double the previous.

You can use this chart to convert a binary number to a decimal number. For every 1, add the decimal equivilent. For instance, the number 1112 is 110 + 210 + 410 which is 710. Another example is 10012, which is 810 + 110, or 9.

OK, converting binary to decimal is the easier part for today. On to converting decimal to binary. You do pretty much the same thing as converting binary to decimal, but in reverse. The first step is to grab a scrap piece of paper, or open notepad.

To walk through the process, I’ll convert 10510 to binary. The first step is to find the decimal number in the chart that is closest to 10510 without going over, which is 6410. 6410 is 10000002, so write that binary number on the first line. The second step is to subtract 6410 from 10510, which is 4110.

Then we repeat. So, 3210, or 1000002, is the next number. Write 1000002 on the second line, making sure to line up the numbers on the right side, same as you would for decimal. Then subtract 3210 from 4110, which is 910.

Then we repeat. So, 810, or 10002, is the next number. Write 10002 on the second line, making sure to line up the numbers on the right side, same as you would for decimal. Then subtract 810 from 910, which is 110.

Then we repeat. So, 110, or 12, is the next number. Write 12 on the second line, making sure to line up the numbers on the right side, same as you would for decimal. Then subtract 110 from 110, which is 010.
Because, we have reached zero, we can move on the last step. On your paper/notepad should be:

1000000
100000
1000
1

All you have to do is combine these. Starting on the left, any column that has a 1 in it, write a 1, or if the column only has zeros, write a 0. This yeilds: 11010012. Converting this back to decimal will let you know you did it right.

Homework:

Convert the following binary numbers to decimal:
1001
1101
10
10000011
10101010
10110010
100011

Convert the following decimal numbers to binary:
37
123
251
6
192
168
68

Remember to convert it back to check your work. Check back Monday when I’ll discuss adding binary numbers.

Computer Math

Wednesday, June 4th, 2008

Usually when people think of what goes on inside a computer, they think of little ones and zeros zipping around their own tiny raceway at the speed of light. For the most part, that’s correct. Today, I’ll discuss what binary numbers are.

Binary is simply a number system that only has two digits, 0 and 1. The number system that we are taught all throughout school is decimal, which has ten digits, 0 thru 9. There are other number systems that are used when working with computers as well; hexadecimal uses 16 digits, 0-9 and the letters a-f, while octal uses eight digits, 0-7. Any whole number can be easily represented in any of these numbering systems.

Here’s the binary equivalent of the decimal numbers 0-10:

Decimal 0 1 2 3 4 5 6 7 8 9 10
Binary 0 1 10 11 100 101 110 111 1000 1001 1010

You may notice that in binary, 1 + 1 = 10. That’s because you have to carry the 1, just like 1 + 9 = 10 in decimal. Once you can wrap your mind around this, you’ll be on your way to understanding binary. Like everything else in life, it just takes time and practice.

Below are some binary numbers to increase by 1:
1001
1000001001001
11111
111000
10101110
101001

Try to add 1 to each of those numbers, if you find it difficult, then re-read the post and try again. If you find it easy, try to count from 1 to 100000000 in binary. BTW, 100000000 is only 256 in decimal.

Check back in a few days for the next part in the series: conversion from decimal to binary and back to decimal.

How I got started programming

Friday, May 2nd, 2008

In the summer of 1987, when I was 7 years old, my uncle gave my family a computer. It was a Commodore 64. He also gave us a lot of programming magazines. These magazines had full programs ready for use, all we had to do was type them in. My brother did most of that kind of thing, he was 15 at the time.

I knew how to enter a program and load and run a program almost instantly. Programming, on the other hand came very slowly. I was constructing my own programs by the age of 8. I started to work on a Monopoly program, but it never came into fruition. I got to the point where the board would be displayed and the dice would roll random numbers, but never got any further.

I wrote other little programs, most of which I cannot recall any more. I do recall fixing my brother’s program once. He was enrolled in a computer course at a local college. He was writing a small program that rolled a die, but the die always rolled in the same sequence. He forgot one line of code that gave the random number generator a seed. A random number generator needs a seed, normally set to the time, to generate different results each time the program is run.

In late 1992, my parents purchased an AST 486DX computer. It cost over $2000, a big change from today’s computer prices. I quickly found the program to run custom programs and off I went to create more programs, most of which I do not recall, but still have backups of somewhere. Hey, 16 years is a long time and things get shuffled around too much to keep up.

That is, in a nutshell, how I got started programming. When I started, I knew that was my calling. I am thrilled to have a programming job now. It took me a while, but here I am.

One of the things I love about computer programming is that it is an always changing field. There is always something new to learn, every day. I would just like to thank my uncle for showing me the door. Without that, I would probably be in a completely different field of work.

5 Free Ways to Speed Up Your Computer

Friday, April 25th, 2008

There are many ways to make your computer faster. Many approaches requires money, but that leaves plenty of ways to speed up your computer without spending a dime. I’ll go over 5 ways right here, right now.

1. Uninstall Norton!

Norton Anti-virus and Internet Security clows down your computer a lot. Instead, use AVG free edition. It uses far less resources, thus your computer runs faster. My sister-in-law turned me onto this anti virus a few years ago and I recommend it for anyone.

When you uninstall Norton, make sure to remove the various programs in a specific order. First, you should uninstall the anti-virus and internet security. After a reboot, uninstall LiveUpdate and reboot again. Now, simply go to download.com and search for “avg free” and download & install. Note: ignore the sponsors.

2. Kill the programs in your systray, by the clock.

If you have more than 2 or 3 icons in the systray, this will help immensely. Run the program “msconfig” from Start->Run… This will bring up the system configuration. We’re only interested in what is in the Startup tab.
Uncheck everything under the startup tab, then put a check for your anti virus. If you have AVG, those programs will have ‘avg’ in their name. Click OK and reboot. Your computer should run at least 10%, up to 75%, faster now.

3. Set your browser’s home page.

Does your browser, Internet Explorer or Firefox, take forever to load? Part of the problem might be your home page. If your home page is big and lengthy, the process of downloading and rendering the page could add upwards of 15 seconds to your browser’s load time.

You have several options available. One is to set your browser’s home page to something that is relatively quick to load, like Google.com. Another option is to set it to use a blank page.

4. Change the performance options.

This is something most people don’t know exists. If you’re fine with XP looking like Windows 98, this fix is for you. Sorry Vista users, I have not used Vista, so I don’t know how to do this with Vista. If someone figures it out, please leave a comment.

To make this change, right click on ‘My Computer’ and click on properties. Under the ‘Advanced’ tab, click on ‘Settings’ under ‘Performance’. In the window that pops up, choose ‘Adjust for best performance’ then click OK. You computer will stop responding for up to 10 seconds and will come back a lot quicker. Do a reboot to finish this fix.

5. Sort out your Start Menu.

Do you have multiple columns in your Programs menu from the Start button? If so, that could be slowing down your computer every time you open that menu. Sorting the menu down to 1 column can save you time two fold. You programs will be organized and easier to find and you computer will load and render the menu much faster.

This sorting can be somewhat complicated, mainly because Windows gives each user their own Programs folder and a centralized Programs folder for all users. Each user will see the blending of the centralized and personalized Programs folder. If there is only 1 login for the computer or each user should have access to all the programs installed, you can just put everything in the centralized location (2 Steps). If this isn’t the case, you’ll have to figure out which programs are needed by which user and which programs are needed by all the users(3 Steps).

Step 1: Consolidate the Programs menu

To sort the menu, right click on the Start button and click on Explore. This brings up your Programs menu folder. To copy everything to the central location, double click on programs, select all the folders & files, and cut. Now on the left pane with all the folders, click the plus next to ‘All Users’ then the plus next to ‘Start Menu’. Click on the Programs folder under that. Now paste.

Step 2: Sort the menu

Now that everything is in the central location, create a folder called “Internet”. You can find the individual programs and drag them into this new folder or you can drag folders into this folder. Just repeat this process until you are happy with your start menu.

Step 3: Personalize the start menu

This step is only required if you want to limit the programs available to certain users. Each user, or login, to the computer has a folder under ‘Documents and Settings’. Under each user’s folder, there is a Start Menu folder. If you want user x, and no one else, to have quick access to a certain program just cut and paste that program from the central, ‘All Users’, into that user’s start menu. If you want user x and user y to have access, just copy and paste instead.

Now that your computer is running faster, you’ll probably be more productive, if you don’t just play games that is. As always, if you have any questions, please leave a comment.

Click Happy? Be Careful!

Thursday, April 17th, 2008

Some people are click happy. They click on ads, off-site links, and things they shouldn’t click. Are you one of those people? If so, here are some guidelines to keep your information and your computer safe.

The majority of sites on the internet, this site is no exception, use ads to offset the time and money put into the site. Sometimes the ads are labeled. Sometimes they aren’t labeled. An easy way to find out is to run your mouse over them and look in the status bar. If the status bar starts the same as the address bar, you’re pretty safe that it’s not an ad.

Don’t get me wrong, ads can be quite useful. Personally, I would never click on an ad unless I knew it was a google ad or knew the site was reputable. When I say reputable, I mean an organization or person who filters the ads, such as <a href=”http://www.thesimpledollar.com/”>The Simple Dollar</a>.

Those listing at the top of search results are hardly ever what you need, but when they are you should use those. The listings at the very top are paid for, and clicking on them helps the search engine to earn some much needed money.

Finally, there are plenty of malicious sites out there. They want you to visit their site using IE6 pre-XPSP2, if you don’t have SP2 DOWNLOAD IT NOW. When you do, they install software that tracks your every click and keystroke. It’s pretty scary if you ask me. I wouldn’t want someone to know my login information for <a href=”http://www.amazon.com”>Amazon</a> or much less <a href=”http://www.paypal.com/”>PayPal</a> or <a href=”http://www.wachovia.com/”>Wachovia</a>.
Just do as FOX says, and PAUSE. If you do this enough, you’ll find yourself checking to see where you are and where you are going on the internet. Not only will your computer be happier, you will feel more secure in your computer usage.

Note: I put all these links in this post to show you what your status bar will say when you run your mouse over them. All sites linked from this site are reputable. I would never subject any of my readers to malicious sites.