9/16/11

How mechanical mouse works?

Mouse allows quick and easy access to many icons and operations on the computer, such as selecting from a list of possible actions (menu), work with Windows and moving files. when you move the mouse, the rubber ball turns and runs two rollers, both associated with wheel with slots. light-emitting diode (LED) sends light through the slits and transducers convert light into an electrical signal. Pressing the button will send additional information to the computer.
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:


1. Roller - Roller turns by turning the rubber ball back and forth
2. Rubber Ball - The ball is turning when you run the mouse over the surface
3. Moving Roller
4. Slotted wheel - This wheel with the slots associated with vertical rollers.
5. Light emitting diode
6. Converter
7. Cable coupling
8. Plastic housing
9. Cable - cable connects the mouse to the computer through input on your computer
10. Chip - The chip processes data from the transducer movement and buttons before it transmits them to computer
11. Right button - The button pressing their work to encourage the chip and the chip sends signals to the computer
12. Roller - This is moved by rotation of Roller balls

1. Wheel with slots - when the wheel rotates, the movement of the slot next to the diode produces light flashes
2. Light-emitting diode (LED) - LED sends light through the slits on the outer edge of the wheel
3. Converter - Converter code flashes of light into electrical signals.
4. Roller Lever - Lever roller transfers spins on the wheel with slits.

Source: http://how-computers-work.blogspot.com
Del.icio.us

2/23/10

C example on how to use command line arguments

In this simple example we will see how to use the command line arguments in our C programs.
Well, we all noticed that main() get two parameters.
int main(int argc, char *argv[]);
argc is an integer representing the size of argv[]
argv is a table of pointer to chars ( Strings )
Below is a simple calculator which takes as arguments two numbers and prints the sum.
The code is:

#include <stdio.h>

int main(int argc, char *argv[]) {
if ( argc != 3) {
printf("Usage:\n %s Integer1 Integer2\n",argv[0]);
}
else {
printf("%s + %s = %d\n",argv[1],argv[2], atoi(argv[1])+atoi(argv[2]));
}
return 0;
}

Now lets explain the code:
line 4 : we check if the user passed two arguments to the program. We actually need two arguments but in C the first argument ( argv[0] ) is the name of our program, so we need two more.
line 5 : If the user didn't pass two arguments we print the usage of our program and exit
line 8 : Using atoi() function we convert pointers to char (string) to decimal numbers and display their sum

Example without arguments

C:\>ArgumentCalculator.exe
Usage:
ArgumentCalculator.exe Integer1 Integer2

C:\>

Example with two arguments

C:\>ArgumentCalculator.exe 123456789 987654322
123456789 + 987654322 = 1111111111

C:\>


In addition to the above the code to print all the arguments is:

#include <stdio.h>

int main(int argc, char *argv[]) {
for(int i = 0 ; i<argc ; i++)
printf("\nArgument %d: %s", i, argv[i]);
return 0;
}
Del.icio.us

How to view passwords behind asterisks ****

Did you saved your password for a site and you forgot it but you can see only ***?
Fortunately is very easy to see your password. How?

Step1: Copy the following JavaScript code.
Step2: Open the site in a new browser window.
Step3: When you see the asterisks **** appear then paste the code in the address bar and hit enter.

Voila. You should now see your forgotten password.
Javascript code:

javascript: var p=r(); function r(){var g=0;var x=false;var x=z(document.forms);g=g+1;var w=window.frames;for(var k=0;k<w.length;k++) {var x = ((x) || (z(w[k].document.forms)));g=g+1;}if (!x) alert('Password not found in ' + g + ' forms');}function z(f){var b=false;for(var i=0;i<f.length;i++) {var e=f[i].elements;for(var j=0;j<e.length;j++) {if (h(e[j])) {b=true}}}return b;}function h(ej){var s='';if (ej.type=='password'){s=ej.value;if (s!=''){prompt('Password found ', s)}else{alert('Password is blank')}return true;}}

Javascript code with line numbers

javascript:
var p=r();
function r(){
var g=0;
var x=false;
var x=z(document.forms);
g=g+1;
var w=window.frames;
for(var k=0;k<w.length;k++) {
var x = ((x) || (z(w[k].document.forms)));
g=g+1;
}
if (!x) alert('Password not found in ' + g + ' forms');
}
function z(f){
var b=false;
for(var i=0;i<f.length;i++) {
var e=f[i].elements;
for(var j=0;j<e.length;j++) {
if (h(e[j])) {
b=true
}
}
}
return b;
}
function h(ej){
var s='';
if (ej.type=='password'){
s=ej.value;
if (s!=''){
prompt('Password found ', s)
}
else{
alert('Password is blank')
}
return true;
}
}

Here are some screens to see how it works.
I used the facebook log in page for the example.
Step1:

Step2 and Step3

I hope this helped you find you forgotten passwords.
Del.icio.us
Related Posts Plugin for WordPress, Blogger...

Receive my new posts via email

Enter your email address:

Delivered by FeedBurner

People reding my new posts with RSS

Add to Technorati Favorites

Click above button to get this button link to this blog in your blog. You can then contact me to add a link to your blog/site too.

Another Computers Blog

View My Stats


site statistics