Sagewire Logo

java programming RSS Feed

Recent Posts View Recent Posts | View Archived Posts

Message from DawidM
Most recent post: 10/21/2007
2 authors and 2 replies.

Is it possible to use the Tomcat Server as a Mbean containter for non web
application? This MBeans will be registered from a standalone application.
Other words, I'm looking for any container for register my MBeans from
standalone app, I can not use the Jboos Server and the rmiregistry. Maybe in
JV is any default server where I can register my MBean and then create
MBeanServerConnection to invoke remote method from beans from another
standalone application client?

Any ideas? :)
DM read more about JMX + Tomcat?


Message from R.A.M.
Most recent post: 10/17/2007
4 authors and 4 replies.

Hi,
I have installed Runtime Environment, Version 6 in directory
/usr/JAVA/jre1.6.0_02. I do not know what else I should do. Define some
shell variables?...
Could you help me please?
/RAM/ read more about newbie: setup of Runtime Environment


Message from David Busch
Most recent post: 10/12/2007
3 authors and 3 replies.

Does anyone know of a way to fill in a JSP form programatically?

Any pointers are greatly appreciated.

Dave read more about Programatically fillling JSP form


Message from Rahsaan Page
Most recent post: 10/10/2007
2 authors and 2 replies.

Hello Everybody,

I am trying to write a file Explorer program in JAVA, I go the Frame, Basic
Menu and Tree going. But now I have the C: listed and I need some help
expanding and collaping the HDD to se Folders and Files contained in there
C:..

Help is greatly apprciated..

Thanks
--Rahsaan read more about Expanding and Collapsing JTree


Message from James Barrett
Most recent post: 10/1/2007
3 authors and 6 replies.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all, I am experimenting with JApplet and JPanel.

My JApplet contains a JPanel called jpanel1 size 210x210.

I created a class myPanel which extends JPanel and I set its size to
210x210.

myPanel contains a Canvas called canvas1 and its size is 210x210.But when I run the applet and draw an image to the canvas1, it isn't
visible.

I call canvas1.setVisible(true), myPanel.setVisible(true) and
jpanel1.setVisible(true) and still my image isn't visible.

I set canvas1.setLocation(0,0), myPanel.setLocation(0,0) and still my
image isn't visible.

Is there something else that I should try to make the image visible?

Thanks,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHAAW8QuDJiZ/QrH0RAnEhAJ41cR35MvFbu43/MkyJr5Wj+kbptACgzc0x
AK0VStBx5AtaRnJzLQ0LPW4=
=dx6/
-----END PGP SIGNATURE----- read more about JPanel not visible in JApplet


Message from jerry chapman
Most recent post: 9/29/2007
3 authors and 3 replies.

I am trying to send a command to windows from my JAVA program, and I get an
error.
The pertinent (?) part of my code follows:
public boolean action(Event evt, Object arg)
{ if (arg.equals("Execute")){
inputText=(String)commandText.getText();
System.out.println(inputText);
try{
Runtime rt = Runtime.getRuntime();
//Process cp1=Runtime.getRuntime().exec(inputText);
//With the Runtime instance the program is run with the exec()
method:
Process process = rt.exec (inputText);
}
catch(IOException ee){
System.err.println(ee+" can not run command");
System.exit(1);
}
}
else return super.action(evt,arg);
return true;
}

I have written other JAVA programs that successfully used this function, but
I do not know why this one does not work. Any suggestions? read more about Runtime process


Message from Darren Withers
Most recent post: 9/19/2007
3 authors and 3 replies.

Hi

Am just starting out using JAVA, what are the best resources to use to =
get the most out of this language? read more about Just Starting Out


Message from Darren Withers
Most recent post: 9/18/2007
2 authors and 2 replies.

Hi

Am just starting out using JAVA, what are the best resources to use to get
the most out of this language? read more about Just Starting Out


Message from Robert Larsen
Most recent post: 9/18/2007
2 authors and 6 replies.

Hi group

I have some code that saves an image to a file using ImageIO. And it
works for all formats except jpeg. A scaled down version follows:

