27 March 2009

Application of computers.

The use of computers is increasing at such a rate that is hardly any field where computers are not used.the following list describes some of the applications of computers.

  • in offices and homes for preparaing documents and to perform other data processing jobs.
  • to prepare salary slips and salary cheques in offices and factories.
  • to maintain accounts and transfer funds in banks
  • to store and retrive large numbers of informations in the offices.
  • to search and retrive informations from the other computers.
  • to reserve tickets in the transportation sector. e.g:railways,airlines.
  • to regulate trafic lights on roads and to control machines and robots in factories.
  • to design automobiles,buildings and dams and also to forcast weather.
  • to create animation catroon movies and compose music.
  • to control morden automobiles,appliances.
  • to do online banking and see merchandise,shares,bonds etc.
  • to control and simulate defense equipment.
  • for scientific and industrial research.

Classification of computers

Computers are used for several applications in almost all fields of morden life.diffrent types of application require diffrent type of computers.for instance, for desktop application such as word-processing, you may require a small computer.on other hand, a large company require a large and powerful computer. computer can be classified based on size, application,speed,technology etc.

  • one of the most commonly used classifications of computers is based on its size.here the computers are devided into three categories -large mainframe, mini and micro.personal computers (PCs) that you use fall into the micro category. small micro computer that we are used for personal application in homes in the 1980s were called home computers.large companies,banks,airlines...etc.
  • normally use large (mainframe computers) fall between the mainframes and macro computers.computer can also classified as analog and digital. your pc is a digital computer.the computers used in officec are generally digitals. digital computer are operate directly on numbers that are expressed as digits. digital computers are more accurate than analog computers. they can be sued data for processing as well as for scientific, engineering and industrial application. on the other hand, analog computers that are normally used in the process industry or in measuring instruments can directly measure physical parameters, such as v,oltage, current pressure,temprature,length,weigh,flow etc. however, nowadays,digital computers are being used for industrial application.

25 March 2009

function of operating system:

  • operating system:an operating system is an integrated set of programs that is used to manage the various resources and overall operation of a computer system.it makes the computer system user friendly.its prime objective to improve the performance and efficiency of computer system and increase facility.

  • function of operating system
  1. processor management, that is assignment of processors to diffrent tasks being performed by the computer system.
  2. memory management, that is allocation of main memory and other storage areas to the system programs as well as user programs and data.
  3. input output management, that is coordinataion and assignment of the diffrent input and optput devices while one or more programs are being executed.
  4. file management, that is the storage of files on various storage devices and the transfer of these files from one storage device to another. it allows all files easily changes and modified through the use of text editiors or some other file manilution routines.
  5. automatic transition from job to job as directed by special control system.
  6. interpretation of commands and instruction.
  7. coordination and assignments of compilers, assembler, utility programs and other software's to the various user of the computer system.
  8. establishment of data security and integrity. that is it keeps diffrent programs and data in such manner that they do not interfere with each other. moreover it also protects itself from being destroyed by any user.
  9. production of dumps, traces, error messages, and other debugging and error-detecting aids.
  10. maintenance of internal time clock and log of system usage for all users.
  11. facilities easy communication between the computer system and the computer (human) operator.

evalution of reverse polish formulas

  1. examine each symbol in the reverse polish formula, starting at the extreme left untill you come to an operator.
  2. write down the operator and the two operands immediately to its left on a piece of scratch paper.
  3. erase the operator and the operands from the formula,creating a hole.
  4. perform the operation on the operands and write the result in the hole.
  • if the formula now consist of one value , that is the answer and the algorithm is finished otherwise goto step 1depicts the evaluation of a reverse polish formula. the order of the operator is the order in which they are actually evaluated.
  • reverse polish is the ideal notation for evaluting formulas on a computer with stack.the formulas comsist os n symbols each one either a variable or an operator.the algorithm for evaluting a reverse polish formula using a stack is as follows.

  • algorithm:
  1. set k to 1
  2. examine the kth symbol. of it is a variable, push it onto the stack. if it is an operator pop the top 2 iteams off the stack, perform the operation and push the result back onto the stack.
  3. if k=n the algorithm terminates and the answer is on the stack; other wise add 1 to k and goto step 2.

direct addressing & indirect addressing

  • Direct addressing

another simple method for specifying an operand is to give the address of the memory word where the operand is contained. in other words a method for specifying an operand in memory is just to give its full address.this form is called direct addressing.

in this type of addressing the memory word can be longer than that of the operand part which is not in case of immidiate addressing.

like immidiate addressing,direct addressing is restricted in use: the instruction will always access exactly the same memory location. so while the value can change,the location cannot.
thus direct addressing can only be used to access global variables wose address is known at compile time.


  • Indirect addressing
direct addressing is a scheme in which the data address specifies which memory word or register contains the operand. indirect addressing is a scheme in which the address specifies which memory word/register contains not the operand but the address of the operands.

some machine allow multilevel indirect addressing.in this addressing mode, a pointer is used to locate memory word that itself points to another memory word.and so on.immidiate ,direct ,indicate and multilevel indirect addressing exhibit a certain progression.

immediate addressing requires 2 memory references, 1 for the pointer and 1 for the operand. multi-level indirect addressing requires at least 3 memory refrences, two or more pointers and one for the operand. memory refrences in this context include register refrences.

immediate addressing

this is the simplest way for an instruction to specify an operand. in this type of addressing the address part of instruction actually contain the operand itself rather than an address of other information -describing where the operand is.

such an operand is called "immediate operand" because it is automatically fetched from the memory and the same time the instruction itself is fetched; hence it is immediately available for use.

  • advantages:
  1. it could use less memory because it does not require an extra memory reference to fetch an operand.
  2. instruction execution time will be less as instruction itself contains operands.
  • disadvantages
  1. restricting the operand to a number that can fit in an address field.in and instruction will 3 bit address, the operands would be restricted to 3 bits, which limit their usefulness.
  2. only constant can be supplied this way.

for example IBM 370 has MOVE,COMPARE, BOOLEAN OPERATION as well as sevral other instruction that contain 1 byte immediate operand.

18 March 2009

what is MCSE?

A Microsoft Certified Systems Engineer (MCSE) is a person who is certified by Microsoft to work with networking concepts and operation systems. Several years ago, Microsoft opened up learning and training centers all over the country to teach people how to become MCSE qualified within the Microsoft platforms, and interest has been booming ever since.

A person who is interested in becoming an MCSE has to pass a credit-by-exam test. This allows a person to work within the latest system. With each new system that comes out, however, there are other certified exams that an MCSE must take and pass in order to maintain certification. For instance, if an MCSE is certified for the year 2002 and 2000, he or she must take at least two certification exams – one for each year of certification.

This upgrading of certification continues as long as the person wishes to continue to be an MCSE. The reason for the testing, and for proving proficiency for each year, is that Microsoft is changing constantly, and the information for earlier operating and networking systems changes with each new application.

To become certified by Microsoft, one must take the Microsoft Certification Exam at a designated Testing Center. Microsoft offers courses to help students pass the MCSE exams. There is, however, limited seating for the courses. At the same time, the training centers run courses constantly in order to serve as many of those who want to become an MCSE as possible.

It takes time and commitment to get through the courses necessary to become an MCSE. Depending on how much time a student devotes to the process, however, it can take as little as a year. On the other hand, the courses can take as long as two years. A student who already has an Associate in Science degree and has applied computer knowledge can often make it through the program even faster.

There is a very high demand for MCSE qualified individuals. Employers see the certification as a plus when hiring a new employee, especially in the field of computers or communications. Although potential employers also consider experience, the certification shows that the potential employee has a defined knowledge of how Microsoft systems work.



Microsoft continues to dominate the information technology industry, and thousands of students who complete their degree program in the areas of computer science or technology can further their career by becoming a Microsoft Certified Systems Engineer. MCSE Certification is the official designation for the Microsoft Certified Systems Engineer, and allows a candidate to earn a higher-than-average salary, pursue better job opportunities, and maintain their skills and knowledge as they further their career.



What is MCSE Certification?

Technology professionals who become MCSE certified can work in roles that involve designing and implementing the infrastructure on the Microsoft Windows 2000 Server platform or the Windows Server System. MCSE Certification is a valuable commodity in today’s high-tech sphere, and prospective employers are looking for candidates who are already MCSE-certified because of the high costs associated with MCSE training. MCSE training programs can take place in both an on-site or online learning environment, but students also have an option to take a self-study course independently.

MCSE Training: MCSE Courses and Program Descriptions

MCSE training programs allow Microsoft Systems Engineers to prepare for the four key exams necessary for certification. An MCSE student needs to pass four designated operating system exams and two elective exams; these test the professional’s’ knowledge and skills in the areas of systems networking, server management, and desktop networking systems. The four operating exams that MCSE training prepares students for are:

*

NT Server
*

NT Workstation
*

Networking Essentials
*

NT Server in the Enterprise

