Skip to main content

Binary Digits.

Consider the number 783 which can be obtained by:
7 x 102=700
8 x 101= 80
3 x 100= 3
78310 Total= 78310

In the decimal system, we are counting how many 10s, 100s, 1000s, 10000s etc. there are. Then we are multiplying the number depending on where it is positioned, and finally, we add them up.

If we were to do the same to the 8th base, then the above table will look as follows:

1 x 83=512
4 x 82=216
6 x 81=48
7 x 80=7
14678 Total= 78310

Now the number 78310 ~= 14678. This means that any number (like 783) can be written to any number base; even its own. So in computers we are interested in binary digits, as the switches in circuits are either ON or OFF. With this in mind, the number above (783) would be written in binary form as follows:


1 x 29=512
1 x 28=256
0 x27=0
0 x 26=0
0 x 25=0
0 x 24=0
1 x23=8
1 x22=4
1 x21=2
1 x 20=1
11000011112 Total= 78310


This means that:
11000011112 ~=78310

Here is a sequence that may simplify this process a bit better:

20 = 1 = 12
21 = 2 = 102
22 = 4 = 1002
23 = 8 = 10002
24 = 16 = 100002
25 = 32 = 1000002
26 = 64 = 10000002
24 = 128 = 100000002
and so on...

So now, gifting somebody $32.00 in decimal form will be written in binary as $100,0002 and giving $64.00 = $1,000,0002 which is a LOT OF MONEY... :).

As the joke goes: There are 10 kinds of people, the kind that understand binary numbers and those who do not.

Comments

fair said…
Absolutley brilliant. It is refreshing to see such creative and mindful thinking in action.

Popular posts from this blog

Hibernate-Secondary Table Annotation..

When using Hibernate with annotation, SecondaryTable needs to be used carefully while using the Discriminator. We assume that there is a table called Inventory which is the parent table that has common elements including Id, createDate, modifiedDate, SKU#, and productType.
The other tables, which are children of the Inventory table, are TV_Inventory, DVD_inventory etc.. In this example, we consider TV_Inventory which inherits from Inventory (in terms of objects).

@Entity
@Table(name = "INVENTORY")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "PRODUCT_TYPE", discriminatorType = DiscriminatorType.STRING, length = 20)
@SequenceGenerator(name = "InventorySequence", sequenceName = "INV_SEQ", allocationSize = 1)



public abstract class Inventory {
 // getters and setters with other annotations for the columns and relevant methods.
}

Consider the child object associated with the table TV_INVENTORY. The outline is shown below:

@…

Single Sign On - SSO

Single Sign On (SSO) is the ability of the user to login into his/her system or network and have access to all the applications which he is authorized to under the Lightweight Directory Access Protocol (LDAP). Another good definition is given on this page .A website with many links to SSO is defined here.

  What is Authentication?
         Authentication is the process of verifying or validating the user and password against some security processes.

   What is Authorization?
         Authorization is granting access (roles) to each user for a specific application.

Consider a company of say ten employees which contains an accounting system and a human resources system. Each user is authenticated and authorized on the company network to access public folders, intra-net, and possibly webmail.

However, only the HR department is authorized to access the HR system. Similarly, the Accounting department is authorized to access the accounting system. There is also a possibility that certai…

Databases - Introduction

Database
In the information age (which started in 1940 or so when the US census used the first computer), a database is referred to as a silo of information which has data stored in a particular way. This makes stored data relevant to employees in order to make business decisions. Databases are a specific type of model. Models are any storage repository (server) which stores data whether it is a relational database, object-oriented database, flat or just files.

In this article, we confine ourselves to relational databases like MySQL, MS SQLServer20xx, Oracle, Sybase, MS Access and HSQLDB. These are the most common relational databases currently in use.

Non-Relational Databases
Before we move onto relational databases we will first discuss non-relational ones. These demanded a lot of sort to find code by programmers in order to retrieve the data to the users. Consider the US phone book and the number 307-456-7892. In order to search the phone book to retrieve who is associated to this …