Recent update: 2008-5-9

A* Search Algorithm

438 byte By aoifes272a at 2008-1-1
hello ...HELP !!!Having a slight problem implementing the A*Search in Java. We have it calculating the straight line distance from nodes to goal using .cost, however we need to get individual path distances between the nodes, preferably without hardcoding. We were thinking of using the addEdge ...

Unexpected NaN from arithmetic operation with double

1423 byte By Ben_Pha at 2007-11-30
Unexpected NaN from arithmetic operation with doubleI抦 not sure if this is the right place to post this message but I hope someone can help. I'm puzzled by a very strange computational error. Java is multiplying two doubles (a[2]*b[2] or 0.0 * 0.0) and is getting NaN. I've attached the code ...

problem about normal distribution

194 byte By seablue1023a at 2007-11-14
i want write a algorithm to implements the normal distribution formula. i worked hard but without success. does the jave liberary includes one? or please some write one for me. thank you!

Graph layout

199 byte By conscripta at 2007-9-25
Hi,Can anyone help to create an algorithm for arranging a graph as http://www.spss.com/research/wilkinson/Applets/graphlayout.html the "Network" layout on this page.Thanks a lot.

time table algorithm

115 byte By jaya_ra at 2007-9-25
I need to do a project for time table generation. I need the algorithm for doing the same. Kindly send it...

combining characters

530 byte By r5dtfvtsaba at 2007-9-24
I need to take an ArrayList of characters and print combinations of them. The length of the combinations should be from 1 character long to x (an input number) characters long. The characters in the ArrayList can be used more than once. What algorithm can I use?example:x = 5ArrayList contains ...

Union-Closed Families of Sets

6457 byte By h3nrya at 2007-9-24
Hi, I have written a short program in Java that takes as input a text file containing an arbitrary number of mathematical sets (presumably with the property that none of the sets can be formed by union of any of the other sets, although thats not really important) and finds all possible ...

Tank Wars In Java.........Any Ideas Where To Start?

707 byte By vlad123a at 2007-9-24
Hey well i have to make a project for my grade 11 computer science class and i wanted to do something hard. i was thinking of a game called tank wars. Here is an example of the game i want to recreate: http://www.addictinggames.com/tankwars.html. I just need to know any ideas any of u might ...

reRoot algorithm

