Tutorials

Monday, March 14, 2011

Why Java for web applications?(Must read for java programmers)

What exactly a an web application is?

A web application is an application which can be accessed over a network like internet or intranet.

So,think of some common web applications......

yes,it may be anything like any content which we access from a server through our client applications i.e the web browser.Consider the a social networking application.Here you are accessing some contents over the internet.

So now as you are clear about web applications let us think up of some languages using which we can impliment them.Those are C,C++,PHP,Java etc.So let us find out the causes, why Java dominates other languages when it comes to web application.

What are the special features of java?

1.Platform Indeependent(Architecture neutral)

2.Object Oriented

3.Security

3.Robust

4.Multithreading Support

Before discussing  about the above points let us have a look at the lifecycle of a java program.

Java-lifecycle2

or in details

Csprogram1

  • A java program is written using any  text editor like notepad or some IDEs(Integreted Developing Environments) like Eclipse or Netbeans etc. and are saved as .java file.(program.java)
  • Then the program is compiled using the java compiler and converted to .class(program.class)file.And which is nothing but the bytecode of the java program.The .class file will run in any machine indeependent of it's architecture.(Magic of byte code is discussed shortly)
  • The class file(program.class) is now interpreted by the JVM(Java Virtual Machine) of the partcular platform which is a part of JRE(Java Runtime Environment) software.(The architecture of the JVM is discussed shortly)
  • So,we can conclude that the JVM is platform dependent but the bytecode is platform indeependent.

Now,what is the difference between JDK and JRE?

Ans:

JDK(Java Developement Kit) is a bundle of software that you can use to develop Java based software. JDK provides developers with tools like compiler ( javac), document generator ( javadoc) etc…

JRE is an implimentation of the JVM which is used to run a java program.Typically, each JDK contains one (or more) JRE’s along with the various developement tools like like the Java source compilers, bundling and deployment tools, debuggers, development libraries, etc.

So let us understand what is the meaning of Platform indeependent.

software or other technology that "doesn't care" what kind of computer the end user has. Platform-independent applications may run on any kind of computer, or may not rely on the enduser's system for anything other than.

Analyze the above definition with reference to Internet?

Internet has got a large number of users having different set of platforms like operating systems(mac,windows,UNIX,Solaris),web browser(Firefox,Internet Explorer,Netscape,Saffari,Opera,Chrome,Epic,Thunderbard etc) etc.So different platforms obey diffrent set of rules for executing a program.That is why the same c program running on windows shows different behaviour in UNIX.So we have to write different set of codes for both, which increases the programming effort.That is infact more harsh and painful while developing web applications because we can not afford to write different codes for different set of user architectures.Is it possible?So languages C,C++,Fortan failed in this aspect.With reference to the diagram below let's understand the difference between a C program and a java program.

9iv6a
So here comes the utility of java's platform indeependent behaviour.Java generates a .class file i.e the bytecode which is the intermediate form of the code.The bytecode for all java programs are same in all platforms and can be interpreted by all JVMs related to all platforms.So the bytecode can be run in any machine where that platform compatible JVM is installed.So to run a java program you need to have a JVM only and the effort of writting codes is reduced because the same source code can be executed in all Platforms.But the same is not possible using C or C++.But the interpretation takes a bit more time then compilation.In recent versions of Java Just in time compilation(JIT) is added to compensate the time upto some extents.

For internet users just we need to send the compiled class files and it can be executed easily.Now let's have a look at the architecture of a JVM and how it incorporates these things.

Fig5-1
We will not go into deep of each part.

Each time a Java Application is executed then an instance of JVM ,responsible for its running,is created.A JVM instance is described in terms of subsystems, memory areas, data types, and instructions.There can be many instances of JVM created,which can hadle more then one java programes at a time.This concept is used in Multithreading.Each instance of the Java virtual machine has one method area and one heap.

When a Java virtual machine runs a program, it needs memory to store many things, including bytecodes and other information it extracts from loaded class files, objects the program instantiates, parameters to methods, return values, local variables, and intermediate results of computations. The Java virtual machine organizes the memory it needs to execute a program into several runtime data areas.