The two elective exams cover areas in Microsoft BackOffice products.

  • What Does MCSE Training Provide?

    MCSE training allows candidates to oversee and manage several tasks involved with networks and computer systems. Common job tasks and responsibilities after completing MCSE courses include:

    *

    Troubleshooting network computer systems
    *

    Checking for software errors
    *

    Monitoring bugs in network systems and software
    *

    Backing up company information for valuable data
    *

    Running diagnostics and scanning computer systems for viruses
    *

    Monitoring and reporting network crashes
    *

    Conducting training classes for employees or business professionals in the office work environment
    *

    Updating computers with the latest software patches

    Key Benefits of MCSE Certification

    MCSE Certification allows candidates to join an active community of technology professionals located around the world, and enhance their career credentials and experience with ongoing training. Key benefits of MCSE Certification include:

    *

    Staying current with server based systems designs and technologies
    *

    Having access to technical resources for any project or work order
    *

    Career and certification planning resources to make it easier to move up in a position
    *

    Networking opportunities with other Microsoft Certified Professionals, both online and offline
    *

    Discounts and rebates on industry-related magazines and software programs
    *

    An MCSE logo for resumes and websites, as well as an official MCSE lapel pin
    *

    Free access to Microsoft Certified Professional Magazine Online
    *

    A higher level of job satisfaction

    Enrolling in an MCSE Online Course Program

    MCSE online course programs allow students to obtain the training and skills they need to successfully pass each exam. These MCSE courses can be designed to simulate the computing environments using the Microsoft Windows Server and other products, so students can gain the hands-on experience and skills they need to create and develop various projects.

    Online MCSE certification makes it easy for non-traditional students to obtain their MCSE credentials from the comfort of home or their work office. Online MCSE certification programs may be comprised of:

    *

    Online training videos
    *

    Hands-on exercises
    *

    Online quizzes, tests and examinations
    *

    Computer labs
    *

    Collaborative group projects
    *

    CD and DVD training as a course supplement
    *

    Web-based study guides and support forums
  • How MCSE Bootcamp Courses Work

    MCSE bootcamp courses and programs are designed for accelerated learning, and are most valuable for candidates who need to complete their MCSE certification in a short period of time for a prospective employer, or other personal reasons. MCSE bootcamp courses can be taken either online, or over the Internet in a virtual classroom setting. These types of self-study programs allow students to complete tests and quizzes, submit coursework and take part in computer labs and hands-on exercises in a ‘condensed’ learning format.
  • MCSE Certification and Training Tips
    If you intend to make a career out of computers, than with MCSE training, you will not only get a boost in your career but also an increase in your pay scale. MCSE is the acronym for Microsoft Certified Systems Engineer and its certification indicates your increased knowledge and understanding of the working of Microsoft.What is MCSE?
    MCSE is used in computer systems running on Microsoft Windows 2000 or 2003 and with MCSE training, you are prepared for facing any problems associated with the infrastructure design of a system or the analysis of a company's requirements before the implementation of a design. And so with MCSE training, you will be recognized for your knowledge and proficiency in Microsoft products and services. This in turn is a major asset for the organization you join as it makes you ready for the different infrastructural implementation found in different businesses.The MCSE Certification Process
    To get a MSCE certificate, you will have to undergo some intensive MSCE training. There is no point in your trying to go through the extensive coursework that come with MSCE training. This only proves to be time consuming, where you will not be able to answer the related exams on the stipulated time. So the best thing to do is to join a local training center for MSCE training. On joining these centers, you are helped through coursework and practical with the help of professionals. The professionals help you in your exam preparation through career oriented study. The most important thing to remember about MCSE training is to understand the coursework thoroughly. With this done, you will be able to answer exams on time, and at the same time, be aware of the practical applications of Microsoft products and services.Computer Based MCSE Training
    If you find that there are no good training centers or boot camps that will provide you MCSE training in your neighborhood, you can always visit the internet. The internet will give you MCSE training through thousands of tutorials and study guides that are found on the internet. Many people prefer taking MCSE training this way, or at least use CD-ROMS and books as a form of MCSE training for MCSE. In fact, Microsoft has also released a MCSE training kit that helps candidates not only learn the skills needed on a job, but also gives them the required knowledge for the exams.MCSE Training Centers and Boot Camps
    If you join training centers for your MCSE training, you find that most of the MCSE training classes here are conducted per your convenience. Most of these centers are open for quite a long time everyday where it is up to you to choose the most convenient timings for your MCSE training. The advantage of attending these training centers for your MCSE training is that there is a restricted number of participants in each group. With this, each member will thus receive individual MCSE training from MCSE experts. However people who want to go through intensive MCSE training to pass its exams, there are quite a few centers that conduct boot camps. These boot camps run the length of the coursework to culminate with an exam in two to three weeks' time. This is the better option for working men and women who don't have the time to attend regular classes for MCSE training, but still be able to take the exam on time.

17 March 2009

blu-ray

nothing stands still in the computer business, certainly not storage technology. DVD(digital versatile Disk) was barely introduce before its successor threatened to make it obsolete. the successor to DVD is Blu-ray,so called because it uses a blue laser instead of the red one, which allows it ti focus more accurately and thus support smaller pits and lands. single sided blu-ray disk hold about 25 GB of data, double sided ones hold about 50 gb of data. the data rate is about 4.5 mb/second, which is good for an optical disk, but still insignificant compared to magnetic desks.
it is expected that blu-ray will eventually replace CD_ROM and DVDs, but this transition will take some years...

more is comming on this blog so stay connected with this......

array processor.

an array processor consists of a large number os identical processors that perform the same sequence of instruction on different sets of data.

an alternative approach to SIMD is the array processor, a design pioneered by the university of ILLinois ILLIAC IV computer and illustrated in this figure.this architecture consists of a 8*8 square grid of processors/memory elements.

the basic idea behind an array processor is that a single control unit provides the signal to drive the many processing elements.each processing elements consists of a CPU or enhanced ALU and some local memory. since a single control unit is driving them all, the processing elements run in per quadrant.
  • advantage:
  1. it is very efficient at executing a sequence of operation on pairs of data elements.
  2. it achieve a performance of 1 giga flop which is the doubled the computing power of the entire world.
  • disadvantage:
  1. duplication of hardware
  2. high cost

instruction exexution cycle.

the CPU executes each instruction in a series of small steps. the steps are as follows.
  1. fetch the instruction from the memory into the instruction register.
  2. change the program counter to point the following instruction.
  3. determining the type of instruction just fetched.
  4. if the instruction uses a word in memory,determine where it is.
  5. fetch the word,if needed into a CPU register.
  6. execute the instruction
  7. Go to step 1 to begin executing the following instruction.
this sequence is also known as fetch-decode-execution cycle.

what are the character codes?

each computer has a set of characters that it uses.in order to transfer these characters into the computer. each one is assigned a number. the mapping of character onto integers is called character codes.when computers are communicating they must use same code otherwise they will not be able to understand one another.for this reason standards have been developed.
e.g.:

  1. BCD(binary coded decimal)
  2. EBCDIC(extended binary coded decimal interchange code)
  3. ASCII(American standard code for information interchange)
  4. ISCII(indian standard code for information interchange)

15 March 2009

Microsoft: IE8 faster than Firefox, Chrome

own speed tests prove Internet Explorer 8 (IE8) is faster than either Firefox or Chrome.

In a report released Wednesday, Microsoft spelled out how it tests browsers in-house, and again stressed that it doesn't buy the idea that benchmarks -- such as those that score JavaScript performance -- accurately compare the players.

"These benchmarks necessarily characterize only a narrow set of the browser functions in a very constrained way," Microsoft's report said. "End users, however, do not operate in a controlled environment."

Microsoft did not test other browsers, such as Apple Inc.'s Safari or Opera Software ASA's Opera, said James Pratt, a senior product manager on the IE development team, because it wanted to focus on rivals that "had a good share on the Windows platform."


Both Opera and Safari for Windows have shares of less than 1%, according to the most recent data from Net Applications Inc., with the former, on all platforms, accounting for 0.7% and the latter just 0.3%.Nor did Microsoft put IE8 in the ring with later versions of Chrome and Firefox.

"IE8 RC1 is a release candidate, and was very close to being done," explained Pratt when asked why newer versions of Chrome and Firefox had not been used. "But Google and Mozilla were still actively working on [those newer browsers], and they weren't super stable."

Although Google did not respond to a request for comment on Microsoft's benchmarks, Mozilla's Mike Shaver, who heads all development at the company, applauded any attempt to boost IE's performance. "I don't think anyone here has had a chance to really look at their methodology yet or tried to reproduce their results, but to whatever extent Microsoft is working to improve the performance of IE, it's a good thing for the Web," said Shaver in an e-mail late Thursday.

what are cookies???

cookies are small, plain-text data files that live somewhere on your computer (exactly where depends on the web browser). Cookies are written to your computer by your web browser responding to commands from a website. A website can write multiple cookies, but (barring software bugs) can only see the cookies they wrote.

Cookies are categorized two ways: according to their lifespan and where they came from.


  • LIFESPAN

Short-lived cookies exist only for the current web browser session. When you close your browser, all such cookies go away. Not surprisingly, these are called session cookies (the IE7 help pages also refer to them as temporary cookies). For tracking purposes, session cookies pose no danger.

The majority of cookies are more permanent. It's not unusual for a website to set the expiration date of a cookie to be 10, 20 or 30 years in the future. These persistent cookies (that's the official name) can be very beneficial, but they can also be used for behavior tracking. If a website has ever remembered your userid/password, you have a persistent cookie to thank for the convenience.

  • ORIGIN

When it comes to the origin of a cookie, there are two categories: first party and third party.

First party cookies come from the website whose domain name is displayed in the address bar of your web browser. For example, at the web site of my home town newspaper, The New York Times, first party cookies are set by the newspaper.

But a web page is normally made up of many pieces and the pieces don't have to come from the same website. The ads, for example, rarely originate on the website you are visiting. Cookies that come from these third party advertising networks are the origin of the term "third party cookies", which refers to cookies set by websites you had no intention of visiting.


13 March 2009

10 reasons why PCs crash U must Know

  • Fatal error: the system has become unstable or is busy," it says. "Enter to return to Windows or press Control-Alt-Delete to restart your computer. If you do this you will lose any unsaved information in all open applications."

You have just been struck by the Blue Screen of Death. Anyone who uses Mcft Windows will be familiar with this. What can you do? More importantly, how can you prevent it happening?

  • 1 Hardware conflict

The number one reason why Windows crashes is hardware conflict. Each hardware device communicates to other devices through an interrupt request channel (IRQ). These are supposed to be unique for each device.

For example, a printer usually connects internally on IRQ 7. The keyboard usually uses IRQ 1 and the floppy disk drive IRQ 6. Each device will try to hog a single IRQ for itself.

If there are a lot of devices, or if they are not installed properly, two of them may end up sharing the same IRQ number. When the user tries to use both devices at the same time, a crash can happen. The way to check if your computer has a hardware conflict is through the following route:

  • Start-Settings-Control Panel-System-Device Manager.

Often if a device has a problem a yellow '!' appears next to its description in the Device Manager. Highlight Computer (in the Device Manager) and press Properties to see the IRQ numbers used by your computer. If the IRQ number appears twice, two devices may be using it.

Sometimes a device might share an IRQ with something described as 'IRQ holder for PCI steering'. This can be ignored. The best way to fix this problem is to remove the problem device and reinstall it.

Sometimes you may have to find more recent drivers on the internet to make the device function properly. A good resource is www.driverguide.com. If the device is a soundcard, or a modem, it can often be fixed by moving it to a different slot on the motherboard (be careful about opening your computer, as you may void the warranty).

When working inside a computer you should switch it off, unplug the mains lead and touch an unpainted metal surface to discharge any static electricity.

To be fair to Mcft, the problem with IRQ numbers is not of its making. It is a legacy problem going back to the first PC designs using the IBM 8086 chip. Initially there were only eight IRQs. Today there are 16 IRQs in a PC. It is easy to run out of them. There are plans to increase the number of IRQs in future designs.

  • Bad Ram

Ram (random-access memory) problems might bring on the blue screen of death with a message saying Fatal Exception Error. A fatal error indicates a serious hardware problem. Sometimes it may mean a part is damaged and will need replacing.

