I'm looking at the possibility of generating Java byte code at run time (hopefully directly in memory rather than via class files, though I imagine that won't make a difference to my question).
I understand this can be done, the question is, does the garbage collector sweep up no-longer-used code? I remember some years ago seeing it cla...
I want to implement logging of all executed statements with actual bind parameters when using Oracle JDBC. And I would prefer that I could create such logging method only passing PreparedStatement object as parameter.
For example I have created PreparedStatement and have bound one parameter
PreparedStatement ps = conn.prepareStatement(...
I using the Samba to implement the Window AUthentication. On my web.xml i put this
<filter>
<filter-name>NtlmHttpFilter</filter-name>
<filter-class>jcifs.http.NtlmHttpFilter</filter-class>
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>192.168.1.101</param-value>
</init-param>
<!--
always n...
I added a custom user field in Liferay, and set a value on a specific user.
How can I access this value programmatically?
If I try this, I always get null:
String customAttr = (String)user.getExpandoBridge().getAttribute("customAttr");
user.getExpandoBridge().getAttribute("customAttr") returns a value of Type java.IO.Serializable.
...
I have a bunch of configuration files which are usually properties files which are opened from application and edited like notepad.Now the requirement is pick each property and find which HTML tag does it fit through and display the whole properties file as HTML page.
For eg:
Security.Properties file
//This property checks if the user...
I am interested in creating a Silverlight application. One of my requirements is to communicate with peripheral devices connected to the clients. What is the best way to meet this requirement. I would like to stay away from ActiveX and use possibly Java. Writing a Silverlight application using Java to communicate with the client peri...
I have a JTable and many strings are there in the table. I have selected some particular strings out of those and stored them in an array. At some mouseclicked event I want to display that new array of strings in that table in place of older existing strings.
Actually, I am working on a project in which code is already existing and I am...
I'm writing a software component that displays on-the-fly the content of a certain log file. Think of boosted-up tail -f. It should be a part of a bigger GUI.
I was wondering which GUI componenet should I choose to implement the scrollable textarea which should display the log file output.
Three my main requirements are:
Search - let...
I have a Camel Route Definition written in Java DSL like this:
from(myEndpoint)
.throttle(200)
.to(myOtherEndpoint);
This connects my two endpoints using a Throttler which limits the message flow to 200 messages per second.
I'm looking for a way to change the maximumRequestCount / second during runtime.
So I need to somehow get to ...
Hi, I need to convert pdf to byte array and vice versa.
Can any one help me?
This is how I am converting to byte array
public static byte[] convertDocToByteArray(String sourcePath) {
byte[] byteArray=null;
try {
InputStream inputStream = new FileInputStream(sourcePath);
String i...
The system I'm running on is Windows XP, with JRE 1.6.
I do this :
public static void main(String[] args) {
try {
System.out.println(new File("C:\\test a.xml").toURI().toURL());
} catch (Exception e) {
e.printStackTrace();
}
}
and I get that : file:/C:/test%20a.xml
How comes that the given URL has no...
What's the best way to group x amount of items into y amount of groups based on a variable property of each item eg. weight.
Leaving me with y amount of groups each holding the same sum(price) (or close to the same). So the groups are balanced by cumulative weight.
...
I am attempting to create a Java source file which will interface with my Grails application. When a certain action is performed, I want this Java file to execute a program via commandline. I am attempting to do this via the Runtime.getRuntime().exec() command, however I keep getting an error about the Runtime object being undefined. ...
Hello,
I am trying to use a relative path to locate an executable file within a Java class instead of hard-coded lines which worked, but using something like:
final static String directory = "../../../ggla/samples/obj/linux_x86"
fails... what is the proper way of using a relative path in Java?
...
I have a web server application runing with JVM, where i manage the class loader.
My application have an singleton with a cycle timertask. During the redeployment i clean all the references to Class(es).
I look like that my singleton with the timerTask doen't die.
I add a finalize method with print. the finalize method was never call.
An...
I'm trying to find a better way to implement these methods, as over very large sets they take a very long time, any ideas?
import java.util.HashMap;
import java.util.HashSet;
public class Multiset<E> extends HashSet<E> {
private static final long serialVersionUID = -9013417064272046980L;
private HashMap<E, Integer> multiplicit...
When I implement new features using TDD, I often use the shortcut "Shift + Alt + D T" to run only the jUnit test case I am currently working on (and not the whole test suite, which takes a few minutes).
This creates a new Debug Configuration for the current Java source and runs it immediately. Now I would like to run the test with asser...
I am working on this bit of code that checks a line of actionscript 3 code for the existance of a type (MovieClip, Sprite, along with the custom classes defined in the classpath) that is in a collection that is being iterated.
for (String type: typeList) {
if (input.contains(type)) {
// dome something here
}
}
The prob...
TCPPacket TCPobj = new TCPPacket((int)obj.src_port.get(t),(int)obj.dst_port.get(t),
obj.sequence.get(t),obj.ack_num.get(t),obj.urg.get(t),
obj.ack.get(t),obj.psh.get(t), obj.rst.get(t),obj.syn.get(t),
obj.fin.get(t),obj.rs...
I am running a query from my java based web app running in a Websphere container.
This query however, being pretty simple, fails with a weird erorr as follows:
[5/15/09 16:50:33:828 IST] 0000001e SystemErr R com.ibm.db2.jcc.b.zd: Invalid data conversion:Requested conversion would result in a loss of precision of 40000
[5/15/09 16:...