Wednesday, 4 December 2013

Java Object oriented programming concepts with real time examples

OOPS Concepts are mainly 4 
 1.Abstraction
 2.Encapsulation
 3.Inheritance 
 4.Polymorphism

Abstraction:-Hiding non-essential features and showing the
essential features
              (or)
Hiding unnecessary data from the users details,is called
abstraction.
Real Time example:1.TV Remote Button
in that number format and power buttons and other buttons
there.just we are seeing the buttons,we don't see the
button circuits.i.e buttons circuits and wires all are
hidden.so i think its good example.

Encapsulation:It is a process of binding or wrapping the data and the
codes that operates on the data into a single entity. This
keeps the data safe from outside interface and misuse. One
way to think about encapsulation is as a protective wrapper
that prevents code and data from being arbitrarily accessed
by other code defined outside the wrapper.
 Real Time Example:  
 1.Ink is the important component in pen but it is hiding
by some other material
2.Medical Tablet
i.e one drug is stored in bottom layer and another drug is
stored in Upper layer these two layers are combined in
single Tablet.

Inheritance:The new classes, known as derived classes, take over (or
inherit) attribute and behavior of the pre-existing classes,
which are referred to as base classes (or Parent classes).
It is intended to help reuse existing code with little or no
modification.
Real Time Example:
1. Father and Son Relationship

Polymorphism: Single Form behaving differently in different Situations. A single
 function or single operator has different characters in different places.
 Real Time Example:
1.A girl plays a role of daughter at home and a manager at
office.
2. Person
Person in Home act is husband/son,
       in Office acts Employer.
       in Public Good Citizen.



Monday, 11 November 2013

HTTP vs HTTPS: Similarities and Differences

What is HTTPS?

HTTPS (Hypertext Transfer Protocol over Secure Socket Layer, or HTTP over SSL) is a web protocol developed by Netscape.

One can say: HTTPS = HTTP + SSL

HTTPS uses Secure Socket Layer (SSL) as a sublayer under its regular HTTP application layering.

Need of HTTPS:

Hypertext Transfer Protocol (HTTP) is a protocol for transmitting and receiving information across the Internet. HTTP serves as a request and response procedure that all agents on the Internet follow so that information can be rapidly, easily, and accurately disseminated between servers, which hold information, and clients, who are trying to access it. You normally use HTTP when you are browsing the web, its not secure, so someone can eavesdrop on the conversation between your computer and the web server. In many cases, clients may be exchanging confidential information with a server, which needs to be secured in order to prevent unauthorized access. For this reason, https, or secure http, was developed by Netscape corporation to allow authorization and secured transactions.

Similarity between HTTP and HTTPS:

In many ways, https is identical to http, because it follows the same basic protocols. The http or https client, such as a Web browser, establishes a connection to a server on a standard port. When a server receives a request, it returns a status and a message, which may contain the requested information or indicate an error if part of the process malfunctioned. Both systems use the same Uniform Resource Identifier (URI) scheme, so that resources can be universally identified. Use of https in a URI scheme rather than http indicates that an encrypted connection is desired.

Difference between HTTP and HTTPS:

1. URL begins with “http://" in case of HTTP while the URL begins with “https://” in case of HTTPS.
2. HTTP is unsecured while HTTPS is secured.
3. HTTP uses port 80 for communication while HTTPS uses port 443 for communication.
4. HTTP operates at Application Layer while HTTPS operates at Transport Layer.
5. No encryption is there in HTTP while HTTPS uses encryption.
6. No certificates required in HTTP while certificates required in HTTPS.

How HTTPS works?

For HTTPS connection, public key and signed certificates are required for the server.
When using an https connection, the server responds to the initial connection by offering a list of encryption methods it supports. In response, the client selects a connection method, and the client and server exchange certificates to authenticate their identities. After this is done, both parties exchange the encrypted information after ensuring that both are using the same key, and the connection is closed. In order to host https connections, a server must have a public key certificate, which embeds key information with a verification of the key owner's identity. Most certificates are verified by a third party so that clients are assured that the key is secure.
In other words, we can say, HTTPS works similar to HTTP but SSL adds some spice in it.

HTTP includes the following actions:

1. The browser opens a TCP connection.
2. The browser sends a HTTP request to the server
3. The server sends a HTTP response to the browser. 4. The TCP connection is closed.

SSL will include the following actions:

1. Authenticate the server to the client.
2. Allow the client and server to select the cryptographic algorithms, or ciphers, that they both support.
3. Optionally authenticate the client to the server.
4. Use public-key encryption techniques to generate shared secrets.
5. Establish an encrypted SSL connection.
6. Once the SSL connection is established the usual transfer of HTTP requests will continue.

Where should https be used?

HTTPS should be used in Banking Websites, Payment Gateway, Shopping Websites, Login Pages, Emails (Gmail offers HTTPS by default in Chrome browser) and Corporate Sector Websites. For example:

PayPal: https://www.paypal.com
Google AdSense: https://www.google.com/adsense/

Beware of using Credit Card Numbers on Internet:  If a website ever asks you to enter your credit card information, you should automatically look to see if the web address begins with https://. If it doesn't, there's no way you're going to enter sensitive information like a credit card number!

Browser integration

