 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- what's wrong with this thread?Why is it when i create and add a new thread to a vector, the vector,
instead of adding a new thread, replaces all the old threads with the
a new one.
I know it's hard to understand, just run the code below, you'll see
what i mean.
////////////////////////////////////////////////
import java.util.*;
class ThreadTest
{
static Vector vec = new Vector();
public static void main(String[] args)
{
for (int x=0; x!=10; x++)
{
vec.add(x, new TestTrd(""+x));
((TestTrd)vec.get(x)).start();
System.out.println("------------------------------------");
}
}
}
// the thread
class TestTrd extends Thread
{
static String clientName= null;
public TestTrd(String name)
{
System.out.println("Original value: "+clientName+" <-- should
be null");
clientName = name;
System.out.println(" New Value: "+clientName);
}
public void run()
{
}
}
/////////////////////////////////////////////////////
OUTPUT:
Original value: null <-- should be null
New Value: 0
------------------------------------
Original value: 0 <-- should be null
New Value: 1
------------------------------------
Original value: 1 <-- should be null
New Value: 2
------------------------------------
Original value: 2 <-- should be null
New Value: 3
------------------------------------
Original value: 3 <-- should be null
New Value: 4
------------------------------------
Original value: 4 <-- should be null
New Value: 5
------------------------------------
Original value: 5 <-- should be null
New Value: 6
------------------------------------
Original value: 6 <-- should be null
New Value: 7
------------------------------------
Original value: 7 <-- should be null
New Value: 8
------------------------------------
Original value: 8 <-- should be null
New Value: 9
------------------------------------
Each time you see a "should be null", it should be null, because a new
thread is started.
does anybody know what's going on?
- 1
- Getting access to printDialog attributesI need to print 8 html files. These files are loaded into JEditPanes
which are then passed to a PrinterJob object. It would be nice to query
the user with the print Dialog ( printDialog() ) at the beginning of the
print sequence but not for each successive file. It appears that the
printDialog() sets a series of attributes in the PrinterJob object. My
code, on n+1 documents, sets some attributes, but clearly, not all of
what the printDialog() method sets. And, I have no way of knowing if the
user changes something (such as page orientation, number of copies,etc).
Is there a way to get the full PrintRequestAttributeSet out of the
PrinterJob object so that it can be set for the next print()? I can send
the code if needed, thanks - Lou
- 1
- Hibernate - one-to-many problem/questionsHi all,
DB: MySQL
Hibernate 2.0.1
I have a very simple (one-to-many) relationship between two tables
QUESTIONS ANSWERS
------------------ ----------------------
id: long id: long
text: string qid: long
text: string
qid is foreign key.
In my Question.hbm.xml I have the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="my.Question" table="questions">
<id column="id" name="id" type="long">
<generator class="identity"/>
</id>
<property column="text" length="200" name="text" not-null="true"
type="string"/>
<set name="answers" table="answers" lazy="false">
<key column="qid"/>
<one-to-many class="my.Answer" />
</set>
</class>
</hibernate-mapping>
There is more than one answer for a question always.
What happens is when I load a question with answers I only get one answer
back, though
in the hibernate trace I see the result set returned more answers and
objects were initialized.
What is wrong?
I tried to use list instead of set with id as index column, but result was
N+1 entry. Additional entry was null.
I still don't understand what should I use as an index column in this case.
Please help.
thanks in advance,
Igor
- 3
- javax.net.ssl.SSLException: untrusted server cert chain with FireFoxFor an in-house project, I have a web server (Apache) with a
self-signed certificate. I can access everything via https: just fine.
The reason for wanting https is to add security to the .htaccess
passwords. This all works just fine.
FWIW, I'm using FireFox, and simply added the self-signed certificate.
However, no Java applets will load. I get the following when trying
to load InHouseApp (one of the applets):
load: class InHouseApp not found.
java.lang.ClassNotFoundException: javax.net.ssl.SSLException:
untrusted server cert chain
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
[rest deleted]
I have complete access to the various client machines (both desktops
on the lan, and laptops that will be out in the wild). What do I need
to add to prevent this exception? Also, as certificates aren't my
strong suit, are there any step-by-step detail instructions on what to
do?
TIA
- 6
- Component requirement
"David McCallum" <email***@***.com> ha scritto nel
messaggio news:q3ooc.4353026$email***@***.com...
> I'm looking for JTextField with a (...) button to the left of it, the idea
> being a user can type something, the press the button and possibly use
what
> was typed in a method. The only thing I can think off calling it is
> ButtonEdit, then name used in Delphi
>
In the button_ActionListener you use yourJTextField.getText() to retrieve
the text present in it.
public void button_ActionListener(ActionEvent e){
String s=yourJTextField.getText();
//do whatever you need to do with 's'
}
- 9
- Capturing web camera video streamHello gurus,
Does java have a standard support of web cameras? I'm interested in
capturing the video stream coming from my webcam using J2SE if this is
possible.
Thanks gurus.
- 9
- Problem with loading an image to a PanelSalutations everybody. I want to load an image into a panel. I have
sub-classed the JPanel class in order to be able to override the pain
method, like this :
public class ImageCanvas
extends JPanel {
Image image;
public ImageCanvas() {
super();
this.setBackground(Color.white);
}
public void paint(Graphics g) {
if (image!=null)
{
g.drawImage(image, 0, 0, this);
}
}
public void SetImage(Image img)
{
image = img;
int iW = Math.min(image.getWidth(this),this.getWidth());
int iH = Math.min(image.getHeight(this), this.getHeight());
this.setSize(iW>>1,iH>>1);
//this.setSize(image.getWidth(this)>>1,image.getHeight(this)>>1);
setVisible(true);
this.repaint();
}
Now I use this code in order to load my image into a normal jPanel :
(this is the snippet of code that executes loading the image :
//Display images
Image img =
Toolkit.getDefaultToolkit().createImage(strFilePath);//strFilePath of
course contains the path where the "image.png" is located
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(img, 0);
try
{
tracker.waitForAll();
}
catch (InterruptedException exI)
{
System.out.println("Error while waiting tracker"+
exI.getMessage());
}
jCanvas.setMaximumSize(jPanelImg.getSize());
jCanvas.SetImage(img);
jPanelImg.revalidate(); //jPanelImg (type = JPanel) contains
jCanvas which is of type //ImageCanvas
jPanelImg.repaint();
However, when I use this program it loads the image all right but the
background is full of trash. Also if I try to load multiple images
then they all get jumbled together...
How can I clean this up ?
Thanx alot !
Pascal
- 9
- Accumulated CACMs (since 1966) Considered Dangerous: you want? (free,OfCourse)Newsgroups: comp.unix.solaris,comp.unix.shell
Subject: Accumulated CACMs (since 1966) Considered Dangerous: you want?
Summary:
Followup-To:
Distribution:
Organization: PANIX -- Public Access Networks Corp.
Keywords:
Cc:
(This is via crosspost -- is faster, easier for me,
this late; also, all responses visible to me.
(and, with any luck, you'll see it only ONCE, in ONE
group -- the *first* one in which you see it)
BE NICE -- DON'T REPLY VIA THE NEWS-GROUP --
please do it ONLY via EMAIL --
ie, lets keep this crosspost to a SINGLE-article thread.
thanks!)
Yes, dangerous -- I've been informed -- dangerous to the
continued existence in house of *other* publications.
Feeling a little queasy about getting rid of these things,
especially the ones up through, say, 1980 (when cacm
went to hell?) -- anyway, tomorrow is recycled-paper
pickup day, at maybe 8am they come by with garbage truck --
Anyone want?
You'd have to come by and pick them up yourself.
This is New Rochelle, NY, right on US 95, exit 16,
maybe 5 miles north of the Bronx.
Interested?
BETTER ACT RIGHT NOW!
If you do reply, please include YOUR PHONE NUMBER.
Thanks,
David Combs
- 9
- Calling java from the command-line: 40 timesMy company has an ETL that runs 40 'threads', and does logic similiar
to a Java object I have created. I am trying to convince them to call
my code instead (from the 40 threads) so we only maintain one code
base (a BIG issue).
My concern? Sinc eit is a command line program, not a service, each
'call' will start in it's own JVM - correct? so this machine will
have 40 JVM's running at the same time? Do I need to be concerned?
What issues am I not considering? The machine is a Solaris box with
96G of memory and 28 processors. How much overhead does a sinlge JVM
need?
- 10
- Scrolling JPopupMenu"bdinmstig" wrote:
> Actually I'm not surprised because every other post I've seen asking
> about scrolling a JPopupMenu got no replies, either.
So why do yo go on our nerves? Do you think your problem is so
important?
> Which begs the question, is there in fact NO solution?
There is. You start from scratch with a JComponent and implement
everything from groud up. Painting, event handling, everything. Have
fun.
- 10
- Diablo 1.3.1 JVM runs out of file descriptors at 1021I'm using the Diablo 1.3.1 JVM package from www.freebsdfoundation.org on a
4.9-STABLE machine and it unfortunately seems to exhibit the bug described at:
http://developer.java.sun.com/developer/bugParade/bugs/4189011.html
interestingly enough, the linux 1.3.1_02 JVM under a 4.6-STABLE machine does
not exhibit the problem.
Is there an updated Diablo (diablo-jdk-noplugin-1.3.1.0 Java Development Kit
1.3.1 is what I'm running) that has this fixed or is my only recourse, other
than compiling from source, to run under linux emulation?
On the Diablo JVM machine (test.java is the program suggested in the bug
report):
nine[ttyp2]:aditya~> /usr/local/diablo-jdk1.3.1/bin/java test 3000 1 1 test
Starting 1078434190431
Opened test0000001020.tst Thread: 0
test0000001021.tst (Too many open files) java.io.FileNotFoundException:
test0000001021.tst (Too many open files)
Aborting 1078434221065
nine[ttyp2]:aditya~> /usr/local/diablo-jdk1.3.1/bin/java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.3.1-0)
Classic VM (build diablo-1.3.1-0, green threads, nojit)
nine[ttyp2]:aditya~> limit
cputime unlimited
filesize unlimited
datasize 524288 kbytes
stacksize 65536 kbytes
coredumpsize unlimited
memoryuse unlimited
vmemoryuse unlimited
descriptors 11095
memorylocked unlimited
maxproc 5547
sbsize unlimited
And the following on a 4.6-STABLE machine running a 1.3.1_02 JVM under linux
emulation (linux-jdk-1.3.1.02_1 Sun Java Development Kit 1.3 for Linux):
two[ttyp2]:aditya~> java test 3000 1 1 test
Starting 1078434145154
Closing 1078434235337.tst Thread: 0
two[ttyp2]:aditya~> java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Classic VM (build 1.3.1_02-b02, green threads, nojit)
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 10
- IllegalAccessError with axis and wsseHello,
Complete java newbie here. I am trying to set up a client for the web
service described at:
https://thefinder.tax.ohio.gov/StreamlineSalesTaxWeb/WebService/About.aspx
I am using JDK 1.4.2 on AIX 5.3. I downloaded the axis 1.4 and axis-
wsse 1.0 packages,
and all included jar files are in the CLASSPATH.
Right now I am just trying to get the sample "TestClient.java" program
provided on the above web page to work. So far, everything seems to
compile ok. However, trying to run the TestClient program produces
the error:
Exception in thread "main" java.lang.IllegalAccessError:
net.vitale.filippo.axis
.handlers.WsseClientHandler tried to access field org/apache/axis/
handlers/Basic
Handler.log from class
at
net.vitale.filippo.axis.handlers.WsseClientHandler.invoke(WsseClientH
andler.java:92)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:
121)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at
gov.ohio.tax.thefinder.OHFinderService.OHFinderServiceSoapStub.getOHS
alesTaxByZipCode(OHFinderServiceSoapStub.java:272)
at TestClient.main(TestClient.java:13)
Anyone out there familiar with setting up axis and logging? What is
the trick I am missing here? I am not running an application server,
just trying to set up a client for a remote web service.
Thanks.
---Hillel
- 11
- JavaMail send mail without using default port 25Hi,
I must send email to a server that listen in port 2025,
how I can do it using JavaMail??
Thank to all.
Nicola Trevisan
PS: I insert my code so you can tell me where to place new code.....I hope
props = System.getProperties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "127.0.0.1");
session = Session.getDefaultInstance(props);
in = new FileInputStream(file);
msg = new MimeMessage(session, in);
msg.setFrom(new InternetAddress("email***@***.com"));
msg.setRecipient(Message.RecipientType.TO, new
InternetAddress("email***@***.com"));
transport = session.getTransport();
transport.send(msg);
- 12
- session attribute copied to new sessionI want to use session attributes to save info on a user who wants to
navigate my site. When the user logs in I use:
HttpSession sess = request.getSession(true);
sess.setAttribute("customer", customer);
where customer is an object I have instantiated earlier. This works
fine and I can view values from this object using the following code
in index.jsp:
CustomerBOImpl cust = null;
if(session.getAttribute("customer") != null){
cust = (CustomerBOImpl)session.getAttribute("customer");}
out.println(cust.getFname());%> <%out.println(cust.getLname());
This prints out the first name and last name just fine. The problem
comes when someone else tries to access the same index.jsp. It opens
up the page, gives them a separate session ID, but this different
session contains the same customer object of the last person who
logged in.
My question is: What is the proper manner to set session attributes
and then retrieve them in a JSP servlet?
- 15
- Can't Call Methods in Class Created W/ ReflectionI am testing a class that I'll need later. I need to be able to load one of
a number of classes that all implement a particular interface, then call 3
methods in them. When I run the test class, I get the same error
(indicated in comments below). I've gone over this several times and
compared it with tutorials online, but I can't find my error (which, the
way my brain works, means it's probably something simple and obvious and
I'm just to caught in it to see what's wrong).
The code for the calling class and the called class are below.
Thank you for any help!
Hal
-------------------------------------------------------
Calling class (ldt):
import java.io.*;
import java.lang.reflect.*;
public class ldt {
int iCount, iLimit;
int iSet = 0, iGet = 0, iProcess = 0;
String dirConf, dirProcess, sName, setFile, RDFile, MMFile;
String[] fList;
public static void main(String[] args) {
ldt l = new ldt();
l.dostuff();
}
public ldt() {
}
public void dostuff() {
int i;
String sTemp = "LDRDMod000";
Class cSearch = null;
Object oSearch = null;
Method[] oMethod = null;
Method mSet = null, mGet = null, mProcess = null;
try {
cSearch = Class.forName(sTemp);
} catch (Exception e) {
System.out.println("Error: Could not find class: "+sTemp+", Error: "+e);
return;
}
oMethod = cSearch.getMethods();
try {
mSet = cSearch.getMethod("set", new Class[] {String.class,
String.class});
mGet = cSearch.getMethod("get", new Class[] {String.class});
mProcess = cSearch.getMethod("process", new Class[] {});
} catch (Exception e) {
System.out.println("Error with getting method. Exception: "+e);
}
try {
oSearch = (Object) cSearch;
Object[] aInput = new Object[] {(String) "one", (String) "two"};
Object o = mSet.invoke(cSearch, aInput);
//Line above seems to be what always causes error, printed below. Error is
//always: "java.lang.IllegalArgumentException: object is not an instance of
//declaring class"
} catch (Exception e) {
System.out.println("Error: Set Value: "+e);
return;
}
return;
}
}
Here is the called class that I'm trying to instantiate through reflection
(LDRDMod000):
import java.io.*;
import java.util.HashMap;
public class LDRDMod000 implements LDRDMod {
String sName = "", sStreet = "", sCity = "", sState = "", sZip = "";
HashMap hData = new HashMap();
LDConfig sysConfig;
public LDRDMod000() {
}
public void set(String sKey, String sVal) {
hData.put(sKey.toLowerCase(), sVal);
return;
}
public String get(String sKey) {
String sVal = (String) hData.get(sKey.toLowerCase());
return sVal;
}
public void process() {
String sIn = get("filename");
String sOut = sIn.substring(0, sIn.indexOf(".RD")) + ".MM";
File outFile = new File(sOut);
if (!outFile.exists()) {
File inFile = new File(sIn);
// inFile.renameTo(outFile);
}
set("filename", sOut);
return;
}
}
|
| Author |
Message |
Brendan Guild

