Showing posts with label computers. Show all posts
Showing posts with label computers. Show all posts

Wednesday, March 3, 2010

Counting in bases: How to count in binary, hexadecimal, and more!

Awhile ago, I posted a tutorial explaining to someone how to count in hexadecimal. I've edited the tutorial a bit and am now posting the superior version exclusively on my blog. Enjoy!

The first step to understanding bases is figure out what base a number is part of. To do that, count how many numbers are in that number's number system.

  • Binary only has 2 characters in it: 0 and 1. Thus, binary is referred to as being a base 2 number system.
  • Our Decimal system has 10 characters in it: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Thus, our decimal system is referred to as being in base 10.
  • Hexadecimal has 16 characters in it: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Thus, hexadecimal is a base 16 number system.

If a number is not written in base 10 (Decimal), it should have a subscript saying what base it is in. Example: Binary should be written like this: 1010101011101002

Do you remember how they taught you to add in grammar (elementary for Americans like me) school? You used columns like the ones, tens, hundreds, thousands, etc. column. Like when you had a problem like the one below:
19
+3
-----
22

You were taught to add a one to the tens column after you exceeded the value of nine in the ones column. (You were also taught to add a one to the hundreds column after you exceeded a value of 9 in the tens column and so on and so forth). If you had for example, a 2 in the the ten;s column wit would have a value of 10 because 10*2=20. Likewise, that 9 in the example above has a value of 9 because 9*1=9. I guess you could say Number*ColumnValue=TrueValue. Most importantly, what I'm trying to do here is jog your memory of that 'columns system'.

Now consider this: How do you think the value of each column was determined?

The value of each column was determined by taking the base number (10 in our decimal system) and giving it an exponent of the column placement. Remember you move from right to left when doing this. Thus, the first column was the ones column because 10^0 is 1. The second column the tens column because 10^1 is 10. The third column the hundreds column because 10^2 is 100.

Now this column system I've finished fully describing applies to any base, just change the base number. So for binary (base 2), the first column is the one's column because 2^0 is 1. The second column is the two's column because 2^1 is 2. The third column is the four's column because 2^2 is 4. The fourth column is the eight's column because 2^3 is 8.

11112 (binary) is equivalent to 15 in decimal because (1*1)+(1*2)+(1*4)+(1*8)=15.

For hexadecimal (base 16) this application works the same way. The only thing that throws some people off about hexadecimal is the letters. Here's the hexadecimal to decimal conversion for them:
Hex -> Decimal
A         10
B         11
C         12
D         13
E         14
F         15
Before I move on with my lesson I want to point something out quick that's in huge relevance to digital circuitry and programming. The max value for one character of hex is 15. Thus, any one character in hex is equivalent to 4 characters in binary. If you don't fully understand why, take a look at that 1111 in base 2 equals 15 in base 10 example above again. Each binary character is actually called a bit in technological vernacular and each hex character is called a nibble. Two hex characters next to each other (AB for example) is called a byte.

So now, finally, let's calculate the decimal value of a hexadecimal (base 16) number:

A35D16

First let's figure out the column values (Remember, we're working from right to left):
16^0 is 1 so the first column on the right is the one's column. The column next to it on the left is then the sixteens column. Then the two-hundred-fifty-six's column. Lastly on the far left we have the four-thousand-ninety-six's column.

So let's add it up:
(10*4096)+(3*256)+(5*16)+(13*1)=41821

If you understand all of this, you should now be able to count in any base be it base 2 binary, base 16 hex, or base 398 (whatever that's called). If not, read over the tutorial. I've truly made this as short and sweet as possible. Good luck :-)

If you have any questions regarding the content of this post, feel free to leave a comment, join me in #arikadosblog on EFNET, post in our forums, tweet to me, or send me an e-mail at castlevania7689@yahoo.com.

Saturday, November 7, 2009

Googlecode SVN and Tortoise Tutorial

