Mike Curwen

Ranch Hand
+ Follow
since Feb 20, 2001
Mike likes ...
IntelliJ IDE Java Ubuntu
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Curwen

That sounds quite interesting.

But because we're a financial services company, and we have collectors and sometimes have to repo assets that people feel are theirs (but is actually ours).... we wouldn't want it to be a publicly-browseable map.

I'm just looking for something hostable on our intranet for employee use.

12 years ago
Hi all,

Is there such a thing as a mapping framework/API that would allow one to create their own maps?

For example, let's say I have a large building, with a few hundred cubicles. And I want to create a (web) browseable map. So it should look and feel and act just like google maps, but the thing being mapped is my building, and instead of addresses, it's people's desk. I should search for "mike curwen', and the little maps zooms to my cubicle.
12 years ago
Thanks Brian,

That link... is it just me, or does that look pretty hackish to you? Like "forcing" two things together, and for what good reason?

Assuming I'm green fields, and don't particularly "require" anything from the spring framework (or so I suppose)... JSF with CDI... doesn't *need* Spring, right?

It seems to me, like much of the arguments in favour of using Spring's container as the bean manager for JSF, are based on JSF's default container being "weak" in comparison to Spring. And I might even agree with that, but that was all before CDI. But *if* I switch to using CDI... do the arguments go away, or merely change? Are there other reasons for still preferring to use Spring (that is: *don't* use JSF+CDI, use JSF+Spring and *not* CDI, and these are the reasons why...)

13 years ago

So I'm new to JSF and CDI, but not all that new to Spring. I'm reading all sorts of online tutorials. Some of them just use "plain old JSF". Some show you how to replace JSF's managed container, with Spring's. And others talk about JSF, CDI and the "JSR 299 fiasco".

My question is a bit fuzzy, architectural, hand-wavy... I just don't have a firm grasp on the subject matter, I think.

If I'm using JSF and choose to use the CDI annotation (use the JEE CDI container, rather than the 'smaller, less capable' JSF container), then why would I use Spring? Aside from "I like Spring", and "the tutorial showed me how to do it" and "because I can". Is there a *need* to use Spring, if I'm using the move powerful CDI container ?

13 years ago

Talk about not seeing the tree for the forest.

Thanks, that works dandy.
13 years ago

I've written some code that connects to the mail server, opens a certain inbox, retrieves the message(s) and writes them to an output stream. Limiting my code to that last bit:

So now, if I were to actually save each message to an individual text file, I'd get (according to the javadoc) "the message as an RFC 822 format stream".

I then tried to find the message.readFrom(InputStream is) method, and did not find one. There's something that looks promising on the MimeMultipart class (a parse() method) but it (and other methods like it) are all protected. So, I'm not very familiar with this API other than using it to send email. Does anyone know then, how to use it as if I were a mailserver, reading a mailfile off disk?

What I eventually want to do: Make an exact copy of a certain message that I've got in an inbox. This particular message, which is from an external 3rd party, exhibits problems for software further down the line that reads and deletes the message from the inbox. I'd simply like to be able to reliably re-produce this exact message with all its problems. I've had no success constructing my own messages using the JavaMail API, that duplicates the exact nature of this message (which is why I thought to make a copy of it).
13 years ago

We're moving a production server over to VM infrastructure. I've confirmed that all components (java, jboss, application and libraries) are the same between platforms. I've also made the platforms as close as possible (same HD, same RAM, better CPU). The difference would be that our existing production server is an old stand-alone server, running linux 2.6.8 ( I think some flavour of redhat) and the new production instance is a vmware host. Not sure what the server is, but the host OS is ubuntu linux 2.6.24

I recognize that there's quite a difference between plain hardware and VMWare hosts. But...

When I start this application on my localhost for development it takes about 17 seconds for the whole thing to start. On production it takes about the same. But on the new VM host, it takes a minute and 17 seconds, and nearly the whole minute extra is experienced right here (3rd line from bottom):

See how after "Core system initialized', it pauses for nearly a minute?

Anyone seen this, or have ideas what the cause is?
14 years ago
balancer is a demonstration app. you don't need it for the proper functioning of Tomcat. In fact I'm pretty sure you don't *need* any of the apps under $CATALINA_HOME/webapps
14 years ago
> [org.apache.webapp.balancer

Unless you're using the balancer app, you could just remove it.
14 years ago
Alright, there is that difference (which I did notice), but thought that was what one did when defining the 'top' node. So I've made a change to the schema (not that it's mine to change...)

I get what I want in the javadoc, but now the ObjectFactory has a new private field and public method that I don't know what they are for.

With the old schema, I get a fairly simple object factory:

But with the javadoc-corrected schema, I now get:

Is this a non-important change? It certainly doesn't (seem to) break any of my code that uses the JAXB objects.
I have a question about the JAXB-generated javadoc code.

So within the schema of interest, there are two "container" elements. One element represents "the report" and it has a couple attributes (timestamp, if it's production data or not). The other element represents one row of data and it has an id attribute. All the other elements represent the columns of data, and for the most part are simple types.

Here is an edited version (took out most columns and anonymized) of the schema:

My problem is with the generated Javadoc comments. Here is the top part of the javadoc for the complex type 'ReportRecord':

So on line 14 it correctly identifies the class name, and at line 19 the schema snippet has a name attribute.

But a similar example from the CompanyBillingReport class:

So, at lines 3 and 8, the information is missing. It's like JAXB didn't know what it was (a CompanyBillingReport class), when it was generating the javadoc. All it says is "anonymous class", and there's no name attribute on the schema snippet.

Is this a JAXB bug, or a problem with the schema?

For completeness, my class looks like:

and my marshal code has a few additional lines:
Ahh... that is satisfying.

I saw on this page: https://jaxb.dev.java.net/guide/Changing_prefixes.html there is a way to change the prefix that is output (in my case, it uses the default namespace, and I wanted it to use a prefix).

Downloading the distribution (finally having found it on java.net - how frustrating), and viewing the namespace-prefix sample, I see how to put my own prefix on all elements.

The other issue I was having was that xmlns:xsi was being declared on each element that had use of xsi:nill. Having found this:

I see that the solution of both of my outstanding problems are resolved by implementing this class.

now I only need to figure out what standalone=yes means.

Paul Clapham wrote:All your element names are in the same namespace as the corresponding element names in the sample XML, namely the http://www.foobar.ca/foo namespace. The sample XML uses a namespace prefix and your XML uses the default namespace to cause that to happen, but the two documents should be treated identically by namespace-compliant software.

Since posting, I've done further reading (multiple times) in these documents:

So I now have a basic understanding of the above.

Paul Clapham wrote:(Caveat: namespaces are not well understood and there's a lot of software which isn't namespace-compliant.)

This is what I'm actually concerned about.

Paul Clapham wrote:In the sample XML, xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" declares a namespace which is not used anywhere in the document. So it would make no difference if it were removed.

In your XML, you have a couple of "nil" attributes which are in the http://www.w3.org/2001/XMLSchema-instance namespace. Their namespace declarations appear in the element which encloses them rather than in the root element, but that makes no difference to the structure of the document. Namespaces can be declared at any level of the tree and they are inherited at lower levels unless they are overridden. Whether the presence of those attributes is a problem depends on the software that will be processing the document.

I understand in the sample that namespace is not used, but in my generated xml doc, it is (or rather, could have been). And I get now that it's a scoping thing, that you either "map" the namespace in the root element, and it is inherited throughout the document. Or you can do it individually for each element that has an attribute (or that contains a sub-element) from a different namespace (like is done in my generated xml).

My concern is that I want my generated document to be as close as possible to the sample provided by the vendor. And in the sample, they've got this:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; right at the top. This would allow me to use just xsi:nil="true" in each element below, instead of having to repeat the xmlns:xsi everywhere.

It seems to me, there should be a way to generate the xml in that format. It would certainly result in smaller output files. If not, I suppose I could post-process it. (XSLT?)


background: My fullest exposure to XML is config files and as a very high-level understanding of WS-*. I now have a vendor that I need to communicate with, via XML. They have XSD's and sample XML files.

So I've got the xml schema file and a sample xml file from the vendor. (I don't know for certain that the one was used to generate the other).

I've used JAXB to generate Java classes from the xsd, and wired up some dummy code and generated an XML file with test data. My XML file does not match the sample the vendor has supplied.

This is what appears at the top of the vendor's sample XML File:

and this is what I get:

1) I've got a "standalone=yes' attribute - does that hurt?

2) my sample has no namespace prefixes (is that the right term?) anywhere. I believe this is alright, but is anyone aware of what JAXB API setting allows me to specify a NS to use in the output XML?

3) I'm totally missing the xmlns:xsi attribute from my root element. I believe that's why I'm getting the output of an xmlns:xsi attribute on my null elements. First, am I correct in that? and two: how do I put the xmlns:xsi element in my root element? I'm assuming it's another JAXB API setting. Or, perhaps this is all driven from the XSD, and the vendor has simply supplied me an XSD they created, and a hand-bombed XML file.

4) what is the purpose of the xmlns:xsi attribute in the XML File?

oh, I can share some code if that would help, but it's almost all generated via JAXB from the XSD. My only code is fairly typical "create some objects, fill them with data, marshal them to XML"