Object Oriented and Security

For web applications one of the most important requirement is security.A code in java is more secure than a code in C or C++.why?All of you must have heard about the fast,furious and dangerous pointers in C and C++.Using pointers a programmer can have access to any part of the system memory which is not secure, as it can also look up at your personal informations like credit card number,bank acc no etc.More ever you can not trust a program downloaded over internet because it may be a harmful one.But java has overcame this problem quite nicely and intelligently.There is no concept of pointers in Java.(that is why it is more object oriented then C++)But do not think this as a weakness of java because it has implimented some skills which will completely compensate pointer.It is designed in such a way that no java program can have access to the restricted ares.

Robust

In C and C++ the programmer must manually allocate and free dynamic memory.This may sometime leade to problems as  programmers sometime forget to free the memory or sometimes frees  up the required memory.Java virtually eliminates the problem by managing memory allocation and deallocation for you.(Garbage collection for unused objects)

 

These are the features of java which makes it the king of programming languages for web applications.Infact C# is mostly derived from Java.So,as a good programmer you should atleast know these things.

 

 

Have a nice programming experience and keep commenting.

 

 

 

Importance of Electronics and Electrical Subjects in Computer Engineering

Most of the  students pursuing engineering(or established in some IT companies) are confused that why did they study or studying subjects unrelated to computer science as they are going to become a computer engineer.why?As an engineering student you must ask.But unfurtunately the time has passed and we have already cleared those papers securing good grades.And throughout your life you will be questioning yourself about this.

But my article has something for you and after reading this I hope all your questions are going to be answered upto some extent.

As a computer science student I have found the following usefulness of electrical and electronics subjects.So read it carefully.

Basic Electronics

story of IBM computers

The story of IBM's hardware is intertwined with the story of the computer industry – from vacuum tubes, to transistors, to integrated circuits, to microprocessors and beyond.

Remember you have studies about the semiconducturs in the first Basic Electronics class.

All of you must have studied RAM(Random Access Memory) in computer architecture.The RAM itself is made up of semiconductur materials and it is the electrical power only that charges and discharges it, which we say 1 and 0.And the computer understands only 1's and 0's.

You must have studied a little about communication engineering and use of optical fibre cable in BE.That is so important which tells about how signal is tranmitted from one device to another.The device may be a computer also.The Optical fibre cable is the most used medium for signal transmission.And it is one of the important prospective of data communication and networking.

So by studying this subject you learned the building blocks of computer.

Digital Electronics Circuit

I think the importnce of this subject is very high in understanding the basics of a microprocessor and the computations inside computer.

The processor only can perform some fundamental operations like addition,division etc.And most of operations are performed using these basic operations.Everyone knows that computer understands on 0's and 1's.

Each type of operation in a microprocessor's instruction set is specified by an opcode, which is represented as a pattern of 1s and 0s. A compiler or interpreter translates code in a source language to machine code made up of those instructions.

For example, take this code, where a variable, x, is assigned the value of 50:

x = 50;

The compiler might translate that to the following assembly language, where the AX register (for the x variable) is set with the value, 50 (in hexidecimal), using the MOV instruction:

mov ax, 0x32

If the opcode for MOV was 0xA0 and the code for the AX register was 0xB then the machine code, in binary, would look like this:

10100000 00001011 00110010

So we need to study the basic operations of 0 and 1.So in DEC you studied the adder circuit,multiplexor,decoder etc. which are implimented inside the computer to perform these operations.The basic unit inside computer which performs these operations is called ALU(arithmetic and Logical Unit).

Another important thing is that all the data stored in disks resides in the form of 0' and 1's.So,how the data in different formats are converted into 0's and 1's is a big question.This is a thing which every computer engineer should know(must know).If you do not know then you are not supposed to be a world class computer engineer.So here is how it happens.

The Standard ASCII Character Set

