I am trying to write a method that uses recursion to compare the strings str1 and str2 and determine which of them comes first alphabetically (i.e., according to the ordering used for words in a dictionary).
If str1 comes first alphabetically, the method should return the integer 1.
If str2 comes first alphabetically, the method shoul...
Hi, I would like to serialize an object to an XML of this form with XStream.
<node att="value">text</node>
The value of the node (text) is a field on the serialized object, as well as the att attribute. Is this possible without writing a converter for this object?
Thanks!
...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I use when setting up the stored procedure call in code I get an error stating that the stored procedure couldn't be found. I have provided t...
I am in the middle of solving a problem where I think it's best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set amount of ingredients and a few different types of sadnwiches i can make. Each ingedient has a cost associated with it. The client would be...
Check this,
List<String> list = new ArrayList<String>();
for (int i = 0; i < 10000; i++) {
String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, 20);
assertFalse(list.contains(value));
assertTrue(value.length() < 18);
list.add(value);
}
This method is passing like char...
Hi. Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using native2ascii and it solved my problem. Is there no other way of converting the file through setting the encoding to ascii in the confi...
History & Situation:
I'm currently working on updating a Java application that was developed for a client several years ago (to run on WinXP) and is used for testing and training people with certain hearing impairments. Users who bought this application were provided with a particular USB sound device and headphones.
One of the most im...
Here is the xml file that I need to process as part of my assignment.
<?xml-stylesheet type="text/xsl" href="people.xsl"?>
<People>
<Person>
`...`
</Person>
`...`
</People>
I am using the "javax.xml.parsers.DocumentBuilderFactory" to create a dom parser. After parsing, the resultant document does not have People at t...
I'm looking to create a set of functions which all implementations of a certain Interface can be extended to use. My question is whether there's a way to do this without using a proxy or manually extending each implementation of the interface?
My initial idea was to see if it was possible to use generics; using a parameterized type as t...
I have to generate PL-SQL code, with some common code(invariable) and a variable code. I don't want to use any external tools.
Some ways that I can think:
Can I go and maintain the common code in a template and with markers, where my java code will generate code in the markers and generate a new file.
Maintain the common code in stati...
Hi ,
What is a java bean ..why do i need it .since i can solve all apps with my class and interface structure. Why do i need beans.And can you point me a place where beans are essential instead of class and interface?
Please explain the essentiality of a bean in the below context:
Wep apps
Standalone Apps
...
I am using the ant tasks 'junit' and 'junitreport' to run my JUnit Tests and generate a report at the end (=> "Unit Test Results").
Is it there some easy way to extend this output somehow to get more information displayed in the report? For example to add an additional column which contains link to a screenshot taken by the test.
I've ...
Hi,
I want to know how to find the protocol(SNMP,TL1,CLI,HTTP) being used by a targed device using its ipaddress
Is there any code to find out...if so pls tell
I will be thankful to your valuable replies
...
Hi,
On my site wemanageloans.com, many of the users are getting the following error when they try to login with the correct credentials:
HTTP Status 408 - The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browse...
Hi all
I want to work out the next payment date in my code. I have a start date and i have a payment frequency which can be DAY, WEEK, MONTH or YEAR. So if the start date was 10 FEB 2009 and had a payment frequency of MONTH and the current date is 13 NOV 2009 then the next payment date would be 10 DEC 2009
I have already written some ...
I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no language-specific? And how can that exception later be displayed based on the current locale?
I was originally looking for a way to localize the...
Hi, I have a JScrollPane with FlowLayout that I want to have a fixed width. It should be scrolling vertically only, and the contents should be rearranged automatically when I resize the window. I think there should be a method like setEnableHorizontalScroll(false) but can't find it. Is there any easy way to do this?
...
We are building a site, where all the knowledge base articles need to be displayed?
Is ther any Open source Java based Knowledge Base System available? If not, what are the best alternatives?(wiki, cms)
...
Are there Java classes for manipulating SQL statements?
For example, break this statement
SELECT col1, col2 FROM table WHERE a = 1 AND b = 2 ORDER BY 1;
into some kind of map.
['select' => {'col1', 'col2'}, 'from' => {'table'}, 'where' => ..]
Then, you would be able to say add to the where clause or add tables to select from. Is t...
I am using Quartz to schedule background tasks for a web application. Some of these tasks just fire off requests against the same web application.
I want to avoid depending on any kind of network settings (for example a request with my own domain name might not be routed properly if made from within the data center). Is there a Java API...