Monday, August 20, 2007

What is the difference between Java IDL and RMI-IIOP?

What is the difference between Java IDL and RMI-IIOP?

This is a fundamental question and it's important to understand the distinction between these two ways of integrating the Java programming language with CORBA.

Java IDL is for CORBA programmers who want to program in the Java programming language based on interfaces defined in CORBA Interface Definition Language (IDL). This is "business as usual" CORBA programming, supporting Java in exactly the same way as other languages like C++ or COBOL.

RMI-IIOP (Remote Method Invocation over Internet Inter-ORB Protocol) is for Java programmers who want to program to the RMI interfaces, but use IIOP as the underlying transport. RMI-IIOP provides interoperability with other CORBA objects implemented in various languages - but only if all the remote interfaces are originally defined as Java RMI interfaces. It is of particular interest to programmers using Enterprise JavaBeans (EJB), since the remote object model for EJBs is RMI-based.

There are several scenarios that will define how you will want to create distributed CORBA applications. Here are some of them:

· Java IDL! If you have been developing CORBA applications using IDL for some time, you will probably want to stay in this environment. Create the interfaces using IDL, and define the client and server applications using the Java programming language to take advantage of its "Write Once, Run AnywhereTM" portability, its highly productive implementation environment, and its very robust platform.

· RMI-JRMP! If all of your applications are written in the Java programming language, you will probably want to use Java RMI to enable communication between Java objects on different virtual machines and different physical machines. Using Java RMI without its IIOP option leverages its strengths of code portability, security, and garbage collection.

· RMI-IIOP! If you are writing most of your new applications using the Java programming language, but need to maintain legacy applications written in other programming languages as well, you will probably want to use Java RMI with its IIOP compiler option.

Some rule:

Java Objects can communicate with CORBA objects and vice versa.

When you want a java program to talk to a CORBA object, use JavaIDL and when you want CORBA objects to talk to Java Objects, use the ubiquitous EJB.

95 When should you use Java IDL and when should you use RMI-IIOP?

A You should use Java IDL when using Enterprise Javabeans.

B You should use RMI-IIOP when using Enterprise Javabeans.

C You HAVE to use RMI-IIOP when using Enterprise Javabeans.

D Java IDL can be used even if the remote interfaces were originally defined as RMI interfaces.

E RMI-IIOP can be used with CORBA only if the remote interfaces were originally defined as RMI interfaces.

F RMI-IIOP can be used with CORBA even if not all of the remote interfaces were originally defined as RMI interfaces.

G It comes down to programmer preference as both can be used in all situations.

Choices B and E are correct.

The following is taken from:http://java.sun.com/j2se/1.3/docs/guide/idl/index.htmlThis is a fundamental question and it's important to understand the distinction between these two ways of integrating the Java programming language with CORBA. Java IDL is for CORBA programmers who want to program in the Java programming language based on interfaces defined in CORBA Interface Definition Language (IDL). This is "business as usual" CORBA programming, supporting Java in exactly the same way as other languages like C++ or COBOL. RMI-IIOP (Remote Method Invocation over Internet Inter-ORB Protocol) is for Java programmers who want to program to the RMI interfaces, but use IIOP as the underlying transport.

RMI-IIOP provides interoperability with other CORBA bjects implemented in various languages - but only if all the remote interfaces are originally defined as Java RMI interfaces. It is of particular interest to programmers using Enterprise JavaBeans (EJB), since the remote object model for EJBs is RMI-based. Choice A is incorrect; Java IDL has nothing to do with Enterprise Javabeans. In choice C you can use JRMP instead of IIOP if you want. So this choice is incorrect. Choice D is incorrect because Java IDL requires CORBA interfaces not RMI interfaces. Choice F is incorrect as all the interfaces must be defined as RMI interfaces. Choice G is incorrect because although sometimes Java-IDL and RMI-IIOP could be used for the same thing, generally a situation will suit one more than the other.

What major patterns do the Java APIs utilize?

Design patterns are used and supported extensively throughout the Java APIs. Here are some examples:

· The Model-View-Controller design pattern is used extensively throughout the Swing API.

· The getInstance() method in java.util.Calendar is an example of a simple form of the Factory Method design pattern.

· The classes java.lang.System and java.sql.DriverManager are examples of the Singleton pattern, although they are not implemented using the approach recommended in the GoF book but with static methods.

· The Prototype pattern is supported in Java through the clone() method defined in class Object and the use of java.lang.Cloneable interface to grant permission for cloning.

· The Java Swing classes support the Command pattern by providing an Action interface and an AbstractAction class.

· The Java 1.1 event model is based on the observer pattern. In addition, the interface java.util.Observable and the class java.util.Observer provide support for this pattern.

· The Adapter pattern is used extensively by the adapter classes in java.awt.event.

· The Proxy pattern is used extensively in the implementation of Java's Remote Method Invocation (RMI) and Interface Definition Language (IDL) features.

· The structure of Component and Container classes in java.awt provide a good example of the Composite pattern.

· The Bridge pattern can be found in the separation of the components in java.awt (e.g., Button and List), and their counterparts in java.awt.peer.

· Iterator pattern is supported through java.util.Enumeration and java.util.Iterator

· Command pattern is also used by the Swing Undo framework

· Singleton in used by java.lang.Runtime and java.awt.Toolkit

· The Decorator pattern is used by the I/O streams.

Many design patterns were used in EJB, and some of them are clearly identifiable by their naming convention. Here are several:

1. Factory Method: Define an interface for creating classes, let a subclass (or a helper class) decide which class to instantiate.

This is used in EJB creation model. EJBHome defines an interface for creating the EJBObject implementations. They are actually created by a generated container class. See InitialContextFactory interface that returns an InitialContext based on a properties hashtable.

2.Singleton: Ensure a class has only one instance, and provide a global point of access to it.

There are many such classes. One example is javax.naming.NamingManager

3. Abstract Factory: Provide an interface for creating families of relegated or dependent objects without specifying their concrete classes.

We have interfaces called InitialContext, InitialContextFactory. InitialContextFactory has methods to get InitialContext.

4.Builder: Separate the construction of a complex factory from its representation so that the same construction process can create different representations.

InitialContextFactoryBuilder can create a InitialContextFactory.

5. Adapter: Convert the interface of a class into another interface clients expect.

In the EJB implementation model, we implement an EJB in a class that extends SessionBean or a EntityBean. We don't directly implement the EJBObject/home interfaces. EJB container generates a class that adapts the EJBObject interface by forwarding the calls to the enterprise bean class and provides declarative transaction, persistence support.

6. Proxy: Provide a surrogate for other object to control access to it.

We have remote RMI-CORBA proxies ( stubs and skeletons) for the EJB's.

7. Memento: Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.

Certainly this pattern is used in activating/passivating the enterprise beans by the container/server

Password-Protecting an Excel 2003 File

By password-protecting your Excel workbook, you can prevent unauthorized users from opening and/or editing the workbook. You set a password for opening the workbook file when you're dealing with a spreadsheet whose data is of a sufficiently sensitive nature that only a certain group of people in the company should have access to it (such as spreadsheets dealing with personal information and salaries). Of course, after you set the password required in order to open the workbook, you must supply this password to those people who need access in order to make it possible for them to open the workbook file.

You set a password for modifying the workbook when you're dealing with a spreadsheet whose data needs to be viewed and printed by different users, none of whom are authorized to make changes to any of the entries. For example, you might assign a password for modifying to a workbook before distributing it companywide, after the workbook's been through a complete editing and review cycle and all the suggested changes have been merged.

If you're dealing with a spreadsheet whose data is of a sensitive nature and should not be modified by anyone who's authorized to open it, you need to set both a password for opening and a password for modifying the workbook file. You assign either one or both of these types of passwords to a workbook file at the time you save it with the File --> Save As command on the Excel menu bar.

