Sunday, 28 August 2011

Open Source Programming VS Closed Source Programming

Open source is a general software license that has revolutionized the software development industry. Before open source software development was limited to the combined effort of a few corporate-hired software engineers working in small groups. The open source movement has changed the way the software is developed. Open source uses broad community-based development techniques that replace a small group of profesional programmers with a large base of experienced individuals. While most large corporations are reluctant to give up the proprietary business model, some have started to realize the benefits of open source in the development of their software. In fact, free open source software, when coupled with service and support, can be profitable for major corporations. This website contains valuable information regarding the open source movement’s advantages, disadvantages, and its repercussions on the global software market.

Open source and proprietary developers have been in a heated battle over market share.
But with billions of dollars in the corporate pocket, are the open sourcers fighting an uphill battle?

Open Source Programming

Software companies from across the world have embraced the open source business model. From flavors of Linux to enterprise-class web server software, an increasing number of software companies are opening their source code to developers. Examples of this practice can be found almost everywhere. File sharing programs like Limewire have an open source model which pays private programmers to update small parts of the program. Sourceforge.net, arguably the largest online open source community, has pioneered the collaboration of open source projects. To date, they have nearly 1.25 million users and over 100 thousand projects. Sun Microsystems, a publicly traded corporation, has begun to make source for popular software like Solaris and Java open. These movements towards open source represent the general trend in the software industry.

Open source software has filled a void left by the proprietary giants. Utilities that would normally be overlooked by major corporations are being developed by individuals and shared around the world. These small programs can prove useful for both private end users and small businesses. The future of software development depends on peoples ability to openly share source amoung developers and to effectivly deliver final products to end users.

Fedora Core 4, an open source opperating system, is shown here in full swing.

Check out these links for good open source software!
Sourceforge.net
Opensource.org
mySQL.com
Red Hat Linux
Sun Microsystems

Closed Source Programming

Proprietary software, unlike open source software, is a pay-to-use service. Propriety software is developed by a small number of professionals working in a corporate think tank. These companies, to protect their intellectual property, provide the end user with only the binary code of a program (the part that only a computer can read). Because these companies make money by selling their programs, rather than their support packages, the source code proves invaluable.

Although the general trend of software development companies is to go open source, the biggest companies have resisted the temptation of open source. Microsoft, the infamous software giant, has been a leader in the proprietary software business model since the dawn of the computer age. Apple, the company holding the second largest share of the market, is also strictly proprietary. Apple even manufactures proprietary hardware, specific to Apple software. The fact that the two largest companies in the software industry have resisted opening their source code shows that proprietary software is still alive and profitable.

Apple computers have always dominated the multi-media market and are a strong force for proprietary software

Check out the following links to proprietary software companies:

Advantages And Disadvantages

Migration. It is difficult for end-users and development companies to drop their proprietary software to move to an open source model. Immature. Open source software has inexperienced developers as compared to professional developers of proprietary software companies. Hard to Deploy. Most open source software solutions don’t have GUI, making it nearly impossible for many end users to install the software.
Lacking support. Since there is no monetary incentive, open source projects can lose steam over time while proprietary software is continually improved.

Sunday, 14 August 2011

Best Introduction to PHP And Also Using PHP.


PHP (the acronym is "recursive" and refers back to itself--it stands for PHP: Hypertext Preprocessor) is a popular server-side scripting language. The fact that it is "server-side" means that special software on the web server is used each time a page with PHP is processed. This software responds to specific commands included within (embedded) in the webpage. Generally, these commands tell it to generate new HTML code which is sent back to the user's web browser. Thus, especially when it is connected to a database on a web server, PHP can be used to generate dynamic web content. There are other uses for PHP that do not involve the internet, but this use of PHP is the most common one today. (Coggeshall)


Like some other technologies, PHP is not tied to a specific software vendor, meaning it is relatively compatible with other technologies and databases. This, and the fact that PHP requires relatively simple software to write and run, makes it a popular choice among programmers, who are seeking something more interactive and dynamic than JavaScript, but not as complex or tied to a single company as ASP.NET. Though there is no formal technical specification for PHP, it is maintained de facto by The PHP Group. (PHP: Introduction)


