I have a request for a contracting gig and one of the requirements in the first draft of the specs says the software (a GUI application for end-users) should run on Win 2000 and Mac OS 7.5. I have no idea why they would want to support such ancient systems, but I guess it leaves me with Java as the only option other than raw C, or doesn'...
Hello,
I have a question about the primitive type 'short' in Java. I am using JDK 1.6.
If I have the following:
short a = 2;
short b = 3;
short c = a + b;
the compiler does not want to compile - it says that it "cannot convert from int to short" and suggests that I make a cast to short, so this:
short c = (short) (a + b);
real...
I created the following code to calculate the duration between two timestamps which can come in two different formats:
public class dummyTime {
public static void main(String[] args) {
try {
convertDuration("2008-01-01 01:00 pm - 01:56 pm");
convertDuration("2008-01-01 8:30 pm - 2008-01-02 09:30 am");
} catch (Exception e) {
e.p...
Is there a way to allocate an uninitialized block of memory, such as an array that contains whatever garbage happened to be left behind, in Java? I want to do so to benchmark how fast Java's memory allocator/garbage collector can allocate/free blocks of memory.
...
Hey,
I have this application i'm developing in JSP and i wish to export a couple of data from the database into XLS (MS Excel format).
Is it possible under tomcat to just write a file as if it was a normal java aplication, and then generate a link to this file? Or do i need to use a specific API for it?
Will i have permition problems...
Most places I've consulted say to use SortedList, but the problem is that the program I'm porting actually uses duplicate keys (differentiated by order), which is permissible with TreeMap, but not SortedList.
Any advice?
...
We are working with large amounts of data, all tagged in UTC (in Java). Between reading this data, storing it in a database and getting it out again, it happened, that some data was off one hour during daylight saving time. As UTC has no concept of daylight saving time this was clearly a bug within the software. Once known, it's easy to ...
Ok, here is the code and then the discussion follows:
public class FlatArrayList {
private static ArrayList<TestWrapperObject> probModel = new ArrayList<TestWrapperObject>();
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] currentRow = new i...
Hey Everyone
I just started Data Structures and Algorithms which is taught in Java. So far I've only learned C++ in my life so I'm still VERY new to using java.
Anyways I have a homework problem I'm a little stuck on:
Write a recursive method that returns the number of 1's in the binary representation of N. Use the fact that this is e...
I was wondering..There is Sun's JRE, IBM's JRE, BEA's JRE, Oracle's JRE and some more less know JREs in the market.
Why is there so many JRE implementations? Does the fact that Sun opened the Java platforms mean that there will be one open JRE / JDK? Or are we going towards what happened with Linux and its many distributions ?
...
MVC is a great concept, but choosing among all the variety and flavors out there is not a simple task. Very soon we are going to start a new web development project and we want to do it in a solid, enterprise class, long lasting language. We are choosing linux friendly language. Even we know that MONO will allow us to run .NET in linu...
It is possible to add and remove elements from an enum in Java at runtime?
For example, could I read in the labels and constructor arguments of an enum from a file?
@saua, it's just a question of whether it can be done out of interest really. I was hoping there'd be some neat way of altering the running bytecode, maybe using BCEL or ...
Hi folks,
i'm trying to port some Java stuff to C#. I'm just wondering if the following C# code is the equivalent to the original Java source.
Source: Java Code
private static final Pattern SIMPLE_IDENTIFIER_NAME_PATTERN =
Pattern.compile("^[a-zA-Z_][a-zA-Z0-9_]*$");
private static boolean isValidIdentifier(String s) {
...
Hello,
I am working with Java, and I am trying to make a cell in JTable to be editable. My class implements TableModel and extends AbstractTableModel (so that I can use the method fireTableCellUpdated(rowIndex, columnIndex)), and I have implemented the methods isCellEditable() and setValueAt().
I represent a single cell in the table as ...
I've trying to use Eclipse JDT AST parsing classes. After including the initial JAR, and sorting out a couple more dependencies, it is with 7+ JARs and I still having NoClassDefFoundError exceptions. This situation arises whenever I'm trying to test libraries with little or no documentation. Trial and error seems a very dumb (and annoyin...
What is the advantage of local classes in Java or in any other language that makes use of this feature?
...
Visual Studio has a way to import, export your color settings.
Does Eclipse have something similar?
I'm looking for the "perfect" color scheme in Eclipse that's easiest on the eyes. For me, that simply means a black background (so I'm not staring into a bright light bulb all day).
Thanks
...
I'm stuck on a portion of the Java tutorial, specifically this exercise. The exercise asks you to:
1- Write a class whose instances
represent a single playing card from a
deck of cards. Playing cards have two
distinguishing properties: rank and
suit. Be sure to keep your solution as
you will be asked to rewrite it in
Enum...
The files residing in .settings in a Dynamic Web Project are:
.settings/
|-- org.eclipse.jdt.core.prefs
|-- org.eclipse.jst.common.project.facet.core.prefs
|-- org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs
|-- org.eclipse.wst.common.component
|-- org.eclipse.wst.common.project.facet.core.xml
|-- org.eclipse.wst.jsdt.ui.superType.co...
The following GUI code is working in 99.99% of OS environments used by our customers:
jStatusDescription = new JTextArea();
jStatusDescription.setFont(new Font("Verdana", Font.PLAIN, 12));
jStatusDescription.setText("test"); <-- crashes
However, there are now 2 different customers both using Terminal server and firefox 3, the co...