Bytes are frequently used to hold individual characters in a text document. In the ASCII character set, each binary value between 0 and 127 is given a specific character. Most computers extend the ASCII character set to use the full range of 256 characters available in a byte. The upper 128 characters handle special things like accented characters from common foreign languages.

You can see the 127 standard ASCII codes below. Computers store text documents, both on disk and in memory, using these codes. For example, if you use Notepad in Windows to create a text file containing the words, "Four score and seven years ago," Notepad would use 1 byte of memory per character (including 1 byte for each space character between the words -- ASCII character 32). When Notepad stores the sentence in a file on disk, the file will also contain 1 byte per character and per space.

Try this experiment: Open up a new file in Notepad and insert the sentence, "Four score and seven years ago" in it. Save the file to disk under the name getty.txt. Then use the explorer and look at the size of the file. You will find that the file has a size of 30 bytes on disk: 1 byte for each character. If you add another word to the end of the sentence and re-save it, the file size will jump to the appropriate number of bytes. Each character consumes a byte.

If you were to look at the file as a computer looks at it, you would find that each byte contains not a letter but a number -- the number is the ASCII code corresponding to the character (see below). So on disk, the numbers for the file look like this:

    F   o   u   r     a   n   d      s   e   v   e   n70 111 117 114 32 97 110 100 32 115 101 118 101 110

By looking in the ASCII table, you can see a one-to-one correspondence between each character and the ASCII code used. Note the use of 32 for a space -- 32 is the ASCII code for a space. We could expand these decimal numbers out to binary numbers (so 32 = 00100000) if we wanted to be technically correct -- that is how the computer really deals with things.

The first 32 values (0 through 31) are codes for things like carriage return and line feed. The space character is the 33rd value, followed by punctuation, digits, uppercase characters and lowercase characters. To see all 127 values, check out Unicode.org's chart.

Now a days the ASCII character set is replaced bu Unicode chracter set,which supports many languages.To know more about this visit http://www.joelonsoftware.com/articles/Unicode.html.

Basic Electrical Engineering and Network Theory

One of my favourite subject is BEE.You would have studies about capacitors,registers etc and their networks.I think now you can realise the importance of the registers and capacitors and how they are used to store data.So,studying their behaviours is so impotrant.

Analog Electronics Circuit

You must have read about transistors in AEC.

Read the wiki's description of transistors.

A transistor is a semiconductor device used to amplify and switch electronic signals. It is made of a solid piece of semiconductor  material, with at least three terminals for connection to an external circuit. A voltage or current applied to one pair of the transistor's terminals changes the current flowing through another pair of terminals. Because the controlled (output) power can be much more than the controlling (input) power, the transistor provides amplification of a signal. Today, some transistors are packaged individually, but many more are found embedded in integrated circuits.

The transistor is the fundamental building block of modern electronic devices, and is ubiquitous in modern electronic systems. Following its release in the early 1950s the transistor revolutionised the field of electronics, and paved the way for smaller and cheaper radios, calculators, and computers, amongst other things.

 

These are the things the teachers should explain the students before teaching the subject matter.Infact every teacher should explain the students that why they are studying the subject.

So keep asking why?

Keep commenting on the articles.

 

 

 

 

 

                                                                                                                                                                                       

 

 

How to use internet efficiently(for Engineers)

For Engineers............

Does not imply that not for others.....but Engineering student will get more help out of this.So be ready for an interesting journey.

Everyone knows that the internet is the one of the best medium to gain knowledge,share your feelings,communication,entertainment,news.........

The list will never end.

But the fact is that it needs exploration.If you will use internet properly then you will get  lots of useful things there or else in other ways then also a lots of things but not useful to increase your knowledgebase.

So I will give you some links and tools which will help you in a great way.(But my advice is that do not limit yourself with the things below only becoz the internet is not limited to any boundry,keep exploring....and in the mean time you will be aquanted with some more unexpected useful things)

1.Do you have an email account?If yes then you are eligible to read the article else close the article and open up an email account now....yes   now and the again come to read the rest.

Assuming you have an email account now

    a.Start communicating by emails and learn how to send a good mail.

    b.Use your email_id as much as possible.

