Hi,
See the following class
public class Parent {
private String name;
private int age;
private Date birthDate;
// getters and setters
}
Suppose i have created a parent object as follows
Parent parent = new Parent();
parent.setName("A meaningful name");
parent.setAge(20);
Notice according to code above birth...
Hi,
I'm looking for a Java (or Groovy) solution for managing static data i.e. data in infrequently changing tables such as a list of countries.
I would like to keep the list of countries in a text file and have the tables automatically updated when the server starts. I can't simply delete all the tables, then re-insert the data in the ...
Over the years I seen many people use the word "generics", I honestly have not a clue what it means, whatever it is I most likely use it but just don't know that it was called that. :p
...
Hi there. I am using a Java Swing based framework that shows popup messages using Java Swing JDialog boxes. I need to get a reference the them so I cam close them programatically. The framework creates dialog boxes but doesn't keep a reference to them. Can I get a reference to the currently displayed box?
Thanks.
...
I maintain an applet that helps users to upload photos to our service. The applet jar file has a few .properties files:
>> jar -tf applet.jar | grep prop
res/messages.properties
res/messages_ca.properties
res/messages_es.properties
...
These are loaded during applet initialization.
messages = ResourceBundle.getBundle("res.messages");...
On a JTable in Java, how do I set the accessible text on a column, row and/or cell?
Normally you would do component.getAccessibleContext().setAccessibleName(text); and that is what JAWS would read upon focusing, but a table "cell" doesn't seem to exist, and columns (from the ColumnModel) do not implement Accessible.
I've tried doing so...
Is there a library to take a folder, take a snapshot of its content, do some modifications and then restore it to its previous state from directly from a java program (i.e. not from the command line) ?
Edit:
Basically, i am working on a very large folder: 80mb, ~7000 files.
And I want to restore only files that were modified as fast as ...
I'm trying to report on every HTTP status code returned from my webapp. However the status code does not appear to be accessible via the ServletResponse, or even if I cast it to a HttpServletResponse. Is there a way to get access to this value within a ServletFilter?
...
I am using an NSIS script to create an installer for my Java program. My executeable jar is launched from a BAT file. The installer works fine, but I want a specific file type (just for an example ".zip") to always use my app as the default. Right now if I double click the file, I have to browse into "Program Files > Company Name > bat f...
Hi.
I am currently trying to profile a java web app. I used Netbeans Profiler in conjunction with Eclipse. My server (Tomcat) is running through eclipse plugin and I dynamically connect to server using Netbeans profiler.
I have a primary problem, that after sometime server runs out of memory on an environment. I read about the memory l...
I configured log4j SMTPAppender to send emails to me on errors. It works, but I have problem with non ASCII data. Configuration uses HTMLLayout and their documentation states:
Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log fil...
I keep finding both on here and Google people having troubles going from long to int and not the other way around. Yet I'm sure I'm not the only one that has run into this scenario before going from int to Long.
The only other answers I've found were "Just set it as Long in the first place" which really doesn't address the question.
Ca...
The (very outdated) page for LZO contains a link to a Java implementation. There is also the vague promise of "New ... Java ... interfaces ... sometime in the near future.", but I believe that has been there for a few years.
This makes me think that the old LZO Java implementation may have been slow. Are there any benchmarks measuring...
I've seen the Fowler-Noll-Vo (FNV) recommended as a good choice for a fast hashing algorithm for use in our implementation of a consistent hashing system.
Can't seem to locate a good Java source for it though.
...
I need to return some special Latin letter (e.g. á) in the response of a portlet serveResource() method. I have tried the following ways:
response.setCharacterEncoding("ISO-8859-1") ;
PrintWriter out = resWrapper.getWriter();
out.println("á");
out.close();
OR
response.setContentType("text/plain; charset=ISO-8859-1");
PrintWriter out...
Please check out this piece of code and tell me why on earth does it print out to the console when you move your mouse over the check box? What is the "change" event that takes place?
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Tes...
Hi,
Can you please tell me how to remount /sdcard directory to read/write on emulator?
I read this:
http://android-tricks.blogspot.com/2009/01/mount-filesystem-read-write.html
But i don't know how to apply that to remount /sdcard directory in read-write mode?
Thank you.
...
At work we're discussing upgrading our view layer for our web application. We're currently running an old and "modified" version of FreeMarker Classic, which is a pain to work with. One of our developers suggested using a Component UI style architecture similar to desktop style environments.
Essentially, this would mean that you would b...
I need to have a default error JSP page which is shown when an exception is thrown by the servlet, and that page will show the stacktrace..
How do I do that?? is there a right technique (provided by the API) or I have to do it manually?? I mean, sending the exception thrown as an attribute and then dealing with it by myself??
Thanks
...
I'm having an inconvenient dealing with sessions..
I have this:
www.mydomain.com
sub1.mydomain.com
sub2.mydomain.com
sub3.mydomain.com
and when I log into "www", then I change to "sub2" (for example) I
figure out it creates another session :S
why is that??
I need the same session for www, sub1, sub2, sub3, and so on.. ALL in
"mydomai...