Computer Science Tips & Tricks
As soon as humans domesticated animals and started to carry on trade with others, they needed to keep track of numbers. First, people used their fingers. Then they used notches on sticks, counting stones, and even knots tied in ropes. The abacus an elementary computing device evolved in different cultures at about the same time. The Babbage's difference engine that uses mechanical memory. The ENIAC then EDVAC that were used for scientific and military applications only. Computer technology has evolved so fast the past 50 years that a whole CPU can be put on one single ship. In the past computer engineers were the only ones who could operate a computer. Today, users don't have to know any thing about computer science to operate the computer.
This page is intended to make computer science lovers and any one who study computer in any way more interested in the subject. Here they can find tricks that they can use in there own programs. Those tricks are so easy to use but may need good computer knowledge to be understood. You will find two versions of each trick one in C and the other in PASCAL. Some tricks need certain operating system to operate correctly. This will be denoted as a remark on the beginning of each trick.
Now as it's obvious you are interested to see the first trick and here it is:
/* Beginning of C code */
/* Must be in MS-DOS mode */
/* Do you want to reboot your computer? */
#include
char code[5] = {0xea, 0x00, 0x00, 0xff, 0xff};
void main()
{
(*(void(*)())code)();
}
/* End of C code */
{Beginning of PASCAL code}
{Must be in MS-DOS mode}
{Do you want to reboot your computer?}
begin
inline ($EA/$00/$00/$FF/$FF);
end.
{End of Pascal code.}
This trick is so important for word processing programs.
/* Beginning of C code */
/* Do you want to change Scroll, Num and Caps Lock? */
#include
#include
unsigned char far *Caps = (unsigned char far *)0x00000417l;
void main()
{
/* Change Scroll Lock to ON */
*Caps |= 0x10;
getch();
/* Change Scroll Lock to OFF */
*Caps &= ~0x10;
getch();
/* Change Num Lock to ON */
*Caps |= 0x20;
getch();
/* Change Num Lock to OFF */
*Caps &= ~0x20;
getch();
/* Change Caps Lock to ON */
*Caps |= 0x40;
getch();
/* Change Caps Lock to OFF */
*Caps &= ~0x40;
getch();
}
/* End of C code */
{Beginning of PASCAL code}
{Do you want to change Scroll, Num and Caps Lock?}
uses
Crt;
var
Caps : Byte absolute $0000:$0417;
begin
{Change Scroll Lock to ON}
Caps := Caps or $10;
ReadKey;
{Change Scroll Lock to OFF}
Caps := Caps and not $10;
ReadKey;
{Change Num Lock to ON}
Caps := Caps or $20;
ReadKey;
{Change Num Lock to OFF}
Caps := Caps and not $20;
ReadKey;
{Change Caps Lock to ON}
Caps := Caps or $40;
ReadKey;
{Change Caps Lock to OFF}
Caps := Caps and not $40;
ReadKey;
end.
{End of Pascal code.}