2.start using Google Reade.It will be your best companion throughout the life and it is more useful for them who have a slow internet connection.

"Google Reader is a Web-based aggregator, capable of reading Atom and RSS feeds online or offline. It was released by Google on October 7, 2005 through Google Labs. Reader graduated from beta status on September 17, 2007."

In the above definition there are several terms which needs explanation

Atom and RSS:

The internet is consisting of  lots of web blogs or websites and out of these some are of your liking.But a problem with this is that you need to view the full site again and again to know the new contents.Sometimes you will not find a new article while visiting that site ,which kills your time and also resources.So is there any solution for this?Yes it is RSS which solves the problem.RSS stands for "Really Simple Syndication".If you will suscribe to the RSS of one site then the newly updated contents will be sent to your email account periodically.

Atom:

Atom is not much different from RSS.But Atom is a new technology as compared to RSS.You can find the difference here

 

cool!

So what is google reader's relation with RSS?

It is nothing but a cool RSS reader from Google using which you can subscribe to blogs to get latest updates and posts. So if you have a gmail account you are ready to go.i.e all your favourite website's updated contents at one platform.

To know how to use google reader watch this video from commoncraft Watch it now!

3.Now as you know how to use google reader,its time to suscribe some blogs and websites which are going to help you a lot.So,suscribe the sites below

  1. Techcrunch.com (King of Technology Blogs)
  2. Gigaom.com (Michale Arrington of Techcrunch considers Om as his Guru)
  3. ReadWriteWeb.com 
  4. Pluggd.in (Indian Techcrunch)
  5. JoelOnSoftware.com (a must read for programmers)
  6. CodingHorror.com (another must read for programmers)

So suscribe as many of sites you want and enjoy.....but my friends never stop exploring!

5.www.stackoverflow.com is the best question answer site for programmers and developers.You can ask any question related on any topics and i am sure you will be answered within 24 hrs.So start questioning and also Answering and go on building reputation points which will help you in many ways.

6.Use commoncraft:our product is explanation and watch the videos there which are damn good and make you understand things from scratch.You will find videos there on cloud computing,twitter in plain english,RSS reader and many others.

Here is a video on RSS

RSS_in_Plain_English_-_Common_Craft_-_Our_Product_is_Explanation.mp4 Watch on Posterous

Here is google reader in plain english

 

 

I am greatful to commoncraft for such great things.

Custom_Video-_Google_Reader_in_Plain_English_-_Common_Craft_-_Our_Product_is_Explanation.flv Watch on Posterous

7.start watching the videos at youtube and google video.Lots of good stuffs are there.

8.what you do at home by bunking the classes?Do you bunk the class because you do not feel it interesting?If Yes then visit academicearth.org where you will find the lectures from Havard,Oxford,stanford,Michagon,MIT etc.Beleive me I have personnaly used all these and  I am sure that you will bunk the classes after watching these lecture videos.

9.For freshers I will suggest freshersworld.com,Here you will find lots of placement papers,exam infos etc and lots of other useful things.

10.Go on exploring Google with the search techniques I explained in my first article and the journey will be more pleasent.

11.Use Wikipedia:the free encyclopedia.This one of the best sites I have ever seen.

12.Best website for web designers is W3schools.com.Here you will get all the things related to web-designing and developement,starting from HTML to PHP.

13.Most of may be awered of online compilation.These are the platforms where you can compile your source code directly with out any compiler installed in your computer.The recommended site for that is http://compiler.com

14.If you know something about web programming, read "Getting Real" from 37Signals.

 

and the list continues......................

So,my friends thats it from me now.If you like the article or not or want to add anything new then please do not forget to comment.

But thing is that "Do not stop exploring..............................."

 

 

Including MySqli extension to PHP

As some of you might know that the Mysqli extension for PHP is released.Let us discuss about it in some details:

What is MySqli?

The MySQLi Extension (MySQL Improved) is a relational database driver used in the PHP programming language to provide an interface with MySQL databases. MySQLi is an improved version of the older PHP MySQL driver, offering various benefits.


