Sunday, July 17, 2011

HTML5:New Era Begins From Here



HTML5 is the latest version of HTML or Hypertext Markup Language. It is currently only fully supported by a handful of browsers but the next year should see a large increase in usage. It isn’t expected to be completed until 2014, but the features that are available now are a great way to become acquainted with HTML5 and add some cool elements to your website.Steve Jobs famously refuses to allow Flash on the iOS due to the many bugs and crashes it experiences, therefore, learning how to use the more intricate features of HTML5 is going to be a must for those who want to develop apps and iOS-friendly websites. With Google rolling out an HTML5-friendly version of YouTube, many developers are starting to see how important this system will become in the near future. However, with Firefox resisting some of the advent of HTML5, developers and designers are still feeling the need to cover all of their bases when implementing new features on a website.
The idea behind HTML5 is that it’s not one large entity, but rather made up of smaller parts that work together to create something innovative and advanced. Each browser may support different features of HTML5, which makes it important for those interested in coding to figure out which features they need and which will be supported by different browsers.
HTML5 simply builds upon the widespread success of HTML4. That means a coder doesn't have to throw away the existing markup, but rather build upon and improve the old one. For example, forms can be updated to allow for new features such as a better email input for those using a mobile device. However, viewers stuck in IE6 will simply see it as a text field and still be able to use it.

Features
Any HTML5 syntax requires a doctype to be specified so that the browser can render the page in standards mode. The good news though is that the doctype declaration has also been simplified from previous HTML. It is now just:

  • The audio and visual support in HTML5 is outstanding. As soon as it’s fully running and all browsers support HTML5, you will find it easy to add audio and video to websites without the need for outside plugins.
  • Editing the content of your website is simplified with HTML5. Using the contenteditable attribute, you can quickly and painlessly change your text by adding contenteditable=“true” to any element.
  • The canvas element makes it possible for you to bypass Photoshop to make your 2D images and directly place them in your code.
  • The application cache enables you to navigate web applications while you are offline.
  • The new tag header is wrapped around introductory elements, such as the page title or a logo. It could also contain a table of contents or a search form. Every header typically contains a heading tag from h1 to h6 .In this case the header is used to introduce the whole page, but we’ll use it to introduce a section of the page a little later.
  • The nav-tag is used to contain navigational elements, such as the main navigation on a site or more specialized navigation like next/previous-links.
  • The section-tag is used to denote a section in the document. It can contain all kinds of markup and multiple sections can be nested inside each other.aside is used to wrap around content related to the main content of the page that could still stand on it’s own and make sense. In this case we’re using it for the sidebar.
  • The footer-tag should contain additional information about the main content, such as info about who wrote it, copyright information, links to related documents and so on.
  • Instead of using divs to contain different sections of the page we are now using appropriate, semantic tags. They will make it a lot easier for search engines and screen readers to figure out what’s what in a page.
  • The article tag is used to denote an independent entry in a blog, discussion, encyclopedia, etc. and is ideal to use here. Since we are viewing the details of a single post we only have one article, but on the front page of the blog we would wrap each post in an article-tag.
  • The header element is used to present the header and metadata about the blog post. We tell the user when the post was written, who wrote it and how many comments it has. Note that the timestamp is wrapped in a -tag. This tag is also new to HTML 5 and is used to mark up a specific place in time


Why Use It

  • HTML5 will load much quicker than its older brother because it implements WebSockets.
  • Mobile phone applications will be much more accessible if written in HTML5 because you will not have to write applications for a specific brand of phone but rather can create universal applications for all phones.
  • You have more flexibility in creating your website.
  • Video, audio and images are all easily written right into the code, eliminating the need for any third party software.
  • This language is growing and will only result in more, new, better and faster features that will leave old websites looking outdated.
  • HTML5 simply builds on HTML4, so the old markup can stay in place as you develop the new features.
  • HTML5 and CSS3 together will give you some serious designer credibility.


List of some of tag that i like most in HTML5:

  1. <aside> – aside element is a section of a page that consists of content that is tangentially related to the content around the aside element. We can use aside element for sidebars, for advertising, for groups of nav elements, and for other content that we can consider separate from the main content of the page.
  2. <article> – article element is a self-contained composition (a forum post, a magazine or newspaper article, a blog entry) in a web page or web application and that is intended to be distributable or reusable. You should use the article element, instead of the section element, when it would make sense to syndicate the contents of the element.
  3. <footer> – footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. It can contain information about its section, links to related documents, copyright dataansd so on. Footer element used for a general site-wide footer and for a article (or section) footer.
  4. <header> – header element represents a group of introductory or navigational aids, it is intended to usually contain the section’s heading (an h1–h6 element or an hgroup element)
  5. <nav> – nav element is a section with navigation links. Not all groups of links on your web page need to be within a nav element, only sections that consist of major navigation blocks are appropriate for the nav element.
  6. <address> – address element represents the contact information for its nearest article.
  7. <time> – it is used to represent a date and/or the time.
  8. <legend> - it is used to represent header for fieldset like we use while creating a some desktop application

