 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- Error Code / Number ?Hi Group
is there any way to get the Error Code or Number related to the error ?
(Say within catch bolck)
Is java support that type of thing ?
What can i get from hashCode ?
Dishan
- 4
- [OT] Java 7 features: PLEASE STOP IT! All of you.This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Twisted schreef:
> On Aug 2, 8:29 am, Lasse Reichstein Nielsen <email***@***.com> wrote:
> [overly verbose off-topic commentary]
Subject says it all.
H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
- 4
- change jscrollpane bar?hi,
is it possible to change the scrollbar in a jscrollpane? i wanted to
replace it with an image, is this possible? i just want to change it's
look, i've see some skins but not exactly what i wanted, and i'm not
sure how to make my own skin. if it's possible can someone tell me
how, or point me to a place that shows how to create look and feel
skins for java applications?
Thank you.
- 4
- Creating a (META) FAQ for c.l.j.g? (was: Re: New to the group)"S. Balk" <email***@***.com> writes:
> There is no FAQ for this newsgroup, maybe not that bad to have one...
You think so? There is so much good stuff out there that I don't think
a full FAQ is needed. What is maybe needed is some kind of meta FAQ
pointing to the most interesting stuff (the stuff which we always refer
newbies to).
What is the group's opinion about this? I would volunteer to create
such a meta FAQ if there is sufficient demand. It would be based on the
list of resources I post from time to time in response to newbie
questions.
/Thomas
- 7
- Any way to turn off array bounds checking? (Matrix multiplication is so slow!)
I am just starting to learn Java J2RE 5.0. I coded the matrix library
below and found that the array accessing is really slow since each
access is checked:
http://f1.pg.briefcase.yahoo.com/bc/agascoig/vwp2?.tok=bccV1CVBYRRfg_eF&.dir=/Guest&.dnm=ComplexDoubleMatrixJava.zip&.src=bc
It appears that with gcj and a -f switch I can turn off the array
bounds checking.
Will a JVM ever be smart enough to know that if the array bound is a
constant variable within a loop, that it can multiply and check the
final array index is within bounds before doing the loop, and then only
have to check once? It seems stupid to me that a general Matrix isn't
included in the Java class libraries. Anybody have a better general
Matrix library in Java?
Also, a newbie observation, that Double (capital D) didn't get passed
as a reference. Why not? This seems dumb to me, as all other objects
seem to get passed by reference.
- 7
- Java Hotspot VM Client 1.4.2.xxxx ???hi,
i've installed JDK 1.4.2, then I installed netbeans 5.0, and have
netbeans use this JDK version (I've uninstalled previous JDK versions
installed on my machine prior to installing 1.4.2). now, netbeans says:
"broken platform 'Java_Hotspot_TM__Client_VM_1.4.2_08-b03'...
From Sun's site, Java Hotspot is included in JDK 1.4.2, but where can
I find the jar file for it (i don't even know the name of the jar
file)?
your help is appreciated.
crash.test.dummy
- 9
- Is the design of 'ArrayList' good ?
Occasionally I think that the design of 'ArrayList' is not good.
Because ...
The access modifier of 'E[] elementData' in 'ArrayList'
is 'private'. That is, Java do not allow a programmer
to access 'E[] elementData'.
Therefore, he will write the following statements to
sort 'ArrayList'.
<example>
List<String> strList = new ArrayList<String>();
Collections.sort(strList); // <- #1
</example>
By the way, the source of #1 is as follows.
<Quote>
public static <T extends Comparable<? super T>> void sort(List<T> list) {
Object[] a = list.toArray(); // <- #2
Arrays.sort(a); // <- #3
ListIterator<T> i = list.listIterator();
for (int j=0; j<a.length; j++) { // <- #4
i.next();
i.set((T)a[j]);
}
}
</Quote>
If 'strList' is large array, #3 is merge sort.
Merge sort requires 2 * M when M is the memory
size of 'strList'.
Because the memory size of 'a' in #2 is M,
'Collections.sort' requires 3 * M and has to execute #4.
It seems inefficient. (note that 'strList' is large array)
If the access modifier of 'E[] elementData' is 'protected',
he can sort 'strList' with 2 * M and without #4.
What is your comment ?
Thanks.
- 9
- animation in custom table cell rendererDoes anybody know how to make animated gifs work in cell renderer?
I'm trying to use JLabel as base component with animated gif as image.
It works perfectly anywere except JTable...
- 9
- change money program - newbie questionHi,
I would appreciate any help I can get with this. The program accepts a
range of numbers (dollors) and provides a combination of the least
amount of bills and coins needed to make change for the input. This
program works for most numbers but there is a bug. try 19.99 and you
will see that the change is a penny short. Thanks for your help.
-R
public class MoneyDriver {
public static void main(String[] args) {
if(args.length != 1){
System.out.println("Please suppy only one argument on the command
line");
return;
}
double dblAmount = Double.parseDouble(args[0]);
Money m = new Money();
m.changeMoney(dblAmount);
}
}
public class Money {
Money (){
}
public void changeMoney(double dblAmount){
if((dblAmount < 0.01) || dblAmount > 9999.99){
System.out.println("The number you entered is out of range. Please
enter a number between 0.01 and 9999.99");
return;
}
double [] dblMoneyDenomination = {100.00, 50.00, 20.00, 10.00, 5.00,
1.00, 0.25, 0.10, 0.05, 0.01};
int count = 0;
for(int i = 0; i < dblMoneyDenomination.length; i++){
while((dblAmount > dblMoneyDenomination[i])){
++count;
dblAmount = dblAmount - dblMoneyDenomination[i];
}
if(count != 0){
System.out.println("Change is " + count + " " +
dblMoneyDenomination[i] + " bill(s)");
}
/* if(i + 1 == dblMoneyDenomination.length){
System.out.println("Change is " + ++count + " " +
dblMoneyDenomination[i] + " bill(s)");
}
*/
count = 0;
}
}
}
- 11
- 11
- Question for Java GurusOn Tue, 18 May 2004, email***@***.com wrote:
> I suspect that the difference lies in how fundamental we think
> those concepts are. I think that the classpath environment
> variable is a rather peculiar aspect of the JDK command-line
> tools. I much prefer, say, Eclipse 3.0, where I can choose
> project properties and just check all of the user-defined
> libraries that my project uses and expect everything to work,
> without dealing with questions of whether I can set an
> environment variable in one place or another, or oops I only
> set it in this shell so it doesn't appear in other shells, etc.
> I think it's clearly possible to develop Java software without
> worrying one bit about environment variables. So I question
> why understanding the CLASSPATH environment variable (or
> command-line option, etc) would be a necessary prerequisite to
> learning programming in Java.
This is analogous to java programmers thinking they can code
database applications without understanding the underlying
database. Oh, I'm sorry, the JVM is the only world one needs to
know.
--
Galen Boyer
- 14
- got packages working/////////command line///////////////
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\>javac @comp
C:\>java -classpath
.;C:\java\classes\org\w3c\tidy\Tidy.jar;C:\java\classes\
atreides.jtidy.Tid
yTest
C:\>type comp
-d C:\java\classes\
-g
-sourcepath C:\java\sources\
-classpath .;C:\java\classes\;C:\java\classes\org\w3c\tidy\Tidy.jar
C:\java\sources\atreides\jtidy\TidyTest.java
C:\>type C:\java\sources\atreides\jtidy\TidyTest.java
// adapted from source available at:
//
<http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153>
package atreides.jtidy;
import java.io.IOException;
import java.net.URL;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.FileWriter;
import org.w3c.tidy.Tidy;
public class TidyTest implements Runnable {
private String url;
private String outFileName;
private String errOutFileName;
private boolean xmlOut;
public TidyTest(String url, String outFileName, String
errOutFileName,
boolean xmlOut) {
this.url = url;
this.outFileName = outFileName;
this.errOutFileName = errOutFileName;
this.xmlOut = xmlOut;
}//tidyTest
public void run() {
URL u;
BufferedInputStream in;
FileOutputStream out;
Tidy tidy = new Tidy();
tidy.setXmlOut(xmlOut);
try {
tidy.setErrout(new PrintWriter(new
FileWriter(errOutFileName),
true));
u = new URL(url);
in = new BufferedInputStream(u.openStream());
out = new FileOutputStream(outFileName);
tidy.parse(in, out);
}//try
catch ( IOException e ) {
System.out.println( this.toString() + e.toString() );
}//catch
}//run
public static void main( String[] args ) {
String url = "http://www.google.com/";
String output = "output.txt"; //specify path?
String errorLog = "errorLog.txt"; //specify path?
TidyTest t1 = new TidyTest(url,output,errorLog,true);
Thread th1 = new Thread(t1);
th1.start();
}//main
}//TidyTest
C:\>
- 14
- How to process 1000 request using ThreadI have one problem. What is the optimal approach for handling 1000
request by using thread.there are 2 scenario. 1 create 1000 thread and
execute the program 2. create 10 thread and pool 1000 requests by some
scheduling algorithm.
- 14
- Open Source OCR for Java/C++I found a lot of open source ocr projects from the net. But none of
them was usable.
Could anyone recommend an open source OCR programs to me?
For Java or Windows VC++ or Linux G++
Thanks
Jack
- 15
- Can't compile simple Java code1 class DecimalToBinary{
2 public static void main(String[] y){
3 int dec = new Integer(y[0]).intValue();
4 if (dec/32 = 0)
5 System.out.println(0 + (dec % 32) / 16);
6 else System.out.println(1);
}}
When I try to compile the above code I get an error on line 4:
Error: unexpected type
required: variable
found : value
What is wrong??
Mvh
Johs
|
| Author |
Message |
Chris

|
Posted: 2007-11-19 3:45:00 |
Top |
java-programmer, Java text compression
What's the fastest way to compress/decompress text?
We're doing that over really large datasets in our app. We're currently
converting char arrays to byte arrays using our own UTF-8 conversion
code, and then compressing the bytes using java.util.zip. The code is
pretty old.
I don't like this two-step process, and the profiler shows that this is
a bottleneck in our app.
Is anyone aware of any code that compresses chars directly? Perhaps a
third-party library that does it faster?
In our particular situation, decompression speed is a lot more important
than compression speed.
|
| |
|
| |
 |
Joshua Cranmer

|
Posted: 2007-11-19 4:14:00 |
Top |
java-programmer >> Java text compression
Chris wrote:
> What's the fastest way to compress/decompress text?
I know of a compression method that can compress in constant time: it
replaces the entire text with a single `0' (hey, it's lossy!). To what
degree of compression do you need?
> We're doing that over really large datasets in our app. We're currently
> converting char arrays to byte arrays using our own UTF-8 conversion
> code, and then compressing the bytes using java.util.zip. The code is
> pretty old.
>
> I don't like this two-step process, and the profiler shows that this is
> a bottleneck in our app.
Questions:
1. From whence are the char arrays coming?
2. Where are the byte arrays going?
3. Which part of the process is the bottleneck? The UTF-8 conversion, or
the compression?
> Is anyone aware of any code that compresses chars directly? Perhaps a
> third-party library that does it faster?
>
> In our particular situation, decompression speed is a lot more important
> than compression speed.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
|
| |
|
| |
 |
Eric Sosman

|
Posted: 2007-11-19 4:16:00 |
Top |
java-programmer >> Java text compression
Chris wrote:
> What's the fastest way to compress/decompress text?
If you're really interested in "the fastest way" to the
exclusion of all other concerns, then don't compress at all.
Bingo! Problem solved!
You might be happier with a compression scheme that did
a little better at reducing the size of the data, but now you
can't get a sensible answer until you describe the trade-offs
you're willing to make. For example, if you were offered a
compression scheme that ran ten percent faster than your current
method but emitted fifteen percent more data, would you take it
or reject it?
> We're doing that over really large datasets in our app. We're currently
> converting char arrays to byte arrays using our own UTF-8 conversion
> code, and then compressing the bytes using java.util.zip. The code is
> pretty old.
>
> I don't like this two-step process, and the profiler shows that this is
> a bottleneck in our app.
>
> Is anyone aware of any code that compresses chars directly? Perhaps a
> third-party library that does it faster?
How badly do you need your own idiosyncratic UTF-8 conversion?
If you can use standard methods, consider wrapping the compressed
streams, somewhat like
Writer w = new OutputStreamWriter(
new GZIPOutputStream(...));
w.write("Hello, world!");
BufferedReader r = new BufferedReader(
new InputStreamReader(
new GZIPInputStream(...)));
String s = r.readLine();
You'll have to make your own assessment of the speeds and the
degree of compression.
> In our particular situation, decompression speed is a lot more important
> than compression speed.
"You'll have to make your own assessment ..."
--
Eric Sosman
email***@***.com
|
| |
|
| |
 |
Roedy Green

|
Posted: 2007-11-19 4:42:00 |
Top |
java-programmer >> Java text compression
On Sun, 18 Nov 2007 13:44:44 -0600, Chris <email***@***.com>
wrote, quoted or indirectly quoted someone who said :
>What's the fastest way to compress/decompress text?
You can try GZIP. See http://mindprod.com/applet/fileio.html
for sample code. It is simpler. It might be faster.
Note that zip has a compression number where you can trade off speed
for compression.
If you have a limited vocabulary, you might try just looking up words
and converting to 16-bit index numbers.
Each number is a word + a trailing space.
see http://mindprod.com/project/supercompressor.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
| |
|
| |
 |
Arne Vajh鴍

|
Posted: 2007-11-19 5:25:00 |
Top |
java-programmer >> Java text compression
Roedy Green wrote:
> On Sun, 18 Nov 2007 13:44:44 -0600, Chris <email***@***.com>
>> What's the fastest way to compress/decompress text?
Not quoted:
#We're currently converting char arrays to byte arrays using our own
#UTF-8 conversion code, and then compressing the bytes using
#java.util.zip.
> You can try GZIP. See http://mindprod.com/applet/fileio.html
> for sample code. It is simpler. It might be faster.
ZIP and GZIP uses the same basic algorithm - the difference
is just in the packaging where zip supports multiple files and
store file meta data while gzip does not.
Arne
|
| |
|
| |
 |
Robert Klemme

|
Posted: 2007-11-19 5:37:00 |
Top |
java-programmer >> Java text compression
On 18.11.2007 21:16, Eric Sosman wrote:
> Chris wrote:
>> What's the fastest way to compress/decompress text?
>
> If you're really interested in "the fastest way" to the
> exclusion of all other concerns, then don't compress at all.
> Bingo! Problem solved!
>
> You might be happier with a compression scheme that did
> a little better at reducing the size of the data, but now you
> can't get a sensible answer until you describe the trade-offs
> you're willing to make. For example, if you were offered a
> compression scheme that ran ten percent faster than your current
> method but emitted fifteen percent more data, would you take it
> or reject it?
Bonus question for OP: what is the size of data sets and how are they
used? Especially, where are they stored?
>> We're doing that over really large datasets in our app. We're
>> currently converting char arrays to byte arrays using our own UTF-8
>> conversion code, and then compressing the bytes using java.util.zip.
>> The code is pretty old.
>>
>> I don't like this two-step process, and the profiler shows that this
>> is a bottleneck in our app.
>>
>> Is anyone aware of any code that compresses chars directly? Perhaps a
>> third-party library that does it faster?
>
> How badly do you need your own idiosyncratic UTF-8 conversion?
> If you can use standard methods, consider wrapping the compressed
> streams, somewhat like
>
> Writer w = new OutputStreamWriter(
> new GZIPOutputStream(...));
Minor detail: The encoding is missing, so in this case it would rather be
new OutputStreamWriter(new GZIPOutputstream(...), "UTF-8")
> w.write("Hello, world!");
>
> BufferedReader r = new BufferedReader(
> new InputStreamReader(
> new GZIPInputStream(...)));
> String s = r.readLine();
>
> You'll have to make your own assessment of the speeds and the
> degree of compression.
This is the solution I was going to suggest as well. If the custom
encoding yields the same results as Java's built in UTF-8 then I would
immediately switch to this approach of stacked streams. If the custom
encoding yields slightly different results I am sure you can plug in the
custom encoding into the standard Java io and nio classes with a little
effort.
If data is to be stored in a BLOB via JDBC you can even extend this
approach to directly stream into the database.
>> In our particular situation, decompression speed is a lot more
>> important than compression speed.
>
> "You'll have to make your own assessment ..."
Decompression is generally much faster than compression. I believe
there is not much difference in decompression speed when decompressing a
GZIP stream that was compressed with highest and lowest level. If you
dig a bit into compression theory then it's pretty obvious that finding
a small compressed representation is significantly harder than
converting a compressed data set back.
Kind regards
robert
|
| |
|
| |
 |
Chris

|
Posted: 2007-11-19 6:20:00 |
Top |
java-programmer >> Java text compression
Joshua Cranmer wrote:
> Chris wrote:
>> What's the fastest way to compress/decompress text?
>
> I know of a compression method that can compress in constant time: it
> replaces the entire text with a single `0' (hey, it's lossy!). To what
> degree of compression do you need?
As with all compression apps, as much as possible. It's hard to pick a
number until you know the available tradeoffs. We already know the
tradeoffs with java.util.zip, so obviously we're looking for something
faster.
> Questions:
> 1. From whence are the char arrays coming?
Memory. They get streamed from an external source, compressed, and
written to disk as they come in.
> 2. Where are the byte arrays going?
Also memory, although ultimately to the UI.
> 3. Which part of the process is the bottleneck? The UTF-8 conversion, or
> the compression?
Both, though the UTF-8 is the bigger burden.
|
| |
|
| |
 |