Ever since I set-up two svns of my own on googlecode, I've recieved a ton of questions about SVNs and how to use them ranging from the most basic to the most complex. I apologize that I haven't been able to individually respond the unprecedented amount of messages I've recieved, so this post will aim to be a rather lengthresponse to all of them. So lets get started shall we?

What is an SVN?
"Subversion is a free/open-source version control system. That is, Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine”."--svnbook

In my own words, think of an SVN as a landfill. Every now and then the garbage trucks (coders) come in and dump their garbage into the landfill. At any point, anyone can visit the landfill and view the garbage that was dropped off at any day. If they want to, they can even take an exact copy of any of the garbage home with them. Thus, people can compare garbage dropped off at different days and seek to understand why the garbage one day is different than the day before it, or attempt to improve the garbage collection by adding some garbage of their own to produce a more ripe smell. Now think of the garbage as code and you'll figure out the picture of what an SVN is supposed to do. 

Why Googlecode?
Because  Googlecode securely hosts your SVN online for free for the world to view. Googlecode also allows you to have a wiki and an issue tracker for you project to help you help your fans and maintain your code respectively.

How do I access/use an SVN?
You use an SVN by performing basic commands upon it which I will cover here. Generally, people use an SVN client, or a computer program to perform these SVN commands for them. The two most popular are RapidSVN and Tortoise SVN.

Import: Upload a new project to an SVN
Commit: Upload new versions of existing files onto an SVN
Add: Add a file to an SVN
Delete: Remove a file from an SVN
Checkout: Download an entire SVN

Why Tortoise?

Most SVN clients are command line programs. In colloquial terms, this means that they require you input long strings of text into an ugly console window to get something to work. Tortoise is a nice looking shell extension. This means that you can perform basic SVN maintenance by simply right-clicking.

And finally, a tutorial on how to set-up and run your own SVN with Googlcode and Tortoise:
1)Create an account with Googlecode

2)Create an SVN on Googlecode on the create project page. Be sure to use a subversion set-up instead of a mercucial one.

3)Install Tortoise SVN

4)Right-click on the main folder for the project you want to upload to your SVN and select import

5)You will be prompted to enter some information. Your username is your Googlecode account name and your password is the security code found in your Googlecode profile settings.

6)Delete your project from your computer

7)Right-click and checkout your SVN

8)From now on, right-click your project's main folder and commit after you make any changes to your project to upload a new revision of your project to the SVN.

9)Stop reading this guide. Your done. Congratulations!!!

Sunday, October 25, 2009

Dual and Multi Boot Operating Systems

Did you know it's possible to have more than one operating system installed on your computer? In fact, some people have three or even more operating systems installed. Having two operating systems installed on your computer is called having a dual boot operating system. Having more than two operating systems installed on your computer is called having a multi boot operating system.

There are many advantages to having more than one operating system installed on your computer.

Foremost, it makes your computer compatible with a wider variety of programs. Since computer programs only work on the operating system they were compiled for, having another operating system ready to go means that you can launch a lot more computer programs than you could without one.

Another advantage to having more than one operating system installed is security (also called "insurance" by some people). Should something ever happen to one of your operating systems, it's possible that you may be able to use one of your other operating systems to fix whatever went wrong with your broken operating system. For example, you could use a Linux operating system to fix a corrupted file preventing a Windows or MAC operating system from launching.

Before I go any further with this post, I wanted to quickly point out that it is possible to have multiple versions of an operating system installed on any computer. For example, you can have Windows Vista and Windows XP and Windows 7 all installed on the same machine. Likewise, you can do the same with different versions of MAC or Linux operating systems if you wish to.

Installing another operating system is as simple as installing your first operating system. You run the operating system installer (which is usually a disc you put into your computer before turning your computer on) and tell the install to install your designated operating system into partitioned space not used by any other operating system. For example, your Windows 7  installation takes up a partition of 250GB on your 500GB hardrive so you choose to install Ubuntu Linux on a partition of 100GB of the remaining 250GB. From then on, every time you turn on your computer, you'll be asked which operating system you'd like to boot into.

