From the java sources, it look like to drops into native code. Is the cost roughly equivalent to a volatile read or does it need to acquire a lock of some type?
Given: LDAP stores location of users.
How do I drive their timezones using their location? Any pointers are accepted, Java language preferred.
Thanks in advance.
I've just found in my java project this code snippet:
List<IssueType> selectedIssueTypes = new ArrayList<IssueType>();
for (Object item : selectedItems)
selectedIssueTypes.add((IssueType) item);
How do you think, can this style be used?
I have an application which uses UDP connection, now when i try to run the app more than once its throwing me an exception
java.net.BindException: Address already in use: Cannot bind
but in my another app, which uses tcp connection, i can open two instance of the same app and its working fine. why this error only with UDP connection?
Should it be all fields, including super-fields, of a purposively immutable java class 'final' in order to be thread-safe or is it enough to have no modifier methods?
Suppose I have a POJO with non-final fields where all fields are type of some immutable class. This POJO has getters-setters, and a constructor wich sets some initial value. If I extend this POJO with knocking out modifier methods, thus making it immutable, will extension class be thread-safe?
Hello, Im searching for ideas to solve the following problem:
I'm loading an URL (any for that matter) into an iFrame, and then block (server side) all image tags, o object tags before sending the page to the client.
--
What I was thinking to do is: fetching the URL, and then manipulating the fetched content using a Java library (any recomendation on that matter?). And after that, send the modify content to que client.
Would that be the best approach to solve this problem? suggestions are wellcome :)
What regular expression using java could be used to filter out dashes '-' and open close round brackets from a string representing phone numbers...
so that (234) 887-9999 should give 2348879999
and similarly 234-887-9999 should give 2348879999.
Thanks,
The compiler does not consider return
type when differentiating methods, so
you cannot declare two methods with
the same signature even if they have a
different return type.
Java Tutorial
Why is this?
Hello, I'm trying to figure out the right way to read lucene index only once whilst running the application multiple times, how can I do that in java?
Because indexed data will not change so reading them each time would not be necessary. Can someone explain me the logic of it reading them only once? thank you
I'm using generics rather long time but I've never used construction like List<? super T>.
What does it mean? How to use it? How does it look after erasure?
I also wonder: is it something standard in generic programming (template programming?) or it's just a java 'invention'? Does c#, for example, allow similar constructions?
Hiya.
I have an Iterator that I use on a hashmap, and i save and load the iterator.
is there a way to get the previous key in the hashmap with Iterator? (Java.Util.Iterator)
update
I save it as an attribute in a Red5 connection and then load it back to continue working where i stopped.
another update
I'm iteratoring through the keyset of the hashmap
Hiya.
I have an Iterator that I use on a HashMap, and i save and load the iterator.
is there a way to get the previous key in the HashMap with Iterator? (java.util.Iterator)
Update
I save it as an attribute in a Red5 connection and then load it back to continue working where i stopped.
Another update
I'm iteratoring through the keyset of the HashMap
I was wondering if there is a 'smooth way' of redeploying a Java WAR to a production server (no cluster, no OSGi)?
All I can come up with is stop server, update file, restart server. And 10 minutes beforehand I need to display a maintenance warning on the site.
What's your approach?
in java we can do this:
public class A{
public static void main(String...str){
B b = new B();
b.doSomething(this); //How I do this in c++ ? the this self reference
}
}
public class B{
public void doSomething(A a){
//Importat stuff happen here
}
}
How can I do the same but in c++, I mean the self reference of A to use the method in B ?
Consider you have the following class
public class OuterClass {
...
private static class InnerClass {
int foo;
int bar;
}
}
I think I've read somewhere (but not the official Java Tutorial) that if I would declare the static member classes attributes private, the compiler had to generate some sort of accessor methods so that the outer class can actually access the static member class's (which is effectively a package-private top level class) attributes.
Any ideas on that?
Hi
I am trying to compare the performance of Single and Multithreaded Java programs. Are there any single thread benchmarks which are available which I could then use and convert to their multithreaded version and compare the performance. Could anybody guide me as to what kind of programs(not very small) are suitable for this empirical comparison.
Thanks in advance
a difficult one..
using classes of primitive types in java, like Integer, Float, Long, etc, write a code fragment using a method to double the value of a variable passed as an argument
Hi, I hv 3 java web-apps running in jetty and i want one of them to be accessed only through localhost. I dont want to write filter. Can it be done by modifying some jetty configuration?
in an array first we have to find whether a desired number exists in that or not?
if, not then how will i find nearer number to the given desired number in java.
Dear all,
I wan to read a file and then write using java.nio and return it to servlet.i also want to check whether file has been downloaded or not.plz suggest.
MyClass.class and MyClass.getClass() both seem to return a java.lang.Class. Is there a subtle distinction or can they be used interchangeably? Also, is MyClass.class a public property of the superclass Class class? (I know this exists but can't seem to find any mention of it in the javadocs)