|
Posted: 2005-9-29 16:22:00 |
Top |
java-programmer, Artificial Intelligence
Roedy Green <email***@***.com> wrote in
news:email***@***.com:
> On Wed, 21 Sep 2005 13:11:14 GMT, "JS" <james.sarjeant90
@ntlworld.com>
> wrote or quoted :
>
>>But we can fake Intelligence by using hard coded if statements,
[snip]
> I suspect living organisms are the same way. These high level
> attributes we use to describe humans and their thoughts are just
> patterns of low level flow. There is nothing in there directly that
> controls them on that level.
Exactly, there is nothing fake about hard coded if statements, unless
you want to call everything that is manmade fake.
The problem with hard coded if statements as an implementation of
intelligence isn't fakeness, it is quality. Unless there are a huge
number of if statements, you're going to notice pretty quick that this
intelligence isn't thinking very deeply on a Turing test. It is
practically impossible to make a good intelligence that way. You would
probably need billions or trillions of 'if's to make something like a
human. At the very least you would need to use a computer to write that
program for you, which is totally violating the spirit of hard coded if
statements.
|
| |
|
| |
 |
Brendan Guild

|
Posted: 2005-9-29 16:22:00 |
Top |
java-programmer >> Artificial Intelligence
Roedy Green <email***@***.com> wrote in
news:email***@***.com:
> On Wed, 21 Sep 2005 13:11:14 GMT, "JS" <james.sarjeant90
@ntlworld.com>
> wrote or quoted :
>
>>But we can fake Intelligence by using hard coded if statements,
[snip]
> I suspect living organisms are the same way. These high level
> attributes we use to describe humans and their thoughts are just
> patterns of low level flow. There is nothing in there directly that
> controls them on that level.
Exactly, there is nothing fake about hard coded if statements, unless
you want to call everything that is manmade fake.
The problem with hard coded if statements as an implementation of
intelligence isn't fakeness, it is quality. Unless there are a huge
number of if statements, you're going to notice pretty quick that this
intelligence isn't thinking very deeply on a Turing test. It is
practically impossible to make a good intelligence that way. You would
probably need billions or trillions of 'if's to make something like a
human. At the very least you would need to use a computer to write that
program for you, which is totally violating the spirit of hard coded if
statements.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-9-29 17:02:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 29 Sep 2005 08:22:23 GMT, Brendan Guild <email***@***.com> wrote
or quoted :
> 'if's to make something like a
>human.
unless by human you mean "Jerry Springer guest".
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
Aki Laukkanen