Examples: Like ASP.NET, PHP is broadly used, especially by small and moderately sized websites. Indeed, the original meaning of PHP was Personal Home Page tools, as it was originally built for the maintenance of the personal website of its creator, Rasmus Lerdorf. PHP is also particularly prevalent in online web discussion boards. All PHP pages end in .php rather than .html or .aspx.



Using PHP


PHP requires software to run, whether it’s on the web server or on your computer. A good guide to installing this software (if you’re installing it on your computer, you’ll be installing a server as well) can be found from Christopher Heng.

PHP can be written in a simple text editor, as it is embedded in the HTML. As with JavaScript, we’ll give a brief example of how to create a sample page, one that offers a welcome message to the viewer. Within the body of a normal HTML page, you can write a PHP tag like this one:

<?php echo '<p>Hello Visitor!</p>'; ?>

If the PHP software is installed on your server correctly and if you saved the page with a file extension of .php and not .html, it will convert this tag to proper HTML for display in the browser, which ultimately renders it as “Hello Visitor!” Of course, you could have performed this task anyway, just using HTML. PHP’s true value lies in its more advanced functionality, which can be used to create interactivity. PHP, like ASP.NET, is often combined with databases. PHP can be used to communicate with a database, gather input or data from a user, and create an interactive experience from that. Of course, acquiring the knowledge to do this takes some practice and study, but PHP is a popular technology for this sort of interaction. Should you want to pursue PHP, we’ve provided a few resources below.

Note that PHP is a server-side technology. If you want .php files to work as designed on a web server, PHP must be installed on that server. Keep this in mind when you choose a web host for your website. Many hosts, but certainly not all, support PHP. Most will clearly state whether or not they support PHP.

The Best Introduction to Databases And Using it.


Database

Concept

The principle of interactivity is clearly seen in databases and their use online. The idea of a database is simple: where plain websites are entirely static (they display the same content every time you look at them, unless the have been manually updated), data-driven websites is one of the things that makes a website dynamic, with new, fresh, content. Essentially, what displays on the page is determined in some part by what's in the database. (Greenspan)
You might be familiar with how a basic webpage works. HTML code that is already written is sent to your browser. Your browser translates this code into a webpage which you can see. With a webpage that uses a database, all or some of the HTML is generated by the data in database, adding an extra step to the process, but meaning that you'll see new data fresh from the database. When the maintainer of the website wants to update a page, he or she manually or automatically (usually the latter) changes the data in the database. The next time you view the page, you'll interact with new data.
How is this interactivity, you might ask. Simple: the website provides you with fresh data from the database, and gives you the opportunity to change the database in most cases (such as when you rank an article or video). Rather than just presenting one, stale page of HTML, it presents a fresh page of generated HTML that represents real-time data. When you perform an action, the data will often update, and, the information displayed. (Chappel)

Examples

Most moderately complex websites use some form of a database. A simple example is an e-commerce site. If you view an item for sale on an e-commerce site, the website will check to make sure the item is in stock before the present a "Checkout" button. If the item isn't in stock, it won't let you buy it, but will rather display a message informing you of this. Notice how sites like Amazon.com and Newegg.com do this the next time your purchase something. Also, most user interactivity connects back to a database at some point. All of those comments and stories from users on Digg, tags on a Flickr photo, or articles on Wikipedia are stored in a database of some sort. 

Using Databases


