Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
What is the single best pretty-printing library for Java? I mean a library for printing formatted output with indentation, break hints, etc., not a library for beautifying/re-formatting Java code itself. Ideally, the library would "play nice" with System.out.println and friends.
For an idea of what I'm looking for, see OCaml's Format module, particularly Format.fprintf.
[UPDATE] I am not looking for a console windowing library. A pretty-printing library allows you to define methods for formatting arbitrary values such that indentation is preserved and line breaks are chosen at sensible locations. Such libraries exist for Haskell, Standard ML, OCaml, F#, and Scheme. The XTC library provides some of this functionality in xtc.tree.Printer, but it is not nearly as flexible as the libraries in other languages.
Is it jpplib?
Since you talk about boxes, break hints and so on I assume you mean to build a text-based windowing application. So I guess that you are looking for something similar to Ncurses but in Java. Maybe charva could help you.
You may also try javacurses.
According to Dr. Dobb's Code Talk it is cute.
I would say its still easier using Xalan + Sax, like in this example.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to know, if there are recommended libraries for decision trees.
For me best laguages atm are Java (easiest) and PHP (long term-usefulness).
I need them for a thesis at university and want to use the code later on as a webservice. The problem itself is not important and could be solved in various ways. But as a condition/constraint I have to use decision trees.
And I searched for quiet a while, but nothing really smashing turned up. So I decided to ask you.
As I said, Java would be easiest for me. And so would be Java-like languages (C++,...). PHP would be most useful as I want to use pieces of that code later on a server. Also frontend programming would be much easier ;-)
Other hosting-supported languages would be ok, too, but I'm not yet familiar with them.
The functionality doesn't need to be very complex as the problem isn't that based on decision trees. It would be nice if I could load the structure (kind of nodes, costs, units) via i.e. XML and than load a configuration-set with dedicated numbers for each node/transistion.
But I'm wondering, if it's maybe easier to implement that stuff myself.
I would be very pleased, if you can recommend something. (And for future investigators other languages wouldn't bother ;-) )
You should look into the Weka API: https://weka.wikispaces.com/Use+WEKA+in+your+Java+code
They have an abundance of decision tree algorithms: ID3, CART, ...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have to produce a report on all of my program's classes and methods and put it into a word document. Now, I really want to know if there is a software that will generate a text file documentation from my project files without inserting comments to source codes. I just want a list of all methods and classes in a text or ms word file, so that I can fill in the description on my own.
You can generate javadoc documentation just from uncommented source code. It will generate HTML, but there are probably converters to Word available.
However, I would strongly recommend that you add comments to your code instead. It's what Java programmers the world over expect; the documentation will show up in tooltips when you're writing new code calling into your current API; the tooling is geared up for it. Basically, try to work with the language conventions instead of fighting them.
EDIT: It sounds like you can use a doclet to generate the Word document for you. The MIF Doclet may be a good starting point, or PDFDoclet.
Generate the documentation using javadoc and then convert it to the required format. Look for different options here: https://www.oracle.com/java/technologies/javase/javadoc-faq.html#print.
Hope it helps.
There is a Maven plugin, "maven-site-plugin" that is useful for producing editable HTML docs from a Java project.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Is there a Java equivalent of Python's "construct" library? I want to write "structs" like so:
message = Struct("message",
UBInt8("protocol"),
UBInt16("length"),
MetaField("data", lambda ctx: ctx["length"])
)
It doesn't have to specifically be a library with some sort of abstraction using the Java language. I mean, it could be a "portable" format, with an API for parsing the documents. I guess this could work out with XML, but it would be be a lot more ugly.
I realize I could just inter-operate with Python, but I don't want to do that.
I've looked a lot around and all I could find was Ragel (www.complang.org/ragel), that can also produce Java code.
It looked too complex for me so I've started some work to port Construct to Java.
I suspect it would be easier to make something like that in Scala, Groovy or JavaScript.
Construct on GitHub: https://github.com/MostAwesomeDude/construct
java construct: https://github.com/ZiglioNZ/construct
I've spent a couple of days on it, mostly looking for equivalents of python's expressive classes.
The most useful java classes I've found are: java.util.Scanner, java.util.Formatter and java.nio.ByteBuffer.
It's a big task so I want to focus on something small like creating simple parsers and formatters for ByteBuffers.
[Update]
I've ported enough code to parse and build some of the protocols that come with Python Construct, such as ethernet, arp and ipv4. Check it out at https://github.com/ZiglioNZ/construct
[Update: new Release]
Java Construct 1.1.2 is now available, see release notes.
You can use DataInput/DataOutput (and their implementations) to convert any set of values from/to a set of bytes. This doesn't give you an object where you can use names to access the individual fields, though - you would have to create such yourself.
It depends a bit on what you want to do - do you have a fixed data format to send/receive on wire, or does this vary from time to time?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm writing a source-code editor in Java (for Java source code), and I'd like to add simple syntax highlighting (distinctive coloring for keywords would suffice). Any suggestions?
Something like JSyntaxPane, perhaps?
A very simple to use and extend JEditorKit that supports few languages. The main goal is to make it easy to have nice looking Java Swing Editors with support for Syntax Highlighting.
What about RSyntaxTextArea? It uses a modified BSD license.
You first should think about using a common parser to create an AST (abstract syntax tree) from the sources. There are some tools around, first I find googling the internet was javaparser. It looks like this parser also records line numbers and columns, so the AST from javaparser can be a nice model for the editor.
Just process the tree, define colors for the AST node types and print it.
Might want to look at an existing editor (Notepad++ for example - http://notepad-plus.sourceforge.net/uk/site.htm) and see how user-defined syntax highlighting is done (oneo of the plugins to check - Gmod 10 Lua Syntax Highlighter). I'd wager that the Java (and other languages) are done similarly...
You should check Google's prettify.js out. Some pretty neat tricks in there, and you might get a more robust feel for syntax highlighting.
http://www.neathighlighter.com/ is a good JavaScript highlighter
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I would like to write a Java terminal application that does screen manipulation. Are there any good libraries out there that allow you to manipulate the screen like curses in the *nix/C world?
Minimal features I'm looking for are windowing and user input support.
In feature-speak, I'd like to have a region of the terminal where some data is regularly updated while (at the same time) the user can enter commands/text in some other part of the screen.
Lanterna
I found the Lanterna library recently. Haven't had the opportunity to use it yet but it looks like a more up-to-date alternative to the others.
There is Charva, which links to native code but has an api based on Swing.
The screenshots show lots of text windows, so that looks useful.
Haven't used it myself, but Java Curses Library sounds like what you want.
Here is a way to call the ncurses lib using JNI. I tested this and it works.
As of 2013, the closest I can find is Blacken.
Blacken is not a curses library per-se. It moves away from the terminal, and instead, renders it's own "console window." This has the disadvantage of not looking "console-like." Instead, you get full (arbitrary) colour support, and a curses-like API (in addition to their main API).
You can also set the font to Mono for fixed-width characters.