|
Posted: 2005-9-29 17:08:00 |
Top |
java-programmer >> Artificial Intelligence
Roedy Green wrote:
> On Thu, 29 Sep 2005 08:22:23 GMT, Brendan Guild <email***@***.com> wrote
> or quoted :
>
>
>>'if's to make something like a
>>human.
>
>
> unless by human you mean "Jerry Springer guest".
I don't think a construct of two or three if- or switch-case -statements
would qualify as a "human".
--
-Aki "Sus" Laukkanen
|
| |
|
| |
 |
Oliver Wong

|
Posted: 2005-9-29 22:25:00 |
Top |
java-programmer >> Artificial Intelligence
"Roedy Green" <email***@***.com> wrote in
message news:email***@***.com...
>
> People with a
> straight face tell me fish and turtles are not conscious and cannot
> feel pain even though the behave quite similarly to mammals when
> skewered. How the hell could they know one way or the other?
It depends on your definition of pain. If you define pain as "an
unpleasant sensation felt by humans", then of course, no other animal can
feel "pain" under this definition.
There's a "widely accepted" definition of pain which basically says
vertebrates can feel "pain", but invertebrates can't. It has to do with
nociceptors, which are free nerve endings of neurons that have their cell
bodies outside of the spinal column. It is believed that the sensation of
pain only occurs when these nociceptors are excited and send signals up the
spine. There are no nociceptors in the brain itself, to merely having a
brain is "not sufficient" to feel "pain". Since invertebrates don't have
nociceptors, they are believed to not feel "pain".
As for an argument against behaving-similarly-when-skewered, a recently
dead human body may also behave similarly when skewered via muscle
contractions from the stimuli, but most people believe that dead humans
don't feel pain (of course, how can we know for sure?)
- Oliver
|
| |
|
| |
 |
