When refactoring methods it is easy to introduce binary incompabilities (with previous versions of the code) in Java.
Consider changing a method to widen the type of its parameter to a parent interface:
void doSomething(String x);
// change it to
void doSomething(CharSequence c);
All the code that uses this method will continue...
I have a Web application written in Java that is targeting several countries, all of which speak different languages (and more often than not, several languages -- that's Europe for you).
We have a bunch of .properties files that hold the localized strings, and our current procedure is to e-mail the language-specific files to our partne...
I need to put number(2d array) on the top left of JButton. But, i got the number result in wrong ordder (upside down), not as the same as the array topLeftNum order. How to make it so the number will show up as the same order?Please help me solve my problem..Thanks
final int ROWS = 12;
final int COLS = 12;
final static int topLeftNum[...
Because of how generics are implemented in Java (eventually compiling down to objects and casts), what are the benefits of using them?
Should I still use them for the compile time type safety? I'm used to the significant speed boost of generics in C# and I'm curious if people who work with Java still frequently use generics despite the...
When creating multiple faces config files, it is correct to have the faces-config.xml outside of WEB-INF? The JSF spec does not seem to be very clear about this (Section 10.1.3)
If yes, how should this faces-config.xml be declared in web.xml? the paths generated by IDE's (like Eclipse/JDev) generally use something like:
<context-param>...
I have a JTree which is 5 level deep, 0, 1, 2, 3, 4 levels. I am interested in level 1's informaton, value or index. is it possible to immediately get level 1' information whenever the selection is below level 1?
...
In emacs, when I type:
public void foo(String one,
String two) {
It tabifies like this:
public void foo(String one,
String two) {
I'd rather it didn't, and just aligned parameters like other line continuations. How can I configure it not to do this?
...
I'm programming using GWT, which includes Jetty. I have defined my own servlet and when I call
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
It gives me a warning that states:
WARNING: Committed before 401 No authentication specified
Sep 2, 2009 2:40:36 AM com.google.apphosting.utils.jetty.JettyLogger warn
...
I was really discouraged by java's string encoding.
There are many auto conversions in it. and I can't found the regular.
Anyone have good idea?
for example:
In a jsp page, it has such link
http://localhost:8080/helloworld/hello?world=凹ㄉ
And then we need to process it, so we do this:
String a = new String(request.getParameter("world"...
I'm trying to deploy an application to Google App Engine that will eventually interface with JIRA and other services over SOAP. The J2SE 6 java.xml.soap.* APIs are not supported by the GAE JRE. What other simple libraries are available for building requests and parsing results over a URLConnection?
Axis and CXF seem to be the general...
Say I have 2 parallel collections, eg: a list of people's names in a List<String> and a list of their age in a List<Int> in the same order (so that any given index in each collection refers to the same person).
I want to iterate through both collections at the same time and fetch the name and age of each person and do something with it....
I have such a link in JSP page with encoding big5
http://hello/world?name=婀ㄉ
And when I input it in browser's URL bar, it will be changed to something like
http://hello/world?name=%23%24%23
And when we want to get this parameter in jsp page, all the characters are corrupted.
And we have set this:
request.setCharacterEncoding("UTF-8"), s...
Hello
I am facing a problem when I move my JSP files along with CSS and JS files under WEB-INF/web/ directory. The problem is that, when a JSP page loads, it does not load CSS and JS files. Please help if you have any idea about it.
Thanks
Umar
...
What are the disadvantages of making a large Java non-static method synchronized? Large method in the sense it will take 1 to 2 mins to complete the execution.
...
I'm getting the following error when trying to connect to a Sql Server (2005) using JDBC:
unhandled token type: unknown token: 0x53
Any ideas anyone? I would have liked a more descriptive error too!!
Also, I've done the 'telnet servername 1433' test and can confirm that machine can create a TCP connection.
...
I have this somewhat unusual process structure:
Launch4J starts my Java application. It creates a mutex to provide single-instance functionality.
The Java application starts a VB6 application.
When the Java application terminates, the VB6 application is still running. (Desired behaviour)
The problem is: The mutex created by Launch4J ...
This is an example of using ThrowawayController in Spring MVC:
public class DisplayCourseController
implements ThrowawayController {
private Integer id;
public void setId(Integer id) { this.id = id; }
public ModelAndView execute() throws Exception {
Course course = courseService.getCourse(id);
...
Situation:
I need to make an imap client (using java mail api) that if, for example when synchronising with gmail would also download my signature.
So that next time i send a mail using SMTP, it would automatically include my gmail signature alongside with it.
Is that possible ?
Does IMAP support this or do i need to use another prot...
What is the prefered way to copy an array of a non-primitve type in Java? How about performance issues?
...
I have recently found your reply in a topic about using multiple persistence.xml files from multi module project. You said something about MergingPersistenceUnitManager. Could you please tell me where can I find it ? The link you provided seems not to work.
...