267 byte By scopriona at 2007-9-24
I`m looking the algorithm reRooting a binary tree:reArange the pointers of the roots (and leafs) and create a new Tree from a chosen root ( =one of the subTrees of the original root).(A Tnode holds data, and pointers to the left and right Tnodes.

Trouble Displaying Buttons in aGUI

5930 byte By some1stolemyusernamea at 2007-9-24
Hello there,can anyone take a look at this very short piece of code and tell me why my JButtons are refusing to show up!/** * Validate.java * * * Created: Mon Apr 24 13:02:50 2006 * * @author <a href="mailto:Samuel@EL-DIABLO"></a> * @version */import java.text.*;import ...

deleting disk quota entry

495 byte By MAKa at 2007-9-24
Hi everyone,I need help on deleting an already existing quota entry in MS Windows XP. I used java to run the commands available in FSUTIL QUOTA in CMD and I was able to create and modify quota...The problem is that I cannot delete an already existing quota entry using java... I used a vbscript ...

Product of Prime Numbers

1127 byte By Vmastaa at 2007-9-24
Hello,Im trying to write another method called primeProduct that takes as input a positive integer n > 1and returns the product of the primes from 2 to n.So far i have only got the program to see if the number is prime or not.Is it easier to write primeProduct in an array? And is the ...

List of Algorithms

141 byte By killerCodingNinjaMonkeya at 2007-9-24
I came across this link and thought it would be useful to my fellow programmers: http://en.wikipedia.org/wiki/List_of_algorithms

How do I find all possible positions?

701 byte By simon_orangea at 2007-9-24
If I have 3 positions and 3 numbers I know there are 6 possible soultions (of having a diff number in each)If I have 4 positions and 4 numbers I know there are 12 possible soultions (of having a diff number in each)I know the function to find the number of diff positions in n! where n is the ...

need help for string

420 byte By shadowssssa at 2007-9-24
i face a problem where i wan compare the contain of the string, let saystring a = "java is cool";string b = "well java is cool";the tokens for a =3 n b=4,i wan compare the whole line using tokenizer, where the b have the similar string on a. the result will be,token 2 3 4 from b is simalar with ...

how i can to implement (Balanced Merge Sort) algorithm?

1300 byte By balanceda at 2007-9-24
轻俞倾 卺磉?Hello for all I want to make Balanced Merge Sort algorithm in my project ,but i face many problems as,I can't make this algorithmand , i don't know ,how i can to establish files to write and read from it ..Example about this algorithm for members who don't know about BMSsuppose that ...

REPOST code formatting error::String Search Algorithms

6863 byte By nottinghamuni_csa at 2007-9-24
Hi im trying to get the program below to work, the method "naive" is redundant but works, its just there to show you what im trying to do. isSpam should be passed a message, and it then needs to use the patterns located in spamPatterns (just a text file read in and separated into separate lines ...

java code statistics analysis

377 byte By barbywarea at 2007-9-24
Hi,I see some product that use "java code statistics analysis" in order to my JR programmer made program as SR programmer or as AP.I think that is better for my apps this tools.I think that this tool could make "robots" and could make that SR programmer to cash more money. I like see a Open ...

poker odds

67491 byte By davidstummera at 2007-9-24
Hi, i found some source code online for a holdem poker odds calculator.i had a look at the code, and tried to copy and compile it. It compiles, but doesn't give the answer i was expecting! bascially it's for a java appletts which you can see here: http://www.jbridge.net/jimmy/holdem_sim.htmAs ...

Stopping thread

651 byte By Zoliqa at 2007-9-23
Hi!!!I have a serious problem with a program i've made.More exactly i have a problem with just a part of the code because i can't stop a thread.This thread is executing a cpu intensive code(i mean the cpu is at 100% when runs this part of code), and i don't know how to stop it.It can be ...

recurrence relations

140 byte By gomaa at 2007-9-23
if we Solve this recurrence relations. may assume that T(1) = 1 then we find O(2^n/2) or n^2 just tell me T(2m)= 2T(2m-1) + 2m

String to BitSet Conversion

941 byte By niall7890a at 2007-9-23
Hello all,I have been trying to find an efficient way to convert some strings into Bitsets in Java. Unfortunately I'm having trouble mapping the string character values to the Bitsets. Currently I read in all of the Strings which reside in a text file in the format:a b c fc da detc. I then ...

string manipulations

1890 byte By bikejokeya at 2007-9-23
Hie dear frenz,Im a beginner here, I would like your help on how to to string manipulations. I have done aprogram that reads a text lines from a file and write it out to another text file. But, at the same time, I need to display the text file line by line and store it in the string, and ...

Algorithm needed: To extrapolate objects from a given class

2949 byte By bhantola at 2007-9-23
I have a following problem: -Given a class with member fields (typical value object) I would like to generate as many objects of this class as many combinations created by the set of setters as well as futher combinations resulting from the different set of values it can take. This class will ...

Difference between two files

1859 byte By lucaz_a at 2007-9-23
Hi, I need to find difference between two files.This is an example:oldfile.txt:This is the old file.I need some help with this task!.newfile.txt:This is the new file.I need help with this task please!.Differences:* old -> new* need -> need* "some" was deleted* please was addedNotice that ...

Shortest Path Algorithm with Djikstra

1054 byte By howsena at 2007-9-23
Hi all,im developing a shortest path searching techniques by using Djikstra's algorithm. My search space is very huge and it is about 100,000 nodes or we can call it Vertex. I store all the nodes and weight of edges in MySql as follows:From|To|PathCostA B2B A2A D9DA 9BC 7CB 7BE 5EB 5CD 5DC ...

Unified login: Design challenge

3194 byte By Kentaurusa at 2007-9-23
HiI have the design challenge of creating an unified login. I have already though about several solutions but I'm not happy with any of them. I'm trying to find a loosely coupled solution.I have, in my application container: -> webapp 1 -> webapp 2 -> webapp 3Each with it's own ...

JgraphT-how to set a weight on an edge of undirected graph

835 byte By LIranya at 2007-9-23
Hello,I am trying to use JgraphT. it sure simplifies things BUT, I think there might be a problem in setting weight on an edge of undirected graph.here are few code lines that stuck:ListenableUndirectedGraph g = new ListenableUndirectedGraph ( );g.addVertex( "v1" );g.addVertex( "v2" ...

mouse listner

264 byte By awwadcoa at 2007-9-23
can any one tell how i can call e.getPoint from another method in the same class that i defined in it mouse listner.means.that i have button event and mouse event and i want to get the point from the mouse event and use it in the button event.

A simple parser

492 byte By Andre-Dantas-Rocha at 2007-9-22
Hi,I'd like to get/replace the methods implementation of a java file. Like this:public class A { public void myMethod(String s) { XXXX }}getMethod("public void myMethod(String)") > returns "public void myMethod(String s) { XXXX }"replaceMethod("public void myMethod(String)", "public void ...

parsing Newick tree (recursive descent parser)

5839 byte By thenestorx at 2007-9-22
I am trying to parse a Newick formatted tree, which looks like this:(((One:0.2,Two:0.3):0.3,(Three:0.5,Four:0.3):0.2):0.3,Five:0.7):0.0;( http://evolution.genetics.washington.edu/phylip/newick_doc.html tells more about the format)The string above represents a tree:+-+ One+--+| +--+ Two+--+| | ...

autocorrection searching agorithm

728 byte By javafun at 2007-9-22
I have a database includes list of book names and price.when key in a book name, system will return its selling price. however, if user keyed in name wrongly, for exmaple. "risl management" instead of real name "risk management", my system won't know how to handle this type of problem. another ...

Code for RFE - Collections.remove/retainAll(...)

7645 byte By rkippen at 2007-9-22
[nobr]The following code is for the benefit of the Java community to improve the performance of the removeAll and retainAll methods when removing elements from an array.The following is the link to the RFE: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5028425The following code is provided ...

Reducing probability with random numbers

461 byte By Adnan_Durrani at 2007-9-22
Hi all, I am trying to create a FilteredRandomizer. I have a range of values (e.g) [MIN , MAX]. I want to reduce the probability of some specific numbers, for example I have range from 1 to 4, if I am generating them 1000 times each number could be generate 250 times. I want number 3 to be ...

parsing a messy file

2281 byte By o37355345 at 2007-9-22
Hi guys;i have a .txt file that contains data that i want to pick for some manipulation...the structure of one record in the file is as follows:in a line it has : ID, fname, Lname, section ...in the second : the first 15 days of the month :01,02,....15in the third: the coresponding hours worked ...

Machine Authentication

583 byte By akhawaja at 2007-9-22
I am trying to come up with a way to do machine authentication in a generic way. Basically, what I was thinking that I will create a simple java class, with my public key embedded.When user will run the program, it will use the local machine's MAC address, encrypt it,and write the information ...

Getting ordinal numbers on clustered servers

363 byte By Tomasits_Akos at 2007-9-22
Hi!I would like to write a server-side program which generates guaranteed ordered numbers (incremental, no hole and duplication) in a networking environment with clustered servers (Used by many clients and Lotus Notes). How should I start doing this? Where can I found great documentation for ...

increse the array sise

4250 byte By kill1234 at 2007-9-22
Hello;I am implementing a stack base on array, and the array size will auto increse by double the array size, if the array size is full, But I got a problem that I do not know how to increse the array size. Could anyone help, please.Thanks. import java.lang.*;import java.util.*; class Stack ...

how to re-write a file

224 byte By kbr1412 at 2007-9-22
hihow can ı re write a file without loosing before ı wroteı mean thatin program ı wrote something in a filelater ı want to add something in file again

Grayscale images:

1139 byte By Stephen9500 at 2007-9-22
Hello,I am writing a basic Image processing system, which reads an grayscale image, stores the pixels in an 2 dimensional array, then writes the array back to an bufferedimage for writing to file . I felt the bufferedimage was too slow to processing.I discovered, when coping the bufferedimage ...

zip distributes over aggregation?

4232 byte By asjfa at 2007-9-21
hi, for the zip algorithm in java.util.zip doessize(zip(A) + zip(B))==approxsize(zip(A+B))?I've run the code below on a few directories of a couple of thousand files and the results seem to more or less say yes. This seems surprising because I'd expected zip(A+B) to be able to compress more ...

Sort?

283 byte By j3boXa at 2007-9-21
Hi all~It may be stupid to ask but I am totally new to this java programming...i will be thankful if any kind soul can help me out on this :How do i implement new algorithms in java, using MergeSort and SelectSort as examples?thank you very much!!!

Fast Fourier Transform in Java

637 byte By james_besta at 2007-9-21
Hi.I'm studying computing at university, and my dissertation requires me to work with sound. Amongst other things, I need to find the frequency of some sound data coming into the computer via a microphone.I understand that I need to use a fast fourier transform on this data. I have chosen to ...

How does repaint work?

49 byte By raheel_siddiquia at 2007-9-21
Can anybody tell me how does repaint work.

Navigating through a 2D array based maze

1245 byte By thc_ibexTalismana at 2007-9-21
Ok guys, I know you all hate being asked for outright answers so I hope this isnt the case, but i really need help.I've been designing a maze that loads up a properties file into a 2d array called coOrdinates. These coordinates relate to a bunch of static ints (Wall, Inner, Sprite, EndPos, ...

2D Gauss fitting

157 byte By feleexa at 2007-9-21
Hi !I have a matrix 11x11 and I need a 2D Guassian Fitting algorithm !Does anyone know where i could find one ?ThanksFelix

sinus equation

160 byte By Lord_of_the_chaosa at 2007-9-21
What is algorithm for sinus?so if I would like to count sin 3= Math.sin would lead just to native method so no learning from source files.

How to implement Kuhn-Munkres Algorithm ( Hungarian Method ) ?

4544 byte By S.Y.Leea at 2007-9-21
public class Hungarian {Hungarian ( int[][] matrix ){//input a n by n matrix}private void initial(){//some initial process}public int getMin(){//main ideainitial();rowSubtract();columnSubtract();while( minCover() < this.size ){modify();}return findSolution();}public int getMax(){//main ...

Connecting to database logic

671 byte By hfs1981a at 2007-9-21
I need help to define the best approach to avoid connection jam.I am writing some classes that read xml file, save to local disk, parse its contents, send receiving notification & insert the contents in oracle database. The xml file is sent over a network and I have a listener (servlet). ...

Right way to build / use quad tree?

975 byte By harleyranaa at 2007-9-20
Hi, the quadtree data stucture seems so simple, and fits alot of problems, but coding it properly is a problem.The purpose of the tree is to find which objects are with in a visible area.So each node has dimensions x,y,width, height. And child a,b,c,d. Plus a object list.The main method to ...