Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

David Irwin

Ranch Hand
+ Follow
since Mar 25, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Irwin

All,

I'm currently using DnD to drag items from a JTable and place them in another container. What I'd like to be able to do is now DnD between different JTables that are placed on different tabs of a JTabbedPane. Unfortunately when I try to drag from one table on tab #1 to another table on tab #2 I'm unable to select tab #2 while I'm dragging. I figure there's got to be an easy way to implement this but can't fine anything.

Any ideas?

Thanks,
Dave
11 years ago
I apologize for double-posting...I put the original post in the wrong forum that was seeing relatively little traffic and I haven't seen any response.

I've deployed a stand alone Java application and have enabled JMX using the -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authentication=false -Dcom.sun.management.jmxremote.ssl=false command line options. Right now I can successfully connect to the JVM using JConsole. I'd like, however, to enable username/passwords in order to make monitoring and controlling via JConsole a bit more secure. Per Sun documents it would appear that I need to:

1) Remove the -Dcom.sun.management.jmxremote.authenticate=false system variable (it defaults to true)
2) Rename the <JRE_HOME>/lib/management/jmxremote.password.template to <JRE_HOME>/lib/management/jmxremote.password and verify the <JRE_HOME>/lib/management/jmxremote.access files in order to enable user authentication.
3) Secure both the jmxremote.password and jmxremote.access by removing the suggested Windows permissions.

However, after making these changes and restarting the application I can still connect using JConsole from a remote computer without being required to enter a username/password.

What do I need to do differently?

Thanks,
Dave

Tried using both JDK 1.5.0_14 and JRE 1.6.0_11 on Windows XP.
12 years ago
I've deployed a stand alone Java application and have enabled JMX using the -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authentication=false -Dcom.sun.management.jmxremote.ssl=false command line options. Right now I can successfully connect to the JVM using JConsole. I'd like, however, to enable username/passwords in order to make monitoring and controlling via JConsole a bit more secure. Per Sun documents it would appear that I need to:

1) Remove the -Dcom.sun.management.jmxremote.authenticate=false system variable (it defaults to true)
2) Rename the <JRE_HOME>/lib/management/jmxremote.password.template to <JRE_HOME>/lib/management/jmxremote.password and verify the <JRE_HOME>/lib/management/jmxremote.access files in order to enable user authentication.
3) Secure both the jmxremote.password and jmxremote.access by removing the suggested Windows permissions.

However, after making these changes and restarting the application I can still connect using JConsole from a different computer without being required to enter a username/password.

What do I need to do differently?

Thanks,
Dave

Tried using both JDK 1.5.0_14 and JRE 1.6.0_11 on Windows XP.
12 years ago
All,

I'm using Hibernate/HQL/named queries to retrieve data from a database. In particular I use pagination (i.e. I control the number of results that are returned on any one query) so as not to pull thousands of rows from the database.

Here's the java code I have right now:



What I'd like to be able to do, however, is find out how many total results this query will return independent of the pagination (so I can display something like "Results 31 through 40 of 123" to the end user). I've looked at the Hibernate Query API but don't see anything help. Any ideas?

Thanks,
Dave
All,

I'm trying to create a Hibernate query. Here's my named query that works so far that I define in my mapping file:



What I'm trying to add is the following:
* there's an object in the AlarmInfo class called "level" that I map as a custom Hibernate user type (it implements org.hibernate.usertype.UserType).
* I only want to retrieve an alarmInfo object if it's alarmInfo.level is in a collection of alarm levels.

I tried to do the following:



This, however, doesn't seem to work. I feel like since the "level" is mapped as a Hibernate UserType I should be doing something differently. Any ideas?

Thanks,
Dave

Originally posted by Campbell Ritchie:
You are familiar with the traps in Runtime.exed(), as described in the classic article by Daconta? Please do a search of JavaRanch; there are other threads active at present addressing similar questions.

[ June 27, 2008: Message edited by: Campbell Ritchie ]



Thanks for the reference...I hadn't read the article but for my sake I unfortunately was already doing much of what was suggested in the article.

Does anyone know of an alternative to using Runtime.exec(), such as some third-party library?