Saturday, February 19, 2011

Interview Experience: India Games And mapsinfotech

Well after exam this was my first job interview well there were many first attached to this interview
1.first interview in Mumbai
2.first interview call from seed InfoTech
3.first time very confident about interview because I have cleared all the round of interview in sela technology. I reached Mumbai night before my interview and stayed at subodh place that was again a good experience student of AIT always help each other in any of ways in there hold. we had chat and drink that is default when it comes to subodh my friend in AIT from electronic and telecommunication. I reached vashi and India Games office is very near to vashi railway station, well navi Mumbai is very well planned place in mumbai railway station are well structured not like Mumbai’s other place. so now about interview process was pretty much easy first aptitude in java and then technical round though I failed in technical round but I learned a lot from them. guys were pretty much easy go, was asking question in Hindi, they asked me everything from basic java like
1.what is overloading and overriding
2.what is size of into in java
3.what is type of sorting
4.what is data structure
5.inteface and abstract class.
As you see question were very easy but problem was they confused me on very question. Some questions were very tricky and require your intelligence well they didn't select me but was very good experience

There was another interview for small company and come to know about some fact regarding these so called startup company. my interview was for they called me and told me about there condition
1.for six month they will pay me only 2k
2.for six month they will keep my all marksheet with them.
I was okay with there first condition but second was a problem so let me tell you there process
1.direct technical round in that they asked me about java only
in there second round they asked me to make a small application in jsp with database driven. I failed in second round but I was not feeling bad about this because I didn't like company’s environment. company office was in some home every thing was so messy and at same time they were making fun of all candidate after there interview round this makes me unhappy about them, has asked some question regarding inheritance and persistency
1.what is Externalizable.
2.what are collections in java
I’ll discuss Externalizable here

public interface Externalizable extends Serializable

Only the identity of the class of an Externalizable instance is written in the serialization stream and it is the responsibility of the class to save and restore the contents of its instances. The writeExternal and readExternal methods of the Externalizable interface are implemented by a class to give the class complete control over the format and contents of the stream for an object and its supertypes. These methods must explicitly coordinate with the supertype to save its state. These methods supersede customized implementations of writeObject and readObject methods.
Object Serialization uses the Serializable and Externalizable interfaces. Object persistence mechanisms can use them as well. Each object to be stored is tested for the Externalizable interface. If the object supports Externalizable, the writeExternal method is called. If the object does not support Externalizable and does implement Serializable, the object is saved using ObjectOutputStream.
When an Externalizable object is reconstructed, an instance is created using the public no-arg constructor, then the readExternal method called. Serializable objects are restored by reading them from an ObjectInputStream.
An Externalizable instance can designate a substitution object via the writeReplace and readResolve methods documented in the Serializable interface.

void readExternal(ObjectInput in)
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

void writeExternal(ObjectOutput out)
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.





