arraylist sorting problem

984 byte By bonomela at 2007-10-2 9:54:06
Hello everybody,I'm fairly new to Java, and my first real project which also implements jsp was going very well, until...I had to sort an ArrayList, which holds object with only 2 attributes, a String uid, and an int diff.I want to sort this ArrayList in ascending order by int diff.So ...

XMLParser exception

409 byte By Nehaa at 2007-10-2 9:54:21
Hi..I am getting the following exception while running a servlet on Apache tomcat[Fatal Error] :15:184: The element type "HR" must be terminated by the matching end-tag "</HR>".From XMLParserorg.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag ...

Command Pattern (Invoker returns Command) and constructors

2352 byte By young_matthewda at 2007-10-2 9:55:02
hej,Using the Command Pattern to run DAOs with a bit of business logic so that I can have a different types of Invoker (Command handler) classes depending if transactions are managed a SLSB or a local test client using JTA. Beyond organizing commands there isn't much hassel with using the ...

Returning Business Objects to View?

617 byte By Liggya at 2007-10-2 9:55:07
All,I was just in a meeting where two different approaches to returning data to the view were discussed.In a nutshell, here are the two options presented:1) The service layer should return the Business Entities entirely (which happen to be Hibernate objects).2) The service layer should return ...

Best way to synchronize in a Singleton

