This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!

Tim Moores

Saloon Keeper
+ Follow
since Sep 21, 2011
UK / DE
Cows and Likes
Cows
Total received
143
In last 30 days
0
Total given
12
Likes
Total received
991
Received in last 30 days
18
Total given
424
Given in last 30 days
9
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Moores

#1: DO you want to do this manually or programmatically? If the former, you can use a tool like Google's Files app. If the latter, Android supports the java.io.File class which lets you rename files using its renameTo method.

#2: It's hard to say whether the app would be considered commercial, although your usage of "his clients" indicates that it might be. But your work on it would be commercial development, if that's what you're wondering about.
1 day ago
Also, the MIME type should reflect the image type - application/octet-stream  is not correct for images.
1 day ago
Searching for "jackson library tutorial" results in many hits - have you tried any of those? Some look quite promising.
2 days ago
This sounds like a problem the hosting company has nothing to do with. On a private JVM, you are responsible for deployments and keeping track of files; I'm surprised they even went so far as to look into whether or not some particular file is present. They wold have to dig quite deep to even know whether some form submission goes to a servlet or not.

But you haven't provided any information that would allow us to venture a guess what might be going on. That information would include file and directory information, wbeb app setup, URLs etc. etc.
3 days ago
JSP
Spaces. But it added empty lines even when there was no leading white space.
Thanks Stephan! This does what I was trying to accomplish:


Without "display:block" it wouldn't work in Chrome, although Firefox was fine. "white-space:pre" would add empty lines, so I used nowrap instead. And "overflow: auto" rather than scroll suppresses the scrollbars when they're not necessary. Neat!
This is part of a CMS where the page contents aren't all generated in the JSP, but partly originate from another source - so it's not all that easy to handle all CODE blocks with JavaScript. Adding a class to each CODE block wouldn't be a big deal, but handling all CODE blocks in JavaScript would be. That's why I was hoping for a solution using only CSS (maybe along with some JSP changes).

Hoping for a simple solution, I tried to set the CODE block's visibility to hidden, but it's still considered for calculating the page width.
Ok, that doesn't describe the use case (which is the WHY of what you intend to do), but it does confirm that I understood correctly. That sounds creepy - would the user know that your app intends to collect this information? TellTheDetails about the use case.

Since you didn't mention the custom text processing idea I mentioned, may we assume that you looked at it, and concluded that it does not meet your needs?
6 days ago
How do I access the XYZ file format in java ?

A large database of file extensions be found at www.file-extensions.org and dotwhat.net

And if you don't know what type a given file is, they there are various way to determine it programmatically: http://www.rgagnon.com/javadetails/java-0487.html

An interesting article about Microsoft's binary file formats, especially DOC and XLS, is Why are the Microsoft Office file formats so complicated? (And some workarounds) It also mentions some alternatives to dealing with those formats directly.