Chris

|
Posted: 2007-11-19 6:28:00 |
Top |
java-programmer >> Java text compression
Eric Sosman wrote:
> Chris wrote:
>> What's the fastest way to compress/decompress text?
>
> If you're really interested in "the fastest way" to the
> exclusion of all other concerns, then don't compress at all.
> Bingo! Problem solved!
Um, actually no. When you're dealing with really large datasets it's
generally faster to compress than not to compress. The reason is that
compressed data requires less disk I/O.
Not always, of course; really processor-intensive compression schemes
can make you processor-bound. But in general, that's the case.
Yup, we've benchmarked it.
> You might be happier with a compression scheme that did
> a little better at reducing the size of the data, but now you
> can't get a sensible answer until you describe the trade-offs
> you're willing to make. For example, if you were offered a
> compression scheme that ran ten percent faster than your current
> method but emitted fifteen percent more data, would you take it
> or reject it?
Yes, but I don't think that knowing that is essential to answering the
question. The question is really about finding better tradeoffs than we
can get with char conversion + zip conversion.
|
| |
|
| |
 |
Chris

|
Posted: 2007-11-19 6:35:00 |
Top |
java-programmer >> Java text compression
> Bonus question for OP: what is the size of data sets and how are they
> used? Especially, where are they stored?
Multi-terabyte sized, split across multiple machines. On a single
machine, generally not more than a few hundred Gb. One or two disks per
machine, SATA, no RAID.
At compression time, the data is streamed from an external source,
transformed in memory, and written to disk.
At decompression time, the app seeks to the particular block of text of
interest and decompresses it. Seek time dominates decompression time,
*except* when we do heavy caching, in which case the decompression
becomes the bottleneck. Storing the decompressed text in memory takes up
too much space. Has to be cached in compressed form.
|
| |
|
| |
 |