Some of the develpers faced a problem while installing the m=MySqli extension for PHP.So let me clarify the issue for windows users.

1.Go to C:/php/php.ini    (the php.ini file stores all the informations regarding the behaviours of the PHP)

2.open php.ini and try to find out  ;extension=php_mysqli.dll

3.Remove the semicollon at the begining.

     Note:The semicolon works as a comment indicator i.e anything followed by a semicolon is a comment.So by removing the semicolon you can make it functional.

4.save the changes made.

5.Next, make sure that the actual extension file, php_mysqli.dll in this example, exists in the  extension directory.

      php_mysqli.dll can be found at c:/php/ext in windows

6.Now restart your server to make the changes permanent.

 

yes,you are done now.Nevertheless you can visit http://php.net/manual/en/book.mysqli.php for more details

As I am a PHP developer you will find more and more posts regarding PHP and MySql.If you have any doubts regarding the above steps please do not hesitate to comment or mail me at radheshyamnayak@rediffmail.com

 

What does the terms like "Alpha" and "Beta" mean in software release?

Mozilla 3.6 Beta Version

Let us analyze each term of the above.

Mozilla-Name of the organisation or the software

3.6-Release version(generally starts from 1.0)

You may be familliar with the above terms but what does the term "Beta" mean?On some softwares you will find this as "Alpha".

What exactly these terms mean?

These are the terms related to the Software Release Cycle.

. The software release life cycle is composed of discrete phases that describe the software's maturity as it advances from planning and development to release and support phases.

Let us have a look at the different stages of software release cycle:

 

1.Developement Stage

        a.Pre Alpha

        b.Alpha

        c.Beta

        d.open and closed Beta

2.Release

        a.RTM(Release To Marketing)

        b.General Availability

3.Support

        a.Service Release

        b.End of life

Developement Stage

Pre Alpha Version:

Pre-alpha refers to all activities performed during the software project prior to testing. These activities can include requirements analysis, software design, software development and unit testing.

In typical open source development, there are several types of pre-alpha versions. Milestone versions include specific sets of functions and are released as soon as the functionality is complete

Alpha:

The alpha phase of the release life cycle is the first phase to begin Software testing.

Alpha software can be unstable and could cause crashes or data loss.

The alpha phase usually ends with a feature freeze, indicating that no more features will be added to the software. At this time, the software is said to be feature complete.

Beta:

"Beta" is the software development phase following alpha, named after the Greek letter beta. It generally begins when the software is feature complete. The focus of beta testing is reducing impacts to users, often incorporating usability testing. The process of delivering a beta version to the users is called beta release.

The users of a beta version are called beta testers. They are usually customers or prospective customers of the organization that develops the software, willing to test the software for free or for a reduced price.

Beta version software is likely to be useful for internal demonstrations and previews to select customers. Some developers refer to this stage as a preview, a prototype, a technical preview (TP) or as an early access.

Open and closed beta:

Developers release either a closed beta or an open beta; closed beta versions are released to a select group of individuals for a user test, while open betas are to a larger community group, usually the general public. The testers report any bugs that they found and sometimes minor features they would like to see in the final version.

Examples of a major public beta test were Microsoft's release of community technology previews (CTPs) for Windows Vista in January 2005. In September 2000, a boxed version of Apple Computer's Mac OS X Public Beta operating system was released.

 Release candidate:

The term release candidate (RC) refers to a version with potential to be a final product, ready to release unless fatal bugs emerge. In this stage of product stabilization, all product features have been designed, coded and tested through one or more beta cycles with no known showstopper-class bug.

During the 1990s, Apple Inc. used the term "golden master" for its release candidates, and the final golden master was used as the general availability release. Other Greek letters, such as gamma and delta, are sometimes used to indicate versions that are substantially complete, but still undergoing testing, with omega or zenith used to indicate final testing versions that are believed to be relatively bug-free, ready for production.

A release is called code complete when the development team agrees that no entirely new source code will be added to this release. There may still be source code changes to fix defects. There may still be changes to documentation and data files, and to the code for test cases or utilities. New code may be added in a future release.

