May 27, 1997

Maintaining arrays of bindings between names and associated arrays

Question: I have few problems with the following code: abstract class AbstractGraph extends java.awt.Frame { static int HighValue,LowValue,ArraySize; static String InstancesArray[][] = new String [20][ArraySize]; float ReturnArray(String name) { … } static void AddArray(String name,float array[]) { … } } The InstancesArray holds a name and values of arrays created

How to convert int to string

Question: I am looking for a generic way to convert an intto a string. It cannot be platform- or compiler-specific in its implementation. Answer: The standard C++ library defines the classes std::istringstream andstd::ostringstream that can be used for manipulations on strings to accommodatevarious datatypes. The way to convert an integer

Replacing shareware GUI with Java GUI running inside browser

Question: I have a huge chunk of C code that currently uses a shareware GUI library for I/O. I would like to replace the current GUI with a browser-based one. Is there a way I can use Java to do this and still ship only C source code and Java

Creating Java packages or library files

Question: I am creating an application by using Symantec Cafe wherein I am using one applet, from which I am calling a series of frames. I have some common functions and variables amongst these frames that I must write in each frame code. I am thinking of making a Java

How to implement a priority singly linked queue

Question: I would like to know how I can implement a priority singly linked queue. Answer: I like to think of priority queue as a possible implementation of the standard queue ADT:interface Queue { public void enqueue(Object item); public void dequeue(); public Object getFront() throws EmptyQueueException; public boolean isEmpty(); public

Byte order

Question: How does one find out the byte order of the platformon which JVM is running? For example, for a Java application that has to read a C structure from a file, the structure wouldbe stored in the local byte order and Java is big endian. Answer: First a little

Generic C++ Exception Handling Class

Question: I would like to see an example of a generic C++ exception class that could be used across objects. Answer: When using exception handling, it is often a good idea to unify all of yourexceptions by inheriting them from a common base class. Here is an example ofhow such