Mag Hoehme

Ranch Hand
+ Follow
since Apr 07, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Mag Hoehme

Hello Filippo,

thank you very much for being here and answering questions! I am wondering what Flex actually is about. Before I start diving into it, I'd like to know something about it:

What kind of apps/user interfaces can I create with Flex?
In which way does Flex differ from other technologies, such as JSP, Swing, ...?
What are the benefits compared to other technologies?

I am not an expert in user interface technologies. Maybe you can give me a short overview about what Flex could do for me, if I wanted to create a user interface. Thank you very much!


7 years ago
Hi folks,

I don't understand what "anonymous" refers to in the following example code from the B&K book:

The B&K book continues to state the following:

We call this anonymous array creation because with this syntax you don't even need to assign the new array ot anything.

I don't understand what they mean with this - since the array IS in fact assigned to the testScores variable. Can anybody help me to understand?
Hi Francesco,

I think you can cast the object you get from class.newInstance() to some interface:

Interestingly the casting works only with an interface.

Hops this answers your question!
13 years ago
Hi Bimal,

encapsulation means that you can access an object's data via getter and setter methods. An object only encapsulates its own data - not the data of the objects its methods return. When you get an object via a getter method, you have full access to the data it exposes - be it via methods or directly.

However, the question is not whether Java perfectly supports encapsulation, but rather whether the programmer of a given class designed their class according to the principles of encapsulation.

The second question is why you would like to make use of encapsulation: One of the major goals of encapsulation is to provide a stable interface on which a client class can rely, even if the programmer chooses to modify the internals of their class.

I hope this answers your question!

Best regards
[ September 13, 2004: Message edited by: Mag Hoehme ]
13 years ago
Hi Stephen,

how do you know that it does not work? Does the piece of code throw any exceptions (if yes, which one)?

I suggest that you change the catch clause and replace it by something like

The stack trace may tell you what exactly is going wrong.
13 years ago
Hi Ramakrishnan,

what do you mean by "desktop java"?

Java classes are organized into packages, which belong together in some way. The core classes are packaged in the java.* pages. The most important ones are the java.lang package (e.g. Object, String), the package, and the java.util package.

Java contains an Abstract Windowing Toolkit (AWT) for creating basic graphical user interfaces (GUIs). The classes for implementing AWT-based GUIs are contained in the java.awt package.

However, AWT has only a limited scope. This is the reason why Swing has been developed for creating desktop applications. The Swing classes can be found in the javax.swing package (javax means "Java extensions").

Does this answer your question?
13 years ago
Hallo Andreas,

I tried to check your code, but I did not find any problem with it.

When does it throw the FileNotFoundException?
Which paramters did you enter?
What is the value of the p parameter?
Is it possible that some other process is locking the file indicated by p while your unzip program tries to open it?
13 years ago
Hi Arindham,

I have my doubts whether StringBuffer is a suitable object type to accompish your task. As I understand it, you want to replace some URL in a href tag by another.

I would adopt the following strategy:

1. get the original String
2. open an empty StringBuffer
3. scanning the original String for href tags
4. copying the portions not to be modified to the StringBuffer as they are, and replace the portions to be modified by the new content.

Use two int variables, start and end, String methods such as indexOf, substring.

However, this approach can be further optimized towards a better performance. Most String methods, such as string.substring (), create new String objects for their return values. To avoid these unnecessary objects, you may choose to work on a char array, copying the chars one by one to a StringBuffer (or to a second char array). For more information on using char array to boost performance, use Google with "String" and "performance".

Hope this helps.
[ June 25, 2004: Message edited by: Mag Hoehme ]
13 years ago
Hi Frank,

the answer is:

This usually returns a GregorianCalendar, which represents our (Western) calendar. The calendar object is initialized with the system's time and date. java.util.Calendar is the abstract superclass for calendar objects such as GregorianCalendar. Other calendar's - for example, a Japanese one - may interpret the system's time in another way. However, the only implemented calendar type is the Gregorian one so far.

For more details check the JavaDoc for java.util.Calendar.

Hope this helps.
[ June 25, 2004: Message edited by: Mag Hoehme ]
13 years ago
Hi Bhaskar,

you need at least the following:

1. - J2EE: include the j2ee.jar (lib directory) into your classpath
2. - get the properties for the initial context from the EJB provider.

Depending of the EJB container, you may need some more jar libraries in your classpath.

Any EJB tutorial also contains client examples addressing an EJB. You may also check my EJB tutorial (somewhat incomplete, but it may cover your questions).

Finally, you question relates to J2EE technology. When you need any further help, you might get it faster when posting in the EJB section of this forum.

Hope this helps.
Hi Verduka,

check the following URL: on parsing a UTC date!

Hope this helps!
13 years ago
Hi Sushil,

deploy your Java classes, which are called by your JSPs in the webapps/<your project>/WEB-INF/classes folder.

Hope this helps.
Hi Alex,

Apache, Tomcat and JBoss provide different services: Tomcat is a servlet container, whereas JBoss is an EJB container. However, Tomcat may also serve HTML pages (this may be a source of confusion).

Consequently, for working with servlets, you use a servlet engine like Tomcat. For working with EJBs, you need an EJB container like JBoss.

EJBs, which always live in EJB containers, can be addressed by any remote (Java) client - that is, stand-alone clients as well as servlets. You do not address EJBs (or JBoss) directly through a Web Server like Apache.

Check Google for Tomcat/Apache integration. You will find a lot of resources.

Hope this helps!
[ June 22, 2004: Message edited by: Mag Hoehme ]
Hi Naren,

an EJB is in fact a special subtype of object. And all objects inherit from java.lang.Object. This may account for the interchangeable use of "bean" and "object".

Hope this helps. If not, please let me know an example.
[ June 22, 2004: Message edited by: Mag Hoehme ]
Hi Thanjai,

check out the following article on garbage collection at It may answer your question in depth.

Hope this helps.
13 years ago