 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- collaborative QA testingDoes free or cheap code to do this already exist? What is this
generic sort of product called?
I want to set up a collaborative QA checklist, so that many people can
be testing at once and reporting what they have tested. Everyone sees
the incoming results like on election night, so they can see what
still needs to be done. It also allows for crucial stuff to be tested
by more than one person, and to record their conflicting results.
It might have columns for different platforms, and some sort of HTML
script to describe the sections and tests.
The problem is getting emergency coverage testing done at the last
possible minute to deal with any "insignificant" last minute changes.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
- 3
- java/74574: Making NetBeans 4.0 available
>Number: 74574
>Category: java
>Synopsis: Making NetBeans 4.0 available
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-java
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Wed Dec 01 06:00:49 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Manfred N. Riem
>Release: 5.3-RELEASE
>Organization:
>Environment:
FreeBSD lord.home 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 5 04:19:18 UTC 2004 email***@***.com:/usr/obj/usr/src/sys/GENERIC i386
>Description:
The latest version of the NetBeans IDE is 3.6 and currently the 4.0 releases are in release candidate phase. I have the necessary files for
the port but I don't know whom to send it to.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 3
- Hashtable: remove elements while Enumerating"Chris Berg" wrote:
> 1) Make a new Hashtable, copy all the 'good' entries into the new
> one, then replace the old one with the new one. This MAY be bad if
> another class still holds a reference to the old table.
>
> 2) make a new Vector in which you remember all keys of entries
> that shall be removed, and then remove them AFTER having finished
> the iteraton.
3) Copy (clone()) the Hashtable. Iterate over the copy. If you find an
entry in the copy that should be removed, remove it from the original.
Make sure that no other thread works the original Hashtable while you
enumerate over the copy and manipulate the original.
- 3
- Repost:STILL Need help w. HTMLUtils class.
Steve R. Burrus wrote:
> Hi all, this is steve Burrus, and I will admit that it's been a while
> since I last checked in with this group! I was wondering whatever
> happened to the "always-perennial" roedy Green, and after scrolling
> down the list of postings in this group, I found his last post was on
> 8.1.2004 and it's now 8/09/04.
> Well anyway, I needed some help with "getting it right" with the
> HTMLUtils class which is used in quite a few of the various examples
> in a particular servlet book of mine. I always seem to get a compiler
> error whenever I try to compile a servlet with this class in it! Can
> anyone help me please with this problem as I am in anguish over it, I
> must admit. Incidentally, I put the folder with this class in it into
> my classpath env. variable, but that didn't seem to help any.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<br>
<br>
Steve R. Burrus wrote:<br>
<blockquote type="cite" cite="email***@***.com">
<meta http-equiv="Content-Type" content="text/html;">
<title></title>
<big><b><font face="Times New Roman, Times, serif">Hi all, this is steve
Burrus, and I will admit that it's been a while since I last checked in with
this group! I was wondering whatever happened to the "always-perennial" roedy
Green, and after scrolling down the list of postings in this group, I found
his last post was on 8.1.2004 and it's now 8/09/04.<br>
Well anyway, I needed some help with "getting it right" with the HTMLUtils
class which is used in quite a few of the various examples in a particular
servlet book of mine. I always seem to get a compiler error whenever I try
to compile a servlet with this class in it! Can anyone help me please with
this problem as I am in anguish over it, I must admit. Incidentally, I put
the folder with this class in it into my classpath env. variable, but that
didn't seem to help any. <br>
</font></b></big> </blockquote>
<br>
</body>
</html>
- 3
- OT. Being Ronald L. Grossi. (Brother Ronald has a website).D-word wrote:
> Smokie Darling (Annie) wrote:
> > Zippy wrote:
> > > alt.drugs.hard, alt.support.arthritis, comp.lang.java.programmer,
> > > alt.sports.football.pro.ne-patriots, alt.security.terrorism.
> > >
> > > Can someone please tell me what all these groups have in common
> that
> > > they are in such urgent need of salvation? these kind of posts
> always
> > > have the same selection of newsgroups. I can only assume that it
is
> > the
> > > same person or group of people doing the posting. But the
newsgroup
> > > list still intrigues me.
> > >
> > > Answers please - sensible or not, humorous or not, in fact
> whatever.
> > Go
> > > on humour me.
> > >
> > > Zippy
> >
> > Nothing other than the fact that posting through Google, one can
only
> > send to 5 groups at a time, and apparently Yahoo caught on to Ron
> > Gossi, so now he's being more creative with his name? Trust me,
> he'll
> > be posting to almost every other group available on Google through
> out
> > the day. That'd be his MO
>
>
>
> Usenet isn't the only forum he spams, according to google
> (http://www.groupsrv.com/science/post-784999.html).
>
>
> Ron can (apparently) be reached for comment at: 919-553-7901
>
Correction, that number could be wrong, it is registered to "Dufresne."
*HOWEVER* This just in. Brother Ronald has a website.
Let's hear it for "Triumphant Ministries" (http://tinyurl.com/c96dw),
"Internet Evangelist" Ronald L. Grossi, and the power of the one true
god, Google. Can I get an Amen?
http://www.arkwebshost.com/advice/host/
- 5
- jvm class path unicode native methodsOkay.. I'm having the following problem.. I've tried pretty much every
solution I can think of but always hit some brick wall.
I need to:
load classes from a jar in a unicode directory and register native
methods for those classes.
Before (the unicode) I was simply doing a -Djava.class.path=myjar.jar
And then registering the native methods..
But.. I can't find a way to send a unicode code string to through the
-Djava.class.path..
So I've tried:
1. sending the string as utf8.. nope.
2. setting environment variable classpath with
SetEnvironmentVariableW.. nope.
3. creating my own url class loader with the jar..
Loads fine.. BUT NATIVE METHODS DO NOT REGISTER CORRECTLY (even
though the jnienv says they do.. they don't.. apparently I can only
register native methods from classes loaded from the jnienv_ sucky..)
4. creating my own url class loader that loads the byte code directly
from the jar, then calls defineClass from the root class loader.
NOPE.. because classes reference each other.. therefore the entire
jar must be available when ever I reference one class.
5. found out the class Launcher and its methods getClassLoader,
appendblahblahfor instrumentation..
NOPE.. although.. I've sort of giving up now.. this is going too far.
Any help?
Surely there are some japanese programmers that have dealt with this
before.
-tim
- 8
- have tomcat run a c binary via cgiAnyone know how to make tomcat run an actual exe?
I'm using windows 2000.
I can get it to print the binary contents of the exe to the web page,
but not actually execute it.
The docs indicate that you specify an executable in web.xml where you
specify cgi and that the default is perl, but I don't need an
interpreter to run an exe.
thanks
- 10
- W32.Swen.A@mm goes ballistic!"Tim Tyler" <email***@***.com> wrote
> It fills the mailboxes of users with huge numbers of 140K attachments -
> making email practically unusable.
Well, no, it just takes perseverance. Being careful not to junk the
five real messages in 1995 others is a bit tedious, I'll grant from
experience.
> Non-Windows users - and the rest of the internet - are targetted
> as a result of Microsoft's security problem - as mindless zombie
> Windows boxes swarm to spread the virus.
Indeed; in 30 hours so far, I've removed roughly 3500 emails either
containing the virus or saying they were forwarded with the virus
removed. This to my Unix ISP account, where mailx() is my friend and
companion for weeding through the end results of Microsoft's sloppy
coding practices.
Too bad California's refusal to allow the M$ denial of "fitness for
merchantability" cannot be reflected world-wide; a class action lawsuit
for damages would redistribute all of M$'s wealth and capital equipment
to the Internet as a whole.
Meanwhile, 200,000,000+ flawed email clients are trying to find my email
box with their virus copies.
Sigh; it is going to be a long next few days.
xanthian.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
- 10
- [Swing] JScrollPane double MouseMotionListenerhi,
I am targetting JRE 1.5.
I have an image displayed within a jscrollPane (with scrollbars).
(in this way : new JScrollPane(new JLabel(new ImageIcon(image))))
I have a MouseMotionListener added to the JScrollPane, so when the
mouse goes over the visible part of the image, I can get the relative
coordinates of the mouse
My question is how to I get at the same time, the coordinate of the
mouse relative to the jscrollpane (the coordinates within the visible
part of the image) and the absolute coordinates (the coordinates of
the mouse relative to the whole image itself).
I tried adding also MouseMotionListener to the JLabel and that gives
me the the coordinates of the mouse relative to the whole image
itself, but then the event is lost for the jscrollpane's listener.
How can I achieve that simply ?
- 10
- 3 way if"Roedy Green" <email***@***.com> wrote:
> If you were to devise a syntax for 3 way if that gave you clauses to
> execute if the expression were positive, negative or zero what sort of
> syntax would you come up with? I find this pattern showing up all the
> time in writing Comparators.
Sure, because it is the output of the comparision functionality.
Trouble is it is too broad, you only need three values, not two ranges
and a central value.
I put a wrapper interface (named "Sortable") around the comparision
functionality so that it would emit specifically -1, 0, or +1, as
manifest constants named LESS_THAN, EQUAL_TO, and GREATER_THAN, on which
I can then use a simple, symmetric, and clean switch syntax.
Given enumerations, that would presumably be even easier, because then
you could exhaust the enumeration type to the satisfaction of the
compiler, and wouldn't have to include a "default" switch case, the only
wart in my current setup.
xanthian.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
- 12
- EJB Remote Calls - Serialization Restriction(s)Hi,
I have a simple HelloWorldApplication which uses SSbs.
I pass a Customer Object which has two attribute String name and
Address address;
I made Address not-serializable
so when i make calls to the SessionBean i get a remote Exception which
contains the not-serializable exception in WebPShere (as expected)
To my surprise this application ran without any problem in JRun4.0
Why would that be the case and what would the result in other APp
Servers like WebLogic be?
AFAIK, objects (parameters and Return types) must be serializable for
all Remote EJB Calls.
Note this applicaiton does not use Local Interfaces..
TIA
Manglu
- 12
- New Forum For People Who Love To Discuss On Technical TopicsA new forum for everything in one place has launched at http://www.technicaltalk.net/
This is a cool forum where any one can discuss about many technical
things like Programming, Scripting, Design, Database, Operating
Systems, Testing and even a place where any one can read and post
articles. People will also find some helpfull site links, E-books.
Get registered at http://www.technicaltalk.net/ to explore more.....
http://www.technicaltalk.net/
- 12
- Latest models of Gibson guitarsReviews of latest models of best guitars, fender, gibson, yamaha, and
many more, with pictures and prices.
http://pro-guitars.blogspot.com/
And if you want to win a free guitar go here
http://freeguitars.blogspot.com/
- 13
- Help needed with BlueJHi All,
Need help(procedures/steps) to execute
an application program using BlueJ.
I have downloaded the
BlueJTutorial.pdf, read
what is there, I can compile my program,
can make a jar,
but where is the "run" instruction
in the main menu?
Bob
- 13
- J2ME: allowing for "Allow HTTP traffic?" confirmation when doing a connection timeout mechanismI'm using threading in a J2ME app to allow a timeout on an attempt to
connect to server. However, I'm having an issue with the usual
confirmation the user gets on first connection attempt: you know, the
message that say something like "This application would like to send
HTTP traffic. Allow this?" The problem is that I have no idea of how
long the user takes to read this message before hitting "ok", so my
connection timeout could timeout before the user has even hit ok and
before any connection attempt has been made!
Is there any callback available so that I know when the user has
actually hit 'ok'?
My current workaround is to make a dummy first connection to a bad
address, e.g. "http://x", just to get the user to hit 'ok' and get that
out of the way before making my proper connection attempt.
Is there a better way though? This technique makes an attempted DNS
lookup which wastes a little time.
Thanks.
N.B.
I'm aware that in some cases the user can have a preference set so that
the HTTP traffic alert happens before *every* server communication, but
I'm ignoring this case for the moment.
|
| Author |
Message |
Josef Garvi

|
Posted: 2005-4-28 21:18:00 |
Top |
java-programmer, Comparables and Generics
How do I express "A Comparable that can be compared to itself" in generics?
I have a method that takes as parameter an array of Comparables.
Whilst trying to "modernize" this code, I can no longer write simply:
public void myMethod(Comparable[] primaryKeyValues)
but need to add "generic info" to Comparable.
The only requirement I have is that the objects should be able to run a
compareTo() on an instance of their own classes.
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
pole

|
Posted: 2005-4-28 22:11:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> How do I express "A Comparable that can be compared to itself" in generics?
>
> I have a method that takes as parameter an array of Comparables.
> Whilst trying to "modernize" this code, I can no longer write simply:
>
> public void myMethod(Comparable[] primaryKeyValues)
Do you mean taking an array of Comparable of a speficic type?
This is a declaration for a method which takes an array of Comparable<T>
instances:
public <T> void myMethod( Comparable<T>[] primaryKeyValues )
pole
--
ammentos - a lightweight persistence framework for JDK5
http://www.sourceforge.net/projects/ammentos
http://ammentos.biobytes.it
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-4-28 23:17:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> How do I express "A Comparable that can be compared to itself" in generics?
>
> I have a method that takes as parameter an array of Comparables.
> Whilst trying to "modernize" this code, I can no longer write simply:
>
> public void myMethod(Comparable[] primaryKeyValues)
>
> but need to add "generic info" to Comparable.
> The only requirement I have is that the objects should be able to run a
> compareTo() on an instance of their own classes.
>
The signature
public <T extends Comparable<T>> void myMethod(T[] primaryKeyValues)
should do the trick. That reads in English something like "a public
method making use of a type, T, that is comparable to itself; returning
no result; and taking as a parameter an array of objects of the
aforementioned type T."
For utmost generality, however, you would want
public <T extends Comparable<? super T>> void myMethod(T[] primaryKeyValues)
which differs from the first example in that it allows key types that
are Comparable to a superclass of their own class. This allows more
types for the keys while still ensuring that all the array elements are
mutually comparable.
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-28 23:19:00 |
Top |
java-programmer >> Comparables and Generics
pole wrote:
> Josef Garvi wrote:
>
>> How do I express "A Comparable that can be compared to itself" in
>> generics?
>>
>> I have a method that takes as parameter an array of Comparables.
>> Whilst trying to "modernize" this code, I can no longer write simply:
>>
>> public void myMethod(Comparable[] primaryKeyValues)
>
>
> Do you mean taking an array of Comparable of a speficic type?
> This is a declaration for a method which takes an array of Comparable<T>
> instances:
>
> public <T> void myMethod( Comparable<T>[] primaryKeyValues )
>
> pole
Will all the Comparables in primaryKeyValues now have to be of the same
class, or can they be of varying classes (within the same array instance).
I would like to call it like this:
myMethod(new Comparable[] {new Integer(12), new String("Good morning")});
I use Comparable[] rather than Object[] as argument, as each value in the
array should be possible to compare with other values, but only other
values of the same type as itself. (meaning the String will never be
compared to an Integer).
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-28 23:44:00 |
Top |
java-programmer >> Comparables and Generics
John C. Bollinger wrote:
> For utmost generality, however, you would want
>
> public <T extends Comparable<? super T>> void myMethod(T[]
> primaryKeyValues)
>
> which differs from the first example in that it allows key types that
> are Comparable to a superclass of their own class. This allows more
> types for the keys while still ensuring that all the array elements are
> mutually comparable.
Whooh, the syntax is overwhelming!
Thanks.
How can I now store the primaryKeyValues into a field of my class?
For example, I'm not allowed to write:
private Comparable<T extends Comparable<? super T>>[] keyValues;
I'm getting the impression that using the function compareTo was a whole
lot easier before Generics... :-(
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-4-28 23:48:00 |
Top |
java-programmer >> Comparables and Generics
pole wrote:
> Josef Garvi wrote:
>
>> How do I express "A Comparable that can be compared to itself" in
>> generics?
>>
>> I have a method that takes as parameter an array of Comparables.
>> Whilst trying to "modernize" this code, I can no longer write simply:
>>
>> public void myMethod(Comparable[] primaryKeyValues)
>
>
> Do you mean taking an array of Comparable of a speficic type?
He was pretty clear, I thought, about "a comparable that can be compared
to itself". This keys on the concept, formalized with generics, that
Comparables are not all comparable to each other, with the implicit
corollary that a particular Comparable is not necessarily even
comparable to itself.
The original declaration translates directly to generics as
public void myMethod(Comparable<?>[] primaryKeyValues)
but that does not achieve what he wants, because it does not constrain
what the Comparables are comparable _to_.
> This is a declaration for a method which takes an array of Comparable<T>
> instances:
>
> public <T> void myMethod( Comparable<T>[] primaryKeyValues )
That is a little better in that it ensures that the Comparables are all
comparable to the same type, and it also makes that type accessible in
the method body via the type parameter. It does not, however, ensure
that the type T implements Comparable at all, much less Comparable<T>.
See my response to the OP for two related solutions that do solve the
problem.
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-29 0:10:00 |
Top |
java-programmer >> Comparables and Generics
To clarify things a bit:
What I'm trying to do is to convert the following class so that it works
with Generics (and thus does not cause a compiler warning anymore):
public class ComplexKey implements Comparable<ComplexKey> {
private Comparable[] keyValues;
public ComplexKey(Comparable[] keyValues) {
super();
this.keyValues = keyValues;
}
public int compareTo(ComplexKey compareWith) {
if (compareWith.keyValues.length == keyValues.length) {
for (int i = 0; i < keyValues.length; i++) {
int x =
keyValues[i].compareTo(compareWith.keyValues[i]); // <- WARNING
if (x != 0) return x;
}
return 0;
} else
throw new ClassCastException("Number of key values do not match.");
}
[...a few other methods...]
}
The purpose of the class is to contain the primary key values of a database
record so it can be used as key in a HashMap.
I get a pesky warning about not being type safe on the line indicated with
the comment, and I can't completely figure out how to rebuild my class:
"Type safety: The method compareTo(Object) belongs to the raw type
Comparable. References to generic type Comparable<T> should be
parameterized"
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-4-29 5:14:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> To clarify things a bit:
> What I'm trying to do is to convert the following class so that it works
> with Generics (and thus does not cause a compiler warning anymore):
>
>
> public class ComplexKey implements Comparable<ComplexKey> {
>
> private Comparable[] keyValues;
>
> public ComplexKey(Comparable[] keyValues) {
> super();
> this.keyValues = keyValues;
> }
>
> public int compareTo(ComplexKey compareWith) {
> if (compareWith.keyValues.length == keyValues.length) {
> for (int i = 0; i < keyValues.length; i++) {
> int x =
> keyValues[i].compareTo(compareWith.keyValues[i]); // <- WARNING
> if (x != 0) return x;
> }
> return 0;
> } else
> throw new ClassCastException("Number of key values do not match.");
> }
>
> [...a few other methods...]
>
> }
>
> The purpose of the class is to contain the primary key values of a
> database record so it can be used as key in a HashMap.
>
> I get a pesky warning about not being type safe on the line indicated
> with the comment, and I can't completely figure out how to rebuild my
> class:
> "Type safety: The method compareTo(Object) belongs to the raw type
> Comparable. References to generic type Comparable<T> should be
> parameterized"
Before you can solve the problem, you have a fundamental question to
answer: what type are the specific key values supposed to be comparable
to? You can describe the type by means of a type parameter, if you
like, in which case you will need to make the ComplexKey class generic,
with the appropriately chosen type parameter. It might look like this:
public class ComplexKey <T extends Comparable<T>>
implements Comparable<ComplexKey<T>> {
private T[] keyValues;
[...]
public int compareTo(ComplexKey<T> compareWith) {
[...]
int x = keyValues[i].compareTo(compareWith.keyValues[i]);
[...]
}
}
I suspect, however, that you still have a problem: the key values'
classes in that scheme are going to need to all inherit from (or be) a
common superclass that is Comparable to itself, because putting them all
in the same array requires that they all have types compatible with the
element type of the array. If I am correctly inferring your use of this
class, then this is a fundamental type safety problem with your
approach. (In the sense that its type safety cannot be verified by
compile-time checks.)
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-29 16:00:00 |
Top |
java-programmer >> Comparables and Generics
John C. Bollinger wrote:
>
> Before you can solve the problem, you have a fundamental question to
> answer: what type are the specific key values supposed to be comparable
> to?
A single instance of ComplexKey might hold something like: a String, an
Integer and a Double. Simply put, the type of values you could find in the
fields of a primary key in a relational db.
> You can describe the type by means of a type parameter, if you
> like, in which case you will need to make the ComplexKey class generic,
> with the appropriately chosen type parameter. It might look like this:
>
> public class ComplexKey <T extends Comparable<T>>
> implements Comparable<ComplexKey<T>> {
>
> private T[] keyValues;
>
> [...]
>
> public int compareTo(ComplexKey<T> compareWith) {
> [...]
> int x = keyValues[i].compareTo(compareWith.keyValues[i]);
> [...]
> }
> }
>
>
> I suspect, however, that you still have a problem: the key values'
> classes in that scheme are going to need to all inherit from (or be) a
> common superclass that is Comparable to itself, because putting them all
> in the same array requires that they all have types compatible with the
> element type of the array. If I am correctly inferring your use of this
> class, then this is a fundamental type safety problem with your
> approach. (In the sense that its type safety cannot be verified by
> compile-time checks.)
Yes, I think you're correct here.
A single instance of the ComplexKey can hold several different types in its
array, with the only common denominator being that they are comparable to
their own types - not to each other.
They all must implement Comparable, because otherwise the ComplexKey itself
can't become Comparable. (So changing the signature to accepting an array
of Objects would not be satisfactory).
Basically, the ComplexKey class is used for caching record keys from db
tables. In practice, this means that ComplexKeys are compared with other
ComplexKeys built with records from the same table (same order of class
instances in the keyValues array). To be more concrete, an instance of
ComplexKey holding a reference to a record in table "Orders" will only be
compared to other ComplexKeys referencing that same table, "Orders", never
to records in a table "Farmers". Attempting this would most likely throw a
run-time error, as two different tables are likely to have different types
of primary keys.
Does this mean that I should create a subclass of ComplexKey for every
possible combination of field types in the primary key? Rather than
accepting an array with field values, each subclass would have a different
constructor:
public ComplexKey(Integer farmerId)
public ComplexKey(Integer farmerId, Integer Year, Integer speciesId)
This would create an explosion of classes and seems like a lot of work...
:-( And seem a lot less "generic" than what I'm doing today! :-)
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2005-4-29 16:29:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> Basically, the ComplexKey class is used for caching record keys from db
> tables. In practice, this means that ComplexKeys are compared with other
> ComplexKeys built with records from the same table (same order of class
> instances in the keyValues array). To be more concrete, an instance of
> ComplexKey holding a reference to a record in table "Orders" will only be
> compared to other ComplexKeys referencing that same table, "Orders", never
> to records in a table "Farmers". Attempting this would most likely throw a
> run-time error, as two different tables are likely to have different types
> of primary keys.
Then attempting to force static type checking using generics strikes me as a
massive waste of time. You are /only/ arguing with the compiler about whether
you know what you are doing, not producing productive code.
I'd treat everything as Objects; let generics go hang. Stick some type
assertions in to make the design more self-documenting and to aid debugging if
you feel you need it.
-- chris
|
| |
|
| |
 |
pole

|
Posted: 2005-4-29 16:53:00 |
Top |
java-programmer >> Comparables and Generics
John C. Bollinger wrote:
> He was pretty clear, I thought, about "a comparable that can be compared
> to itself". This keys on the concept, formalized with generics, that
> Comparables are not all comparable to each other, with the implicit
> corollary that a particular Comparable is not necessarily even
> comparable to itself.
> [...]
Ok, I agree whith you, even if I could never imagine a Comparable which
is not comparable to itself :).
--
ammentos - a lightweight persistence framework for JDK5
http://www.sourceforge.net/projects/ammentos
http://ammentos.biobytes.it
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-29 18:44:00 |
Top |
java-programmer >> Comparables and Generics
Chris Uppal wrote:
> Then attempting to force static type checking using generics strikes me as a
> massive waste of time. You are /only/ arguing with the compiler about whether
> you know what you are doing, not producing productive code.
True indeed.
> I'd treat everything as Objects; let generics go hang. Stick some type
> assertions in to make the design more self-documenting and to aid debugging if
> you feel you need it.
That's sounds fine.
But even if I treat the keyValues array as Object[], how can I compare it's
items without throwing compiler warnings?
For instance:
int x = ((Comparable)keyValues[i]).compareTo(compareWith.keyValues[i]);
will still bug me with the lack of type safety...
Put in it's context it looks like this:
public int compareTo(ComplexKey arg0) {
ComplexKey compareWith = arg0;
if (compareWith.keyValues.length == keyValues.length) {
for (int i = 0; i < keyValues.length; i++) {
// Warning on the line below.
int x = ((Comparable)keyValues[i]).
compareTo(compareWith.keyValues[i]);
if (x != 0) return x;
}
return 0;
} else
throw new ClassCastException("Number of key values do not match.");
}
I don't want to turn off generics warnings for my entire project, as they
are good to have in other circumstances.
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-4-29 22:25:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> John C. Bollinger wrote:
>
>>
>> Before you can solve the problem, you have a fundamental question to
>> answer: what type are the specific key values supposed to be
>> comparable to?
>
>
> A single instance of ComplexKey might hold something like: a String, an
> Integer and a Double. Simply put, the type of values you could find in
> the fields of a primary key in a relational db.
That's as I guessed.
>> I suspect, however, that you still have a problem: the key values'
>> classes in that scheme are going to need to all inherit from (or be) a
>> common superclass that is Comparable to itself, because putting them
>> all in the same array requires that they all have types compatible
>> with the element type of the array. If I am correctly inferring your
>> use of this class, then this is a fundamental type safety problem with
>> your approach. (In the sense that its type safety cannot be verified
>> by compile-time checks.)
>
>
> Yes, I think you're correct here.
> A single instance of the ComplexKey can hold several different types in
> its array, with the only common denominator being that they are
> comparable to their own types - not to each other.
>
> They all must implement Comparable, because otherwise the ComplexKey
> itself can't become Comparable. (So changing the signature to accepting
> an array of Objects would not be satisfactory).
>
> Basically, the ComplexKey class is used for caching record keys from db
> tables. In practice, this means that ComplexKeys are compared with other
> ComplexKeys built with records from the same table (same order of class
> instances in the keyValues array). To be more concrete, an instance of
> ComplexKey holding a reference to a record in table "Orders" will only
> be compared to other ComplexKeys referencing that same table, "Orders",
> never to records in a table "Farmers". Attempting this would most likely
> throw a run-time error, as two different tables are likely to have
> different types of primary keys.
So why do the ComplexKey objects need to be Comparable? That's wholly
unnecessary for simple caching. Is there some other requirement here
that you haven't discussed yet?
> Does this mean that I should create a subclass of ComplexKey for every
> possible combination of field types in the primary key? Rather than
> accepting an array with field values, each subclass would have a different
> constructor:
>
> public ComplexKey(Integer farmerId)
> public ComplexKey(Integer farmerId, Integer Year, Integer speciesId)
>
> This would create an explosion of classes and seems like a lot of
> work... :-( And seem a lot less "generic" than what I'm doing today! :-)
And it would not get you where you want to be without even more work
than you may realize. As I wrote before, you have a *fundamental* type
safety problem with your current code. Even if there were a way to
express them, the type constraints you want are not sufficient to
guarantee type safety for the elements of an array as you wish to use
them. On the other hand, type constraints sufficient to guarantee type
safety for your problem are stronger than you can work with. The same
would apply if you were using a List of the key fields instead of an
array. The only way I can see that you could obtain type safety is to
write ComplexKey subclasses that were completely independent, storing
the key fields in individual instance variables and not relying on a
common comparison engine. In principle one could write code to generate
such classes on the fly, but that's an extreme workaround for a minor
problem.
I encourage you, therefore, to take this opportunity to look at the
bigger picture. Do ComplexKey objects _really_ need to be Comparable?
My general rule of thumb is to rely on the DB to do what DBs are good
at, and sorting records is one of those things.
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
Josef Garvi

|
Posted: 2005-4-30 5:06:00 |
Top |
java-programmer >> Comparables and Generics
John C. Bollinger wrote:
>
> [...]
>
> I encourage you, therefore, to take this opportunity to look at the
> bigger picture. Do ComplexKey objects _really_ need to be Comparable?
> My general rule of thumb is to rely on the DB to do what DBs are good
> at, and sorting records is one of those things.
Thanks for your great help and advice.
The Comparable interface was meant to allow sorting, but after looking at
it closely, I do think I can live without that. A bit frustrating though,
when new language features "cripple" ones possibilities... :-) Ok, I know,
it's just a question of adjusting mentally to the new paradigms....
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
|
| |
|
| |
 |
