Richard Gray

Greenhorn
+ Follow
since Aug 08, 2008
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 Richard Gray

Is there any utility out there that can scan the source directory as well as the lib directory to determine which jar files are unused and can be removed from the lib directory?

We inherited code and seems like there is way too much jar files and some may not even be needed.
12 years ago
Is it possible to set a managed property in a faces-config.xml from a .properties file like:

<managed-property>
<property-name>dbName</property-name>
<value>prop.getProperty("database.name")</value>
</managed-property>
13 years ago
JSF
I am using Netbean 6.9.1 and have a workspace defined as Free Form. How do I change this project to a Java Project?
13 years ago
quick question on packaging a war file that utilizes hibernate with JPA. How do we package a war file containing these?
Does it just go in meta-inf/persistence.xml or does it go elsewhere?

myapp.war
- meta-inf/persistence.xml
- web-inf/.....

I would like to know what is an industry accepted way, like a standard so I develop something that is acceptable.




Does anyone have any ideas on generating a video file such as AVI or MPEG from a set of sequenced images? Perhaps using the Java Media Framework API?
14 years ago
both inside the security-role and auth-constraint.
14 years ago
Is defining in a web.xml <role-name>*</role-name> legal? or do you need to literally specify a name like <role-name>USER</role-name>
14 years ago
I'm using Glassfish v3 and set up a jdbc realm. I know the realm is autheticating the user successfully but won't let me access the resource. I get the error message:

HTTP Status 403 - Access to the requested resource has been denied

How is the group-table used in glassfish? Is group the same as roles in Tomcat?

Any help on this will be greatly appreciated.
14 years ago
Are there any SDKs out there for Java that allows you to generate an H.264/MPEg4 video from a set of sequenced images?

Such as having a sequenced set of bmp images and then roll it into a video that is compliant to H.264/MPEG4.
15 years ago
I have a file containing serialized objects containing a byte[] representing a JPEG image.

What I need to do is read through the file via ObjectInputStream to deserialize the object so that I can get the byte[] and then convert it to BufferedImage.

The reason for doing this is due to the fact the a BufferedImage is not serializable so the JPEG image is serialized as byte[].

The reason for serializing the JPEG images into objects via OjectOutputStream is so that I can store some metadata for a particular frame and then display it as I am playing the sequence of images. (movie)

The issue is converting a byte[] to BufferedImage costs time to process. For example: a 5000 by 5000 JPG image in byte[] to BufferedImage takes 0.3 seconds. This will results in a 2 frame by second play back. if I want to play it as 10 frames per second, I would need to get the byte[] to BufferedImage conversion down to at a minimum 0.1 seconds.

If I was to process this at first or through some Thread, then I would need to store all of these processed images (BufferedImage) into memory. This would result in a JVM memory leak (OutOfMemory).

The next option where I am stuck on is caching these BufferedImages. (approx 50,000 frames at 200k per frames)

Is the a optimal caching soltion of these BufferedImages or is there a more optimal approach to serializing an object containing memtadata and byte[] (JPG image) and then streaming then as we read the file with a byte[] to BufferedImage conversion?

I am in need for some guidance or advice.
15 years ago
I am writing an application that serializes images into an Object as a byte array since the Image is not serializable.

I am dealing with images that is 7000 by 7000. So at I/O processing of deserializing the object from byte[] to BufferedImage, there is a slight delay in processing time. (0.3 seconds).

BufferedImage bimg = ImageIO.read(byteArray);


My question is: Is there a way to process that byte[] to BufferedImage in say 0.1 seconds?


Once the byte[] is in BufferedImage, dealing with the images itself takes no time at all, just the conversion from byte[] to BufferedImage.

Perhaps there's a way to store Image into a serialized object and deserialize it without having to deal with conversions from byte[] to BufferedImage.

I tried overriding the readObject and writeObject when serializing/deserializing and the delay of 0.3 seconds still exists.

That's why I'm making a callout to see if there's an alternative.
15 years ago
Ok, if we scrap using the ObjectOutputStream/ObjectInputSTream due to limitaions and buffering problems, and unexpected buffering issues with MappedByteBuffer, and go with using ZipOutputStream or DataOutputStream using byte arrays, that would mean we would need to convert an Object to a byte array using BufferedOutputStreams.

Then the question of reading the bytes from the file, how do we know how much bytes to read from the file to retrive the object?

As you can see, I am new to Java and have been using the APIs that Java has provided for these kinds of scenarios so I have stuck with using the ObjectOutputStreams since Java will return back the objects using readObject and write using writeObject. This makes it very intuitive.

When we need to read a number of bytes then having to form that back into an object is where I am starting to get confused and anxious.

Is there not a way in Java to serialize large amounts of Objects into a file without effecting heap? I thought this is why NIO comes into play.

15 years ago
I am new to Java and have been trying to serialize objects to a file using ObjectInputStream and ObjectOutputStream. As a requirement, I am adding image files about 1MB as byte[] since an Image is not serializable. Once I deserialize the byte[], I convert it to BufferedImage so that I can process it such as subimages and so forth. I am attempting to serialize many objects into one file. (greater than 2 GB)

The issues that I am running into is that when I get to 1024MB, I get a OutOfMemory exception. I got the exception earlier and I increased the heap sisze -Xmx1024m.

I know this is not the way to go because I will always run into the OutOf Memory exception.

Now with Java NIO, I am thinking that I can use a memory mapped file using Channels and MappedByteBuffer.

The question is:

How do I serialize my objects into a file using this method to perform a write and a read. I am assuming that I would have to use the ObjectInputStream and ObjectOutputStream with the Channels and ByteBuffer but not sure where to begin.

I would like to use the Java NIO because it utilizes the Operating System for I/O rather than filling up my JVM Heap which results in OutOfMemory.

Could someone please give me guidance into how I can go about doing this?

I exhaustively search various forums and Googled it and could not find a soultion that makes sense to me.
15 years ago