// : c12:Blips.java // Simple use of Externalizable & a pitfall. // {Clean: Blips.out} // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 // www.BruceEckel.com. See copyright notice in CopyRight.txt. 
import java.io.Externalizable; 
import java.io.FileInputStream; 
import java.io.FileOutputStream; 
import java.io.IOException; 
import java.io.ObjectInput; 
import java.io.ObjectInputStream; 
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
class Blip1 implements Externalizable { 
public Blip1() { 
  System.out.println("Blip1 Constructor"); 
} 
public void writeExternal(ObjectOutput out) throws IOException { System.out.println("Blip1.writeExternal"); 
} 
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 
System.out.println("Blip1.readExternal"); 
} 
} 
class Blip2 implements Externalizable { 
Blip2() { 
System.out.println("Blip2 Constructor"); 
} 
public void writeExternal(ObjectOutput out) throws IOException { System.out.println("Blip2.writeExternal"); 
} public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 
System.out.println("Blip2.readExternal"); 
} 
} public class Blips { // Throw exceptions to console: public static void main(String[] args) throws IOException, ClassNotFoundException { System.out.println("Constructing objects:"); 
Blip1 b1 = new Blip1(); 
Blip2 b2 = new Blip2(); 
ObjectOutputStream o = new ObjectOutputStream(new FileOutputStream( "Blips.out")); System.out.println("Saving objects:"); 
o.writeObject(b1); 
o.writeObject(b2); 
o.close(); // Now get them back: ObjectInputStream in = new ObjectInputStream(new FileInputStream( "Blips.out")); 
System.out.println("Recovering b1:"); 
b1 = (Blip1) in.readObject(); // OOPS! Throws an exception: //! System.out.println("Recovering b2:"); //! b2 = (Blip2)in.readObject(); } } ///:~

Question: What is the difference between Serializable and Externalizable in Java?
Answer: To add to the other answers, by implementation java.io.Serializable, you get "automatic" serialization capability for objects of your class. No need to implement any other logic, it'll just work. The Java runtime will use reflection to figure out how to marshal and unmarshal your objects.
In earlier version of Java, reflection was very slow, and so serializing large object graphs (e.g. in client-server RMI applications) was a bit of a performance problem. To handle this situation, the java.io.Externalizable interface was provided, which is like java.io.Serilizable but with custom-written mechanisms to perform the marshalling and unmarshalling ructions (you need to implement readExternal and writeExternal methods on your class). This gives you the means to get around the reflection performance bottleneck.
In recent versions of java (1.3 onwards, certainly) the performance of reflection is vastly better than it used to be, and so this is much less of a problem. I suspect you'd be hard-pressed to get a meaningful benefit from Externablizable with a modern JVM.
Also, the built-in Java serialization mechanism isn't the only one, you can get third-party replacements, such as JBoss Serialization, which is considerably quicker, and is a drop-in replacement for the default.
A big downside of Externalizable is that you have to maintain this logic yourself - if you add, remove or change a field in your class, you have to change your writeExternal/readExternal methods to account for it.
In summary, Externalizable is a relic of the Java 1.1 days. There's really no need for it any more.

Interview Experience: Sela technology

sela technology is in training and placement they were conducting interview for there some client. So coming to point it was 3 day process
first day aptitude which again was fun aptitude constitute of 4 parts on each part there was elimination.
1.apptiude
2.core java
3.adv java
4.Html and sql
Question were pretty much easy especially aptitude section
After selected in aptitude there was HR round she asked me again same set of standard question. But friend always be prepared for Standard question like
1.What is your strength
2.What is your weakness
3.If your percentage is not good in college then you should have string reason for this
4.If you have year gap then it’s really require hard explanation why this
In my case both are true so I said was preparing for IIT but that didn't work out. Now never tell him/her about your weakness that will effect your Selection. Always put your weakness in such way that doesn't related to your job or company didn't care about that like being from technical background you don't have to have good communication skill so you can tell this but don't say that your have poor skill say there is scope in improving communication skill or say I believe in practical approach not very bookish type. My HR round was very bad I was hopeless and gave very rubbish which might she was not seeking from me. But guess what I got selected there. After HR round there was technical round this was good, he asked some good question related to java about that I was not aware like
1.What is string or constant pool
2.What is late or early binding
3.What is serialization in java
4.What is marker interface()

The Purpose of the Marker Interface
One of the "clean" features of the Java programming language is that it mandates a separation between interfaces (pure behavior) and classes (state and behavior). Interfaces are used in Java to specify the behavior of derived classes.

Often you will come across interfaces in Java that have no behavior. In other words, they are just empty interface definitions. These are known as marker interfaces. Some examples of marker interfaces in the Java API include:

- Java,lang.Cloneable
- Java,io.Serializable
- java.util.EventListener

Marker interfaces are also called "tag" interfaces since they tag all the derived classes into a category based on their purpose. For example, all classes that implement the Cloneable interface can be cloned (i.e., the clone() method can be called on them). The Java compiler checks to make sure that if the clone() method is called on a class and the class implements the Cloneable interface. For example, consider the following call to the clone() method on an object o:

SomeObject o = new SomeObject();
SomeObject ref = (SomeObject)(o.clone());

If the class SomeObject does not implement the interface Cloneable (and Cloneable is not implemented by any of the superclasses that SomeObject inherits from), the compiler will mark this line as an error. This is because the clone() method may only be called by objects of type "Cloneable." Hence, even though Cloneable is an empty interface, it serves an important purpose.

And some more of these kind of question finally client round in whom people from client company were came for taking technical round they asked me very basic question related to java but he asked me very good question which I would like to discuss here
why String and Wrapper class object are immutable??
so here I put my understanding of what people has suggested on java ranch
Exact answer of Why String class is immutable can only be provided by designer of java but here I see few reason which enforces immutability of String.


1)Imagine String Pool facility without making string immutable , its not possible at all because in case of string pool one string object/literal e.g. "Test" has referenced by many reference variables , so if any one of them change the value others will be automatically gets affected i.e. lets say

