Hi i am trying to generate a 5 digit int array in java and am having trouble on where to start. None of the numbers in the array can be duplicates. i can generate random numbers for it fine but just cant figure out how to compare the numbers to each other and replace any duplicates.
thanks
...
I have two objects each with an id and a list.I would like to have a third arraylist sorting this object according to the list size.and still have the correaponding id along with the list
...
We have a Java project which contains a large number of English-language strings for user prompts, error messages and so forth. We want to extract all the translatable strings into a properties file so that they can be translated later.
For example, we would want to replace:
Foo.java
String msg = "Hello, " + name + "! Today is " + day...
Hello all,
Is there a way to add (or extend existing) classes at runtime in java. I'm stuck on a problem, in which I have to extend an existing class at runtime and add this to the classpath, so that this new class get picked up.
thanks,
...
I have a int variable which hold multiple flags, for instance:
int styles = ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED;
I can test the presence of a flag
boolean expanded = (styles & ExpandableComposite.EXPANDED) != 0;
How can I clear the value of a flag from styles, i.e. dynamically...
I am trying to create a back up file for an html file on a web server.
I want the backup to be in the same location as the existing file (it's a quick fix). I want to create the file using File file = new File(PathName);
public void backUpOldPage(String oldContent) throws IOException{
// this.uri is a class variable with th...
I would like to create a REST interface for my Java Google App Engine program. I figured I would start by generating some XML from my POJOS. However, it seems that XStream is bitten by GAE's restrictions.
What can I use to generate an XML string in Google App Engine?
Thanks.
Edit 1:
Here is the beginning of the exception:
javax.servl...
I'm binding a JComboBox to an observable List. I clear and add Objects form the observable list. This works fine and reflects the changes in the JComboBox correctly.
The problem is I can't select the content of the list using the mouse although the newly added items are correctly displayed in the combobox when expanded. The getSelected...
I have been using jquery UI dialog in which I want to
give a ajax call to populate the combobox in it,I also have
jspf regarding the same.So please tell can I do this (using jspf inside the dialog box )
also can I give ajax call via the selection on dialog box
if yes how as also I have to map the jquery data with the struts form.
...
hi...
i m using the keyboard event on Robot Objects....
but each time i have to specify the keys individually....like
Robot r=new Robot();
r.KeyPress(KeyEvent.VK_A);
r.KeyPress(KeyEvent.VK_B);
r.KeyPress(KeyEvent.VK_C);
r.KeyPress(KeyEvent.VK_D);
is there any technique to get/recognize eachand every keys....not by specifying them ind...
We are stuck with Java2SE v1.4 till the end of 2010. That's really nasty, but we can't help it. What options do we have to use some of the new features already now? I can think of several ways like
changing the bytecode, e.g. using Retrotranslator or Retroweaver.
backport of libraries, e.g. Concurrent Backport, but this does not help f...
Is there a legal way to add/remove permissions to Java security policy at runtime?
...
We're starting to make heavier use of GWT in our projects, and the performance of the GWT compiler is becoming increasingly annoying.
We're going to start altering our working practices to mitigate the problem, including a greater emphasis on the hosted-mode browser, which defers the need to run the GWT compiler until a later time, but...
I was just reading a Java7 preview presentation (pdf) and there was a slide on Chained Invocation. Here is the example used in the slide:
// Construction with setters
DrinkBuilder margarita = new DrinkBuilder();
margarita.add(“tequila”);
margarita.add(“orange liqueur”);
margarita.add(“lime juice”);
margarita.withRocks();
margarita.withS...
I've run accorss a really weird issue, in eclipse I've got a codebase I've been working on for a couple of weeks and it's working fine. I did an svn update and all of a sudden one of my classes doesn't compile because it can't resolve an enum which is in the same namespace to a type.
I've checked the Java version and I'm running under J...
Resolution: No I'm no longer extending the original parent.
Original:
Is there a way to annotate an inherited final setter method? I am extending a class which has a final setter which I would like to @Autowire with Spring. The parent class is from a library and cannot be modified.
A workaround I have found is to write a proxy method, ...
I have successfully marshaled the following class
@XmlRootElement(name = "Field")
private static class MyField {
@XmlAttribute(name = "Name")
String name;
@XmlElement(name = "Size")
int size;
....}
Now I want to have my container class to hold multiple instances of Field, so I declared a class in the followi...
hi
there is a problem during handling Robot.KeyPress(KeyEvent...) is it neccesarry to specify all the keys every time....
e.g
Robot.KeyPress(KeyEvent.VK_A);
Robot.KeyPress(KeyEvent.VK_B);
Robot.KeyPress(KeyEvent.VK_C);
if there is any shortkut for not repeating this everytime...plz tell me.....
and the interpretation for keys th...
I'm working in a Java project where the axis 2 library from Apache is being used. The axis 2 library is composed of about 20 jar files and some of these are not used project. What I want to know if there is a method to identify which of those jar files are the unused ones.
I'm using the Eclipse IDE an I thought that one way to solve the...
Hi.
I was wondering if anyone have tried to do an equivalent of
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(secret, saltValueBytes);
byte[] secretKey = key.GetBytes(16);
in Java. Where secret is a string(password), and saltValueBytes is, well, a salt in byte array.
I've tried stuff, but can't seem to wrap my head around it.
Tha...