[sanselan] Unable to read jpeg comment field

2011-12-08 Thread Erlend Aakre
I have 2 images, one has almost no metadata (no EXIF), it just has the
JPEG Comment field set (not to be confused with the exif user comment
field).

When I try to read metadata from it:
IImageMetadata meta = Sanselan.getMetadata(file); 
it returns null.

The other picture is a picture from my camera (Canon EOS1000), which has
lots of metadata.

I've set the JPEG comment on this image with exiftool (exiftool
-comment=foo file.jpg), I read the metadata:
IImageMetadata meta = Sanselan.getMetadata(file);

the metadata is a JpegImageMetadata object, I go trough everything in
meta.getItems(), and meta.getExif().getAllField() without finding the
jpeg comment. meta.getPhotoshop() is empty, and meta.getRawImageData()
returns null.

Is there a way to get the JPEG comment with sanselan?

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [sanselan] Unable to read jpeg comment field

2011-12-08 Thread Damjan Jovanovic
On Thu, Dec 8, 2011 at 2:38 PM, Erlend Aakre erlend.aa...@q-free.comwrote:

 I have 2 images, one has almost no metadata (no EXIF), it just has the
 JPEG Comment field set (not to be confused with the exif user comment
 field).

 When I try to read metadata from it:
 IImageMetadata meta = Sanselan.getMetadata(file);
 it returns null.

 The other picture is a picture from my camera (Canon EOS1000), which has
 lots of metadata.

 I've set the JPEG comment on this image with exiftool (exiftool
 -comment=foo file.jpg), I read the metadata:
 IImageMetadata meta = Sanselan.getMetadata(file);

 the metadata is a JpegImageMetadata object, I go trough everything in
 meta.getItems(), and meta.getExif().getAllField() without finding the
 jpeg comment. meta.getPhotoshop() is empty, and meta.getRawImageData()
 returns null.

 Is there a way to get the JPEG comment with sanselan?


I'm checking. If not, I'll make you a patch. Can you email me an image to
test with?

Regards
Damjan


[configuration] Common-configuration is not compatible with apache-lang-3.X

2011-12-08 Thread Ivan Boelle
Hello,

We recently upgraded our apache-common-lang library from 2.4 to 3.
But some classes of apache-common-configuration rely on classes that are
not part of apache-common-lang anymore.
(ConfigurationException depends on NestableException for example)
- http://commons.apache.org/lang/article3_0.html

I can't find any information on that issue, am I the only one in this
situation ?
What can I do ?

Does apache-common-configuration will be modified to be compatible with
apache-common-lang-3 ?

Best regards,

---
Ivan Boelle


Re: [sanselan] Unable to read jpeg comment field

2011-12-08 Thread Erlend Aakre
Here is the program I was using and the file that has metadata.

1test.jpg has only the JPEG Comment (view by using exiftool for
example), when I run the attached ExifTest.java program I get a null
metadata object.

vegas.jpg is from a camera, I get metadata but can not find the comment
(JPEG COM) anywhere in it

Regards
Erlend

 
 I'm checking. If not, I'll make you a patch. Can you email me an image to
 test with?
 
 Regards
 Damjan

import java.io.File;

import javax.swing.JOptionPane;

import org.apache.sanselan.Sanselan;
import org.apache.sanselan.common.IImageMetadata;
import org.apache.sanselan.formats.jpeg.JpegImageMetadata;
import org.apache.sanselan.formats.tiff.TiffField;
import org.apache.sanselan.formats.tiff.TiffImageMetadata;

public class ExifTest {

public static void main(String[] args) {
String filename = ;
if (args.length != 1) {
filename = JOptionPane.showInputDialog(Enter filename);
} else {
filename = args[0];
}
File file = new File(filename);
if (!file.exists() || !file.canRead()) {
System.out.println(File not found or not readable:  + file.getAbsolutePath());
System.exit(0);
}

try {
  
IImageMetadata meta = Sanselan.getMetadata(file);
System.out.println(got metadata =  + meta);

//ImageInfo info = Sanselan.getImageInfo(file);
//System.out.println( info, # of comments =  + info.getComments().size() );
//info.dump();
printMetaData(meta);
} catch (Exception e) {
e.printStackTrace();
}
}



public static void printMetaData(IImageMetadata meta) throws Exception {
if (meta instanceof JpegImageMetadata) {
// write all items
System.out.println(ITEMS:  + meta.getItems().size());
System.out.println(==);
for (Object o : meta.getItems()) {
System.out.println(   item:  + o);
}

// write all exif data
TiffImageMetadata exif = ((JpegImageMetadata) meta).getExif();
System.out.println(\n\n\n\n\n\n\nEXIF:  + exif.getAllFields().size());
for (Object o : exif.getAllFields()) {
TiffField f = (TiffField) o;
System.out.println(+ f.getDescriptionWithoutValue() +  =  + f.getValue());
}
} else if(meta == null) {
System.out.println(META is null);
}
else {
System.out.println(Unsupported image type (not jpeg):  + meta.getClass());
}
}
}
-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Re: [configuration] Common-configuration is not compatible with apache-lang-3.X