public void write(String filename) throws IOException {
int idx = filename.lastIndexOf('.');
if (idx >= 0) {
File file = new File(filename);
String format = filename.substring(idx + 1).toLowerCase();
ImageIO.write(image, format, file);
}
}

The image has been instanciated using:
image = new BufferedImage(w > 0 ? w : 1, h > 0 ? h : 1,
BufferedImage.TYPE_INT_ARGB);
...where 'w' is the width and 'h' is the height.

And given "img.png" I get a very nice PNG image. But "img.jpg" gives a
weird result.

The two images can be seen here (they are quite small):
http://194.255.21.180/img.png
http://194.255.21.180/img.jpg

Bigger versions can be seen here:
http://194.255.21.180/bigger.png
http://194.255.21.180/bigger.jpg

Firefox actually says the following when asked to display the JPEG:
<quote>
The image “http://194.255.21.180/img.jpg” cannot be displayed, because
it contains errors.
</quote>
...but The Gimp has no problem displaying it.

Has anybody seen this ?
Or do you know what I am doing wrong ?

Best,
Robert read more about ImageIO problems encoding jpeg


Message from Robert Bralic
Most recent post: 9/14/2007
2 authors and 3 replies.

Jer sve radi osim Save,
da radi Save onda bi aplet
mogao natrpati gomilu
virusa iz browsera...
Da su ju razdjelili na dio
za klasicne programe,
koji se ne mogu vrtiti u browseru, I aplete(bez Save) bila bi odlicna...

LP, Robert....;)
robert.bralic@xxxxxxxxxxx read more about Zasto javu nisu razdjelili.....


Message from Z.K.
Most recent post: 9/12/2007
4 authors and 4 replies.

wrote in message which adds 3 buttons and some
text. It seems to work, but the buttons seem like they are all
different sizes. How to I get them to be all the same size. I tried
setSize(), but that didn't seem to work. My code is below.

Z.K.code:

import JAVAx.swing.*;
import JAVA.awt.*;

public class NotHelloWorld
{
public static void main(String[] args)
{
NotHelloWorldFrame frame = new NotHelloWorldFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}

}

class NotHelloWorldFrame extends JFrame
{
public NotHelloWorldFrame()
{
setTitle("NotHelloWorld");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
NotHelloWorldPanel panel = new NotHelloWorldPanel();
add(panel); }

public static final int DEFAULT_WIDTH = 300;
public static final int DEFAULT_HEIGHT = 200;
}

class NotHelloWorldPanel extends JPanel
{

public NotHelloWorldPanel()
{
NotHelloWorldButtonPanel bpanel = new NotHelloWorldButtonPanel();
add(bpanel);

}
public void paintComponent(Graphics g)
{
g.drawString("Not a Hello World program", MESSAGE_X, MESSAGE_Y); }

public static final int MESSAGE_X = 75;
public static final int MESSAGE_Y = 100;

}