Eric Sosman

|
Posted: 2007-11-19 7:30:00 |
Top |
java-programmer >> Java text compression
Chris wrote:
>> Bonus question for OP: what is the size of data sets and how are they
>> used? Especially, where are they stored?
>
> Multi-terabyte sized, split across multiple machines. On a single
> machine, generally not more than a few hundred Gb. One or two disks per
> machine, SATA, no RAID.
>
> At compression time, the data is streamed from an external source,
> transformed in memory, and written to disk.
>
> At decompression time, the app seeks to the particular block of text of
> interest and decompresses it. Seek time dominates decompression time,
> *except* when we do heavy caching, in which case the decompression
> becomes the bottleneck. Storing the decompressed text in memory takes up
> too much space. Has to be cached in compressed form.
Cutting the text into blocks usually makes the compression
less effective. Most compression schemes nowadays (and I believe
DEFLATE is among them) are adaptive, meaning that they adjust to
the characteristics of the data stream as they process it. Thus,
they compress relatively poorly at first, then improve as they
learn more about the statistical profile of the data.
Implications: (1) You'll get better compression if you can
keep the blocks "fairly long." (1a) You might make the blocks
"long" by concatenating multiple sub-blocks, at the expense of
needing to decompress from the start of a block even if you only
need the sub-block at its end. (2) If the blocks simply must be
small, you probably shouldn't waste effort on BEST_COMPRESSION.
Some interesting experiments are in order.
--
Eric Sosman
email***@***.com
|
| |
|
| |
 |
