Siddhartha Ghosh

Greenhorn
+ Follow
since Jul 07, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Siddhartha Ghosh

I believe that the comment set by setComment() can be read by some advanced Archiving Softwares like Winzip, but really I don't know how it might be possible to read the comment using the java.util.zip package.
15 years ago
My Dear Simrat,
Unless you are using Generics, whenever you invoke the method

You actually get back an object, nothing but a plain and simple object right? Now what happens is that when you are actually calling System.out.println(), your object gets converted into it's String equivalent, and this is where the magic happens and your question is answered! See what happens is that in order to convert your object to a string, the JVM internally invokes the toString() method that all Objects have. However, at runtime, due to dynamic binding the actual method that gets invoked is the overriden toString() method in the Integer class, and this method knows how to convert your integer to a nice looking string representation. Hence, you think that you are accessing the Integer, while in essense you only have an Object.
15 years ago
Hi Easwar,
First of all, get the latest stable release of Netbeans, i.e., version 5.5. If you are already having this version then follow the steps below:

1. Create a new project in netbeans.
2. Go to menu File > New File ( or alternately press Ctrl - N )
3. In the dialog box that appears, notice that in the left hand side you have a list of categories, select Java GUI Forms in the category list.
4. Notice that the right hand list now changes to show you the available form types. You must have a type called JDialog form available in the right hand side list. Select this and press next!
5. Fill in the details in the next page and Voila! The GUI editor of Netbeans called Matisse now opens up for you with the JDialog that you want to create.

15 years ago
The JVM decides on how much space is to be reserved in memory for creating an object when you actually create an object by the new keyword!
For eg,


This is when actual memory is allocated in the Heap for your Object. However, when you add an object to a collection by calling the add method, you are actually passing a reference to that object, ( Not the real object ) already lying around in the heap, and this reference is of a size known to the JVM. Thus, no matter what the real size of the object might be in the heap, the collection happily adds the reference of that object.
15 years ago

Originally posted by steve souza:
http://www.exampledepot.com/egs/java.sql/BatchUpdate.html



Thanks a lot for helping me out Sir. This example was exactly what I needed. This is why I love this community. Thanks for replying so quickly... I am indebted!
I've seen a lot of JDBC Code samples and examples for doing batch updates using the plain Statement interface. But I want to do the batch updates using the PreparedStatement interface, and I don't want to use the addBatch(String sql) method that PreparedStatement inherits from the Statement interface. Rather I want to use the addBatch() method of the PreparedStatement that can re use the same statement along with various data values to form different statements of the batch. The problem is that I am a bit confused about the exact usage...
Can anyone give me a small example? Is the method invoked after setting a new set of data values or before setting it for each new batch statement?
Thanks in advance!
We all know that the System and Runtime classes have methods to load native libraries ( *.dll or *.so ). But I would like to know whether there is any way to load a Jar ( Java Archive ) library into the JVM as a library at runtime? Thanks in advance for your assistance.
Regards,
Siddhartha
15 years ago
Dear Jeanne and Ilja,
Thanks a lot for answering my queries, and thanks especially for reminding the automated IDE or Ant based generation approaches for getters and setters. I almost forgot about it.
It is true that a getter/setter based approach provides more security and robustness to the code than the Properties object based approach. I was just apprehensive ( read horrified ) about the bulk of the fields that was there in the initial draft of the class diagrams. But we are going to review and modify the design soon and I hope or rather pray that it has lesser fields per class.
Once again thanks a lot for your generous help!!
Regards
Siddhartha
15 years ago
Hi I have this project in which some Data Bean Classes used to represent entities have an enourmous number of fields. If I am to write the accessors and mutators ( getters and setters ) for all these fields the code length would grow huge and even managing it would be a nightmare . I have thought of an alternative solution. Instead of storing data properties as fields why can't I stuff all of them in a Properties or HashTable Object and have this as the only field of the data bean. That way I would have only a single accessor and mutator and all the properties would be stored as key value pairs. Is this a good solution? Or is it just another luring anti pattern?
Can anyone suggest any other alternative solutions?
eg.: instead of writing:


Can I write this one:

Please suggest ASAP
15 years ago
Dear Mark,
Once again thanks a lot for your help. I have bought the book, Head First EJB, which I think I should have bought a lot earlier. And I've also learned how to create the client jars. Hey, that was damn easy, it's almost like creating any other jar file, only that we need to pack the client interfaces in it. Many many thanks to you, I am no longer afraid of EJB or JBoss any more.
Regards,
Siddhartha Ghosh
Dear Mark,
Thanks a lot for answering so soon. But you see I am a total noob in EJB. So I would appreciate it very much if only you could just gimme some hints about what commands to use for generating the client jars, or else atleast could you please gimme some references from where I might learn more about the process?
The Eclipse IDE shows you an error against a project even if a single file in the entire project has an erroneous line. To add to our woes, Eclipse does a kind of live compilation, churning out byte codes everytime you hit on the save button ( and sometimes even if you don't )

Don't worry, here's your solution to locate and debug errors precisely:
Go to Window > Show View > Problems from the main menu bar at the top. This shows up the problems window usually docked at the bottom, which tells you the description, resource, path and location of your error precisely. You can then find out and correct it to run your code again!!
15 years ago
Hi, I am completely new to EJBs. Although, I have successfully deployed an EJB in the J2EE RI server using the Sun Studio IDE, I wanted to know how I can get a production server like JBoss or Websphere to generate the Client-jar files needed by a Swing Desktop client. If Jboss does generate these files automatically where does it put it?
Java is the best language known to us all over to implement all the features of OO languages, Encapsulation, Polymorphism, etc. You get to implement UMLs using JAVA in the best possible manner and hence it also conforms to the OMG specs. IF JAVA'S NOT OO THEN NOTHING ELSE IS!
16 years ago