Sunday, May 30, 2010

Parallel Processing

The simultaneous use of more than one CPU to execute a program. Ideally, parallel processing makes a program run faster because there are more engines (CPUs) running it. In practice, it is often difficult to divide a program in such a way that separate CPUs can execute different portions without interfering with each other.
Most computers have just one CPU, but some models have several. There are even computers with thousands of CPUs. With single-CPU computers, it is possible to perform parallel processing by connecting the computers in a network. However, this type of parallel processing requires very sophisticated software called distributed processing software.

Note that parallel processing differs from multitasking, in which a single CPU executes several programs at once.

Parallel processing is also called parallel computing.

Wednesday, May 26, 2010

This is how you hack your Keyboard to use it in Darkness, Get lights through your keyboard to en-light the keys.

How Search Engines Work


The term "search engine" is often used generically to describe both crawler-based search engines and human-powered directories. These two types of search engines gather their listings in radically different ways.
Crawler-Based Search Engines
Crawler-based search engines, such as Google, create their listings automatically. They "crawl" or "spider" the web, then people search through what they have found.
If you change your web pages, crawler-based search engines eventually find these changes, and that can affect how you are listed. Page titles, body copy and other elements all play a role.
Human-Powered Directories
A human-powered directory, such as the Open Directory, depends on humans for its listings. You submit a short description to the directory for your entire site, or editors write one for sites they review. A search looks for matches only in the descriptions submitted.
Changing your web pages has no effect on your listing. Things that are useful for improving a listing with a search engine have nothing to do with improving a listing in a directory. The only exception is that a good site, with good content, might be more likely to get reviewed for free than a poor site.
"Hybrid Search Engines" Or Mixed Results
In the web's early days, it used to be that a search engine either presented crawler-based results or human-powered listings. Today, it extremely common for both types of results to be presented. Usually, a hybrid search engine will favor one type of listings over another. For example, MSN Search is more likely to present human-powered listings from LookSmart. However, it does also present crawler-based results (as provided by Inktomi), especially for more obscure queries.

The Parts Of A Crawler-Based Search Engine
Crawler-based search engines have three major elements. First is the spider, also called the crawler. The spider visits a web page, reads it, and then follows links to other pages within the site. This is what it means when someone refers to a site being "spidered" or "crawled." The spider returns to the site on a regular basis, such as every month or two, to look for changes.
Everything the spider finds goes into the second part of the search engine, the index. The index, sometimes called the catalog, is like a giant book containing a copy of every web page that the spider finds. If a web page changes, then this book is updated with new information.
Sometimes it can take a while for new pages or changes that the spider finds to be added to the index. Thus, a web page may have been "spidered" but not yet "indexed." Until it is indexed -- added to the index -- it is not available to those searching with the search engine.
Search engine software is the third part of a search engine. This is the program that sifts through the millions of pages recorded in the index to find matches to a search and rank them in order of what it believes is most relevant. You can learn more about how search engine software ranks web pages on the aptly-named How Search Engines Rank Web Pages page.

Major Search Engines: The Same, But Different
All crawler-based search engines have the basic parts described above, but there are differences in how these parts are tuned. That is why the same search on different search engines often produces different results. Some of the significant differences between the major crawler-based search engines are summarized on the Search Engine Features Page. Information on this page has been drawn from the help pages of each search engine, along with knowledge gained from articles, reviews, books, independent research, tips from others and additional information received directly from the various search engines.
Now let's look more about how crawler-based search engine rank the listings that they gather.

Tuesday, May 25, 2010

Cars running on Water


Water Powered Cars or Hydrogen/Oxygen Powered Cars, using 100% water as fuel is real. By splitting water by electrolysis and creating hydrogen/oxygen gas, you can replace gasoline. We have been taught this is impossible! Engineers, scientists and professors may in fact tell tell you you're crazy to believe such non sense. They will also set out to prove you wrong. They base their laws of physics form 1825 thinking. Faraday's laws. Did you know that the first ICE engine ran on hydrogen from water? BMW has them! Hyundai will be making them. Japan endorses them. Many patents, inventions have been bought and there project is shelved, yes it is true. Some of the stubborn inventors who don't sell out disappear. Yes that's right. It happens in the US, Aus, NZ, UK and India. We are in a crunch to find alternative fuels. The pressure is on. War for oil is not the way to go. Talking politics about a hydrogen future that never comes, is not going to help either. Arthur C. Clarke explained how there were four stages in the way scientists react to the development of anything of a revolutionary nature.

1) "It's nonsense,"
2) "It is not important,"
3) "I always said it was a good idea," and
4) "I thought of it first."

