I am using Xalan and Java for extending a stylesheet.
(Similar example to what I am doing there : Dictionary example)
I struggle to make my tag do an <xsl:apply-templates/>. I wish to have this :
<xsl:template match="sometag">
<my-java:tag>
<xsl:apply-tempates/>
</my-java:tag>
</xsl:template>
My java class containing...
Is it possible to get the type of a generic parameter?
An example:
public final class voodoo {
public static chill(List<?> aListWithTypeSpiderMan) {
// Here I'd like to get the Class-Object 'SpiderMan'
Class typeOfTheList = ???;
}
public static void main(String... args) {
chill(new List<SpiderMan>(...
I'm new to joda-time and I didn't find anywhere examples to do some simple things.
I want to make an object where to save a time value read from a table in a database (a java.sql.Time - e.g. "18:30:00") I don't care about time zone, so I think that I need LocalDate. But the problem is that I couldn't create a LocalDate object based on t...
import java.sql.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="A0" width=250 height=200>
</applet>
*/
public class A0 extends Applet implements ActionListener,ItemListener
{
String msg="";
Button view,delete,create,edit,reapp,exit;
TextField M_head;
int x,i,ans=0,flag;
public v...
I have a JScrollpane which contains a scrollable client that changes its size dynamically while using the application. I want the JScrollPane to be aware of the changes without moving the viewport when the client size changes.
To clarify what I mean:
Refer to the Java Webstart example ScrollDemo2 from the article How to use scroll panes...
Hi!
Given a javax.swing.table.TableColumn... is it possible in some way to specify the TableCellRenderer/TableCellEditor to be used for a given type rather than having the TableColumn use the same TableCellRenderer/TableCellEditor?
I'm aware that I can specify some DefaultCellEditor/Renderer in the JTable, but this is not what I want.
...
how can i write a query controlled loop that will continue to input int values from the user,adding each to the value sum,and then ask if the user has another value to input,until the user says that there are no more values
...
Hi, I would like to execute JUnit on a remote machine hosting a JVM embedded and linked to a C application through JNI. This JVM has state and access to live external resources and data which of course are not available in my build/test environment. In addition, my test/dev JVM is not linked to the C application and uses mock objects, so...
I'm deleting entities from a table with a one to many relationship to the same entity (representing node hierarchy). If I make the xincoCoreNodeId relationship a cascade all it works but I don't want that in the real application. I don't want removing a leaf removing its parent. Is there a way to modify this relationship at run time or d...
I believed the String pool abandoned local Strings when their methods completed
Yet:
public class TestPool implements Runnable{
/**
* @param args the command line arguments
*/
public void run() {
String str= "hello";
synchronized(str){
try {
System.out.print(Thread.current...
Setup
I'm packaging a WAR with a number of legacy jar dependencies in it (for the sake of keeping this simple, they can not possibly be altered or excluded from the deployed WAR).
Issue
Including either or both of two of these jars will cause inexorable errors at test-time. If I exclude the dependencies altogether, the tests pass happil...
I'm trying to figure out if the code below suffers from any potential concurrency issues. Specifically, the issue of visibility related to volatile variables. Volatile is defined as: The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"
public static void main(String [] ar...
how can i rewrite the following method using try and catch statements instead of the throws clause in the method header:
public String getInput(String filename) throws Exception
{
BufferedReader infile = new BufferedReader (new FileReader(filename));
String response = infile.readLine();
infile.close();
return response:
...
My project requires me to convert DITA to nroff, but the toolkit I'm using (DITA Open Toolkit) only converts to troff.
Are there any toolkits (preferably java, but any language will do) that can convert from troff to nroff? I'm not even sure of what the difference is, but from some googleing they appear to be very closely related.
...
Hoping someone can shed some light on this.
I have a PHP program which opens a port and sends some text to a java program listening on that port. Basically, there could be many instances of this PHP program connecting over this port to this one java program. The java program contacts an API, retrieves the answer, and then sends the ...
I have a class structure where I would like some methods in a base class to be accessible from classes derived directly from the base class, but not classes derived from derived classes. According to the Java Language specification it is possible to override access specifications on inherited methods to make them more public, but not mo...
The following thread is made to run unpredictably. Sometimes it may print ABC and others 123. I don't get why it's able to print ABC. Please explain its flow of execution.
public class ArrayDeclaration implements Runnable {
String [] s;
public ArrayDeclaration (String []s){
this.s=s;
}
public void run() {
...
Hello all,
I have converted the following applet tags to object tags so that it can work. But for some reason the below isn't working. Firstly, Is the below a correct conversion that should work?
Applet:
document.writeln('<applet');
document.writeln(' code="LittleShootApplet"');
document.writeln(' id="LittleShootApplet" name="Littl...
Hi there!
Based on ideas presented in link I implemented several different "sleep methods". One of this methods was the "binary sleep", which looks like this:
while (System.currentTimeMillis() < nextTimeStamp)
{
sleepTime -= (sleepTime / 2);
sleep(sleepTime);
}
Because the check if the next time step is already reached takes place at...
Recently I have needed to use RMI, and I know enough for what I need to do, but one thing is intriguing me as I revisit this topic. Is it possible to make asynchronous RMI calls to the same service on the server?
Let's say I have n threads on the client and a single server-side object--call it S. S has a single method that I want to ca...