I have a xml document like this rootXMLDoc=<root></root> . I need to insert paramxmlDoc= <parameter par='1'>abc</parameter>. how to insert paramxmlDoc to rootXMLDoc in java.?
I'm having trouble with a JVM running an app, whose heap memory looks like a comb. It's constantly jumping from 1.5 GB to 3 GB and slowly deteriorating to higher values. I'm using G1 GC algorithm, but have no idea how to configure it.
I do not have access to the code of the app I'm running and, needless to say, it's a rather large app.
So, bottom line, does anyone know of a good guide to configure GC in Java?
I am scrapping data from web site using my java application and want to display the result after parsing code of html page in a Text Area made in Swing.
Text like: hello <b>every</b>one should be displayed as: 'hello everyone' in text area.
Thanks!!
Hi all,
Most google results for sample questions/problems for java, results in a link directing to mock certification questions. Does anyone know where can i find sample problems for practice ?
Thanks
I have a Class<? extends Annotation> and tried calling newInstance() but Java yelled at me for the obvious reason that I can't instantiate an interface. But I know frameworks like EasyMock are perfectly capable of instantiating interfaces. What would it take to get a completely dumb Annotation instance out of my Class?
Is there a method in JDK or apache commons to "pop" a list of elements from a java.util.List? I mean, remove the list of elements and return it, like this method:
public Collection pop(Collection elementsToPop, Collection elements) {
Collection popped = new ArrayList();
for (Object object : elementsToPop) {
if (elements.contains(object)) {
elements.remove(object);
popped.add(object);
}
}
return popped;
}
What are the best practices for using Java's @Override annotation and why?
It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override?
Hi guys.
First I want to say is that I am 37 years old and not from programmer background (actually from biology). And my question is should I start learning Java? I have coded in PHP and JavaScript for a year and a half. Every answer would be appreciated.
Thanks in advance
Bobi.
Hi all,
I am tyring to merge an .mov file with a .wav file using java media framework, thus I need to know their duration. How can I do this? Any ideas would be appreciated..
For example:
a) int [x][y][z]
vs
b) int[x*y*z]
Initially thought i'd go with a) for simplicity
I know that Java doesn't store arrays linearly in memory like C does. But what implications does this have for my program?
I have no experience with MongoDB and we are trying to port a JPA application to be based on MongoDB. There are 3 drivers mentioned for porting java here. Which driver would be the easiest to use for converting my existing JPA application? Would it be morphia, mungbean or daybreak. Would prefer some practical experiences with users who have gone through this path before.
Is there a "best" or more popular database for standalone Java app?
I'm currently writing by hand, but I would like to know what is commonly done, if there is something that is commonly done.
I have a small Java Swing application that I want to rewrite in WPF .NET.
The application uses a JTable with an AbstractTableModel and a custom TableCellRenderer. I use my custom cell renderer to display the objects in two rows.
What is the corresponding WPF .NET component to JTable?
in java what is the syntax for commenting out multiple lines?
i want to do something like:
(comment)
LINES I WANT COMMENTED
LINES I WANT COMMENTED
LINES I WANT COMMENTED
(/comment)
This is sort of the Java analogue of this question about C#.
Suppose I have a String object which I want to represent in code and I want to produce a string literal that maps to the same thing.
I was just about to write a state machine that ingests the string character by character and escapes appropriately, but then I wondered if there was a better way, or a library that provides a function to do this.
I need a Java code that takes tab delimited info from a file to a displayed table. The user should be able to click a row and update it, this is followed by updating the file. The code should use Swing objects.
Java Servlets - How do I detect if a user is from a mobile device?
I'm using the TinyMCE javascript editor, and it doesn't work on the iphone. How can I detect if the user is coming from a mobile device?
I'm relatively new to Java coding, and was looking for some help. I have a capital letter defined in a variable string, and I want to output the next and previous letters in the alphabet. For example, if the variable was equal to C, I would want to output B and D.
Thanks in advance for any help.
Hi,
I am doing a project in which i require btree or b+tree data structure. but its not an important part of project. it would take my time to write a code for it. I googled it but didn't get anything....
So, can anyone provide java code for btree or b+tree implementation (with insert, delete, search algorithms)??????
it should accept string as input and form btree or b+tree of these string.
Say I have the following piece of java code
ArrayList<Double> myList = new Double[100];
for (Double x : myList)
x = randomDouble();
Does this actually modify myList or just the dummy variable?
I realize I should just try this code segment out, but I think this is the sort of thing I should be able to google or search for on this site, and several queries so far have turned up nothing useful.
How and where do you define your own Exception hierarchy in Java?
My main question concerns package location where they your Exception classes must be defined.
Do we create a special package ourexceptions and put all classes inside it?
Maybe the title might be better, if someone knows a better one, please edit.
I've seen in many Java code notation that after a method we call another, here is an example.
Toast.makeText(text).setGravity(Gravity.TOP, 0, 0).setView(layout).show();
As you see after calling makeText on the return we call setGravity and so far.
How can I do this with my own classes? Do I have to do anything special?
Do any exist? Ideally it would also come with a library of basic PHP functions.
I have a bunch of simple PHP scripts (no extensions, no fancy dynamic hacks, etc) I'd like to convert to Java... It would be great if a tool could do 80% of the work while I do the other 20%.