But a fatal error caused by Ram might be caused by a mismatch of chips. For example, mixing 70-nanosecond (70ns) Ram with 60ns Ram will usually force the computer to run all the Ram at the slower speed. This will often crash the machine if the Ram is overworked.

One way around this problem is to enter the BIOS settings and increase the wait state of the Ram. This can make it more stable. Another way to troubleshoot a suspected Ram problem is to rearrange the Ram chips on the motherboard, or take some of them out. Then try to repeat the circumstances that caused the crash. When handling Ram try not to touch the gold connections, as they can be easily damaged.

Parity error messages also refer to Ram. Modern Ram chips are either parity (ECC) or non parity (non-ECC). It is best not to mix the two types, as this can be a cause of trouble.

EMM386 error messages refer to memory problems but may not be connected to bad Ram. This may be due to free memory problems often linked to old Dos-based programmes.

  • BIOS settings

Every motherboard is supplied with a range of chipset settings that are decided in the factory. A common way to access these settings is to press the F2 or delete button during the first few seconds of a boot-up.

Once inside the BIOS, great care should be taken. It is a good idea to write down on a piece of paper all the settings that appear on the screen. That way, if you change something and the computer becomes more unstable, you will know what settings to revert to.

A common BIOS error concerns the CAS latency. This refers to the Ram. Older EDO (extended data out) Ram has a CAS latency of 3. Newer SDRam has a CAS latency of 2. Setting the wrong figure can cause the Ram to lock up and freeze the computer's display.

Mcft Windows is better at allocating IRQ numbers than any BIOS. If possible set the IRQ numbers to Auto in the BIOS. This will allow Windows to allocate the IRQ numbers (make sure the BIOS setting for Plug and Play OS is switched to 'yes' to allow Windows to do this.).

  • Hard disk drives

After a few weeks, the information on a hard disk drive starts to become piecemeal or fragmented. It is a good idea to defragment the hard disk every week or so, to prevent the disk from causing a screen freeze. Go to

* Start-Programs-Accessories-System Tools-Disk Defragmenter

This will start the procedure. You will be unable to write data to the hard drive (to save it) while the disk is defragmenting, so it is a good idea to schedule the procedure for a period of inactivity using the Task Scheduler.

The Task Scheduler should be one of the small icons on the bottom right of the Windows opening page (the desktop).

Some lockups and screen freezes caused by hard disk problems can be solved by reducing the read-ahead optimisation. This can be adjusted by going to

* Start-Settings-Control Panel-System Icon-Performance-File System-Hard Disk.

Hard disks will slow down and crash if they are too full. Do some housekeeping on your hard drive every few months and free some space on it. Open the Windows folder on the C drive and find the Temporary Internet Files folder. Deleting the contents (not the folder) can free a lot of space.

Empty the Recycle Bin every week to free more space. Hard disk drives should be scanned every week for errors or bad sectors. Go to

* Start-Programs-Accessories-System Tools-ScanDisk

Otherwise assign the Task Scheduler to perform this operation at night when the computer is not in use.

  • 5 Fatal OE exceptions and VXD errors

Fatal OE exception errors and VXD errors are often caused by video card problems.

These can often be resolved easily by reducing the resolution of the video display. Go to

* Start-Settings-Control Panel-Display-Settings

Here you should slide the screen area bar to the left. Take a look at the colour settings on the left of that window. For most desktops, high colour 16-bit depth is adequate.

If the screen freezes or you experience system lockups it might be due to the video card. Make sure it does not have a hardware conflict. Go to

* Start-Settings-Control Panel-System-Device Manager

Here, select the + beside Display Adapter. A line of text describing your video card should appear. Select it (make it blue) and press properties. Then select Resources and select each line in the window. Look for a message that says No Conflicts.

If you have video card hardware conflict, you will see it here. Be careful at this point and make a note of everything you do in case you make things worse.

The way to resolve a hardware conflict is to uncheck the Use Automatic Settings box and hit the Change Settings button. You are searching for a setting that will display a No Conflicts message.

Another useful way to resolve video problems is to go to

* Start-Settings-Control Panel-System-Performance-Graphics

Here you should move the Hardware Acceleration slider to the left. As ever, the most common cause of problems relating to graphics cards is old or faulty drivers (a driver is a small piece of software used by a computer to communicate with a device).

Look up your video card's manufacturer on the internet and search for the most recent drivers for it.

  • 6 Viruses

Often the first sign of a virus infection is instability. Some viruses erase the boot sector of a hard drive, making it impossible to start. This is why it is a good idea to create a Windows start-up disk. Go to

* Start-Settings-Control Panel-Add/Remove Programs

Here, look for the Start Up Disk tab. Virus protection requires constant vigilance.

A virus scanner requires a list of virus signatures in order to be able to identify viruses. These signatures are stored in a DAT file. DAT files should be updated weekly from the website of your antivirus software manufacturer.

An excellent antivirus programme is McAfee VirusScan by Network Associates ( www.nai.com). Another is Norton AntiVirus 2000, made by Symantec ( www.symantec.com).

  • 7 Printers

The action of sending a document to print creates a bigger file, often called a postscript file.

Printers have only a small amount of memory, called a buffer. This can be easily overloaded. Printing a document also uses a considerable amount of CPU power. This will also slow down the computer's performance.

If the printer is trying to print unusual characters, these might not be recognised, and can crash the computer. Sometimes printers will not recover from a crash because of confusion in the buffer. A good way to clear the buffer is to unplug the printer for ten seconds. Booting up from a powerless state, also called a cold boot, will restore the printer's default settings and you may be able to carry on.

  • Software

A common cause of computer crash is faulty or badly-installed software. Often the problem can be cured by uninstalling the software and then reinstalling it. Use Norton Uninstall or Uninstall Shield to remove an application from your system properly. This will also remove references to the programme in the System Registry and leaves the way clear for a completely fresh copy.

The System Registry can be corrupted by old references to obsolete software that you thought was uninstalled. Use Reg Cleaner by Jouni Vuorio to clean up the System Registry and remove obsolete entries. It works on Windows 95, Windows 98, Windows 98 SE (Second Edition), Windows Millennium Edition (ME), NT4 and Windows 2000.

Read the instructions and use it carefully so you don't do permanent damage to the Registry. If the Registry is damaged you will have to reinstall your operating system. Reg Cleaner can be obtained from www.jv16.org

Often a Windows problem can be resolved by entering Safe Mode. This can be done during start-up. When you see the message "Starting Windows" press F4. This should take you into Safe Mode.

Safe Mode loads a minimum of drivers. It allows you to find and fix problems that prevent Windows from loading properly.

Sometimes installing Windows is difficult because of unsuitable BIOS settings. If you keep getting SUWIN error messages (Windows setup) during the Windows installation, then try entering the BIOS and disabling the CPU internal cache. Try to disable the Level 2 (L2) cache if that doesn't work.

Remember to restore all the BIOS settings back to their former settings following installation.

  • 9 Overheating

Central processing units (CPUs) are usually equipped with fans to keep them cool. If the fan fails or if the CPU gets old it may start to overheat and generate a particular kind of error called a kernel error. This is a common problem in chips that have been overclocked to operate at higher speeds than they are supposed to.

One remedy is to get a bigger better fan and install it on top of the CPU. Specialist cooling fans/heatsinks are available from www.computernerd.com or www.coolit.com

CPU problems can often be fixed by disabling the CPU internal cache in the BIOS. This will make the machine run more slowly, but it should also be more stable.

  • 10 Power supply problems

With all the new construction going on around the country the steady supply of electricity has become disrupted. A power surge or spike can crash a computer as easily as a power cut.

If this has become a nuisance for you then consider buying a uninterrupted power supply (UPS). This will give you a clean power supply when there is electricity, and it will give you a few minutes to perform a controlled shutdown in case of a power cut.

It is a good investment if your data are critical, because a power cut will cause any unsaved data to be lost.

12 March 2009

Google secrets

  • method 1
?ww.google.com

put this string in google search:

"parent directory " /appz/ -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

"parent directory " DVDRip -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

"parent directory "Xvid -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

"parent directory " Gamez -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

"parent directory " MP3 -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

"parent directory " Name of Singer or album -xxx -html -htm -php -shtml -opendivx -md5 -md5sums

Notice that i am only changing the word after the parent directory, change it to what you want and you will get a lot of stuff.

voila!

  • method 2
?ww.google.com

put this string in google search:

?intitle:index.of? mp3

You only need add the name of the song/artist/singer.
Example: ?intitle:index.of? mp3 jackson

8 March 2009

create 1-click shutdown and reboot shortcut.

  • First, create a shortcut on your desktop by right-clicking on the desktop, choosing New, and then choosing Shortcut. The Create Shortcut Wizard appears. In the box asking for the location of the shortcut, type shutdown. After you create the shortcut, double-clicking on it will shut down your PC.
  • But you can do much more with a shutdown shortcut than merely shut down your PC. You can add any combination of several switches to do extra duty, like this:
  • shutdown -r -t 01 -c "Rebooting your PC" Double-clicking on that shortcut will reboot your PC after a one-second delay and display the message "Rebooting your PC." The shutdown command includes a variety of switches you can use to customize it. Table 1-3 lists all of them and describes their use.
  • I use this technique to create two shutdown shortcuts on my desktop—one for turning off my PC, and one for rebooting. Here are the ones I use:
  • shutdown -s -t 03 -c "Bye Bye m8!"
  • shutdown -r -t 03 -c "Ill be back m8 ;)!"
  • Switch
What it does??

  • -s Shuts down the PC.
  • -l Logs off the current user.
  • -t nn Indicates the duration of delay, in seconds, before performing the action.
  • -c "messagetext" Displays a message in the System Shutdown window. A maximum of 127 characters can be used. The message must be enclosed in quotation marks.
  • -f Forces any running applications to shut down.
  • -r Reboots the PC.

common ftp errors.