Roedy Green

|
Posted: 2007-11-19 16:51:00 |
Top |
java-programmer >> Java text compression
On Sun, 18 Nov 2007 19:54:10 -0800, email***@***.com (Mark Rafn) wrote,
quoted or indirectly quoted someone who said :
>This will at least get you a baseline, and it'll be fairly easy to use other
>DeflaterOutputStream implementations.
Google points out:
http://teatrove.sourceforge.net/javadoc/com/go/trove/util/DeflaterOutputStream.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
| |
|
| |
 |
rossum

|
Posted: 2007-11-19 18:00:00 |
Top |
java-programmer >> Java text compression
On Mon, 19 Nov 2007 01:51:11 -0500, George Neuner
<gneuner2/@/comcast.net> wrote:
>This sounds like it might be DNA sequences.
If it is DNA sequences, then you might be able to use something like
Base64 for initial coding:
A -> 00
C -> 01
G -> 10
T -> 11
AAA -> 000000
...
ACG -> 000110
...
TTT -> 111111
Those six bit codes are a straight match for Base64 coding. That will
compress three bytes "AAC" into one "B" (000001 -> B in Base64).
rossum
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2007-11-19 19:14:00 |
Top |
java-programmer >> Java text compression
rossum wrote:
>>This sounds like it might be DNA sequences.
>If it is DNA sequences, ..
Sounds more like a heap of speculation over a 'cagey' problem
specification.
To clarify the 'cagey' aspect, perhaps the OP can indeed express
what the ulitmate point of this exercise is, rather than doling out
'precious little tid-bits' that supposedly represent the actual problem.
(Ultimately, the OP's own posts identify that they are entirely
unaware of the subtleties of the problems they face, and until
they fill in more detail, it really constitutes an 'interesting but
inefficient use of bandwidth' to speculate further.)
--
Andrew Thompson
http://www.physci.org/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
|
| |
|
| |
 |
Roedy Green

|
Posted: 2007-11-19 19:41:00 |
Top |
java-programmer >> Java text compression
On Mon, 19 Nov 2007 01:51:11 -0500, George Neuner
<gneuner2/@/comcast.net> wrote, quoted or indirectly quoted someone
who said :
>>> Multi-terabyte sized, split across multiple machines. On a single
>>> machine, generally not more than a few hundred Gb. One or two disks per
>>> machine, SATA, no RAID.
>
>This sounds like it might be DNA sequences.
If they are, convert each letter to 3 bits, then pack them 21 to a
long, wasting the sign bit.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
| |
|
| |
 |
Eric Sosman

|
Posted: 2007-11-19 22:45:00 |
Top |
java-programmer >> Java text compression
George Neuner wrote:
> On Sun, 18 Nov 2007 18:30:19 -0500, Eric Sosman
> <email***@***.com> wrote:
>
>> Chris wrote:
>>>> Bonus question for OP: what is the size of data sets and how are they
>>>> used? Especially, where are they stored?
>>> Multi-terabyte sized, split across multiple machines. On a single
>>> machine, generally not more than a few hundred Gb. One or two disks per
>>> machine, SATA, no RAID.
>
> This sounds like it might be DNA sequences.
> [...]
>
> Most LZ based implementations (including DEFLATE) limit codes to
> 16-bits (I've heard of 32-bit LZ, but I've never seen it).
> Compression studies have shown that, on average, the 16-bit code
> dictionary will be filled after processing 200KB of input.
>
> If the remainder of the input is characteristically similar to the
> part already encoded, the full dictionary will compress the rest of
> the input pretty well. But most input varies as it goes, sometimes
> rapidly and drastically, so it does make sense to segment the input to
> take advantage of the variation.
> [...]
> If we are talking about DNA sequences, then I would probably go for
> 256KB - once the base nucleotides and amino acid sequences are in the
> dictionary (and you can guarantee this by preloading them),
> compression is typically very good (80+%), so it makes sense to not
> worry about it and just pick a convenient sized buffer to work with.
If you're right, the alphabet is so small that I'd question
the need for the UTF-8 conversion. DEFLATE will quickly learn
that every other byte is a zero, and will compress them very well.
--
Eric Sosman
email***@***.com
|
| |
|
| |
 |
rossum

|
Posted: 2007-11-20 0:38:00 |
Top |
java-programmer >> Java text compression
On Mon, 19 Nov 2007 11:41:29 GMT, Roedy Green
<email***@***.com> wrote:
>On Mon, 19 Nov 2007 01:51:11 -0500, George Neuner
><gneuner2/@/comcast.net> wrote, quoted or indirectly quoted someone
>who said :
>
>>>> Multi-terabyte sized, split across multiple machines. On a single
>>>> machine, generally not more than a few hundred Gb. One or two disks per
>>>> machine, SATA, no RAID.
>>
>>This sounds like it might be DNA sequences.
>
>If they are, convert each letter to 3 bits,
Two bits, there are only four letters.
rossum
>then pack them 21 to a
>long, wasting the sign bit.
|
| |
|
| |
 |
Chris

|
Posted: 2007-11-20 11:55:00 |
Top |
java-programmer >> Java text compression
Andrew Thompson wrote:
> rossum wrote:
>>> This sounds like it might be DNA sequences.
>> If it is DNA sequences, ..
>
> Sounds more like a heap of speculation over a 'cagey' problem
> specification.
>
> To clarify the 'cagey' aspect, perhaps the OP can indeed express
> what the ulitmate point of this exercise is, rather than doling out
> 'precious little tid-bits' that supposedly represent the actual problem.
>
> (Ultimately, the OP's own posts identify that they are entirely
> unaware of the subtleties of the problems they face, and until
> they fill in more detail, it really constitutes an 'interesting but
> inefficient use of bandwidth' to speculate further.)
>
I started to write a long, irritable response to this, but I just don't
have time. Maybe I'll start a new thread later on twerps whose snotty,
fatuous responses waste bandwidth.
I'll say only this:
1. The problem is fully specified. Text compression is a known problem,
and I just asked if anyone knew of a Java library that had better
tradeoffs than UTF-8 + zip.
2. Text means text, not DNA. Written words.
3. I'm fully aware of the subtleties of this particular problem space,
and there is nothing in any of the posts so far that I haven't
considered and already benchmarked. (Including block sizes. For this
app, ~10k is optimal).
4. You don't need to know about the environment or the rest of the app,
because I'm not asking for a damn consultant.
5. Asking "how much compression I want" is just stupid.
In short, a narrow question is an invitation for a narrow answer, not an
invitation for you to tell me how you think I should write this app.
|
| |
|
| |
 |
Eric Sosman

|
Posted: 2007-11-20 12:15:00 |
Top |
java-programmer >> Java text compression
Chris wrote:
> [...]
> 1. The problem is fully specified. Text compression is a known problem,
> and I just asked if anyone knew of a Java library that had better
> tradeoffs than UTF-8 + zip.
>
> 2. Text means text, not DNA. Written words.
Elsethread you've explained that the compressed stream
gets read back into a companion program and decompressed there;
this suggests that it doesn't need to be exchanged with "foreign"
programs. In which case, I ask again: Does UTF-8 encoding buy
you enough additional compression to justify its expense? How
bad would things be if you just handed 16-bit chars to the
compressor with no "intelligence" whatsoever?
> 5. Asking "how much compression I want" is just stupid.
Well, you asked about compression speed. Other things
being equal, faster compressors compress less well and "looser"
compressors compress faster, so the question of "how much" must
eventually arise when you weigh alternatives.
--
Eric Sosman
email***@***.com
|
| |
|
| |
 |
Chris

|
Posted: 2007-11-20 12:51:00 |
Top |
java-programmer >> Java text compression
Eric Sosman wrote:
> Chris wrote:
>> [...]
>> 1. The problem is fully specified. Text compression is a known
>> problem, and I just asked if anyone knew of a Java library that had
>> better tradeoffs than UTF-8 + zip.
>>
>> 2. Text means text, not DNA. Written words.
>
> Elsethread you've explained that the compressed stream
> gets read back into a companion program and decompressed there;
> this suggests that it doesn't need to be exchanged with "foreign"
> programs. In which case, I ask again: Does UTF-8 encoding buy
> you enough additional compression to justify its expense? How
> bad would things be if you just handed 16-bit chars to the
> compressor with no "intelligence" whatsoever?
>
I'd like to try that. Unfortunately, java.util.zip.Deflater accepts only
byte arrays, not char arrays. I suppose it might be faster to copy the
chars to 2-byte sequences and compress, rather than run the UTF-8
compressor. An extra step, but worth a try.
>> 5. Asking "how much compression I want" is just stupid.
>
> Well, you asked about compression speed. Other things
> being equal, faster compressors compress less well and "looser"
> compressors compress faster, so the question of "how much" must
> eventually arise when you weigh alternatives.
>
Of course. It just reminded of walking into a store and having the clerk
ask "how much do you want to pay?" The right answer is, "show me the
merchandise and I'll figure out what the tradeoffs are on my own".
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2007-11-20 13:02:00 |
Top |
java-programmer >> Java text compression
Chris wrote:
>>> [...]
..
>Of course. It just reminded of walking into a store and having the clerk
>ask "how much do you want to pay?" ...
That might be an appropriate comparison if this were
a help desk. It is not a help desk. (Though you seem
to be treating the responders as though they were your
own personal servants - so perhaps you are confused
about the differences between 'help-desk' and 'usenet').
--
Andrew Thompson
http://www.physci.org/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Directory Aliases in ResinI recently had a project dropped into my lap that is written in JSP
running on Apache/Resin. A previous version of the application is
already running and configured on the production server, but new
functionality forces us to reconfigure some portions of both Apache
and Resin. There are basically two versions of the app that live in
separate directories, one that is served when someone goes to
www.domain.com, the second when someone goes to www.domain.com/subdir.
The main issue here is that there will be more than one "subdir", all
of which need to point to the same directory on the server, rather
than duplicating all the code for each new "subdir" that gets added.
Setting up aliases in Apache isn't a big deal, those are done. What
I'd really like to know is if it is even possible to set up aliases in
Resin similar to how they are done in Apache. I did some digging
through documentation, but was unable to find something. If anyone
can point me in the right direction, I'd appreciate it.
- 2
- 3
- Swing textboxes can't get focus after JFileChooserHi Java guru's,
I have a swing form that has a text field where a directory name can
be entered. Just to its right I have a button that will open the
JFileChooser dialog to allow selection of the directory name from a
dialog.
I can go in and type the directory name into the textbox by hand. So
far, so good.
I can go in and press the button, have the dialog appear, choose a
directory, and have the textbox programatically updated. Again, this
works.
But, if I press the button and choose a directory, I then lose the
ability to use my mouse to access any textboxes on my form. I am able
to use the tab button to move to, and update the textboxes.
I can't then click my mouse on a textbox and be able to enter in data.
Instead, I have to tab to it. The mouse also cannot be used to select
data within a textbox by double clicking or highlighting it. I CAN
hold down the mouse button and scroll right or left and have the
textbox's data shift if the text exceeds the width of the textbox.
But, the textbox appears to be disabled.
Interestingly enough, I AM able to use my mouse to click other BUTTONs
on the page.
So, its just the textboxes that seem affected.
Anyone have a solution or hints?
(btw, I'm using Java 1.4.2.x)
TIA
Here is my button listener:
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == btnRun)
if (areAllFieldsPopulated())
{
lblStatus.setText("Processing");
ExportFunctionalAreas exportFunctionalAreas = new
ExportFunctionalAreas();
exportFunctionalAreas.ExportXml(txtInputFileName.getText(),
txtOutputFileName.getText(), txtElementName.getText());
lblStatus.setText("Finished");
}
else
{
}
else if (event.getSource() == btnSelectFile)
txtInputFileName.setText(FileHandler.OpenFileDialog(txtInputFileName,"Open
Input File","xml","XML files (*.xml)"));
else if (event.getSource() == btnOutputDirectory)
txtOutputFileName.setText(FileHandler.OpenDirectoryDialog(txtOutputFileName));
}
and here is the open directory dialog code:
public static String OpenDirectoryDialog(Component Owner)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(Owner))
return chooser.getSelectedFile().getPath();
else
return null;
}
- 4
- Java Newbie questionHi all, I'm learning Java 2 by myself and find question for help.
I'm testing the System.in.read() method and tried the following program:
import java.io.*;
class ReadBytes {
public static void main(String args[])
throws IOException {
byte data[] = new byte[10];
System.out.println("Enter some characters.");
System.in.read(data);
System.out.print("You entered: ");
for (int i=0; i<data.length; i++) {
System.out.print((char)data[i]);
}
}
}
My question are:
(1) if I just comment out the "throws IOException" in the main, I
just got compilation error! Is the any condition I can tell whether
I have to throw something or not? I remembered in the HelloWOrld
app, I don't have to throw anything.
(2) If I entered more than 10 characters in the above test, I didn't
get overflow error. Why? Actually I'm expected an exception to
be caught.
Thanks in advance.
- 5
- 6
- Netbeans V5......Tomcat just won't start.. Why??My appologies if this is not the correct forum but I am desperate.
I have downloaded Netbeans V5.0 with JDK 1.5.0_05. Tomcat will not start.
It just seems to hang until it times out. If anyone else has had this
problem OR can direct me to a possible solution I would be deeply grateful.
PS Netbeans refuse to answer my emails!!
- 7
- Unreferenced enclosing class instance ?Hi,
I have below question about below enclosing class instance:
For below class
class MyOuter {
//.. say, some variables and methods defined here
class MyInner {
//.. say, some variables & methods defined here
}
}
pulic class TestNested {
public static void main(String[] args) {
MyOuter.MyInner inner = new MyOuter().new MyInner();
//.. suppose some time & memory consuming code executed afterwards
but inner not assigned 'null'
}
}
If compiled class TestNested ran & garbage collector did run at some
time before program terminated, will the MyOuter instance created in
first line of main be garbage collected ? Is there any method to
re-bind that created MyOuter instance with a reference variable after
the line "MyOuter.MyInner inner = new MyOuter().new MyInner();"
executed (besides split the statement into two like
MyOuter outer = new MyOuter();
MyOuter.MyInner inner = outer.new MyInner() ? :)
- 8
- How to get Cell ID from J2ME location API, on modern phones!Hi all, I wanted to know how to get the Cell ID using the J2ME
location API? I have found so much sites on the net bu they're all
since 2005 or 2003, and none of them contains a clear example (or even
basic idea) how to take the Cell ID. What I've tryed:
set the Criteria power management to low, so it doesn't search for
bluetooth. Everything else I've left as it is (now limits). It stops
the app for 60 secs (that's what I've set) and then it pops exception
- LocationException, which means it can't find info or timeout. I've
tested with longer times - same result. I'm sure the operator supports
it and the phone supports it (N73).
Please give an idea, please!
Thanks in advance...
- 9
- programi would to get the solution for the following program.
Write a complete Java program that does the following:
Prompt the user to type in the hour and minute departure time for an
airline flight.
Prompt the user to type in the hour and minute arrival time for that
flight. (Note: assume that the flight occurs in just one afternoon, leaving
at or after 1:00 and arriving at or before 12:59. Assume also that the user
provides valid input values!)
Calculate the total number of minutes the flight will be in the air.
Display the departure time, the arrival time, and the flight time (in
minutes) of the flight.
--
Message posted via http://www.javakb.com
- 10
- Applet downloading from netI have a beginner's question.
If I go to internet, a web page containing a java applet. The applet
class
should be downloaded to my hardware.
Does anybody can tell me where I can find the downloaded applet class
file
and image file related to the applet class?
Thanks in advance,
P.Kaviarasu
email***@***.com
- 11
- M-I'5.P ersecution - Capital Radi o - Chris T arrant-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=
-= Capital Radio -. Chris Tarrant -=
-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=
Capital Radio DJs have been "in on it" from the start.. One of the first
things. I heard in the summer of 1990 was from a Capital DJ who said, "If
he listens to Capital then he can't be all bad". (supportive, you see. We're
not bastards). Much. of what came over the radio in 1990 is now so far away
the precise details. have been obliterated by time. No diary was kept of the
details, and although archives if they. exist may give pointers, the
ambiguity of what broadcasters said would leave that open. to
re-interpretation.
In spring 1994, Chris Tarrant on his Capital morning show made an aside. to
someone else in the studio, about a person he didn't identify.. He said,
"You know this bloke? He says we're trying to kill him. We. should be done
for. attempted manslaughter".
That mirrored something I had said a day or. two before. What Tarrant said
was understood by the staff member in. the studio he was saying it to; they
said, "Oh no, don't say. that" to Tarrant. If any archives exist of the
morning show (probably unlikely) then. it could be found there; what he said
was so out of. context that he would be very hard put to find an explanation.
A couple of days later, someone at the site where I. was working repeated the
remark although. in a different way; they said there had been people in a
computer room when automatic fire. extinguishers went off and those people
were "thinking of suing. for attempted manslaughter".
Finally, this isn't confined to. the established radio stations. In 1990
after I had listened to. a pirate radio station in South London for about
half an hour, there was. an audible phone call in the background, followed
by total silence for a. few moments, then shrieks of laughter. "So what are
we supposed to say now?. Deadly torture? He's going to talk to us now, isn't
he?", which meant that they could. hear what I would say in my room.
5716
- 12
- FreeBSD / Eclipse 3.1 / WTP 0.7Hello,
As port of Eclipse 3.1 is already available, I was trying to install Eclips=
e=20
WTP 0.7 to improve my work with JSPs and Servlets. I installed first: GEF,=
=20
EMF, and Java EMF Model Runtime: JEM-SDK-1.1.zip (this is the problem) from=
=20
WTP site, but I have still error saying that there is no such plugin as=20
org.eclipse.jem.util - I checked plugins directory and there is such plugin=
=20
installed, in manage configuration it is shown as disabled - that's probabl=
y=20
mean that this version is incompatible with FreeBSD.
Is there anybody who installed WTP with success on Free, and can share=20
his/her knowledge on this topic? Anybody work on porting JEM and WTP to=20
FreeBSD?
Best Regards,
Lee
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 13
- Full Casino Source Codes For JUST $9,900We'd like to know if you or your company is interested in buying online
casino software.
We are now selling full casino sourcecodes for crazy cheap price, $9,900.
Yes, it's not $99,000. IT'S JUST $9,900 for full casino sourcecodes
including software, flash, database and everything we have.
With full casino sourcecodes,
You own the sourcecodes
There are no royalties to pay
You can setup as many casino sites as you want, without additional cost.
You can license the software for additional revenue opportunities
You can modify software, flash and database anytime at your own will.
You can do whatever you want.
No download flash casino software backed by java technology.
Stunning 3d graphics and sound add quality to our casino software.
The casino software includes the popular games like roulette, craps,
blackjack, caribbean poker, paigow, video poker games, slots, multi-line
slots and more.
Also it includes full marketing and management tools for your successful
casino business.
Check our website.
http://www.eplaysoft.com
http://www.megabetcasino.com (demo site)
The winning rate in fun mode play is different from that of real money
mode.
In real money mode, you can control the winning rate of each game.
Temporary user account for testing realmode play can be provided upon
request.
The price of the full casino sourcecodes including software, flash,
database and documents is JUST $9,900
Don't think that our software value is just $ 9,900. It's way beyond even
$99,000.
Check our software at the above site.
We are selling just 3 copies for this price on a first-come-first-served
basis to invest in developing different software(not gaming one).
We are selling full sourcecodes including everything(software, flash,
database and documents).
If you want, we can use escrow.com to make the deal safe and ensured to
you. Using escrow.com, you can release money to us after you receive the
source codes and check/verify if your casino works as megabetcasino.com.
We can install casino on your own server for you.
Contact us if you are interested.
We are the developers of the casino software, not sales broker or
reseller.
David.
email***@***.com
Eplaysoft, the gaming software development company.
http://www.eplaysoft.com
- 14
- XML Validation From Flat File?Hi All,
I am trying to convert some Flat Files (Fixed-Width and CSV) to XML
files (Using Java) and I was wondering what is the best way to validate
the data in conversion time (in term and data type, size, missing
fields, etc.)? I know javax.xml.validation helps but is this the
easiest way? Is there any UI tool to help generating these Schema
files?
Thanks in Advance,
Homer
- 15
|
|
|