- Estas parseando metadatos de imagenes en tu super enterprise entorno java
- le tiras un XPath al Nodo de los metadatos que te devuelve la API y no te devuelve nada
- pensas "debe estar mal la query XPath"
- lo probas en un debugger de XPath y anda
- le das mil vueltas y sigue sin andar
- probas con DOM a mano (que es una API horrenda) y anda
- pero te negas a hacerlo en DOM pelado
- seguis probando
- "no puede ser que la API esta mal" pensas
- ya te rendis y le preguntas a google
- "This class is not intended to be used for general XML processing. In particular, Element nodes created within the Image I/O API are not compatible with those created by Sun's standard implementation of the org.w3.dom API. In particular, the implementation is tuned for simple uses and may not perform well for intensive processing."
- Intensive processing? no responde a los queries XPath, eso no es intensive, eso es mal implementado!
- lo siguiente lo dijo mejor este vago que lo que podria escribir yo asi que lo cito
possible in a org.w3.dom.Node, but that does not mean it should
actually be wrong. Since javax.imageio.metadata.IIOMetadata.
getAsTree() returns an org.w3.dom.Node, I believe that compliance
with the contract for org.w3.dom.Node is required.
In the case of the JPEG 2000 metadata accessed using this method,
I have observed Nodes of type Element with Values set, which is
illegal.
If Element nodes are not going to have Text children in your model,
then they should have Attribute children with the Attribute name
being "value", and I don't think the JPEG 2000 metadata is doing
that (unlike the standard metadata which does use Attributes).
Also, it is all very well to say that the IIOMetadataNode is not
a "real" Node, but the point of choosing this methodology was so
as to allow the use of "ordinary" style DOM accessors, at least
that is how I remember the decision in the JSR 015 Expert Group
discussions. It is presumably the point of the existence of the
getAsTree() method.
To that end, if an ordinary Transformer cannot render the structure
returned by getAsTree() as XML without losing information, and if
XPath cannot query it, then I would argue that the implementation
of getAsTree() is broken, not just limited.
The "ability to store an Object reference within a node" is all
very well in special circumstances, but should NOT in my opinion,
be abused just to point to a scalar type, for example. This begs
the question of what the behavior is supposed to be, or defined
to be, for javax.imageio.metadata.IIOMetadata.getAsTree() in
such circumstances. Not that I have looked into the detail of
how this is implemented, just wondering theoretically how such
an Object reference would be correctly used and under what use
cases it is required."
http://forums.java.net/jive/thread.jspa?messageID=255691
y el problema es que esto ya me paso antes, en la api del widget para mostrar Rich Text en swing no hay forma en la api para obtener el offset del cursor contando el HTML que esta por detras, solo te da el offset del texto que esta en pantalla, por lo tanto hay muchas acciones que se re complican, buscando en los foros por esa epoca habia respuestas como "si, sabemos que esta mal pero no lo vamos a arreglar por X o por Y".
muy enterprise..
Edit 1:
- por que no puedo iterar sobre un NodeList en ese pseudo foreach que tienen? es un iterable despues de todo no?
- porque Vector no tiene una api para hacer slicing?
- porque Vector, LinkedList y ArrayList son implementaciones de List? no podrian esconder los detalles de implementacion al usuario y hacerles pensar que estan eligiendo mal cada vez que eligen uno por sobre el otro?
- Porque Vector es thread safe y LinkedList y ArrayList no?
- La version limitada de Node que me devuelve la metadata de la imagen no me deja hacer getElementByTagName, asi que no puedo hacer mas que iterar por todos los childs buscando el que me hace falta ya que por suerte en la implementacion se mueve de posicion.
- size() length() getLength() getSize(), no se ponen de acuerdo en eso no?
In "The Zen of Graphics Programming", Michael Abrash (a co-author of Quake and inventor of Mode X) wrote:
-------------
Our world is changing, and I'm concerned. By way of explanation, three anecdotes.
Anecdote the first: In one of his books, Frank Herbert, author of Dune, told me how he had once been approached by a friend who claimed he (the friend) had a killer idea for a SF story, and offered to tell it to Herbert. In return, Herbert had to agree that if he used the idea in a story, he'd split the money from the story with this fellow. Herbert's response was that ideas were a dime a dozen; he had more story ideas than he could ever write in a lifetime. The hard part was the writing, not the ideas.
Anecdote the second: I've been programming micros for 15 years, and been writing about them for more than a decade and, until about a year ago, I had never-not once!- had anyone offer to sell me a technical idea. In the last year, it's happened multiple times, generally via unsolicited email along the lines of Herbert's tale.
This trend toward selling ideas is one symptom of an attitude that I've noticed more and more among programmers over the past few years-an attitude of which software patents are the most obvious manifestation-a desire to think something up without breaking a sweat, then let someone else?s hard work make you money. Its an attitude that says, "I'm so smart that my ideas alone set me apart." Sorry, it doesn't work that way in the real world. Ideas are a dime a dozen in programming, too; I have a lifetime's worth of article and software ideas written neatly in a notebook, and I know several truly original thinkers who have far more yet. Folks, it's not the ideas; it's design, implementation, and especially hard work that make the difference.
Virtually every idea I've encountered in 3-D graphics was invented decades ago. You think you have a clever graphics idea? Sutherland, Sproull, Schumacker, Catmull, Smith, Blinn, Glassner, Kajiya, Heckbert, or Teller probably thought of your idea years ago. (I'm serious-spend a few weeks reading through the literature on 3-D graphics, and you'll be amazed at what's already been invented and published.) If they thought it was important enough, they wrote a paper about it, or tried to commercialize it, but what they didn't do was try to charge people for the idea itself.
A closely related point is the astonishing lack of gratitude some programmers show for the hard work and sense of community that went into building the knowledge base with which they work. How about this? Anyone who thinks they have a unique idea that they want to "own" and milk for money can do so-but first they have to track down and appropriately compensate all the people who made possible the compilers, algorithms, programming courses, books, hardware, and so forth that put them in a position to have their brainstorm.
Put that way, it sounds like a silly idea, but the idea behind software patents is precisely that eventually everyone will own parts of our communal knowledge base, and that programming will become in large part a process of properly identifylng and compensating each and every owner of the techniques you use. All I can say is that if we do go down that path, I guarantee that it will be a poorer profession for all of us - except the patent attorneys, I guess.
Anecdote the third: A while back, I had the good fortune to have lunch down by Seattle's waterfront with Neal Stephenson, the author of Snow Crash and The Diamond Age (one of the best SF books I've come across in a long time). As he talked about the nature of networked technology and what he hoped to see emerge, he mentioned that a couple of blocks down the street was the pawn shop where Jimi Hendrix bought his first guitar. His point was that if a cheap guitar hadn't been available, Hendrix's unique talent would never have emerged. Similarly, he views the networking of society as a way to get affordable creative tools to many people, so as much talent as possible can be unearthed and developed.
Extend that to programming. The way it should work is that a steady flow of informa-tion circulates, so that everyone can do the best work theyre capable of. The idea is that I don't gain by intellectually impoverishing you, and vice-versa; as we both compete and (intentionally or otherwise) share ideas, both our products become better, so the market grows larger and everyone benefits.
That's the way things have worked with programming for a long time. So far as I can see it has worked remarkably well, and the recent signs of change make me concerned about the future of our profession.