As far as I know, what I ask here isn't possible, but I thought I'd ask anyway in case I'm missing something.
Suppose you want to let users upload JPG images, and these images are scaled into smaller icons and the original images are always discarded and never required again. Is there any way that would commonly work in most modern brow...
In Java, I just read a file into a ByteBuffer. When I started checking to make sure that the ByteBuffer contained the right bytes, I noticed that it had mostly the correct start and end bytes, except for the 3rd byte, it has -117 instead of what emacs says should be 139 (8b in hexl-mode). What gives? Does this have something to do with B...
When I compile my project with compiler warnings (JDK 1.5) I get a bunch of bad path element warnings:
Warning:: [path] bad path element "C:\Users\User\MyJava\common\lib\junit.jar": no such file or directory
Warning:: [path] bad path element "C:\Users\User\MyJava\common\lib\jdom.jar": no such file or directory
Warning:: [path] bad path ...
I'm trying to run a query to see if a link already exists in the database. In my example below url is of type Link.
Query query = pm.newQuery("select from com.ClassName where url == newUrl");
query.declareParameters("com.google.appengine.api.datastore.Link newUrl");
List<ResourceItem> results = (List<ResourceItem>) query.execute(new...
I have an application that takes some input and generates configuration files as output. Since the exact input or output format could change over time, I defined two interfaces: Importer and Exporter.
Each concrete importer or exporter could have different parameters that need to be initialized to work. For example, if the import data i...
I'm thinking about learning Java. I'm already a more than competent c# developer. Has anybody else been in a similar situation? Roughly how long (whilst doing a typical 9-5 job) did it take you to transfer your skills? What resources would you recommend?
(When talking about resources, I specifically mean resources aimed at developer...
If I have a boolean field like:
private static final boolean DEBUG = false;
and within my code I have statements like:
if(DEBUG) System.err.println("err1");
does the Java preprocessor just get rid of the if statement and the unreachable code?
...
I have an old legacy java web application that I want to deploy on the same server as my asp.net-applications (running on IIS 7). And I need to have all applications running on port 80, so I can't just install two web servers on different ports.
The java-application is really simple, just a couple of serverlets (no JSP) with functional...
I need to extract data from a DB2 table, run some processing on each returned row and output to a flat file. I'm using iBatis but found that using the queryForList I started getting out of memory errors, I'll be looking at 100k+ rows of data increasing.
I've looked at using queryWithRowHandler instead but the iBatis RowHandler interfac...
hi,
say i have a class Animal, and then classes Dog and Cat that extend it. Can i have a method then that returns dog or cat, depending on some value? so, something like this, except working :)
public <T extends Animal> getAnimal(){
if (a)
return new Dog();
else
return new Cat();
}
...
I have a file watcher that is grabbing content from a growing file encoded with utf-16LE. The first bit of data written to it has the BOM available -- I was using this to identify the encoding against UTF-8 (which MOST of my files coming in are encoded in). I catch the BOM and re-encode to UTF-8 so my parser doesn't freak out. The proble...
hi, i know about what a RowSet is and all; what i would like to know is if it works properly and is accepted already, or if it still has it's bugs and isn't as widely accepted as the classic ResultSet. it looks good to me so far, but i want to hear more experienced views on the subject.
...
I'm utilizing Java and SQLiteJDBC to work with SQLite. I need to access name of columns for a given table and I've found that I could accomplish this with the following command:
pragma table_info(myTable)
However, when attempting to do the following I get an error.
PreparedStatement _pstmt = this._DBConnection.prepareStatement("pragm...
I have the following Java class that draws a 3D arrow in space, but there are two problems,I don't quite know how to fix them.
import javax.swing.*;
import java.awt.Frame;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;...
I'm trying to compile a Flex application in Ant (no problems here, I can do it fine). When I try to publish the contents of the project to a Windows network drive (known as "Z:\" on my system), I get the following LAME exception thrown by Java/Ant:
BUILD FAILED
C:\workspace\bkeller\build.xml:42: Failed to copy C:\workspace\bkeller\web\...
Is it a good or bad idea to make setters in java return "this"?
public Employee setName(String name){
this.name = name;
return this;
}
This pattern can be useful because then you can chain setters like this:
list.add(new Employee().setName("Jack Sparrow").setId(1).setFoo("bacon!"));
instead of this:
Employee e = new Employee...
While you create a user defined class in Java, you do not specify it as extending Object. But still the class is an Object. How does this work? How does javac or the JVM inject all properties of a class to the user defined class?
...
Hi all.
I am using org.apache.commons.validator.routines.DateValidator to validate a date with a simple date pattern "dd/mm/yyyy"
Unfortunate part is that if I pass a date in format "2/2/1992" then it declares it as an invalid date and if I use format "d/m/yyyy" (In java SimpleDateFormat both these formats works for both cases), then ...
I parse a big xml document with Sax, I want to stop parsing the document when some condition establish? How to do?
...
Does any one have any idea why this would be happening?
This is some modified lines from the Java DBus bindings (2.6)
// don't let people import things which don't have a
// valid D-Bus interface name
System.out.println("type.getName: " + type.getName() + " type.getSimpleName: " + type.getSimpleName() );
if (type.getName().eq...