I'm wrestling with a strange problem: When I make a change to a POJO or Seam Component in my localhost JBoss instance, restart it, and load the page, the change is visible. However, on our server, running the same version of JBoss, when I stop the instance, delete the WAR file, upload the latest version, and restart JBoss, it won't show ...
Can someone point me to some java code that can upload a file via FTP. The important thing is that if the FTP responds with an error message I need to obtain it. This is because I need to be sure the file was succesffully uploaded.
I am using the following code, but it does not return an error if the upload fails.
import java.io.Buf...
I'm am creating an Android application, but in order to have one of the functionalities working I need to read a predefined xml file whilst only knowing its name, not the R.id..
In normal Java I know I can use
getClass().getClassLoader().getResource(xmlName)
but using the limited Android SDK thats not working, any knows how to solve ...
I see this idiom of initializing instance variables quite a bit
public class Test{
private Long l = 1l;
private MyClass mc = new MyClass();
public Test(){}
...
}
But I would prefer
public class Test{
private Long l;
private MyClass mc;
public Test(){
l = 1l;
mc = new MyClass();
}
...
hey,
i'm just getting started with using json with java. i'm not sure how to access string values within a JSONArray. for instance, my json looks like this:
{
"locations": {
"record": [
{
"id": 8817,
"loc": "NEW YORK CITY"
},
{
"id": 2873,
"loc": "UNITED STATES"
},
...
When I was programming a Form Validator in PHP, when creating new methods, I needed to increase the number of arguments in old methods.
When I was learning Java, when I read that extends is to not touch previously tested, working code, I thought I shouldn't have increased the number of arguments in the old methods, but overridden the ol...
I have ten WAR files, all of which have nearly identical code and markup. The only differences lie in the images, CSS and Messages. I hit on the concept of Profiles but I haven't quite groked it yet and I'm not sure if this can handle what I need it to do.
Basically, I want a base project with different profiles for the 10 different WAR...
Are there any patterns or best practices that can be used to simplify changing configuration profiles for java web applications across multiple environments. e.g. JDBC URLs, SOAP end-points, etc.
As a bit of background to help clarify my question, I work with several large java web applications that during any given release cycle move...
Hi,
I have created several files with unit tests on existing classes in NetBeans project.
I used menu "File/New file/JUnit/Test for Existing Class" to create test files.
I can run one file with unit tests by right click on it and select "Run File".
But I want to run all files with unit tests.
How can I achieve this in the simplest way...
I work with RDF and OWL but until I came to SO I'd never heard of Rowlex and OwlGrinder. It's got a much larger presence on SO than Protege or Pellet (although from a smallish number of active people). Is it primarily the .NET equivalent of Protege or does it take a different approach (It stresses the Open-world assumption). There's very...
When programmatically creating a PDF document using iText, I'm able to insert a JPG image into the document's header on my local environment (Windows XP). However, when executing the same code on our test environment (Linux based), iText throws an exception claiming the image file "is not a recognized imageformat", in com.lowagie.text.Im...
I'm looking for the Clojure/Java equivalent to Python's lxml library.
I've used it a ton in the past for parsing all sorts of html (as a replacement for BeautifulSoup) and it's great to be able to use the same elementtree api for xml as well -- really a trusted friend! Can anyone recommend a similar Java/Clojure library?
About lxml
...
I am converting Java to C# and need to convert code involving Calendar:
Calendar rightNow = Calendar.getInstance();
StringBuilder sb = new StringBuilder();
sb.append((rightNow.get(Calendar.MONTH) + 1));
sb.append(rightNow.get(Calendar.DAY_OF_MONTH));
sb.append(rightNow.get(Calendar.YEAR)).substring(2);
sb.append(rightNow.get(Calendar.HO...
Trying to do something like:
public interface Order {
public List<? extends OrderItem> getItems();
public void setItems(List<? extends OrderItem> items);
}
public interface OrderItem {
// stuff
}
public calss OrderItemImp implements OrderItem {
// stuff
}
public class OrderImp implements Order {
...
Error: Unhandled exception type IOException.
File imgLoc = new File("player.png");
BufferedImage img = ImageIO.read(imgLoc);
How do I get a bufferedImage from a file location?
...
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable ="false")
public class Foo implements IsSerializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private Long revision;
@Persistent
private String information;
}
The problem is this obje...
How would I force a Frame to repaint() immediately after it is maximized, or resized?
I can't find what method is called when that specific operation takes place. I have a bunch of graphics that are written with Graphic objects in paint and their orientation depends on the real time feedback from getWidth() and getHeight() but paint isn...
Say I have something like this:
new File("test").eachFile() { file->
println file.getName()
}
This prints the full filename of every file in the test directory. Is there a Groovy way to get the filename without any extension? (Or am I back in regex land?)
...
I understand that C++ is generally considered better than Java for games (at least larger-scale games). Why is this?
What is keeping Java from being competitive in this field? Which reasons against using Java for game programming have the most basis, and which ones are myths?
EDIT: Am a bit unfamiliar with C/C++, and did not think to ...
How do you use svnkit to enumerate svn repositories in a root directory?
...