If all ICE motors (Internal Combustion Engines) were converted to burn hydrogen and oxygen in the water, as fuel to propel our cars, trucks, semi's etc., we would no longer need gas stations, oil tankers, refineries, SMOG and war. The only problem would be that the large Oil Corporations would go under and SMOG would leave the planet for good. The government is worried that National Securities would be ruptured & it would cause the economy to fall? The Ozone would get healed and we would survive. God will then once again smile down on the Earth, instead of letting the powers to be, destroy it. If we stopped producing SMOG, the ozone and global warming and greenhouse effects would go away.

It is said that the OIL MAFIA has been hiding/preventing this Technology to hit the Limelight.They are said to be stalling future inventions which would curtail the OIL & GAS sales.Whatever may be the Truth,the the ultimate sufferer's the common man himself.What we can do is just pray for the future! 

Monday, May 24, 2010

Scaling and Centering of ID3DXMesh Geometry in DX9

Introduction


Frequently I have received requests for functions that will allow a mesh to be rescaled to fit within specific bounds and/or centered at origin, so I decided to take some time to publish source code to accomplish this task.  It is often necessary to do this when dealing with arbitrary content such as in a mesh viewer, or as a means to verify the validity of imported meshes that may be arbitrarily scaled or offset from origin.  In that context it may also be useful for rescaling mesh geometry so that it can be saved back to a geometry file properly scaled for later use.

Normalizing a Mesh

Rather than scaling the mesh by a fixed amount, the first function that I am going to show here "normalizes" a mesh - that is, it scales the mesh based on the dimensions of the mesh, so that it will fit inside of a bounding sphere of a specified size.  Normalization typically refers to scaling to unit (1.0) dimensions, but in the case of our function we will allow you to specify the final dimensions of the bounding sphere.
Before we can write our mesh normalization function, we will first need a couple of supporting functions, which will allow us to measure the mesh and to apply scaling and offset.

    Measuring the Mesh

Our first function will allow us to compute the bounding sphere of the mesh, by wrapping the D3DXComputeBoundingSphere() function:
HRESULT CalcBounds(ID3DXMesh *pMesh, D3DXVECTOR3 *vCenter, float *radius)
{
 BYTE *ptr=NULL;
 HRESULT hr;

 // return failure if no mesh pointer provided
 if (!pMesh)
  return D3DERR_INVALIDCALL;

 // get the face count
 DWORD numVerts=pMesh->GetNumVertices();

 // get the FVF flags
 DWORD fvfSize=D3DXGetFVFVertexSize(pMesh->GetFVF());  // See DX8 Version

 // lock the vertex buffer
 if (FAILED(hr=pMesh->LockVertexBuffer(0,&ptr)))

  // return on failure
  return hr;

 // compute bounding sphere
 if (FAILED(hr=D3DXComputeBoundingSphere((D3DXVECTOR3 *) ptr, 
      numVerts, 
      fvfSize,   // See DX8 Version
      vCenter, radius )))
  // return on failure
  return hr;

 // unlock the vertex buffer
 if (FAILED(hr=pMesh->UnlockVertexBuffer()))

  // return on failure
  return hr;
  
 // return success to caller
 return S_OK;
}

    Scaling the Mesh

Our next function allows us to scale and offset the vertices of a mesh:
HRESULT ScaleMesh(ID3DXMesh *pMesh, float scale, D3DXVECTOR3 *offset=NULL)
{
 BYTE *ptr=NULL;
 HRESULT hr;
 D3DXVECTOR3 vOff;

 // return failure if no mesh pointer set
 if (!pMesh)
  return D3DERR_INVALIDCALL;

 // select default or specified offset vector
 if (offset)
  vOff=*offset;
 else
  vOff=D3DXVECTOR3(0.0f,0.0f,0.0f);

 // get the face count
 DWORD numVerts=pMesh->GetNumVertices();

 // get the FVF flags
 DWORD fvf=pMesh->GetFVF();

 // calculate vertex size
 DWORD vertSize=D3DXGetFVFVertexSize(fvf);

 // lock the vertex buffer
 if (FAILED(hr=pMesh->LockVertexBuffer(0,&ptr)))
 
  // return on failure
  return hr;

 // loop through the vertices
 for (DWORD i=0;ix*=scale;
  vPtr->y*=scale;
  vPtr->z*=scale;

  // increment pointer to next vertex
  ptr+=vertSize;
 }

 // unlock the vertex buffer
 if (FAILED(hr=pMesh->UnlockVertexBuffer()))

  // return on failure
  return hr;
  
 // return success to caller
 return S_OK;
}

    Our Normalization Function