String A = "Test"
String B = "Test"

Now String B called "Test".toUpperCase() which change the same object into "TEST" , so A will also be "TEST" which is not desirable.

2)String has been widely used as parameter for many java classes e.g. for opening network connection you can pass hostname and port number as string , you can pass database URL as string for opening database connection, you can open any file by passing name of file as argument to File I/O classes.
Now Why Wrapper classes are immutable, again there could be many different reason but immutability makes them pretty useful in multithreaded environment without worrying of thread safety issue also immutability makes them good candidate of being key in Hashtable and Hashmap .
By default, all Java classes are mutable i.e. contents of their instances can be modified. But there are few advantages that immutability offers (click me to know more), and that's why some classes are made immutable by marking them as final. The classes in question are String and Wrapper classes, and if you think logically about them (any immutable class), then the description in the link provided would start making sense. Let us address each of the two separately:

String class:
As mentioned in SCJP page 433 by Kathy Siera and Bert Bates, as applications grow, it’s very common to have a lot of redundancy in the String literals for a program. Hence, in order to address this issue, the designers of Java came up with the concept of String pool which improves performance by making efficient use of available memory. But now, as you might imagine, if several reference variables refer to the same String without even knowing it, it would be bad if any of them could change the String's value. Hence, there arose the need of making this String class immutable.

Wrapper classes:
One of the objectives of making wrapper classes is to provide a mechanism to treat primitives with activities reserved for objects, like being added to Collections, or returned from a method with an object return value. If you think about a collection, it would often be the case that it is accessed by multiple threads. If the wrapper classes weren't mutable, it would run into the risk of concurrent modification and thus lead to inconsistent states. Thus, in order to avoid conflicts, wrapper classes are made immutable.

So, in general, whenever you come across an immutable class, it would be logical to think of its instances being used in a concurrent manner. Also, if you do not want your object contents to be modified (one of the reasons being concurrent access), then make the class immutable.
Thread Safe class/object means we can safely use that object in a multithreaded environment without worrying about inconsistent object state due to multiple thread working on that. if a class is immutable means you can not change its state once it has been created so only read operation is possible on that , since no thread is writing or modifying its state , it can be safely shared between multiple thread without worrying about inconsistent object state.

It’s recommended to make your object immutable as much possible to avoid any object inconsistency issue in multithreaded environment.

Since String and wrapper classes are immutable no once can modify object after creation so you can safely shared that between thread without worrying about object state.

Thursday, January 20, 2011

Backlog

Backlog generally refers to an accumulation over time of work waiting to be done or orders to be fulfilled. Every engineering student is familiar with this word some refer this by back or in some place backlog. I am the lucky one who have used this word 29 times in his engineering period and list still continues yes after spending (4+1) year in college I am still having 6 backlogs some people are like me who never learn from there mistake even after so many failure, clearing engineering exam for me are like conquering huge napoleon army. So after leaving college in 19 June 2010 I gave backlogs exam in December 2010 before the exam I was very boost up and was ready to clear all my 6 backlogs because I knew without clearing this I will not going to get my degree but thing never happens with me as I think. I appeared for first 3 exam and with every exam my preparation goes down and finally I take big decision of leaving operating system exam, this was my third attempt but I never had appeared for this exam this is beauty about me if I leave one exam to prepare for next exam I will surely leave next exam also then next then next so on until the last exam same thing happened this time also out of 6 I appeared for 3 that to with less preparation that is why I am dedicating whole post for this backlogs word. I was doing Google for this word then I found I am not the only one who is facing same problem there are lots of people with me so when you do Google with backlog Google will suggest you two string one backlog and second is backlogs in engineering even Google knew the strong bond of engineering and backlogs.
Here I am indexing some interesting result about goggling backlogs in engineering
1. Hi all i had backlogs in my engineering i completed my 4rth year...
2. How to clear back logs in my engineering? - 2011
3. My B.Tech percentage is 58.76 (15 backlogs)
4. How to calculate the number of backlogs in engineering?
I found this question on yahoo answer this is very funny I don’t understands state of mind of person and relevancy of question: How to calculate the number of backlogs in engineering. If I have taken 3 to 4 attempts to clear a single subject will it be considered as 3 backlogs or 1 backlog? Please reply fast. Thanks in advance


So why we are having backlogs?