ftp: file transfer protocol
# Description

  • 110 Restart marker reply. In this case, the text is exact and not left to the particular implementation; it must read: MARK yyyy = mmmm where yyyy is User-process data stream marker, and mmmm server's equivalent marker (note the spaces between markers and "=").
  • 120 Service ready in nnn minutes.
  • 125 Data connection already open; transfer starting.
  • 150 File status okay; about to open data connection.
  • 200 Command okay.
  • 202 Command not implemented, superfluous at this site.
  • 211 System status, or system help reply.
  • 212 Directory status.
  • 213 File status.
  • 214 Help message.On how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.
  • 215 NAME system type. Where NAME is an official system name from the list in the Assigned Numbers document.
  • 220 Service ready for new user.
  • 221 Service closing control connection.
  • 225 Data connection open; no transfer in progress.
  • 226 Closing data connection. Requested file action successful (for example, file transfer or file abort).
  • 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).
  • 230 User logged in, proceed. Logged out if appropriate.
  • 250 Requested file action okay, completed.
  • 257 "PATHNAME" created.
  • 331 User name okay, need password.
  • 332 Need account for login.
  • 350 Requested file action pending further information
  • 421 Service not available, closing control connection.This may be a reply to any command if the service knows it must shut down.
  • 425 Can't open data connection.
  • 426 Connection closed; transfer aborted.
  • 450 Requested file action not taken.
  • 451 Requested action aborted. Local error in processing.
  • 452 Requested action not taken. Insufficient storage space in system.File unavailable (e.g., file busy).
  • 500 Syntax error, command unrecognized. This may include errors such as command line too long.
  • 501 Syntax error in parameters or arguments.
  • 502 Command not implemented.
  • 503 Bad sequence of commands.
  • 504 Command not implemented for that parameter.
  • 530 Not logged in.
  • 532 Need account for storing files.
  • 550 Requested action not taken. File unavailable (e.g., file not found, no access).
  • 551 Requested action aborted. Page type unknown.
  • 552 Requested file action aborted. Exceeded storage allocation (for current directory or dataset).
  • 553 Requested action not taken. File name not allowed.

Boot Winxp Fast

Follow the following steps
  1. Open notepad.exe, type "del c:\windows\prefetch\ntosboot-*.* /q" (without the quotes) & save as "ntosboot.bat" in c:\
  2. From the Start menu, select "Run..." & type "gpedit.msc".
  3. Double click "Windows Settings" under "Computer Configuration" and double click again on "Shutdown" in the right window.
  4. In the new window, click "add", "Browse", locate your "ntosboot.bat" file & click "Open".
  5. Click "OK", "Apply" & "OK" once again to exit.
  6. From the Start menu, select "Run..." & type "devmgmt.msc".
  7. Double click on "IDE ATA/ATAPI controllers"
  8. Right click on "Primary IDE Channel" and select "Properties".
  9. Select the "Advanced Settings" tab then on the device or 1 that doesn't have 'device type' greyed out select 'none' instead of 'autodetect' & click "OK".
  10. Right click on "Secondary IDE channel", select "Properties" and repeat step 9.
  11. Reboot your computer.
all the chages which you are made in ur system we are not responsible for any damages.

7 March 2009

encoder,multiplexer and demultiplexer

  • what is encoder?
it converts an active input signal into a coded output signal.

only one of the n input line is active.internal logic with in the encoder converts active input to a coded binary output with m bits.
  • what is multiplexer?

a multiplexer is a circuit with many inputs but only one output.by applying control signal we can steer any input to the output. the following figure shows
general idea of multiplexer.

  • what is demultiplexer?

demultiplexer means one into many.it is a logic circuit with one input and many outputs.by applying control signals we can steer the input signals to one of the output lines.

the output bit is labeled as D and is transmitted to the data bit of the output lines.
it depands on the value of abcd,the control input.

when abcd=0000 the upper and gate is enabled and all other and gates are disabled. so data bit D is transmitted to the output Y0 thus Y0=D.
if d is low y0 is low if D is high Y0 is high.
inputs abc and d select when everytime information from one sourcr must be fed to sevral places.

what is binary adder?

as shown in the figure there are four adders with inputs a0 to a3
and b0 to b3. and s0 to s3 are output and c1,c2,c3,c4 are the carry bits.

this figure shows an example of adding of two numbers 12 and 9 the decimal addtion of it is 21
.binary form of 12 is 1100 and 9 is 1001 so sum=0101 and the carry 1.
so our final output will be 10101.



the half adder produce the a sum of 1 and carry of 0, the first full adder produce a
sum of 0 and carry of 0 the second full adder produce a sum of 1 and carry of 0 and the third full adder produces a sum of 0 and carry is 1.so our final output is 10101.
using more full adders we can build more binary adders of any length.

What is half-adder?


  • half adder is a logic circuit that adds 2 bits.
  • the computers are sum and carry.
  • the boolean equation for these outputs are
  • sum= a symmetric difference carry=A*b
  • the sum output is A nor B.the carry output is Aand B.therefore sum is a when A and B are diffrent. carry is a 1 when A and B are 1s.

  • Truth table:

A

B

Sum

Carry

0

0

0

0

0

1

1

0

1

0

1

0

1

1

0

1



  • this circuit is used to add two bits and the output is given as sum and carry.two gates used to construct half adder are and x-or gate. the logic circuit for half adder is as shown below:

  1. case-1:if A=0 and B=0according to the condition of and gate the output will be false because both the inputs are low and thus our carry bit remailns 0.and for x-or gate as both the inputs are law output is also law.
  2. case-2:if A=0 and B=1then the output for the and gate will be false because one of the input is law so carry=0.according to the truth table of x-or gate if both the inputs are diffrunt so the output will be high thus sum=1.
  3. case=3:if A=1 and B=0 then the output for the and gate will be false because one of the input is law so carry=0.according to the truth table of x-or gate if both the inputs are diffrunt so the output will be high thus sum=1.
  4. case=4:of A=1 and B=0 then the output for the and gate will be high as both the inputs are high so carry=1 and as both the inputs are same so according to the x-or truth table the output will be low so sum=0

What is hexa decimal number system?

the hexa decimal number system is one with a base of 16.
the base of 16 suggests choices of 16 single-character digits or symbols.
the first 10 digits
are the digits of a decimal system is 0 to 9. and other is A to F.
again each position in a hexadecimal system represent a power of the bse(16).
thus the decimal equivalent of the hexa decimal number 1AF
written as simmilar as (1AF)H.

what is octal number system.?


in the ocatal number system the base is 8.so in this system there are only eight symbols like digits
0 to 7(one less than base).
again each position in an octal number represent a power of the base(8). thus the octal number 2057 written as (2057)O.
observe that since there are only 8 digits in the
octal number system. so total cube exponent of 2=8
are sufficient to represent to any octal number in binary.

what is binary number system?

the binary number system exactly like the decimal number system except that the base
is 2 instead of 10.we have only two sysmbols or digits (0 and 1) that can be used to in this
number system.note that the largest digit is 1 and less than the base.again each position in a
binary number represents a power of base 2. as such in this number system the right most
position is the units 2 and its exponent is 0. and the second position is counted as the unit is
2 and its exponent is 1. and than so on exponent value every time increases by 1.

thus the decimal equivalent of the binary number 10101 is
(1*2)4 +(1*2)3 +(1*2)2 +(1*2)1 +(1*2)0

here 4 3 2 1 is exponent of the bracket.
so the ans is 16+0+4+0+1=21.

in order to be specific about which system are we reffering to.is is common preactice to
indicate the base as a subscript.thus we can write this similar as (10101)B=(21)D
binary digit is often reffered by the common abbreviation bit.
thus a bit in computer terminary means either 0 or 1. a binary number consisting of n bits is
called a n-bit number remember that we have only two digits 0 and 1. and hence the binary
equivalant of the decimal number 2 has to be stated as 10. and can be represented in the binary
form as an n-bit number.

what is number system?

in the number system basically of two types:

  1. 1st is non-positional number system
  2. 2nd is positional number system
  • =>non-positional number system

in early days ,human beinds counted on fingers.when 10 fingers were not adequate,stones,pebbles,

or sticks were used to indicate values.
this method of counting uses an additive approch or the non postional number system.
in this number system we have symbols such as I,II,III and so on.since it is very difficult
to perform arithmetic with such a number system.
positional number system were developed as the centuries passed.

  • =>positional number system

