Tuesday, December 19, 2006

Creating a SOAP message

The first step is to create a message using a MessageFactory object. The SAAJ API provides a default implementation of the MessageFactory class, thus making it easy to get an instance. The following code fragment illustrates getting an instance of the default message factory and then using it to create a message.

MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
Parts of a Message

A SOAPMessage object is required to have certain elements, and, as stated previously, the SAAJ API simplifies things for you by returning a new SOAPMessage object that already contains these elements. So message, which was created in the preceding line of code, automatically has the following:

I. A SOAPPart object that contains

A. A SOAPEnvelope object that contains

1. An empty SOAPHeader object

2. An empty SOAPBody object


SOAPPart soapPart = message.getSOAPPart();


SOAPEnvelope envelope = soapPart.getEnvelope();

SOAPHeader header = envelope.getHeader();

SOAPBody body = envelope.getBody();

OR you can directly access a soap header llike:

SOAPHeader header = message.getSOAPHeader();

SOAPBody body = message.getSOAPBody();

This example of a SAAJ client does not use a SOAP header, so you can delete it. (You will see more about headers later.) Because all SOAPElement objects, including SOAPHeader objects, are derived from the Node interface, you use the method Node.detachNode to delete header.

header.detachNode();

Adding Content to the Body


SOAPBody body = message.getSOAPBody();

SOAPFactory soapFactory = SOAPFactory.newInstance();

Name bodyName = soapFactory.createName
("GetLastTradePrice", "m", "http://wombat.ztrade.com");


SOAPBodyElement bodyElement = body.addBodyElement(bodyName);

Name name = soapFactory.createName("symbol");

SOAPElement symbol = bodyElement.addChildElement(name);

symbol.addTextNode("SUNW");

The content that you have just added to your SOAPBody object will look like the following when it is sent over the wire:







SUNW







Getting a SOAPConnection Object

SOAPConnectionFactory soapConnectionFactory =
SOAPConnectionFactory.newInstance();


Now you can use soapConnectionFactory to create a SOAPConnection object.

SOAPConnection connection =
soapConnectionFactory.createConnection();


Sending a Message

A SAAJ client calls the SOAPConnection method call on a SOAPConnection object to send a message. The call method takes two arguments: the message being sent and the destination to which the message should go. This message is going to the stock quote service indicated by the URL object endpoint.

java.net.URL endpoint = new URL("http://wombat.ztrade.com/quotes");

SOAPMessage response = connection.call(message, endpoint);

The content of the message you sent is the stock symbol SUNW; the SOAPMessage object response should contain the last stock price for Sun Microsystems, which you will retrieve in the next section.

A connection uses a fair amount of resources, so it is a good idea to close a connection as soon as you are finished using it.

connection.close();

Getting the Content of a Message

To add content to the header, you create a SOAPHeaderElement object. As with all new elements, it must have an associated Name object, which you can create using the message's SOAPEnvelope object or a SOAPFactory object.

For example, suppose you want to add a conformance claim header to the message to state that your message conforms to the WS-I Basic Profile. The following code fragment retrieves the SOAPHeader object from message and adds a new SOAPHeaderElement object to it. This SOAPHeaderElement object contains the correct qualified name and attribute for a WS-I conformance claim header.

SOAPHeader header = message.getSOAPHeader();

Name headerName = soapFactory.createName("Claim","wsi", "http://ws-i.org/schemas/conformanceClaim/");

SOAPHeaderElement headerElement = header.addHeaderElement(headerName);

headerElement.addAttribute(soapFactory.createName("conformsTo"), "http://ws-i.org/profiles/basic1.0/");


conformance claim header has no content. This code produces the following XML header:






For a different kind of header, you might want to add content to headerElement. The following line of code uses the method addTextNode to do this.

headerElement.addTextNode("order");

Thursday, December 14, 2006

Decode Function in Oracle

Oracle/PLSQL: Decode Function
In Oracle/PLSQL, the decode function has the functionality of an IF-THEN-ELSE statement.

