I have dates in text format of the form dd-mmm-yy or d-mmm-y, where months are abbreviations in letters (for example, 4-Nov-09 or 12-Dec-05, etc...)
I would like to parse it to produce a java.util.Date object.
Could this be achieved by leveraging the java.text.DateFormat class? Or is there another easy way of doing this?
...
Hi Guys.
I have a singleton class called SingletonController1.
This SingletonController1 instantiates a bunch of others Singleton classes.
SingletonController1{
Authenticator - Singleton;
DBAccessor - Singleton;
RiskAccessor - Singleton;
}
My question is, what if I rework this design to:
SingletonController2{
Authenticator -...
Is it safe to call the dispose() method of a JFrame from a different thread (not the EDT)?
...
hello good people! thanks to you guys my knowlegde on hibernate has been improve dratiscally.
now i hit a block here about current_timestamp.
here is my codes
@Column(name="DATE_CREATED", insertable=false, updatable=false, columnDefinition="timestamp default current_timestamp")
@org.hibernate.annotations.Generated(value=GenerationTime....
Im using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a spring app and using Tomcat as the servlet container.
I'm running into issues making a connection to a https endpoint. I am receiving the following error:
org.springframework.web.client.ResourceAccessException: I/O error:...
Hey guys this is a followup to my previous question. I now have a text file which is formatted like this:
100 200
123
124 123 145
What I want to do is get these values into a two dimensional ragged array in Java.
What I have so far is this:
public String[][] readFile(String fileName) throws FileNotFoundException, IOException {
...
Background: A long time I remember reading about a Java library that was created specifically to handle routine operations on Windows operating systems. It had, for example, native routines for handling things like "shortcut" creation, and all those cute little quirks of windows filepaths.
It was touted as being the "missing library" f...
What is the easiest way to obtain a statically typed representation of an XML schema (.XSD) in Java?
More specifically I want to be able to programatically traverse all defined simpleType:s and complexType:s in the XSD, obtain defined elements and their types, etc.
Something along the lines of:
for (XsdComplexType complexType : docume...
I've encountered the following bug:
http://issues.apache.org/jira/browse/AXIS2-4363
It states the following:
This error only occurs when log level for org.apache.axiom is DEBUG so a workaround is to set log level > DEBUG.
My question is HOW do I go about doing that? I've been scouring my directories for a properties file or something...
A super trivial beginner question on Java arrays:
Can anyone explain why the compiler doesn't like this:
class Cycle {}
public class CycleTest {
Cycle[] cy = new Cycle[3];
cy[0] = new Cycle();
cy[1] = new Cycle();
cy[2] = new Cycle();
}
Many thanks.
...
Hi I am doing the following in my SampleServlet.java
//Fill resultset from db
.....
try {
ArrayList Rows = new ArrayList();
while (resultSet.next()){
ArrayList row = new ArrayList();
for (int i = 1; i <= 7 ; i++){
row.add(resultSet.getString(i));
}
Rows.add(row);
}
reques...
How can I restrict a user (in the development domain) to allow them to VPN into a domain, yet not use Windows Terminal Services to any server in that domain? I need for them to be able to run a client-side Java application (Quest Spotlight, actually) that will connect using Windows Auth to a single production server and display data comi...
If so how do you do this?
(jboss/tomact embedded/jdk 1.5)
not embedded js/css but an actual file...
...
So i have made a simple program with a basic menu at the top of the frame, Now i just need to put actions behind each JMenuItem. Im struggling to work the code out though, Here is what i thought would work:
JMenu file_Menu = new JMenu("File");
JMenuItem fileExit = new JMenuItem("Exit Program");
file_Menu.add(fileExit);
fileExit.addActi...
I saved my java source file specifying it's encoding type as UTF-8 (using notepad, by default notepad's encoding type is ANSI) then I tried to compile it using
javac -encoding "UTF-8" One.java
but it gave a error message
One.java:1: illegal character: \65279
?public class One {
^
1 error
is there any other way, i can compile this ...
I wanted my application to just have one TimeZone object which will be used by many SimpleDateFormat and Calendar objects from the other places concurrently. This is to avoid having to always do TimeZone.getTimeZone(ID).
I know SimpleDateFormat and Calendar classes are not thread safe, which is why I configure one thread to always cr...
Is Java's URL class a thread-safe, in particular URL.openConnection()?
In my application, I make tens of concurrent HTTPS connections a second to the same URL, and I would like to maximize object reuse. Yet, it's not clear from the documentation what can be reused.
EDIT: I'm open to using a different library if needed.
...
I was looking at the implementation of compare(double, double) in the Java standard library (6). It reads:
public static int compare(double d1, double d2) {
if (d1 < d2)
return -1; // Neither val is NaN, thisVal is smaller
if (d1 > d2)
return 1; // Neither val is NaN, thisVal is larger
long thisBits =...
I have project use EJB 3.0 and implement Toplink framework for model layer.
When using EJBQL to process data, I see it seems have some limitation:
It cannot process datatime such as find a part of date such as day, month or year
It cannot find datetime among from...to
It cannot comparison datetime field
It cannot map a class not entit...
While using visualVM to detect memory leak, it allows us an Instance view as described below:
The Instance view displays object instances for a selected class. When you select an instance from the Instance pane, VisualVM displays the fields of that class and references to that class in the respective panes. In the References pane, you c...