There are many types of databases. In this getting started guide, we’ll outline what you need to set up a popular free database so that other technologies (such as ASP.NET or PHP) can interact with it.
A popular free choice for webmasters is a type of database called MySQL. You can download the free version of MySQL here. It runs on both Windows and Linux. We also recommend that you download a reference manual here. Once you have the database downloaded and installed, you need to configure your web technology to link it to your website (for example, using ASP.NET or PHP). This is typically done with something known as a “connection string.” Essentially, this is a piece of data that specifies where your database is, what data you wish to access, and what username and password, if any, you are using. Connection strings vary greatly from database to database, but mostly only in syntax—the above concepts are universal across databases and technologies. For more on virtually every type of connection string, see an excellent free resourcehere.
As with ASP.NET or PHP, databases are generally server-side, meaning that they run on your web server. If you want your database to be part of a website visible to the world (as opposed to just an experimental site on your computer), you’ll need to set your database up with your web host. The procedure varies from host to host, but generally you’ll need to upload or configure some files and change your connection string to reflect the new location of your database.
It is also worth covering how data is stored in a database, and what technologies are often used to retrieve it. Almost all data is stored in tables, with columns, called “fields,” and rows, called “records.” A sample table might be named “People” with fields of “First_Name,” “Last_Name,” and “Date_of_Birth.” Each record in this table would have data for all three fields (though some fields can be set to be left blank in some cases, if necessary). Many records can exist in one table, all with the same fields.
To query, or retrieve, this data, a language called SQL (for Structured Query Language) is often used. There are many variants on SQL and it varies slightly database by database. A basic SQL statement though, might look something like this:
SELECT * FROM PEOPLE_TABLE WHERE FIRST_NAME = “JOHN”
As you might know, the * character means all, so this statement selects all of the records—each one represents a different person—from the table with all the people listed and shows or returns the record if the person’s first name is John. This is a very basic SQL query; they are usually much more complex, but you can get the general idea from this.

Introduction To Javascript And The simplest way to use it.


Javascript



The Introduction Part


JavaScript is a client-side scripting language that many webmasters find quite useful. Essentially, JavaScript performs simple actions within the viewer's web browser. This is advantageous because it means that the viewer doesn't need to wait for the website to communicate with the server again.
JavaScript was designed to be similar to many other programming languages (for example, its syntax is quite like the C programming language). It is streamlined, with simple naming conventions, and is designed to be easy to learn. Many web designers learn JavaScript not long after becoming familiar with the basics of static web content such as HTML and CSS. (Andreessen)
Conceptually, JavaScript is similar to AJAX in that in runs within the web browser to perform simple tasks. There are numerous uses for this sort of technology; even though it won't provide the fully dynamic feel that a data-driven website will--JavaScript doesn't interact with much data on the server. Effective use of JavaScript can make your website more intuitive, and can provide your users with a more productive experience. (Web Programming)
Examples: JavaScript, in some form, is used in many websites today. Common examples include user data validation, pop-up windows, and increased responsiveness to user actions. The first is common when the user is expected to enter data; for example, if a website asks for a telephone number and an email address, but the user enters data that does not meet the specific format of telephone numbers (xxx-xxx-xxxx) or email addresses (x@y.z), JavaScript can be used to stop the submission of that data and prompt the user to correct their error. Since many forms of interactivity rely on users submitting data or comments, this form of verification is useful. So, too, is JavaScript used to create pop-up windows and boxes that ask the users to confirm their actions--this can prevent users from taking significant actions, like ordering a product online, inadvertently. As a final example, JavaScript is also used to highlight things for the user; some sites will change the background of a textbox in which the user is currently typing or the link over which the user is currently hovering his or her mouse cursor to highlight such facts to the user. Such highlighting can make submitting data and navigating a website easier.

Using it...

Getting started with JavaScript is quite easy. JavaScript is a client-side technology, which means that there’s no new software installed on the web server for it. JavaScript is part of the actual webpage itself, next to the HTML code. It has a special tag of its own, called the <script> tag. JavaScript code is contained within these tags in the header—a special section—of the HTML page.
JavaScript is also relatively easy to learn and is similar to languages such as Java, C, and C#. To get started with JavaScript, create a basic HTML page, and in the header, add a <script> tag. For example, you could write the following between the <head> tags:
<script language="JavaScript">
alert("Welcome to my page.");
</script>
This would create an alert box that pops up when the visitors views the page and displays a welcome message. Click here to visit this page with the above alert added using Javascript. This feature is one of the most basic in JavaScript.
JavaScript is best used tastefully and sparingly. Most users don’t want to be bombarded with messages each time they click a link—so don’t bombard them! Most users, however, do want to be informed when they’ve submitted invalid data into a form, so it’s certainly appropriate to inform them, often using JavaScript, of such.
There are excellent free resources for JavaScript all over the web. We encourage you to explore it, both for its own merits and as a gateway to more complex, but similar, technologies. The three resources below are excellent overviews for beginners.