Oliver Wong

|
Posted: 2005-9-29 22:33:00 |
Top |
java-programmer >> Artificial Intelligence
"Brendan Guild" <email***@***.com> wrote in message
news:email***@***.com...
> Roedy Green <email***@***.com> wrote in
> news:email***@***.com:
>
>> On Wed, 21 Sep 2005 13:11:14 GMT, "JS" <james.sarjeant90
> @ntlworld.com>
>> wrote or quoted :
>>
>>>But we can fake Intelligence by using hard coded if statements,
>
> [snip]
>
>> I suspect living organisms are the same way. These high level
>> attributes we use to describe humans and their thoughts are just
>> patterns of low level flow. There is nothing in there directly that
>> controls them on that level.
>
> Exactly, there is nothing fake about hard coded if statements, unless
> you want to call everything that is manmade fake.
>
> The problem with hard coded if statements as an implementation of
> intelligence isn't fakeness, it is quality. Unless there are a huge
> number of if statements, you're going to notice pretty quick that this
> intelligence isn't thinking very deeply on a Turing test. It is
> practically impossible to make a good intelligence that way. You would
> probably need billions or trillions of 'if's to make something like a
> human. At the very least you would need to use a computer to write that
> program for you, which is totally violating the spirit of hard coded if
> statements.
The more major problem with hardcoded if statements, I think, is that
they are not capable of learning. The human mind has memory, and is
self-modifying (i.e. new neural connections can be made, and old ones can be
disconnected). With a finite number of if statements, you could "fake"
learning for any finite number of years (80 years? 800 years? 8 trillion
years?), but with an actual neural network, in principle, it could go on
learning forever, and eventually differ from its "equivalent" if-statement
construct.
It's like the difference of expressive power between a finite state
automata and an infinite-state automata.
- Oliver
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-9-30 0:23:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 29 Sep 2005 14:25:14 GMT, "Oliver Wong" <email***@***.com>
wrote or quoted :
> As for an argument against behaving-similarly-when-skewered, a recently
>dead human body may also behave similarly when skewered via muscle
>contractions from the stimuli, but most people believe that dead humans
>don't feel pain (of course, how can we know for sure?)
That is as similar argument to the ones that define humans as the only
intelligent species by positing human intelligence as the only valid
kind.
From an Darwinian point of view, humans are way down there. We will be
one of the shortest lived experiments. Even a chimp knows better than
to shit in its nest. We take huge risks daily with survival of the
entire species.
My great hope is that AI will be more sensible than humans are, and
will tame us before we kill ourselves off. Once AI reaches the point
it starts controlling its own evolution it will leave us in the dust
literally overnight. We will awake to a whole new world, hopefully
free of XML and JavaScript.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
Oliver Wong

|
Posted: 2005-9-30 5:20:00 |
Top |
java-programmer >> Artificial Intelligence
"Roedy Green" <email***@***.com> wrote in
message news:email***@***.com...
> On Thu, 29 Sep 2005 14:25:14 GMT, "Oliver Wong" <email***@***.com>
> wrote or quoted :
>
>> As for an argument against behaving-similarly-when-skewered, a
>> recently
>>dead human body may also behave similarly when skewered via muscle
>>contractions from the stimuli, but most people believe that dead humans
>>don't feel pain (of course, how can we know for sure?)
>
> That is as similar argument to the ones that define humans as the only
> intelligent species by positing human intelligence as the only valid
> kind.
I don't see the similarities. The argument I gave can be abstracted to:
* It is widely believed that recently deceased humans do not feel pain.
* Recently deceased humans also react about when skewered (this being
explained as a responce of muscle tissue to stimuli)
* Therefore, if a given entity reacts when skewered, it is not enough to
prove that that entity is feeling pain.
An alternative argument which is similar to the above one:
* It is widely believed that rocks and other minerals do not feel pain.
* It is possible to construct a object using only rocks and other
minerals such that when it is skewered, it thrashes about and makes loud
noises, and then slowly stops, gradually losing energy.
* Therefore, if a given object thrashes about and makes loud noises when
skewered, and gradually stops, that is not sufficient to prove that said
object felt pain.
I don't see how these arguments resemble "proof by definition", which is
what it sounds like you are comparing them to. They're more like "proof by
counter-example" (first one) or "proof by construction" (second one).
- Oliver
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-9-30 14:13:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 29 Sep 2005 21:20:24 GMT, "Oliver Wong" <email***@***.com>
wrote or quoted :
>I don't see the similarities.
Here is another way to approach what I am trying to say. I understand
the eye has independently evolved at least 8 different times in
evolution.
If you study the eye's fine structure and mechanisms in just one
species, you can't necessarily extrapolate your findings to all the
others.
In a similar way I suspect "pain" could have evolved multiple times in
evolution. There may be a great many different mechanisms that all
have the same basic purpose. So again a discovery about how pain
works in only one species should not be blanket extrapolated to all
other species, especially when doing so seems primarily to justify
cruelty and exploitation.
There is a penalty to be paid for being too kind to a rock and a
penalty to be paid for being too cruel to a whale. I am far more
concerned about making the second error than the first.
Baumhertzig
There was a German Christian who lived in the 1900s in Stadtsteinach
in Germany named Gottfried M黮ler. Some called him a saint. He
arranged homes for orphans around the world. He suggested the key to
transforming earth from hell to heaven lay in tiny acts of compassion,
for the lowest of the low, e.g. even earthworms, done in secret.
揧ou must behave as if your every act, even the smallest, impacted a
thousand people for a hundred generations. Because it does.?
~ Gottfried M黮ler
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
jonck

