One feature of Java that I really like is autoboxing, in which the compiler automatically converts between primitives and their wrapper classes.
I'm writing a Core Data application in Objective-C/Cocoa, and I'm finding it frustrating to deal with my integer attributes programmatically. Here's why:
//img is a managed object that I have ...
I have a file saved as utf-8 (saved by my application in fact). How do you read it character by character?
File file = new File(folder+name);
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
The two options seem to be:
char c = dis...
Given this code:
public class TwoThreads {
static Thread laurel, hardy;
public static void main(String[] args) {
laurel = new Thread() {
public void run() {
System.out.println("A");
try {
hardy.sleep(1000);
} catch (Exception e) {
...
My Java program saves its data to a binary file, and (very) occasionally the file becomes corrupt due to a hardware fault. Usually only a few bytes are affected in a file that is several megabytes in size. To cope with this problem, I could write the data twice, but this seems overkill - I would prefer to limit the file size increase ...
Hi guys, I'm returning this, it is similar to how you percieve dollars, $"32.95" etc. I calculate it in cents which is an int, but the problem is the second half cuts off the 10s of cents part if the number is less than that. For example if I have "32.08" it returns as "32.8". Any ideas ? i know i need an if but i cant think how to write...
As a C++ programmer becoming more familiar with Java, it's a little odd to me to see language level support for locking on arbitrary objects without any kind of declaration that the object supports such locking. Creating mutexes for every object seems like a heavy cost to be automatically opted into. Besides memory usage, mutexes are an ...
How do I explicitly destroy an EJB instance in code and take it out of circulation? I have an ejb class that becomes unusable after it throws a certain exception. After that I need to remove it from the app servers pool of instances.
...
Hi,
I'm trying to create java to xsd for a java type that looks like this.
public class MainRequest<E extends AParentType<Person>> extends EObject {
private Transaction tran;
private E e;
private String email;
}
public class SubRequest extends MainRequest<AChildType> {
}
where AChildType extends AParentType.
when i try to create a s...
Greetings all,
I am quite new to GWT and going to develop the UI for user-management application using GWT.
I am planing to use existing module which created using Spring/Hibernate.I figure out how to integrate GWT with Spring but I am not sure how to design the layout.
I want two pages :
1) User registration page (want to embedd GWT wi...
I would like to transform any http/s based url inside random text to be automatically tagged with xsl-fo , where the random text might contains one or more http/s based url.
So the http/s url is not part of an attribute or the only content of a node, but part of text within a node.
For example: the source
<misc>
<comment>Yada..yada....
my service layer methods are transactional, when i use ExecutorService and submit task to threads, i cannot pass servicelayer as parameter to each threads, as i get error
Dec 14, 2009 10:40:18 AM com.companyx.applicationtest.applicationtestcompanyx.services.threadtestRunnable run
SEVERE: null
org.hibernate.HibernateException: No Hiberna...
Hey guys
I've got a nice text based java program that I'd like to add a GUI to.
I have dabbled with Netbeans and shouldn't have too much of a problem getting the components in place.
However, the program will have to dynamically update images within the interface window, and I'm not sure what the best way to go about doing it is.
Ar...
Besides the following link, which is pro Spring, are there any other resources which show pros and cons of different Frameworks that can be used to implement SOAP in java
http://blog.arendsen.net/wp-content/TheSpringExperienceSpringWebServices.pdf
Also, I read the following on [Axis Wiki]
Q: What is Apache Axis? What's its
relati...
Correct me if I'm wrong but one normally puts deployment or user-specific properties (e.g. development/testserver settings) inside settings.xml. And by specifying which profiles to use, we can change the behaviour of the maven build.
However there are usually settings in the profiles (settings.xml) which should be shared. Since I don't ...
Hello i install jetty 6.1.8 on windows for development,
I configure it in eclipse to run with jdk 1.5, and my project is configured to build using the same jdk.
my problem is my project can't be runned using jetty server. it complained the below error message. Please note I can start jetty without error when there is no project added. ...
I am studying for a final and have a few questions about RMI and CORBA. These are discussion questions taken from a study guide so there is no real application context around them.
Why are RMI and CORBA based on TCP? The question states to answer in terms of invocation semantics.
What I have thought of so far is that TCP is going to...
(Disclaimer: these examples are given in the context of building a compiler, but this question is all about the Visitor pattern and does not require any knowledge of compiler theory.) I'm going through Andrew Appel's Modern Compiler Implementation in Java to try to teach myself compiler theory (so no, this isn't homework) and I'm havin...
Hello there,
I am using Tomcat 6, Apache Ant 1.7.1 and JDK 1.6 on OS X Snow Leopard...
Created the following build script and supporting property files:
(1) build.xml
<?xml version="1.0"?>
<project name="${project.name}" default="deploy" basedir=".">
<property file="build.properties"/>
<property file="admin.properties"/>
...
The following replaces any current css class names. It appears to call setStyleName.
<g:DecoratorPanel styleName="{style.myCssClass}">
What I really want to do is add a class name, like calling addStyleName.
Is it possible to do what I'm attempting?
...
I'm trying to choose the most appropriate build system to work in enterprise with a common source repository, emphasizing sharing of common code. I'd like the source hierarchy to look something like this:
- src
- java
- common
- net
- database
- team1
- team2
- team3
- lib
- tests
- jav...