I spent a lot of time programming in Java recently, and one thing I miss from scripting languages was the ability to test them in a console.
To quickly test a java program, I have to edit a file, then turn it to bytecode and execute it. Even using an IDE, it loses its fun after the 372 th time.
I would like to know if there is a prod...
Does the Java compiler remove multiplications by 1, when talking about BigDecimal?
I'm standing in something similar to this:
BigDecimal bd = getBigDecimal();//get arbitrary bigDecimal, could be anyone.
bd = bd.multiply(new BigDecimal(getOneTwoOrThree());
Where the getOneTwoOrThree method is declared as:
/*
* Always returns Integ...
I have a web-based application and a client, both written in Java. For what it's worth, the client and server are both on Windows. The client issues HTTP GETs via Apache HttpClient. The server blocks for up to a minute and if no messages have arrived for the client within that minute, the server returns HTTP 204 No Content. Otherwise,...
When trying to use a custom JSP tag library, I have a variable defined in JSP that I would like to be evaluated before being passed to the tag library. However, I cannot seem to get it to work. Here's a simplified version of my JSP:
<% int index = 8; %>
<foo:myTag myAttribute="something_<%= index %>"/>
The doStartTag() method of my T...
Specifically, I'm looking for similarly clean notation to the Collection<T>.TrueForAll / Exists, etc.
It feels smelly to have to write a foreach loop to inspect the return of a method on each object, so I'm hoping there's a better Java idiom for it.
...
Could you please tell me from where I can download JVM 1.4 and the Java Speech API?
See also:
Download and install IBM’s Speech for Java
...
I have a J2EE application running on an IBM Websphere Application Server on a Windows Operating System.
Occasionally I see an OutOfMemoryError Exception with the following information in the javacore file.
1TISIGINFO Dump Event "systhrow" (00040000) Detail "java/lang/OutOfMemoryError":"Failed to create a thread: retVal -1073741830...
Hi.
I have a server which waits for a connection from a client then sends an image to that client using the Socket class.
Several clients will be connecting over a short time, so I would like to compress the image before sending it.
The images are 1000 by 1000 pixel BufferedImages, and my current way of sending them is to iterate over...
I have an open source Java application that uses Hibernate and HSQLDB for persistence. In all my toy tests, things run fast and everything is good. I have a client who has been running the software for several months continuously and their database has grown significantly over that time, and performance has dropped gradually. It final...
I have a one-to-one relationship but hibernatetool complains when generating the schema. Here's an example that shows the problem:
@Entity
public class Person {
@Id
public int id;
@OneToOne
public OtherInfo otherInfo;
rest of attributes ...
}
Person has a one-to-one relationship with OtherInfo:
@Entity
public cl...
In another Bruce Eckels exercise in calculating velocity, v = s / t where s and t are integers. How do I make it so the division cranks out a float?
class CalcV {
float v;
float calcV(int s, int t) {
v = s / t;
return v;
} //end calcV
}
public class PassObject {
public static void main (String[] args ) {
int dista...
Hi Just wondering what exactly is a Parseing or parsing? especially related to Java. Why are they used?
for example: Integer.parseInt, String parse.String etc
Thank you
...
Does anyone know good source where I can find about implementation of SQL iterator/Operator in java and any other languages?
Than you,
-Nimesh
...
I have a JComboBox which contains an MRU list combo-box and a for a directory tree panel. Together, the two form the left hand panel of my GUI (the MRU is above the tree panel) which is a JSplitPane, so the left panel is resizeable.
It has a problem in that the directory text is always longer than the required width to see that directo...
I can't seem to figure out a way for an editor kit to work for only one JTextPane. Every time I implement one, it always functions for any JTextPane in the frame.
How can I fix this?
...
Apache Felix has the concept of an "extension bundle". This seems to be a bundle that contributes to the system bundle. There is also a special URL "felix://extensions/" being registered for them.
When would I need to use extensions as opposed to regular bundles?
Are there examples of bundles that use this approach?
Is this a Felix-on...
final DataSource ds = DataSourceLocator.getInstance()
.getDataSource(sg.cmpl.starhub.lprs.Constants.APP_KEY);
final DataSourceTransactionManager txManager = new DataSourceTransactionManager();
txManager.setDataSource(ds);
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setIsolationLevel(TransactionDe...
I have seen a few examples where the architecture is that there is java on the server side and c# on the client - what makes this combination so good? why would .net on both sides not be a better choice (or in fact, java on both sides?)
added later: in lots of cases, the java is hosted on a windows server itself, i think via tomcat (not...
Hi all,
I am getting following warning :
warning:[unchecked] unchecked conversion
[javac]found:java.util.List
[javac] required:java.util.List<edu.fullerton.cs476s09.espressobar.jpa.espressobar_milk>
return query.getResultList();
What may the problem and probable solution.
I am using following code:
@Stateless
@Remote(Order.class)
//...
I'm playing around with some code katas and trying to get a better understanding of java generics at the same time. I've got this little method that prints arrays like I like to see them and I have a couple of helper methods which accept an array of 'things' and an index and returns the array of the 'things' above or below the index (it'...