Why does this work:
List<?> list = new LinkedList<Integer>();
while this gives a type dismatch error:
List<List<?>> list = new LinkedList<List<Integer>>();
Why is this?
Ist there a way around this, without using raw types?
...
hi all,
if i have two hashmaps, of types
HashMap<Integer, HashMap<Integer, Police>> time_id_police;
HashMap<Integer, HashMap<Integer, Ambulance>> time_id_ambulance;
where Police and Ambulance both extend Rescue, how can i have a method like
HashMap<Integer, HashMap<Integer, Rescue>> getRescue(){
if (a) return time_id_police;
...
I have been trying to launch browser from a java app on Linux. When this app is run for the first time browser don't get opened. The error log shows : shell-init: cannot get current directory getcwd : no such file or directory.
After this if u restart everything falls into place and browser opens fine.
I have tried many things like cha...
When using one of the various JDBC template methods I am confused on how to iterate/scroll over large result sets (which won't fit into memory). Even without a direct exposure of an Iterable interface I would at least expect instances of RowCallbackHandler to get called while the query is executing not after it's finished (or the heap ov...
If I have the following example file where each number is represents a byte (123 has bytes 1, 2, and 3):
123456789
Let's say I create a FileInputStream. This reads in the binary byte by byte. So .read() returns 1, then 2, etc. Now let's say I create a buffer. The initial chunk it reads in (if I understand buffers correctly) is 1-5. Th...
I'm having an issue trying to parse the ascii part of a file, and once I hit the end tag, IMMEDIATELY start reading in the bytes from that point on. Everything I know in Java to read off a line or a whole word creates a buffer, which ruins any chance of getting the bytes immediately following my stop point. Is the only way to do this rea...
Consider
Object obj = ....;
System.out.println(obj instanceof Object);
What should obj be so that the answer is false (Any other option other than null)
...
I'm using a class to get a property file under the source folder. But it doesn't work! After checking, I found that the default path by using the File f = new File("/src/ss.properties");
is not the web application path but the glassfish config path! What can I do if I want to fetch the property file stored in the "classes" path? Usually ...
I have a web application running on OC4J 10.1.3. I am trying to do some logging using log4j. The messages show up in my IDE console as expected, but nothing is going into the application.log in OC4J. Anybody know what I need to do to get this working?
Here's my log4j.properties:
log4j.rootCategory=DEBUG, CON1
# CON1 is set to be Co...
Does anyone have a list of the changes between JPA 1 and JPA 2?
I have read about the Criteria queries and other changes, but I would like a "what's new" kind of reference.
Thanks
...
When the program starts, a new JFrame is created. Once the user clicks the start button a thread is created and started. Part of this threads execution is to validate the data on the form and then execute with that data. Once the data has been validated the thread calls dispose() on the original frame and then creates a new JFrame that a...
We have a web application right now that we deploy a copy for each client. Our current deployment strategy is to create a uniquely named jdbc connection pool for each instance.
so say jdbc/client. They are specified like this...
< Context path="/"
reloadable="true"
docBase="\home\client\ROOT"
debug="5" >
...
Hi,
I am new to Web Programming and I hear that there are many biggies like Java, .Net and PHP for Web Application Development.
I would certainly appreciate if I can get some insights on how this technology stack up in comparison and in what scenarios one would prefer one technology over the other.
Thanks for all guidance in advanc...
Hi again.
I have hibernate.cfg.xml file.
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url"></property>
<property name="connection.username"></property>
<property name="connection.password"></property...
I want to get the name of all active process on a Win2000 machine. I know that "tlist -s" is the command, but to use this, the "tlist.exe" has to be extracted from the Win2000 CD-ROM. I also know "tasklist" only works on XP or greater.
I am running my tests on VM Ware, and do not have a CD-ROM. Is there another way to programmatically g...
I have Person entity which has composition with Location Entity
@ManyToOne(fetch = FetchType.EAGER, cascade =
{ CascadeType.PERSIST, CascadeType.MERGE })
@Cascade(
{org.hibernate.annotations.CascadeType.SAVE_UPDATE })
public Location getLocation()
{
return location;
}
And Location Entity has Name as Id
@Id
public String getName()...
Hi all,
Have you ever heard about a GUI freezing because of repeated calls to the method javax.swing.Document.insertString ??
There is my code:
private int insertNotation(GameNode startNode, StyledDocument doc, int pos) {
String s = "";
int startPos = pos;
boolean isContinuous = false;
Style boldStyle, regularStyle, ...
I have some stock market data. I want to simulate the stock market by having prices sent at intervals that can be determined from the times at which trades occur.
What would the best way be to do this.
So far I have a class with static variables and methods in which I am storing the hour, min, millseconds for the last trade time. I th...
I'm attempting to create a Spring application (NOT web application) to perform some simple tasks. Eventually they will hook up with some other Spring apps around the network, but for now I'm keeping it simple. I have a CheckForNewItems class (extending Timer) which is configured to run every 10 seconds.
I can confirm it runs by calling ...
So I'm currently working on some FPS game programming in OpenGL (JOGL, more specifically) just for fun and I wanted to know what would be the recommended way to create an FPS-like camera?
At the moment I basically have a vector for the direction the player is facing, which will be added to the current player position upon pressing the "...