class NotHelloWorldButtonPanel extends JPanel
{

public NotHelloWorldButtonPanel()
{
JButton yellowButton = new JBut read more about JButton question


Message from Doug Robinson
Most recent post: 9/4/2007
2 authors and 2 replies.

Hello
I cannot find the plugin that, I thought, should
come with jdk1.6.

Have I lost my mind or have they hidden it somewhere?

Thanks for your time.
dkr read more about jdk1.6 - has no applet plugin


Message from harry
Most recent post: 9/3/2007
3 authors and 3 replies.

I need to validate a file name but it has to work on Windows & Unix!

Does anybody know of JAVA code that does this?

thanks in advance

harry read more about Generic file name validation code?


Message from Benny Dein
Most recent post: 8/24/2007
3 authors and 5 replies.

Hi

I want to create a servlet or something similar by which im able to create
virtual webservices.

Lets say I would like to create a webservice with a method called 'getDate'
which returnes the current date.
This could be done by making a wsdl file (or whatever the name is) and via a
wizard in some JAVA tool make a real webservice. This webservice'd be
static since it creates a class in which I can make my code to return the
date. The servlet should be published to a server and the behaviour cant be
changed without compiling the class again and publish again. In that way it
is static.

I'd like to implement the same thing, but in af dynamic manner. By this I mean that I will create the wsdl file dynamically, when a client requests
for that and I would dynamically construct the soap response, when the
client makes a request on my method.

So to the client it should seem exact as a static normal webservice but the
implementation on the server is totally dynamic, and any xml returned from
calls to my 'webservice' should be created dynamically.

Can anyone guide me in how to implement this?

Which .jar files do I need, where do I get them from, which classes can help
create wsdl files and soap webservice responses?
Can it be implementet in a normal servlet or do I have to code my own http
server?

Links to guides'd be appreciatet.

Thanks in advance, Benny read more about How to create virtual webservices?


Message from Mothra
Most recent post: 8/16/2007
2 authors and 2 replies.

... is that it doesn't return the length of the bit set. For example, if
I create a new 8-bit set:

BitSet eightBits = new BitSet(8);Running eightBits.length() returns zero, rather than eight.

The problem is that I want to be able to convert the bit set back to an
integer at some point. I thought the easiest way'd be to iterate
backwards over the bit set thus:

private static int bitsToInt(BitSet bits) {
int myInt = 0;
int binColumn = 1;

// loop over the bitset backwards, adding up the true values
for (int i=(bits.length()-1); i>=0; i--) {
myInt += (booleanToInt(bits.get(i)) * binColumn);
binColumn = (binColumn * 2);
}

return myInt;
}

But because BitSet.length only returns the length from the highest
bit that's set to "true", this does not work for any binary numbers that
start with zeros in the full bit set (e.g. an 8-bit set of '00111000').

I suppose my method could take in a 'length' parameter that I coul define,
but is not there a neater way of getting the true length of a BitSet? read more about Problem with BitSet.length()...


Message from Doug Robinson
Most recent post: 8/15/2007
2 authors and 3 replies.

If I try to access another jar files default package I have no
problem. When I try to access anythig else i.e. package com.mine.thing,
I always get the not found message.

What special thing do I need to do to make it work?package a.b.c.*;

import Another.*;
class Test {
System.out.println ("Hello World");
try {
Class.forName("another/Thing");
// Class.forName("Stuff");
}
catch (ClassNotFoundException ex) {
ex.printStackTrace();
System.out.println ("Good bye Cruel World");
System.exit (-1);
}

}
for this class Stuff works but another/Thing is another thing.

Any ideas?

Thanks for your time. read more about Need help linking & packages


Message from Z.K
Most recent post: 7/23/2007
3 authors and 4 replies.

I was wondering if someone could explain something that while not a big
deal, I wouldn't mind understanding why. When I set the Month field
with the set command with the value 1 and then use get to read it back,
it reads it as 0 and not 1.

Z.K. read more about Calendar class question


Message from ITMozart
Most recent post: 7/20/2007
2 authors and 3 replies.

I'd need some library to easily draw flowcharts (for example b-trees)
etc. via JAVA APIs
I found JGraph, but it's quite chubby. Is there anything
(opensource/free) similar but smaller?

I remember there was something, but I could not find it (I see many
diagram related tools, but they do not fit for what I need).

Thanks!
Saverio read more about Flowcharts libraries?


Message from Troy Matteoli
Most recent post: 7/19/2007
2 authors and 3 replies.

I'm having an issue running some JAVA processes on a Windows server. My
system has serveral JAVA processes that are started in the background by
a system service. They are run as the SYSTEM user. When someone logs
off from the console, the runtimes for the processes are given the
shutdown command. I'd expect this if the processes were running as
the logged in user, but they are running as the SYSTEM user. Has anyone
else encountered this situation? If so, how'd I go about resolving it?

TIA
Troy read more about JAVA processes being sent shutdown on logoff


Message from Z.K
Most recent post: 7/19/2007
2 authors and 3 replies.

I was wondering if the function strftime is available for JAVA. It
seems to be for every other language, but I can not find any information
on its use for JAVA.

Z.K. read more about strftime in JAVA?


Message from Retalix is Hiring
Most recent post: 7/13/2007
3 authors and 4 replies.

Do any of you know someone experienced in JAVA that is interested in a full
time job in Tucson, Omaha or Dallas? Company dies not pay relo but has an
excellent reputation as a great place to work.

If you are interested sheck out www.retaliz.com read more about JAVA Developer


Message from jupiter
Most recent post: 7/1/2007
3 authors and 4 replies.

The Collections class is supposed to, among other things, return
type safe collections from existing collections with static methods
such as .checkedList().

My question is: What is so special about these static methods since
we can do the same thing by declaring the original list generically
with a type like <String>? I mean, once you create the list with
<String> the compiler will no longer allow you to add, say,
Integer to the list. So what purpose does .checkedList() provide
in that context?

Maybe it's all about backward compatibility? read more about Collections.class methods anachronisms?


Message from Jacky Luk
Most recent post: 7/1/2007
5 authors and 7 replies.

import JAVA.awt.Graphics;

public class printtest extends JAVA.applet.Applet
{
public void init()
{
}

public void paint (Graphics g)
{
g.drawString ("Hello from JAVA!", 60, 30);
}

public static void main (String args)
{

}
}
===============================
JAVA.lang.NoSuchMethodError: main
Exception in thread "main"

What happened?
Thanks
Jack read more about beginner's question


Message from mlw
Most recent post: 6/29/2007
4 authors and 15 replies.

Don't take anything about this, it isn't a flame or troll, while I'm not
new to JAVA I favor C++. However, I may need to use it in a contract
position, and am concerned that the restrictions it places on application
code.

Take, for instance, this C++ construct:

class foo
{
char *m_name;
....
void * operator new(size_t size, char *string);
}void *foo::new(size_t size, char *string)
{
size_t cbstr = strlen(string)+1;
size_t cb = cbstr + size;
foo * t = (foo *) malloc(cb);
char * name = (char *) &t[1];
strcpy(name, string);
t->m_name = name;
}

The above example is a methodology that can be used to reduce the CPU and
memory overhead of malloc. You my argue that this isn't a valid concern,
but if you've 10 or 100 million objects, the malloc block overhead,
alone, make this worth while. Hint: This is actually a simplification, some
times malloc isn't used at all, and a big array is pre-alocated and work
through it with each new.Is there a way to create 10 to 100 million objects in JAVA with a reasonable
system configuration? read more about C++ vs JAVA "new" (no flame war please!)


Message from RAM
Most recent post: 6/29/2007
15 authors and 17 replies.

Hello,
I graduated computer science faculty and decided to became a
programmer. Please help me to make a decision: JAVA or Microsoft .NET?
What is the future of JAVA?
Thanks!
/RAM/ read more about beginner: JAVA or .NET?


Message from Ronald Verbeek
Most recent post: 6/27/2007
2 authors and 2 replies.

I have to deal with several lookup tables like for example:
Quality SpecificWeight Hardness TearStrength

So I'd create a Quality Class to store the values for a single
record.

I know it'd be possible to use a HashMap<String, Quality> and fill it
with the appropriate data. All examples I find use the main method for
this.

However I need to reuse the same lookup tables for different
applications. So my idea is to put this lookup tables in a library jar
file that can be shared by this applications.

What is the best approach?

Regards,

Ronald. read more about Reusable lookup tables


Message from ITMozart
Most recent post: 6/21/2007
2 authors and 2 replies.

wrote in message this piece of code:class A {
public A() {
someMeth();
}
public void someMeth() {
out.println(entries[0]);
}
public final String[] entries = { "a" };
}

class B extends A {
public void someMeth() {
out.println(entries[0]); *** NullPTR
super.someMeth();
}
private final String[] entries = { "b" };
}

the point is to start, during instantiation, some methods from the
bottom of the inheritance tree instead of from the top.

but I had some unexpected behavior: at the marked point, I receive a
NullPTR.
Why does this happen?

Seem like that at the moment of the call (***) member vars aren't
instantiated, since the call comes from the constructor of the
superclass, and the subclass isn't still instantiated, but why then the
subclass method works?

Bye!
it read more about Inheritance and member variables


Message from Robert Bralic
Most recent post: 6/21/2007
2 authors and 2 replies.

If I make a applet from JAVA program is it possible
that this applet writes something on disk from browser...
I have a application with graphics and I want to make,
she as applet but I do not know how to save data...??

Thanks in advance, Robert..!!
robert.bralic@xxxxxxxxxxx read more about Save in JAVA...???


JVM
Message from timothy ma and constance lee
Most recent post: 5/30/2007
2 authors and 2 replies.

Sir/madam

I put little amount of user in each JVM but I found the application almost
hit the margin of JVM size so that the application is very slow. Any idea?
WHat is heap size for as well.

Sorry I am not JAVA expert so I need help. read more about JVM


Message from jupiter
Most recent post: 5/29/2007
2 authors and 3 replies.

I have noticed that the type in generic declarations isn't
"inherited" by new references to the object. This seems
inconsistent to me but maybe there's a good reason for it. To wit:

ArrayList<String> list1 = new ArrayList<String>();

ArrayList list2 = list;

list1.add(new Integer(3)); //compiler catches it as expected.
list2.add(new Integer(3)); //compiler is fat, dumb and happy.

I thought the idea of a reference was to point to the original
object and pick up all of the relevant data. Why not type? read more about Generics references


Message from David Ricketts
Most recent post: 5/28/2007
5 authors and 5 replies.

I'm familiar with all the must own books for C++ developers, the Meyers, the
Sutters, the Alexandrescus, etc. But what are the "must own" books for JAVA? read more about Which are the "must own" JAVA books?


Message from ndac
Most recent post: 5/28/2007
4 authors and 4 replies.

Hello,

assume I've the following:

public interface X<E> {
...
E[] toArray();
}
public class XImp<E> {
E[] toArray(){
E[] a = (E[])new Object[N];
...
return a;
}
}

using this like this gives me a bad cast exception?
X<String> x = new X<String>();
...
String[] a = x.toArray();
(or String[] a = (String[])x.toArray();)

what am I doing wrong here?

Regards read more about returning a generic array


Message from timothy ma and constance lee
Most recent post: 5/27/2007
2 authors and 2 replies.

Sirs/Madam

I encounter the problem on date field.
Sometimes, when there is no date, then it'll return the null object. When
I want to check by

aDate.toString() = "" or null, it throws exception.

How can I ensure they return the value or not.

Please help read more about new to JAVA, need help


Message from Robert Smith
Most recent post: 5/26/2007
2 authors and 4 replies.

Why/How does this work?

I know that if I want to convert a signed byte (ie > 0x7F) to unsigned
number I can promote it to an integer, like this:

byte a = (byte)0xAB; // -85
int b = a & 0xFF; // 171

The bit pattern is 10101011 (0xAB)
If I AND it with 11111111 (0xFF)
The result is 10101011

ie. the same number! so why does this change the number to an unsigned
(positive) number? read more about signed to unsigned. How does this work?


Message from Jeremy
Most recent post: 5/25/2007
2 authors and 3 replies.

I can not get dates to parse with any accuracy. I have a date like this,
for example:

Fri May 25 07:58:46 GMT 2007

I am using a SimpleDateFormat with a format string of:

EEE MMM dd HH:MM:SS z yyyy

When I parse the date and print it back out, it thinks it was:

Tue Oct 25 02:00:00 CDT 2011

Which isn't even remotely the same except for the "25".

Any tips on using the date parser? I guess I could just extract all the
fields into integers and make a date out of that, but it seems like
there is built-in functionality for this and I want it to work!

Thanks,
Jeremy read more about DateFormat.parse issues


Message from mlw
Most recent post: 5/10/2007
5 authors and 9 replies.

Could someone explain why there is no destructor in JAVA classes?

There are many times you need to be called WHEN an object goes out of scope
and not when it'll eventally be freed. read more about Class destructors


Message from DL
Most recent post: 5/8/2007
3 authors and 7 replies.

Hi

I have an array of objects:

Student[] studentarray;

how do I save studentarray to file?

David. read more about How to write Array of Object to a file?


Message from l-EE
Most recent post: 4/24/2007
2 authors and 2 replies.

If I'm writting a bean - and I mean just a plain old JAVA Bean not an EJB or
anything like that - is there any merit to seperating the interface out of
the class? I do this with pretty much every other kind of class I write but
Beans... read more about Programming to interfaces with beans?


Message from Keith McCutcheon
Most recent post: 4/24/2007
4 authors and 15 replies.

I have got a jar file that I'm loading with JAVA's Web Start. When I load the
.jnlp file from a browser, the application installs and runs properly the
first time. If I close the application and click on the link in the browser
a second time, the Web Start splash screen loads for 15-20 seconds and
disappears without launching the app. If I delete the application from the
Web Start utility it'll again download and execute the first time but not
subsequently.

Web Start is configured to "Use Browser Settings" under Network Settings.
I have tried Direct Connection also. The results are the same under Mozilla
Firefox and IE 6.0. JRE's for 1.4.2_12, 1.5.0_06 and 1.5.0_11 are installed
with only 1.5.0_11 enabled currently.

Any thoughts?

Thanks,
-Keith read more about JAVA Web Start


Message from mistonl
Most recent post: 4/20/2007
3 authors and 5 replies.

have a several PCs running WinXP SP2 and W2k SP2 latest patches. all have AMD
or Intel chips with at least 1 gig ram.

have JAVA applet that at times requires ~250 meg of ram. on some boxes it
runs in less than 1 min on other takes over 30 mins.

on ones with 30 mins I notice mem never goes over 150 meg ram usage in task
manager even when box has 600 meg free. on boxes with 1 min time it goes to
250 megs and finishes.
I have tried all versions of Sun JVM from 1.4.2 to 1.6
I went to http://www.duckware.com/support/JAVAhelp.html and noticed that on
boxes that are fast in the JAVA VM: Your JAVA VM reports the following
diagnostic information: section in max mem it said >128 meg or >256 etc

on slow boxes its says max memory: 93 meg.

there are no settings in the JAVA plugin

can anybody please explain read more about why does Sun JVM have a hard max mem limit of 93meg on 2gig pc with no setting done


Message from Robert Larsen
Most recent post: 4/19/2007
2 authors and 3 replies.

Hi

I am developing JAVA applet games and have come across a problem that
seems to exist in the VM from Sun. I have tested in Mozilla and Firefox
on Windows and Linux and IE (several versions) on Windows.

When I run a game applet and then reload the page, two instances of the
game are running in the same VM. I have verified this with JMP
(http://www.khelekore.org/jmp/), and as the more recent games use lots
of memory (up to 42 megs), they run out of memory and throws a:

Exception in thread "Image Fetcher 0" JAVA.lang.OutOfMemoryError: JAVA
heap space
JAVA.lang.OutOfMemoryError: JAVA heap space

If not on the first reload then on the second or third. This also
happens if I close down the window and open the game again. The only
thing that works is closing down all windows.

I have the following in the applets destroy() method:

public void destroy() {
System.out.println("Applet destroyed");
applet = null;
appletAdapter = null;

if (engine != null) {
engine.destroy();
engine = null;
}
System.gc();
}

'applet' is a reference to the applet itself.
'appletAdapter' is a proxy for calling methods on the applet (games can
also run as an application so this object implements methods for getting
"host", "applet parameters" and calling JAVAScript without the need for
an actual applet).
The engine object is the actual game and the applet doesn't have any
other referenc read more about Applets not being garbage collected


Message from TonyB
Most recent post: 4/14/2007
7 authors and 7 replies.

I'm new to JAVA, and'd like some advice on how to keep track of groups
of objects where the number of objects isn't predefined.
For example say I've a toolbox class which contains an arbitrary number of
tool objects. I want to have a method to add a tool to the toolbox object,
and other methods to list the current contents of the toolbox for example.
I could keep a reference to each tool object as added in an array of type
tool but an array is declared with a fixed length, so short of defining the
array to have a some arbitrary large size I can not see how to deal with this
list of objects. I do not want to use a database at this time.
Is there a better way to do this ?
Tony read more about Using arrays of objects ?


Message from R.A.M.
Most recent post: 4/14/2007
5 authors and 7 replies.

Hello,
I am a user of Windows XP and I'd like to learn JAVA, espacially JSP,
Servlets and JDBC. I've a question: what are the most popular web servers
for Windows XP working with JAVA? Should I install Apache, for instance? So
far I was using IIS 5.1, but I wasn't programming in JAVA.
Could you help me please? Thank you!
/RAM/ read more about newbie: popular web servers for Windows?


Message from Matt
Most recent post: 4/10/2007
2 authors and 2 replies.

I've to believe I'm not the first person to have this question.
However, I'm not having any luck finding an answer.

I'm using JAVA 1.5. Say I've the following:

Set<String> a = new HashSet<String>();
Map<String, Object> b = new TreeMap<String, Object>();

Assume somewhere these are populated.

When I check the set for a string using a.contains("bob"), the method is
checking using a case-sensitive search. Similarly, if I did
b.containsKey("tom"), it's case-sensitive.

Is it possible to get these methods to perform a comparison
case-insensitively? Thus, performing:

a.contains("bob")
a.contains("BoB")
a.contains("BOB")

would all yield the same result?Thanks for your time. Cheers,

Matt
-- read more about Case-insensitive collections (sets, maps, etc.)


Message from llloyd wood
Most recent post: 4/7/2007
2 authors and 2 replies.

/**
* @xxxxxxxxxxx(#)MyClock.JAVA
*
* MyClock application
*
* @xxxxxxxxxxx kevin
* @xxxxxxxxxxx 1.00 2007/4/4
*/
import JAVA.awt.*;
import JAVA.awt.event.*;
import JAVAx.swing.*;
import JAVAx.swing.event.*;
import JAVA.util.Calendar;

public class MyClock
implements Runnable{

Calendar now = Calendar.getInstance();
int h = now.get(Calendar.HOUR_OF_DAY);
int m = now.get(Calendar.MINUTE);
int s = now.get(Calendar.SECOND);public void showClock(){
JTextField present;// holds display

present = new JTextField(5); // create display
present.setEditable(false);
present.setFont(new Font("sansserif", Font.PLAIN, 48));

JPanel content = new JPanel(); // put time in display
content.setLayout(new FlowLayout());
content.add(present);
content.setVisible(true);}// showClockpublic void run(){

while (true){
showClock();
}
}
public static void main(String[] args) {
Thread t = new Thread();
t.start();
System.out.println("Hello World!");

}
}
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass I hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom. read more about this is wha i'm working on: any help???


Message from mlw
Most recent post: 3/28/2007
2 authors and 2 replies.

I have a question for JAVA/jsp/web guys

Say you've a cluster of JAVA boxes serving a web site from behind a load
balancer, what is your strategy:

Use a JDBC database, use local files and have the load balancer make
sessions sticky to particular servers, use files on a file based share, or
some other strategy? (Corba, RMI, etc.) read more about JAVA Session Managemnent (HttpSession) question: What do you do?


Message from sk
Most recent post: 3/27/2007
2 authors and 2 replies.

read more about please ignore this post


Message from Carey Carlan
Most recent post: 3/26/2007
5 authors and 10 replies.

Can the bright minds here point me to the JAVA tools best suited to
interfacing a C++ library with the widest range of web servers?

Fundamental question from a JAVA newbie. I'm about to start a web app with
the business logic contained in a C++ DLL (could be a COM object if
necessary). It must be compiled to protect the intellectual property
within. My research to date indicates that JAVA is both portable and
powerful enough to manage my library if I can talk to enough servers.

I will need to host this C++ code on the client's web server, be that Apache,
IIS, or the next new flavor of the month. I'm hoping for many clients with
many different web servers.

Do web servers have a common, standard JAVA interface? Do all web servers
except IE share an interface?

Is JAVA the best interface for this application?

Book and web page references are welcome. read more about Between C++ and web server


Message from ndac
Most recent post: 3/21/2007
3 authors and 8 replies.

Hello,

How should I pass a function as an argument?

Regards,
Pieter read more about function as an argument


Message from Thomass Square
Most recent post: 3/7/2007
4 authors and 6 replies.

... names kevin. I am deaf and looking to learn
JAVA. pls contaxcct me.

k

--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass I hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom. read more about online free tutoring sought




7/24/2008 10:52:57 PM

Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional