im new to Java and have the following question regarding inner classes:
when implementing a inner class do i need to declare its attributes and methods scope i.e. public, private, protected?
Anyone know how I can use httponly cookies for sessions and cookies on the app engine?
In the javadoc for the Cookie class, http://java.sun.com/javaee/6/docs/api/javax/servlet/http/Cookie.html#setHttpOnly(boolean) ,
there is a setHttpOnly method.
I get a compiler error when trying to use it when developing for app engine though.
The method was introduced in the Servlet 3.0 spec, so its pretty new.
Hi All,
I am using the Java POI package to access the excel files. I have an excel file for which i am updating the cell values. those values are being used in some other sheets (within the same excel file) however, when i open the file, those values don't updated. when i select the cell text and hit enter then all the remaining sheets get the value.
please suggest if I am missing something...
Thanks
ABH
I have a fragment of bytes in a byte[]. The total size of the array is 4 and I want to convert this into a positive long number. For example if the byte array is having four bytes 101, 110, 10, 1 then i want to get the long number represented by binary sequence
00000000 00000000 00000000 00000000 00000101 00000110 00000010 00000001
which equals 84279809
What is the efficient way to do that in Java?
I am working with some code from back in 2003. There is a reference to the following class:
new com.sun.net.ssl.internal.ssl.Provider()
It is causing an error:
Access restriction: The type Provider is not accessible due to restriction on required library /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/jsse.jar
Does anyone have any suggestions for a suitable alternative to using this class?
How to compare dates in between in java? Example:
date1 is 22-02-2010
date2 is 07-04-2010 today
date3 is 25-12-2010
date3 is always greater than date1 and date2 is always today. I forgot the main point, how to verify if today's date is in between date1 and date 3?
I've found that java.lang.Integer implementation of compareTo method looks as follows:
public int compareTo(Integer anotherInteger) {
int thisVal = this.value;
int anotherVal = anotherInteger.value;
return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
}
The question is why use comparison instead of subtraction:
return thisVal - anotherVal;
I'm looking for a well-maintained Java bytecode manipulation library with an intuitive API. There seem to be quite a lot of them out there. Any suggestions on which ones to try?
Hi,
I have a HashMap in Java, the contents of which (as you all probably know) can be accessed by
HashMap.get("keyname");
If a have a HashMap inside another HashMap i.e. a nested HashMap, how would i access the contents? Can i do this like this, inline:
HashMap.get("keyname").get("nestedkeyname");
Thank you.
On Java side, we have a servlet filter that handles authentication. We don't have to change all other servlet or JSPs to add authentication to the page, unless the page needs customized content.
How can we achieve the same on PHP? We don't use any frameworks on PHP.
I would like to write a Java app that counts how long I have been using the keyboard or mouse w/o a break. Are there any built-in classes or 3rd party libraries that can detect global keyboard/mouse use?
Is it possible that we can access memory location in Java directly or indirectly?
If we tries to print a object, it will print hashcode. Does hashcode signify indirectly to memory location?
For two object at different memory location but still their hashcode can varies.
-Abhishek
Hi,
I have rtf file in with I need replace some field values (with word I can do it with mail merge, but I need do this with java). I found iText (2.1.7) source code with can parse rtf files, but I can find hove to manipulate the content of file.
Or maybe there is some better solution for editing rtf?
Hello!
I want to implement eventhandling for my reports via java-classes... where do i have to put the files? And do i need .class-files or .jar-files?
BIRT 2.1.3, RCP - Designer
I have a Java SWT GUI with a multiline Text control. I want to append lines of text to the Text control without affecting the position of the cursor within the text box. In particular, the user should be able to scroll and select text at the top of the Text control while new text lines are appended to the bottom.
Is this possible?
I know Java doesn't allow unsigned types, so I was wondering how it casts an integer to a byte. Say I have an integer a with a value of 255 and I cast the integer to a byte. Is the value represented in the byte 11111111? In other words, is the value treated more as a signed 8 bit integer, or does it just directly copy the last 8 bits of the integer?
Thanks,
helixed
JAXB 1.5 installed under C:\Sun\jwsdp-1.5
J2SE 1.4.2 installed under C:\j2sdk1.4.2_08
copied sample.xsd file to C:\Sun\jwsdp-1.5\jaxb\bin
went to C:\Sun\jwsdp-1.5\jaxb\bin and ran xjc.bat -p com.package sample.xsd
got error message: Unrecognized option: -p
Could not create the Java virtual machine.
Please help me out, thanks a lot
In every benchmark that I found on the web it seems that Ruby is slow, much slower than Java. The Ruby folks just state that it doesn't matter. Could you give me any example that the speed of Ruby on Rails (and the Ruby itself) really doesn't matter?
i want how to code for get only link from string using regex or anyothers.
here the following is java code:
String aas = "window.open("+"\""+"http://www.pageresource.com/jscript/jex5.htm"+"\""+")"+"\n"+"window.open("+"\""+"http://www.pageresource.com/jscript/jex5.htm"+"\""+")";
how to get the link http://www.example.com/jscript/jex5.htm
thanks and advance
Hi, I'm using the Scanner class in java to go through a a text file and extract each sentence. I'm using the setDelimiter method on my Scanner to the regex:
Pattern.compile("[\\w]*[\\.|?|!][\\s]")
This currently seems to work, but it leaves the whitespace at the end of the sentence. Is there an easy way to match the whitespace at the end but not include it in the result?
I realize this is probably an easy question but I've never used regex before so go easy :)
Is there any utility (or sample source code) that truncates HTML (for preview) in Java? I want to do the truncation on the server and not on the client.
I'm using HTMLUnit to parse HTML.
UPDATE:
I want to be able to preview the HTML, so the truncator would maintain the structure while stripping out the elements after the desired output length.
i want how to replace the string in java
example
String a = "adf?sdf";
how can i replace these string..
or
how can i avoid special characters.
thanks and advacne..
Question: IS there and IDE like python's IDLE for other languages? specifically I'd like one for java, but any programing just feels so much nicer with a debug system like IDLE's.