comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Obtaining the client host from a webservice - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/98eda994dd8aec3d
* Problem with mssql jdbc - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bf3235eec595bc83
* Structuring JUnit tests for large package structures? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a4ee9978ce4598d
* why does ObjectInputStream constructor block reading a header - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7b8520ff9f293b96
* mailing list web-app - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93b9e94b79afbf6a
* put static keyword inside the JSP scripplets error - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84ad5eb13c822195
* multi-inheritance between EntityBeans - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c56b1038efd7ffbb
* How to starthandshake with client browser?? - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d41b9d8f6879f8b
* JBuilder / BlueJ question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfea91ed00a06b2c
* has someone seen this error before? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8e9f76b902386f4
* How to deference a String? - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/826d1418a6f42154
* Is JCA approriate? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d
* Problem with JPEG file - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4393e3859645b138
* Stupid null pointer exception - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aeeebd0bb6f11be3
* NoClassDefFoundError exception - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ddad41290f0004d
* Passing Servlet Context to a non servlet object. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea7f86915490db6b
* simplifying use of properties - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3
* How to get my IP address - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bd97add828fa8a4a
  
==========================================================================
TOPIC: Obtaining the client host from a webservice
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/98eda994dd8aec3d
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 2:18 pm
From: "Andy Flowers" <[EMAIL PROTECTED]> 

What version of AXIS are you using ?

I use version AXIS version 1.1, in conjunction with Tomcat 4.1, and have no 
problems getting this property.

If you have a look at the source, AxisServlet.java (which you can get from 
http://ws.apache.org/axis/download.cgi) you ill see that this property is 
set in the doGet() handler of the AXIS servlet.

You could also use the source to debug what may be happening in your 
scenario.

"Roberto Milani 2002" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Andy Flowers" <[EMAIL PROTECTED]> wrote in message 
> news:<[EMAIL PROTECTED]>...
>> Try this...
>>
>> // first get the message context
>> MessageContext mc = MessageContext.getCurrentContext();
>>
>> // then get the remote address from the current HTTP request directed at 
>> the
>> web service
>> String remote_client =
>> ((javax.servlet.http.HttpServletRequest)mc.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLETREQUEST)).getRemoteHost();
>
> mc.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLETREQUEST))
>
> is NULL, so I cannot call getRemoteHost().
>
> Then I tried:
>
>        Iterator i = mc.getPropertyNames();
>        while (i.hasNext()) {
>            String v = (String) i.next();
>            System.out.println (v + " = " + msg.getProperty(v));
>        }
>
> and the output is:
>
> home.dir = .
> realpath = axis/services/EsempioService
> jws.classDir = jwsClasses
> attachments.directory = C:\Documents and Settings\manganelli\Local 
> Settings\Temp
> transport.url = http://andromeda:8080/axis/services/EsempioService
> path = axis/services/EsempioService
>
> any idea? 






==========================================================================
TOPIC: Problem with mssql jdbc
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bf3235eec595bc83
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 2:24 pm
From: "sp" <[EMAIL PROTECTED]> 

No I use windows 2003.
I've try to execute netstat -an, but no process listen on port 1433. But I
've configured with Server Network Utility and client server utility to use
tcp protocol listen on port 1433.


"Mark Thornton" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> sp wrote:
>
> > I can't connect with jdbc for mssql.
> >
> > This is the code:
> >
> >  try {
> >    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
> >   } catch (ClassNotFoundException e) {
> >    e.printStackTrace();
> >   }
> >   try {
> >   conn =
> >     DriverManager.getConnection(
> >      "jdbc:microsoft:sqlserver://localhost:1433","username","pwd");
> >       dmd = conn.getMetaData();
> >   } catch (SQLException e1) {
> >     e1.printStackTrace();
> >   }
> >
> >
> >
> >
> > This is the error :
> > java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error
> > establishing socket.
>
> Are you running XP SP2 and haven't made the server an exception to the
> firewall (or simply turned it off)?
>
> Mark Thornton






==========================================================================
TOPIC: Structuring JUnit tests for large package structures?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a4ee9978ce4598d
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 2:41 pm
From: Stephen Riehm <[EMAIL PROTECTED]> 

Hi,

I'm an old-hat perl junkie that has grown very accustomed to setting up 
a simple testing structure and then simply adding test cases whenever I 
add functionality to my code. (ie: write test for new feature, write 
feature, test, go back to step 1,...)

