How can I get client side information using either Javascript or Java Servlets?
Client side information such as client's computer name, its IP Address etc.
Thanks in advance.
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.?
In Python, I can do this:
>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
Is there any way to do something similar in Clojure (apart from copying and pasting the above characters somewhere)? I looked through both the Clojure standard library and the java standard library and couldn't find it.
I'm trying to encourage a best practice of not catching general exceptions in Java code. eg:
try {
...
} catch (Exception e) { // bad!
...
}
Is there a way to flag this as an error/warning in Eclipse?
I know PMD picks this up, but I'd rather avoid integrating it into everyone's build environment at the moment.
Dear All,
I am new to MySql database. I've large table(ID,...). I select ID frequently with java code and.And that make a heavy load on transaction
select from tableName where ID=someID
notes:
1.Database could be 100,000 records
2.I can't cache result
3.ID is a primary key
4.I try to optimize time needed to return result from query.
Any ideas for optimization ?
thanks in advance
Are they same ?
Came across this line when reading about Java's main method's signature
"String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings."
Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.
If letter case was unimportant I would do this:
str.toLowerCase().replaceAll ("a|the|of|some|any", "");
Is there an "ignore case" solution with regular expressions in java?
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?
If I have the following table schema to log an exception (in standard SQL schema):
Table: ExceptionLog
Columns: ID (Long),
ExceptionClass (String),
ExceptionMessage (String),
Host (String),
Port (Integer),
HttpHeader (String),
HttpPostBody (String),
HttpMethod (String)
How would I design the same thing in HyperTable (specifically, what is the best approach for efficiency)? And, how would I code it using the HyperTable Java client?
I'm trying to figure out how to enforce a 5 minute per post/action rule.
I'm developing a web application with Wicket in Java and I've got a session class which I was planning on using to keep track of these timers on a per-user basis. I wasn't planning on storing the timestamp in a database.
public boolean isAllowedToPost() {
if(null OR has 5 minutes passed since last post) {
// set the new timestamp
return true;
}
else
{
return false;
}
}
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.
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!!
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.
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
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.
Sorry I dont know the correct terminology to use but I have a 3x3 matrix like this
1 3 4
5 4 5
2 2 5
and I want get the highest score by picking a value from each row/column but I cant pick the same row or column more than once , so the answer in this case is
3 + 5 + 5 = 13 (row0,col1 + row1,col0 + row2,col2)
4 + 5 + 5 = 14 is not allowed because would have picked two values from col2
I'm using Java, and typically the matrix would be 15 by 15 in size.
Is there a name for what Im trying to do, and whats the algorithm
thanks Paul
Why are the methods contains() and indexOf() in the Java collections framework defined using o.equals(e) and not e.equals(o) (where o is the argument of the methods and e is the element in the collection)?
Anyone know the reasons of that?
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.
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?
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?