Dieter Merlin

Greenhorn
+ Follow
since Oct 25, 2005
Merit badge: grant badges
For More
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 Dieter Merlin

sorry, its just because we do it from a servlet in a jboss container that I thought it should be there, that it could have a meaning to it
16 years ago
Hi,

I have some code to create thumbnails of pictures anddisplay them on a site.
The problem is that we run into an outofmemoryerror every 2 weeks or so. (heap size = 512mb)

The average picture size is +- 1 MB

Here is the current code;





I know that the ImageIcon(byte[] data).getImage() holds a reference to the data but using Toolkit.createImage fails to work (black image)
and using ImageIO.read() doesnt help with the OOM either.

Avoiding the BAOS and writing the thumb directly to the ServletOutputStream causes 100% cpu usage and prevents the picture to be loaded.

I'm a little desperate on this since I cant find anything usefull that would help.

Thanks in advance
16 years ago
indeed. The way I validate user input is in this way:



Messages.java

18 years ago
Thank you very much
this works great!
And yes, I was planning to use the JTabbedPane in my program, but it was intended for one of the inner JPanels, and I had to keep things a bit user-friendly
18 years ago
I have a problem when trying to switch to a different JPanel when you press another button on a toolbar.

The panel does not show up until I resize the window or let a JTextArea appear instead of a JPanel.
More specifically: the btnStakes currently places a JTextArea in BorderLayout.CENTER, wich works right away.
The btnContacts places my own JPanel in the center but when I press that button before I do anything else, nothign comes up.
If I resize my screen, or press the btnStakes first and then the btnContacts button, the panel does show up.
Does anyone know a good way of dynammically adding/removing panels to a layout with proper refreshing/redrawing?

I currently have the following code:
My panel:


The main screen where the toolbar and the panel should come:
18 years ago
Wel, I got a lot of things working with it, but for some reason, it refuses to get the information from files or directories with a space in between.

The following command :
ls -l "/some/dir/AC Seven Yearmix 2004.mp3"
would provide me hte proper info, as the quotes take care of the spaces.
If I try to implement this in the Runtime.exec() I get nothing.
Runtime.getRuntime().exec( "ls -l \"/some/dir/AC Seven Yearmix 2004.mp3\"" ).getImputStream();

gives an empty string after reading all its bytes.
Reason: for some unknown reason, the exec method considers Seven, Yearmix etc as other arguments and as such the command of course cannot find the file

if there some way to escape a space or to replace it with some ascii character to make sure it is preserved as one string?

edit: found it.
if I do a myFile.getName().replace(' ', (char) Character.DIRECTIONALITY_WHITESPACE)

it is fixed
[ October 28, 2005: Message edited by: Dieter Merlin ]
18 years ago
aah
thanks, i got it working now.

this is perfect, now I can get the info line per line
18 years ago
hmm, and there are no frameworks available to somehow listen on those Runtime.exec() calls to get their output ?
Qt (c++) has such implementation but I have no knowledge of that in Java

I also looked at commons-io but that didnt have what I needed, sadly
[ October 25, 2005: Message edited by: Dieter Merlin ]
18 years ago
What I basically want, is to find out wheter the owner, group and others have read, write and exec permissions on a file as well as the owner/group of that file (or directory).

So far I do not know if there is any way to do so in Java, so if there isnt, is there a way then to get the result of an execution of ls -l as a String ?
18 years ago