Computer fundamentals; Best Information in Short.


The Computer Fundamentals





Disk Operating System (DOS) - it is a collection of special programs that supervise and control the operation of the personal computer. 
Functions of DOS: (a.) interprets and executes commands. (b.) manages the disks, files and directories. (c.) oversees and communicates with peripheral devices. 


Parts of DOS: 


(a.) DOS System Files - it consists of three files: two hidden system files and visible system files: 
(1.) COMMAND.COM - this is the DOS Command Processor and is the interface between the user and DOS. As a command processor, it handles the execution of commands. It is loaded to the computer"s memory upon booting. It is responsible for displaying the system prompt. It access key from the keyboard and interprets the commands so that they can be acted upon by DOS. 
(2.) IBMBIO.COM (Basic Input/Output) - handles the input and output between the computer and its peripheral devices like the disk or the printer. It is hard-coded in the ROM of the microcomputer and cannot be touched by the computer user. It provides basic functions for the computer to communicate with the user. It provides the background and foreground colors on a color monitor. 
(3.) IBMDOS.COM - forms the heart of DOS. It receives all request for DOS service functions and converts them into a form understandable by IBMBIO.COM. It reads and writes data on a storage device. It refers back to the BIOS to handle input and output functions. Application programs could not run without DOS. 




(b.)Internal DOS Commands - these are the programs that reside in the memory of the computer. These commands are referred to as "resident commands". When you type in internal commands, MS-DOS performs them immediately because they were loaded into the computers memory when the system was booted up. 
Examples of Internal DOS Commands: 
CHDIR - changes from one directory or sub-directory to another. 
CLS - clears the screen. 
COPY - copies one or more files to another storage location. 
DATE - displays or sets the date. 
DEL - deletes files from a storage location. 
DIR - lists a file from a directory or sub-directory. 
MKDIR - creates a new sub-directory. 
PATH - displays or sets a search path for executable files. 
TIME - displays or sets the time. 
VER - displays the MS-DOS version number. 
PROMPT - use to set a new DOS prompt or reset the normal DOS prompt. 
RENAME - use to change a file names within the same disk directory.


The upcoming of 3G in our country India...


Hiie friends, Today I Amit Upadhyay will tell you the most important things about the upcoming of  3G in our country India. To know much more about me visit my personal website here .

What is 3G?


3G stands for third generation, and is a wireless industry term for a collection of international standards and technologies aimed at increasing efficiency and improving the performance of mobile wireless networks.3G wireless services offer enhancements to current applications, including greater data speeds, increased capacity for voice and data and the advent of packet data networks versus today’s  switched networks.

Technology

3G wireless networks are capable of transferring data at speeds of up to 384Kbps. Average speeds for 3G networks will range between 64Kbps and 384Kbps, quite a jump when compared to common wireless data speeds in the United States that are often slower than a 14.4Kb modem. 3G is considered high-speed or broadband mobile Internet access, and in the future 3G networks are expected to reach speeds of more than 2Mbps.

The 3G technologies are turning phones and other devices into multmedia players, making it possible to download music and video clips. The new service is called the "freedom of mobile multimedia access" (FOMA), and it uses wideband code division multiple access (W-CDMA) technology to transfer data over its networks. W-CDMA sends data in a digital format over a range of frequencies, which makes the data move faster, but also uses more bandwidth than digital voice services. W-CDMA is not the only 3G technology; competing technologies include CDMAOne, which differs technically, but should provide similar services. 

FOMA services are available within a 20-mile radius around the center of Tokyo, the company plans to introduce it to other Japanese cities by the end of the year. But services and phones are expensive and uptake of this market is expected to be slow.

History

This first-generation analog network may have been cutting edge at the time, but it soon became notorious for its decent call quality. Even worse, anyone with a police radio scanner can easily eavesdrop on AMPS calls, which travel through the air without any scrambling or encryption. AMPS still is available today on some CDMA phones from Sprint and Verizon, but it is largely fading as a technology.