Thanks,
Dave
12 years ago
After looking at the Java 1.5 source it turns out that the Runtime.exec() method actually uses the ProcessBuilder class. And I have been unable to get my application to start successfully using the ProcessBuilder class alone.
Since Runtime.exec() actually uses ProcessBuilder internally I don't expect any fix if I were to get the standalone ProcessBuilder approach to work.

Any ideas?

Thanks,
Dave
12 years ago
Doing a little more research I came across the ProcessBuilder class in the Java 1.5 API. When I start VLC using the process builder the CPU usage is near 1% when idle. I'm hoping that this will help solve my problem.

Dave
12 years ago
All,

I have a third-party application (VLC video decoder from http://www.videolan.org) that I start using Java, specifically using the following Java code:



I hold onto the process object so that I can close VLC later on.

When I start VLC using my Java application as shown above, the VLC application consumes 50% of the CPU before even doing anything; it's not even decoding video yet! (note: VLC the application is consuming 50% of the CPU, not my Java application; this per the Windows task manager). If I start VLC just by itself it doesn't consume anything more than 1% of the CPU.

Any reason why this would be so? It's causing a real problem when I actually start decoding video because VLC then consumes nearly 100% of the CPU.

Thanks,
Dave

Java 1.5+ on Windows XP
[ June 25, 2008: Message edited by: David Irwin ]
12 years ago
Nathan,

Thanks for your response. That worked great!

Dave
12 years ago
Thanks Brian for your response.

I did try using the JTable.fireTableCellUpdated(), however I found that this cleared the current row selection in the table which is a problem for me. While as you said it may not be 100% correct, it is working when I call the JTable.repaint() method after each timing event.

Thanks,
Dave
12 years ago
I'm trying to add a component other than a JMenu to a JMenuBar. In particular, I'm adding a label that displays the current date and time. I can add the label fine but it gets added and is located right next to the last JMenu that I added. I'd really like it to be right-justified (while all the JMenus are left-justified). I thought maybe by adding the label via a

call would work but this didn't do anything. Is there any way to force the justification of a component in a JMenuBar?

Thanks,
Dave
12 years ago
All,

I have a JTable and a custom ImageIcon class for one particular column in my table. The custom ImageIcon class is used to overlay and fade in/fade out a small additional image on the background image (think of a small recording icon that fades in and out when recording is taking place for a given row).

Everything works well except for getting the cell to update. If I move my mouse in and out of the cell then the small overlay icon updates, but if I just leave the cell alone it doesn't update.

Here's a snippet of the code that I'm using to update the custom ImageIcon:



I'm using the TimingFramework to actually do the timing. Here's a snippet from the timing target:



I currently don't call a repaint() on the actual JTable after the Alpha component has been updated. Do I need to do this? Are there any other ideas to get the small overlay icon to update automatically?

Thanks,
Dave
12 years ago

Originally posted by Matthew Plant:
Hi,
Am trying to design a simple GUI which is basically a form with labels down one side and various components down the other all nicely aligned.

This seems to be proving really difficult and I'm sure this kind of layout is a common one.
Is there an easy way of arranging components into a simple form?
Maybe someone could point me in the right direction.

Thanks.



I've used the JGoodies Forms layout manager a lot in the past and it works really well, especially for form type layouts. Try it at http://www.jgoodies.com/freeware/forms/index.html.

Dave
12 years ago

Originally posted by Ulf Dittmer:
You're right, it doesn't look good.

There's QT4Java, but that too is no longer being updated.

The FOBS and jffmpeg libraries add a few new formats to JMF.

And there's jVLC (on top of the VLC libraries).

Links to all these are in the http://faq.javaranch.com/java/OtherOpenSourceProjectsFaq



I've actually have quite a bit of experience using VLC and Java and have been quite happy so far. I'm not using jVLC but rather the regular software decoder that you can download from http://www.videolan.org. While the video isn't directly embedded in any type of Swing container, you can control VLC via a remote interface (it supports several). In particular I use the telnet protocol (and the Apache commons-net library) to send commands using Java. Like I said it works pretty well but requires a fair bit of knowledge of VLC to get everything to work correctly.

Thanks,
Dave
12 years ago