I need to create a class which will be responsible for result set processing but it might happen that different algorithms should be used to process that result set.
I am aware of the following options:
1) Use Strategy patern, below is pseudo code:
interface Strategy {
processResultSet(ResultSet rs);
}
class StrategyA implements St...
How can I run a task daily at a specified time (say 11:00 am) using java.util.Timer? I'm using JDK 1.4.2, I know it's old, but it's what the project requires.
...
I set up a bean with an id of "exceptionResolver" made it an instance of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver. Then I define two properties, "defaultErrorView" and "exceptionMappings".
As I understand it this should catch any exceptions thrown in my web application and forward to the view I've specifie...
I would like to do something in Java (using iBatis, JDBC, etc., really in SQL) like:
SELECT SUM(rowName) FROM myTable WHERE id = [myArrayOfIds]
Where myArrayOfIds can be almost any length. Now I know you can do:
SELECT SUM(rowName) FROM myTable WHERE id IN (x, y, z)
but what happens for longer lists? For example my list could be as...
I have a List that is guaranteed to contain just one type object. This is created by some underlying code in a library that I cannot update. I want to create a List<ObjectType> based on the incoming List object so that my calling code is talking to List<ObjectType>.
What's the best way to convert the List (or any other object collect...
I know the ideas and features between C# and Java programming language is very similar. So as a senior C# web developer(average) how long will it take to make it feel comfortable programming Java web applications? Will it just like from VB.net to C#?
...
I have a Java Web Start Application which communicates against my server via a web service (over https).
I want to restrict the usage of the webservice to my app only, so that 3rd party apps don't work.
What strategies to I have? This question is somewhat broad, but running in JWS disables some options, like doing a checksum over all ja...
Hi.
I've omitted some code(package declarations, imports, other fields)
for shortness.
I have here simple One-to-Many relation.
It worked fine till this moment.
@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable="true")
class Restaurant implements Serializable {
@PrimaryKey
@Persistent(valueStrategy = IdGenerator...
I'm developping a plugin for eclipse and extending the org.eclipse.ui.views extension point. I want to use JFreeChart for drawing some graphics in eclipse view.
Is it possible to use JFreeChart with SWT in eclipse view ?
...
I'm pretty sure you can, but in addition to answering the question in the title, could you also explain the pros, cons, caveats, if any, to doing so? I know that you can't return a List, Set, Collection, Map, or any interface, from a WebMethod (which is stupid, IMO, but I don't know what the design reasons were should I should probably w...
Hi guys, I've to create a bmp image from two txt files.The first one is an mxn array:
* * * * * * * *
m n
c11 c21 .. cm1
...
c1n c2n .. cmn
* * * * * * * *
* * * * * * * *
6 5
.7 .7 .6 1.0 1.2 .1
.9 .3 .7 1.1 .7 .2
1 1.1 1.2 1.3 1.7 .6
.5 .6 .5 .4 .9 .1101
2 .1 .1 .1 2.1 1.1
* * * * * * * *
The second txt file is a color scale, like thi...
Hi, I'm just stuck with a problem (maybe Simple). But I can't figure out how to solve it, maybe someone of you can help me.
I receive as input an string with this format:
D0001001.tiff
And I need to return the next one (given that the next one is the received incremente by factor of one.
Input: D0001001.tiff
Output: D0001002.tiff
No...
I have a scenario where the unit of work is defined as:
Update table T1 in database server S1
Update table T2 in database server S2
And I want the above unit of work to happen either completely or none at all (as the case with any database transaction). How can I do this? I searched extensively and found this post close to what I am e...
Is there any way to hold tag files out of /WEB-INF/tags folder? Maybe by using tld somehow and calling them with uri instead of tagdir?
Reason for this request is that we are trying to run several sites from one codebase and we would like to have it like WEB-INF/site1/templates, tags, ... so if this is wrong idea to begin with, feel fr...
I'm really pulling my hair out over this one. Some background. I have a list of items that all have checkboxes next to them. When you deselect a checkbox, a button appears that allows you to delete the item from the list. This seems backwards at first but we only want "selected" items to be eligible for further processing, etc. This is m...
I have a servlet which handles a multipart form post. The post is actually being made by a Flash file upload component embedded in the page. In some browsers, the Flash-generated POST doesn't include the JSESSIONID which is making it impossible for me to load certain information from the session during the post.
The flash upload compon...
On my web server I have an HTML file that contains an applet tag:
<html>
<head/>
<body>
<applet code="Hello.class" width="100" height="100" />
</body>
</html>
And I have a Java class file named Hello.class in the same directory as the HTML file.
Both of these files are running on a web server (IIS 6) whose host name is some...
Hello,
I have an existing excel spreadsheet, which I am accesssing and reading values from, I am using Apache POI HSSF.
It is initialised like this:
HSSFSheet sheet;
FileInputStream fis = new FileInputStream(this.file);
POIFSFileSystem fs = new POIFSFileSystem(fis);
HSSFWorkbook wb = new HSSFWorkbook(fs);
this.sheet = wb.getSheet(exsh...
I'm looking for a way to give a java array a value directly, outside of its declaration, for example
/*this works*/
int a[] = {1,2,3};
/*this doesn't*/
a = {1,2,3};
the motivation is so that a method with an array as an argument can be used like this
public void f(int a[]) {
/*do stuff*/
}
f({1,2,3});
instead of
int a[] = {1,2,...
I need to be able to detect Japanese characters in a Java string.
Currently I'm getting the UnicodeBlock and checking to see if it's equal to Character.UnicodeBlock.KATAKANA or Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS, but I'm not 100% that's going to cover everything.
Any suggestions?
...