2011-12-08 Thread Jörg Schaible
Hi Ivan,

Ivan Boelle wrote:

 Hello,
 
 We recently upgraded our apache-common-lang library from 2.4 to 3.
 But some classes of apache-common-configuration rely on classes that are
 not part of apache-common-lang anymore.

c-lang and c-lang3 are designed to be used side-by-side, since they are 
binary incompatible. You cannot expect that anything using c-lang is 
immediately ported to c-lang3.

 (ConfigurationException depends on NestableException for example)
 - http://commons.apache.org/lang/article3_0.html
 
 I can't find any information on that issue, am I the only one in this
 situation ?
 What can I do ?

Use c-lang for c-configurations. However, nothing prevents you from using c-
lang3 in *your* code.

 Does apache-common-configuration will be modified to be compatible with
 apache-common-lang-3 ?

Development of a version using Java 5 has started some days ago, so may take 
quite some time for it to be finished.

- Jörg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [sanselan] Unable to read jpeg comment field

2011-12-08 Thread Damjan Jovanovic
No, Sanselan didn't have any way to read comments in the last released
version.

But I just committed a patch to SVN trunk (revision 1211882) that supports
reading JPEG comments with:
Sanselan.getImageInfo().getComments()

If you can't check out and compile SVN, let me know and I can email you a
new Sanselan JAR.

Regards
Damjan

On Thu, Dec 8, 2011 at 3:19 PM, Erlend Aakre erlend.aa...@q-free.comwrote:

 Here is the program I was using and the file that has metadata.

 1test.jpg has only the JPEG Comment (view by using exiftool for
 example), when I run the attached ExifTest.java program I get a null
 metadata object.

 vegas.jpg is from a camera, I get metadata but can not find the comment
 (JPEG COM) anywhere in it

 Regards
 Erlend

 
  I'm checking. If not, I'll make you a patch. Can you email me an image to
  test with?
 
  Regards
  Damjan



 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org



Re: [sanselan] Unable to read jpeg comment field

2011-12-08 Thread Erlend Aakre
 If you can't check out and compile SVN, let me know and I can email you a
 new Sanselan JAR.
 
 Regards
 Damjan

I've checked it out from svn, I tried building it with mvn -Prc package,
but that gives the following warning at first:

[WARNING] Some problems were encountered while building the effective
model for org.apache.commons:commons-sanselan:jar:0.98-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-idea-plugin is missing. @
org.apache.commons:commons-parent:17, 
/home/erlend/.m2/repository/org/apache/commons/commons-parent/17/commons-parent-17.pom,
 line 317, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.

and the following tests fail:
Failed tests: 
testInsert(org.apache.sanselan.formats.jpeg.exif.ExifRewriteTest)
testRewriteLossy(org.apache.sanselan.formats.jpeg.exif.ExifRewriteTest)
testRewriteLossless(org.apache.sanselan.formats.jpeg.exif.ExifRewriteTest)


Mvn -version:
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: /home/erlend/apache-maven-3.0.3
Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
Java home: /home/erlend/jdk1.6.0_21/jre
Default locale: en_US, platform encoding: UTF-8
OS name: linux, version: 2.6.32-34-generic-pae, arch: i386,
family: unix

No .jar files are generated in the target directory

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [dbcp] Handling many different user accounts over time

2011-12-08 Thread William Speirs
On Wed, Dec 7, 2011 at 11:27 AM, Cameron, Scott scott.came...@sap.com wrote:
 Hi,

 I'm considering using either SharedPoolDataSource or PerUserPoolDataSource to 
 do some connection pooling but I've noticed that there doesn't seem to be any 
 way to configure an upper bound on the total number of connections in the 
 pool across all users.

What do you mean, across all users? Do you have different connection
strings (user/pass) for each person who connects to your database?

 For example, say I have 5,000 named users in my database.  Any of the 5,000 
 can come in to request a DB connection at any time, but likely no more than, 
 say, 100 of them will ever be active at a particular point in time.  If I 
 want to allow 3 connections per user, how do I ensure that I'm not eventually 
 going to end up with 15,000 open connection over time.

 It looks like the maxTotal setting on the GenericObjectPool (and 
 GenericKeyedObjectPool) can be used to control this such that when this 
 absolute upper bound is reached on the pool the least recently used 15% of 
 connections will be recycled.  But neither SharedPoolDataSource nor 
 PerUserPoolDataSource expose any way to configure maxTotal.

 Is there another recommended way to solve this problem?  What do high-traffic 
 web containers like Tomcat or JBoss do to deal with this scenario (if they do 
 deal with it)?

