Hi,
I have to convert an incoming String field into a BigDecimal field that would represent a valid amount of money, for example:
String amount = "1000";
BigDecimal valid_amount = convert(amount);
print(valid_amount.toString())//1000.00
What is the right API to use convert a String into a valid amount of money in Java (eg: apache commons library)?
Thanks in advance,
What I mean is like have to user input a string with multiple variables and get the value of those variable. Like a simple quadratic formula: x^2 + 5x + 10. Or in java: (Math.pow(x,2)) + (x * 5) + 10The user would then enter that and then the program would solve for x. I will be using the BeanShell Interpreter class to interpret the string as an equation. But how would I solve for x?
When I use the default java locale on my linux machine it comes out with the US locale settings, where do I change this so that it comes out with the correct locale?
How can I check for a boolean to change state over a given period of time, and if a change is made over that time period perform a method?
Can any help please be given in Java.
Thanks.
Hi,
i've a Java project managed by Maven2. The scenario i'm trying to solve is the following:
in development mode i need to use some configuration files (for example, a hibernate.cfg.xml configured for the dev environment), while in production i need to exclude all the development specific files and configurations, and get instead some other ones for my production environment. How can i handle this situation?
Thanks
Is it possible to have multiple authentication methods for a java servlet? For example, have form based authentication in addition to open id based authentication so users can choose how they log in.
how to download a image from a web server to java SE application.
i have found the code for the ME application but apparently javax package is not in the SE developments. can someone help me
Can anyone recommend a tutorial on how to write a java servlet which connects to ms sql server and manages data?
I'm trying to write something which pulls products out of one database and inserts them into a stored procedure located on another database.
thanks in advance
Hi,
I found Facelift which can basically generate html headings as images (with "nice font") on the fly. Does something similar exist for Java (couldn't find one myself)?
Cheers,
stephanos
hi,
i'm trying to put an image as a background of my interface in java , i tried to write a class that does that and using it , but is there a simpler way to do that .
thanks
Is it possible to define array in this way in JAVA, otherwise are there an alternative close this definition?
private final int CONST_0= 0;
private final int CONST_1= 1;
private final int CONST_2= 2;
private final int CONST_3= 3;
private final String[] CONST_TXTRECORDS = new String[]
{[CONST_0] = "test0",
{[CONST_1] = "test1",
{[CONST_2] = "test2",
{[CONST_3] = "test3"};
Hi,
I want to maintain order of the elements being added in a list. So, I used a linkedlist in Java. Now I want to be able to swap two elements in the linked list. First of all, I cannot find an elementAt method for linked list. Also, there is no way to add element at a specified position.
Thank you.
Hi,
I have just started with the ebay Finding API and Feedback API and I need to deploy a basic API implementation on GAE/J.
The problems are:
How do we start with the local dev environment of the ebay SDK?
There is no Java tutorial for the Finding API and feedback.
GAE/J + ebay APIs won't cause any complexity right?
I am looking for head start in the right direction,I am using Eclipse + GAE plugin.
Hi, is there any way to debug a 3rd party Java code (library) which, as I believe, was compiled without line number attributes? I attach a debugger to this class (decompiled in Eclipse using JadClipse) and I can set breakpoints on method entries, but cannot step through code line by line.
Is there a way (and if so how?) to access plugged-in resources on my computer with java? Like the microphone, the speakers and the computer monitor? I'm not talking about mainboard, cpu, etc. this is reserved for C.
This might sound stupid, but why doesn't the Java compiler warn about the expression in the following if statement:
String a = "something";
if(a == "something"){
System.out.println("a is equal to something");
}else{
System.out.println("a is not equal to something");
}
I realize why the expression is untrue, but AFAIK, a can never be equal to the String literal "something". The compiler should realize this and at least warn me that I'm an idiot who is coding way to late at night.
Is there a way to kill a child thread after some specified time limit in Java?
Edit: Also this particular thread may be blocked in its worst case (Thread is used to wait for a file modification and blocks until this event occurs), so im not sure that interrupt() will be successful?
Hi,
I'm looking for a CSS Parser in java. In particular my requirement is, for a given node/element in an HTML document, to be able to ask/get the css styles for that element from the Parser.
I know there is the W3C SAC interface and one or 2 implementations based on this - but turorials/examples appear non-existant.
Any help/points in rigth direction much appreciated.
Thanks
I need to create simple pagination of objects, but when I read manual I found out that query.setRange(5, 10); will fetch 10 objects, even when only 5 objects are needed.
Is there anyway to fetch just needed objects?
EDIT: I started bounty, so fi you can show me simple example code in Java that works, then I will accept you answer.
I've got this function for encrypting passwords in Java, but somehow when I call
MessageDigest, it returns a different result every time even though I call it with the same password. I wonder if I am initializing it wrong somehow.
public String encrypt (String password) {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.reset();
md.update(password.getBytes(Charset.forName("utf-8")),0,password.length());
String res = md.digest().toString();
}
I have a Java web app that I develop on a Windows machine and will deploy on a Unix machine.
There are some file path settings and permissions details that differ on the two (and there is nothing I can do to change this). Is there some way of detecting which machine the app is sitting on (it's only one of two), either by detecting the operating system or the computer's name so I can then using the appropriate settings.