|
Posted: 2005-10-3 19:26:00 |
Top |
java-programmer >> Artificial Intelligence
You might want to take a look at the WEKA project:
http://www.cs.waikato.ac.nz/~ml/
It has, among other machine learning algorithms, a neural network
implementation and it's in Java.
|
| |
|
| |
 |
jonck

|
Posted: 2005-10-5 8:07:00 |
Top |
java-programmer >> Artificial Intelligence
> My next challenge is where to start.
Here is a great place to start:
http://www.gamasutra.com/features/19970801/pathfinding.htm
You need to register, but it's free.
Another great URL is:
http://www.policyalmanac.org/games/aStarTutorial.htm
This handles the A* algorithm, which is truly the star of path-finding
algorithms. But if you're new to this, you'll probably want to tangle
with simpler path-finding algorithms first, which the first URL offers.
Then, when path-finding is second nature to you, head over to:
http://www.cs.waikato.ac.nz/ml/weka/
which offers all sorts of machine learning algorithms, in Java
(including neural nets).
Kind regards, Jonck
|
| |
|
| |
 |
JS

|
Posted: 2005-10-5 16:00:00 |
Top |
java-programmer >> Artificial Intelligence
"Roedy Green" <email***@***.com> wrote in
message news:email***@***.com...
> On Tue, 20 Sep 2005 22:13:42 GMT, "Oliver Wong" <email***@***.com>
> wrote or quoted :
>
> > I believe a fruit fly has about 250,000 neurons, and even this will
be
> >quite a struggle to simulate.
>
> I met a guy named Bernie Till who did his master's thesis back in the
> early 90s doing a simulation of a nematode -- a tiny white worm. It
> had something like 149 neurons. What blew me away is the simulation
> was able to demonstrate all known activities of the nematode from
> finding mates to food to avoiding chemicals, to the way it moved. This
> is amazingly compact coding -- all this with a mere 149 neurons!
> He said the secret was in the S function each neuron implements.
> --
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Again taking new Java programming contracts.
What was in the S function?
|
| |
|
| |
 |
Oliver Wong

|
Posted: 2005-10-6 4:31:00 |
Top |
java-programmer >> Artificial Intelligence
<email***@***.com> wrote in message
news:email***@***.com...
>> My next challenge is where to start.
>
> Another great URL is:
> http://www.policyalmanac.org/games/aStarTutorial.htm
>
> This handles the A* algorithm, which is truly the star of path-finding
> algorithms. But if you're new to this, you'll probably want to tangle
> with simpler path-finding algorithms first, which the first URL offers.
I actually wanted the OP to try and solve the problem him/herself first
before introduce him/her to A*. For the benefit of those who don't know, A*
is considered the "best" general purpose path finding algorithm; so much so
that very little further research is done in path finding after A*'s
discovery.
- Oliver
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-10-6 5:56:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 22 Sep 2005 09:06:36 GMT, "JS" <email***@***.com>
wrote or quoted :
>
>So to solve the problem in computing terms we need to write a computer which
>has a few hard coded rules to get it started.
Look how we train humans. Mom first tells you "never go in the
street". Or we tell newbie coders "never use public members".
When the student eventually feels confident he understand the REASONS
for the rule of thumb, then he is in a position to discover instances
where it might make sense to violate it.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-10-6 15:06:00 |
Top |
java-programmer >> Artificial Intelligence
On Wed, 05 Oct 2005 08:00:21 GMT, "JS" <email***@***.com>
wrote or quoted :
>What was in the S function?
The paper was over my head. But I do recall him saying that the
secret of the nematode's intelligence is not the wiring of the
neurons, but the parameters of the S functions that control their
firing.
I remember the diagrams of them looking like S curves you get in
titration.
Think about it. Imagine how much Java code you would have to write to
simulate ALL the behaviours of a small worm. Yet the worm does it
with 140 odd neurons, a hard-wired set of connections, and
parameters to some S functions for the neurons.
Bernie's simulated S-function worm mimics the worm and exhibited all
the behaviours. That demonstrates the power of worm programming skill.
It also suggests that we are playing with only a small subset of
reasonable coding techniques.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
Oliver Wong

|
Posted: 2005-10-6 23:54:00 |
Top |
java-programmer >> Artificial Intelligence
"Roedy Green" <email***@***.com> wrote in
message news:email***@***.com...
> On Wed, 05 Oct 2005 08:00:21 GMT, "JS" <email***@***.com>
> wrote or quoted :
>
>>What was in the S function?
>
> The paper was over my head. But I do recall him saying that the
> secret of the nematode's intelligence is not the wiring of the
> neurons, but the parameters of the S functions that control their
> firing.
>
> I remember the diagrams of them looking like S curves you get in
> titration.
It just occured to me that what your friend calls an "S function" might
be what I call a "sigmoid function". As can be seen in this random diagram I
found in google, the graph of a sigmoid function does vaguely look like an
S: http://www.gisdevelopment.net/aars/acrs/2000/ts9/images/imgp0001a.jpg
If my assumption that S refers to sigmoid is indeed correct, then when
the friend said that the "secret was in the S function", what they meant was
that the "secret" was the fact that an S function was being used at all.
It's a "secret" in the sense that people who haven't studied much AI are
astonished when they find out how simple neural networks are.
The neurons in a neural net can essentially be connected randomly; it
really doesn't matter. As long as each neuron implements a sigmoid function
with some sort of feedback so that it can learn to adjust the the parameters
to the function, the neuron by itself can learn some surprisingly
sophisticated relationships between input and output. Put 149 of those
neurons together, and you get something about as smart as a worm. It's
really that simple.
- Oliver
|
| |
|
| |
 |