Access
  • Jackcess - library to read and write MDB files
  • HXTT Access - commercial pure Java JDBC driver for MS Access


  • CHM
  • JChm - library to read CHM files


  • Excel
  • Apache Commons CSV, Ostermiller Utils, CSVObjects, CSVBeans, opencsv, Java CSV, Super CSV - libraries to read and write CSV files. CSV is not as easy to read and write as it first looks - once all the special cases are considered, one might as well use a library.
  • POI - library to read and write XLS and XLSX files
  • jXLS - library for writing XLS files based on templates
  • Obba works with Excel spreadsheets on Windows
  • OpenXLS - "OpenXLS is the open source version of ExtenXLS - a Java spreadsheet SDK that allows you to read, modify and create Java Excel spreadsheets from your Java applications."


  • Gedcom
  • GDBI
  • gedcom4j
  • GenJ


  • HDF (Hierarchical Data Format)
  • Java products by the HDF Group


  • Image and movie files
  • ImageJ - Java image processing application and library that has plugins for lots of image file formats
  • JIMI - library to read and write BMP, CUR, GIF, ICO, JPEG, PICT, PNG, PSD, Sun Raster, TGA, TIFF, XBM and XPM. There's a plugin for using JIMI with ImageJ, which also includes a couple of JIMI patches.
  • GIF write, TIFF, RAW, PNM and JPEG2000 read/write support for ImageIO: JAI Image I/O Tools
  • TwelveMonkeys| - additions for the ImageIO API
  • MP4 parser
  • Apache Commons Imaging is a library that reads and writes a variety of image formats, including fast parsing of image info (size, color space, ICC profile, etc.) and metadata.


  • INI
  • ini4j "is a simple Java API for handling configuration files in Windows .ini format."


  • Matlab
  • JMatIO - Matlab's MAT-file I/O in JAVA


  • mbox
  • Mbox-Store works with JavaMail, but requires to be built using C
  • mstor also works with JavaMail


  • OpenDocument (ODF)
  • ODFDOM is a Java library for accessing ODF files.
  • jDocument.org has an open-source library for accessing all Open Document file types.
  • Obba works with OpenOffice spreadsheets
  • Office2FO converts ODF documents to XSL-FO documents, making possible further transformations (like conversion to PDF using FOP)


  • Office Open XML
  • These are the XML-based Microsoft Office formats, standardized by ECMA, but implemented by Microsoft in a non-compliant way
  • docx4j - create and edit docx documents using a JAXB content model matching the WordML schema
  • Apache POI implements these formats.


  • OpenOffice Java API
  • OpenOffice can read a number of file formats, and makes them accessible through its API. A starting point might be this article and of course the OO developer site
  • Some introductory information about the OO file format can be found here
  • JODConverter is a Java library that uses the OO Java API to perform document conversions between any formats supported by OO


  • Outlook / PST
  • The Apache POI project developed some code that can read the texual contents of Outlook's MSG files. This page talks about that.
  • Xena can convert multiple file formats -including MSG- to XML. Either the result of that conversion, or Xena's source code, may be helpful.
  • JPST can read and extract PST files.
  • java-libpst is a pure Java library that can access 64bit PST files.


  • PDF
  • PDF is a hard to read format. The best one can do is try to extract the text contained in a PDF file.
  • OpenODF is a library to create PDFs built on top of iText2, but still licensed under a business-friendly license. code example - more examples - javadocs
  • PDFBox - library that can create, merge, split and print PDFs, extract text, create images from PDFs, encrypt/decrypt PDFs, fill in PDF forms and more. See PDFBoxExample for example code of how to use it to create a PDF.
  • FOP - library to create PDFs (and other formats) from XML by using XSL-FO transformations
  • FlyingSaucer - library to convert CSS-styled XHTML to PDF
  • JPedal - library for viewing and printing PDFs, can also extract text (how to print PDFs); commercial (the LGPL version provides PDF viewing only)
  • PDFxStream - commercial library to extract text from PDFs
  • PDF Renderer is a more up-to-date PDF viewer that renders using Java2D. Download, Examples, Printing PDFs
  • ICEPdf is another library that can render PDFs.
  • Qoppa offers numerous libraries for PDF-related tasks
  • Aspose.Pdf for Java is a commercial library for reading and writing PDFs
  • jPod is a rich PDF manipulation and rendering framework
  • OrsonPDF is a fast, lightweight PDF generator for the Java platform


  • PowerPoint

  • The Apache POI project developed some code that can open and (to a limited extent) edit PPT files. This page talks about it.


  • Project
  • The MPXJ library can work with several Project file formats.


  • QIF (used by Microsoft Money and Quicken)
  • Buddi and Eurobudget are Java applications that can import and export QIF files (and thus contain code you may be able to use in your application). Both are licensed under the GPL.


  • RTF
  • jRTF can create RTFs
  • iText 2 can create RTFs: jar file, javadocs
  • JavaCC - is a lexer/parser for which an RTF grammar is available. From that an RTF reader can be constructed.


  • Visio
  • The Apache POI project developed some code that can read Visio files. This page talks about that.


  • Word

  • POI - library to read and write DOC and DOCX files. It can also be used for extracting the text of a document.
  • WordApi.exe is native Windows component with a Java interface, which lets you create Word documents, and alter word templates. Some impressions about it can be found here.
  • Java2Word - library to create Word documents, especially reports, on the fly.




  • Something else?
    If you encounter an obscure format for which no library is available, it may be feasible to create a reader for it if you have a file format description (which may be available on Wotsit, see link above). Several libraries, so-called lexers and parsers, are available that help in creating a reader, especially if the file format is ASCII, and not binary. You will need knowledge of regular expressions, though. Some file formats that have been tackled using this approach include RTF, CSV, HPGL and PBM/PGM/PPM. Lexers are easier to start with, but parsers can do more of the work for you. All these have ready-to-use examples on their web sites.

  • Lexers: JFlex (introductory article in the JavaRanch Journal)
  • Parsers: Antlr, SableCC, JavaCC



  • CategoryFaq CategoryHowTo
    6 days ago
    I'm aware of two options, Mbox-Store and mstor, both of which work with JavaMail. The former requires you to build it using C, though. I haven't used either, so can't say which one might be easier to use.
    6 days ago
    I'm not sure I'm understanding correctly - are you saying that the app is supposed to be monitoring all browser activity for text that the user is highlighting? That sounds nefarious - please elaborate what the use case is.

    If you merely want the user to be able to use your app to act on highlighted text, you can implement it using custom text processing actions: https://medium.com/androiddevelopers/custom-text-selection-actions-with-action-process-text-191f792d2999
    6 days ago
    What does the code do with those classes? I wouldn't expect there to be a one-to-one correspondence to any Tomcat classes.
    6 days ago
    That looks like an exercise you should be doing in order to learn something. So: what do you have so far, and where are you stuck making progress? If you haven't started, what ideas have you had?
    1 week ago