Ganesh Ram

Ranch Hand
+ Follow
since Jul 20, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ganesh Ram

Yours is an interesting situation.
There are couple of approaches based on the options you have.
Do you have represent every single record on the graph?
If not,
Let us say you have alloted 800 as the max you could get.
and you actually get only 600. One way of dealing with this is
split it into multiples that would also be multiples of the
max. So represent the first 400 as it is and for the next 200,
use a broader graph scale so you would drawing a line every alternate pixel.
If the actual exceeds, the max, you can represent every alternate intially with a narrow scale and then switch to regular scale and represent the most recent.
Here the assumption is that most recent is more important.
Well, my solution is a result of 2 mins of thinking so this is more of a quick response.
I hope this gives you some off the track info.

22 years ago
BitSet replaceChars
replaceChars = new BitSet(256);
String s = "your string";
for (int i = 0; i < s.length(); i++) {
int c = (int)s.charAt(i);
if (replaceChars.get(c)) {
put in your custom char.
22 years ago
NullPointerException's are thrown when operation is performed on a null value.
You should not throw it. You have to prevent it from happening.
One way is check if a value is null before doing anything with it.
For eg: if you have a null string. If you do a string.length(), this will throw a nullpointerexception.
22 years ago
This will not work as
your while (((j = rawString.indexOf("| |")) > 0))
would go in an infinite loop.
You should be checking from a different starting point every time.
22 years ago
To extract values out of this XML doc, you would have to use a XML DOM Parser. There are many parsers available like xml4j from IBM. These parsers would read the inputstream and give you a Document object back.
From this Document object you can extract the Elements, attributes etc .. using the API.
From representing this XML doc as a HTML doc, you will have to create a XSL.
Microsoft may have tutorials on how to write XSL's.
If the XML doc refers to a XSL and if you use IE to read the XML, it would automatically display the intended HTML.
With Netscape, you would have to the transformation server side.
When you are writing a file, using BufferedWriter, you could use newLine() to write a new line. This is much better than hard coding .
22 years ago
XML should be very suitable. If you dont have many other uses for XML, you may not want to use it. Other way would be develop a class for that.
22 years ago
To read from a database, you need JDBC. Please read up on how to connect to a database and perform query etc. you can find examples at javasoft.
Formatting would be write each of the relevant columns or any computation performed into a StringBuffer appending commas after every column.
stringbuffer sb = new stringbuffer();
To write to a file, use outputstream.
Fileoutputstream f = Fileoutstream(filename).
bufferedwriter b = new bufferedwriter(new outputstreamwriter(f));
watch all the cases(lower and upper), i am writing this more as a draft.
22 years ago
If use make to build, then can't you compile dependencies also?
22 years ago
did you see the what the diff was.
22 years ago
I am sure you do as you need to create a reader and later close it also.
22 years ago
One thing that comes to mind is Random Access File but it is pretty inefficient.
22 years ago
Hashtable lets to get a value based on a key.
for eg: you are reading a configuration file, which has various
params and for each param there is a value. you dump all these into a hashtable.
Later whenever a param value is needed, you can get the value by using the param as a key.
22 years ago
I am not sure what the exact issue is.
I am assuming that you have a InputStream to an XML doc. You need to pass this to some remote object.
Your question is how to do this.
Well, I think you can write this to a String and send the String over.
Do you think that is a feasible/possible solution.