Just a minor problem with Arraylist. I want to sort a ArrayList<Client> by name.
Class Client{ String name; int phonenumber ..}
This code does the work, but i'm having a compiler warning: "uses unchecked or unsafe operations". Whats the problem?
public void sortByName(){
Collections.sort(ListofClients, new NameComparator());
}...
Hello all,
I get the following error:
quicksort(int[],int,int)cannot be applied to(int[])
When I compile this:
import java.util.*;
public class Sort {
public static void main(String[] args){
Random rand = new Random();
int[] tab = new int[10];
for(int i = 0; i < tab.length; i++) {
tab[i] = rand.nextInt(100);
System.out.println(...
I have a simple web service. One of the exposed methods returns a java Object of type "Data". This Data class has a method called "getName()". I compile the project, run "wsgen" on it, and start the service (using the JDK6's embedded HTTP server, not tomcat or glassfish etc.)
So far so good, I can see the wsdl in my browser at the appro...
I'm looking for an example of how to implement 2D terrain destruction that you see in games like scorched earth or on the iphone iShoot.
I'm looking to implement a game that needs to do destructible terrain and render it using OpenGL (LWJGL in Java) and using OpenGL ES on the iPhone.
...
hi,
I'm currently working on a financial alerts application , and for the client interface I've decided to use JFreeChart. However as I'm new to it ,there are some important things that I can't figure about the ohlc charts :
-I'd like to be able to put in a chart only a limited number of bars (let's say 300) and after this number is re...
Hi,
I want to write a program for a school java project to parse some CSV I do not know. I do know the datatype of each column - although I do not know the delimiter.
The problem I do not even marginally know how to fix is to parse Date or even DateTime Columns. They can be in one of many formats.
I found many libraries but have no cl...
I'm trying to call SendMessage with an uint parameter from Java, but I can't convert int to uint. I can't change the uint parameter in SendMessage because it is a windows function. Is there some way of doing this?
Background:
I'm actually using Processing, and I'm following the following tutorials to access user32.dll: http://processing...
What exactly makes the JVM (in particular, Sun's implementation) slow to get running compared to other runtimes like CPython? My impression was that it mainly has to do with a boatload of libraries getting loaded whether they're needed or not, but that seems like something that shouldn't take 10 years to fix.
Come to think of it, how do...
I am having a querying issue in Hibernate. I have a table, 'test', with existing data. I have a requirement where I can not modify the schema of the test table, so I created another table, 'testExtension', whose primary key is a foreign key to the primary key of Test. Data in testExtension is a subset of the data in test. i.e. There w...
I am working on an exercise in Java. I am supposed to use / and % to extract digits from a number. The number would be something like 1349.9431. The output would be something like:
1349.9431
1349.943
1349.94
1349.9
I know this is a strange way to do but the lab exercise requires it.
...
I've been developing in java then I stopped, so now since I have my google app engine account I wanted to start with this again. Also I love web and I know struts is a good MVC framework. I've been reading this. do you think struts can help me to start or should I start with "plain" servlets, and then go to some framework
...
I'm new to Maven but I'm hooked on what it offers. How do I take a webapp and have Maven package the webapp as a deployable WAR? Additionally, can I set up Maven to automatically version the builds?
...
I have a method that looks similar to the following:
public void myMethod(MyClass c)
{
if (c == null)
{
return;
}
try
{
c.someMethod();
}
catch (SomeException e)
{
// log the exception, possibly re-throw
}
}
I am trying to find a way to set up a mock instance of the MyClass parameter c such that it return...
I am making a drawing program, and have a few question with regards to that.
I'll need the user to have the choice of drawing a rectangle, an oval and a line. I suppose I need to make a super class they all derive from. Should I make this an interface or an abstract class? And how would I set up that all the shapes have some default val...
I'm interested in knowing how can my Java program listen to the Print event generated by the underlying OS. As my project is based on Java, the Print job event listener should not be platform depended.
To be more specific my program will be running on the background and should be notified of the print job if a user is trying to print pag...
Hi All,
Can anybody help me to make j2ME implementation of Dijkstra algorithm faster ? I have two loops, one inside another. Like this
while(for each item in Q)
{
//...do something.
//the following loop is to find the minimum
for(all un-visited nodes in Q)
{
//.. do something to get min.
}
}
I have almost...
I am converting some Java code to C#. This code is using getGlyphOutline from GlyphVector. Any idea if there an equivalent in C# or .NET?
...
I have to use some static windows library (*.lib) from java code, I can write C++ JNI wrappers, but I'd rather not do it (not that experienced in C++).
What would be the easiest (least developement effort) way use it, performance is not important, since that code will just be fetching some data, that most probrably will be worked on on...
Hi
I am not sure if anyone else encountered this issue,
I have a java app that polls data from an external provider every second, it works fine and polls data as required -this is a console app
I have written a jsp service that does the same, it is basically returning the same data that the console app writes to the console, instead...
Hello,
I have timestamp in milliseconds from 1970. I would like to convert it to a human readable date in python. I don't might losing some precision if it comes to that.
How should I do that ?
The following give ValueError: timestamp out of range for platform time_t on Linux 32bit
#!/usr/bin/env python
from datetime import date
prin...