I have some cookies stored in http://sub1.myserver.com and I want to be able to see them in http://myserver.com Answer I was able to do it using the following code:
Tag: java
Java conditional compilation: how to prevent code chunks from being compiled?
My project requires Java 1.6 for compilation and running. Now I have a requirement to make it working with Java 1.5 (from the marketing side). I want to replace method body (return type and arguments remain the same) to make it compiling with Java 1.5 without errors. Details: I have an utility class called OS…
Checking if a date exists or not in Java
Is there any predefined class in Java such that, if I pass it a date it should return if it is a valid date or not? For example if I pass it 31st of February of some year, then it should return false, and if the date exists then it should return me true, for any date of any year.
Does Java IO have a maximum file name length limit?
Different operating systems have different file name max lengths. Does Java have any limit on file name length when working with files? Answer Java has no maximum file name length, except obviously for the String max length limit (which is the array max length, i.e. Integer.MAX_VALUE). Maybe some JVMs have a …
how to start stop tomcat server using CMD?
I set the path for the tomcat and set all variables like JAVA_HOME=C:Program Files (x86)Javajdk1.6.0_22 CATALINA_HOME=G:springworkserverapache-tomcat-6.0.29 CLASSPATH=G:springworkserverapache-tomcat-6.0.29libservlet-api.jar;G:springworkserverapache-tomcat-6.0.29libjsp-api.jar;.; When I go to bin folder and do…
when is a spring bean instantiated
In the above, when are the beans instantiated, when the ApplicationContext is created or when the getBean() is called? Answer Assuming the bean is a singleton, and isn’t configured for lazy initialisation, then it’s created when the context is started up. getBean() just fishes it out. Lazy-init be…
how to call getResouces() in a class that is not extended Activity?
I would like to call getResouces in some classes, however, these classes are not extended to Activity. How to do it in a right way? Answer You can pass in a pointer to your activity from which you should call getApplicationContext(). In certain cases you would want to use the regular getContext().
How can I add JAR files to the web-inf/lib folder in Eclipse?
I’m using Eclipse and I need to be able to add Java libraries (JAR files) into my web application’s WEB-INF/lib folder. How do I achieve this? Answer Add the jar file to your WEB-INF/lib folder. Right-click your project in Eclipse, and go to “Build Path > Configure Build Path” Add t…
How do I remove some characters from my String
i want to remove all of the following chars from my string “>[],-” at the moment im doing this. but there must be a more efficient way newString = myString.replace(“>”,””).replace(“[“,””)….
Ultra-fast “Begins With” Query from Disk
I have a 40MB (too big for memory in this case) list of strings that I want to do “begins with” queries on to extract matches. Anyone know of a good data structure for this? Bonus points for an existing os java implementation. I would be willing to sacrifice “begins with” to just exact…