JS

|
Posted: 2005-10-7 2:30:00 |
Top |
java-programmer >> Artificial Intelligence
"Roedy Green" <email***@***.com> wrote in
message news:email***@***.com...
> On Thu, 22 Sep 2005 09:06:36 GMT, "JS" <email***@***.com>
> wrote or quoted :
>
> >
> >So to solve the problem in computing terms we need to write a computer
which
> >has a few hard coded rules to get it started.
>
> Look how we train humans. Mom first tells you "never go in the
> street". Or we tell newbie coders "never use public members".
>
> When the student eventually feels confident he understand the REASONS
> for the rule of thumb, then he is in a position to discover instances
> where it might make sense to violate it.
> --
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Again taking new Java programming contracts.
So are you saying that writing hard coded if statments isnt a good way to go
about it unless we can decide which situations require which actions?because
if we only have one statement that was written when we were told not to go
into the street then we would never cross the road so we have to have two
actions and decide which one is sensible to use in that situation
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-10-9 7:47:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 06 Oct 2005 15:54:26 GMT, "Oliver Wong" <email***@***.com>
wrote or quoted :
>The neurons in a neural net can essentially be connected randomly; it
>really doesn't matter. As long as each neuron implements a sigmoid function
>with some sort of feedback so that it can learn to adjust the the parameters
>to the function, the neuron by itself can learn some surprisingly
>sophisticated relationships between input and output. Put 149 of those
>neurons together, and you get something about as smart as a worm. It's
>really that simple.
That sounds like what he said. He might even have used the term
sigmoid. I just remember seeing the graphs. This was back in the
early 90s.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-10-9 7:50:00 |
Top |
java-programmer >> Artificial Intelligence
On Thu, 06 Oct 2005 18:29:35 GMT, "JS" <email***@***.com>
wrote or quoted :
>So are you saying that writing hard coded if statments isnt a good way to go
>about it unless we can decide which situations require which actions?because
>if we only have one statement that was written when we were told not to go
>into the street then we would never cross the road so we have to have two
>actions and decide which one is sensible to use in that situation
All I am saying is if statement style rules of thumb can be used
without any understanding WHY you should follow the rules. As a child
you don't need to have a traffic model to apply them. Later, once you
understand acceleration, mass, traffic, drunk drivers etc etc. you can
dispense with the rules of thumb and use your own internal modeling
which will sometimes tell you it is safe when the rules of thumb
predict danger and vice versa.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
JS

|
Posted: 2005-10-24 17:01:00 |
Top |
java-programmer >> Artificial Intelligence
Hi all.
Does anyone happen to have the thread about Artificial Intelligence saved
anywhere or can they tell me where I can get it because I was saving it for
a rainy day so to speak but last night I had to reinstall my OS and lost it.
It was the one that started with a simple question about Java and AIML and
ended up as a deep, almost philosophical, chat about AI and ways to
implement it etc.
Thanks in advance
JS
|
| |
|
| |
 |
Roedy Green