Now I'm branching into the world of Java and haven't quite 'got-it' when 
using JUnit.

In the FAQ at http://junit.sourceforge.net/doc/faq/faq.htm#organize_2 
Mike Clark presents a way of creating a TestSuite which contains a lot 
of tests. So far so good. He does this by using a static method which is 
called directly from the main method. Is it possible to wrap up a 
TestSuite in a "higher" TestSuite?

In my case, I've split my application into several packages, just 5 so 
far, but they'll be more. ie: myapp.data, myapp.gui, myapp.cli, 
myapp.interfaces. I would *like* to group the test cases for each 
package into a TestSuite (ie: myapp.data.AllDataTests) and then have 
them all run from a central point. (ie: myapp.AllTests). The idea being 
that once the structure is in place, all we would need to do is write 
tests and classes, and not have to fiddle with the administration of 
test cases.

Is there a neat way of recursively grouping suites of TestSuites (I 
tried subclassing TestSuite, but with little success) or is JUnit 
limited to a single TestSuite of TestCases? Have I missed something obvious?

Thanks for your enlightenment!

Steve




==========================================================================
TOPIC: why does ObjectInputStream constructor block reading a header
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7b8520ff9f293b96
==========================================================================

== 1 of 2 ==
Date:   Tues,   Nov 2 2004 3:01 pm
From: Esmond Pitt <[EMAIL PROTECTED]> 

Tony Morris wrote:
> In that case, you want to look at the java.nio package.
> 
Why?




== 2 of 2 ==
Date:   Wed,   Nov 3 2004 12:10 am
From: "Tony Morris" <[EMAIL PROTECTED]> 


"Esmond Pitt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Tony Morris wrote:
> > In that case, you want to look at the java.nio package.
> >
> Why?
>

Because it includes non-blocking I/O.
http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/SelectableChannel.html#configureBlocking(boolean)

-- 
Tony Morris
http://xdweb.net/~dibblego/






==========================================================================
TOPIC: mailing list web-app
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/93b9e94b79afbf6a
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 3:04 am
From: Nathan Coast <[EMAIL PROTECTED]> 

Hi,

does anyone know of a java web-application that provides mailing list 
functionality like mailman?

http://sourceforge.net/projects/mailman/

cheers
Nathan




==========================================================================
TOPIC: put static keyword inside the JSP scripplets error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/84ad5eb13c822195
==========================================================================

== 1 of 3 ==
Date:   Tues,   Nov 2 2004 3:59 pm
From: [EMAIL PROTECTED] (Matt) 

I put static keyword inside the JSP scripplets, and it has Generated
servlet error "illegal start of expression."

<%
static ConnectorLogger logger = ConnectorLogger.getLogger();
%>

Any ideas??

Generated servlet error:
C:\Projects\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\extendedguiApp\extendedgui.war\attachdoc\_NewAttachDocAction.java:101:

illegal start of expression
                static ConnectorLogger logger =
ConnectorLogger.getLogger&#40;&#41;&#59;

please help. thanks!!



== 2 of 3 ==
Date:   Tues,   Nov 2 2004 4:09 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 2 Nov 2004 15:59:19 -0800, Matt wrote:

> I put static keyword inside the JSP scripplets, and it has Generated
> servlet error "illegal start of expression."
> 
> <%
> static ConnectorLogger logger = ConnectorLogger.getLogger();
> %>
> 
> Any ideas??

..take it out.  

( Instead you might use an 'application' scope bean that 
creates the (single) logger, but I doubt that is the correct
way to go about doing it. )

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 3 of 3 ==
Date:   Tues,   Nov 2 2004 4:23 pm
From: Sudsy <[EMAIL PROTECTED]> 

Matt wrote:
> I put static keyword inside the JSP scripplets, and it has Generated
> servlet error "illegal start of expression."
> 
> <%
> static ConnectorLogger logger = ConnectorLogger.getLogger();
> %>
> 
> Any ideas??

Sure! Look up the difference between declarations and scriptlets.
Anything within <% and %> gets inserted into the _jspService
method. Does it make any sense to specify static for a method
variable? Remember, this isn't C.
Try it in a small class and you'll find the compiler complains
with the same message, to wit "illegal start of expression".
Solution? Make it a declaration. Try this:

<%!
static ConnectorLogger logger = ConnectorLogger.getLogger();
%>