The 1990s marked the arrival of two digital networks: CDMA, popular in the United States and a few other countries; and GSM, the dominant technology overseas. These second-generation (2G) networks spread voice calls across several wireless spectrums, making for more reliable connections that are much harder--though not impossible--for hackers to intercept. More importantly, CDMA and GSM networks are also capable of sending a sliver of data along with voice signals, making possible for such features as text messaging (SMS), caller ID, and conference calling.

Though the move to 2G was a great leap in terms of the technology, the splintering of the CDMA and GSM camps created a mess. At the time, AT&T Wireless, Cingular, and VoiceStream (now T-Mobile) opted for GSM. This required the carriers to adopt the now largely defunct TDMA technology before moving on to GSM. On the other hand, Sprint, Verizon, and a number of smaller carriers chose CDMA. While each side says it has the advantage, the schism resulted in two competing networks with little incentive to create a unifying 3G standard. Conversely in Europe, 3G arrived much more quickly because all carriers were working off a government-mandated standard. 

Of course, there were other factors working against 3G's adoption in the United States. Rolling out the new networks was very expensive, and customers had to be sold on the services. Furthermore, the move also involved technological constraints. Carriers had to bridge the gap between slow-as-molasses 2G service and zippy 3G with "2.5G" network enhancements. In operation a couple years now, 2.5G networks let you download ring tones, listen to short audio clips, send multimedia messages, or surf the Web, albeit slowly. These services include GPRS, which is capable of transmitting and receiving data at an average of about 30Kbps to 40Kbps, or a little slower than standard 56K dial-up service and EDGE, another GSM enhancement that manages about 90Kbps on an average day, or almost twice as fast as dial-up. On the CDMA side is 1xRTT, an early version of CDMA2000, which squeaks in about 60Kbps to 80Kbps. The next step, of course, is 3G and beyond. But some important differences remain. 

Devices 

To support the new generation of networks, standards and services, new device types are being developed. It is envisaged that there will be four device types:

1. Voice Centric: Aimed at a market purely interested in making voice calls, although there will be the  

ability to handle limited data. In terms of look and feel they will not deviate far from the current designs, although styled for the current trends and fashion. The ability to search, select, download and play back music (probably in MP3 format) from various service providers should also be possible with these devices. 

2. Smart Phone: These will still resemble current mobile phone forms but will have increased functionality. The user will be able to play back music and display images (possibly small video clips). Some of these devices may include a small camera for taking still pictures or even provide the ability to video conference. Other services available may include some form of Personal Information Manager (PIM), with email and corporate network access. 

3. Personal Data Assistant (PDA): Akin to the current PDA offerings but with the built-in functionality of wireless access to the UMTS network. Voice services will be accessible but these devices are aimed at the data services. The PDA provides a large screen for video and picture display, and web browsing ease. 

4. Radio Card: It is unlikely these will be capable of handling voice, designed purely for the data services and will not be stand-alone. The Radio Card will be designed to be plugged into a laptop to provide access to the wireless UMTS network. It is Likely to take the form of a PCMIA card.