When you choose this command (or choose the File --> Save command for a new file that's never been saved before), Excel opens the Save As dialog box. You can then set the password to open and/or the password to modify the file by taking these steps:

1. Click the Tools pop-up button in the Save As dialog box and then click General Options on the pop-up menu.

Doing this opens the Save Options dialog box where you can enter a password to open and/or a password to modify. When entering a password, it can be up to 255 characters long and consist of a combination of letters and numbers with spaces. When using letters, however, keep in mind that passwords are case-sensitive, so opensesame and OpenSesame are not the same password because of the different use of upper- and lowercase letters.

When entering a password, make sure that you don't enter something that you can't easily reproduce or, for heaven's sake, that you can't remember. You must be able to immediately reproduce the password in order to assign it, and you must be able to reproduce it later if you ever want to be able to open or change the darned workbook ever again.

2. (Optional) If you want to assign a password to open the file, type the password (up to 255 characters maximum) in Password to Open text box.

As you type the password, Excel masks the actual characters you type by rendering them as asterisks (*) in the text box.

By default, Excel assigns an Office 97/2000 Compatible type encryption when you assign a password to open the file. You can use the Advanced button to assign another type of encryption for password-protecting the opening of the file. You should not, however, fool with these options unless you know what you're doing or have been instructed to use another type by someone in your IT department.

If you decide to assign a password for opening and modifying the workbook at the same time, proceed to Step 3. Otherwise, skip to Step 4.

When entering the password for modifying the workbook, you want to assign a password that's different from the one you just assigned for opening the file (if you did assign a password for opening the file in this step).

3. (Optional) If you want to assign a password for modifying the workbook, click the Password to Modify text box and then type the password for modifying the workbook there.

Before you can assign a password to open the file and/or to modify the file, you must confirm the password by reproducing it in a Confirm Password dialog box exactly as you originally entered it.

4. Click the OK button.

Doing this closes the Save Options dialog box and opens a Confirm Password dialog box, where you need to exactly reproduce the password. If you just entered a password in the Password to Open text box, you need to reenter this password in the Confirm Password dialog box. If you just entered a password in the Password to Modify text box, you need only to reproduce this password in the Confirm Password dialog box. However, if you entered a password in both the Password to Open text box and the Password to Modify text box, you must reproduce those passwords. In the first Confirm Password dialog box, enter the password you entered in the Password to Open text box. Immediately after you click OK in the first Confirm Password dialog box, the second Confirm Password dialog box appears, where you reproduce the password you entered in the Password to Modify text box.

5. Type the password exactly as you entered it in the Password to Open text box (or Password to Modify text box, if you didn't use the Password to Open text box), and then click OK.

If your password does not match exactly (in both characters and case) the one you originally entered, Excel displays an alert dialog box, indicating that the confirmation password is not identical. When you click OK in this alert dialog box, Excel returns you to the original Save Options dialog box where you can do one of two things:

• Reenter the password in the original text box.

• Click the OK button to redisplay the Confirm Password dialog box, where you can try again to reproduce the original. (Make sure that you've not engaged the Caps Lock key by accident.)

If you assigned both a password to open the workbook and one to modify it, Excel displays a second Confirm Password dialog box as soon as you click OK in the first one and successfully reproduce the password to open the file. You then repeat Step 5, this time, exactly reproducing the password to modify the workbook before you click OK.

When you finish confirming the original password(s), you are ready to save the workbook in the Save As dialog box.

6. (Optional) If you want to save the password-protected version under a new filename or in a different folder, edit the name in the File Name text box and then select the new folder on the Save In drop-down list.

7. Click the Save button to save the workbook with the password to open and/or password to modify.

As soon as you do this, Excel saves the file if this is the first time you've saved it. If not, the program displays an alert dialog box indicating that the file you're saving already exists and asking you if you want to replace the existing file.

8. Click the Yes button if the alert dialog box that asks if you want to replace the existing file appears.



http://www.dummies.com/WileyCDA/DummiesArticle/id-2200,subcat-OFFICESOFT.html

How to save wet cell phone !!!

Steps
Get it out of the water as soon as possible. The plastic covers on cell phones are fairly tight, but water can enter the phone over time. But this time may be quite short - 20 seconds or less. So grab your phone quickly!

Remove the battery. This is one of the most important steps. Don't take time to think about it; electricity and water do not mix. Cutting power to your phone is a crucial first step in saving it. Many circuits inside the phone will survive immersion in water provided they are not attached to a power source when wet.

Remove your SIM card. Some or all of your valuable contacts (along with other data) could be stored on your SIM. To some people this could be more worth saving than the phone itself. SIM cards survive water damage well, but some of the following steps are unnecessary i.e. don't heat it. Just pat it dry and leave it aside until you need to connect your phone to your cellular network. Note that many phones by specific providers, such as Verizon, do not use SIM cards.

Dry your phone. Obviously you need to remove as much of the water as soon as possible, so you can to prevent it from getting into the phone. Use a towel or paper towel to remove as much of the water as possible.

Allow the phone to dry. Since you do not want to ruin your phone or lose all of the numbers in your phone book, you need to allow the phone to dry. Also, ringtones and graphics stay with the phone - not the SIM. Don't try putting the battery back on to see if it works as this would risk damaging the phone with a short circuit. Leaving your phone in a bowl of dry rice will help to expedite moisture evaporation.

Heat your phone. Apply enough heat to your phone to cause the water to evaporate without water-logging your digital screen. One of the best things you can do to save a cell phone is to set it on the back of your computer monitor or TV screen over the heat vents. This is usually the perfect amount of heat to fix your phone. The convection action of the heat vents will help carry away the moisture in your phone. Leave the phone on the heat for at least 2-3 days.

Test your phone। After you have waited 3 days, make sure everything is clean and dry looking and re-attach the battery to the phone and see if it works. If your phone does not work repeat step 4. If it still won't work, try taking your cell phone to an authorized dealer. Sometimes they can fix it.

Alternative Alcohol Soak Method
Soak in Alcohol. Alcohol is hydrophobic and will seem to draw out most of the water in the phone, which will then pour out of the phone with the alcohol. Any remaining alcohol will evaporate. Alcohol will not harm your phone but may mess up glue (from stickers and the like). Use 95% alcohol, not the regular 70% rubbing type. Do it outside! Be sure to remove your battery first. When done, leave your phone outside for a day or two to dry.
You can use denatured alcohol, which you can buy at any hardware store. This alcohol can be used on electronics and it evaporates quickly. This is commonly used to clean remote controlled cars that have electronic components, but get dirty frequently. Spray it on or rinse and let it evaporate. If you can open the phone, even better.

Warnings
Don't heat the battery or it could leak acid. If you use an oven or hairdryer, make sure to remove the battery first.
If you use alcohol make sure to do so outside, and do not apply heat in any form, not even the gentle heat of a monitor. Do not hook up the battery till the alcohol smell dissipates.
Do not apply too much heat to your phone, as mentioned above. You don't want to melt or burn your phone.
Most modern phones have more than one liquid damage indicator (stickers that change color when wet) on them, only one visible to you (and sales/technician agents), and chances are, if the sticker under the battery is triggered, then the odds are that the internal stickers you can't access are tripped as well. This will still result in you paying a voided-warranty fee in the long run. Warranties don't cover water damage, insurance does.
Even if all these steps are followed, minerals dissolved in the water can precipitate on solder and component pins, causing corrosion or shorting. Components pins are packed so closely together in a modern cell phone that even a small encrustation can create a short, rendering the phone inoperable.
Be warned that manufacturers place stickers that will display "void" once peeled and some will change colors in the presence of a liquid (usually turns blue or red). This helps techs know that you have dropped it in the water, as most cell phone insurance coverage policies don't cover water damage. Also note that these stickers have been known to change colors in extreme humidity as well.
Do not put the phone (or any electronic or metal-containing object) into the microwave. You will destroy electronic components and potentially the microwave.


Source : http://forum.xcitefun.net/how-to-save-wet-cell-phone-t2998.html