Finally, we get to our normalization function, which will utilize the two functions we saw above:
  1. First, it will find the bounding sphere of the mesh, as a radius and center.
  2. Next, it will calculate a scaling factor based on the radius calculated and the desired mesh size.
  3. If centering of the mesh is requested, the center will be negated for use as an offset.
  4. The scaling function we wrote will then be called with the calculated scaling factor and offset.
HRESULT NormalizeMesh(ID3DXMesh *pMesh, float scaleTo=1.0f, BOOL bCenter=TRUE)
{
 D3DXVECTOR3 vCenter;
 float radius;
 HRESULT hr;

 // calculate bounds of mesh
 if (FAILED(hr=CalcBounds(pMesh,&vCenter,&radius)))
  return hr;

 // calculate scaling factor
 float scale=scaleTo/radius;

 // calculate offset if centering requested
 D3DXVECTOR3 vOff;
 if (bCenter) 
  vOff=-vCenter;
 else
  vOff=D3DXVECTOR3(0.0f,0.0f,0.0f);

 // scale and offset mesh
 return ScaleMesh(pMesh,scale,&vOff);
}

What is an IP address?


Ethernet cable with ip addresses in background
Hans Joachim Roy/Dreamstime.com
There are 4.3 billion possible combinations of IP addresses.
Every machine on the Internet has a unique identifying number, called an IP Address. A typical IP address looks like this:
  • 216.27.61.137
To make it easier for us humans to remember, IP addresses are normally expressed in decimal format as a "dotted decimal number" like the one above. But computers communicate in binary form. Look at the same IP address in binary:
  • 11011000.00011011.00111101.10001001
The four numbers in an IP address are called octets, because they each have eight positions when viewed in binary form. If you add all the positions together, you get 32, which is why IP addresses are considered 32-bit numbers. Since each of the eight positions can have two different states (1 or 0) the total number of possible combinations per octet is 28 or 256. So each octet can contain any value between 0 and 255. Combine the four octets and you get 232 or a possible 4,294,967,296 unique values!
Out of the almost 4.3 billion possible combinations, certain values are restricted from use as typical IP addresses. For example, the IP address 0.0.0.0 is reserved for the default network and the address 255.255.255.255 is used for broadcasts.
Learn More
The octets serve a purpose other than simply separating the numbers. They are used to create classes of IP addresses that can be assigned to a particular business, government or other entity based on size and need. The octets are split into two sections: Netand Host. The Net section always contains the first octet. It is used to identify the network that a computer belongs to. Host (sometimes referred to as Node) identifies the actual computer on the network. The Host section always contains the last octet. There are five IP classes plus certain special addresses:
  • Default Network - The IP address of 0.0.0.0 is used for the default network.
  • Class A - This class is for very large networks, such as a major international company might have. IP addresses with a first octet from 1 to 126 are part of this class. The other three octets are used to identify each host. This means that there are 126 Class A networks each with 16,777,214 (224 -2) possible hosts for a total of 2,147,483,648 (231) unique IP addresses. Class A networks account for half of the total available IP addresses. In Class A networks, the high order bit value (the very first binary number) in the first octet is always 0.
Net
Host or Node
115.
24.53.107
  • Loopback - The IP address 127.0.0.1 is used as the loopback address. This means that it is used by the host computer to send a message back to itself. It is commonly used for troubleshooting and network testing.

Other IP Classes

  • Class B - Class B is used for medium-sized networks. A good example is a large college campus. IP addresses with a first octet from 128 to 191 are part of this class. Class B addresses also include the second octet as part of the Net identifier. The other two octets are used to identify each host. This means that there are 16,384 (214) Class B networks each with 65,534 (216 -2) possible hosts for a total of 1,073,741,824 (230) unique IP addresses. Class B networks make up a quarter of the total available IP addresses. Class B networks have a first bit value of 1 and a second bit value of 0 in the first octet.
  • Net Host or Node 
    145.24. 53.107 

  • Class C - Class C addresses are commonly used for small to mid-size businesses. IP addresses with a first octet from 192 to 223 are part of this class. Class C addresses also include the second and third octets as part of the Net identifier. The last octet is used to identify each host. This means that there are 2,097,152 (221) Class C networks each with 254 (28 -2) possible hosts for a total of 536,870,912 (229) unique IP addresses. Class C networks make up an eighth of the total available IP addresses. Class C networks have a first bit value of 1, second bit value of 1 and a third bit value of 0 in the first octet.
  • Net Host or Node 
    195.24.53. 107 

  • Class D - Used for multicasts, Class D is slightly different from the first three classes. It has a first bit value of 1, second bit value of 1, third bit value of 1 and fourth bit value of 0. The other 28 bits are used to identify the group of computers the multicast message is intended for. Class D accounts for 1/16th (268,435,456 or 228) of the available IP addresses.
  • Net Host or Node 
    224. 24.53.107 

  • Class E - Class E is used for experimental purposes only. Like Class D, it is different from the first three classes. It has a first bit value of 1, second bit value of 1, third bit value of 1 and fourth bit value of 1. The other 28 bits are used to identify the group of computers the multicast message is intended for. Class E accounts for 1/16th (268,435,456 or 228) of the available IP addresses.
  • Net Host or Node 
    240. 24.53.107 

  • Broadcast - Messages that are intended for all computers on a network are sent asbroadcasts. These messages always use the IP address 255.255.255.255.