|
Posted: 2005-10-24 17:33:00 |
Top |
java-programmer >> Artificial Intelligence
On Mon, 24 Oct 2005 09:01:29 GMT, "JS" <email***@***.com>
wrote, quoted or indirectly quoted someone who said :
>Does anyone happen to have the thread about Artificial Intelligence saved
>anywhere or can they tell me where I can get it because I was saving it for
>a rainy day so to speak but last night I had to reinstall my OS and lost it.
>It was the one that started with a simple question about Java and AIML and
>ended up as a deep, almost philosophical, chat about AI and ways to
>implement it etc.
>Thanks in advance
if you remember the group it was in or some keywords, you can go to
groups.google.ca which archives old postings.
group:comp.lang.java.help
selects the group.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- jboss and Workflow??I'm work with Jboss, and I'd use Workflow on Jboss server. Is Anyone working about this problem? Can anyone give me a tutorial or an example???
- 2
- web search with summarized results, good for wireless, too.We just released a wireless search service. The wireless search
service takes the results returned by Google and gives key points of
the resulting web sites. The short key points are suitable for viewing
on wireless devices.
Check it out at:
http://www.netosprey.com
The following is an example of www.sun.com:
-----
You entered: http://www.sun.com/
Link to Text ratio: 453/914=0.49562363238512036
AME finds this page has a lot of links.
It could be an index page and talks about: Java, Sun, System,
Computing, and Products
Here is a list of main ideas presented in the page:
*** Sun's Big Web Event - Don't miss Network Computing 03-Q4 on
December 3 at 8 am PST. Sign up for an e-mail reminder today.
*** Choice on a grand scale. - Sun extends product line through
strategic alliance with AMD; plans to offer high-performance x86
systems at affordable prices.
*** The identity management leader. - Sun's planned acquisition of
Waveset aims to inject the Java EnterpriseSystem with superior network
identitycapabilities.
*** Sun Signs Agreement with CSSC - Java Desktop System to be
established as the foundation for China's fast-growing IT industry.
*** Contact |Company Info |Employment |Privacy |Terms of Use
|Trademarks
-----
Check it out at:
http://www.netosprey.com
Steve
- 3
- question about keeping the GUI and logic separateHello,
I have a question about keeping logic/processing code off of the GUI.
In a couple of other languages I'm familiar with, there is usually a
method called FindComponent which will iterate through a form and get
the component matching the name in the argument.
For example, in VS.NET lets say I have a grid (table) on a form, the
form represents one class. I then put the code for getting and
processing data in another class. After any processing occurs (and
the results are placed in a dataset), I need to bind the dataset to
the grid. But the grid doesn't have knowledge of where the dataset
came from... so how does the data get shoveled in there?
In the data processing class, there's a local variable of grid type
and it's gets bound to the grid in the form, like so (sorry about the
VB):
Class SomeClass
Sub doSomething(ByVal c As Component)
Dim localGridView as GridView
Dim localDataSet as DataSet
' MyGrid lives on Form1
localGridView = c.FindComponent("MyGrid")
localGridView.DataSource = localDataSet
' So even though the GUI hasn't a clue as to what is going on, the
current data is now displayed to the user.
localGridView.DataBind()
End Sub
End Class
Does Java have an equivalent of FindComponent, or a something similar
to the code snip above?
I'm using Java 6 here. I did try looking at c.getComponent() but
there's only one valid index... 0 and it represents the
javax.swing.JRootPane. Anything after 0 throws an index out of bounds
error. There are 3 JButtons and 1 JList on the panel. I want to add
some strings to the JList...
public class MyGUI() extends JFrame
{
GUIUtils u = new GUIUtils();
public MyGUI()
{
//
// snip
//
myButton.addActionListener (new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
try
{
u.doSomething(MyGUI.this);
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
});
}
and...
public class GUIUtils
{
public void doSometing(Container c) throws IOException
{
listModel = new DefaultListModel();
listModel.addElement(value);
// I want to put the listmodel in the JList now but how do I get
this code to know about the JList in MyGUI?
}
}
Suggestions are greatly appreciated.
Thanks!
- 4
- servlet calling servlet stopped by securityI have two servlets in the same tomcat webapp (A and B) both normally
accessed from the web. Sometimes A needs to access B and I use http to
do that. Actually 'B' is about a dozen other servlets, still all in
the same webapp.
This works just fine until I turn on security constraints. When I do
that and request A the login form works as normal and invokes A
correctly. But when A needs to invoke B I get another logon form
instead of B. This would be okay, I can hack through that, but I only
know the user name, not the password for A's session.
Is there a simpler way to have one servlet in the same webapp invoke
another without having to go through security? I cannot just do java
to java, there are too many entry points (ie cases of 'B') They are
all volatile and need to be exposed to the web.
Thanks for your help
Roger
- 5
- Making hand Hand Held Devices Easier to UseMy partner comes to me every once in a while utterly flummoxed by some
hand held device for example a cell phone, a wall phone, a stereo, an
alarm clock (no kidding -- this beast is quite an intimidating device
it has over 20 buttons), and lately a digital tape recorder.
The problem is these devices have ten thousand features. All she
wanted to do was place a cell phone call or record a telephone
interview. The other features just got in the way.
There are two problems:
1. The other features distract from the basics. There are two many
buttons and too many menu items.
2. The devices have modal traps. Even if you know how to do the
simple operations, it is easy to hit the wrong button, get off in the
weeds and not know how to navigate the device back to a familiar
state.
Imagine a cellphone I could hand to my 4 year old grandson and say
"hit 7 to call me, hit 8 to call your mother, hit the red button for
an emergency" Nothing else the child could do would hurt or confuse
the phone.
Imagine I cellphone I could give to my mother. I say "When you want
to call make a call, hit the call button, use the up down arrows to
select a person from your friends list. If you get to the bottom and
it still not there, choose new person, and they will automatically be
added to the end of your list, but will drop off automatically
eventually if you don't call them.
Imagine a digital tape recorder I could give to a child. I restrict it
so that there are only buttons, record, play, fast forward, rewind.
you can't overwrite anything recorded. There is no erase button.
Imagine a PDA that starts allowing only the simplest functions.
Everything else is hidden. Once you have used and apparently mastered
those functions it offers to teach you yet another function. You can
decline or ask to lean something else. It never reveals too much of
its functionality at a time. It remembers the learning state of
several users.
A few other ideas for hand helds:
1. AC power outlets should have a DC jack built into the wall plate
using some new style plug that delivers a variety of voltages. The
tips of the prongs would receive 12, the base 1.5 with perhaps bands
for 9, 6, 3 in between. The plug on the device would normally only
tap just one voltage, but it would be free to tap all 5. There would
be no matching problem. One plug fits all. It would relieve the
clutter of ac adapters in the typical home office.
2. could it be possible to have a universal charging stand so that you
can wall mount it and put any device in it for a recharging by
induction. Another feature of the charging stand is it would also
tell and device in it the latest accurate atomic time. You could then
create a "wand" you recharge with the correct time then wave at the
microwave or any other non-portable device to update its clock.
3. Could every product be given a UPC number or equivalent so that you
can find an online manual for any device without fuss. Software too
should get such numbers so you can automatically track the latest
version, the replacement or the author. Software then could keep
track of your possessions (software and otherwise) and periodically
poll for a recall message, an important update etc.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
- 6
- Integrating servlet container into my stand alone AppHello Everyone,
I had this idea for an application I would like to write. I want
to write it as a java application, but be able to output
program-generated .html into an Internet Explorer window. Sending the
generated html to the IE window is easy... just using the Runtime
class. But I want the Internet Explorer window to be able to make http
calls back to my application for form submissions. I didn't want to
have to force my users to install Tomcat just so the internet explorer
could pass back information to the servlet in my .Jar file.
How hard is it to add a servlet container and respond to http post's
from the localhost internet explorer window? This is all from my .jar
file and not from a web application running under tomcat remember. The
only http requests coming into my application will be from that one
internet explorer window... so its really acting like a
single-user-local-machine Tomcat server. But I dont want the burden of
forcing Tomcat on people.
I suppose you'll say pick a standard application or a jsp/servlet
solution, but not both.... but I think there is a lot of flexability
to this method, being able to generate GUI screens on the fly in the
IE window is really exciting.
Thanks,
Greg
- 7
- reason for sporadic long full GC pause times?!?....Hello folks,
in our java business application our customer realize sporadic very
long pauses caused by full gc's.
Normaly the app runs smoothly with acceptable gc- and
full-gc-pausetimes. (gc=0.0xx sec / fullgc <=2 sec)
But sometimes during 8 hour work the occurs full gc's with 90-150
seconds (!)
which our customer complains about - of course.
In the first step I thought that our JVM-settings were wrong:
-Xms450m -Xmx450m -XX:NewSize=32m -XX:MaxNewSize=32m
-XX:SurvivorRatio=8 -classpath....
--> long full gc pauses occured sporadicaly.
I thought that the Newsize is too small -> wich implies the too big
tenured space -> which could be the reason for too longs full gc's. I
decided to use -NewRatio=4 Parameter.
And I also lowered the max. Heap size to Xmx350m, because the gcviewer
told me that the memory usage was only about 290 MB.
With the new settings
-Xms350m -Xmx350m -XX:NewRatio=4 -XX:SurvivorRatio=8 -classpath....
our customer had the same experience that sometimes the full gc's
pausetime took more than 100 sec's.
Additionally we/they relaized that the full gc freed not enough memory
so that the full gc frequency raised up to a point where no minor gc
were done - only full gc's !
Due to that I raised Xms and Xmx
-Xms512m -Xmx512m -XX:NewRatio=4 -XX:SurvivorRatio=8 -classpath....
which enables the JVM to free more memory at full gc (already tested),
but I fear this will not help to solve the sporadic problem with the
long full gc pause times at customer side.
Does anybody have an idea what could be the reason for the
extraordinary long full gc pause times?
Info btw:
customer PC's all have 1 GB RAM and the throughput of the application
was in any case >= 99,8% !
The problem with the long full gc pause times was never reproduced in
our lab / dev.-deptmnt.
Thanks in advance
Martin
- 8
- J2ME: j9 & JSR75?Hi all...
Has anyone tried to install IBM's optional package for JSR75
support on it's PDA?
I am having troubles by lauching the Midlet HQ that would
support FileConnection.
Regards,
Branko
- 9
- Ideas, Making a graphical grid look like ISO viewHi, hope my question is not too abstract.
I'm drawing a square grid and I have mouse events that return
coordinates of that grid. Now I'd like to make that grid look like an
iso view. Illusion of 3D, seen from an oblique angle, as is typical in
conquest and exploration games.
Affine transform shear takes me close, but I think it's not going to get
me all the way. I think the problem is, I don't really want the
vertical lines to stay parallel, because that makes it look like the
"far end" is fatter, instead of converging to some vanishing point (The
squares in the grid should end up being trapezoidal, I think).
So two problems, 1., how to draw my grid in rectangular coords but have
it look like an iso view, and 2., how to translate the Point from the
mouse event, into the coordinates of my grid.
If Affine transform is still the way to go, I can keep studying it.
Right now I'm thinking I may actually need to work out the geometry of
the iso view, draw it explicitly, and then find the mouse coordinates by
iterating through the boundaries of my graph. This is nasty, since
AffineTransforms would make it so easy.
Maybe there's a better way I'm not thinking of, such as, instead of
bounding my grid by "lines", construct it from "shapes", and then I
could add a listener to each shape, or something like that. That sounds
treacherous too.
- 10
- a unusual codesthe codes:
-------------------
Object[] stuff = new Object[5];
stuff[0] = "eggs";
stuff[1] = new StringBuffer( "flour" );
stuff[2] = 3.56;
stuff[3] = 'c';
stuff[4] = 123;
stuff[0]="33";
for( int i=0; i<stuff.length; i++ ) {
System.out.println( stuff[i] );
}
------------------
It seems odd.....
followings is what I guest. please tell me whether it's correct, thank
you very much
1:
what I think is because that the Object Class is any class's
superClass, so it can point to any type (right?), but in these codes it
only have Object Class's interface, not the interface which it point
to.
is it right?
2:
stuff[0]="eggs"
in this sentence,the JVM create a String object(right?), although it's
a String object and of course it has all the String object's
interface, but what the reference(stuff[0]) can access is only the
Object Class's interface.not the String interfaces(just like
concat(),charAt()....)
is it right?
3:
stuff[0]="eggs"
System.out.println( stuff[0] );
and when print it,the print function call stuff[0]'s toString()
function,and this toString() is the String object's , not the Object
Class's
is it right?
thank you very much
JTL
- 11
- Adding multiple GUI drivers into one windowHello,
I'm reasonably new at java:
I have several classes that create different windows...using JFrame, JPanel
etc, I was wondering how I could add these seperate gui's to one driver
class to have it all show in one window (which i could have a tabbed pane)
If someone understands what i'm blabberin about, please help!
--
Message posted via http://www.javakb.com
- 12
- 13
- Looping over arrays.Isn't it a waste of resources to loop over arrays this way:
for (i = 0; i < myArray.length; i ++) {
// do something
}
... as opposed to create a variable to hold the value of
myArray.length first, like so:
int len = myArray.length;
for (i = 0; i < len; i ++) {
// do something
}
This way the length of the array doesn't have to be recalculated on
every iteration? Or am I completely wrong?
TIA,
AJ
- 14
- Comparing two long numbersOn Mon, 2 Jun 2008, Daniele Futtorovic wrote:
> On 2008-06-02 13:22 +0100, Lew allegedly wrote:
>> Lew wrote:
>>>> Why do you use either "d" or "D"? Is it something you always put on
>>>> double constants, or just for potentially ambiguous situations? If the
>>>> latter, how do you assess ambiguity?
>>
>> John B. Matthews wrote:
>>> I don't use either "d" or "D"; I use "d", but I have to read other
>>> people's "D"s. Presbyopia comes to us all. :-)
>>
>> Most people don't bother with either "d" or "D" in Java double constants.
>> I never have to read other people's "D" in Java code; I don't think I've
>> ever encountered a double suffix on a constant in any professional Java
>> code.
>
> double athird = 1d / 3; ?
Urgh. Now this:
double farthing = 1d / 4 ;
is at least numismatically accurate, but won't compile after 1960!
tom
--
Eat whip you steroid wall-bashing lug-head! -- The Laird
- 15
- JInternalFrame/JDesktopPane questionHello,
Is it possible to add a JDesktopPane to components other than
top-level components (RootPaneContainer interface implementors like
JFrame, JDialog, etc.)? I'd like to contain a set of JInternalFrames
within one side of a JSplitPane. I don't see a way to do it.
The functionality I'm looking for is a way to create a set of
components that can be dragged around within one side of a JSplitPane.
If there is another way to do that outside of JInternalFrames, I'd be
happy to hear about that as well.
Thanks,
R. Trevor
|
|
|