in a positional number system, there are only a few symbols called digits, and this symbols
represents diffrent values depanding on the position they occupy in the number.
the value of each digit in such a number is determined by three consideration.
  • the digit itself
  • the position of the digit in the number
  • the base or radix of the number system (where base is defined as the total number of the digits available in the number system.

the number system that we are using in our day to day life is decimal number system which has
been based at 10.basically there are 4 type of positional number system

  1. binary number system.
  2. octal number system.
  3. decimal number system.
  4. hexa decimal number system.
computer is only know binary number system which is also called machine level language.
some of the number system commonly used in computer science and by computer professional
are discussed at the next blog.

What is visual Basic?


It's a computer programming system developed and owned by Microsoft. Visual Basic was originally created to make it easier to write programs for the Windows computer operating system. The basis of Visual Basic is an earlier programming language called BASIC that was invented by Dartmouth College professors John Kemeny and Thomas Kurtz. Visual Basic is often referred to using just the initials, VB. Visual Basic is easily the most widely used computer programming system in the history of software.


  • history of and versions of vb.

Yes. Since 1991 when it was first introduced by Microsoft, there have been nine versions of Visual Basic up to VB.NET 2005, the current version. The first six versions were all called Visual Basic. In 2002, Microsoft introduced Visual Basic .NET 1.0, a completely redesigned and rewritten version that was a key part of a much larger computer architecture. The first six versions were all "backward compatible". That means that later versions of VB could handle programs written with an earlier version. Because the .NET architecture was such a radical change, earlier versions of Visual Basic have to be rewritten before they can be used with .NET. Many programmers still prefer Visual Basic 6.0 and a few use even earlier versions.

VB.NET is the equal of any programming technology anywhere. In fact, the resulting program using the .NET version of the C programming language, called C#.NET, is virtually identical with the same program written in VB.NET. The only real difference today is programmer preference.



DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

5 March 2009

Orkut- Most popular the social networking site

Orkut is a social networking service which is run by Google and named after its creator, an employee of Google - Orkut Büyükkökten. The service states that it was designed to help users meet new friends and maintain existing relationships. Orkut is similar to other networking sites. Since October 2006, Orkut has permitted users to create accounts without an invitation.

Orkut is the most visited website in Brazil and second most visited site in India. A large percentage of users in India are high school and college students. The initial target market for Orkut was the United States, but the majority of its users are in Brazil and India.2 In fact, as of May 2008, 53.86% of Orkut's users are from Brazil, followed by India with 16.97%3 and 23.4% of the traffic comes from Brazil, followed by India with 18.0%.4 In 2008, more than 23 million of Brazilians had an account on orkut.
Originally hosted in California, in August 2008 Google announced that Orkut will be fully managed and operated in Brazil, by Google Brazil, in the city of Belo Horizonte. This was decided due to the large Brazilian user base and growth of legal issues.

Features

  • Scrapbook

  • Communities

  • and much more.

Legal Issues


Brazil

On August 22, 2006, Brazilian Federal Judge José Marcos Lunardelli ordered Google to release Orkut user’s information of a list of about two dozen Brazilian nationals, believed to be using Orkut to sell drugs and involved in child pornography by September 28. The judge ordered Google to pay $23,000 per day in fines until the information is turned over to the Brazilian government. The information the government is requesting would also be used to identify individuals that are spreading child pornography37 and hate speech, according to the Brazilian government. As of September 27, 2006 Google has stated that it will not release the information, on the grounds that the requested information is on Google servers in the U.S. and not Google servers in Brazil, and is therefore not subject to Brazilian laws.

India

Of late, the number of Indians on Orkut has been increasing rapidly. On October 10, 2006, the Bombay High Court's Aurangabad bench served a notice on Google for allowing a hate campaign against India.39 This referred to a community on Orkut called 'We Hate India', which initially carried a picture of an Indian flag being burned and some anti-India content.40 The High Court order was issued in response to a public-interest petition filed by an Aurangabad advocate. Google had six weeks to respond. Even before the petition was filed, many Orkut users had noticed this community and were mailing or otherwise messaging their contacts on Orkut to report the community as bogus to Google, which could result in its removal. The community has now been deleted but has spawned several 'We hate those who hate India' communities. Prior to the 60th Independence Day of India, orkut's main page was revamped. The section which usually displayed a collage of photos of various people, showed a stylized orkut logo. The word orkut was written in the Devanagiri script and was colored in the Indian national colours. Clicking on the logo redirects to a post by the orkut India Product Manager, Manu Rekhi,41 on the orkut internal blog. There has also been some media outcry against Orkut after a couple of youngsters were apparently lured by fake profiles on the site and later murdered.

On November 23, Bombay High Court asked the state government to file its reply in connection with a petition demanding a ban on social networking site, Orkut, for hosting an anti-Shivaji Web community.43 Recently, the Pune rural police cracked a rave party filled with narcotics.44 The accused have been charged under anti-narcotic laws, the (Indian) Narcotic Drugs and Psychotropics Substances Act, 1985 (NDPS). Besides the NDPS, according to some media reports, the police were deliberating on the issue of charging the accused under the (Indian) Information Technology Act, 2000 perhaps because Orkut was believed to be one of the mode of communication for these kind of drug abuses.The Cyber police in India have entered into an agreement with Orkut to have a facility to catch and prosecute those misusing Orkut since the complaints is in a rising stage.


DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

What is google? and what google doing?

Google Inc. is an American public corporation, earning revenue from advertising related to its Internet search, e-mail, online mapping, office productivity, social networking, and video sharing services as well as selling advertising-free versions of the same technologies. The Google headquarters, the Googleplex, is located in Mountain View, California.
Google was co-founded by Larry Page and Sergey Brin while they were students at Stanford University and the company was first incorporated as a privately held company on September 4, 1998.the company has 20,222 full-time employees.
  • History of Google.
Google began in January 1996, as a research project by Larry Page, who was soon joined by Sergey Brin, when they were both Ph.D. students at Stanford University in Californiahey hypothesized that a search engine that analyzed the relationships between websites would produce better ranking of results than existing techniques, which ranked results according to the number of times the search term appeared on a page.7 Their search engine was originally nicknamed "BackRub" because the system checked backlinks to estimate the importance of a site.8 A small search engine called Rankdex was already exploring a similar strategyConvinced that the pages with the most links to them from other highly relevant web pages must be the most relevant pages associated with the search, Page and Brin tested their thesis as part of their studies, and laid the foundation for their search engine. Originally, the search engine used the Stanford University website with the domain google.stanford.edu. The domain google.com was registered on 15 September 1997,10 and the company was incorporated as Google Inc. on 4 September 1998 at a friend's garage in Menlo Park, California. The total initial investment raised for the new company amounted to almost US$1.1 million, including a US$100,000 check by Andy Bechtolsheim, one of the founders of Sun Microsystems.11

In March 1999, the company moved into offices in Palo Alto, home to several other noted Silicon Valley technology startups.12 After quickly outgrowing two other sites, the company leased a complex of buildings in Mountain View at 1600 Amphitheatre Parkway from Silicon Graphics (SGI) in 2003.13 The company has remained at this location ever since, and the complex has since come to be known as the Googleplex (a play on the word googolplex). In 2006, Google bought the property from SGI for US$319 million.

The Google search engine attracted a loyal following among the growing number of Internet users, who liked its simple design and useful results.15 In 2000, Google began selling advertisements associated with search keywords.6 The ads were text-based to maintain an uncluttered page design and to maximize page loading speed.6 Keywords were sold based on a combination of price bid and clickthroughs, with bidding starting at US$.05 per click.6 This model of selling keyword advertising was pioneered by Goto.com (later renamed Overture Services, before being acquired by Yahoo! and rebranded as Yahoo! Search Marketing).161718 Goto.com was an Idealab spin off created by Bill Gross, and was the first company to successfully provide a pay-for-placement search service. Overture Services later sued Google over alleged infringements of Overture's pay-per-click and bidding patents by Google's AdWords service. The case was settled out of court, with Google agreeing to issue shares of common stock to Yahoo! in exchange for a perpetual license.19 Thus, while many of its dot-com rivals failed in the new Internet marketplace, Google quietly rose in stature while generating revenue.6

The name "Google" originated from a common misspelling of the word "googol",2021 which refers to 10100, the number represented by a 1 followed by one hundred zeros. Having found its way increasingly into everyday language, the verb "google", was added to the Merriam Webster Collegiate Dictionary and the Oxford English Dictionary in 2006, meaning "to use the Google search engine to obtain information on the Internet.
A patent describing part of the Google ranking mechanism (PageRank) was granted on 4 September 2001.24 The patent was officially assigned to Stanford University and lists Lawrence Page as the inventor.
  • Partnerships of Google
In 2005, Google entered into partnerships with other companies and government agencies to improve production and services. Google announced a partnership with NASA Ames Research Center to build up 1,000,000 square feet (93,000 m2) of offices and work on research projects involving large-scale data management, nanotechnology, distributed computing, and the entrepreneurial space industry.42 Google also entered into a partnership with Sun Microsystems in October to help share and distribute each other's technologies.43 The company entered into a partnership with AOL of Time Warner,44 to enhance each other's video search services.

The same year, the company became a major financial investor of the new .mobi top-level domain for mobile devices, in conjunction with several other companies, including Microsoft, Nokia, and Ericsson among others.45 In September 2007, Google launched, "Adsense for Mobile", a service for its publishing partners which provides the ability to monetize their mobile websites through the targeted placement of mobile text ads,46 and acquired the mobile social networking site, Zingku.mobi, to "provide people worldwide with direct access to Google applications, and ultimately the information they want and need, right from their mobile devices."47

In 2006, Google and Fox Interactive Media of News Corp. entered into a US$900 million agreement to provide search and advertising on the popular social networking site, MySpace.48

Google has developed a partnership with GeoEye to launch a satellite providing Google with high-resolution (0.41m black and white, 1.65m color) imagery for Google Earth. The satellite was launched from Vandenberg Air Force Base on 6 September 2008.49

In 2008, Google announced that it was hosting an archive of Life magazine's photographs, as part of a joint effort. Some of the images in the archive were never published in the magazine.
  • Software related google
The Google web search engine is the company's most popular service. As of August 2007, Google is the most used search engine on the web with a 53.6% market share, ahead of Yahoo! 19.9% and Live Search 12.9%.59 Google indexes billions of Web pages, so that users can search for the information they desire, through the use of keywords and operators, although at any given time it will only return a maximum of 1,000 results for any specific search query. Google has also employed the Web Search technology into other search services, including Image Search, Google News, the price comparison site Google Product Search, the interactive Usenet archive Google Groups, Google Maps, and more.

In 2004, Google launched its own free web-based e-mail service, known as Gmail or Google Mail in some jurisdictions.60 Gmail features conversation view, spam-filtering technology, the capability to use Google technology to search e-mail. The service generates revenue by displaying advertisements and links from the AdWords service that are tailored to the choice of the user and/or content of the e-mail messages displayed on screen.

In early 2006, the company launched Google Video, which not only allows users to search and view freely available videos but also offers users and media publishers the ability to publish their content, including television shows on CBS, NBA basketball games, and music videos.61

Google has also developed several desktop applications, including Google Desktop, Picasa, SketchUp and Google Earth, an interactive mapping program powered by satellite and aerial imagery that covers the vast majority of the planet. Many major cities have such detailed images that one can zoom in close enough to see vehicles and pedestrians clearly. Consequently, there have been some concerns about national security implications; contention is that the software can be used to pinpoint with near-precision accuracy the physical location of critical infrastructure, commercial and residential buildings, bases, government agencies, and so on. However, the satellite images are not necessarily frequently updated, and all of them are available at no charge through other products and even government sources; the software simply makes accessing the information easier. A number of Indian state governments have raised concerns about the security risks posed by geographic details provided by Google Earth's satellite imaging.62

Google has promoted their products in various ways. In London, Google Space was set-up in Heathrow Airport, showcasing several products, including Gmail, Google Earth and Picasa.6364 Also, a similar page was launched for American college students, under the name College Life, Powered by Google.65

In 2007, some reports surfaced that Google was planning the release of its own mobile phone, possibly a competitor to Apple's iPhone.666768 The project, called Android, an operating system provides a standard development kit that will allow any "Android" phone to run software developed for the Android SDK, no matter the phone manufacturer. In September 2008, T-Mobile released the first phone running the Android platform, the G1.

Google Translate site aka Google Language Tools site is a server-side machine translation service, which can translate 35 different languages to each other, forming 1190 language pairs. Browser extension tools such as Firefox extensions allow for easy access to Google Translate from the browser. The software uses corpus linguistics techniques from translated documents, such United Nations documents, which are professionally translated to extract translations accurate up to 88 percent. A "suggest a better translation" feature appears with the original language text in a pop-up text field, allowing users to indicate where the current translation is incorrect or else inferior to another translation.

On 1 September 2008, Google pre-announced the upcoming availability of Google Chrome, an open-source web browser,69 which was released on 2 September 2008.






DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

What is J2ME?


In computing, the Java Platform, Micro Edition or Java MEis a specification of a subset of the Java platform for the development of software for requirement.

As of 22 December 2006, the Java ME source code is licensed under the GNU General Public License, and is released under the project name phoneME.As of 2008, all Java ME platforms are currently restricted to JRE 1.3 features and uses that version of the class file format (internally known as version 47.0). Should Sun ever declare a new round of Java ME configuration versions that support the later class file formats and language features, such as those corresponding JRE 1.5 or 1.6 (notably, generics), it will entail extra work on the part of all platform vendors to update their JREs.

Java ME has become a popular option for creating games for cell phones, as they can be emulated on a PC during the development stage and easily uploaded to phones. This contrasts with the difficulty of developing, testing, and loading games for other special gaming platforms such as those made by Nintendo, Sony, Microsoft, and others, as expensive system-specific hardware and kits are required.


DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

What is HTML?



HyperText Markup Language

The first publicly available description of HTML was a document called HTML Tags, first mentioned on the Internet by Berners-Lee in late 1991.

Version history of the standard

  • November 1995(html 2.0 published.)
  • January 1997 (html 3.2 Published.)
  • December 1997 (html 4.0)
  • December 1999 (html 4.01)
  • January 2008(html5)
HTML MARK UP:




</span></span>Hello HTML<span class="sc2"><span class="kw2">

  • This Document Type Declaration is in HTML5 format.
  • HTML documents can be delivered by the same means as any other computer file; however, they are most often delivered either by HTTP from a Web server or by e-mail.

Frameset versus transitional

nt></span><br /> <span class="sc2"><span class="kw2"><body></span></span><span class="sc2"><span class="kw2"></body></span></span><br /> <span class="sc2"><span class="kw2">





DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

What is c programming?

c Programming.
  • C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system and the other purpose of building this language is to create independent software.
  • C has greatly influenced many other popular programming languages, most notably C++, which originally began as an extension to C, and Java and C# which borrow C lexical conventions and operators.
  • C was therefore useful for many applications that had formerly been coded in assembly language.
  • array indexing as a secondary notion, defined in terms of pointer arithmetic
  • No automatic garbage collection
  • C supports a rich set of operators, which are symbols used within an expression to specify the manipulations to be performed while evaluating that expression.
  • C99, new standard for the C programming language

for example:
long int SomeFunction();
/* int OtherFunction(); */

/* int */ CallingFunction()
{
long int test1;
register /* int */ test2;

test1 = SomeFunction();
if (test1 > 0)
test2 = 0;
else
test2 = OtherFunction();

return test2;
}


DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.

1 March 2009


C programming language...

Lecture One – Variables and Functions

What these lecture notes cover

These lecture notes should cover the following topics:

· Some introductory material in which I justify this course’s existence.

· More detail about the "Hello World" program.

· Elements of C – pre-processor, language and libraries.

· Keywords in C – a first look.

· Variables and types in C.

· What are functions and what is prototyping?

· What is scope and why is it useful?

· Syntax of the C language

These notes assume you have already worked through and understood the exercises in Worksheet One.

Lecture One – Variables and Functions. 1

What these lecture notes cover 1

Introduction – What we hope to teach you (and why) 1

Why teach C?. 2

Writing compiling and running a C program... 2

Hello World revisited. 3

Elements of C – Pre-processor, Language and Library. 4

Keywords in C.. 4

Types of variable. 5

Choosing names for variables. 5

char variables. 6

Other types signed/unsigned short/long and const 6

Some more simple mathematical operations ++, --, +=, -=, *=, /= and %.. 7

Functions. 7

void functions. 10

Returning from functions (the return statement) 10

Prototypes of functions. 12

Local variables, Global Variables and Scope. 12

Summary of Language elements learned in worksheet and lecture one. 14

Example code using language elements from worksheet and lecture one. 16

Introduction – What we hope to teach you (and why)

This course aims to teach you how to program in the C programming language (obviously). There are very good reasons why a mathematician should learn how to program:

1) A good chunk of modern mathematics (much of chaos theory and proving the four colour theorem to give but two examples) relies on computer programming and would be inaccessible without it.

