I want to call ejb from servlet via remote interface. Maybe it is a RTFM question but i cannot find solution via Google or documentation
I use Jboss 4.2, Java 1.6
Thanks for your answer!
what's are the uses of the host param with java applets?
can it be tricked to use a different server than the originating server?
I didn't find a clear complete explanation of the host param.
how do you get source ip, username, password, etc... of the client machine that sends a soap request? is there any of these details that one can pull for logging purposes?
I am using Java to handle the incoming SOAP requests. The service simply adds 2 numbers and is working, but I just need to get some client details.
Thanks, Lavanya
Resolving an xpath that includes namepsaces in Java appears to require the use of a NamespaceContext object, mapping prefixes to namespace urls and vice versa. But I can find no mechanism for getting a NamespaceContext other than implementing it myself. This seems counter-intuitive. Is there any easy way to acquire a NamespaceContext from a document, or to create one, or failing that, to forgo prefixes altogether and specify the xpath with fully qualified names?
Programming challenge: Given a set of integers [1, 2, 3, 4, 5] I would like to generate all possible k-combinations in ascending size order in Java; e.g.
[1], [2], [3], [4], [5], [1, 2], [1, 3] ... [1, 2, 3, 4, 5]
It is fairly easy to produce a recursive solution that generates all combinations and then sort them afterwards but I imagine there's a more efficient way that removes the need for the additional sort.
Hi,
is there a way to log the JdbcTemplate's DataSource connection URL in Java?
The field exists in the DataSource, but there ain't a getter to access it. Of course I could read the DataSource properties from the application context xml, but I'd like to do it the other way.
I'm working on a new Java project and therefore im reading the already existing code. On a very important part of the code if found the following regex expression and i can't really tell what they are doing. Anybody can explain in plain english what they do??
1)
[^,]*|.+(,).+
2)
(\()?\d+(?(1)\))
When you call remove(object o) on an arraylist in java, how does it compare the objects to find the correct one to remove? does it use the pointer? or does it compare the objects using the interface Comparable?
I always thought that varibales are mapped to stack locations once your Java source is compiled; additionally, they may include the info about the variable names and their scope in classfiles, but that's optional AFAIK.
The question is - how do my Eclipse/IDEA IDEs allow me to set a watch expression containing the local variable name? To me, it's hard to understand :)
I have data structured in Binary tree format, i want to represent it into an image(*. jpeg) then i need to display that image on web page and all the data will come @ runtime, so image processing should be done @ runtime, how to do this ?
This is what my thought solution any other suitable solution are also welcomed,
web site is in .NET , i am thinking to produce image using java api then integrate it to .NET wither through WEB-SERVICE call or any other solutions are also welcomed.
Hello everyone! I try to learn java for android devices..
i have to create the update function. But still have one question: How????
in class root
public void update(){
maindebug("update"); // This is my debug function
}
public void run(){
while(isRunning){ // isRunning is a boolean variable
SystemClock.sleep(100);
update();
}
}
and inside onCreate
run();
but it doesnt work :(
I'm trying to send an email in Java but when I read the body of the email in Outlook, it's gotten rid of all my linebreaks. I'm putting \n at the ends of the lines but is there something special I need to do other than that? The receivers are always going to be using Outlook.
I found a page on microsoft.com that says there's a 'Remove line breaks' "feature" in Outlook so does this mean there's no solution to get around that other than un-checking that setting?
Thanks
I have a set of points in 3d space and I want to be able to categorize the shape that best fits them - cube, sphere, cylinder, planar (flat) etc.
I've looked at supervised/machine learning but since I need first generate a large training data set that's not really suitable.
My dream solution would be a java library with a wonderful magical function something like :
public enum ShapeType {
CUBE,
SPHERE,
CYLINDER,
PLANAR
}
public ShapeType CategorizeShapeFromPoints( 3DPoint[] points )
However, any and all help will be appreciated. Thanks
I've written the following if-statement in Java:
if(methodName.equals("set" + this.name) ||
isBoolean() ? methodName.equals("is" + this.name) :
methodName.equals("get" + this.name)) {
...
}
Is this a good practice to write such expressions in if, to separate state from condition? And can this expression be simplified?
I have this situation(Java code):
1) a string such as : "A wild adventure" should match.
2) a string with adjacent repeated words: "A wild wild adventure" shouldn't match.
With this regular expression: .* \b(\w+)\b\s*\1\b.* i can match strings containing adjacent repeated words.
How to reverse the situation i.e how to match strings which do not contain adjacent repeat words
The answer to 'unloading classes in java' says -
"The only way that a Class can be unloaded is if the Classloader used is garbage collected."
I took a look at the JLS but couldn't understand it
Why is this the case?
Will incrementing the instance variables of an object ever lead to a stack overflow error?
For example:
This method (java) will cause a stack overflow error:
class StackOverflow {
public static void StackOverflow (int x)
{
System.out.println (x) ;
StackOverflow(x+1) ;
}
public static void main (String[]arg) { StackOverflow (0) ;
}
but will this?: (..... is a gap that i've put in to shorten the code. its long enough as it is.)
import java.util.*;
class Dice
{
String name ;
int x ;
int[] sum ;
....
public Dice (String name)
{
this.name = name ;
this.x = 0 ;
this.sum = new int[7] ;
}
....
public static void main (String[] arg)
{
Dice a1 = new Dice ("a1") ;
for (int i = 0; i<6000000; i++)
{
a1.roll () ;
printDice(a1) ;
}
}
....
public void roll ()
{
this.x = randNum(1, this.sum.length) ;
this.sum[x] ++ ;
}
public static int randNum (int a, int b)
{
Random random = new Random() ;
int c = (b-a) ;
int randomNumber = ((random.nextInt(c)) + a) ;
return randomNumber ;
}
public static void printDice (Dice Dice)
{
System.out.println (Dice.name) ;
System.out.println ("value: "+Dice.x) ;
printValues (Dice) ;
}
public static void printValues (Dice Dice)
{
for (int i = 0; i<Dice.sum.length; i++)
System.out.println ("#of "+i+"'s: "+Dice.sum[i]) ;
}
}
The above doesn't currently cause a stack overflow error but could i get it too if i changed this line in main: for (int i = 0; i<6000000; i++) so that instead of 6 million something sufficiently high were there?
I have a mixed Java / C# project and use an ant script that contains a csc task to compile the dll. This works, but I get a warning
[csc] This task is deprecated and will be removed in a future version
[csc] of Ant. It is now part of the .NET Antlib:
[csc] http://ant.apache.org/antlibs/dotnet/index.html
How can I replace the csc task? I can surely create an exec task calling nant with a project.build file, but that feels completely wrong.
I have 3 boxes, each box contain 10 piece of numbered paper (1 - 10) but there is a number the same in all 3 boxes eg: box1 has number 4 and box2 has number 4 and box3 also has number 4. How to find that repeated number in java with an efficient/fastest way possible?
I have a java main application, and I want to use log4j.
I don't want to hard code my settings, so where do I put the log4j config file so my application can find it?
I have a quadcore processor and I would really like to take advantage of all those cores when I'm running quick simulations. The problem is I'm only familiar with the small Linux cluster we have in the lab and I'm using Vista at home.
What sort of things do I want to look into for multicore programming with C or Java? What is the lingo that I want to google?
Thanks for the help.
I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS request but still not finding any sample code which successfully perform PUT and DELETE request. Can any one give idea regarding that?
Hello Guys
i just want to create a simple application that will allow a user to input a url to a rss feed and display the contents to a user.
what would be a good java library to enable me to read rss feeds?
cheers
I know I can find out if a variable is null in Java using these techniques:
if (var==null) - too much work
try { ... } catch (NullPointerException e) { ...} - it tells me what line is throwing the exception
using the debugger - by hand, too slow
Consider this line of code:
if (this.superSL.items.get(name).getSource().compareTo(VIsualShoppingList.Source_EXTRA)==0) {
I would like to know if there's a generic way to find out programatically what variable (not just the line) is throwing the NullPointerException in a certain area of code. In the example, knowing that