Ivan Bosnjak

Greenhorn
+ Follow
since Jun 08, 2007
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 Ivan Bosnjak

Hi all!

I have a peace of code that reads a tiff image that goes something like this:



After I read my picture I would like to know which compression is used for this picture, LZW, G4, packbits...

I read about TIFFEncodeParam here:

http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/com/sun/media/jai/codec/TIFFEncodeParam.html

But I still can't figure out how to find the used compression. I would appreciate any help. Thanks in advance!
15 years ago
I managed to show images from a tree to a split panel, using JAI, and scale it with the next code:



But I would still like to know what is the easiest way to enable dragging this image (instead of scrolling) and zooming into an image, so any help on those issues would be much appreciated.
16 years ago
Hi all!

I'm having trouble displaying an image. I'm using a split pane, on the left side i have a tree with image names and paths to each image and on the right I would like to display the selected image from a tree in a JPanel. This is where I handle tree selection:



The function "showImage" should just put the image, defined with it's path (image.imagePath) and stored locally, on the left JPanel. I tried everything to show this image using Image, ImageIcon, BufferedImage, JAI and God knows what else but with none success. All imaegs are in TIF format. It would be useful if the shown image would be scaled to fit the panel and zoom controlls, using buttons, would also be very helpful.

Thanks in advance for all your help! Cheers
16 years ago

Originally posted by Rob Prime:
1) You are adding the exact same instance of the string array to the set. Because it is a set, there will always be only one element.
2) See Ernest's comment; this also solves issue 1.
3) You can use Arrays.toString(...) to nicely print an array.




Ok, I was in a hurry yesterday so I'll try to explain my problem again.

I'm trying to read some data from text files(no problems with this), specifically first name and last name. I want to put this data in a sort of collection that cannot contain duplicates, and that's why I chose hashSet. So if I come across a same first name and last name more than once I don't want it to be added in the collection. Afterwards I need to print this data.
Can you give me a simple solution to do this?

Thanks!
16 years ago
Hi! I'm having trouble reading a hashSet I created. This is the way it is defined and used:




after that I would like to print this data and I'm trying with this code:



And of course it doesn0t work, I get something like:

[Ljava.lang.String;@87c268,

How do I print my hashSet?

Thanks in advance!
16 years ago

Originally posted by Ivan Bosnjak:

Still doesn't work...[/QB]



...and it works now

I copied the three files (msbase.jar, mssqlserver.jar and msutil.jar) in a folder C:\Program Files\Java\jre1.6.0_02\lib\ext

Does that mean my program won't work if I install a new version of jre?

Thanks for the help

Originally posted by Paul Sturrock:

So you don't have the Microsoft JDBC driver in your application's classpath. Make sure you have the driver jar files in your classpath and it should work fine.



I set the classpath (Win XP) in Start/Control Panel/System/Advanced/Environment Variables/ as system variables and user variables in this way:

.;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar

Still doesn't work...
This is the full error message, I manged to export it to a file.

Originally posted by Paul Sturrock:

There will be more to that message. What else does it contain? Could you post the stack trace?



Ok, just to be sure you understand what I'm saying I'll repeat myself: the program works like a charm in Eclipse and no error are displayed in the console, but nothing happened when I exported and ran the jar file so I added the part of the code where the program catches the exception and displays an error message:



This option pane shows this message: java.lang.ClassNotFoundException:com.microsoft.jdbc.sqlserver.SQLServerDriver

I don't know how to export the stack trace to a file to give you a full description of the error...

Originally posted by Tarun Yadav:
What's the exception that you get? Could you post the stack trace?



After running the jar file I get the message: com.microsoft.jdbc.sqlserver.SQLerverDriver

I added the claspath variable and it still doesn't work, I also registered the driver in a way explained on the mentioned link...



I still don't understnd what's wrong
Hi!

My problem is this: I wrote a small test program that works with jdbc, using Microsoft SQL Server 2000 and Eclipse. The program is very similar to the test code on this page: http://support.microsoft.com/kb/313100 and everything works fine in Eclipse but after exporting the project to a jar file it won't run properly. The problem seems to be with the connection in this part of the code:



To establish a connection with the database I added these external archives to my project: mssqlserver.jar, msutil.jar and msbase.jar.

Thanks for your help!

Cheers

[ September 25, 2007: Message edited by: Ivan Bosnjak ]
[ September 25, 2007: Message edited by: Ivan Bosnjak ]
Hi! I'm using Java Advanced Imaging API to create a multi page tiff files from a bunch of single page tiff files.

For example in one folder there are 80 single tiff images and I would like to create 8 multi tiff files with 10 images each.

Here is another example where I tried putting 5 images (single0.tif ... single4.tif) in one multi tiff file (multi.tif) but of course it doesn't work



If you have any ideas I would really appriciate your help.

Thanks in advance!
16 years ago
Thank you very much Ulf! You saved me a lot of time.

I'm done with the program and it works just like I wanted it.

Thanks again!
16 years ago
Hi! I'm trying to write a program to convert a batch of images in PDF files(1 picture - 1 file) to JPEG. The pictures are cocooned with a "header" and a "footer" and if I just remove them and rename the filename to JPG I get just what I want.

The problem starts with removing these headers and footers.

In my PDF files I have:

...bunch of PDF bytes...stream....bunch of JPG bytes....endstream...more PDF bytes...

So my idea was this:
1. take the first 1000 bytes, convert them to String and find the index of the keyword "stream"

2. take the last 1000 bytes, convert them to String and find the index of the keyword "endstream"

This way I get the beginning and the end of my JPG file so I can use the code JPEG data and put it in my JPG file.

This is some code I started with:



I keep getting an IndexOutOfBoundsException on this line:



and I can't figure out why?

I would also like to know if you think my way of thinking is OK

Cheers
16 years ago