ServicesThere are two main flavors of 3G: UMTS (Universal Mobile Telephone Service), which is being rolled out over existing GSM networks, and CDMA2000, which brings 3G speeds to CDMA networks; for a detailed explanation of terms, see the glossary. Both UMTS and CDMA2000--which has two high-speed offshoots, the data-only 1xEV-DO and the voice-plus-data 1xEV-DV--are already springing up in a handful of U.S. cities and should be available nationwide by the end of 2005. Speeds for both should be about DSL quality. We're also beginning to see discussions of 3.5G and 4G technologies such as HSDPA and WiMax, which should provide cable modem and gigabyte Ethernet speeds.Of course, you'll need a 3G-capable phone to use one of the new high-speed networks. After some false starts, a handful of 3G handsets have appeared in the last few months such as the LG VX8000 and the Motorola A845. In fact, 3G cell phones were a big theme at the 2005 Consumer Electronics Show in Las Vegas, so you can expect many more in 2005. (See all new cell phone reviews.Laptop users also can take advantage of 3G networks for on-the-go broadband without a Wi-Fi network; all you need is a carrier-supplied PC Card. We first played with Verizon's card in 2004, and we liked what we saw. After starting slowly with just two cities in 2003, Verizon now has the largest 3G network. AT&T started a limited rollout in 2004, and other carriers are expected to catch up in the next couple years. Each has a different process for getting there, of course, and their selection of handsets will vary.

By Amit Upadhyay.

Guys wait for me I will be back again with some new interesting stuff which will be something special for you...

Wednesday, 10 August 2011

The Basic Data Structures of Computer Science.

Friends, I am back with another mind blowing topic of the "The Basic Data Structures of Computer Science".


A data structure is "something" that holds data in the memory of a computer. Sticking data in the memory is quite easy but for example, you store all the names of friends in the computer's memory. What should you do if you wanted to print out an alphabetical listing?
Before we start, here is a brief rundown on the several basic data structures. You should know (to a certain degree) about integers, floats, chars, and bools.

Integers - they store numbers from -32k to 32k
Floats - they can store decimals
Characters - one "symbol" storage, like 'a', '!', and so on.
Bools - they store a "true" or "false" value, represented as 1 and 0's.

What about strings? Well, they're just an array of characters! Hence, they are another data structure!



'h''i''_''1''2''3'
(an example of a string)


a. Stacks - Have you played with Legos? Or as a child, did you try... stacking blocks on top of another? Maybe you have seen people in department stores stack box after box until it reaches up all the way to the ceiling.

Or, the most conventional explanation of stacks: At some restaurants like an all-you-eat buffet, you probably notice that closeby (near all that food) there is a massive stack of plates. You reach out, grab one and instantly the stack pops up!

Now... what happens if you happen to grab the last plate and someone behind you tries to grab one? First of all, there is no plate and he might go hungry which is a "bad" thing. If you are planning to use a stack, make sure you don't grab something that doesn't exist. Your program might crash or funny errors might occur.

What a stack looks like:

apple
oranges
bananas
grapes



Here is some vocabulary:
Pushing - adding something to the stack
Popping - taking something off the stack
Stack overflow - when you add too much stuff onto the stack (like stuffing the stack with so many plates the whole thing... topples over and causes what is known as a "crash")
FIFO - first in, first out. When you add something onto the stack, it is on the top so if you wish to pop something off it, the "something" you just added will be the first one to come off.

Note that in a stack you CANNOT access anything in it except for the top in order to keep with the true definition of a stack.

How do you implement a stack? You could use an array and once you add something onto the stack, you resize it (adding one more cell to the array) and stick it into index 0, or the front of an array. There are other ways to implement stacks and they will be covered!

What are some of the uses for a stack?


Back then, they had calculators based on "RPN" or reverse polish notation. How do you use these calculators? It seems weird compared to the calculators most of us use in school these days. If you wanted to calculate 5 x 7, on a RPN calculator, you would type in 5, hit the enter key, 7, enter, then you would hit the x button. The RPN calculator is based on a stack so the 5 first goes in, then the 7. When the x button is pressed, it pops the 7, then pops the 5 and multiplies them together to show 35! The 35 is then pushed onto the stack for later use. What are the advantages? Let's say you had to solve this: 6 + (5 x (3 + 2 (5 + 2) ) ) = ???? Pretty complicated and tricky to type in on a regular "modern" calculator. How to do this? Type in 6, enter, 5, enter, 3, enter, 2, enter, 5, enter, 2, enter, then a plus. This will give you 5 +2 = 7. Then, 7 is pushed onto the stack while 5 and 2 are popped off. You would then hit x. This pops off 2 and the 7 and pushes back on a 14. And you keep going :) If you notice, this is a lot simpler so here's a programming exercise! Try to program a rpn calculator!

b. Queues - Don't you just HATE standing in line? In fact, some people probably die of boredom just from standing in line...

When people line up in front of something, let's say a ticket booth, only the first person in line gets to buy a ticket. If someone decides to go buy a ticket, he will travel to the end of line and wait until the queue (or line) in front of him is gone.
Here's some vocabulary:
Enqueue - something goes to the end of the line
Dequeue - the first thing in front of the line leaves, and the lines moves up
LILO - last in last out. In a line, the last person to get in is the last one to leave :P That's life!

So how do you implement this? The easiest way (to understand) is to use an array.

A picture of a queue: 



c. Linked Lists
Have you ever built model trains as a child? Connecting each one at the end or at the front... then turning on the switch and watch the train go? A linked list is similar to a train. It can be short (consisting of the locomotive) or it can go all the way hauling tons of materal.

In the world of computers, a linked list consists of "nodes" and each node points to the next one in line. The front of a list is called the head and it starts off the list. The last one in line points to a nonexistent node or a "null" node. This indicates the end of a list.  











How are lists useful? Why not use an array? Linked lists save memory and they are called "dynamic storage" since the size of the list reflects the amount of data. Arrays are "static" since they do not change. There are certain tradeoffs between the two and more about speed and efficiency will be covered in section 5.

There are several different styles of linked lists. With most of these styles, there is another structure that holds 2 pointers. One is to the front of the list and the other is to the end. One is a circular linked list where the last node of the list points to the first node, creating a "chain." You would need that structure to distinguish between the first and last nodes. Another is having each node contain a left or right pointer. There are many possibilities!

d. Hashes
If you ever visit a grocery store (webvan doesn't exist anymore!) and examine some goods, you would probably notice a barcode on every product. What's a barcode? It is an unique id # for that certain item. Or, if you play computer games and you notice some shareware games need a "special key or code" to register and just randomly typing in information doesn't work, it probably works off a hashing scheme.

So what's hashing? Hashing (think of it as taking something and chopping it into pieces) allows the breaking down of data into a much simpler form for storage. Let's say there are at least 10 billion individual products on sale but your store only sells food. Just food. You want to minimize the amount of data storage and you ONLY want barcodes for food products. You don't want to have 10 billion numbers in storage.




This is where hashing comes in. If grapes are item 12421414, you run it through a magic hashing function and it returns "5." Not bad? This can simplify a lot of things since you would only need a storage space large enough to hold up to a 5th item. Now... here's the bad part. What if bananas (20002002) converts into 5? What should you do? Try tweaking your "magic hashing function"? You could and this is called a "collision." This is where linked lists come in. In each data cell of your storage, if there is a collision, the node in that cell will "link" to the node that "collides" with it.

Here is what I would do:
I would create a structure called "food" and have several items in it. The barcode, the name, and price and null pointer.
 
      struct food{

      int barcode_hash;
      string name;
      double price; 

      food *next;
      }; // don't forget this! 
      


This is so if I have a collision, I will still be able to identify the product. I would place all of this in an array from code #0 all the way down to x, where x is the largest value I recieve from the hashing function out of all my products. 

The array would contain structures that could contain null pointers or possibly point to another colliding item. Now, if my scanner scans in 20002002 (bananas) and returns a 5, it goes to location 5 of my array and looks. It sees grapes. The barcode and name for grapes isn't the same as bananas so it moves onto the next node. Tada! It found a match! 
What else could you do with hashes?


On some programs they require you to type in your name, address, name of your pet and you HAVE to type it in correctly. Why? There is a hidden hashing sequence that converts all this data into some "X56zwa31" code you have to type in. How could it work? It could add up your address #, take your name and grab the first letter, then add it onto some weird sequence of letters. It's whatever the programmer decided to have. :) 
Is it possible to crack a hashing sequence? Yes... providing you have enough data but it's pointless. Just register and it will save you the trouble of being cheap. Why? Most hashing sequences are VERY hard to crack. 

Here's an example:
Name: Jonathan
Address: 12345 Anywhere St.
Age: 16
Hashing code: 2TBW1N (yes, it's possible to generate something like this but how about...) 

Name: Vincent 
Address: 34211 Something Lane
Age: 14
Hashing Code: ??? (even if you figure out how to create a code for my data, is it possible to use the same one on Vincent and get the right one?)

e. Trees (a long tall vegetable....) What are trees? In the digital world, they consist of nodes linked to each other... but here's the catch. They are NOT linked together like a linked list. Each node in a tree contains a left and right pointer. These two pointers could point to another node or NULL. 

Binary Trees (what they are commonly called) can be used to store and sort data efficiently. Most of this will be covered in later chapters (speed and the like) but here is why binary trees can be very fast. 

Let's take a binary SEARCH tree which contains sorted values. Everything to the left side of a node is less than the value inside that node and everything to the right of the node is bigger. Now, you might ask this question. What if everything is bigger or lesser than the first node? Wouldn't I get a linked list? You are right and this is a worse case scenario.

In most scenarioes, the binary tree will have some values scattered around, making it more "balanced," or the two sides of the tree (starting from the top node called the head) are roughly the same. This is where BST (binary search trees) come in.

Here is a example:  
























The code: 
 
      struct node{

      int value;   // this could be a character, string, whatever you want to 
				   // compare
      node *next;
      }; // don't forget this! 
      

This is a "roughly balanced" tree as opposed to this one which is a linked list: 3 5 8 9 10 14 15 17
Now, here comes the fun part! Taking the binary tree (not the list), if I wanted to search for the value 5, I start at the head, 10. 5 is smaller than 10 so I go to the left. The next node is 8. 5 is less than 8 so I move on to the left node, which is 3. 5 is bigger than 3 so I move to the right. What do I find? 5! A matching node! 

I'm giving a perfect "rigged" example but this is why you might want to use a binary tree instead of a linked list. What if you wanted to search for 3? Well, it would take you a little longer with the binary tree and the linked list has it as its first node (the head). However, GENERALLY, a binary tree gives you better odds at finding something quicker.


Monday, 8 August 2011

Everything About Operating System, It's Types, Functions, History and Working.


Operating System meaning and definition...




In simple words Operating systems are software's which help user's to interact with a machine . For a normal user a computer without operating system is just a useless machine. Operating systems are not only used in computers but it's installed in almost all user friendly machines operated by humans like mobile phones, robots etc. Now when we consider the computer systems the purpose of operating systems is not only to provide a convenient user interface but also to organize the hardware and software installed in the machine.



Types of Operating System


Real-time A real-time operating system is a multitasking operating system that aims at executing real-time applications. Real-time operating systems often use specialized scheduling algorithms.
Multi-user vs. Single-user A multi-user operating system allows multiple users to access a computer system concurrently. Time-sharing system can be classified as multi-user systems as they enable a mu Multi-tasking vs. Single-tasking When a single program is allowed to run at a time, the system is grouped under a single-tasking system.


Distributed A distributed operating system manages a group of independent computers and makes them appear to be a single computer. The development of networked computers that could be linked.


Embedded Embedded operating systems are designed to be used in embedded computer systems. They are designed to operate on small machines like PDAs with less autonomy.
Chrome OS - Chrome OS is the new operating system developed by Google and it cannot be added in any of the classification listed above. It's not actually an operating system but its a web browser.



History of operating systems


In the 1940s, the earliest electronic digital systems had no operating systems. Electronic systems of this time were so primitive compared to those of today that instructions were often entered into the system one bit at a time on rows of mechanical switches or by jumper wires on plug boards. These were special-purpose systems that, for example, generated ballistics tables for the military or controlled the printing of payroll checks from data on punched paper cards. After programmable general purpose computers were invented, machine languages (consisting of strings of the binary digits 0 and 1 on punched paper tape) were introduced that sped up the programming process (Stern, 1981).


Working Of Operating System


Description of Diagram

Consider the figure; here the user gives instruction through software. Software passes instruction to operating system and OS to hardware. The return path is from hardware to OS and then from OS to software (result). For example you click on the 'X' button to close Windows media player. Then the instruction to that software is passed to Windows operating system and then to the CPU. The CPU executes it and the result you see on desktop is closing of Windows media player.

5 Functions of Operating System

1) Provide user interface - As said earlier without a proper user interface its difficult to manage a machine. It is possible to interact with a machine using the commands, but it's easy to learn all

2) Input/output management - We can add additional hardware's to a computer and configure them easily with the help of an operating system. Printer, external hard disk, scanner, USB drives are some of

3) Memory and CPU management - Operating system allocates the memory and other resources for the other programs in a computer. The memory allocation and CPU usage of each program is controlled by OS a

4) Multitasking - Multitasking is another feature of operating systems (not in DOS). We can do more than one tasks at the same time in an operating system. For example you can listen to music in media

5) Networking - Its easy to do networking with the help of operating systems. You can share files, folders or even hardware resources like printer through a network with the help of operating systems.