Sunday, May 23, 2010

MAXQ61C 16-Bit Microcontroller with Infrared Module


The MAXQ61C is a low-power, 16-bit MAXQ® microcontroller designed for low-power applications including universal remote controls, consumer electronics, and white goods. The device combines a powerful 16-bit RISC microcontroller and integrated peripherals including two universal synchronous/asynchronous receiver-transmitters (USARTs) and an SPI™ master/slave communications port, along with an IR module with carrier frequency generation and flexible port I/O capable of multiplexed keypad control.
The device includes 80KB of ROM memory and 2KB of data SRAM.
For the ultimate in low-power battery-operated performance, the device includes an ultra-low-power stop mode (0.2µA typ). In this mode, the minimum amount of circuitry is powered. Wake-up sources include external interrupts, the power-fail interrupt, and a timer interrupt. The microcontroller runs from a wide 1.70V to 3.6V operating voltage.

Thursday, May 20, 2010

Inside a Computer Mouse (Pointing Device)


Inside a Mouse

The main goal of any mouse is to translate the motion of your hand into signals that the computer can use. Let's take a look inside a track-ball mouse to see how it works:

The guts of a mouse
  1. ball inside the mouse touches the desktop and rolls when the mouse moves.

    The underside of the mouse's logic board: The exposed portion of the ball touches the desktop.
  2. Two rollers inside the mouse touch the ball. One of the rollers is oriented so that it detects motion in the X direction, and the other is oriented 90 degrees to the first roller so it detects motion in the Y direction. When the ball rotates, one or both of these rollers rotate as well. The following image shows the two white rollers on this mouse:

    The rollers that touch the ball and detect X and Y motion
  3. The rollers each connect to a shaft, and the shaft spins a disk with holes in it. When a roller rolls, its shaft and disk spin. The following image shows the disk:

    A typical optical encoding disk: This disk has 36 holes around its outer edge.
  4. On either side of the disk there is an infrared LED and an infrared sensor. The holes in the disk break the beam of light coming from the LED so that the infrared sensor sees pulses of light. The rate of the pulsing is directly related to the speed of the mouse and the distance it travels.

    A close-up of one of the optical encoders that track mouse motion: There is an infrared LED (clear) on one side of the disk and an infrared sensor (red) on the other.
  5. An on-board processor chip reads the pulses from the infrared sensors and turns them into binary data that the computer can understand. The chip sends the binary data to the computer through the mouse's cord.

The logic section of a mouse is dominated by an encoder chip, a small processor that reads the pulses coming from the infrared sensors and turns them into bytes sent to the computer. You can also see the two buttons that detect clicks (on either side of the wire connector).

In this optomechanical arrangement, the disk moves mechanically, and an optical system counts pulses of light. On this mouse, the ball is 21 mm in diameter. The roller is 7 mm in diameter. The encoding disk has 36 holes. So if the mouse moves 25.4 mm (1 inch), the encoder chip detects 41 pulses of light.
You might have noticed that each encoder disk has two infrared LEDs and two infrared sensors, one on each side of the disk (so there are four LED/sensor pairs inside a mouse). This arrangement allows the processor to detect the disk's direction of rotation. There is a piece of plastic with a small, precisely located hole that sits between the encoder disk and each infrared sensor. It is visible in this photo:

A close-up of one of the optical encoders that track mouse motion: Note the piece of plastic between the infrared sensor (red) and the encoding disk.

This piece of plastic provides a window through which the infrared sensor can "see." The window on one side of the disk is located slightly higher than it is on the other -- one-half the height of one of the holes in the encoder disk, to be exact. That difference causes the two infrared sensors to see pulses of light at slightly different times. There are times when one of the sensors will see a pulse of light when the other does not, and vice versa. This page offers a nice explanation of how direction is determined.