The syntax for the decode function is:
decode( expression , search , result [, search , result]... [, default] )
expression is the value to compare.
search is the value that is compared against expression.
result is the value returned, if expression is equal to search.
default is optional.
If no matches are found, the decode will return default. If default is omitted, then the decode statement will return null (if no matches are found).

For Example:

You could use the decode function in an SQL statement as follows:
SELECT supplier_name,
decode(supplier_id,
10000,
'IBM',
10001,
'Microsoft',
10002,
'Hewlett Packard',
'Gateway') result
FROM suppliers;
The above decode statement is equivalent to the following IF-THEN-ELSE statement:
IF supplier_id = 10000 THEN result := 'IBM';
ELSIF supplier_id = 10001 THEN result := 'Microsoft';
ELSIF supplier_id = 10002 THEN result := 'Hewlett Packard';
ELSE result := 'Gateway';
END IF;
The decode function will compare each supplier_id value, one by one.
Frequently Asked Questions
Question: One of our viewers wanted to know how to use the decode function to compare two dates (ie: date1 and date2), where if date1 > date2, the decode function should return date2. Otherwise, the decode function should return date1.
Answer: To accomplish this, use the decode function as follows:
decode((date1 - date2) - abs(date1 - date2), 0, date2, date1)
The formula below would equal 0, if date1 is greater than date2:
(date1 - date2) - abs(date1 - date2)
Question: I would like to know if it's possible to use decode for ranges of numbers, ie 1-10 = 'category 1', 11-20 = 'category 2', rather than having to individually decode each number.
Answer: Unfortunately, you can not use the decode for ranges of numbers. However, you can try to create a formula that will evaluate to one number for a given range, and another number for the next range, and so on.
For example:
SELECT supplier_id,
decode(trunc ((supplier_id - 1) / 10),
0,
'category 1',
1,
'category 2',
2,
'category 3',
'unknown') result
FROM suppliers;
In this example, based on the formula:
trunc ((supplier_id - 1) / 10
The formula will evaluate to 0, if the supplier_id is between 1 and 10.The formula will evaluate to 1, if the supplier_id is between 11 and 20.The formula will evaluate to 2, if the supplier_id is between 21 and 30.
and so on...
Question: I need to write a decode statement that will return the following:
If yrs_of_service <>= 1 and <> 5 then return 0.06
How can I do this?
Answer: You will need to create a formula that will evaluate to a single number for each one of your ranges.
For example:
SELECT emp_name,
decode(trunc (( yrs_of_service + 3) / 4),
0,
0.04,
1,
0.04,
0.06) as perc_value
FROM employees;
Helpful Tip: One of our viewers suggested combining the SIGN function with the DECODE function as follows:
The date example above could be modified as follows:
DECODE(SIGN(date1-date2), 1, date2, date1)
The SIGN/DECODE combination is also helpful for numeric comparisons e.g. Sales Bonuses
DECODE(SIGN(actual-target), -1, 'NO Bonus for you', 0,'Just made it', 1, 'Congrats, you are a winner'

Wednesday, December 13, 2006

making direct db conn

it didnt get published for some reason hopefully it will now.
import="java.sql.PreparedStatement
import="java.sql.Statement

import="java.util.Hashtable

import="javax.naming.InitialContext"


import="java.text.DecimalFormat"


import="javax.naming.Context"

import="com.jpmchase.srgt.util.SrgtProperties"

Connection conn = null;Statement s = null;
ResultSet rs = null;
PreparedStatement ps = null;
List result = null;
String prividerURL=null;
//Getting the url and datasource from srgtProperties file
String providerURL=SrgtProperties.getProperty("perf_url");
String jndiDS=SrgtProperties.getProperty("perf_srgt_ds");
System.out.println("Provider URL is :"+providerURL);
Hashtable ht = new Hashtable();
ht.put(Context.PROVIDER_URL,providerURL);
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
InitialContext ctx = new InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup(jndiDS);
conn=ds.getConnection();
ps = conn.prepareStatement(sqlBuff.toString());

Monday, December 4, 2006

SCDJWS Exam Objectives

Exam Objectives

Section 1: XML Web Service Standards
1.1 Given XML documents, schemas, and fragments determine whether their syntax and form are correct (according to W3C schema) and whether they conform to the WS-I Basic Profile 1.0a.
1.2 Describe the use of XML schema in J2EE Web services.
1.3 Describe the use of namespaces in an XML document.

Section 2: SOAP 1.1 Web Service Standards

2.1 List and describe the encoding types used in a SOAP message.
2.2 Describe how SOAP message header blocks are used and processed.
2.3 Describe the function of each element contained in a SOAP message, the SOAP binding to HTTP, and how to represent faults that occur when processing a SOAP message.
2.4 Create a SOAP message that contains an attachment.
2.5 Describe the restrictions placed on the use of SOAP by the WS-I Basic Profile 1.0a.
2.6 Describe the function of SOAP in a Web service interaction and the advantages and disadvantages of using SOAP messages.

Section 3: Describing and Publishing (WSDL and UDDI)

3.1 Explain the use of WSDL in Web services, including a description of WSDL's basic elements, binding mechanisms and the basic WSDL operation types as limited by the WS-I Basic Profile 1.0a.
3.2 Describe how W3C XML Schema is used as a typing mechanism in WSDL 1.1.
3.3 Describe the use of UDDI data structures. Consider the requirements imposed on UDDI by the WS-I Basic Profile 1.0a.
3.4 Describe the basic functions provided by the UDDI Publish and Inquiry APIs to interact with a UDDI business registry.

Section 4: JAX-RPC

4.1 Explain the service description model, client connection types, interaction modes, transport mechanisms/protocols, and endpoint types as they relate to JAX-RPC.
4.2 Given a set of requirements for a Web service, such as transactional needs, and security requirements, design and develop Web service applications that use servlet-based endpoints and EJB based endpoints.
4.3 Given an set of requirements, design and develop a Web sevice client, such as a J2EE client and a stand-alone Java client, using the appropriate JAX-RPC client connection style.
4.4 Given a set of requirements, develop and configure a Web service client that accesses a stateful Web service.
4.5 Explain the advantages and disadvantages of a WSDL to Java vs. a Java to WSDL development approach.
4.6 Describe the advantages and disadvantages of web service applications that use either synchronous/request response, one-way RPC, or non-blocking RPC invocation modes.
4.7 Use the JAX-RPC Handler API to create a SOAP message handler, describe the function of a handler chain, and describe the role of SAAJ when creating a message handler. Section


5: SOAP and XML Processing APIs (JAXP, JAXB, and SAAJ)


5.1 Describe the functions and capabilities of the APIs included within JAXP.
5.2 Given a scenario, select the proper mechanism for parsing and processing the information in an XML document.
5.3 Describe the functions and capabilities of JAXB, including the JAXB process flow, such as XML-to-Java and Java-to-XML, and the binding and validation mechanisms provided by JAXB.
5.4 Use the SAAJ APIs to create and manipulate a SOAP message.

Section 6: JAXR

6.1 Describe the function of JAXR in Web service architectural model, the two basic levels of business registry functionality supported by JAXR, and the function of the basic JAXR business objects and how they map to the UDDI data structures.
6.2 Use JAXR to connect to a UDDI business registry, execute queries to locate services that meet specific requirements, and publish or update information about a business service. Section

7: J2EE Web Services

7.1 Identify the characteristics of and the services and APIs included in the J2EE platform.
7.2 Explain the benefits of using the J2EE platform for creating and deploying Web service applications.
7.3 Describe the functions and capabilities of the JAXP, DOM, SAX, JAXR, JAX-RPC, and SAAJ in the J2EE platform.
7.4 Describe the role of the WS-I Basic Profile when designing J2EE Web services.

Section 8: Security

8.1 Explain basic security mechanisms including: transport level security, such as basic and mutual authentication and SSL, message level security, XML encryption, XML Digital Signature, and federated identity and trust.
8.2 Identify the purpose and benefits of Web services security oriented initiatives and standards such as Username Token Profile, SAML, XACML, XKMS, WS-Security, and the Liberty Project.
8.3 Given a scenario, implement J2EE based web service web-tier and/or EJB-tier basic security mechanisms, such as mutual authentication, SSL, and access control.
8.4 Describe factors that impact the security requirements of a Web service, such as the relationship between the client and service provider, the type of data being exchanged, the message format, and the transport mechanism.

Section 9: Developing Web Services

9.1 Describe the steps required to configure, package, and deploy J2EE Web services and service clients, including a description of the packaging formats, such as .ear, .war, .jar, deployment descriptor settings, the associated Web services description file, RPC mapping files, and service reference elements used for EJB and servlet endpoints.
9.2 Given a set of requirements, develop code to process XML files using the SAX, DOM, XSLT, and JAXB APIs.
9.3 Given an XML schema for a document style Web service create a WSDL file that describes the service and generate a service implementation.
9.4 Given a set of requirements, develop code to create an XML-based, document style, Web service using the JAX-RPC APIs.
9.5 Implement a SOAP logging mechanism for testing and debugging a Web service application using J2EE Web Service APIs.
9.6 Given a set of requirements, develop code to handle system and service exceptions and faults received by a Web services client.

Section 10: General Design and Architecture


10.1 Describe the characteristics of a service oriented architecture and how Web services fits to this model.
10.2Given a scenario, design a J2EE service using the business delegate, service locator, and/or proxy client-side design patterns and the adapter, command, Web service broker, and/or faade server-side patterns.
10.3 Describe alternatives for dealing with issues that impact the quality of service provided by a Web service and methods to improve the system reliability, maintainability, security, and performance of a service.
10.4 Describe how to handle the various types of return values, faults, errors, and exceptions that can occur during a Web service interaction.
10.5 Describe the role that Web services play when integrating data, application functions, or business processes in a J2EE application.
10.6 Describe how to design a stateless Web service that exposes the functionality of a stateful business process.

Section 11: Endpoint Design and Architecture


11.1 Given a scenario, design Web service applications using information models that are either procedure-style or document-style.
11.2 Describe the function of the service interaction and processing layers in a Web service.
11.3 Describe the tasks performed by each phase of an XML-based, document oriented, Web service application, including the consumption, business processing, and production phases.
11.4 Design a Web service for an asynchronous, document-style process and describe how to refactor a Web service from a synchronous to an asynchronous model.
11.5 Describe how the characteristics, such as resource utilization, conversational capabilities, and operational modes, of the various types of Web service clients impact the design of a Web service or determine the type of client that might interact with a particular service.

Thursday, November 30, 2006

Antimatter and Dark Matter


Just read a very interesting Stephen Hawking's article.. wanna know abt him visit : http://www.hawking.org.uk/home/hindex.html . He said, we can achieve the speed of light when matter and antimatter destroy each other the process called annihilation.
Antimatter and Dark Matter

AntiparticlesEvery elementary particle in the Universe appears to have a partner particle called its antiparticle that shares many of the same characteristics, but many other characteristics are the opposite of those for the particle. For example, the electron has as its antiparticle the antielectron. The electron and the antielectron have exactly the same masses, but they have exactly opposite electrical charges.
The common stuff around us appears to be "matter", but we routinely produce antimatter in small quantities in high energy accelerator experiments. When a matter particle meets its antimatter particle they destroy each other completely (the technical term is "annihilation"), releasing the equivalent of their rest masses in the form of pure energy (according to the Einstein E=mc^2 relation). For example, when an electron meets an antielectron, the two annihilate and produce a burst of light having the energy corresponding to the masses of the two particles.
Because the properties of matter and antimatter parallel each other, we believe that the physics and chemistry of a galaxy made entirely from antimatter would closely parallel that of our our matter galaxy. Thus, is is conceivable that life built on antimatter could have evolved at other places in the Universe, just as life based on matter has evolved here. (But if your antimatter twin should show up some day, I would advise against shaking hands---remember that matter and antimatter annihilate each other!) However, we have no evidence thus far for large concentrations of antimatter anywhere in the Universe. Everything that we see so far seems to be matter. If true, this is something of a mystery, because naively there are reasons from fundamental physics to believe that the Universe should have produced about as much matter as antimatter.
Dark MatterDark matter is the general term for matter that we cannot see to this point with our telescopes, but that we know must be there because we see its gravitational influence on the rest of the Universe. Many different experiments indicate that there is probably 10 times more matter in the Universe (because we see its gravitational influence) than the matter that we see. Thus, dark matter is basically what the Universe is made out of, but we don't yet know what it is!
As one simple example of the evidence for dark matter, the velocity of rotation for spiral galaxies depends on the amount of mass contained in them. The outer parts of our own spiral galaxy, the Milky Way, are rotating much too fast to be consistent with the amount of matter that we can detect; in fact the data indicates that there must be about 10 times as much matter as we can see distributed in some diffuse halo of our galaxy to account for its rotation. The same is true for most other spiral galaxies where the velocities can be measured.
There are various candidates for the dark matter, ranging from ordinary matter that we just can't see because it isn't bright enough (for example, ordinary matter bound up in black holes, or very faint stars, or large planet-like objects like Jupiter) to more exotic particles that have yet to be discovered. There are some fairly strong arguments based on the production of the light elements in the Big Bang indicating that the majority of the dark matter cannot be ordinary matter or antimatter (which physicists call "baryonic matter"), and thus that the majority of the mass of the Universe is in a form very different from the matter that makes up us and the world around us (physicists call this "non-baryonic matter"). If that is true, then the matter that we are made of (baryonic matter) is but a small impurity compared to the dominant matter in the universe (non-baryonic matter). As someone has put it, "not only are we not the center of the Universe, we aren't even made of the right stuff!"
The nature of the dark matter is perhaps the most fundamental unsolved problem in modern astronomy.
Could the Dark Matter be Antimatter?It is conceivable that the dark matter (or at least part of it) could be antimatter, but there are very strong experimental reasons to doubt this. For example, if the dark matter out there were antimatter, we would expect it to annihilate with matter whenever it meets up with it, releasing bursts of energy primarily in the form of light. We see no evidence in careful observations for that, which leads most scientists to believe that whatever the dark matter is, it is not antimatter.

Tuesday, November 14, 2006

Schrodinger's cat --Stickiest areas in Quantum Physics

Schrodinger's cat:

Schrödinger's cat is a famous illustration of the principle in quantum theory of superposition, proposed by Erwin Schrödinger in 1935. Schrödinger's cat serves to demonstrate the apparent conflict between what quantum theory tells us is true about the nature and behavior of matter on the microscopic level and what we observe to be true about the nature and behavior of matter on the macroscopic level.
Here's Schrödinger's (theoretical) experiment: We place a living cat into a steel chamber, along with a device containing a vial of hydrocyanic acid. There is, in the chamber, a very small amount of a radioactive substance. If even a single atom of the substance decays during the test period, a relay mechanism will trip a hammer, which will, in turn, break the vial and kill the cat. The observer cannot know whether or not an atom of the substance has decayed, and consequently, cannot know whether the vial has been broken, the hydrocyanic acid released, and the cat killed. Since we cannot know, the cat is both dead and alive according to quantum law, in a superposition of states. It is only when we break open the box and learn the condition of the cat that the superposition is lost, and the cat becomes one or the other (dead or alive). This situation is sometimes called quantum indeterminacy or the observer's paradox: the observation or measurement itself affects an outcome, so that it can never be known what the outcome would have been if it were not observed.
We know that superposition actually occurs at the subatomic level, because there are observable effects of interference, in which a single particle is demonstrated to be in multiple locations simultaneously. What that fact implies about the nature of reality on the observable level (cats, for example, as opposed to electrons) is one of the stickiest areas of quantum physics. Schrödinger himself is rumored to have said, later in life, that he wished he had never met that cat.

My new Favourite -- Quantum Physics -- Introduction

Light always amazed me with its innumerable theories.... just wanted to refresh my thinking from highschool. Hope you will enjoy reading it.

The Origins of Quantum Physics :

The roots of quantum physics reach far into the past. Even Isaac Newton, the father of classical physics, played a part in the development of quantum physics. He didn't know it at the time, but one of his most famous arguments was a matter of quantum physics.Newton tried to explain the behavior of light in terms of particles, which he called corpuscles. He was the founder of the physics of particles after all, so why shouldn't light be treated like particles, just like the planets. The Dutch physicist Christiaan Huygens, however, tried to describe light in the terms of waves. Although the wave and particle theories of light were both sound, there was one obvious problem with Huygens' wave theory: when light is obstructed, it creates a shadow with well-defined edges. If light was a wave traveling through Huygens' "ether", it would flow around the edges of the obstruction, blurring the shadow. (This is not the case because the wavelength of light is small enough to create sharp edges, but this was not considered at the time.) Because of this flaw, and the fact that Newton was the physics hotshot of his day, the particle theory was accepted. With quantum physics, though, both of these theories are right.
The wave theory did not come up again until an English scientist named Thomas Young devised an interesting experiment to test it. This experiment, which is explained under Important Experiments, proved Newton's particle theory of light to be wrong. The experiment was ignored by most scientists because of Newton's greatness. Augustin Fresnel, a Frenchman, however, adopted this idea and worked to create a wave explanation of light. His work also included explaining why a thin film of oil creates such a colorful reflection. He noticed that a film of oil is bumpy and uneven, so it reflects the light at different angles. He theorized that if color was a product of the wavelength of light, and since waves can mix in ways to either strengthen or dampen the product's wavelength, the colors produced must be a product of the light bouncing off the uneven surface and interfering with the other reflected light waves. If light was made up of particles, it couldn't do this. By the nineteenth century, it had become accepted that light was made of waves.


Knowledge of the atom had also increased since the time of Newton. John Dalton, an early 19th century scientist, had created a model of the atom that was indestructible, and with different sizes and shapes for each element, as the Greeks suggested. At this time, however, the existence of atoms was doubted by the majority of scientist. That is, until a young German theorist named Albert Einstein published a revolutionary paper.
One of his papers discussed the way light (photons) and electricity (electrons) interact, which was one of the first questions of quantum mechanics. The most important paper, however, established without a doubt the existence of atoms. Einstein used a seemingly unrelated scientific discovery which had been made nearly a century before by Thomas Brown, a British botanist. While examining a grain of pollen floating on water, Brown noticed that it was randomly shaking. The scientific community was puzzled by "Brownian Motion", but not very concerned. Einstein showed that this motion was caused by the random movement of the water particles.


In 1897, an Englishman named J.J. Thomson made another important discovery. Cathode tubes, an old scientific curiosity (which, because of his discovery, became more of an obsession) consisted of a glass vacuum tube with a small amount of gas in it and electrodes on each end. When current is applied, electricity flows through the gas, producing light. The type of gas used effected the color of light emitted (which, surprise surprise, has to do with our old friend, the quanta). A common application of cathode tubes today is neon lighting. In addition to creating light, though, cathode tubes gave off cathode rays. By using magnetic fields, Thomson was able to manipulate the rays. More of this experiment is described in Important Experiments. To sum up the experiment, Thomson discovered that the cathode rays were negatively charged particles which were being knocked off the atoms. He dubbed these particles electrons and claimed a Nobel Prize in physics for his discovery.
Thomson unfortunately over-looked the color issue. It was known that different elemental gases always created different colored light, but everyone was at a loss to explain why. As we know today, each element has a different number of electrons which are arranged differently. Light is produced when the atom of gas absorbs some energy, which excites some electrons into a higher energy level. Electrons don't stay excited very long, though, and soon fall back into their original energy levels. This means that they must give off the energy which they absorbed, which comes out as light. Depending on the difference between the two energy levels, which depends on the element, the light can have a lot of energy (blue - ultra violet), some energy (yellow - green), or very little energy (red - infra red). The quanta comes into play because there are set differences between energy levels, which means that the electron can't give off one and three quarters of an energy level's energy.
Thomson also overlooked something else: where's the positive charge? Because atoms are known to be electrically neutral, there must be a positive charge to cancel the electrons' negative charge. Thomson solved this dilemma with his Plum-Pudding model. He theorized that the negative electrons were embedded in a sphere of positive charge, much like raisins in the English snack plum-pudding. This model is wrong because it couldn't explain how the electrons got knocked off the atom if they were inside the positive charge. His experiments did, however, allow Thomson to discover ions, or atoms with a charge (made by adding or removing electrons).



In 1909, Ernest Rutherford and his two colleagues, Hans Geiger (more commonly known for his work with radioactivity, and hence the Geiger Counter) and Ernest Marsden created a very important experiment. Their experiment consisted of shooting the newly discovered alpha particles (positive particles made of two protons and two neutrons emitted during radioactive decay) at a piece of gold foil. They set up fluorescent screens to detect the particles, dimmed the lights, and let the alpha particles fly. What they discovered was that the majority of the alpha particles went right through the foil, occasionally being deflected a bit. The real surprise came when some of the alpha particles ricocheted right back at the source. Rutherford compared this to shelling a piece of tissue paper and being hit by your own reflected shots.
To sum it all up, Rutherford theorized that the alpha particles must be occasionally hitting other positive particles. By the statistics gathered, he found that the positive charge must be concentrated in the center of an electron shell. The startling thing is that there is a lot of empty space between the electrons and the positive nucleus. If the nucleus was the size of a pin-head in the center of St. Paul's Cathedral, the electron cloud would be around 100 meters away in the dome. Through these observations, Rutherford created a new atomic model in 1911. In his model, there is a cloud of electrons with a small, concentrated nucleus made of protons in the center.



Rutherford's model is much like our current generic atomic model, minus the neutrons (discovered through more experiments). Like all atomic models in the past, Rutherford's model had just one flaw. The electrons in his model were doomed to fall out of their orbit around the nucleus and collapse into the nucleus, annihilating the atom. To make a long decade short, Neils Bohr fixed Rutherford's problem with a little imagination.
In his atomic model, the electrons were located in different energy levels, where each energy level was further from the nucleus (which now had neutrons as well as protons) than the previous. For example, if the first energy level was one inch away from the nucleus, the second would be two inches away, the third would be four, the fourth would be eight inches away, and so on. Bohr's energy levels cannot have a energy between two levels though. The electron is much like a ball resting on the stairs. If you give it enough energy, it will go up to the next step. If not enough energy is provided, it will not go halfway between the steps, for there is nowhere for it to rest there. Any excess energy is given off as light. Also, if the ball goes up a step, there will be room on the lower steps for it, and since the arrangement with the lowest energy is always the most stable, it's pretty likely that the ball/electron will give off some light and fall back down to it's old step. Bohr's model solved the problem of Rutherford's decaying orbits, but it was an incomplete solution. Unlike balls on steps, electrons can't just sit there. There had to be some movement to oppose the attraction between the positive and negative charges. This movement is solved by the quantum atomic model.

Before scientists could get to the quantum atomic model of an atom, though, they had to find the right math. The mathematics that they were searching for comes from a surprising source: a German physicist named Max Planck. Planck was the first to use the quanta, which he more or less stumbled upon in 1900. The quanta is the smallest amount of energy possible which can be emitted or absorbed by matter. The cause of the quanta comes from Bohr's model of a stair-case of atoms. When an atom absorbs energy, it's electrons become excited and move up an energy level or two. Like I said before, though, the electrons can't absorb one and a half energy level's worth of energy. Conversely, the electrons can't fall one and a half energy levels and give off that much energy. It has to be an integer amount. It is very surprising that Planck discovered this fact. Planck had been working long and hard on an electrodynamics problem, and as a last resort, he used another scientist's thermodynamics equations to help him solve the problem. At the time, the connection between electrodynamics and thermodynamics had not been discovered, so there was no reason for Planck to be doing this, but he did. And he did it wrong. The thermodynamic equations he was using had several steps. The first step involved dividing the energy up into small chunks (quanta, anyone?). After doing this, the mathematics could juggle the different chunks of energy, and then the last step put it all back together into a final solution with just one piece of energy. Planck, however, decided that the mathematics was working well halfway through the process, so he didn't bother doing the last step and didn't put the energy back together. Planck didn't apply the equations consistently either, yet somehow he got the right answer. No, he didn't look in the back of the book, he was just incredibly lucky and discovered the quanta. The correct mathematical work was later done by Erwin Schrödinger, an Austrian scientist. His math was based upon the work of Planck, Einstein, and others, such as Werner Heisenberg. Heisenberg's key idea during the 1920's was the Heisenberg Uncertainty Principle. He stated that the position and the velocity of a subatomic particle cannot be known simultaneously. Because of this, a margin of probability and randomness is introduced into the whole equation. This did not go over well with any of the scientists, especially Schrödinger and Einstein. Hence the quote at the bottom of the page.


Schrödinger incorporated the H.U.C. Principal into his model so that the electrons randomly 'pop' around the nucleus, provided they stayed within their own energy level. This provides the necessary movement to prevent the electrons from falling into the nucleus. The electrons 'pop' in a random but predictable way. Each energy level has a different shape (called shells), which is formed by the highest probability where the electron will be. When two atoms join to form a molecule, their outer energy shells overlap and merge together. This is the current atomic model, which is based on the quantum theory, and it's much more interesting than Thomson's plum pudding.
The evolution of quantum physics first started with questions about light and the atom. It grew as more complete atomic models were developed, and it finally appeared as a science when Schrödinger developed his mathematical atomic model. Like all other sciences, quantum physics had humble beginnings, and grew to be the sophisticated science it is today. It has continued to expanded, and quantum theory is no longer limited to explaining the workings of light and atoms, but also black holes, quantum gravity, negative energy, and more.


Lifted from : http://www.jracademy.com/~jtucek/science/origins7.html

Monday, November 13, 2006

Working with interfaces and Abstract Classes

Points to note while declaring vars in interface:

1) Variables declared in an interface are public static and final and are initialized before use

Ex:
public interface Bag {

int i=90; //Fine and i is static final variable

//private int k=90; Gives u an error as the variable cant be private.

public String simpleBag();

}

2) Which means u can just references these vars in ur impl classes but u cannot assign them a new value

