We have a kerberos domain at my company and I'm running a few of the Java/Kerberos examples. The question I have is around the login mechanism from the server's perspective. When running the server example GssServer.java, I need to get a javax.security.auth.Subject; in the supplied code this is via a LoginContext thus:
// Create a Login...
I know Date is mostly deprecated, but I still use it form time to time (less code than using Calendar). I came across a truly bizarre bug, and I'm wondering if anyone can explain this to me.
This code, which adds 24 days to the current time:
long nowL = System.currentTimeMillis();
Date now = new Date(nowL);
System.out.println("now = "+...
Real simple question really. I need to read a Unicode text file in a Java program.
I am used to using plain ASCII text with a BufferedReader FileReader combo which is obviously not working :(
I know that I can read a String in the 'traditional' way using a Buffered Reader and then convert it using something like:
temp = new String(tem...
I've noticed that on all the examples that illustrate the decorator pattern, there is a base class/interface and there is a decorator class that inherits/implements it, after which, all the decorated classes extend the decorator class. Something along the following lines :
Interface Window > WindowDecorator > WindowDecorator > VerticalS...
Say I have a very simple XML with an empty tag 'B':
<Root>
<A>foo</A>
<B></B>
<C>bar</C>
</Root>
I'm currently using XSLT to remove a few tags, like 'C' for example:
<?xml version="1.0" ?>
<xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:outpu...
I have this method signature:
public int nrOfEntities(Class<? extends MailConfirmation> clazz, User user, String email)
I would like nrOfEntities to return the number of entities that:
Are of the concrete class clazz
Have a matching User if user != null
Have a matching email if user == null
It's the class matching I'm having a pro...
Hi All,
I'm fairly new to the C programming language but I know that it is not standardized in the same way as Java.
When performing a comparisson of the runtime of a algorithm, to keep the analysis fair, I need to call a method similar to Java's Array.sort(int []).
void qsort(void *base, size_t nmemb, size_t size, int (*compar)(cons...
I would like to add a color picker dialog to my app that remembers recently selected colors, so that it's easy to pick the exact same color as before, instead of getting several slight variations of a color.
I've tried but I couldn't do this with the standarard JColorChooser. JColorChooser has a recent-color panel in some look&feels (mo...
I'm attempting to write a junit test to guard against a piece of code getting stuck in a endless iteration which will eventually cause a StackOverflow.
so i'm looking for a way to decrease the stack size at runtime so the Junittest will fail faster.
setting the max stack as a jvm argument is not possible because the test is part of a m...
I have an eclipse plugin, which connects to a COM component using Jacob. But after I close the plugin entirely, the .exe file stays hanging in Windows processes.
I use ComThread.InitMTA(true) for initialization and make sure that SafeRelease() is called for every COM object I created before closing the app and I call ComThread.Release()...
Using the iText PDF library, is it possible to freely (like "position: absolute" in CSS) insert overlay text or other elements on page, so that it gets rendered on top of all existing elements?
Thanks for all the help and tips in advance.
...
Hey yall, I have a wicket- and also a server-related question:
We built a little server with java (yeah, I know, why re-invent the wheel ... I got that a lot when I asked the question on the wicket-mailing-list) .... so let's just say, it is desperately needed b/c ... ehm ... I still can't think of a good reason, but there's not a lot I...
I want to specify language for the JDBC connection before it is actually created.
For example if I specify wrong L/P credentials in
DriverManager.getConnection(url, user, password)
I need to get ORA error localized to the language I selected. I use Oracle thin client and setting NLS_LANG environmental variable did not work. :-(
...
I need to build a jar file that includes (other, external projects') Maven artefacts.
The artefacts are to be included just like stuff in src/main/resources, without any processing. Even though they happen to be jar files themselves, they are not compile time dependencies for my code and should not be added to the classpath, at neither ...
Starting from an XML with a default namespace:
<Root>
<A>foo</A>
<B></B>
<C>bar</C>
</Root>
I apply an XSLT to remove the 'C' element:
<?xml version="1.0" ?>
<xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" enc...
As a programmer I think of these as looking like "the java.lang.Object at address 1a234552" or similar for something like the s in
Object s = "hello";
Is this correct? Therefore are all references a fixed size?
...
I have two threads in Java.
First thread is closing a bufferedreader (br.close())
When the second thread does a read on the same reader I get an IOException (Stream Closed)
I get this exception even if I use br.ready()
Is there a way to know if the stream is already closed?
...
Is it possible to set a default working directory in Eclipse 3.4.1? By Default that is:
${workspace_loc:(project name)}
But I want it to be something like
${custom_var}
Per class, I can change the Run configuration -> arguments -> Working directory to "Other", but it's better if the default can be changed. I have a lot of classes tha...
I'm looking for a plugin similar to the Eclipse plugins Veloeclipse or Velocity Web Edit for NetBeans.
Update: I tried the Velocity Editor Support plugin mentioned by Kathy Van Stone (thanks!), but it's not quite as robust as I had hoped. It doesn't support code folding, directive tag matching, or code completion, as far as I can tell....
Can you use XMLCatalog to resolve xsds in schema import statements? If so, what is the preferred/best practice? I want to package the xsds in a jar, so using a relative schemaLocation has not worked.
So far I am trying to do something like:
SchemaFactory factory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)...