Tuesday, September 26, 2006

PERL--->INTRO

PERL was developed by Larry Wall (author of the USENET newsreader rn). Wall developed PERL originally as a data reduction language (that is, a language that is capable of consuming large quantities of data in an efficient manner and performing some function(s) on it).
PERL is an acronym for "Practical Extraction and Report Language." PERL is almost the perfect tool for system administrators since it allows the easy manipulation of files, process information, and many other items. PERL is also great for people who write cgi-bin scripts to process web forms because it has so many useful string manipulation functions.
Since PERL's syntax resembles shell programs and C and it has the builtin functions of awk, sed, and grep, many people find it very easy to learn. One thing to always remember about PERL...."There's always more than one way to do it." Five PERL programmers may write a simple piece of code to perform and function and they may each take five different approaches to accomplish the task.

Sunday, September 03, 2006

DYNAMIC MEMORY ALLOCATION

Whenever we require n bytes of memory using new or malloc, we actually use up at least n bytes of memory, because typically the memory manager must add some overhead to your request. There are two common considerations that affect this overhead are housekeeping overhead and chunk size overhead.

The housekeeping overhead: In a general-purpose or not fixed-size allocation scheme, the memory manager will have to somehow remember how big each block is so that it later knows how much memory to release when we call delete or free. Typically the manager remembers the block size by storing that value at the beginning of the actual block it allocates and then giving you a pointer to "your" memory that's offset past the housekeeping information, this means it has to allocate extra space for that value, which could be a number as big as the largest possible valid allocation and so is typically the same size as a pointer. When freeing the block, the memory manager will just take the pointer we give it, subtract the number of housekeeping bytes and read the size, and then perform the de-allocation.

Of course, fixed-size allocation schemes (i.e., ones that return blocks of a given known size) don't need to store such overhead because they always know how big the block will be.

The chunk size overhead: Even when we don't need to store extra information, a memory manager will often reserve more bytes than you asked for, because memory is often allocated in certain-sized chunks.
For one thing, some platforms require certain types of data to appear on certain byte boundaries (e.g., some require pointers to be stored on 4-byte boundaries) and either break or perform more slowly if they don't. This is called alignment, and it calls for extra padding within, and possibly at the end of, the object's data. Even plain old built-in C-style arrays are affected by this need for alignment because it contributes to sizeof(struct).

AMAZING FACTS

AMAZING FACTS :


1. All moons of the solar system are named after Greek and Roman mythology, except the moons of uranus which are named after Shakespearean characters.

2. Beets reminded early cooks of a bleeding animal when they cut them open, so they started calling them ‘beets’. This was derived from French word ‘bjte’, meaning ‘beast’.

3.’MAYONNAISE’ is said to be the invention of the French chef of the Duke de Rich elieu in 1756.Once he improvised olive oil for cream for preparing a victory feast. This new concoction was named as ‘MAHONNAISE’ in honor of Duke’s victory.

4. Oddly no term existed for ‘homosexuality’ in ancient Greece, there were only a variety of expressions referring to specific homosexual roles.

5. The smallest book in the world is called ‘Chemin da la cruix’. It has 119 pages.
It is 2 inches high and 1.99 inches wide.

6. Young and impoverished, Pablo Picasso had to burn his own paintings to keep them warm.

7. The first kind of pencil was a bunch of graphite sticks held together by a string.

8. The city of St.Petersburg, Russia was founded in 1703 by Peter the great,hence it was named as ‘St.Petersburg’.

9. COFFEE as a medicine reached its highest and lowest points in the 1600’s in England. Coffee trees produce highly aromatic, short-lived flowers producing a scent between jasmine and orange.

10. A spider’s web is made of two types of silk, one sticky and the other non-sticky. the spider first forms the spokes with non–sticky silk and then connects the spokes with sticky silk after the frame has been constructed.

11. Because of the fear of Japanese attack, the Rose Bowl Game of 1942 between Oregan state and Duke university was moved east to Duke’s hometown in Durham, but still Oregan won 20-16.

12. Although people in the majority of countries of the world drive on the right side of the road, there are fifty countries in which people drive on the left side.These include England, Australia, New Zealand etc.

13. Ninety percent of all the volcanic activity occurs in the ocean.

14. The social life in ants and termites has been accompanied by an extraordinary royal perk : a 100 fold increase among queen ants in average maximum lifespan,with some queen surviving for almost thirty years.

15.Blood is red only in the arteries after it has left the heart and is full of oxygen. Blood is purplish, blue color in the veins as it returns to the heart. In fact the blood is red throughout only half your body.

16. Banana is still the number 1 fruit with the world’s leading athletes. It contains three natural sugars-sucrose, fructose, and glucose combined with a fiber. Study has shown that two bananas can provide enough energy for a 90 minutes workout.

17. Table tennis was originally played with the balls made from champagne corks and paddles from cigar-box lids.

18. The Chinese developed the custom of using chop sticks because thy didn’t need anything resembling a knife and fork at the table.

19. After Canada and Mexico, Russia is the nearest neighbor to the United States.
Siberia’s easternmost point is just 56 miles from Alaska.

20.Donald Duck comics were banned from Finland because he doesn’t wear pants.

WHY C???

1. In late seventies, it replaced the more familiar languages like PL/I, ALGOL etc.
There were no advertisements but then too C’s reputation spread, and since then its users are growing at a rapid pace.

2. C helps us to learn the basic language elements, hence migration to other languages like C++, JAVA becomes easy.

3. The basic programming skills incorporated by C helps us to use the program organizing principle called – Object Oriented Programming.

4. Even today there is no language which can beat C when it comes to performance or speed of execution and the reason why the major parts of popular OS like windows and UNIX are written in C.

5. The programs which require both speed and limited memory to run like those in cell phones are written in C.

6. Moreover, C provides several language elements that make hardware interaction feasible without compromising the performance.