Most browsers display a warning if they receive an invalid certificate. Older browsers, when connecting to a site with an invalid certificate, would present the user with a dialog box asking if they wanted to continue. Newer browsers display a warning across the entire window. Newer browsers also prominently display the site's security information in the address bar. Extended validation certificates turn the address bar green in newer browsers. Most browsers also display a warning to the user when visiting a site that contains a mixture of encrypted and unencrypted content.



Tuesday, 27 August 2013

Usefull Java Resources

http://javapapers.com/
http://www.roseindia.net/interviewquestions/
http://www.geekinterview.com/Interview-Questions/J2EE
http://www.java2s.com/
http://www.javaworld.com/
http://java.about.com/
http://www.javaranch.com/
http://www.techinterviews.com/interview-questions/java
http://www.interview-questions-java.com/
http://www.oracle.com/technetwork/java/javamagazine/index.html?origref=http://java.net/projects/java-magazine
http://www.jguru.com/
http://www.planet-source-code.com/
http://www.javadb.com/
http://java.sourcecode4u.com/categories/basic
http://www.javacodegeeks.com
http://www.java-examples.com/
http://www.java2all.com/1/1/Technology/CORE-JAVA
http://www.vogella.com/articles/JavaCollections/article.html
http://java.happycodings.com
http://www.sourcecodesworld.com/source/show.asp?ScriptID=1001
http://www.javatutorialhub.com/java-exception.html



Thanks....................

Saturday, 10 August 2013

Hadoop Installation on Ubuntu 12.04 LTS

Enabling the root user:-

1. After Installation of Ubuntu 12.04 LTS , an account will be created with the role of Administrator.
2. Log In into Ubuntu using the credentials which are given while installing the Ubuntu software.
3. Till this step we don't created the root user. We can create the root user by entering the following              commands in the terminal prompt.
   
sudo passwd root
sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'
4. After executing the above commands root user created in our system.
5. From UI Login using the root user credentials.
Installing the java(JDK7 ):-
1. Login using root user and execute the below commands
Installing the JDK7 IN ubuntu

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*

sudo apt-get update

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer
2. After executing the above commands jdk
7 will install automatically and the class path will also set automatically.
Creating UserGroup and User :-
1. Command for creating the UserGroup and User

For More Information (UserGroups): https://help.ubuntu.com/community/AddUsersHowto
Downloading Hadoop :-
1. download hadoop from the apache site
2. after enting the the url :   http://www.apache.org/dyn/closer.cgi/hadoop/common/
select the any url from this page in that you can see list of files in that select file which have the extension end  like .tar.gz
Ex: 
select : [   ] hadoop-1.2.1.tar.gz 22-Jul-2013 18:27 61M 

Configuring Hadoop :-
1. copy the downloaded hadoop in your newly created User(Ex: hduser)
     in the path  '/usr/local/ '   with the folder name hadoop

need to prepare............
to be continue..............

Tuesday, 12 March 2013

Event Bubbling, and Stop Propagation


Information found at this article - Introduction to event handling in ActionScript 3.0 is more demonstrative and easy to understand. It will enhance the above accepted answer by @Jason Sturges.
Event bubbling and event capturing are two faces of events. If you make the event.bubbles to false that means the event is marked as non-bubbling event.
bubbles: Indicates whether or not the event is an event that bubbles (and captures). This does not mean that the event went through or is going through a capture or bubbles phase, but rather it is a kind of event that can.
Below image (from the above article) shows how the event goes through the process.
Event capturing and bubbling
The difference of the stopPropagation() and stopImmediatePropagation() will be more clear in following images.
StopPropagation :
stopPropagation
StopImmidiatePropagation :
stopImmediatePropagation


Thanks for visiting..................................

Friday, 25 January 2013

Clearing the cache automatically for every new deployment

UPDATE: It turns out in Firefox my SWFs start being cached after directly midnight. Once I manually clear the cache I don’t have to clear it for a while.

So you’re working on a project and you go to check it in the browser and hit refresh. You test it again and the same problem exists. But wait! Are you looking at the SWF you just compiled or a cached SWF!??!?! There have been so many times I’ve been working on a problem and didn’t realize the SWF was cached in the browser. What if there was a way to tell if you are looking at a cached SWF or a newly compiled SWF? Well NOW YOU CAN!

Taking Igor and Paul’s work a bit further I created a class you can drop into your project with one line of code, that will tell you the compilation date of your swf, if the swf is being viewed for the first time or if it is cached and a version number you can use for testing. It also provides a reload button handler.

Here is a live demo.
 
Here is the project download





Monday, 14 January 2013

Dell laptop – FN function keys problem resolved


As one of the problem I found with the laptop now a days is the keys those are with the Function keys. As a developer, we require to setup function key as priority instead of other keys. But by default, we need to press FN+Function key.
To change this behavior

1. First Solution:-

You can use the Function Key Behaviour setting in the System Setup (BIOS) utility to configure the media control keys. The options in the Function Key Behaviour setting are:
Multimedia Key First – This is the default option. Press any multimedia key directly. For function key, press <Fn> + the required function key.
Function Key First – Press any function key directly. For multimedia key, press <Fn> + the required multimedia key.
NOTE: Multimedia Key First option is active only in the operating system. During POST, press <F2> or <F12> directly.

2. Second Solution:-

Just go to Control Panel -> Hardware and Sound -> Adjust commonly used mobility settings -> Fn Key Behavior
Change it to "Function key"




Thanks for Visiting.............