Abstract Class:

1) You can define private variables in abstract class. They juts behave as variables declared in any other class.

Some code Examples:

public abstract class Badge {
int badgeId=100;
public int getBadgeId() {
return badgeId;
}

public void setBadgeId(int badgeId) {
this.badgeId = badgeId;
}

}


Implementation Class:

public class JPMCBadge extends Badge {

int badgeId=200;
public void showBadge(){
System.out.println(this.badgeId);
//this.badgeId=200;
}
public void newMethodInJpmcBadge(){

System.out.println("This is a new Method in JPMC Badge");

}

}


Main Class:

public class BadgeMain {

public static void main(String[] args) {

Badge badge=new JPMCBadge();

System.out.println(badge.badgeId); //This would print out 100 as we are still referring to badge

JPMCBadge badge2=new JPMCBadge();

badge2.newMethodInJpmcBadge();

System.out.println(badge2.badgeId); //this prints 200

}

}

Adding new TNS Names

Adding new TNS Names:
1) Add to
c:\oracle92\Network\admin\tnsnames.ora
2)And also to
c:\programfiles\tnsnames.ora

new value appears in the data base dropdown in TOAD.
select it and type in the user id and pwd to login to the new db

-Suneetha

Sunday, November 12, 2006

Daily routine

Time now is 1:49 had a very lazy Saturday, in which we managed to do a little bit of shopping. Shopping is always fun. :) especially in the holiday season hunting the best deals . ;). Saw some movie called Sri Krishana 2006. okay kinda movie. Herione is a big let down.

Have a production deployment tomorrow. Starts at 9 in the morning and estimated to end around 5 . I am sure it will go late (God knows how long). My wk end is gone =(
I hope I have one more day to sleep and rest...not gonna happen though.

My first Blog

Welcome to my blog.

Yay,
Sonu