Release

RTM

The term "release to manufacturing" or "release to marketing" (both abbreviated RTM)—also known as "going gold"—is used to indicate that the software has met a defined quality level and is ready for mass distribution either by electronic means or by physical media. RTM usually means the software is actually released; in most cases it would mean that the software is being released to manufacturers, for pre-installation on ready machines, or for the manufacturer to adjust the software for their manufactured hardware and settings. The term does not define the delivery mechanism; it only states that the quality is sufficient for mass distribution. The deliverable from the engineering organization is frequently in the form of a gold master CD used for duplication or to produce the image for the web.

RTM happens prior to general availability (GA) when the product is released to the public.

General Availibility

General availability or General Acceptance (GA) is the point where all necessary commercialization activities have been completed and the software has been made available to the general market either via the web or physical media.

Support

Service Release

During its supported lifetime, software is sometimes subjected to service releases, or service packs. As a well used example, Microsoft's Windows XP has currently had 3 major Service Packs.

Such service releases contain a collection of updates, fixes and/or enhancements, delivered in the form of a single installable package. They may also contain entirely new features.

Certain software is released with the expectation of regular support. Classes of software that generally involve protracted support as the norm include Anti-virus suites and Massively Multiplayer Online Games.

End Of Life

When software is no longer sold or supported, the product is said to have reached end-of-life.

 

Hope the informations are clear...

You are invited to put forword any questions or sugestions regarding my posted articles.

 

Google Searching techniques?

Yes,You are right,this is my first post.I am just here to share some valuable informations with you.

 

There is no internet user who don't know about Google.So what google does is that it makes our journey with internet comfortable and enjoyable.If there were no search engines then the internet could not be explored upto this extent.So how a search engine works?

Here is a brief introduction of search engines.What is search engine?

"A computer program that retrieves documents or files or data from a database or from a computer network."

So what exactly a database is?

"Integrated data files organized and stored electronically in a uniform file structure that allows data elements to be manipulated, correlated, or extracted to satisfy diverse analytical and reporting needs. ..."

to know more about database visit http://en.wikipedia.org/wiki/Database

So database stores the informations in form of tables,why?To make the searching,organising,editing,retrival easier.

Collection of interrelated datas stored in a tabular format is called Relational Database Management System(RDBMS).

Examples of RDBMS:Oracle,MySql,DB2,BigTable

So what a search engine does is that it takes our entered query as arguement to its DBMS and interms gives us the results based on the data stored in the database.

As you are familiar about the terms like database and search engines let me know u some informations on Google Search Engine.

Google uses BigTable as its DBMS which is designed by itself and it is managed through its own file system called Google File System(GFS).Now I will give you some techniques on "How to search google effectively."

1.place your search query within a double quote which will give u the exact result you want.

         Example:let us say you typed

pen drive contents

you will get contents containing pen or drive or contents or pen drive contents

but if you enter like this

"pen drive contents"

"Go and check it now!"

Then definietly you will get contents only bases on "pen drive contents"

cool!

2.Include some operators listed in the table below with their importance while searching

operatorOper ator Meaning
+ Must be present in every match
- Must not be present in any match
~ Lowers a ranking if present
* Wildcard
< Decrease a word’s importance
> Increase a word’s importance
" " Must match the exact phrase
()

Create subexpressions

For example:

+hitler -france

the above will result in contents which must include "hitler" and must not include "france"

ind*

this will result in all the contents replacing anything inplace of * lile india,indi etc.

While returning the contents the search follows certain preference except the sponsered links which are paid

to decrease or increase the precedence u can use the > and < operators like ">hello" etc.

 

Ok now I gave you some techniquies.It's upto you to how to utlilize these things.

Have a pleasent searching.........

 

 

Please do not forget to comment in this post as it will inspire me for some more contents like this and everyone is welcome to add any new points to this post and the problems if any..

 

My next post will be based on Software Release Lifecycle .....

 

How Popular is the iPhone Anyway

Iphone-popular-thumb