sentence
stringlengths 1
1.38k
| label
stringclasses 3
values |
---|---|
What Java implemenations exists?
|
o
|
Pros and cons for them?
|
o
|
I'm aware of Lucene, any other solution or Lucene is best?
|
o
|
I found these, anyone has experience with them?
|
o
|
URL_http://www.dcs.shef.ac.uk/~sam/simmetrics.html [SimMetrics] URL_http://ngramj.sourceforge.net/ [NGramJ] .
|
o
|
Commons Lang has an implementation of URL_http://commons.apache.org/lang/apido cs/org/apache/commons/lang3/StringUtils.html#getLevenshteinDistance%28java.lan g.CharSequence,%20java.lang.CharSequence%29 [Levenshtein-distance] .
|
o
|
Commons Codec has an implementation of URL_http://commons.apache.org/proper /commons-codec/apidocs/org/apache/commons/codec/language/Soundex.html [soundex] and URL_http://commons.apache.org/proper/commons- codec/apidocs/org/apache/commons/codec/language/Metaphone.html [metaphone] .
|
o
|
SimMetrics is probably what you need: URL_http://sourceforge.net/projects/simmetrics/ [ URL_http://sourceforge.net/projects/simmetrics/ ] It has several algorithms for calculating various flavours of edit-distance.
|
o
|
Lucene is a very powerful full-text search engine, but FT search isn't exactly the same thing as fuzzy string matching (eg.
|
p
|
given a list of strings find me the one that is most similar to some candidate string).
|
o
|
simmetrics looks to be GPL v2, however, so not compatible with commercially developed software.
|
o
|
To Lucene I would add SOLR URL_http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters [ URL_http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters ] .
|
o
|
URL_http://lucene.apache.org/ [Apache-Lucene] is the only way, I think.
|
o
|
I don't know any better search lib.
|
o
|
Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java.
|
p
|
It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.
|
n
|
You can try bitap.
|
o
|
I was playing with bitap written in ANSI C and it was pretty fast there is java implementation in URL_http://www.crosswire.org [ URL_http://www.crosswire.org ] .
|
p
|
File Manipulation libraries.
|
o
|
I have a project which I need to manipulate files.
|
o
|
things like: create new file by a defined structure(header,data,trail).
|
o
|
and then I need to things like search/validate/create/read.
|
o
|
basically I want to map the files to objects and vise versa.
|
o
|
(I am willing to map them to objects coz it will be much more comfortable for me to manipulate the fields inside each file via object) I wonder if any of you deal with such things before?
|
o
|
and maybe could recommend me on libraries which could easy my work.
|
p
|
thanks,ray.
|
o
|
You may want to look at serialization and de-serialization .
|
o
|
serialization wont help me here.
|
o
|
I want my own structure in the file since some1 else need to read it by a specific structure.
|
o
|
serialization wont map the object to the file in the way I want it.
|
o
|
If you want custom mapping, you need custom coding.
|
o
|
I would suggest you look at DataInputStream and DataOutputStream.
|
o
|
Using these you can control the header, records and footer in any binary format you want.
|
o
|
I suggest you generate your serialization (if you need to have the afstest possible speed) or use reflections to do the translation.
|
o
|
Just using reflection is pretty fast and much simpler than generating code.
|
p
|
;) .
|
o
|
but Serialization will make it binary.
|
o
|
I want it to remine text.
|
o
|
In that case I would serialize as text.
|
o
|
;) With the built in Serialization you have no choice, but if you do it yourself, you can make it anything you want.
|
o
|
For example, all my objects serialize and deserialize in CSV format i.e.
|
o
|
you can read it in excel.
|
p
|
;) You could use XML or JSon with XStream.
|
o
|
If you have a defined file layout with different content you should consider to use a template engine like URL_http://freemarker.sourceforge.net/ [FreeMarker] or URL_http://velocity.apache.org/ [Velocity] to generate your files.You can define templates here which will be filled with your dynamic content which you have to provide.
|
o
|
Definitly better than to use CODETERM1 (I mean hard code your template text).
|
n
|
A library which helps for basic file manipulation is URL_http://commons.apache.org/io/ [Apache-Commons-IO] .
|
o
|
If you realy want to map your files to objects than it would be a Serialization/Deserialization as Angelom mentions.
|
o
|
Many libraries help you to do this but the file format is fixed: JSON: URL_http://jackson.codehaus.org/ [Jackson] , URL_http://code.google.com/p/google-gson/ [GSON] XML: URL_http://jaxb.java.net/ [JAXB] .
|
o
|
Are those libraries able to sanely produce binary output?
|
o
|
As far as I know they are focused on text-based output formats.
|
p
|
@Joachim The libraries work with text output (that is what _rayman_ needs if I understand it correct).
|
p
|
He doesn't mention if he wants text or binary, actually but from what I understand he want's the library to help him with parsing/reading as well.
|
p
|
And that's where those template libraries fall flat.
|
o
|
He want's text (see comment in answer from Lawrey).
|
o
|
Using templates to generate his files will definitly help - particularly if his files contains lot text around the object info.
|
o
|
You are right - reading is not included - thus I only mentioned generation of his files.
|
o
|
I tried to give help and some ideas - I thought that would be requested.
|
o
|
Unfortunately I do not know the library he want's.
|
n
|
If you want the file read by 3rd party as well, how about using some popular existing exchange format such as CSV or XML?
|
o
|
XML is fully supported in standard library.
|
p
|
There's plenty of CSV libraries out there, including URL_http://commons.apache.org/sandbox/csv/ [Apache- Commons-CSV] .
|
o
|
I am not required to use XML format.
|
o
|
only a specific format which is defined by the company.
|
o
|
that format is TXT and I wanted to convert all those files to objects.. something like ORM.
|
o
|
In the end I Found a ORM framework called Canyon which mapping Files to Objects.
|
o
|
but still had difficulties.
|
n
|
so I have implemented my own ORM file to objects and vise versa.
|
o
|
java.net versus java.nio.
|
o
|
At what point is it better to switch from java.net to java.nio?
|
o
|
.net (not the Microsoft entity) is easier to understand and more familiar, while nio is scalable, and comes with some extra nifty features.
|
p
|
Specifically, I need to make a choice for this situation: We have one control center managing hardware at several remote sites (each site with one computer managing multiple hardware units (a transceiver, TNC, and rotator)).
|
o
|
My idea was to have write a sever app on each machine that acts as a gateway from the control center to the radio hardware, with one socket for each unit.
|
o
|
From my understanding, NIO is meant for one server, many clients, but what I'm thinking of is one client, many servers.
|
o
|
I suppose a third option is to use MINA, but I'm not sure if that's throwing too much at a simple problem.
|
p
|
Each remote server will have up to 8 connections, all from the same client (to control all the hardware, and separate TX/RX sockets).
|
o
|
The single client will want to connect to several servers at once, though.
|
o
|
Instead of putting each server on different ports, is it possible to use channel selectors on the client side, or is it better to go multi-threaded io on the client side of things and configure the servers differently?
|
o
|
Actually, since the remote machines serve only to interact with other hardware, would RMI or IDL/CORBA be a better solution?
|
o
|
Really, I just want to be able to send commands and receive telemetry from the hardware, and not have to make up some application layer protocol to do it.
|
o
|
Avoid NIO unless you have a good reason to use it.
|
p
|
URL_http://blog.uncommons.org/2008/09/03/avoid-nio-get-better-throughput/ [It's-not-much-fun-and-may-not-be-as-beneficial-as-you-would-think] .
|
o
|
You may get better scalability once you are dealing with tens of thousands of connections, but at lower numbers you'll probably get better throughput with blocking IO.
|
n
|
As always though, make your own measurements before committing to something you might regret.
|
n
|
Something else to consider is that if you want to use SSL, NIO makes it extremely painful.
|
o
|
Thanks for the remark about SSL, this will probably drive my decision.
|
o
|
Scalability will probably drive your choice of package.
|
o
|
java.net will require one thread per socket.
|
o
|
Coding it will be significantly easier.
|
o
|
java.nio is much more efficient, but can be hairy to code around.
|
n
|
I would ask yourself how many connections you expect to be handling.
|
o
|
If it's relatively few (say, < 100), I'd go with java.net.
|
o
|
With a modern 64-bit OS you can have hundreds of thousands of threads.
|
o
|
Sure, but that's not necessarily the most scalable way to architect an application.
|
p
|
But a socket is much more resource intensive than a thread...
|
o
|
The question is not one of more sockets versus more threads.
|
o
|
It's how many threads per socket.
|
o
|
@Zombies in what sense?
|
o
|
Beyond the fact that a thread costs you half a megabyte and a socket costs you a few dozen kilobytes they are barely comparable at all.
|
o
|
The number of connections you're talking about tells me you should use java.net.
|
o
|
Really, there's no reason to complexify your task with non-blocking I/O.
|
o
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.