Note the exclamation mark.

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: multi-inheritance between EntityBeans
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c56b1038efd7ffbb
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 4:12 pm
From: "Hal Rosser" <[EMAIL PROTECTED]> 


"Grzegorz Trafny" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Hi,
>
> Question is lightly theoretical but how to implement project
> (for example: data model ) in which was used multi-inheritance?
> Especially, how to model multi-inheritance in apps which data
> is based on EntityBeans?
>
> Problem is quite large because normally it is not possible to apply
> (in EntityBeans) even single inheritance. However it exists patterns
> to solve this problem (f.e.: article "EJB Inheritance" from onjava.com).
> Maybe someone know way (similar to above mentioned) how to
> by-pass problem of multi inheritance in EntityBeans (and java :)))?
>
> Greetings
> GT

you can try (drum roll)
implementing multiple interfaces



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.781 / Virus Database: 527 - Release Date: 10/21/2004






==========================================================================
TOPIC: How to starthandshake with client browser??
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d41b9d8f6879f8b
==========================================================================

== 1 of 3 ==
Date:   Tues,   Nov 2 2004 4:42 pm
From: [EMAIL PROTECTED] (Jakekeke) 

Thank you 2 guys for help.
I hope i can finish my project by those information.
I will post the follow up message if i get any difficulties again

Thanks,
Jake

Rogan Dawes <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Bruno Grieder wrote:
> 
> > Additional notes:
> > 
> > a-You MIM should NOT send any reply directly to the client.
> > 
> Actually, it has to send the 200 Ok response to the CONNECT request, 
> prior to negotiating the SSL session.
> 
> > c- Your MIM will NEVER be transparent in terms of authentication: you 
> > can transparently pass the content including headers from client to 
> > server, but authentication will always be Client to MIM and MIM to 
> > server. (Fortunately, if not this would defeat the whole purpose of 
> > using certificates).
> 
> Note that, depending on the location of the MIM, and collusion between 
> the operator of the client (e.g. browser) and the operator of the MIM, 
> the operator of the browser can simply accept the invalid certificates 
> presented by the MIM, and can also possibly load the browser's client 
> certificate in the MIM application, with the nett result that the server 
> has no knowledge that anything is amiss, and the browser will continue 
> to operate with no degraded functionality.
> 
> WebScarab includes this functionality.
> 
> Regards,
> 
> Rogan



== 2 of 3 ==
Date:   Tues,   Nov 2 2004 7:56 pm
From: [EMAIL PROTECTED] (Jakekeke) 

Sorry for having question again

I have make some modification and run ConnectionHandler....
However, i get the following result in my console

Start
HERE~~
GOOD~~
Finished negotiating SSL - algorithm is SSL_NULL_WITH_NULL_NULL
HERE2~~
2004/11/3 ¤W¤È 11:54:10 ConnectionHandler run
ÄY­«ªº: ConnectionHandler got an error : javax.net.ssl.SSLException:
Connection has been shutdown: javax.net.ssl.SSLHandshakeException: no
cipher suites in common
javax.net.ssl.SSLException: Connection has been shutdown:
javax.net.ssl.SSLHandshakeException: no cipher suites in common
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.d(DashoA12275)
        at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA12275)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.read(BufferedReader.java:157)
        at ConnectionHandler.run(ConnectionHandler.java:155)
