Db Riekhof

+ Follow
since May 21, 2009
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Db Riekhof

Doh, I see my problem. I missed a set of parens. It should be this:

Now it makes sense.
I'm getting different results when I run this on my 1.6 JVM than what the book says.

It's a question about short circuit operators. Reducing it to the bare minimum:

The book says b should equal 1.
My JVM says it equals 0.

So which is it? Should b be incremented to 1 according to official Java?

Manish Sridharan wrote:Have you added ContextLoaderListener in your web.xml ?


Yes, I had the listener defined just as you say in web.xml. I moved it up to the top, and it still doesn't matter, same error.
12 years ago

I'm using Spring 3.1 and Tomcat 7.0.25. I'd like to get some custom property files loaded before the Spring Container processes my applicationContext.xml and initializes some beans in there. So after some research I found that a nice new way to do something like this in 3.1 is to use a custom ApplicationContextInitializer class. I tied it in my web.xml like this:

Then I wrote my class here:

It all works fine except for one Major problem. Beans inside my applicationContext.xml are getting initalized before my ContextPropsLoader code is getting executed. I know this by the errors it is showing, and by running it in the debugger and seeing the errors before it gets to the ContextPropsLoader code:

The db.driver.class.postgresql property is defined in my ContextPropsLoader, but too late after bean initialization.

Suggestions? Anyway to get that code to run sooner or the beans to initialize later?

Thanks for reading.
12 years ago
We're thinking of using HashMap to get rid of duplicate records having the same key value. So we shove everything into a large Map--it will probably be somewhere between 100,000 and 10 million records per run after removing duplicates. The key will be around 20 characters, and the value will be around 300 characters, both String objects. (rough guestimates)

So, after processing all the records, and removing dupes we'd like to write all the values out to a file. Don't need to sort. There seems to be a few options on how to do this with HashMap:

1) Getting a Set of keys, iterating the through the keys and pulling each value.
2) Getting a Set of values, iterating through those.
3) Getting a Collection of values.

Anyone have a good understanding of the consequences of each choice above in terms of memory usage and performance?
If all of these prove to be too slow and require too much memory, then we'll have to look for another data structure or write a custom one.

Looking for some advice/guidance on this. Anyone have an opinion on the best way to handle this problem?
13 years ago
Spoke to a co-worker a little more adept at CSS than me, he showed me how to look up the textfield's style class using Firefox's Firebug Inspect Element. The fix was to add this to our .css:

.rich-filter-input {
width: 100%;

I think it was set to auto by default. 100% works a little better for our needs.
14 years ago

Seems like a simple problem but it has me stumped. How do you set the width of the default filter textfield that appears in the header row? The filter textfield is taking up too much horizontal space in a few columns. We're using richfaces 3.2.2.CR4.

I'm using the default filtering like this:

14 years ago
We have a dropdown:

Sometimes the values in these dropdowns have consecutive spaces between words. Cleaning the data of these double spaces really isn't an option. When we select one of these double space values in the dropdown, we get a validation error:

I'm no JSF expert and I didn't write this code, so I'm having a little trouble understanding why this validation error is happening, or even finding the validator that fails. I think this is some kind of default JSF validation, because I've searched through our code and can't find anything that matches this validation error. Has anyone else experienced this and found a solution, or can anyone give me some advice on how to get started finding the problem?
14 years ago
Thanks for the responses. I'm trying to do a simple demo with all the features we'll need, then apply the solution to our project (assuming i get the demo working). I've hit a snag early in the demo. When the user presses a button, the demo creates a new tab with code like this:

That works fine. Now I'd like to include a .jspf on this new programatically created HtmlTab (ht). I haven't been able to figure out how to include a JSP on a JSF component created programatically instead of statically in a JSP file. How do I programatically do this?

<c:import url="./sandbox/ContentPane.jspf"/>

Here's the only thread I've found googling that I thought was related to my problem, and unfortunately it didn't offer any clear solution:


Can anyone offer some advice on how to do this? Assuming I can get over this roadblock, our plan for the demo is to then use scriptlet code in our .jspf files to generate unique component ids for all the components in the included .jspf files.
15 years ago
I'm new to JSF. I've just started working on a JSF webapp with lots of page fragements (.jspf). Almost all of our jsp files are .jspf and are added to tabs with something like this:

This has worked pretty well, but now we've run into a problem. We want multiple tabs to use the same page fragment JSP to provide the same view to a different collection of data. When I do this, I get duplicate component id errors. I assume this is because some of the component IDs are specified in the page fragment JSPs.

I'm not sure how to tackle this problem. I've done some googling and brainstorming and haven't made much progress. Is there a good way to do it? Should we do a major refactoring and get rid of the page fragments in tabs architecture to accomplish this? Any examples on the web of providing the same view on multiple tabs with a different set of data on each tab?

I was thinking of trying this but it seems kind of crazy: When a new HtmlTab is needed, programatically create it. Then grab all the child components off another HtmlTab and clone them and set unique IDs in the clones, and then add them programatically to the new HtmlTab. This seems like a lot of work, and probably would run it to problems.
15 years ago