Mark Williams

Ranch Hand
+ Follow
since Aug 01, 2008
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 Mark Williams

I suspected that your question about constructing the dialog with the frame as the owner was going to lead me to the answer and it did. Thanks Darryl!
In my program, I subclassed JDialog (well actually the Eclipse WindowBuilder plugin did it for me) and didn't notice the constructors of JDialog that take a Frame as an argument.
After placing a call to the JDialog's constructor with the parent frame as an argument in my JDialog subclass's constructor, I got the behavior I expect.

Thanks!
9 years ago
I don't do much Swing programming usually but I got to play with some at work recently. It's been a lot of fun but I've got this annoying little issue.

My app consists of a JFrame that opens up a modal JDialog to show progress of a long running task. When I alt-tab or switch to another window and then switch back to my program, the modal dialog comes to the top of the view but the parent JFrame does not come to the front. The parent JFrame remains behind the window I temporarily switched to while the modal JDialog comes right to the top. I expect to see JFrame come to the top along with the modal dialog.

This does not happen on my Linux/Gnome box, just on the Windows 7 boxes I have run the program on. Does anyone have any tips?
9 years ago

Alessandro Zabaroni wrote:Hello Mark. I'm experiencing the same issue. Websphere application running on jvm 1.6
Did you solve that ?



In our case, our application had several thousand threads that were getting started. Fortunately, these threads ended up not being needed for several reasons. When we got rid of the unneeded threads, we never experienced the problem again.

The bad news is that we never definitively proved the root cause. The problem went away once we reduced the number of threads so we just moved on with life.
Is there anything unusual about your application?
10 years ago

Paul Clapham wrote:Okay... but SAX doesn't preserve the order of the attributes either. The startElement method passes you something which amounts to a Map of the attributes attached to the element.



Yikes, glad I didn't spend any time on reworking the approach to use SAX then! I guess I'll be hacking something together to suit my needs then. Thanks for the advice.
Whoa don't get carried away! I definitely didn't propose a Xerces fork. I was thinking more along the lines using a SAX to handle the elements I am interested in while passing the ones I don't care about straight to the output.
Jimmy, turning off the load of the external DTD did the trick. Thanks.

As for the order of the attributes. I believe I am going to have to take another approach.

From what I read, attributes are stored in org.apache.xerces.dom.NamedNodeMapImpl. I can't prove it but judging by the logic used to place attribute nodes into NamedNodeMapImpl's Vector based internal storage, it appears to me that the attributes will always be stored in alphabetical order.
Jimmy, I follow what you are saying but it doesn't appear that my application's behavior matches what you describe.

When I get a new instance of DocumentBuilderFactory - an instance of org.apache.xerces.jaxp.DocumentBuilderFactoryImpl is returned.
The document object is an instance of org.apache.xerces.dom.DeferredDocumentImpl.

When I inspect the DOM in debug using eclipse immediately after calling DocumentBuilder.parse() it appears as if all of the default attributes are in the DOM representation of the source at that time.

Does that make any sense?

Well it looks like the Xalan Design link from the Xalan website clears up some of the confusion. I'll have to look at it in more detail after getting some rest. I don't understand the process completely at this point but I think the information I need is all there.

Jimmy Clark wrote:Xerces is a low-level XML parser. It does not produce any XML-based data. Xerces does not "add" any attirbutes and it does not alphabetize them either.

Your concern lies in whatever is creating the XML-based data, e.g. DOM implementation, Xalan implementation.



So, I think I am confused about which implementation is responsible for which portion of JAXP. Where is the line that marks the end of Xerces's responsibility and the beginning of Xalan's responsibility?

I assumed Xalan was parsing the XML and building the DOM. Then i thought Xalan was transforming the DOM into XML. But I guess going from XML to DOM is a transformation and that would seem to also fall in Xalan's court. I am confused...
The only issue I have is that I am trying to do an automated change on several thousand hibernate mappings. Where I work, we let our customers have source code and they often make their own changes. All of the unecessary changes introduced by the transformation would make it harder for customers to take an upgrade and bring their modifications forward.

Other than that, I agree that it's a non-issue. Thanks for the response.
I am trying to use Xerces implementation of JAXP to load a hibernate mapping file into the DOM and then write out the XML using Xalan. It works pretty well but in the final XML, all of the attributes with a default value defined in the DTD are appearing. The attributes are also being written out in alphabetical order. I don't want either of these behaviors. I tried playing around with setting a few different parser features but I couldn't figure out how to stop it.

Is there any way I can stop Xerces from adding the default attributes and also leave them in the order they were read from the original XML?

Thanks.
At work I ran across an interesting problem for the first time and I am perplexed as to how I should respond.

We have a large Java application running on IBM's JDK 1.5. IBM's JDK has a default setting for the maximum number of class loaders that can exist which is 8192. If this threshold is reached, the JVM will throw and out of memory exception.

Our application threw this exception after running for several days. No big deal I thought. So I doubled the maximum to from 8192 only to find that our application reached the new maximum after a two weeks.

Now, I don't think it would be normal for the application to run for this long in a production environment but I am worried that this might be a symptom of a more fundamental problem in the application. Are there any suggestions for analyzing this problem? Is there some way I can get Java or a debugger to show all of the class loaders present in the JVM? Any other ideas?

Also, this application runs on either Websphere or Tomcat. We are only experiencing this issue when running on Websphere. And we have only one deployment that seems to be affected.

Thanks!
10 years ago
Are there any reason I should be concerned about a jsp file that contains a content type definition meta tag? Kind of a strange question, I know.

As an example, say I write a jsp and save the source file on my PC in one encoding. I then upload the JSP to a server.

Is it possible that the server may actually send the response to the client encoded differently than the source file is? If so, does pose any risks? Thanks.
10 years ago
JSP

Joe Ess wrote:Standards are for things that can be standardized. The problem with things like names is, once you try to set a standard, some jerk comes along and violates it just because they can. See this epic rant for example.



Great respsonse Joe. There actually are some good thoughts in that epic rant.
A few best practices was really all I had hoped to find anyway. Thanks very much!
11 years ago
I figured this is the best board out of them all for this question...

I am working on an i18n project and need some help locating some
standards information. The systems current personal and business
contact information database columns are not even totally sufficient
for US domestic users. The primary reason is the insufficient maximum
length on columns such firstname, lastname, address, etc.

I have not been able to find any standards such as an ISO standard
that address contact information storage for i18n'ed computer systems.

Does anyone have any sources of information they could point me to?

Thanks Javaranch!
11 years ago