I have a domain object that looks something like this:
class UserStuff
{
String userid;
boolean primordial;
}
In the table, primordial is a TINYINT. A User can have possibly many UserStuff. What I want to ensure is that only one row (the first row created) will have primordial == 1. All subsequent rows will have primordial ==...
Is there a API method in JodaTime to see whether a DateTime is within [start, end], i.e. the boundary is included?
Only thing I found was
new Interval(start, end).contains(dateTime) but this seems to give false if dateTime equals end.
...
I need to serialize a java object which might change later on, like some of the variables can be added or removed. What are the pit falls of such an approach and What precautions should I take, if this remains the only way out.
...
Please teach it still more because it is a beginner.
I study JavaEE5 with NetBeans now.
I made a project by an enterprise application and made session Bean of an entity class and the entity class in ejb.
And make a servlet in war; of the cord insertion "call enterprise Bean
This succeeded, but to use Visual Web JSF next; in the framewor...
Hi,
I want to use the URLEncoder/URLDecoder class (java.net.URLEncoder/URLDecoder) in an application and the methods : encode(String s, String enc)/decode(String s, String enc), but I don't know what can be the value of the String argument enc?
I want to encode/decode in the "x-www-form-urlencoded" MIME content type.
Thank you for your h...
When using the MVP pattern, I often come across methods and members which don't seem to fall nicely within the View or Presenter classes...My question is: What rules do you use to decide what functionality lies which classes? I am relatively new to MVP, so please humour me.
TIA.
...
For a project in school, we are making a multithreaded server in Java 5.0. This project is centered on the concurrence aspect of a server.
We have some threads dedicated to treating the requests. To do so, they have a call to a ServerSocket.accept() to accept new connections. Our choice was to start a bunch of them and let them treat th...
What is the best tool out there at the moment to convert java to c#? Apart from
j2ctranslator
j#
I use IKVM at the moment.
...
This is a follow up to this question. Is this solution watertight?
public final class Thing implements Serializable {
private static final long serialVersionUID = 1L;
private static final Thing[] instances = new Thing[2];
private static int nextOrdinal = 0;
public static final Thing instance0 = new Thing("whatever0")...
I would really like to be able to run our test suite on Xvfb so that swing windows don't keep popping up in the way of my work. Unfortunately I cannot seem to find a way to get the java runtime to use the display specified in the DISPLAY environment variable. I suppose this is because the Mac JDK is hardwired to use the (non-X-based) Mac...
Hi,
I am using EditText for getting userInput but the problem i am
facing is that i want to change the font color at runtime but in the
same Edittext as i am able to change the font type but as i change the
font color it changes for the whole editext but i need to change the
color for specfic text only .
And one more issue i...
I have a game that currently runs under Windows and Mac OS X and I'd like to make it available under Linux. The porting should be fairly easy since it's a Java based game and uses portable libraries that are available on all 3 platforms.
The hard part and the reason for this question is packaging it so that it works on as many modern Li...
What is the correct way of terminating a servlet that doesn't return any data to the client?
The purpose of the servlet in question is to recive some data from an Ajax request and fire off a TCP message to a piece of hardware to tell it to change it's state.
Do you have to specify a response at all?
I've opted for getting a reference ...
I have a class that maps incoming messages to matching readers based on the message's class. All message types implement the interface message. A reader registers at the mapper class, stating which message types it will be able to handle. This information needs to be stored in the message reader in some way and my approach was to set a p...
In Java, do class objects have the same heritance relations as the classes they represent?
...
I have a Price object consisting of two MonetaryValues where one MonetaryValue consists of an amount and a currency.
If I configure the OR-mapping the XML-way, I can do this
<component name="baseAmount" lazy="false" class="MonetartyValue">
<property name="amount" column="baseAmount" precision="20" scale="2" not-null="true"...
I'm relatively new to working with XML and am working with some rather large documents using the javax.xml.parsers.SAXParser .
The thing is: The information I need is near the top of the XML file and I don't need to parse the entire document. -- What is the "best" way to stop parsing a file when the relevant information has been identi...
Hi,
I am trying to get a very small desktop app built - something that can be downloaded by people very quickly. I am trying to decide whether i shd build it in .net or java. I know Java will be cross platform, but I want to know if a lot of Windows users do not have JRE installed on their computers, in which case I am told they will ne...
I have panel that is using group layout to organize some label. I want to keep this panel center of the screen when re sized. If i put the panel inside a another panel using flow layout i can keep the labels centered horizontally but not vertically. Which layout manager will allow me to keep the panel centered in the middle of the screen...
Given the following example (using JUnit with Hamcrest matchers)
Map<String, Class<? extends Serializable>> expected = null;
Map<String, Class<java.util.Date>> result = null;
assertThat(result, is(expected));
This does not compile with the JUnit AssertThat method signature of:
public static <T> void assertThat(T actual, M...