2) Computer simulation techniques allow us to apply mathematical ideas to solve real-world problems (such as setting traffic signals or curing congestion on the internet).

3) If you decide that you don't like being a mathematician after all, computer programming will make you employable.

finally, and most importantly,

4) Computer programming can be fun (really, it can be fun I don't necessarily guarantee that it will be fun).

In this course I hope to teach you:

· How to program in the C language and use the most common libraries.

· How to write stylish and elegant programs.

· How to write mathematical programs that are small and fast running.

· How to document code so that other people who might have to use it don't want to kill you.

· How to tell a good algorithm from a bad algorithm (well, how to make an educated guess anyway).

· Some simple and handy techniques which will serve for everyday programming needs.

I do not plan to teach you:

· The latest fancy Windows graphical widget (it may be fun but you'll have to learn a new one in a few years).

· How to create all-singing, all-dancing multimedia products (sorry, we're mathematicians not internet consultants).

Why teach C?

There are a large number of programming languages in the world today. Why am I teaching you C and not (to name but a few) C++, Java, Ada, BASIC, COBOL, Perl, Pascal, Smalltalk, Assembler or FORTRAN. There are several reasons to learn C:

· C is a common language. There are an awful lot of C programs out there. In fact we would go so far as to say that there are more lines of C code than any other language in the world today.

· C is a small language. C has only thirty two keywords (and only about twenty of them are in common use). This makes it relatively easy to learn (we hope) compared with bulkier languages.

· C is a stable language. The ANSI standard for C was created in 1983. The language has not been revised since then. (Sadly this doesn't mean that all C code is standard). In newer languages (mentioning no names) the standard changes regularly and often and what is good code today may not compile properly tomorrow.

· C is a quick language. A well written C program is likely to be as quick or quicker than a well written program in any other high-level language.

· C is a core language. That is to say, a number of common and popular computer languages are based upon C. Having learned C, it will be much easier for you to learn languages which are largely, or in part based upon C. Such languages include: C++, Java, awk and Perl.

Indeed, it is often said that C is the second best language for any given programming task. The best language depends on the nature of the particular task but the second best language is C, whatever the task.

Writing compiling and running a C program

Some jargon listed for you:

–Source code: The stuff you type into the computer. The program you are writing.

–Compile (build): Taking source code and making a program that the computer can understand.

–Executable: The compiled program that the computer can run.

–Language: (Special sense) The core part of C central to writing C code.

–Library: Added functions for C programming which are bolted on to do certain tasks.

–Header file: Files ending in .h which are included at the start of source code.

Just to remind you about your experience in worksheet one, there are three stages to writing a C program as shown by the diagram:

Firstly you must write the program’s source code – that is to say the C language instructions shown in the first box above. (Teaching you how to do this is what this course is about).

The second stage is to compile the program. This causes the computer to take the source code and attempt to make it into an executable – that is to say a program which the computer can run. As a beginner you will find that your programs will often fail at this compilation stage and the compiler will complain about problems with your code.

The final stage is to run the executable code. Some errors will still turn up at this stage.

Hello World revisited

You probably saw easily enough of the Hello world program in Worksheet one. Here it is again to remind you:

#include

/* My first C program which prints Hello World */

int main (int argc, char *argv[])

{

printf ("Hello World!\n");

return 0;

}

There's a lot to be learned from this particular example. For one thing, C doesn't care about whitespace much (spaces, returns and tabs). So the program would work just as well as:

#include /* My first C program which prints Hello World */

int main(int argc, char *argv[]){printf("Hello World!\n");return 0;}

(But note that nothing but the comment could go on the # line and it was necessary to keep some of the spaces.)

On the other hand it could be written as:

#include

/* My first

C program

which prints

Hello World */

int

main

(

int

argc

,

char

*argv[]

)

{

printf

(

"Hello World!\n"

)

;

return

0

;

}

(The #include statement cannot be broken up and anything within " marks should stay on the same line but other than that anything goes). The first version of the program looks MUCH nicer and it is expected your code will look more like the first version than the strange example given.

Elements of C – Pre-processor, Language and Library

There are three main elements to the C language all of which are represented in "Hello World". The pre-processor is so called because it makes alterations to the C source code before the source code is compiled. Pre-processor statements begin with a # character. In this case, the pre-processor statement we have is a #include statement. #include tells the pre-processor to "glue in" another bit of C source code here. Included files are known as header files and by convention have the extension .h. The angle brackets surrounding the file name tell you that the file being included is part of the C libraries on this machine. In this case, it is the standard library header stdio.h which contains information about standard input and output routines. We will learn more about the pre-processor later and also how (and why) C programmers write their own header files.

The C language (which is, after all, what is being taught) is an extremely small base of a very few keywords and syntactical elements. (C has only thirty two keywords – they are listed later in these notes – and most of them you don't need to use anyway).

Finally, there are the C libraries. The libraries are full of helpful routines which do general "useful things" that you might commonly want to do. If the task you're thinking of is quite simple or common (sorting a list of numbers into order or calculating cosines for example) then the chances are there's something in the C libraries to do it. In C, even things as basic as printing to screen or writing information to disk are library routines. In Hello World, we used the library routine printf which writes to screen. To access the stdio library (standard input and output) we had to include the header file. It sometimes surprises people that C considers disk access and printing to screen as not important enough to be in the language but instead consigns them to a library.

Keywords in C

Here are the C keywords (the categories depend on the prejudices of your lecturer):

Flow control (6) – if, else, return, switch, case, default

Loops (5) – for, do, while, break, continue

Common types (5) – int, float, double, char, void

For dealing with structures (3) – struct, typedef, union

Counting and sizing things (2) – enum, sizeof

Rare but still useful types (7) – extern, signed, unsigned, long, short, static, const

Keywords which are pure and unadulterated evil and which we NEVER use (1) – goto

Wierdies that we don't use unless we're doing something strange (3) – auto, register, volatile

(Total keywords: 32)

We will revisit it later in the course, when, hopefully, it will mean a little more. As you can see, we've already covered a good chunk of the language: int, float, double, while, return, if, else and for means that we've already covered 8/32 of the C language. (Even more if we take into account that the last four keywords won't be used). Don't bother learning the table (most C programmers couldn't list all 32 keywords) but just take heart that you've already got so far through it.

Types of variable

C is a "weakly typed" language. That means, you can't just plonk down a variable name and start using it – you have to tell the compiler what type of variable it is first.

This may seem a nuisance for you but it has a number of benefits to the programmer – not least of which is that it prevents code like this from compiling:

my_variable = 1;

while (my_varible <>

do something

my_variable++;

}

which would cause you a lot of headaches.

[A strongly typed language is one where you cannot convert between one type and another without explicitly telling the program are about to do so – the bondage and discipline school of the programming. An untyped or run-time typed language is one where you do not have to declare a variable before using it. In an untyped language the above program would be legal but would not do what you might expect if you didn’t notice they spelling error.]]

We've already met int, double and (briefly) float so let's look at some other common variable types.

double is like a float but has twice the "precision" (loosely speaking, it has more decimal places). So why not use double all the time? Because it has more digits, it's likely to be slower and it's definitely going to take more memory up. Use a float when you want to save memory or time and double is too large or slow.

IMPORTANT RULE: Whenever you want to use a variable in your program it must first be declared. This means you must tell the C compiler its type and its name. This is done at the start of main (or at the start of a function). The type of the variable will be int, float, double (or some other things we will see later). Its name is up to you but there are good names and bad names.

Choosing names for variables

Variable names can be just about any combination of letters and underlines but must not start with a number. By convention, C programmers use lower case or Mixed Case variable names but not UPPER CASE [the reason should become clear later, but, in any case, if you program in all UPPER CASE, people will think you're a FORTRAN programmer, which is in itself enough reason to not do it]. The exact rules for naming variables are found in K&R on page 35.

Good variable names reflect the purpose of the variable and how commonly it is used. They should not be too long nor too short for their role in the program. If you only use a variable three or four times you will not mind calling it My_important_loop_variable_used_to_count_sheep but if you have to use it a lot you might regret all that typing. For historic reasons, it is traditional to use i,j and k as loop counter variables in for loops. You don't have to do this but, when you do, it reassures everyone else that you know what you're doing and also helps clarify what's going on.

Try to express what your variable does in the program using its name (if it counts the number of students call it no_students not n or num). You might like to use underscores for this. Variable names are usually lower case or MixedCase.

char variables

char is a character variable. That is to say that it can hold one (and only one) alpha-numeric character. In C, single characters must be specified using single quotes. For example:

char a= 'A';

char space= ' ';

char one= '1';

char new_line= '\n';

(The last example might seem a bit confusing since it looks like two characters, as in the Hello world program – '\n' translates to only one character – the character "newline" which returns you to the start of the next line of printing.)

Caution: It is a common beginner mistake to put a char in double quotes or a string (see later in the course) in single quotes.

In a printf statement you can use %c to print a char.

Note: In fact, a char is really just a one byte number – so you can equally well say:

char a= 45;

You can find out what numbers correspond to what characters by doing something like this:

printf ("Character %c is the same as number %d\n",'e','e');

/* 'e' is interpreted first as a character then as a number */

Other types signed/unsigned short/long and const

It is important to remember that variables take up a certain amount of storage space and have a limit on what type of numbers they can store. For example, a char variable can never store a number larger than 255. How high a value an int can store depends upon your compiler.

There are a number of alterations we can make to variables. For example:

signed or unsigned can be added before the type to say whether or not a variable can be negative or not. For example:

unsigned char c;

declares that C can hold a number from 0 to 255. We can also declare ints to be signed or unsigned.

We can also declare ints, floats and doubles to be long or short. long uses the maximum length for that type of variable permitted on that computer and short uses the minimum length. long and short can be combined with signed and unsigned.

Note that no guarantees are made that on any given machine longs are bigger than ints or that shorts are smaller.

You will not often use long, short, signed or unsigned except when space is extremely low and you want a large number of variables of that type.

We can also declare a variable as const meaning that it is constant and cannot be changed. This can be useful for example when declaring fundamental constants.

const float e= 2.718281828;

Some more simple mathematical operations ++, --, +=, -=, *=, /= and %

Recall from the worksheets that ++ is shorthand for "add one to variable" and -- is shorthand for "subtract one"

IMPORTANT RULE: ++i means increment and then use and i++ means use then increment. For example:

i= 5;

printf ("%d\n",i++);

would print 5 whereas:

i= 5;

printf ("%d\n",++i);

would print 6.

However, it is far clearer and better not to rely on this behaviour since it is confusing and can backfire. It is far safer and clearer to write:

i= 5;

printf ("%d\n",i);

i++;

for the first example and:

i= 6;

printf ("%d\n",i);

for the second example. In C it is possible to construct horrendous and complicated examples – but it is usually better for everyone's sake if you don't.

In addition we have the following:

-- (subtract one from variable) e.g. countdown--; (Count down counts down by one).

+= (add to a variable) e.g. a+= 5; (add 5 to a).

-= (subtract from variable) e.g. num_living-= num_dead; (Subtract the dead from the living ).

*= (multiply a variable) e.g. no_bunnies*=2; (They breed like rabbits).

/= (divide a variable) e.g. fraction/= divisor; (Divisor was clearly a good name for it).

Another mathematical operation that we missed out is modulo %.

(x % y) returns the remainder when x is divided by y – obviously using integers.

Casting between types

Mixing types can cause problems. For example:

int a= 3;

int b= 2;

float c;

c= b*(a/b);

printf ("2 * (3/2) = %f\n", c);

doesn't behave as you might expect. Because the first (a/b)is performed with integer arithmetic it gets the answer 1 not 1.5. Therefore the program prints:

2 * (3/2) = 2.000

The best way round this is what is known as a cast. We can cast a variable of one type to another type like so:

int a= 3;

int b= 2;

float c;

c= b* ( (float)a / b);

the (float)a construct tells the compiler to switch the type of variable of a to be a float. [b was automatically cast to float to match a). This isn't often useful but can sometimes get you out of trouble. The main use of casting is when you have written a routine which takes a variable of one type and you want to call it with a variable of another type. For example say we have written a power function with a prototype like so:

int pow (int n, int m); /*Prototype for square root function */

/*which calculates n^m */

We might well have a float that we want to find an approximate power of. Your compiler should complain bitterly about you writing:

float n= 4.0;

int squared;

squared= pow (n,2); /* The compiler will not like this because it

expects n to be of type int not float*/

However, in this case, we want to tell the compiler that we do know what we're doing and have good reason for passing it a float when it expects an int (whatever that reason might be). Again, a cast can rescue us:

float n= 4.0;

int squared;

squared= pow ((int)n,2); /* We cast the float down to an int*/

IMPORTANT RULE: To move a variable from one type to another then we use a cast which has the form (variable_type)variable_name.

CAUTION: It can be a problem when we downcast – that is cast to a type which has less precision than the type we are casting from. For example, if we cast a double to a float we will lose some bits of precision. If we cast an int to a char it is likely to overflow [recall that a char is basically an int which fits into 8 binary bits].

Functions

An important concept in C is the idea of the function. A function is an effective sub-unit of a program. We have already encountered one function without explicitly calling it that: printf. C allows you to write your own functions (indeed, if you are to write anything but the simplest programs it requires you to do so). main itself is a function. Let's take an example. We might want to have a function which returns the largest of two integers. Here's how you would write it:

int maximum (int a, int b)

/* Return the largest integer */

{

if (a > b) return a;

return b;

}

This function takes two arguments both of which are integers. It returns the value of the largest integer. (If the two values are the same, it will return the value of the second – which doesn't matter because the two values are the same). Note that return is being used here in the same way as return was used from main but returning from main exits the program whereas returning from a function returns control to wherever the function was called from.

IMPORTANT_RULE: Function names follow the same rule as variable names. Letters, numbers, underscores and don't start with a number. It's also a wise idea not to call your function the same as a library function – using lower case letters is conventional.

We can use this from main or from another function as follows:

#include

int maximum (int, int); /* Prototype – see later in lecture */

int main(int argc, char *argv[])

{

int i= 4;

int j= 5;

int k;

k= maximum (i,j); /* Call maximum function */

printf ("%d is the largest from %d and %d\n",k,i,j);

printf ("%d is the largest from %d and %d\n",maximum(3,5), 3, 5);

return 0;

}

int maximum (int a, int b)

/* Return the largest integer */

{

if (a > b) return a;

return b;

}

Note that in the printf function, we used the result from a function maximum(3,5) as a function argument. We can use a function inside another function to build up a more complex function as follows:


int max_of_three (int i1, int i2, int i3)

/* returns the maximum of three integers */

{

return (maximum (maximum(i1, i2), i3));

}

This example takes a bit more thinking about. We're using our previously defined function maximum in quite a sophisticated way. Perhaps it would help if we think of the example using some actual values. If we called the function max_of_three with the values (4,7,8) using the line max_of_three(4, 7, 8); then we would set the local variables i1, i2 and i3 to the values 4,7 and 8. The complicated looking statement first calls maximum(i1,i2) where i1 is 4 and i2 is 7 which, as we would expect returns 7. The line then calls maximum a second time with 7 and i3 which is 8 which is what the function returns. Therefore it has correctly found the maximum of 4,7 and 8. OK, so that's not exactly rocket science, but it gives you an idea of how functions can build upon each other.

We could have made the above bit of code look a bit clearer by writing:

int max_of_three (int i1, int i2, int i3)

/* returns the maximum of three integers */

{

int d;

d= maximum (i1, i2);

d= maximum (d, i3);

return d;

}

Not only is this second version a bit clearer, it is likely to be just as fast using a modern optimising compiler. (Many people make the mistake of assuming that more semi-colons means a slower program. It isn't necessarily so.)

void functions

Note that a function doesn't have to take any arguments or return any. To indicate this we declare the function as void. We might for example want to write a function which simply prints hello:

void print_hello (void)

/* this function prints hello */

{

printf ("Hello\n");

}

or we might want a function which prints odd or even depending on the argument we send it

void odd_or_even (int num)

/* this function prints odd or even appropriately */

{

if ((num % 2) == 0) {

printf ("Even\n");

return;

}

printf ("Odd\n");

}

Returning from functions (the return statement)

Note here that we use return to jump back out of the function early without getting to the end. Note that it is an error to "fall off the end" of a function which is supposed to return something.

int function_returning_int (void)

/* This is an error */

{

printf ("I am not going to return an int\n");

}

And it is also an error to try and return a value from a function which is supposed to return void.

void print_i_value (int i)

/* This is also an error*/

{

printf ("i is equal to %d\n", i);

return i;

}

IMPORTANT RULE: A function can only return one value. (A void function doesn't return any values).

Beginners often see this rule as a fundamental problem with C. "What if I want to return TWO values?" We shall see later that this rule is not as limiting as it seems and when it is a problem, there are ways round it.

IMPORTANT RULE: A function does not change the values of its arguments.

For example if we define a function to return the square of a number:

int squared (int i)

/* Squares i */

{

i= i*i;

return i;

}

then we can test it with this code:

#include

int main()

{

int i= 2;

printf ("i squared is %d\n",squared(i));

printf ("i is %d\n",i);

return 0;

}

which will print:

i squared is 4

i is 2

it will NOT print:

i squared is 4

i is 4

The reason for this is that functions only have a local copy of the values sent to them. In C this is known as pass by value. Variables passed by value to a function

We shall be returning to the concept of functions a lot since they are one of the most important concepts in the C language. For now, simply remember that, using a function you can create an addition to the C language which takes a number of arguments and may return a single value.

Prototypes of functions

One important thing about functions is that they should be prototyped. Prototyping involves telling the compiler in advance about the function that you write later. Here are function prototypes from some of the functions above:

int maximum (int,int); /* Prototype for maximum function above*/

int max_of_three (int,int,int); /* Return largest of 3 ints */

int function_returning_int (void); /* Returns an int */

void print_i_value (int); /* Prints the value of the integer */

Obviously the comments are optional but function prototypes are an excellent place to add comments to your code. Since the function prototypes are all together in the same place, it is a convenient place for someone browsing your code to look for what the functions actually do. You might like to repeat the comments later when you actually come to write the functions themselves.

IMPORTANT RULE: Every function that you write (apart from main) should have a prototype and the prototype should occur before the first time the function is used and before the function is defined.

The correct place for a prototype is after any #include statements but before you start any other functions. [Actually, the strictly correct place to put function prototypes is in a header file of their own we will tell you how to do this later – for now put them after the #include statements but before main and the other functions.] Shrewd students might well be asking "Why doesn't printf need a prototype?". It does. The prototype for printf (along with lots of other things) was what you were including in your program when you #include d that mysterious stdio.h file.

It doesn't matter which order you actually put the functions in the code. Some people like to have main as the first function in a file – which makes some sense since it is the first one which runs. It doesn't matter to the compiler which order you have them in though.

Local variables, Global Variables and Scope

In C, variables are local to the function in which they are declared. That is to say if we have a function:

float circumference (double r)

/* Return the circumference of a circle given its radius*/

{

double pi= 3.14;

return (2*pi*r);

}

the value of pi cannot be used in a subsequent function for example:

float double(float r)

/* Return area of circle given radius */

{

double (pi*r*r); /* pi is not defined here although it was

defined earlier*/

}

would be an error since pi was defined in circumference locally – it is undefined in area. Like many rules of C that seem quirky to the beginner, there is a very good reason for this. Imagine it were not the case. We might, if we were inclined, write a routine to print n asterisks.

void print_stars (int n)

{

int i;

for (i= 0; i <>

printf ("*");

printf ("\n");

}

If we want to write a routine to print 5 lines of 5 stars we should expect that the following will work:

int i;

for (i= 0; i <>

print_stars (5);

And, indeed, this does work as we would expect and prints 5 rows of 5 stars. However, if the variable i were NOT local in scope then by the time the first row of stars had been printed, i would be set to 6 and the loop would exit after printing only one row of stars. This would be startling for the programmer and this is the reason why C variables are normally local in scope.

If you do want to use global variables (and sometimes you do) then it can be done. Simply put the variable declaration outside function bodies in your program and the variable will be global and will be usable by any function below the point where it is defined. Normally you will want global variables to be visible in the entire program and therefore they are normally positioned after the #includes but before the first function and the main function.

IMPORTANT RULE: A variable which is declared outside a function is global and it is usable in any function below the point where you declared it. It is good practice if you are going to use globals to put them at the top of the code (but see the next note).

CAUTION: Using global variables is extremely bad style. They have their purpose, of course, but they can be extremely confusing and cause more problems than they are worth. Use EXTREMELY sparingly.

Debugging

A good technique for "debugging" code is to think of yourself in place of the computer. Go through all the loops in the program and ask "what is in each variable?" Each time you go through a loop ask "is the condition met" and "should I continue" The factorial program shows how to do this. Can you see the bug?

CODE

THOUGHTS ABOUT CODE


number= 4

answer= 1

count= 4

enter while loop

answer= 1*4=4

count=3

enter while loop

answer=4*3= 12

count=2

enter while loop

answer=12*2= 24

count= 1

enter while loop

answer= 24*1= 24

count= 0

enter while loop

answer= 24*0= 0

AHA – I see!!!

#include

int main(int argc, char*argv[])

{

int number= 4;

int answer;

int count;

answer= 1;

count= number;

while (count >= 0) {

answer= answer* count;

count--;

}

printf ("%d! = %d\n",

number,answer);

return 0;

}

Here are some other debugging techniques:

  1. Check missing brackets and commas.

  1. Check that you have a semicolon at the end of every line which needs one.
  2. Put in some printfs– if you know what your program is DOING you will know what it is DOING WRONG.

  1. Try to explain to someone else what the program is meant to do.

  1. Take a break, get a cup of coffee and come back to it fresh. (Debugging is FRUSTRATING).

Summary of Language elements learned in worksheet and lecture one

One of the most confusing things to a new C programmer is the syntax of the language. When do you need to put a semi-colon on the end of the line? When do you need a { or a } to indicate a block of code? When do you use = and when do you use ==? What goes in which order? When do I begin a statement with a # and when don't I?

While we will try our very best to answer these questions, there is no substitute for experience. The best way to learn programming is to get out there and practice it. If you can't work out how to "say" something in C then try to find some code that says something similar. [Of course, just because someone out there does something a certain way does not necessarily mean that is the best way to do it.]

The complete syntax of C is listed in a mildly confusing way in K&R pages 191-233 and in a really, really confusing way it is summarised on pages 234- 239. No C programmer ever learned how to write C by reading and memorising these rules. Let's instead summarise some of the rules we have learned so far:

Comments begin with /* and end with */ and can contain anything (well, anything except for a */).

Lines beginning with # are pre-processor directives. #include adds in a header file to your code.

Pre-processor directives do not have semi-colons at the end.

Every function should have a prototype which comes before the function (preferably at the top of the code just after the #includes – later we'll show you how to use header files which is the proper place for prototypes). Example function prototypes are:

int add_three_ints (int, int, int);

void print_a_char (char);

A function starts with the type of the function followed by its name then the arguments with their types and names – and no semicolon.

int add_three_ints (int i1, int i2, int i3)

void print_a_char (char c)

Every C program has a main function which returns an int. We can declare it like so:

int main(int argc, char *argv[])

A function body starts with a { and ends with a }.

The first thing in the function should be declarations of variables (which can also be initialised at this point) for example:

int milk, brilliant; /* Declares milk and brilliant as integers */

float pi= 3.14; /* Declares a float pi and sets it to 3.14 */

double big_num= 3e9; /* Big_num = 3,000,000,000*/

char c= 'c'; /* Declares a char and sets it to 'c' */

int same_as_c= c; /* Declares an int and sets it to the value of

the char c */

Variables declared outside functions are global and are available for use in any function below where they are declared. Global variables are bad style and should be avoided.

There are various mathematical assignment operations: +,-,*,/,% and shorthands ++, --, +=, *=, -=, /=

while (condition){

commands;

}

repeats the commands inside the braces until condition is false. (If condition starts false then while never does anything – this can be useful sometimes). If we miss out the braces, then the while loop only repeats the one next command – for example:

i= 1;

while (i <>

printf ("%d\n",i++);

is the same as:

while (i <>

printf ("%d\n",i++);

}

both would print numbers from 1 to 5. [If we'd used ++i it would have printed the numbers from 2 to 6]

A for loop has three parts separated by semicolons an initialiser, a condition and an counter increment.

(Note that any one of these three parts can be omitted). A for loop sets the initialiser and then repeats the commands within the loop until the condition is false – the count initialiser is performed once at the end of each loop. For example:

for (i= 1; (i <>

printf ("%d\n",i);

}

Will also count from 1 to 5.

if (condition) {

commands;

} else {

other commands;

}

will perform commands once if condition is true and other commands once if condition is false. As with for and while, if the braces are omitted then only the next single statement part of the if statement.

Conditions for while, for and if are > >= < <= == and !=.

!= means not equal to - ! means not and can negate any expression for example !(a == 3) is the same as (a != 3)

0 means false and non zero means true. (So if(5) is always true and if(0) is never true). A true expression evaluates to 1 so:

a= (3 <>

will set a to be equal to 1.

¦¦ within a condition means OR, && means AND and ! means NOT.

Finally return; returns from a void function and return variable name; returns from a function returning a variable of type variable name.

Example code using language elements from worksheet and lecture one

/* Program does very simple arithmetic for numbers < style="">

Answers are printed as stars.

Might be useful for showing children maths */

#include "stdafx.h"

#include

Function prototypes go here at the start


void print_number(int);

/* Prints int stars in a block */

void print_stars (int);

/* Prints a row of stars */

int main(int argc, char* argv[])

{

int no1= 48; /* Two input numbers and an answer */

int no2= 7;

int answer;

int sum_type= 4; /* 1 means add 2 means subtract

3 means multiply and 4 means divide */

char op_sign; /* Sign of this operation */

int remainder; /* Remainder -- if we are doing division */

/* Check our inputs are in range */

if (no1 <= 0 || no1 >= 50) {

printf ("The first number is not in the range 1 - 49");

return -1;

}

if (no2 <= 0 || no2 >= 50) {

printf ("The second number is not in the range 1 - 49");

return -1;

}

/* Check for divide by zero */

if (sum_type == 4 && no2 == 0) {

printf ("Cannot divide by zero\n");

return -1;

}

/* Calculate the answer */

if (sum_type == 1) {

answer= no1 + no2;

op_sign='+';

} else if (sum_type == 2) {

answer= no1 - no2;

op_sign='-';

} else if (sum_type == 3) {

answer= no1 * no2;

op_sign='*';

} else if (sum_type == 4) {

answer= no1 / no2;

op_sign='/';

remainder= no1 % no2;

} else {

printf ("Unknown sum type %d\n", sum_type);

}

if (answer <= 0 || answer >= 50) {

printf ("The answer is not in the range 1 - 49");

return -1;

}

print_number(no1);

printf (" %c\n", op_sign);

print_number(no2);

printf (" =\n");

print_number(answer);

if (sum_type == 4 && remainder > 0) {

printf (" remainder\n");

print_number(remainder);

}

return 0;

}

void print_number(int inp_number)

/* Print inp_number stars as blocks of ten */

{

/* While there are more than ten stars to print then print a full row */

while (inp_number > 10) {

print_stars(10);

inp_number-= 10;

Here are the functions themselves

}

print_stars(inp_number);

}


void print_stars(int stars)

/* Print 'stars' many stars */

{

int i;

for (i= 0; i <>

printf ("*");

}

printf ("\n");

}




DISCLAIMER:
THIS ALL THE DATA IN FROM WHICH WE FATCH IS ONLY FOR THE LEARNING PURPOSE ONLY AND IT ARE RESPECTIVE RIGHT OF THEIR OWNERS.
HERE PICTURES ARE TAKEN FROM WIKIPEDIA.ORG or any public website.