This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Mirko Froehlich

Ranch Hand
+ Follow
since Aug 21, 2000
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 Mirko Froehlich

Thanks for the pointers. I actually came across the Wikipedia entry and the JCaptcha project shortly after I posted my message.

For some reason, information on this topic seems to be difficult to find without knowing the proper name of this technique (Captcha)...

-Mirko
15 years ago
JSP
Does anybody know an open source Java implementation of an image verification form? I'm not really sure how this feature is officially called, but I am talking about those automatically generated images that contain scrambled text which users need to enter on various websites these days in order to verify that they are indeed human and not a spam bot.

Any pointers would be appreciated.
Thanks.

-Mirko
15 years ago
JSP
I could think of a few cases where you might want to scale down an image that was acquired on a camera phone using the MMAPI, for example in order to generate a thumbnail. In fact, I am working on such an application right now. The following article points out a simple way to do this:
Link
Check out the createThumbnail() example. In theory, this solution is not ideal, but it works fine for this purpose on my Nokia 3650.
With regards to scaling up you would need some real interpolation algorithm, so this would be more tricky. I'm not sure why anyone wouln need to do this, though.
Otherwise, I completely concur with Michael that you should do the scaling before and package the scaled images with your app.
-Mirko
16 years ago
I could think of a few cases where you might want to scale down an image that was acquired on a camera phone using the MMAPI, for example in order to generate a thumbnail. In fact, I am working on such an application right now. The following article points out a simple way to do this:
http://developers.sun.com/techtopics/mobility/midp/articles/picture/
Check out the createThumbnail() example. In theory, this solution is not ideal, but it works fine for this purpose on my Nokia 3650.
With regards to scaling up you would need some real interpolation algorithm, so this would be more tricky. I'm not sure why anyone wouln need to do this, though.
Otherwise, I completely concur with Michael that you should do the scaling before and package the scaled images with your app.
-Mirko
16 years ago
You could also use one of the MIDP ANT extensions, such as Antenna (http://antenna.sourceforge.net/). I have not used Eclipse, but I would imagine that it has good ANT support.
-Mirko
16 years ago
I agree with Sue that there are better places to look for performance improvements, such as the business logic. I also agree that it is well worth taking a small hit on the performance if this makes the development, debugging, and maintenance of the code easier.
Having said that, we did find a significant performance overhead when using JSTL as opposed to scriptlets. This is in JSP pages that are purely concerned with presentation, i.e. there is no business logic on these pages. Because of this, certain parts of our application that need to be highly scalable and performant will be unable to use JSTL for now, while other, less critical parts, can benefit from using JSTL.
The reason is most likely the amount of reflection that JSTL uses, which is still an expensive operation. Hopefully, newer versions of Java / JSP, or even more performant implementations of JSTL will get around these initial problems.
-Mirko
16 years ago
JSP
The main page contains the frame set that includes the URLs of the individual frames. On the main page, you can simply read the parameteters from the request and include them in the appropriate frame URL.
-Mirko
16 years ago
JSP
JAXP is an API that simplifies using (particularly instantiating) different XML parsers that implement the DOM or SAX APIs. It is not a parser itself but more of a framework that allows you to easily plug in the parser you want to use.
Xerces is a particular XML parser implementation, in this case from the Apache group. You can use it with JAXP, and you can also use other implementations, for example from IBM or SUN. Most parsers implement both SAX and DOM.
In your case, i.e. for parsing customer data and operating on it without having to modify the XML file, it sounds like you might want to use a SAX parser for efficiency purposes.
-Mirko

Originally posted by Mak Bhandari:
Jaxp and Xerces ? I have a xml file with say customer-name and customer-action that I need to read with a command line java program and then act upon the database to add/delete or modify the name based on action..
What are the components I need for reading this xml file and using the values in it as keys for my db lookup ?
Thanks !


Hi Andy and Dave, great to have you here! I read your book last year and liked it a lot (particularly the nice analogies to boiling frogs and such... ;-))
I actually bought it twice because I somehow lost the first copy when I took it with me on vacation. ;-)
-Mirko
I am not sure if I understand you correctly. It sounds like you probably want to look at the SAX API, which is generally supported along with DOM by XML parsers like Xerces, etc. Reading an XML file line by line does not make much sense, since whitespace between elements is not technically necessary, even if it makes it easier for a human to read the XML file. The same file could be written in a single line.
DOM parses the complete document into a tree that is stored in memory and which you can subsequently traverse, modify, and even write back. SAX on the other hand uses an event-based parser which allows you to define callbacks (by implementing a certain interface), that get called when a certain element is found in the XML file, e.g. a start tag, an end tag, etc.
I am not sure what you are trying to do with XSL in this context. Using XSL is quite different from parsing an XML file. You need an XSL engine like Xalan that you pass both an XML and an XSL file, and it converts this into the appropriate output resulting from applying the XSL stylesheet to the XML file.
-Mirko