Friday, October 23, 2009

A Basic Explanation of Operating Systems

Computer hardware is important and all, but everyone knows that operating systems are the most essential piece of a computer. A computer operating system is the main piece of software that runs a computer. The purpose of an operating system is to let you launch and use programs on your computer. Generally, operating systems come with their own set of programs already installed so you can browse the internet, explore your file system, and play media files from the get-go.

The three most widely used operating systems (which I'll cover in more detail later in this post) are:
  • Windows
  • MAC
  • Linux
Windows is a commercial operating system created by the Microsoft corporation which can be installed on any computer. Windows comes with a ton of popular programs including Microsoft Works, Internet Explorer, and Windows Media Player. Windows is drastically the most expensive operating system, but it's users will argue that the steep price is more than worth it. The latest version of the Windows operating system is Windows 7.

MAC is a commercial operating system developed by Apple. MAC operating systems are unique in that they can only be installed on computers manufactured and condoned by Apple. MAC operating systems come supplied with an unrivaled set of photo and video editing software. MAC users tend to argue that the monopolistic hardware situation is worth the cheaper price and the MAC operating system. Most interesting about the MAC platform (for programmers only, really) is that MAC computers come with an SDK which allows people to develop for any device (including iPhone) that's part of the MAC platform. The latest version of the MAC operating system is MAC OS X.

Linux is a free, open source operating system core. Developers then use the core to create their own distributions (also known as versions or distros) of the linux operating system. The two most popular distros are Ubuntu and Arch. Because linux operating systems are free, they can save you a signifigant chunk of money when you are building your own PC. Many people say that the linux operating systems rival and in many cases even surpass the quality of the commercial operating systems.

Every computer needs an operating system to perfrom the most rudimentary tasks and we are fortunate to live at a time with so many different choices of operating systems.

Monday, October 19, 2009

A Very Basic Explanation of how Computers Work

The computer is easily the most important object in the modern day. Whether it's a PC, MAC, iPod, Nintendo Wii, or even a PS3, all computers operate in the same manner. Unfortunately, the average consumer doesn't understand even the purpose of the most basic components of a computer. So with the new computer and laptop model releases right around the corner (I'm picking up my first computer in less than a week!!!) I figured it would be appropriate for me to write out a very basic explanation of how every computer works.

While writing this, I'm going to keep two very important things in mind. First, long explanations are boring and unnecessary. Second, I need to write from the point of view of someone who knows absolutely nothing about computers. So let's get to it!

All computers are made up of the same basic components which interact with one another to perform the overall function of making the computer work. These parts are:
  • The motherboard
  • The processor
  • The RAM
  • The hard drive
  • The video and sound cards
The motherboard is the main or central part of all computers. Every part of the computer is connected to the motherboard in some way. Motherboards determine what type of processor you can have as well as what and how many inputs (USB, PS2 ports etc.) you can have on your computer.

The processor is the "brain" of the computer. The processor reads and executes all of the code it receives. The faster your processor is, the faster things happens. The more cores your processor has, the more information it can simultaneously process (again, the faster it can go).

The random access memory (RAM) of a computer temporarily holds information the computer needs. For example, your computer's RAM is currently holding your entire internet browser. While information is held in the RAM, the processor can more quickly access it. My dad has a simple explanation of why more RAM is better which I'll quote here: "The more RAM your computer has, the more computer programs you can have running at a good speed at once."

The hard drive is the storage unit of the computer. All of your save files, mp3s, videos, and pictures are stored on the hard drive to be accessed when the computer wants them (ie: When you tell the computer to get them)

The video and sound cards of a computer are parts that output video and sound signals to the monitor and speakers respectively.

All of these different parts work in unison in every computer to provide a user friendly experience. This explanation was aimed at being an extremely simple "ground level" explanation of how computers work so everyone is starting at the same the level for when I get more into how computers work later.