Answer is simple because we don’t study. Is this answer is fare enough to judge that somebody is having backlogs or not. I think more then study there is interest toward that subject and some will say university marking system but I don’t agree on university marking system explanation. Question still continues why backlogs as we are engineering student we must find out root cause of system and come up with solution but I guess there are some problem in computer science which are non deterministic as backlogs are part n percale of engineering system we don’t have much choice for this. Some of them among us are very lucky and other not.
By the way there is big list of article on Wikipedia called: Wikipedia backlogs that contains backlogs which need to be dealt with so if have knowledge then you can contribute to Wikipedia to enhance knowledge of thousands of people like me.

यहाँ हम ने ऐसी रवानी देखी ,
बिन सुर ताल पर नाचती ज़िंदगानी देखी,
आके भी ना आए ऐसा बुडापा देखा,
जाके भी ना जाए ऐसी जवानी देखी,
यहाँ हम ने ऐसी रवानी देखी,

हसिनाओ के हुस्न की कहानियों मैं बीत जाए ऐसी रात दीवानी देखी,
जो बात मैं कह जाऊं उस बात मैं वो बात नही इन बातों मैं की भी कहानी देखी,
दुख के सागर मैं उठती उमंग की लहरों को किनार पर टूट जाने की बात निराली देखी,
यहाँ हम ने ऐसी रवानी देखी
यहाँ हम ने ऐसी रवानी देखी

Wednesday, January 19, 2011

Interview experience: Knowledge Quest

After attending interview of ikwoledge works directly went to knowledge quest interview for java developer this was first time I am attending interview for java developer position I was nervous at the same time bit excited because there were only 20 people for interview. Soon after entering into company premises which is located into small residential house every room was occupied with computer there was hardly any place to site. After sitting arrangement, interview organizing team gave us, Question paper and asked us to write answer again first time in place of aptitude we have to write easy answer. As paper was easy I thought I will surely clear this exam and numbers of candidates were very less. I gave exam only difficult part was adv java as I didn't have much practice in adv java. There were some problems which I’ll discuss in some time before this after completing exam (1 hr) they told us to waits for 15 min they will give us a call When I came down from office building I saw nearly 200 people I was horrified WTF!! I am seeing more then 200 people for only 10 opening then all my dreams were shattered. Now after seeing 200 people even company had changed there requirement process now they are giving call to each candidate I waited there for 2 hrs after that I got to know I was not selected there were some people who accompanied me some of them were from raipur,jharkand. I also come to know that some of them having very good knowledge regarding java and j2ee

