Singleton Vs Static

1013 byte By vipinzee at 2007-9-30 11:02:12
We generaly use a singleton class when we want only a single instance of that class to exist.Why cant we use a class with all static methods and all static member variables for the same purpose.what is the difference between the following two classes.public class ClassStatic{private static ...

Cumulative Distribution Functions

368 byte By MarkFairchild at 2007-9-30 11:02:40
Like a fool, I sold my first year statistics textbook and have regretted it ever since. Help a guy out?It goes like this: I have two random variables, X and Y, for which I know the cumulative distribution functions. I have a third random variable Z, which is just X + Y. Is there a formula ...

MultiDimensional structure

747 byte By B_Martins at 2007-9-30 11:03:23
Hi,i need to create a multidimensional structure let's say with n dimensions.I only know what n is and the size of each individual dimension at runtime.I cannot use an array because it's not dynamic, so curently i am using a Vector of Vector's.If i know the number of dimensions it's easy to ...

Counting sort

928 byte By MonkeyDLuffy at 2007-9-30 11:15:29
Hello all..I want to make a Counting sort that sort an array[1],...,a[n] of integers, which each in the range 0 to m, inclusive.The algorithm may look like this://....start of algorithmInput Parameter: a, mOuput Parameter: aCounting_sort(a,m) {//set c[k] = the number of occurence of value k in ...

Multiple Instances of a field in a FORM

683 byte By puneet_ugs at 2007-9-30 11:17:02
I have a FORM which can have multiple instances of a single field. Each of those fields can have a different value.Now when I submit the form, I will get those attribute values as an array.For eg if I have a field say Owner which is present multiple times on my Form, when I submit FORM then I ...

Limiting oputput bandwidth

1228 byte By valjok at 2007-9-30 11:19:59
Some Server have multiple TCP clients and the goal is to fix output bandwidth on per client basis (each client has its own limit). The implementation will be done using FilterOutputStream. I'm itnerested in the algorithm. Currently, I mark the connection establishment time. After each write ...

Parsing request parameters

546 byte By xfactor973 at 2007-9-30 11:20:28
I have data that's coming from a network connection in the format as followsreceiver_email=someone%40hotmail.com&receiver_id=I9OWF2HNCR2XH&business=paypal%40yourdomain.com&item_name=Item1I wrote a simple algorithm to parse the data based on the = and & characters. My question ...

Tree creation algorithm needed. Experts pls help

515 byte By alexleong at 2007-9-30 11:26:31
hi,I'm writing a program that read data from database to create a Tree. The database table:DATAPREDATAPOSTDATA145267312489If the DATA has a PREDATA, it will be inserted into the left node otherwise null and POSTDATA will be inserted into right node. For example if I pass in 3 the Tree should ...

sound segmentation

605 byte By tazze at 2007-9-30 11:31:21
Hi,Im trying to analyse soundfiles. In every soundfile there are sounds from one real instrument. I want now to separate these sounds. I did count the sum of segments running over the soundfile and comparing them with a threshold but that is not getting exact segmentations and only works if the ...

chromatic tuner

643 byte By enlowe at 2007-9-30 11:32:51
I'm working on a chromatic tuner. I use FFT to get the frequencies from the sound samples and then find the freq with the most power. The tuner works well for the most part. My problem is this: Some of the notes are being read as an octave above the correct pitch. It seems to be the same notes ...

Sprite collision

145 byte By must41 at 2007-9-30 11:35:10
How can I detect a collision between two rectangles? I'm now doing it with a few points but there has to be an algorythm for that!

image reading + bitmap vector conversion

281 byte By lulusheriff at 2007-9-30 11:37:22
Hi, I am trying to write an algorithm that reads in an image file and extracts every single pixels, checks whether it is black or white and stores 0 (black) or 1(white) ina 2-D array. So what steps should I take to read those pixels?Cheers,Dinaz Sheriff

URI/URN Parser?

198 byte By xaviesh1 at 2007-9-30 11:43:22
Does anybody know of an existing URI/URN parser that can parse not onlythe scheme but also all the parameters. For examplemailto:abc@def.com?subject=subj1&body=body1

Waveform drawing

388 byte By tazze at 2007-9-30 11:45:54
Hi,I want to make a waveform drawing panel. If i use a zoomed out look of the wave it doesn't seems to be the correct output like audio editors use. If the wave is zoomed out , for example, i paint every eighth point from the samples a line to the next eighth point.How do audio editor paint ...

OCR/OMR code

322 byte By fenril06 at 2007-9-30 12:11:56
Hi!I've tried unsuccesfully to find an algorithm of OCR /OMR over the web...I would like something not very complicated cause I just have to scan 4 boxes (a,b,c and d) to verify which one has been marked with a cross.A typicall form actually...If anyone has an idea or a link thank you! ...

Implementing class events

1044 byte By jim.cp at 2007-9-30 12:32:05
I was reading the Collections FAQ:"... Why don't you provide for "observable" collections that send out Events when they're modified? Primarily, resource constraints. If we're going to commit to such an API, it has to be something that works for everyone, that we can live with for the long ...

Reordering an array based on the change in a value at one index

1204 byte By aryasanyal at 2007-9-30 12:36:16
I have a problem with reordering an array when one of it's values is changed.I can state the problem as follows :Suppose there is an array of size three(3), consisting of elements 0, 1 and 2 at the respective indices. Now if the value at any one of the indices is changed, like 0 is changed to ...

Genetic Algorithms for Optimal Graph Reduction

818 byte By PRASHPSG at 2007-9-30 12:37:45
Hello all,I am currently carrying out a project that involves using some genetic algorithms to solve optimal reduction Problems in a graphical term rewriting system. I want the algorithm to find the optimal positions for rewriting or reduction in this caseI need to represent chromosones in tree ...

faster Math (sqrt, trig)

204 byte By super_joel_04 at 2007-9-30 12:45:59
I would like to implement those functions myself. The speed is all that matter, the accuracy does not matter. Trig functions are especially slow in java and are the most important to improve

how to re-write a file

224 byte By kbr1412 at 2007-9-30 12:48:47
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

Compression API in J2ME

186 byte By Tjoa at 2007-9-30 12:54:29
Hi, I currently doing a project which needs the API for data compression in J2ME environment. Does anyone here have or knows about this API. Thank You.

number format

202 byte By cmartinezrazola at 2007-9-30 12:57:02
I want to write numbers in fixed format. I mean, using only 8 characters as it happens on the display of a calculator. What's the best way to format that numeric string? Thank you.

Achitecture for finite element models input file

472 byte By cmartinezrazola at 2007-9-30 12:57:35
Hi,I'm mechanical engineer and I like programming too.Do you know about finite elements models used for structural analysis in mechanical engineering?I would like to know what architecture you would chose for the input files of this kinds of applications. On the meantime people use NASTRAN ...

arraylist and objects

1211 byte By deus452003 at 2007-9-30 12:57:49
I want to search through the arraylist by name and then print out the information at the index that it is found.Both the getname and print method are declared. Can someone tell me why this algorithm doesn't work. The compiler isn't giving me any errours. I am using a constructor and storing ...

Mutex Problem

2537 byte By chops316 at 2007-9-30 13:03:24
I am trying to implement Eisenbergs and Mcguires algorithm for the mutex problem using the following codeimport java.io.*;public class EandM2 extends AbstractTestThread{ public static final int IDLE = 0; public static final int WAITING = 1; public static final int ACTIVE = 2; public static ...

Rule Base Engine

613 byte By AminEmami at 2007-9-30 13:05:29
Folks,In an enterprise system, the rules are variable in a year and they may change. The rules and data are somehow dynamic. The dynamic data exists in a RDBMS but about the rules, I want to put them in a Rule Base Engine. If they are hard coded, the system is not flexible again the changes. ...

How to get around FFT leakage?

1244 byte By Hasooni at 2007-9-30 13:05:42
Im making a Java game that is played by a person's brainwaves, rather than any keyboard of mouse input.To convert analogue brainwaves into digital numbers than can be used as game inputs, I have to use FFT - since im interested to know the amplitudes of the alpha(8-12Hz), beta(16-20Hz) and ...

How can I compute a very precise value for e?

797 byte By carr_onstott at 2007-9-30 13:09:59
So I've been looking around for a good algorithm to compute a very precise value for e. All the algorithms I've found all use a derivative of the old summation from 1->n of 1/n!. And this is accurate, however I need to calculate e out to several thousand decimal places and you simply ...

getting page from php

320 byte By jeroen_dhollander at 2007-9-30 13:12:32
I dont know if this is the correct forum, but it's the best I can find.I need to download a webpage, but it's on a php-using server... I do have an account on that server, so I basicly need an algorithm to submit my user info to the webpage, so I can acces them...any suggestions?tnx ...

Zip help

175 byte By Tjoa at 2007-9-30 13:20:08
How do we check if there are multiple files to unzip ?Is there a the method in the java.util.zip that allow us to check for multiple files ?

Algorithm complexity.

583 byte By Lord_of_the_chaos at 2007-9-30 13:23:58
What is the complexity of this problem?It's my old problem, it was presented on this board a while ago.You have a ball. The ball is in a 3D space. It's moving on some trajectory that is unknown. There are a lot of other balls. You know starting positions of balls, expected destinations and ...

multi-objective GA package

318 byte By jboeing at 2007-9-30 13:24:33
Does anyone know if anyone has made available a package for multi-objective genetic algorithms (such as NSGA-2 or SPEA-2)? I found source in C, but here at work, we need it in Java. I had no luck with Google, and if nothing shows up, I can start porting from C (at least it's well-written ...

ask help

1565 byte By kill1234 at 2007-9-30 13:26:01
Could anyone help me to implement a fastest fibonacci with recursive , and use the BigIntegers for avoid the integer overflow problem, the methods like "static public BigInteger fastestFibonacci(int n);the Fibonacci is defined as follows;fibonacci(0)=0;fibonacci(1)=1for all ...

GA

178 byte By ManjuTheGreat at 2007-9-30 13:27:08
Has anybody written a Genetic Alorithm in Java or any other language...if so I would appreciate if he/she can send me a concrete example.... manju_RN@rediffmail.com

using rewrite strings to optimally shorten an input string

2453 byte By asjf at 2007-9-30 13:27:26
hi, I would like to find the shortest string possible given a rewrite relation (a Map in the code below) and a string.The map has a special property that anything mapped to cannot appear in the input string (this is hacked in to the implementation below by surrounding the r.h.s with !s)a simple ...

Search Algorithm

839 byte By xfactor973 at 2007-9-30 13:28:41
Hi everyone,I like to use winamp all the time and it has a jump feature that can jump to a song if you type a few letters that are contained in it. So i'm trying to apply that idea to a directory i have on my computer that has too many books to look through to find anything. My first thoughts ...

Conversion from Hex to Ascii

238 byte By anilntm at 2007-9-30 13:31:38
hiI had to convert a value in hexadecimal to its corresponding ascii value.How can it be done ?( eg:313233(hexa) will be 123(ascii) ) Pls help me with a sample code.thankxAnil

Optimize Container Loading

427 byte By santan_1 at 2007-9-30 13:32:04
I have an application to code that is about loading a Container in an optimized way, I do not know how to start the algorithm, I looked at the Genetic Algorithm but it is only about optimizing the exeistig situation,but how can I load lots of different shaped objects into a Container that has ...

files in java

1899 byte By deus452003 at 2007-9-30 13:34:10
I am trying to put an array into a file and read the array from the file. I am using FileOutputStreamObjects and FileInputStreamObjcets. I have serializable implemented and here is the code. The code compiles but and the Save method seems to be working because i checked it with MS-DOS so I ...

Anyone know a chaotic 1 to 1 function of whole numbers?

828 byte By jeremiahrounds at 2007-9-30 13:35:59
Question:Do you know a function that fits these requirements1) Its chaotic (other then knowing the function a value cannot be used to predict the next value of in the sequence)2) Its guarenteed to be 1 to 1.Range is whole numbers 0 to 32^2-1. Domain is whole numbers 0 to 32^2-1. Each number in ...

run time problem

1464 byte By kill1234 at 2007-9-30 13:36:12
Hello; The following is the code for recursive fibonacci , but i got a problem with run my code, when run my code with "java Fib 20", it come up the result in 1 second, but when I run my code with "java Fib 50" or up to 50,I wait for 10 mins, i could not see any things, I am runing in linux ...

Reshape Array

533 byte By chungkp at 2007-9-30 13:37:00
What is the most efficient way of converting from 1D array into a 2D array? I know the easiest way is to do something like:k = 0for( int i = 0; i < array2D.length; i ++ )for( int j = 0; j < array2D.length; j++ ) { array2D[j] = array1D[k];}But this is rather inefficient for handling a ...

Bin Packing Algorithms

186 byte By santan_1 at 2007-9-30 13:39:04
IS there anybody knows about the bin packing algorithms, I searched the web but there is not any usefulsource for me! can you tell me a book name or a resource name.

novice question regarding finding components

1229 byte By jack_ingoldsby at 2007-9-30 13:41:13
Hi,I am a novice to Java (and not that experienced with programming.) I am looking for a library of basic reusable components. Most of the stuff I want is fairly simple, but for the college assignment I am working on, I would get a better grade for reusing robust external components rather than ...

negamax

158 byte By pollacchi at 2007-9-30 13:43:38
does anyone have code for the negamax algorithm in order to build a game tree for a draughts playing program. Any help would be much appreciated

search engine challenge!

133 byte By lolidus at 2007-9-30 13:46:07
Write a program in C++ or Java that will take as input two Web pages URLs and find a path of links from one to another.

OutOfMemoryError

1767 byte By kill1234 at 2007-9-30 13:47:24
Hello; I am implementting for insertion sort, but when I run my code, it report the following error, If my array side > 100000. Could anyone help me, Thanks. Exception in thread "main" java.lang.OutOfMemoryError [code]import java.util.*;public class InsertionSort{ public static Random ...

increse the array sise

4250 byte By kill1234 at 2007-9-30 13:49:48
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 ...

Map algorithms

600 byte By Lord_of_the_chaos at 2007-9-30 13:50:01
Hi I'm creating a few map algorithms. A nasty map generation. Any Ideas and recommendations? I have a few rather effective algorithms, I prefer non fractal ones, that are able to create maps at sizes 1000x1000. They are not stat of art however. Because on the Internet is a pretty low amount of ...

Converting String to BigInteger

205 byte By cinunited14 at 2007-9-30 13:51:06
Hello,I am wondering how to convert user input string such as "hello world" to a BigInteger using the constructor public BigInteger(string val);How does this work exactly? I do