I have some code that does a bunch of HTTP GETs, POSTs, and PUTs using Commons HttpClient 3.1. I'd like to provide a current transfer speed indicator in my GUI, but was unable to find any methods for determining the transfer rate of a HttpMethod being processed.
I could easily just time the transfer and do some simple math after it was...
I would like to validate a given Word 2007 XML file against the Schema defined in wml.xsd.
How could it be done in Java?
Loading the Schema with the following line is not a problem. But it seems that I have to tweak the validation process becaus I get error messages even on valid input files (I could open and view the input file in Word ...
hello
I've already realized some applications with a small graphical user interface. Nothing complex, but I've encountered several problems that components aren't displayed or just not behaving as expected.
Now my question:
How do you plan those user interfaces? What do you do when you need to make changes? How do you debug strange be...
Which class implements all the Connection Interfaces which are in javax.microedition.io package and how?
And in the same way which class implements the some of Collection interfaces like Iterator interface.
I saw a code: -
Iterator it;
ArrayList list = new ArrayList();
it = list.iterator();
The iterator() return type is "Iterator"...
I have an application that uses lucene for searching. The search space are in the thousands. Searching against these thousands, I get only a few results, around 20 (which is ok and expected).
However, when I reduce my search space to just those 20 entries (i.e. I indexed only those 20 entries and disregard everything else...so that deve...
I understand how to make a multiple-select list box using JLists but I want to add JCheckBoxes to the list and make it dropdown like. The best visual representation I have found online is dropdown-check-list.
What would be the best way to accomplish the above?
I was thinking of a TableList. Any suggestions?
...
I am trying to program a small application but I would like the entire window to be glass with buttons and labels on top of it. Is it possible to do this within Java?
...
As is widely known, anything related to Swing components must be done on the event dispatch thread. This also applies to the models behind the components, such as TableModel. Easy enough in elementary cases, but things become pretty complicated if the model is a "live view" of something that must run on a separate thread because it's cha...
I'm unit testing with jetty and I want to serve not only my servlet under test but a static page as well. The static page is needed by my application. I'm initializing jetty like this
tester = new ServletTester();
tester.setContextPath("/context");
tester.addServlet(MyServlet.class, "/servlet/*");
tester.start();
What I need now, is s...
Hello,
I am trying to persist a one-to-one relation with Spring 1.2.8 and Hibernate 3.2.7ga but the foreign key is always empty.
But let me first give you a short introduction:
I have two Entities called "ClientDomain" (Web-Domain) and "Measurement".
Hibernate Mapping Files:
ClientDomain.hbm.xml:
<hibernate-mapping package="statist...
I have a question in my mind that, while writing into the file, before closing is done, should we include flush()??. If so what it will do exactly? dont streams auto flush??
EDIT:
So flush what it actually do?
...
I'm exposing some services using RMI on Spring. Every service has a dependency to other service bean which does the real processing job. For example:
<bean id="accountService" class="example.AccountServiceImpl">
<!-- any additional properties, maybe a DAO? -->
</bean>
<bean id="rmiAccount" class="example.AccountRmiServiceImpl"/>
<...
Weblogic 10.3.1 gives me a "Dependency injection failure" when I publish my code; the publish itself succeeds. I am working via Eclipse.
Basically I publish an ear with a web service aaa.MyWebServicePort that has a bean bbb.MyBean declared as local variable with the ejb 3.0 @EJB annotation. bbb.MyBean is also in the ear as well as a cl...
Possible Duplicate:
Difference between a Structure and a Union in C
I see this code for a union in C:
union time
{
long simpleDate;
double perciseDate;
} mytime;
What is the difference between a union and a structure in C? Where would you use a union, what are its benefits? Is there a similar construct...
We have a major body of code in Java that runs on the desktop that we want to reuse with a MS.NET user interface (desktop rather than web). Any do's or don'ts would be very welcome.
...
Below is example of text:
String id = "A:abc,X:def,F:xyz,A:jkl";
Below is regex:
Pattern p = Pattern.compile("(.*,)?[AC]:[^:]+$");
if(p.matcher(id).matches()) {
System.out.println("Hello world!")
}
When executed above code should print Hello world!.
Does this regex can be modified to gain more performance?
...
What's the most compact code to compare three objects for (semantic) equality using Java? I have a business rule that the objects must be unique i.e. A is different to B, A is different to C and B is different to C.
Assume that the objects are all of the same class and have correctly overridden equals and hashCode methods. A slight wrin...
is it possible somehow to accept only super types of the generic Type of a class?
what im looking for is something like:
class <T extends Object> MyClass {
public <TS super T> void myMethod(TS someObjectSuperToTheClass) { //do stuff }
}
i don't really need it anymore (and its probably not all that usefull to begin with) but I'm ...
Hi,
I created a SocketChannel to a remote server to send and receive messages on Tomcat. To receive messages from a remote computer, I used a thread dedicated to task (only this thread will read from the socket, nothing else).
When some bytes are received at the SocketChannel (I keep polling the SocketChannel on non-blocking mode for n...
I love the pleasure of dealing with XML files with XMLBeans objects... Now working with 834 files, i wonder if its a similar tool for 834 files
A flat file object will be helpful also
thanks
Chung
...