Do I understand correctly, if I show up to your site as user wspeirs,
then I'm connecting to your database as wspeirs? If so, then why
wouldn't you simply create a connection for that user and store it in
the user's session? When the session is destroyed, you close the
connection. There is a bit more start-up time in creating the
connection when they first show up, but it'll be live and active
during the rest of the time they are there.

That work for you?

Bill-

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: [dbcp] Handling many different user accounts over time

2011-12-08 Thread Cameron, Scott

 What do you mean, across all users? Do you have different connection
 strings (user/pass) for each person who connects to your database?

It's a slightly mixed bag as the app is multi-tenanted.  We have some 
connection strings used by nearly everybody for certain things.  Some 
connection strings are assigned to an organization and will be used 
by all users in that org.  And some connection strings are unique for 
each individual user.

 Do I understand correctly, if I show up to your site as user wspeirs,
 then I'm connecting to your database as wspeirs? If so, then why
 wouldn't you simply create a connection for that user and store it in
 the user's session? When the session is destroyed, you close the
 connection. There is a bit more start-up time in creating the
 connection when they first show up, but it'll be live and active
 during the rest of the time they are there.

Even if the connections weren't sometimes shared across users, the 
component that manages connections doesn't have any knowledge of 
application-level concepts like session. It's job is just to manage
connections, which can potentially have a different lifecycle than
session.

We're thinking that maybe we can rely on maxIdle to evict unused
connections.  The downside to this is that the default minimum
idle time before eviction is 30 minutes and can't be configured. But
maybe that will be OK.

It would be nice to have more control over the object pool inside
the pooled data source classes as that seems to be where most of the 
interesting tweakable pooling features live.  But only a very small 
number of options are exposed to data source consumers.

--
scott

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: [dbcp] Handling many different user accounts over time

2011-12-08 Thread William Speirs
If you have specific ideas, open a JIRA ticket and we can look into it.

Bill-
On Dec 8, 2011 5:52 PM, Cameron, Scott scott.came...@sap.com wrote:


  What do you mean, across all users? Do you have different connection
  strings (user/pass) for each person who connects to your database?

 It's a slightly mixed bag as the app is multi-tenanted.  We have some
 connection strings used by nearly everybody for certain things.  Some
 connection strings are assigned to an organization and will be used
 by all users in that org.  And some connection strings are unique for
 each individual user.

  Do I understand correctly, if I show up to your site as user wspeirs,
  then I'm connecting to your database as wspeirs? If so, then why
  wouldn't you simply create a connection for that user and store it in
  the user's session? When the session is destroyed, you close the
  connection. There is a bit more start-up time in creating the
  connection when they first show up, but it'll be live and active
  during the rest of the time they are there.

 Even if the connections weren't sometimes shared across users, the
 component that manages connections doesn't have any knowledge of
 application-level concepts like session. It's job is just to manage
 connections, which can potentially have a different lifecycle than
 session.

 We're thinking that maybe we can rely on maxIdle to evict unused
 connections.  The downside to this is that the default minimum
 idle time before eviction is 30 minutes and can't be configured. But
 maybe that will be OK.

 It would be nice to have more control over the object pool inside
 the pooled data source classes as that seems to be where most of the
 interesting tweakable pooling features live.  But only a very small
 number of options are exposed to data source consumers.

 --
 scott

 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org




RE: [dbcp] Handling many different user accounts over time

2011-12-08 Thread Cameron, Scott

 If you have specific ideas, open a JIRA ticket and we can look into it.

It seems like everything we want to customize to get the behavior we want
is actually at the ObjectPool level.  So I was wondering why not expose
deeper access to that?  It seems like it would provide a lot more flexibility
without necessarily changing the DataSource-specific aspects of the class.
But maybe there are issues with this I'm not thinking about.

I was thinking about posting something to the Developer list asking about
this.  But do you think JIRA is a better avenue?

Thanks for your assistance.

--
scott


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[math] Complex Tanh for big numbers

2011-12-08 Thread Juan Barandiaran
Hi,

In Complex.java the tanh is computed with the following formula:

tanh(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i

The problem that I'm finding is that as soon as a is a big number,
both sinh(2a) and cosh(2a) are infinity and then the method tanh returns in
the real part NaN (infinity/infinity) when it should return 1.0.

Wouldn't it be appropiate to add something as in the FastMath library??:

if (real20.0){
  return createComplex(1.0, 0.0);
}
if (real-20.0){
  return createComplex(-1.0, 0.0);
}


Best regards,

JBB