comp.lang.java.help
  Home FAQ Contact Sign in
comp.lang.java.help only
 
Advanced search
August 2008
motuwethfrsasuw
    123 31
45678910 32
11121314151617 33
18192021222324 34
25262728293031 35
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.java.help Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Protocol spam         


Author: CGeek Wannabe
Date: Aug 29, 2008 03:38

Anyone who is still seeing all the Protocols spam in this ng
I've found that if you can killfile or Score by the
X-Complaints-To: attribute, you can use this:

X-Complaints-To: abuse@te.net.ua

It's pretty expensive, but it works. At least in slrn it does.
YMMV

--
* CGeek Wannabe = I Want To Be Cranky Geek
* http://www.crankygeeks.com and http://improve-usenet.org
* Running Windows Vista Ulitmate, Ubuntu Hardy Heron and MacOS X Tiger
*************************************************************************
4 Comments
  Re: size of things         


Author: Roedy Green
Date: Aug 29, 2008 02:28

On Thu, 28 Aug 2008 10:39:36 -0700 (PDT), "Tom A."
yahoo.com> wrote, quoted or indirectly quoted
someone who said :
>So, after I build the file, I was wondering how to get the offset to
>the "Offsets" area. I couldn't find any sort of "size" function that
>will return the size in bytes of "Names".
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
no comments
  Re: size of things         


Author: Boris Stumm
Date: Aug 29, 2008 00:16

Mark Space wrote:
> Tom A. wrote:
>> 2nd question
>> If I have an array of say boolean, barray, would I be able to
>> initialize it using the new for syntax with:
>> for(boolean b : barray ) b=false;
>
> I think new arrays of primitives are initialized to 0/null/false just
> like instance fields in new classes, but I didn't double check that.

That is right.
> However I think b just represents the value of your array elements, not
> a reference to them, so no dice on the loop. Use indexes and access the
> elements as normal for an array.

If you do not want to fill it with 0/null/false, you can use
java.util.Arrays.fill()
no comments
  Generic generics help         


Author: wizard of oz
Date: Aug 28, 2008 22:11

I'm trying to write a data class using generics. This class is a Sparse
Matrix meaning that it can have many dimensions but not many entries (e.g. a
100 by 100 matrix, but there might only be 10 entries in the matrix).

I intend to use LinkedLists or Trees to manage the row and column keys and
probably a hash Map to manage the cells - but that's not important right
now.

My first step is that in my add method, I need to ensure that my row and
column keys are in my list. I would like to use one common routine for this.
The problem is I can't figure out the right generics syntax.

Here is what I started with:

public class SparseMatrix {

private TreeSet rowHeaders = new TreeSet ();
private TreeSet colHeaders = new TreeSet ();

public void add (R rowKey, C colKey, E element) {

ensureExists (rowHeaders, rowKey);
ensureExists (colHeaders, colKey);
}
Show full article (2.07Kb)
4 Comments
  Exception handling and snarky compiler         


Author: Tom A.
Date: Aug 27, 2008 07:00

I am trying to set up a random access file RanFile.
(sorry, I don't have my code with me)

I have confirmed or created the directory, I have confirmed or created
the file in a File object, and then I create the random file
try { RanFile = new RandomAccessFile(File, "rw" ); }
catch ( < exceptions> ),
{ < put out informative error, and exit program > }

Then I use RanFile
RanFile.seek(0L);
and the compiler complains that RanFile may not be initialized. Now I
know that if it wasn't, then the program would have ended by this
point. How do I convince the compiler of that?

Thanks.

Tom A.
7 Comments
  Question on OO Principle         


Author: QQ
Date: Aug 27, 2008 00:27

Hi All

I read a book which mentioned Java new keyword vialiate "Open-close"
and "DIP" OO principle.

I don't understand it, anybody having deep knowledge explain to me?

Thanks a lot.

Steven
4 Comments
  threads: to join or not to join         


Author: marlow.andrew
Date: Aug 27, 2008 00:04

I have just discovered that when a java program starts one of more
threads and then the main thread comes to the end of function main,
the program will wait for the other threads to complete unless the
threads are daemon threads. This comes as quite a suprise to me. Does
this mean there is an implicit join?

Regards,

Andrew Marlow
4 Comments
  Question on syntax         


Author: maxnesler
Date: Aug 26, 2008 19:14

I have been doing some practice exams and came across this funny
'. . .' in the signatuer of a method:

int doIt(int... i) {
return 4;
}

any hint on what this means? i have an idea that it means you can
pass as many ints as you wish? Ruby uses a similar syntax.
7 Comments
  Question on syntax         


Author: maxnesler
Date: Aug 26, 2008 19:12

I have been doing some practice exams and came across this funny
'. . .' in the signatuer of a method:

int doIt(int... i) {
return 4; }
4 Comments
  MappedByteBuffer and UTF-8         


Author: ykon
Date: Aug 26, 2008 16:22

Hello java ppl,

For some hours now I am experimenting with MappedByteBuffer, and I
have the following issue:
Firstly I write 10 integers, followed by a String encoded in UTF-8.
Next when I try to read it back, but the String is garbage formated.
Here is the (messy)code:

public class MemoryMappingRW {

MappedByteBuffer mbb;

public MemoryMappingRW(String fileName) throws
java.io.FileNotFoundException, java.io.IOException {
File myFile = new File(fileName);
if (myFile.exists()) {
myFile.delete();
}
mbb = new RandomAccessFile(myFile, "rw").getChannel().map(
FileChannel.MapMode.READ_WRITE, 0, 0x8FFFFFF);
}

public static void main(String[] args) throws Exception {
Show full article (1.77Kb)
no comments
1 2 3 4 5 6 7 8 9