John C. Bollinger

|
Posted: 2005-5-2 22:30:00 |
Top |
java-programmer >> Comparables and Generics
Josef Garvi wrote:
> John C. Bollinger wrote:
>
>>
>> [...]
>>
>> I encourage you, therefore, to take this opportunity to look at the
>> bigger picture. Do ComplexKey objects _really_ need to be Comparable?
>> My general rule of thumb is to rely on the DB to do what DBs are good
>> at, and sorting records is one of those things.
>
>
> Thanks for your great help and advice.
You're welcome.
> The Comparable interface was meant to allow sorting, but after looking
> at it closely, I do think I can live without that. A bit frustrating
> though, when new language features "cripple" ones possibilities... :-)
> Ok, I know, it's just a question of adjusting mentally to the new
> paradigms....
Nothing has been crippled. You can continue to do as you have always
done, and put up with the type safety warnings. Type safety checking is
helpful in developing correct code, but it should not be viewed as a
straight jacket. If you have sufficient reason for confidence that your
scheme will not in practice ever produce a ClassCastException or
otherwise produce type-related mysterious failures, then you should feel
justified in documenting and subsequently ignoring the warnings. If you
do not have such confidence then by resolving the warnings you will have
made your product more robust.
Good luck,
--
John Bollinger
email***@***.com
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- URGENT RXTX SERIAL PORTHello
This is my situation :
A PC under OS MandrakeLinux 10.1
A machine branched on the serial port
I use jdk1.5 and the rxtx API
Opening the port seems good, i send data to the machine but when i read
th response i have a buffer with bytes null.
I have tried to sniff the serial port but i don't understand the data i
intercept, i don't recognize my protocol !
I don't know how i can debug to know what's wrong.
Any help will be welcome.
Thanks
Nanou
- 2
- main() parametersWhat's the difference in these parameters?
main(String[] args) and main(String args[]) ?
public class app extends Applet{
public static main void (String[] args)....
Bill
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
- 3
- (www.shoessuperstar.com)Wholesale world famous handbag-CHANEL/CHLOE/LV/GUCCI/Feidi and so onHello
http://www.shoessuperstar.com/
shoessuperstar.co.,LTD greets and desires of success and wishes you
happy times.
This is professional export company from china who carry PAYPAL
payment and DROPSHIP .
We greated in 1998 year ,and now we become the one of best supplier
here because of we keep our credit standing .
Pls visit our site if u are interest in any products below ,
http://www.shoessuperstar.com/
Our main products :
Fashion shoes:
Air Jordan , Air force , Air max , Shox , Dunk , Adidas , Puma ,
Prada , Chanel , Gucci , Lacoste , LouisVuiton and more .
Fashion Hoodies&T-Shirt&Jeans&Jacket:
Gino Green Globa , Bape , BBC , Evsiu , Juicy couture , Burberry , 10
Deep , LRG , ED Hardy , Chanel , G-Star , Red monkey , lacoste ,
POLO,
Armani ,Replay , Tommy and more.
Fashion bags:
LouisVuiton , Pada , Chanel , Fendi , Versace , Burberry , MIUMIU ,
Y-3 , Gucci ,Chloe , Guess , Juicy and more
Electronic :
IPOD NANO , http://www.shoessuperstar.com/
Features:
1) All Package are original ,coming with guarantee cards
2) Main Market : U.S.A . U.K ,ITALY , EURO COUNTRY ,
AUSTRALIA
3) Ship Company : DHL , TNT , UPS , SODIEX , EMS
4) Payment Method : PAYPAL , WESTERN UNION ,T/T .
5) Custom : We carry the custom clear and promise items
must be arrive .
Thanks for your reading , pls mail us if u have any problem
with
the business . We hope that will make a long&great business with you
in future.
Your satisfactions,Our pursuit!
Please Email me to get discount!!
MSN : email***@***.com
email***@***.com
EMAIL: email***@***.com
http://www.shoessuperstar.com/
Best regards
Yours sincerely
- 4
- Eclipse Appearance ProblemHi all,
I have Eclipse (version: 3.2.2) and JRE (version:1.6.0.1) installed on
my Windows Vista System. When I am working regularly with Eclipse I
encounter with disappearance of some regions of Eclipse window.
Specifically package explorer and console regions are becoming a white
area right after I switch(focus/bring to front) from another
application to Eclipse. If I resize the Eclipse window or just make
some mouse gestures over those white area, they return back to normal.
I have no idea about the problem so I could not goggled it. Here is a
screenshot: http://www.imagehosting.com/show.php/502707_20070421132840.png.html
- 5
- To correct my program. please, check to find errors and correct me.import. Java.io.*;
import. Java.text.NumberFormat;
public class commander
public. static.void man(String[]args)throws IOException
BufferedReader in =
new BufferedReader(New InputStreamReader(Systemin));
int (commander);
System.out.println("Enter your code");
code = integer.parseint(in.readLine());
switch(commander)
{
case 1:
System.out.println("The status of president of United States);
break;
case 2:
System.out.println("The status of secretary of Defense);
break;
case 3:
System.out.println("The status of the Air force);
break;
case 4:
System.out.println("The status of Air force chief staff);
break;
case 5:
System.out.println("The status of Air university commander);
break;
case 6:
System.out.println("The status of Air commader);
break;
default:
System.out.println(" The status of commander is children");
-------------------------------------------------------------------------------
please correct me.
this is switch statement to make program.
- 6
- regex: How to extract substrings?This should be really easy, but I couldn't find it in the tutorials and
documentations on the web:
What is the Java equivalent to the following Perl operation?
my $entry = "__3432__Smith__"
my ($id,$name) =
$entry =~ m/__(\d+)__([A-z]+)__/;
In other words, I want to extract the number and the name from the
string $entry, using a regular expression.
I tried the following:
Pattern p = Pattern.compile("__([0-9]+)__([A-z]+)__");
Matcher m = p.matcher("__3432__Smith__");
while(m.find()){
System.out.println(m.group());
}
But that gives me the complete match at once, not the two subgroups that
I specified using the parens: (\d+) and ([A-z]+).
Who can help?
Thanks!
- 7
- Somone got a 4096x4096 pixel screen at sunWell at least it looks like that if you try to look at this new, quite
helpful "poster-map" from sun:
http://java.sun.com/developer/onlineTraining/new2java/javamap/index.html
I had to go to full-screen mode in my browser, otherwise the controls at
the bottom wouldn't appear and I couldn't see more than 5% of the poster
and navigate around.
It's also downloadable as PDF here
http://java.sun.com/developer/onlineTraining/new2java/javamap/Java_Technolo
gy_Concept_Map.pdf
CU
Ren?
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
- 8
- Difficulty with swingswe r beginners in java, creating an application similar to paintbrush.
(still working on the frontend)what r the different packages and classes that we could use to create a new window by selecting the "New" option from the MenuBar.What other sites could we visit for help?what r the recommended books that we could refer to ?
Thank you in advance.
--
Message posted via http://www.javakb.com
- 9
- 10
- Renamed: Lutus alert [Re: how many tomcat instances on one machine]This is a multi-part message in MIME format.
"Kathy Benson" <email***@***.com> wrote in message news:email***@***.com...
That should not be a problem as long as each one of them is listening on a different port and you have enough memory. We have an application that uses embedded Tomcat and I can start about 15 instances without any problem. I have about 1GB of memory and the initiali heap for Tomcat is set the the default, which I bellieve is 2 MB.
KB
--
------------------------------------------------------------------------------
This email is certified to be Spam free by Spam Marshall
You don't pay to get spam, why pay to clean it?
Visit http://www.spammarshall.com to create an account for free
------------------------------------------------------------------------------
Andy Fish wrote:
Hi,
Just curious to see if anyone has run lots of separate tomcat instances on
one machine. I currently have 2 which works fine, but I wonder if anyone has
ever done 10? 50?
I'd like to be able to host a number of separate instances of my app on the
same box for evaluation purposes and this seems the easiest way of doing it.
They will not be heavily used, so I guess RAM is the biggest factor.
Unfortunately I am on windows 2000 not *nix, so paging will be an issue.
Any comments would be appreciated
Andy
Lutus alert!!!! Hey, looks like SPAM in a signature that advertises a no SPAM product. Is this signature recursive??
--
Gary
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content=text/html;charset=ISO-8859-1>
<META content="MSHTML 6.00.2800.1264" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV>"Kathy Benson" <<A
href="mailto:email***@***.com">email***@***.com</A>> wrote in
message <A
href="news:email***@***.com">news:email***@***.com</A>...</DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">That
should not be a problem as long as each one of them is listening on a
different port and you have enough memory. We have an application that uses
embedded Tomcat and I can start about 15 instances without any problem. I have
about 1GB of memory and the initiali heap for Tomcat is set the the default,
which I bellieve is 2 MB.<BR><BR>KB<BR>
<DIV class=moz-signature>-- <BR>
<STYLE type=text/css>P {
FONT-SIZE: 12px; COLOR: black; FONT-FAMILY: Tahoma, Arial, Verdana
}
H1 {
}
H2 {
}
H3 {
}
HR {
WIDTH: 80%; COLOR: #cc0000; LINE-HEIGHT: 1; HEIGHT: 1px; TEXT-ALIGN: left
}
A {
}
A:visited {
}
A:active {
}
A:hover {
}
BODY {
FONT-SIZE: 12px; COLOR: black; FONT-FAMILY: Tahoma, Arial, Verdana
}
TABLE {
FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Tahoma, Arial, Verdana
}
</STYLE>
<HR>
This email is certified to be Spam free by Spam Marshall<BR>
<P>You don't pay to get spam, why pay to clean it?<BR>Visit <A
class=moz-txt-link-freetext
href="http://www.spammarshall.com">http://www.spammarshall.com</A> to create
an account for free<BR><A href="http://www.spammarshall.com"
target=_blank><IMG
src="http://www.spammarshall.com/SpamMarshall/images/logo-c.gif" border=0>
</A></P>
<HR>
</DIV><BR><BR>Andy Fish wrote:<BR>
<BLOCKQUOTE cite=midwJNjb.275$email***@***.com type="cite"><PRE wrap="">Hi,
Just curious to see if anyone has run lots of separate tomcat instances on
one machine. I currently have 2 which works fine, but I wonder if anyone has
ever done 10? 50?
I'd like to be able to host a number of separate instances of my app on the
same box for evaluation purposes and this seems the easiest way of doing it.
They will not be heavily used, so I guess RAM is the biggest factor.
Unfortunately I am on windows 2000 not *nix, so paging will be an issue.
Any comments would be appreciated
Andy
</PRE></BLOCKQUOTE><BR><FONT face=Arial size=2>Lutus alert!!!! Hey, looks
like SPAM in a signature that advertises a no SPAM product. Is this
signature recursive??<BR>-- <BR>Gary</FONT></BLOCKQUOTE></BODY></HTML>
- 11
- Deployment problem with messge driven beans.When deploying a message driven bean I get the following error. Can
anyone help?
boss-3.0.8/server/default/deploy/TextMDB.jar
14:11:06,681 INFO [EjbModule] Creating
14:11:06,711 INFO [EjbModule] Deploying TextMDB
14:11:06,811 INFO [JMSContainerInvoker] Creating
14:11:06,821 INFO [JMSContainerInvoker] Created
14:11:06,831 INFO [EjbModule] Created
14:11:06,841 INFO [EjbModule] Starting
14:11:06,851 WARN [MessageDrivenContainer]No resource manager found
for jms/QCF
The ejb-jar.xml and jboss.xml is as follows:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>TextMDB</ejb-name>
<ejb-class>com.gbst.socketlistener.TextMDB</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
<?xml version="1.0"?>
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>TextMDB</ejb-name>
<destination-jndi-name>queue/ListenerQueue</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<jndi-name>QueueConnectionFactory</jndi-name>
</resource-ref>
</message-driven>
</enterprise-beans>
</jboss>
Jamie
- 12
- Is i irrational? (was Re: Versionincrementaphobia)In comp.lang.java.advocacy, James Westby
<email***@***.com>
wrote
on Tue, 07 Mar 2006 20:34:56 GMT
<Q7mPf.94623$email***@***.com>:
> Ian Pilcher wrote:
>> James Westby wrote:
>>
>>>What makes you think that i is rational?
>>
>>
>> I'll bite. What do you put after the decimal point?
>>
>
> I don't know, but I imagine that I couldn't write it in closed form. For
> that matter what do you pu in front?
>
> I always assumed that i would be irrational, but maybe it is neither
> irrational nor rational.
An interesting philosophical question. If a number is
rational it can be expressed as p/q, where p and q are
integers, q != 0. Therefore i is not rational.
However, it's not clear whether i is irrational or not,
since irrational also means "not rational", but I for one
would think that an irrational number is real, and i is
not real.
Also, there are at least two different ways of defining
a real number (Dedekind cuts and Cauchy sequences), and
neither can be used for i, since i is not part of the
total real ordering, nor can it be the limit of any sequence of
rationals, even allowing for silly claims such as -1 = 1+2+4+8+... .
(Briefly: if x = 1+2+4+..., then 2*x=2+4+8+... = x-1;
therefore 2*x = x-1 or x = -1, despite all partial sums
of the series being positive. But it's not i.)
On the flip side, though,
http://mathworld.wolfram.com/IrrationalNumber.html simply
defines an irrational number as any number which cannot
be a quotient p/q of two integers, but the definition is a
bit sloppy since it implies irrational numbers have decimal
expansions (though it has real and imaginary parts, which can).
This appears to be a "definitional bug".
It gets bizarre though, as i is an algebraic integer,
and a unit of the algebraic number field. (There are a
lot of units in that field, as opposed to the two units +1
and -1 in the rational field.)
So now we have a non-rational algebraic unit. At this
point it's probably best to head out for a coffee or
tea break as one's brain is probably screaming for aspirin
at this point. :-)
Followups to a slightly more logical discussion area. :-)
>
>
> James
--
#191, email***@***.com
It's still legal to go .sigless.
- 13
- 1376180 CD-R, DVD R, DVD CASES LOWEST PRICE! 13 media4sale.com offers innovative and quality media, CD/DVD packaging and
other computer accessories at the best prices. We pride ourselves in
service, quality and commitment and are certain that our standards will
exceed expectations.
http://www.media4sale.com
<a href="http://www.media4sale.com" target="_blank">Media4Sale.com</a>
- 14
- Tomcat, creating threadsI am trying to do some thread profiling on a website that consists
almost entirely of JSPs. When I create a thread in my application, I
give it a relevant name.
The problem is, I am seeing other threads that are calling my classes.
Are these threads being created by Tomcat?
The "unknown" threads have names like: Thread-17, Thread-18, etc.
I'm not sure, but I think these threads are being created every time my
JSPs try to access a session. Is there any way to tell where these
threads are coming from? Or, if they are being created by tomcat, can
I tell tomcat to name them something different?
Thanks in advance.
- 15
- Jmagick and rotating image.Hello,
I am using Jmagick to manupulate and rotate images. When I rotate an
image, it gets a white color where no image is standing (in the
corners). I already tried with convertImg.setBackgroundColor( new
PixelPacket(100,50,100,200) ); but the whitespaces stay... ...white. I
need to have those areas transparent. I am using
imgInfo.setColorspace( ColorspaceType.TransparentColorspace ); so it
must be possible. can annyone help me with this?
When using imagemagick commandline I get what I need by using -
background none -rotate 10
I hope someone can help me.
thanks,
Erik
|
|
|