Now main part apart from my story there were some question which I will discuss here like:-
Q. Difference between jdk, jre, jvm?
Q. List http method (I didn't know this)?
Q. What is wrapper class?
Now we will only discuss here what jdk, jre and jvm and http method:

List of Http Method :( http://annevankesteren.nl/2007/10/http-methods)
List of HTTP methods (verbs)
As the web doesn’t appear to have a list of registered HTTP methods I’ll make one. (RFC 2616bis will most likely define a registry for HTTP methods, but that’s a few years away still, as I understand it.)

RFC 2616
OPTIONS
GET
HEAD
POST
PUT
DELETE
TRACE
CONNECT
RFC 2518
PROPFIND
PROPPATCH
MKCOL
COPY
MOVE
LOCK
UNLOCK
RFC 3253
VERSION-CONTROL
REPORT
CHECKOUT
CHECKIN
UNCHECKOUT
MKWORKSPACE
UPDATE
LABEL
MERGE
BASELINE-CONTROL
MKACTIVITY
RFC 3648
ORDERPATCH
RFC 3744
ACL
Draft-dusseault-http-patch
PATCH
Draft-reschke-webdav-search
SEARCH
Basically, the original HTTP methods plus a lot of stuff for WebDAV. Maybe a future version of this list will be a table and include information about. Whether a given HTTP method is safe, idempotent and cacheable. Didn’t need that information myself. Opening It seems that there a bunch of other methods floating around as well either invented by Microsoft for Microsoft products or somewhere else. The interweb isn’t very good at providing detailed information about WebDAV unfortunately. MSDN has section on WebDAV methods which lists the following that are not in the above list:

BCOPY
BDELETE
BMOVE
BPROPFIND
BPROPPATCH
NOTIFY
POLL
SUBSCRIBE
UNSUBSCRIBE
X-MS-ENUMATTS
Elsewhere I found RPC_OUT_DATA and RPC_IN_DATA. I suspect there are more.

But for entry level exam you only need to know first 8 i.e.
OPTIONS
GET
HEAD
POST
PUT
DELETE
TRACE
CONNECT

Differnce between jdk, jre, jvm?

JRE (Java Runtime Environment)

Yes JRE is Java Run Time Environment. The java programming language adds the portability by converting the source code to byte code version which can be interpreted by the JRE and gets converted to the platform specific executable ones. Thus for different platforms one has corresponding implementation of JRE. But JRE has to meet the specification JVM (Java Virtual Machine) Concept that serves as a link between the Java libraries and the platform specific implementation of JRE. Thus JVM helps in the abstraction of inner implementation from the programmers who make use of libraries for their programmers.
JRE = JVM + Java Packages Classes (like util, math, lang, awt, swing etc) +runtime libraries.
Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE. If you want to run any java program, you need to have JRE installed in the system The Java Virtual Machine provides a platform-independent way of executing code; programmers can concentrate on writing software, without having to be concerned with how or where it will run. If u just want to run applets (ex: Online Yahoo games or puzzles), JRE needs to be installed on the machine.

JDK (Java Developmental Tool kit)

The JDK (Java Developmental Tool kit) comes along with java libraries and JVM embedded in it.
Apart from these it comes along with the utility tools for byte code compilation "javac", executing the byte codes through java programmers through "java" and many more utilities found in the binary directory of java. Speaking practically JDK is essential for developers, which comes along with library packages to develop Software programs. While JRE is minimal set of programs which executes the java class files developed by the software developers.

JVM (Java Virtual Machine)

As we all aware when we compile a Java file, output is not an 'exe' but it's a '.class' file. '.class' file consists of Java byte codes which are understandable by JVM. Java Virtual Machine interprets the byte code into the machine code depending upon the underlying operating system and hardware combination. It is responsible for all the things like garbage collection, array bounds checking, etc… JVM is platform dependent. The JVM is called "virtual" because it provides a machine interface that does not depend on the underlying operating system and machine hardware architecture. This independence from hardware and operating system is a cornerstone of the write-once run-anywhere value of Java programs. There are different JVM implementations are there. These may differ in things like performance, reliability, speed, etc. These implementations will differ in those areas where Java specification doesn’t mention how to implement the features, like how the garbage collection process works is JVM dependent, Java spec doesn’t define any specific way to do this.

Saturday, January 1, 2011

Interview Experience:iknowledge works

Nov 19, 2010 I have attended two interviews on this day one of iknowledge works and other of knowledge quest. In knowledge works interview is for PHP developer they were seeking PHP developer. Let me tell something about Startup Companies in pune all companies based on PHP wants people who have perfect knowledge of PHP and HTML. These company do consider you if you are not perfect with these technology. I have seen only company in which my friend is working who have not taken PHP and HTML knowledge into consideration only checked aptitude and logical skill this make total sense how come you accept total knowledge from fresher and after all these nonsense they pays you very little but we as fresher don’t have any choice we have to do everything what they want so anybody wants to become a PHP developer start learning PHP now and go in dept beside PHP you also have to learn HTML, JavaScript. I know only basic of PHP. So in interview of knowledge work which is very small company I found only 8 people working there.CTO of company have taken my interview he was very nice to me he asked me to rate my PHP, HTML, JavaScript knowledge. I rated myself 5 in PHP, 7 in HTML, 4 in JavaScript and on the base of these score he asked me question. Everything he asked was very basic but question that shocked me was difference between POST and GET method of HTTP. I was very disappointed because. I had given wrong answer to this question I came back check what is difference between GET and POST method:
The fundamental differences between "GET" and "POST"
(Article is taken from here)
The HTML specifications technically define the difference between "GET" and "POST" so that former means that form data is to be encoded (by a browser) into a URL while the latter means that the form data is to appear within a message body. But the specifications also give the usage recommendation that the “GET" method should be used when the form processing is "idempotent", and in those cases only. As a simplification, we might say that "GET" is basically for just getting (retrieving) data whereas "POST “may involve anything, like storing or updating data, or ordering a product, or sending E-mail.
The HTML 2.0 specification says, in section Form Submission (and the HTML 4.0 specification repeats this with minor stylistic changes):
If the processing of a form is idempotent (i.e. it has no lasting observable effect on the state of the world), then the form method should be GET. Many database searches have no visible side-effects and make ideal applications of query forms.
If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.
In the HTTP specifications (specifically RFC 2616) the word idempotent is defined as follows:
Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests are the same as for a single request.
The word idempotent, as used in this context in the specifications, is (pseudo)mathematical jargon (see definition of "idempotent" in FOLDOC) and should not be taken too seriously or literally here. The phrase "no lasting observable effect on the state of the world" isn't of course very exact either, and isn't really the same thing. Idempotent processing, as defined above, does not exclude fundamental changes, only that processing the same data twice has the same effect as processing it once. But here, in fact, idempotent processing means that a form submission causes no changes anywhere except on the user's screen (or, more generally speaking, in the user agent's state). Thus, it is basically for retrieving data. If such a form is resubmitted, it might get different data (if the data had been changed meanwhile), but the submission would not cause any update of data or other events. The concept of changes should not be taken too pedantically; for instance, it can hardly be regarded as a change that a form submission is logged into the server's log file. On the other hand, sending E-mail should normally be regarded as "an effect on the state of the world".
The HTTP specifications aren't crystal clear on this, and section Safe Methods in the HTTP/1.1 specification describes the principles in yet another way. It opens a different perspective by says that users "cannot be held accountable" for side effects, which presumably means any effect than mere retrieval:
In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.
Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.
The concept and its background is explained in section Allowing input in Tim Berners-Lee's Style Guide for online hypertext. It refers, for more information, to User agent watch points, which emphatically says that GET should be used if and only if there are no side effects. But this line of thought, however logical, is not always practical at present, as we shall see.
See also answer to question "What is the difference between GET and POST?" In CGI Programming FAQ by Nick Kew.
Why the distinction matters
In the same context where the pragmatic difference is stated, the HTML 2.0 specification describes the corresponding submission methods technically. However, it does not explain why those methods are recommended for idempotent vs. non-idempotent submissions. Neither does it explain what practical difference there might be between the methods.
Alan Flavell has explained, in an article in a thread titled Limit on URL length in the newsgroupcomp.infosystems.www.authoring.html, that "the distinction [between GET and POST] is a real one, and has been observed by some browser makers, which can result in undesirable consequences if the inappropriate one is used". He gives the following reason for conforming to the advice:
When users revisit a page that resulted from a form submission, they might be presented with the page from their history stack (which they had probably intended), or they might be told that the page has now expired. Typical user response to the latter is to hit Reload.
This is harmless if the request is idempotent, which the form author signals to the browser by specifying the GET method.
Browsers typically will (indeed "should") caution their users if they are about to resubmit a POST request, in the belief that this is going to cause a further "permanent change in the state of the universe", e.g. ordering another Mercedes-Benz against their credit card or whatever. If users get so accustomed to this happening when they try to reload a harmless idempotent request, then sooner or later it's going to bite them when they casually [OK] the request and do, indeed, order a second pizza, or invalidate their previous competition entry by apparently trying to enter twice, or whatever.
Thus, some browsers can act more cleverly if the author uses "GET" or "POST" consistently, i.e. using “GET" for pure queries and "POST" for other form submissions. It needs to be noted, though, that using “GET" gives no protection against causing changes. A script which processes a form submission sent with the "GET" could cause a pizza ordering. It's just that authors are expected to take care that such things don't happen.
Moreover, the use of "POST" cannot guarantee that the user does not inadvertently submit the same form data twice; the browser might not give a warning, or the user might fail to understand the warning. Users are known to become impatient when it seems that "nothing happens" when they click on a button, so they might click on it again and again. Thus, robust processing of forms should take precautions against unintended duplicate actions. (As a simple example, a submission might be processed first by a script which sends back a page containing a confirmation request, echoing back the data submitted and asking the user to verify it and then submit the confirmation.)
A "GET" request is often cacheable, whereas a "POST" request can hardly be. For query systems this may have a considerable efficiency impact, especially if the query strings are simple, since caches might serve the most frequent queries. For information about caches, see Caching Tutorial for Web Authors and Webmasters, especially section Writing Cache-Aware Scripts.
Differences in form submission
For both METHOD="GET" and METHOD="POST", the processing of a user's submit request (such as clicking on a submit button) in a browser begins with a construction of the form data set, which is then encoded in a manner which depends on the ENCTYPE attribute. That attribute has two possible values mentioned in the specifications, but multipart/form-data is for "POST" submissions only, whereas application/x-www-form-URL encoded (the default) can be used both for "POST" and for "GET".
Then the form data set is transmitted as follows (quotation from the HTML 4.0 specification):
• If the method is "get" - -, the user agent takes the value of action, appends a? To it, then appends the form data set, encoded using the application/x-www-form-URL encoded content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes.
• If the method is "post" --, the user agent conducts an HTTP post transaction using the value of the action attribute and a message created according to the content type specified by the encrypt attribute.
Thus, for METHOD="GET" the form data is encoded into a URL (or, speaking more generally, into a URI). This means that an equivalent to a form submission can be achieved by following a normal link referring to a suitable URL; see the document Choices in HTML forms for details and examples. On a typical browser, the user sees the URL of a document somewhere (e.g. on Location line), and if he is viewing the results of a query sent using METHOD="GET", he will see what the actual query was (i.e. the part of the URL that follows the? sign). The user could then bookmark it or cut paste it for later use (e.g. to be E-mailed or put into one's own HTML document after some editing).
Although the HTML specifications don't say it very explicitly, the fundamental difference between the methods is really that they correspond to different HTTP requests, as defined in the HTTP specifications. See especially Method Definitions in RFC 2616. For form submission with METHOD="GET", the browser constructs a URL as described above, then processes it as if following a link (or as if the user had typed the URL directly). The browser divides the URL into parts and recognizes a host, then sends to that host a GET request with the rest of the URL as argument. The server takes it from there. Submission of a form with METHOD="POST" causes a POST request to be sent.
Differences in server-side processing
In principle, processing of a submitted form data depends on whether it is sent with METHOD="GET" or METHOD="POST". Since the data is encoded in different ways, different decoding mechanisms are needed. Thus, generally speaking, changing the METHOD may necessitate a change in the script which processes the submission. For example, when using the CGI interface, the script receives the data in an environment variable when METHOD="GET" is used but in the standard input stream (stdin) when METHOD="POST" is used.
It is, however, possible to construct libraries of subroutines (e.g. Perl functions) which allow one to write scripts in a manner which works both for METHOD="GET" and METHOD="POST". This would be based on distinguishing between the cases within the subroutine code and returning the data to the caller in a uniform manner.
Possible reasons to use "POST" for idempotent queries
For reasons explained above, one should normally use METHOD="POST" if and only if the form submission may cause changes. There are some exceptional situations where one may consider using METHOD="POST" even for pure queries, too:
• If the form data would contain non-ASCII characters, then METHOD="GET" is inapplicable in principle, although it may work in practice (mainly for ISO Latin 1 characters). Thus, for a query where the keywords might contain e.g. accented letters, you have to select among two evils: using METHOD="GET" against the rules which restrict the character repertoire to ASCII within it, or using METHOD="POST" against the rules which says that it should not be used when the processing is idempotent. The latter alternative is probably less dangerous.
• If the form data set is large - say, hundreds of characters - then METHOD="GET" may cause practical problems with implementations which cannot handle that long URLs. Such usage is mentioned in the HTML 2.0 specification in an informative note as follows:
Note - The URL encoding may result in very long URIs, which causes some historical HTTP server implementations to exhibit defective behavior. As a result, some HTML forms are written using METHOD=POST even though the form submission has no side-effects.
The limitations are not only historical. There is an official statement by Microsoft, originally published 2000-02-23: INFO: Maximum URL Length Is 2,083 Characters in Internet Explorer (Q208427).
• You might wish to avoid METHOD="GET" in order to make it less visible to users how the form works, especially in order to make "hidden" fields (INPUT TYPE="HIDDEN") more hidden. Using POST implies that users won't see the form data in the URL shown by the user; but note that this is not a very effective method of hiding, since the user can of course view the source code of your FORM element!

Thursday, December 16, 2010

Welcome Note

Hello Friend Today, I am doing Shree Gaeshayaa Namah!! (Remembering lord Ganesha) to my first post. Well this is not my first blog, I used to be blogger, but for earning money by cheating Google yes yes I am making this my public apologize to Google and all those people who used to follow my blog. So what’s new with this blog, well friend this is not just a regular blog to me this is my public dairy. I will write about everything related to me and my failure in life that leads to me this place but how this benefits you everybody is so busy in there life, why you guys follow my blog.I am not actor or entrepreneur or politician or famous personality.I am just common dreamer who have faced lots of failure in his life,i know all because of me, as kiran bedi said 90% of trouble or failure in life created by us only 10% is because of certain thing which are not in our hand. So back to question why follow my blog I am writing this blog in hope that people around the world who are on same path will not repeat same mistake as I have committed in past. We follow successful person thats a good thing but we can also learn from failure of person who are in same boat.So guys my point is learn from your mistake convert them into your success. As Mahatma Gandhi said nobody is perfect but we can train our self to reach near to perfect.As name suggest 2020daysofengineering I dedicate this blog to my engineering life and life after college what did I said engineering college yes yes I am a "computer engineer" I’ll cover following points in this blog first thing about my philosophies in life, open source web technology, my favorite programming language Java,photography(hobby), Photoshop an EQ with this software, and all bakwass that force you to follow my blog.
thank you.......
PS: MY ENGLISH IS NOT SO GOOD BUT I AM TRYING TO MAKE IT PERFECT SO SORRY FOR MY POOR GRAMMAR OR CHOICE OF WORD