3304 byte By pgeuensa at 2007-10-2 9:57:50
I have this classimport java.util.ArrayList;import java.util.List;public class SynchIssues{ private List values = new ArrayList(); private static final SynchIssues singleton = new SynchIssues(); public static SynchIssues getInstance() {return singleton; } public void addValue(String value) ...

Shared resources

510 byte By DesarrolloScreenNamea at 2007-10-2 9:58:15
I don't know if this is the correct forum for my question.My application has to assign an appointment with a doctor. But there are many users (patients) compeating for this resource. I thought of blocking this resource until I collect all the patient information, but I'm not quite sure that ...

Singleton -> Constructor needs a parameter :(

929 byte By toniG.a at 2007-10-2 9:59:09
Hello,i have a Problem with the Singleton Pattern.Following situation:I have a class (Commander) which starts all the dialogs of my Swing Application. For this it starts first the BPs and they start the dialogs.The BPs need my mainprocess class in the construtor to set the its parent. So, my ...

Please....... Explain Polyphace Balanced Merge Sort

241 byte By balanceda at 2007-10-2 9:59:45
Hi for all............Please ,I want from you to explain Polyphace Balanced Merge SortHelp Help Help Help Help Help Help Help Help Help Help Help HelpNote: I hope to give detailed explainationThanks FoRrVeR

Generic methods in DAO

2756 byte By Liggya at 2007-10-2 10:05:39
All,Is loose coupling/method reuse in the DAO a good thing?In the method example below, methods in the DAO would all invoke this generic method to dynamically build the stored proc to call, and execute it.Is this good design? or overkill? or problematic?private void executeStoredProcedure(Long ...

Layers in a Struts application

1779 byte By sbelslya at 2007-10-2 10:06:46
I am looking for comments/suggestions on appropriate layers and dependencies in a Strus application.We currently have FormBeans, an Action layer, a Service layer, a Business logic layer, some Utilities, the Model objects, a Persistence layer and a Helper layer.The Action layer is supposed to be ...

Loop algorithm

1406 byte By r.hollensteina at 2007-10-2 10:07:10
I got the following code:VectorVector<String> v = new Vector<String>();for (int i = 0; i < 10000; ++i) // For example{v.add(str1 + str2 + str3);}where st1, str2 and str3 are strings that change through every iteration, so they can't be added from before.The adding line is quite ...

kill threads

147 byte By Albertitoa at 2007-10-2 10:07:32
hi! I'd like to kill many threads I throw. I use Thread class. do have I to kill them using "join" or "interrupt"? thank you!

puzzle about prototype pattern

535 byte By dxuranusa at 2007-10-2 10:08:10
is prototype just use clone substitute the "new" operation? but client must know about manager and concrete products and initial manager with products he or she wants,so what's use of this manager and clone-- if client want to get product, he or she must "new" it and then clone it .in my view ...

cannot open chess applet in yahoo

1114 byte By tredoucea at 2007-10-2 10:12:55
i am having an issue with yahoo chess ( my fave game and i cannot seem to be able to access the rooms for it.i can pick an actual room like the " rat pack " but it says " please wait while the applet loads (could take 3 minutes) if it does not click here " well it gives me that good ol broken ...

implementation of MVC

368 byte By brainydextera at 2007-10-2 10:15:30
helloIve read about the Model-View-Control Architecture and understood it ,theoretically atleast!! Ive found huge coding fr explaining the concept. Thus I am unable to visualise this pattern in terms of coding. Can someone please explain it to me with a simple example and some method ...

incorporate java code

1364 byte By sparky132a at 2007-10-2 10:16:05
I have no idea where to start with this! I might even be posting in the wrong forum. Anyway - here's my problem.I have algorithms which I have written. They all all perform a task, but have different approaches to it. They all implement an interface I have written.Now. I want to design a GUI ...

2D Graphics tutorials

247 byte By CoMaa at 2007-10-2 10:16:22
Hey guys, i want to write a 2D FPS. Unfortunatly i dont know much about this sort of programming (i do java at universtiy, but its all swing). Does anyone know of any good tutorials in 2D graphics handling , animation etc?Thanks Dave

Program - User Interface

890 byte By _Yonder_a at 2007-10-2 10:16:38
How is this supposted to be connected with good programming practise on a class-diagram level?Say I have a board game, say tic tac toe. All my logic are in the classes Board, Player and Move. I also need a GameController class that controls the game. Now I want to have an UI for this game. Say ...

Which EJB patterns are motivated by minimizing network calls?

1354 byte By lightbulb4321a at 2007-10-2 10:17:08
Hi, I'm reading a book on EJB patterns, and the motivation for many patterns seem to be minimizing network calls. If my application server and web server which serves as the EJB client are on the same machine, then to what extent should I consider the minimization of network calls as a factor ...

Command pattern

1171 byte By bachewa at 2007-10-2 10:19:17
I'm new to this design pattern (and this forum too). I would like to know about your experience and advice on command pattern.Is it OK to implement it this way?TypicalCommand cmd = new TypicalCommand();TypicalInput in = new ...

method overloading doubt

165 byte By HelloTamilaa at 2007-10-2 10:20:03
In java ,Is method overloading is a compile time polymorphism ?I mean all those method calls will be decided at the time of compilation .. am i right ?

Parser - Reader - ..

717 byte By sdegardina at 2007-10-2 10:20:05
Hi everyone,I'm developing a bacth application.This application has to read a file in which each line represents a Business Object.To parse this file i've done a static method which, from a line of this file give me an Object.that's ok !.But, i've also done a Reader (suchn as ...

out of memory error

253 byte By David_Bakera at 2007-10-2 10:22:32
We are getting out of memory errors that do not seem to be associated with the heap ,because we are monitoring the available space and there is plenty of space.It happens when the class loader is loading a resource.Is this possible?

Property, Attribute, Parameter - difference?

162 byte By throwablea at 2007-10-2 10:22:37
Hi,I know sounds silly, but what is the difference between Property, Attribute and Parameter? In what cases every of this words is used?Anton

virtual world and war game

107 byte By jonathanz1980a at 2007-10-2 10:23:50
I am looking for a java engine/framework to develop virtual world and war game. Any recommendations?

Passing by Reference

258 byte By Saisha at 2007-10-2 10:23:52
Well, Daffy up and got that thread deleted for us. Too bad the admins could not save a few of Loko's excellent explanations that were contained therein. Starting a new thread in case anyone wanted to post a recap. Nice job Daffy.- Saish

Where's that thread?

279 byte By Marcelo9a at 2007-10-2 10:24:00
What happened with the latest daFei's thread? It was not so useful thread, but at least there were a lot of interesting and important replies there, posted by the others.Did someone here ask to delete that thread? Or did Sun decide to do that, without our request?

Best data structure to maintain top N elements

744 byte By toyrunra at 2007-10-2 10:24:43
Hello,The problem at hand is the following. I need to run 1 million search and return back only top 100 scores. I do not wish to store all million scores, sort them and only return top 100. I'd like to maintain a "list" of top 100 scores. As new search produces a score, I'd like to very ...

Design of a messanging application

1374 byte By mackXjacka at 2007-10-2 10:27:05
HI all, i am designing a messenging application which has following modules : UI Module DB Module Messenging Module UI to DB connector UI to Messenging connectorMy problem lies in Messenging module. The purpose this modules is, it should provide a destination for the messages and an interface ...

Declutter layout algorithm

959 byte By zcox522a at 2007-10-2 10:29:05
Hi all you algorithm gurus - I'm looking for ideas for an algorithm to solve the following problem. It's specifically meant to "spread out" or "declutter" the overlapping vertices in a graph visualization system, but I'll state it in more general terms.In a rectangular area of the screen ...

Steganography implemented in Java with QIM Dither Modulation

368 byte By tm022woolfya at 2007-10-2 10:29:52
Hello wondering if anybody can advise me on how to get started with this ?I am starting a project where using Steganography as digital watermarking tool to insert text into an image.I am using the quantization index modulation method with the colt maths package to implement the equations ...

Dealing with nulls

1783 byte By fragorla at 2007-10-2 10:31:03
This is very non-specific question, I'm sorry. Still, it's something that comes up from time to time when I write java.Basically, suppose an object takes a list of something in it's constructor. The object expects that that list of something contains no nulls - ie it calls a method on each ...

Insersion Sort with Classes

2078 byte By Cobbweba at 2007-10-2 10:31:10
Hello. I'm doing an insersion sort for an array of pet's in a store. Im running into two problems. My first problems is im trying to use the compareTo() to compare the name of each of these pets. Im running into a null pointer exception but dont know what to do about that or why im getting ...

Composite desing pattern & exception handling

4347 byte By jvaudrya at 2007-10-2 10:31:50
Hi, I've been thinking about how to write a reusable composite object. Basically this would be a simple implementation of the composite pattern, but would be general enough that you could reuse it in many places. Here is an example?after the examples I talk about my problem./** * Composite ...

Database application design help

2538 byte By ramndra at 2007-10-2 10:33:32
I need to develop a application using swing and SQlserver.Though it is not web based one,three computers connected to my computer will run the application parallely.ProblemI have a JTable which will show the database table contents.I have two designs:1) To have a helper class( contains static ...

Random sequence evaluation

253 byte By gilroittoa at 2007-10-2 10:33:36
Hello,does anyone know about libraries or methods to evalutate a random sequence for weeknesses in the sequence? E.g. java.util.Random is a far from perfect pseudo random generator, and such a method might be able to detect that.Gil

OO Design question

632 byte By nereidahoxhaja at 2007-10-2 10:33:39
Hi,this is my question:I have some heterogen classes lets say:class A, class B, class C and class Dclass A implementsmethod amethod bmethod cmethod dmethod zclass B implements method emethod fmethod cmethod dmethod zclass C implements method gmethod hmethod imethod jmethod zclass C implements ...

ploblem Bomberman

179 byte By sonic02ita at 2007-10-2 10:34:17
Hi..How to make the 4 way of bomb and continue bomb in the game like bombermanplease help me....if ((keyStates==FIRE_PRESSED)){ ?}

Factory pattern and overriding

712 byte By Dylan68a at 2007-10-2 10:34:48
Hi all,I'm currently refactoring an application which uses two different libraries according to the user input.There is a Factory class who returns instances of, let's say, MetadataB and MetadataB, both subclass of Metadata.This is fine if the user calls one of the method exposed by the ...

Dijkstra's ALgorithm

428 byte By SKS7a at 2007-10-2 10:36:37
Hi there,I am a college student. I am currently working on a project that involves me programming the Dijkstra's algorithm and then producing a GUI that will show this algorithm running on a pre-defined graph.I have looked on the web and have found code but I still don't know where to begin. ...

Which pattern best suites a diagram application?

445 byte By globba at 2007-10-2 10:37:39
Hi all,I need to implement an application such as Rational Rose or Visio.I am intending to use the mvc pattern as all the info i have points in this direction.I think MVC, Decorator, mediator, builder, etc are all possible candidates but susspect that MVC is the best. Can someone please either ...

Initialise Array

256 byte By g_p_javaa at 2007-10-2 10:39:19
Hi guys,When we want to initiliase an array P which consists of N positions,do we have to initilaise all the positions in order to point to NULL?This demands O(n) time although we may not use all the positions.Thanks,in advance!

Avoiding Busy-Wait When Opening a Thread's Input Stream

963 byte By Jus144ticea at 2007-10-2 10:42:09
I am trying to avoid using busy wait when, after opening a child thread's input stream, I wait for it it to be ready before I start reading from it. A segment of the code follows:BufferedReader reader=new BufferedReader(new InputStreamReader(child.getInputStream()));while (true) {while ...

Finding Square Roots w/ Recursion

666 byte By msd59a at 2007-10-2 10:43:21
I'm trying to write a method that finds the square root of a number using recursion. So far i have the following:public double rootMeth(double a) {if (a < = 1)return a;elsereturn a / rootMeth(a-2);}I know this is not right, but it does work for a few numbers, if you can help it would be ...

searching appropriate String and return the accurate

804 byte By 6666a at 2007-10-2 10:43:24
hiIf I run the following Queryselect P.ECMSKU ITEM_ID, P.ECMLDS ITEM_TITLE, 'ESH' ITEM_TYPEfrom ECMMST PwhereP.ECMSTS = 'A'AND UPPER(P.ECMLDS) LIKE UPPER('%?%');Result:suppose if I pass " yamaha uprirht piano"The result set contain so many records.I want to get reuslt like thisfirst ...

separating a sentence into words

258 byte By rock_chica at 2007-10-2 10:44:05
hi there..what is the best or most efficient algorithm for separating a string into words? the string contains a sentences and phrases, and i would like to have them separated into words..how can i do this manually? without using a native java method?

Ant Colony Optimisation using Java

477 byte By Eclipsea at 2007-10-2 10:45:54
I am currrently working on a project to solve an 'advanced' TSP problem using ACO.I have been unable to find any source code as yet for an implementation of ACO using Java. I intend to use some existing free to use code and build on top of this the features I need to solve the new TSP ...

Drift stability algorithms

499 byte By herrena at 2007-10-2 10:46:04
I am currently looking for one or more algorithms in detecting a stable drift in the voltage/potential of a electrical measure device. I have googled a bit but I am having problems finding something relevant.I must admit that drift is a relative new term for me, so there are perhaps some ...

Singleton Implementation, is this Singleton?

1471 byte By Cana_Bravaa at 2007-10-2 10:48:37
public class Wrapper{public static MyClass createInstance(){return new MyClass();}}I have seen this , this is not a singleton, since im creating a new MyClass, whenever i call the static method createInstance(). Am i right?this is , right?public class Singleton { private static Singleton ...

Saving the State!

662 byte By vics_31a at 2007-10-2 10:48:45
Hi GuysNeed a bit of help in designing a framework to save and subsequently restore the state of an object in a relational database.To elaborate, the object is a JButton. It's property of interest are background color, label and whether or not it is enabled. I have created a bean to represent ...