Caused by: javax.net.ssl.SSLHandshakeException: no cipher suites in
common
        at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SunJSSE_aw.b(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.getSession(DashoA12275)
        at ConnectionHandler.negotiateSSL(ConnectionHandler.java:301)
        at ConnectionHandler.run(ConnectionHandler.java:145)


How to make SSL_NULL_WITH_NULL_NULL work??



== 3 of 3 ==
Date:   Wed,   Nov 3 2004 1:06 am
From: Rogan Dawes <[EMAIL PROTECTED]> 

Jakekeke wrote:

> Sorry for having question again
> 
> I have make some modification and run ConnectionHandler....
> However, i get the following result in my console
> 

> How to make SSL_NULL_WITH_NULL_NULL work??

You are not finding the certificate correctly. If you initialise the 
KeyStore with a null InputStream, you will get this error. Make sure 
that your inputstream is not null before you initialise the key store.

Rogan
-- 
Rogan Dawes

*ALL* messages to [EMAIL PROTECTED] will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"




==========================================================================
TOPIC: JBuilder / BlueJ question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfea91ed00a06b2c
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 5:51 pm
From: "Bill Joy" <[EMAIL PROTECTED]> 

Things might be easier if you just got familiar with projects first.  Do 
something like File | New Project, then File | New | General | Application, 
then Run | Run Project.  (Look at Project | Project Properties | Paths and 
at Run | Configurations afterwards.)

Some guesses about your problems:

(a) Are you seeing a <Project Source> node in the Project pane?  When you 
expand that tree node, are you seeing your source?  If not then your project 
source path is not set correctly.

(b) Are you keeping your source and compiled classes in separate 
directories?  If not, then that might be confusing things.  If you have 
classes and source mixed together, then delete the classes.  Make sure your 
project output path is configured for a separate directory tree than your 
source.

(c) When you are ready to run for the first time, you ought to go to Run | 
Configurations.  Tell it that you have an Application and the class where 
the main() method is located that you want to use as an entry point. 
Alternatively, you can just right-click on the class with the main() and 
choose Run from the context menu.


"zcraven" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Thanks - I did that, but now it seems to only show 'stub' files instead of
> all the code.
>
> Also, when I click 'run project' nothing happens.
>
> Zac
>






==========================================================================
TOPIC: has someone seen this error before?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8e9f76b902386f4
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 8:14 pm
From: "Jeff" <[EMAIL PROTECTED]> 

I would greatly appreciate some good advice on a problem that has eluded us.

Our server has what appears to be a network IO problem under load.   We have 
seen one instance of an error message that we think is a strong clue:
java.net.SocketException: Insufficient buffer space

However, we can't find any documentation on what this error means?  Which 
buffer space?

ARCHITECTURE
1. our probe sends large volumes of data to our server
2. the probe-server connection is tcp carrying proprietary data
3. at times, our probe definitely sends more data than the server can 
process.  We expected tcp congestion control to throttle the probe.

OPTIMIZATIONS COMPLETED
1. set the socket's receiveBufferSize to 32768
2. set the the buffered input stream's buffer size to 1024000

SYMPTOMS
1. data in buffer returned by inputStream.read() appears to be off by 2 or 3 
bytes
2. no tcp congestion control (advertised window does not decrease)
3. according to the server's operating system stats, the receiver queue 
builds up
4. data input rate is 7 to 8 Meg continuous.

ENVIRONMENT
- running BEA's JRockit JVM
- both SuSE 8.2 and WinXP.
- Lot of processing on the buffer returned by the read call is available for 
garbage collection

SERVER'S SOCKET CODE
Socket probeSocket = sock.accept();
 if ( probeSocket.getReceiveBufferSize() < 32768 ) 
probeSocket.setReceiveBufferSize(32768);

 BufferedInputStream is = new BufferedInputStream( 
probeSocket.getInputStream(), 1024000 );

Thanks
-- 
Jeff 






==========================================================================
TOPIC: How to deference a String?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/826d1418a6f42154
==========================================================================

== 1 of 4 ==
Date:   Tues,   Nov 2 2004 9:20 pm
From: Nick Coleman <[EMAIL PROTECTED]> 

I guess I'm still stuck in C programming mode, despite two semesters of
Java.

I have a bunch  of static finals, one of which is S1 = "Database";

I am passed a String containing the value "S1".  I want to use the value
of the String to refer to the constants and resolve (in this case) to
"Database".  So that:

String static final S1 = "Database";
String key = "S1";
String result = (insert tricky stuff here);  // result is "Database"

I can't use a switch statement as there is no consistency in the format
of the static constants.

I can't use a TreeMap to store the values of the constants as keys along
with their associated values (spec prevents it).

Is there a way to resolve "S1" to S1?

thanks for any help,
Nick




== 2 of 4 ==
Date:   Tues,   Nov 2 2004 9:45 pm
From: "hilz" <[EMAIL PROTECTED]> 

> String static final S1 = "Database";
> String key = "S1";
....
> Is there a way to resolve "S1" to S1?
>


I am not sure i understand what you're trying to achieve here, but to get a
reference to the filed S1, given that you know its name, you need to use
"reflection", similar to the following:

import java.lang.reflect.*;


Field aField = this.getClass().getField("S1");
String tempString = (String)aField.get( this);



but if i really understand what you're trying to do, i doubt you need to use
reflection.
thanks, and good luck
hilz





== 3 of 4 ==
Date:   Tues,   Nov 2 2004 9:48 pm
From: Sudsy <[EMAIL PROTECTED]> 

Nick Coleman wrote:
> String static final S1 = "Database";
> String key = "S1";
> String result = (insert tricky stuff here);  // result is "Database"

First off, that won't compile: you need to specify the modifiers before the
type, e.g.:

     static final String S1 = "Database";

As for the tricky stuff, try this:

import  java.lang.reflect.Field;

public class X {
         static final String S1 = "Database";

         public static void main( String args[] ) {
                 String key = "S1";
                 String value = null;
                 try {
                         value = (String) X.class.getDeclaredField( key 
).get( null );
                 }
                 catch( NoSuchFieldException e ) {
                         // if named field doesn't exist
                 }
                 catch( IllegalAccessException e ) {
                         // shouldn't happen with a class static field
                 }
                 catch( ClassCastException e ) {
                         // if named field is not of type String
                 }
                 System.out.println( value );
         }
}

ps. I have no idea why you would want to do this...

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.




== 4 of 4 ==
Date:   Tues,   Nov 2 2004 10:06 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Nick Coleman" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I guess I'm still stuck in C programming mode, despite two semesters of
> Java.
>
> I have a bunch  of static finals, one of which is S1 = "Database";
>
> I am passed a String containing the value "S1".  I want to use the value
> of the String to refer to the constants and resolve (in this case) to
> "Database".  So that:
>
> String static final S1 = "Database";
> String key = "S1";
> String result = (insert tricky stuff here);  // result is "Database"
>
> I can't use a switch statement as there is no consistency in the format
> of the static constants.

You can't switch on strings at all.

>
> I can't use a TreeMap to store the values of the constants as keys along
> with their associated values (spec prevents it).

What exactly does the spec say that prevents it?  That seems like an 
arbitrary restriction, the kind that would appear only in ...

A school assignment.  I see. 






==========================================================================
TOPIC: Is JCA approriate?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d
==========================================================================

== 1 of 1 ==
Date:   Tues,   Nov 2 2004 10:10 pm
From: "Reinf" <[EMAIL PROTECTED]> 

Hello group,
  I am working on a data broadcasting system(in java) which communicates
with
one physical broadcast card via JNI. The system itself is composed of
several EJBs and a web interface. And now we are redesigning the system in
order to work with more than one broadcast card, which involves the
management
of multiple hardware resource.
  My colleague suggestted the use of JCA(j2ee connector architecture), and
his
reason is that JCA includes features like Transaction processing, resource
pool
and etc, though it might sounds differrent from what Sun suggested.

  Do you think JCA is really approriate for this purpose? And your reasons
please.
  Thank you






reinf






==========================================================================
TOPIC: Problem with JPEG file
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4393e3859645b138
==========================================================================

== 1 of 3 ==
Date:   Tues,   Nov 2 2004 10:10 pm
From: [EMAIL PROTECTED] (Amar) 

hello all,

I am accepted an a JPEG file from user and created a BufferedImage
from it with type as TYPE_INT_RGB.

By using BufferedImage.getRBG method to get the pixels, I displayed
those pixels on the screen.

>From those array of pixels, I created another image and saved it by
another name.JPG

Now the problem is when I am trying to display the pixels of the newly
created image they are different from the old image.

Someone told me that this problem is due to JPEG compression.

Can anyone suggest me a way to save the image in JPEG form in this
situation?

Basically I am writing an application where I want to compare the two
above images.  But their pixels are not matching.



== 2 of 3 ==
Date:   Tues,   Nov 2 2004 10:57 pm
From: JScoobyCed <[EMAIL PROTECTED]> 

Amar wrote:
> hello all,
> 
> I am accepted an a JPEG file from user and created a BufferedImage
> from it with type as TYPE_INT_RGB.
> 
> By using BufferedImage.getRBG method to get the pixels, I displayed
> those pixels on the screen.
> 
> From those array of pixels, I created another image and saved it by
> another name.JPG
> 
> Now the problem is when I am trying to display the pixels of the newly
> created image they are different from the old image.
> 
> Someone told me that this problem is due to JPEG compression.
> 
> Can anyone suggest me a way to save the image in JPEG form in this
> situation?
> 
> Basically I am writing an application where I want to compare the two
> above images.  But their pixels are not matching.

Well, it is not directly a Java issue. More it is a imaging issue. 
Anyway, I'll try to help.
Do you control the sender of the initial JPG image ? That is, could you 
force the sender to send in a different format --i.e. directly the array 
of pixel--) ?
If not, you could try some edge detection algorithm for your comparison.

-- 
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!



== 3 of 3 ==
Date:   Wed,   Nov 3 2004 12:20 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Amar wrote:
> hello all,
> 
> I am accepted an a JPEG file from user and created a BufferedImage
> from it with type as TYPE_INT_RGB.

What was wrong with the answers you got for your previous post? Did you 
at least read them?

/Thomas




==========================================================================
TOPIC: Stupid null pointer exception
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aeeebd0bb6f11be3
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 12:09 am
From: "Tony Morris" <[EMAIL PROTECTED]> 

> Good!

She knows.

-- 
Tony Morris
http://xdweb.net/~dibblego/






==========================================================================
TOPIC: NoClassDefFoundError exception
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ddad41290f0004d
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 12:26 am
From: Thomas Weidenfeller <[EMAIL PROTECTED]> 

Matt wrote:
> Test.java is just a simple class. I have the Java path set in environment,
> but it has NoClassDefFoundError exception when i run the program. any ideas?
> 
> C:\>javac Test.java
> 
> C:\>java Test
> Exception in thread "main" java.lang.NoClassDefFoundError: Test
> 
> please help. thanks!!


(a) beginner's questions are best asked in comp.lang.java.help

(b) Consider working through Sun's getting started tutorial 
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html

(c) Consider reading the tool documentation coming with the JDK

(d) Consider consulting the tool documentation to learn how the VM 
searches for classes.

(e) Set the classpath (see the tool documentation on how to do this)

/Thomas




==========================================================================
TOPIC: Passing Servlet Context to a non servlet object.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea7f86915490db6b
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 12:37 am
From: [EMAIL PROTECTED] (Andrew Purser) 

As you can tell by my subject line I am fairly new to java and
servlets.

I was hoping I could get some feed back as to the merits / problems /
suggestions of other ways to do it for the code skeleton below.

Basically I have created a Something java class that I want to call
from a servlet. The catch is I want the Something java class to
include Jsps depending on various things. The only way I can see to do
this if for my servlet to pass the ServletContext, HttpRequest and
HttpResponse to the class. I get the feeling this may be a bad thing
to do. Can someone enlighten me?

Cheers,

Andrew. 



Code outline :

public class Something {

   public void buildPage(ServletContext context,
                         HttpServletRequest req, 
                         HttpServletResponse res) {
     // do various bits and pieces to work out what page
     // to include.      

     context.getRequestDispatcher(jspToInlucde).include(req,res);

   }

}

public class MyServlet extends HttpServlet {

   doPost() {
     Something.buildPage(context,request,response);
   }
}




==========================================================================
TOPIC: simplifying use of properties
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 12:47 am
From: [EMAIL PROTECTED] (kartik) 

Currently, use of (JavaBeans) properties requires manual calls to
getter & setter methods. Wouldn't it be better to extend the language
so that an expression "object.foo" (without a '()'), in the absence of
a field named foo, is treated as equivalent to a call to a
getter/setter method (depending on whether the property is being read
or written).

I feel it would be better to do this *not* by a compile-time
transformation but by changing the spec of the getfield & putfield
instructions to invoke a getter/setter method when there is no
matching field. Then, classes can replace fields with properties (or
vice-versa) without hurting binary compatibility (for clients who
access the fields/properties using the "object.foo" syntax).

Maybe static properties should also be allowed.

Any comments? Thank you.

-kartik




==========================================================================
TOPIC: How to get my IP address
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bd97add828fa8a4a
==========================================================================

== 1 of 1 ==
Date:   Wed,   Nov 3 2004 12:57 am
From: "Neutrino" <[EMAIL PROTECTED]> 

Thank you for your answer,
I agree with you, 127.0.01 is correct, but inside my program I have to
connect to a host specifying the local port, so I decided to use the
function : socket (host, remote_port, local, local_port). In a order to get
the local address, I used local = InetAddress.getLocalHost(); this is
working perfectly with Windows XP (java 1.4.2), but with Linux Red Hat, the
connection fails with a Socket Exception "Invalid argument or Cannot assign
requested address". If I change the IP address 127.0.0.1 in the local
InetAddress with the IP address of my interface (I have only one net
interface), the connection is ok. I don't understand why ?
Best regards,
AR

> Which is the "correct address"? 127.0.0.1 sounds perfectly correct to me.
> One computer can have *a lot* of IP addesses.






=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to