Originally posted by al881:

I am getting heavily involved in servlet/xalan parsing.
I have the process of sending the data to a file, and also
re-directing back to the browser in HTML. But...
What I din't understand is how to conveniently point to an
xml and xsl file and then read it line by line. Is this possible
with the Xalan API ? Is it DOM I have to look at it?
Any help is appreciated.
Regards Al


Yes, I have seen XML used a lot here in the USA. In fact, in three different jobs in the last 2 1/2 years I have used XML at least to a certain extent. However, how XML is used varies widely. Some places use XML to transfer data between different applications, some use it for their document management and presentation systems, etc. Therefore it is not easy to tell you what you should learn. However, the basic concepts of XML are quite trivial, there really isn't much to it; it is simply a convenient, platform-independent and human-readable way to represent hierarchical data. I would advise you to take a look at the structure of XML documents as well as DTDs (and possibly XML Schema, but I haven't seen this used yet, and you can always learn it later if you do need it). If you are specifically looking for a Java job, you might also want to check out DOM and SAX parsers. You can probably skip XSLT for now and learn it if you need it later.
A good book to learn about XML (particularly in the context of Java, but it also covers general XML) is "Java and XML" from Brett McLaughlin. Reading the first few chapters should not take more than a day or two and give you a good overview.
-Mirko

Originally posted by Noor Mustafa:
Hi,
I am SCJP and going to USA on H1 visa. Somebody told me to learn the XML as it is going to be very popular in USA. Can anybody confirm me about this?
I am new to XML and I have 1/2 months before joing my new job in USA. How much time I need to learn XML and what is the practical assignment I should do?
Bye
Noor


Thanks, this looks just like the thing I was looking for!
-Mirko

Originally posted by Jim Baiter:
See if this link helps:
http://www.cs.colorado.edu/~gerry/xml/dtds.html


Thanks. This looks interesting, but unfortunately does not contain a lot of information about what I was looking for. I guess xmlpatterns.com will probably (hopefully) come back up again.
-Mirko

Originally posted by Jim Baiter:
I can't get it either. But this link has some info on XML patterns.
http://c2.com/cgi/wiki?XmlPattern


A friend of mine is trying to represent some recursive data in XML. Basically, a chapter can have some data as well as any number of sub-chapters, which in turn can have sub-sub-chapters, etc. Since the number of levels is not fixed, we don't want to use fixed elements like <chapter>, <subchapter>, etc. Ideally, the XML would look something like this:

Do you know if it is possible to represent this kind of recursive data in a DTD? Apparently the parser complained about the DTD that my friend used to constrain this XML document even though it looked fine.
I know there are alternative, possibly better ways to represent this data. I am just curious whether this is possible or not.
-Mirko
Does anybody know what happened to the XMLPatterns.com website? Someone had posted the link here a while ago, and it looked really interesting. However, I haven't been able to connect to the site today. Does anybody know if the URL has changed or something?
-Mirko