Re: Multi-Tenant Data Architecture

2009-09-23 Thread Cheong Hee (Gmail)
I read with great interest as I encountere the same situation some time ago. 
In practice (at least in my case), it worked to have the app run on separate 
EOF stacks accessing different database.  So , it simplified the case to 
only have one instance in JavaMonitor for multi databases.  However, it is 
not the preferred way due to the following same reason..



That is our main concern. Today we have 20 instances, but this
number is likely to increase considerably in near future.


If it grows to 40, are you planning on having each instance host all
40?  I'd look into EOF stack size if you are thinking of having 40 in
one JVM and there is a significant amount of data per tenant.  That
might work out to a lot of RAM per instance and so few instances per
machine.  It is just something to keep in mind.


Shared this too and Chuck has a good point.  So I opted to redisign and put 
all into single database.




The backup / restore is a good point.  Managing many EOF stacks and
ensuring that one tenant does not see another tenants information
might be just as complex in either scenario.

I have no idea how / if EOModelGroup implements cloning.  You would
have to test it.  I'd probably choose to do it manually so that I had
control if I ever needed to make any other changes.



When a session is created, you will need to ensure that all editing
contexts created for that session use the correct
EOObjectStoreCoordinator.  You will also want to ensure that you
don't use defaultAnything in  your code (defaultEditingContext(),
defaultModelGroup() etc.) as these are unlikey to return objects
from the correct EOF stack.  Caveat: this is theoretical, I don't
have any experience doing this.  I don't think that many people
have done this, so you run the risk of finding bugs in seldom
executed EOF code.


My tests concurred so far.  It worked as Chuck mentioned, never use 
defaultanything.  Called OSC right at the session constructor to be safe.




Thank you very much! We are not in a hurry to make this change in
our application, but we are worried about future. I'll try to make
some tests following your advices and see what happens.



Please let us know what happens.  This is seldom explored territory.



I run into the similar situation and will be good to know how it goes.

Cheers

Cheong Hee 


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ant build file size issue

2009-09-23 Thread Jake Bearkley
Hi All,
Eclipse 3.3.2 / WOLips 3.3.5304 / WebObjects 5.3 / Leopard 10.5.8

I am trying to build a project using ant embedding the 5.3 frameworks to
deploy on 5.4.

I can build and run the project fine within eclipse.

Yesterday I started getting java heap space issue while trying to build the
war file.  Thanks to Chuck I now use ANT_OPS.  I specify ANT_OPS in the VM
variables on the JRE settings page and the project build successfully, BUT
my build process which zips up the dist directory now creates a 300Mb tar
file instead of a 40Mb tar file.

Can anyone suggest why the significant change?
I am sure the huge dist directory issue occurred before the ANT_OPS change.
 Perhaps this was the cause of the java heap space errors.
I possibly did a automatic software update since my last deploy, which may
have included a java update but not 100% sure.

I reverted my project to last week and rebuilt and the dist directory is
still huge, so I am sure it is nothing I have explicitly done/coded.

I obviously have cleaned the project, my java currentJDK points to 1.5

anyone have any suggestions?

Thanks in advance


Bearko
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ant build file size issue

2009-09-23 Thread Mike Schrag
BUT my build process which zips up the dist directory now creates a  
300Mb tar file instead of a 40Mb tar file.


Can anyone suggest why the significant change?
untar it and see what's taking up the space?  are we adding something  
to the tar that we didn't before?


ms ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WebObjects 5.4.3 and SQL Server 2005

2009-09-23 Thread David Avendasora


On Sep 22, 2009, at 7:36 PM, Chuck Hill wrote:


Not sure why that works and not inclined to dig into it right now.

Chuck



According to the 'legacy' docs, that's the way it's supposed to work.


That seems odd as Boolean is not a Number.  There is trickery there  
in EOF.



David, your modeling skills should be safe from Chuck's snide  
comments... for now (^_^)


Well lookie there! When you use a Value Class of java.lang.Number,   
c means Boolean. (c—java.lang.Boolean)


I am obviously a far superior modeler/coder than I even realized!


I am unlikely to allow simple facts to stand in my way.  ;-)


Why start now. :-P

Dave ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: WebObjects 5.4.3 and SQL Server 2005

2009-09-23 Thread David Avendasora


On Sep 22, 2009, at 11:29 AM, Freddie Tilley wrote:


Value class of type NSNumber does not work for me, using a value class
of java.lang.Boolean does.


What are the results if you use NSNumber? You could also try Number  
or java.lang.Number


I'm suspicious of the Boolean setting...

Dave



Thanks!

2009/9/22 David Avendasora webobje...@avendasora.com:

Okay, let's try it completely manually.
Here's what I have setup in one of my custom Prototypes for MS SQL  
Server:

External Type: bit
Class: java.lang.Boolean
Data Type: Custom - Custom
External Width:
Value Class: NSNumber
Value Type: c
Factory Method:
ConversionMethod:
Init Argument:
These settings work for me in a current project that talks to a SQL  
Server

2000 DB.
Dave

On Sep 22, 2009, at 11:01 AM, Freddie Tilley wrote:

This will give me class cast errors

java.lang.Short cannot be cast to java.lang.Boolean


2009/9/22 David Avendasora webobje...@avendasora.com:

That prototype doesn't do what you think it does. That will convert  
the


boolean value true to the string true and and false to false  
which


obviously won't save into a bit column.

Look at the intBoolean Wonder prototype. You may need to set the  
Prototype


to intNumber first, and then to intBoolean to get it to work as  
I think


there is a bug in Entity Modeler that doesn't properly update the  
external


type when changing to intBoolean.

Dave

On Sep 22, 2009, at 10:25 AM, Freddie Tilley wrote:

the EOJDBCSQLServerPrototypes boolean type defaults to bit with a

custom data type as follows:

External Width: 5

Value Class: java.lang.Boolean

Value type: c

Factory Method: valueOf

Conversion Method: toString

Init Argument: String

2009/9/22 David Avendasora webobje...@avendasora.com:

Hi Freddie,

I don't believe Microsoft SQL Server has a boolean datatype. What

datatype

are you using for the column in the DB?

Dave


On Sep 22, 2009, at 7:32 AM, Freddie Tilley wrote:

I have a problem with writing a boolean value to the database, using

the EOJDBCSQLServerPrototypes and the boolean type. I'm also

using Chuck Hills MicrosoftPlugin.

If I set the boolean to true when creating an object it actually sets

this value in the db when saving.

But if I edit the object again and set the boolean value to false. It

will show the value as false in the list, but it will remain True

in the database. And after this I cannot change the value to True

anymore.

What's going on here?

Freddie Tilley

___

Do not post admin requests to the list. They will be ignored.

Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)

Help/Unsubscribe/Update your Subscription:


http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to webobje...@avendasora.com




___

Do not post admin requests to the list. They will be ignored.

Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)

Help/Unsubscribe/Update your Subscription:

http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to webobje...@avendasora.com




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to webobje...@avendasora.com





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com

This email sent to webobje...@avendasora.com




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


WO WebServices Java 1.6

2009-09-23 Thread Jarda Hanuš

Hi list,

we are developping a web service frontend to a wo application and we  
try to implement some security/authentication controls in it.
However, when we try to access the SOAPEnvelope part of the ws  
message, we obtain this exception:


java.lang.ClassCastException:  
com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot  
be cast to java.lang.String

at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:554)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:688)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)

From some googling it seems that this exception can be caused by  
combination of Axis 1.4 and Java 1.6 - the default version of Java on  
Snow Leopard.


So my questions are:
- has anybody any experiences with using WebObjects WebServices with  
Java 1.6?
- did someone succeed in hacking some newer version of axis (Axis2) to  
work with WO 5.4.3?
- should we try and hack our way ugly through, or is there some hope  
in a new WO release that will make it's WS capabilities  compatible  
with Java 1.6?


Thanks,

Jarda

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Multi-Tenant Data Architecture

2009-09-23 Thread Klaus Berkling

FWIW

We uses an setup were access is organized by groups, sub-groups and  
sub-sub-groups, etc.


We have sales reps which manage channel partners, which manage clients  
or schools.  In the schools are more groups. These are all group  
objects.


There are classes that relate to groups, students are related to one  
or more class. All the groups are in one table, then there is a  
classes table and students table.


The groups are the your tenants. One of our sites has 35819 groups.

A user is assigned a group and when the user logges into their group  
they are given a list of their sub-groups. Users are never aware of  
their login group, their parent groups or any other group above that.  
We keep track of their login group in the session.


There are certain safe-guards to block exposing objects who's group  
relationship is not a child of the users' login group.


This seems to work pretty well.

Issues arise when doing searches for data in a table that's shared  
with multiple tenants. A tenant should not take the penalty for  
someone else's large data set. There is a performance hit when  
combining the database your searching through with the group the  
tenant belongs to. If you have large tenants you'll need to considere  
getting them their own server, or at least their own instance(s) 
+database.


Thanks

kib

We keep moving forward, opening new doors, and doing new things,  
because we're curious and curiosity keeps leading us down new paths.

Walt Disney

Klaus Berkling
Web Application Dev.  Systems Administrator
DynEd International, Inc.
www.dyned.com | www.eskimo.com/~kiberkli




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


saving pdf's to the database

2009-09-23 Thread Tim Worman

WO'ers:

I am writing an application where users can upload pdf files - which  
my app saves to the database. I also need to have mechanisms in place  
where a reviewer can browse the documents that have been uploaded.  
The upload and saving to the database seems to be working. This is  
modeled as 'blob' and the class type is 'NSData.' The files are  
uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm concerned  
that there is something more I need to do to save the pdf files. Are  
there special considerations for maintaining the mime type,  
continuity, etc. of these files before I save them as NSData to the  
database? Also, I am not sure how to present the files to the  
reviewer. I have converted text to pdf for viewing before but I'm  
stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really help me  
as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread John Kim Larson

Hi Tim,
We do this all the time with receiving reports, prints, etc. Since the  
component I use for upload handles any file type ( Word, images, PDF)  
I keep track of the file extension that the file was uploaded with in  
an attribute of my File entity. I then use that information to  
reconstitute the mime type when either embedding or downloading the  
file.  There's not too much magic there, just a bunch of if elses to  
get the mime type from the extension. I can try to help you if that  
isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed the  
blob capacity. PDFs from text are fine, but if someone uploads a high  
res scanned file as a PDF, you will get an error either upon  
committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files - which  
my app saves to the database. I also need to have mechanisms in  
place where a reviewer can browse the documents that have been  
uploaded. The upload and saving to the database seems to be working.  
This is modeled as 'blob' and the class type is 'NSData.' The files  
are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the pdf  
files. Are there special considerations for maintaining the mime  
type, continuity, etc. of these files before I save them as NSData  
to the database? Also, I am not sure how to present the files to the  
reviewer. I have converted text to pdf for viewing before but I'm  
stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really help  
me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread Tim Worman

John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf is a  
big ole glorified image. Hopefully, most of the users will produce  
their pdf's by printing to pdf in mac os x (or acrobat on Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my question.


I've assumed that I should just be able create a response that simply  
returns my NSData object and set the proper content-type. Am I on the  
right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word, images,  
PDF) I keep track of the file extension that the file was uploaded  
with in an attribute of my File entity. I then use that information  
to reconstitute the mime type when either embedding or downloading  
the file.  There's not too much magic there, just a bunch of if  
elses to get the mime type from the extension. I can try to help you  
if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads a  
high res scanned file as a PDF, you will get an error either upon  
committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have mechanisms  
in place where a reviewer can browse the documents that have been  
uploaded. The upload and saving to the database seems to be  
working. This is modeled as 'blob' and the class type is 'NSData.'  
The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the pdf  
files. Are there special considerations for maintaining the mime  
type, continuity, etc. of these files before I save them as NSData  
to the database? Also, I am not sure how to present the files to  
the reviewer. I have converted text to pdf for viewing before but  
I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really help  
me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread John Kim Larson
That's all I do. Are you embedding the file in the page or having the  
response download the file as an attachment?


John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 11:24 AM, Tim Worman li...@thetimmy.com wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf is  
a big ole glorified image. Hopefully, most of the users will produce  
their pdf's by printing to pdf in mac os x (or acrobat on Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my  
question.


I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either upon  
committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have mechanisms  
in place where a reviewer can browse the documents that have  
been uploaded. The upload and saving to the database seems to be  
working. This is modeled as 'blob' and the class type is 'NSData.'  
The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really help  
me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread John Kim Larson
Here's another do'oh question: are you sure the data is making it to  
the db from the upload?


John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 11:24 AM, Tim Worman li...@thetimmy.com wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf is  
a big ole glorified image. Hopefully, most of the users will produce  
their pdf's by printing to pdf in mac os x (or acrobat on Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my  
question.


I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either upon  
committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have mechanisms  
in place where a reviewer can browse the documents that have  
been uploaded. The upload and saving to the database seems to be  
working. This is modeled as 'blob' and the class type is 'NSData.'  
The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really help  
me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread David Holt

Hi Tim,

Have you looked at ERAttachment? It has been designed to do exactly  
what you are attempting and optionally ties into the AjaxFileUpload  
component.


The framework provide a single unified set of components and models  
that can allow the storage of attachments on your local filesystem,  
served through your webserver; on your local filesystem served  
through a custom request handler; in your database, served through a  
custom request handler; and on Amazon's S3 service, served directly  
from S3. The intent of the framework is to make it very simple to  
control how the attachments are stored and served by simple adjusting  
some configuration properties.


It also has attachment viewer components. Save yourself some time,  
use ERAttachment.


http://webobjects.mdimension.com/hudson/job/Wonder53/javadoc/er/ 
attachment/package-summary.html


David


On 23-Sep-09, at 9:24 AM, Tim Worman wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf  
is a big ole glorified image. Hopefully, most of the users will  
produce their pdf's by printing to pdf in mac os x (or acrobat on  
Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my  
question.


I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either  
upon committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class type  
is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons% 
40mac.com


This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/programmingosx 
%40mac.com


This email sent to programming...@mac.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: saving pdf's to the database

2009-09-23 Thread Tim Worman

On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote:


Hi Tim,

On Sep 23, 2009, at 9:24 AM, Tim Worman wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf  
is a big ole glorified image. Hopefully, most of the users will  
produce their pdf's by printing to pdf in mac os x (or acrobat on  
Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf.


How does it present the converted files?


It implements iText but at some point I will be moving to PDFKit. I  
present the text as a PDF in a new window.


So, I got concerned that maybe I was missing something saving the  
NSData. My database saves blobs to the file system so I tried  
reading one as a pdf and couldn't. Hence my question.


That might be an artifact of your database (adding extra info).  It  
could also be that there is some encoding/re-encoding happening that  
is scrambling the contents of the file.  Which database are you using?


I'm using OpenBase and I suspect what you're saying is right. It does  
cause some worry though since I don't have the review portion working  
yet. :-)




I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


That is what I have always done in the past.  It _should_ be simple  
and straightforward.


Chuck





On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either  
upon committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class type  
is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects









___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread Tim Worman
I'm going to try and do the same as I am doing with my other component  
and have these open in a new window.


Tim

On Sep 23, 2009, at 10:16 AM, John  Kim Larson wrote:

That's all I do. Are you embedding the file in the page or having  
the response download the file as an attachment?


John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 11:24 AM, Tim Worman li...@thetimmy.com wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf  
is a big ole glorified image. Hopefully, most of the users will  
produce their pdf's by printing to pdf in mac os x (or acrobat on  
Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my  
question.


I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either  
upon committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class type  
is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread Chuck Hill


On Sep 23, 2009, at 1:27 PM, Tim Worman wrote:


On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote:


Hi Tim,

On Sep 23, 2009, at 9:24 AM, Tim Worman wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating  
user's submission. I can definitely see the file size concern if  
the pdf is a big ole glorified image. Hopefully, most of the users  
will produce their pdf's by printing to pdf in mac os x (or  
acrobat on Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the  
file was originated as pdf.


How does it present the converted files?


It implements iText but at some point I will be moving to PDFKit. I  
present the text as a PDF in a new window.


The same thing should work with the PDF in a database.


So, I got concerned that maybe I was missing something saving the  
NSData. My database saves blobs to the file system so I tried  
reading one as a pdf and couldn't. Hence my question.


That might be an artifact of your database (adding extra info).  It  
could also be that there is some encoding/re-encoding happening  
that is scrambling the contents of the file.  Which database are  
you using?


I'm using OpenBase and I suspect what you're saying is right. It  
does cause some worry though since I don't have the review portion  
working yet. :-)


You are certain it is a BLOB not a CLOB?

How is the attribute modeled?


Chuck






I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type.  
Am I on the right track?


That is what I have always done in the past.  It _should_ be simple  
and straightforward.


Chuck





On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc.  
Since the component I use for upload handles any file type  
( Word, images, PDF) I keep track of the file extension that the  
file was uploaded with in an attribute of my File entity. I then  
use that information to reconstitute the mime type when either  
embedding or downloading the file.  There's not too much magic  
there, just a bunch of if elses to get the mime type from the  
extension. I can try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone  
uploads a high res scanned file as a PDF, you will get an error  
either upon committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com  
wrote:



WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class  
type is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects











--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who 

Re: saving pdf's to the database

2009-09-23 Thread Tim Worman
Yeah, there is definitely data being stored. My only concern is that I  
don't have proof yet that I can read what I've written to the  
database. So, I was concerned but I expect that Chuck is right that  
the database probably manipulates file it stores.


Tim

On Sep 23, 2009, at 10:26 AM, John  Kim Larson wrote:

Here's another do'oh question: are you sure the data is making it to  
the db from the upload?


John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 11:24 AM, Tim Worman li...@thetimmy.com wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating user's  
submission. I can definitely see the file size concern if the pdf  
is a big ole glorified image. Hopefully, most of the users will  
produce their pdf's by printing to pdf in mac os x (or acrobat on  
Windoze).


I already had a component class that takes plain text blobs (logs)  
from the database, converts them to pdf, and presents them in a  
browser window. That class doesn't work on the blobs where the file  
was originated as pdf. So, I got concerned that maybe I was missing  
something saving the NSData. My database saves blobs to the file  
system so I tried reading one as a pdf and couldn't. Hence my  
question.


I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type. Am  
I on the right track?


Thanks for your help.

Tim

On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc. Since  
the component I use for upload handles any file type ( Word,  
images, PDF) I keep track of the file extension that the file was  
uploaded with in an attribute of my File entity. I then use that  
information to reconstitute the mime type when either embedding or  
downloading the file.  There's not too much magic there, just a  
bunch of if elses to get the mime type from the extension. I can  
try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't exceed  
the blob capacity. PDFs from text are fine, but if someone uploads  
a high res scanned file as a PDF, you will get an error either  
upon committing the change or upon trying to view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com wrote:


WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class type  
is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them as  
NSData to the database? Also, I am not sure how to present the  
files to the reviewer. I have converted text to pdf for viewing  
before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com




___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: saving pdf's to the database

2009-09-23 Thread Tim Worman


On Sep 23, 2009, at 1:41 PM, Chuck Hill wrote:



On Sep 23, 2009, at 1:27 PM, Tim Worman wrote:


On Sep 23, 2009, at 10:15 AM, Chuck Hill wrote:


Hi Tim,

On Sep 23, 2009, at 9:24 AM, Tim Worman wrote:


John:

Thanks for the response. In our case the files will always be pdf  
since we are requiring that as the format of the originating  
user's submission. I can definitely see the file size concern if  
the pdf is a big ole glorified image. Hopefully, most of the  
users will produce their pdf's by printing to pdf in mac os x (or  
acrobat on Windoze).


I already had a component class that takes plain text blobs  
(logs) from the database, converts them to pdf, and presents them  
in a browser window. That class doesn't work on the blobs where  
the file was originated as pdf.


How does it present the converted files?


It implements iText but at some point I will be moving to PDFKit. I  
present the text as a PDF in a new window.


The same thing should work with the PDF in a database.


Right, but since it should already be a PDF, I don't need any  
translation or need for my iText implementation, correct?


So, I got concerned that maybe I was missing something saving the  
NSData. My database saves blobs to the file system so I tried  
reading one as a pdf and couldn't. Hence my question.


That might be an artifact of your database (adding extra info).   
It could also be that there is some encoding/re-encoding happening  
that is scrambling the contents of the file.  Which database are  
you using?


I'm using OpenBase and I suspect what you're saying is right. It  
does cause some worry though since I don't have the review portion  
working yet. :-)


You are certain it is a BLOB not a CLOB?

How is the attribute modeled?


I've modeled it as a blob, with the external type 'object.' OpenBase  
has a 'binary' type but it seems 'object' should be correct. I  
attached a screenshot.


Tim


Chuck






I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type.  
Am I on the right track?


That is what I have always done in the past.  It _should_ be  
simple and straightforward.


Chuck





On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc.  
Since the component I use for upload handles any file type  
( Word, images, PDF) I keep track of the file extension that the  
file was uploaded with in an attribute of my File entity. I then  
use that information to reconstitute the mime type when either  
embedding or downloading the file.  There's not too much magic  
there, just a bunch of if elses to get the mime type from the  
extension. I can try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't  
exceed the blob capacity. PDFs from text are fine, but if  
someone uploads a high res scanned file as a PDF, you will get  
an error either upon committing the change or upon trying to  
view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com  
wrote:



WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the documents  
that have been uploaded. The upload and saving to the database  
seems to be working. This is modeled as 'blob' and the class  
type is 'NSData.' The files are uploaded via AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save the  
pdf files. Are there special considerations for maintaining the  
mime type, continuity, etc. of these files before I save them  
as NSData to the database? Also, I am not sure how to present  
the files to the reviewer. I have converted text to pdf for  
viewing before but I'm stuck on reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who 

Re: saving pdf's to the database

2009-09-23 Thread Chuck Hill

On Sep 23, 2009, at 2:28 PM, Tim Worman wrote:


Thanks for the response. In our case the files will always be  
pdf since we are requiring that as the format of the originating  
user's submission. I can definitely see the file size concern if  
the pdf is a big ole glorified image. Hopefully, most of the  
users will produce their pdf's by printing to pdf in mac os x  
(or acrobat on Windoze).


I already had a component class that takes plain text blobs  
(logs) from the database, converts them to pdf, and presents  
them in a browser window. That class doesn't work on the blobs  
where the file was originated as pdf.


How does it present the converted files?


It implements iText but at some point I will be moving to PDFKit.  
I present the text as a PDF in a new window.


The same thing should work with the PDF in a database.


Right, but since it should already be a PDF, I don't need any  
translation or need for my iText implementation, correct?


Yeah, just the present the text as a PDF in a new window part.


So, I got concerned that maybe I was missing something saving  
the NSData. My database saves blobs to the file system so I  
tried reading one as a pdf and couldn't. Hence my question.


That might be an artifact of your database (adding extra info).   
It could also be that there is some encoding/re-encoding  
happening that is scrambling the contents of the file.  Which  
database are you using?


I'm using OpenBase and I suspect what you're saying is right. It  
does cause some worry though since I don't have the review portion  
working yet. :-)


You are certain it is a BLOB not a CLOB?

How is the attribute modeled?


I've modeled it as a blob, with the external type 'object.' OpenBase  
has a 'binary' type but it seems 'object' should be correct. I  
attached a screenshot.


I don't think you did.  :-)  I am not sure which type is correct, or  
if both are.



Chuck





I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content-type.  
Am I on the right track?


That is what I have always done in the past.  It _should_ be  
simple and straightforward.


Chuck





On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc.  
Since the component I use for upload handles any file type  
( Word, images, PDF) I keep track of the file extension that  
the file was uploaded with in an attribute of my File entity. I  
then use that information to reconstitute the mime type when  
either embedding or downloading the file.  There's not too much  
magic there, just a bunch of if elses to get the mime type from  
the extension. I can try to help you if that isn't enough info.


Another gotcha is to make sure that your file size doesn't  
exceed the blob capacity. PDFs from text are fine, but if  
someone uploads a high res scanned file as a PDF, you will get  
an error either upon committing the change or upon trying to  
view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com  
wrote:



WO'ers:

I am writing an application where users can upload pdf files -  
which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the  
documents that have been uploaded. The upload and saving to  
the database seems to be working. This is modeled as 'blob'  
and the class type is 'NSData.' The files are uploaded via  
AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save  
the pdf files. Are there special considerations for  
maintaining the mime type, continuity, etc. of these files  
before I save them as NSData to the database? Also, I am not  
sure how to present the files to the reviewer. I have  
converted text to pdf for viewing before but I'm stuck on  
reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects- 
d...@lists.apple.com)

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to ch...@global-village.net


--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase 

Re: saving pdf's to the database

2009-09-23 Thread Tim Worman


On Sep 23, 2009, at 2:43 PM, Chuck Hill wrote:


On Sep 23, 2009, at 2:28 PM, Tim Worman wrote:


Thanks for the response. In our case the files will always be  
pdf since we are requiring that as the format of the  
originating user's submission. I can definitely see the file  
size concern if the pdf is a big ole glorified image.  
Hopefully, most of the users will produce their pdf's by  
printing to pdf in mac os x (or acrobat on Windoze).


I already had a component class that takes plain text blobs  
(logs) from the database, converts them to pdf, and presents  
them in a browser window. That class doesn't work on the blobs  
where the file was originated as pdf.


How does it present the converted files?


It implements iText but at some point I will be moving to PDFKit.  
I present the text as a PDF in a new window.


The same thing should work with the PDF in a database.


Right, but since it should already be a PDF, I don't need any  
translation or need for my iText implementation, correct?


Yeah, just the present the text as a PDF in a new window part.


So, I got concerned that maybe I was missing something saving  
the NSData. My database saves blobs to the file system so I  
tried reading one as a pdf and couldn't. Hence my question.


That might be an artifact of your database (adding extra info).   
It could also be that there is some encoding/re-encoding  
happening that is scrambling the contents of the file.  Which  
database are you using?


I'm using OpenBase and I suspect what you're saying is right. It  
does cause some worry though since I don't have the review  
portion working yet. :-)


You are certain it is a BLOB not a CLOB?

How is the attribute modeled?


I've modeled it as a blob, with the external type 'object.'  
OpenBase has a 'binary' type but it seems 'object' should be  
correct. I attached a screenshot.


I don't think you did.  :-)  I am not sure which type is correct, or  
if both are.



Chuck


Damnit, I hate it when you're right even more than normal. Screenshot  
attached.


inline: Screen shot 2009-09-23 at 2.24.24 PM.png


Tim








I've assumed that I should just be able create a response that  
simply returns my NSData object and set the proper content- 
type. Am I on the right track?


That is what I have always done in the past.  It _should_ be  
simple and straightforward.


Chuck





On Sep 23, 2009, at 9:02 AM, John  Kim Larson wrote:


Hi Tim,
We do this all the time with receiving reports, prints, etc.  
Since the component I use for upload handles any file type  
( Word, images, PDF) I keep track of the file extension that  
the file was uploaded with in an attribute of my File entity.  
I then use that information to reconstitute the mime type when  
either embedding or downloading the file.  There's not too  
much magic there, just a bunch of if elses to get the mime  
type from the extension. I can try to help you if that isn't  
enough info.


Another gotcha is to make sure that your file size doesn't  
exceed the blob capacity. PDFs from text are fine, but if  
someone uploads a high res scanned file as a PDF, you will get  
an error either upon committing the change or upon trying to  
view the file.


JAL

John A. Larson
President
Precision Instruments, Inc.
Ph: 847-824-4194
Fax: 866-240-7104

Sent from my iPhone

On Sep 23, 2009, at 10:45 AM, Tim Worman li...@thetimmy.com  
wrote:



WO'ers:

I am writing an application where users can upload pdf files  
- which my app saves to the database. I also need to have  
mechanisms in place where a reviewer can browse the  
documents that have been uploaded. The upload and saving to  
the database seems to be working. This is modeled as 'blob'  
and the class type is 'NSData.' The files are uploaded via  
AjaxFileUpload.


I have saved plain text files to the database before but I'm  
concerned that there is something more I need to do to save  
the pdf files. Are there special considerations for  
maintaining the mime type, continuity, etc. of these files  
before I save them as NSData to the database? Also, I am not  
sure how to present the files to the reviewer. I have  
converted text to pdf for viewing before but I'm stuck on  
reconstituting a pdf for display.


If anyone has any pointers or code examples that would really  
help me as I'm under a serious time crunch.


Tim
UCLA GSEIS
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com 
)

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com

This email sent to the_lars...@mac.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

Re: WO WebServices Java 1.6

2009-09-23 Thread Lachlan Deck

On 24/09/2009, at 12:02 AM, Jarda Hanuš wrote:

we are developping a web service frontend to a wo application and we  
try to implement some security/authentication controls in it.
However, when we try to access the SOAPEnvelope part of the ws  
message, we obtain this exception:


java.lang.ClassCastException:  
com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl  
cannot be cast to java.lang.String

at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:554)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:688)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)


What jars have you included?

From some googling it seems that this exception can be caused by  
combination of Axis 1.4 and Java 1.6 - the default version of Java  
on Snow Leopard.


So my questions are:
- has anybody any experiences with using WebObjects WebServices with  
Java 1.6?


Yes. (Though we deploy on FreeBSD, but that should be irrelevant)

- did someone succeed in hacking some newer version of axis (Axis2)  
to work with WO 5.4.3?


Didn't try. Still using axis 1.4 with relevant dependencies...
http://mavenrepository.com/artifact/axis/axis/1.4

- should we try and hack our way ugly through, or is there some hope  
in a new WO release that will make it's WS capabilities  compatible  
with Java 1.6?


What if you target your compile for that particular framework for 1.5?

with regards,
--

Lachlan Deck

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Multi-Tenant Data Architecture

2009-09-23 Thread Henrique Prange

Hi Guido,

Guido Neitzer wrote:

On Sep 22, 2009, at 4:34 PM, Chuck Hill wrote:


- some increase in RAM usage due to duplicated loading of code and JVM
If you don't want to do that and are committed to doing this in one 
instance, the next best way is to tag the root object with the 
tenant.  But you said separate databases, so that is ruled out.


You mean data categorized by tenant?


Yes.


I did something like this a while ago and it was actually pretty simple 
to come up with a model that worked for the situation we had:


- all (!) entities have a client (tenant?) relationship
- this is set along with audit information in awakeFromInsertion (init) 
automatically as every user belongs to a client
- the app automatically limits fetches with restricting qualifiers (D2W 
app)


- if an object gets fetched and it's awakeFromFetch is called and the 
client of this object and the client of the current user don't match, it 
throws a fatal exception, the users session is logged (every single 
action), the stack trace is logged, and the session terminated




That is a good idea to avoid undesirable access to data that don't 
belong to the corresponding tenant.



- I don't use any raw row fetching at all



We do for report generation. But we could create a mechanism for sanity 
checking (like the one in the awakeFromFetch) as soon as all data used 
in reports come from the same data source.


Thanks for your comments and advices.

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Updated to 3.5 and now lots of html errors

2009-09-23 Thread Ramsey Lee Gurley

Hi all,

I just updated to 3.5.  It's very fast. I like it a lot (^_^) However,  
I'm getting *lots* of red Xs in ERExtensions and ERDirectToWeb  
regarding unclosed br hr ... that sort of thing.  Now, for my  
stuff, I like that... but for the wonder frameworks, some of those  
things are correct because they are still using HTML doctype so it  
would be invalid to change them to br/ etc.  Is there any way to  
quiet down eclipse with regard to these on a per project/framework  
basis so I can keep them for my stuff, but disable them for ERD2W and  
ERExt?


Also... I have been cheating with a //VALID notation that no longer  
works.  I have


CheckboxWrapper: WOGenericContainer {
// ** Because there's no elementName, this is an invisible  
wrapper element.

elementID = wrapperElementID;
name = context.elementID;
formValues = selections;
}

Of course, this works fine, but it gives me a red X.  The trick that  
worked before was...


CheckboxWrapper //VALID
: WOGenericContainer {

That was a bit of overkill because it disabled validation on the whole  
WOD, but it did work.  Now, that's not working... so, any hints on  
how to make my red Xs go away?


Thanks all,

Ramsey




smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Updated to 3.5 and now lots of html errors

2009-09-23 Thread Mike Schrag
I just updated to 3.5.  It's very fast. I like it a lot (^_^)  
However, I'm getting *lots* of red Xs in ERExtensions and  
ERDirectToWeb regarding unclosed br hr ... that sort of thing.   
Now, for my stuff, I like that... but for the wonder frameworks,  
some of those things are correct because they are still using HTML  
doctype so it would be invalid to change them to br/ etc.  Is  
there any way to quiet down eclipse with regard to these on a per  
project/framework basis so I can keep them for my stuff, but disable  
them for ERD2W and ERExt?
Look in your WOLips Development Preferences for your project and see  
if Require Well-formed Templates is checked .. Uncheck it and clean  
build if it is.


Also... I have been cheating with a //VALID notation that no longer  
works.  I have


CheckboxWrapper: WOGenericContainer {
// ** Because there's no elementName, this is an invisible  
wrapper element.

elementID = wrapperElementID;
name = context.elementID;
formValues = selections;
}

Of course, this works fine, but it gives me a red X.  The trick that  
worked before was...


CheckboxWrapper //VALID
: WOGenericContainer {

That was a bit of overkill because it disabled validation on the  
whole WOD, but it did work.  Now, that's not working... so, any  
hints on how to make my red Xs go away?
i'm amazed that worked before :)  i didn't intentionally disable this,  
but then i never really intentionally ENABLED it. Valid should  
definitely not have disabled for the entire WOD -- are you sure it did  
that? what red 'x' are you getting btw? that elementName is a required  
binding?  if it isn't, then we should remove it from the API  
validation rules for WOGenericContainer.


ms ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Multi-Tenant Data Architecture

2009-09-23 Thread Henrique Prange

Hi Lachlan,

Lachlan Deck wrote:

On 23/09/2009, at 8:46 AM, Henrique Prange wrote:


Chuck Hill wrote:
- problems / load on one tenant do not impact others
- guaranteed that one tenant will not accidently see information from 
another


This last one is exactly the reason why we can't have a shared 
database at all.


This is what we do .. simply requires an auto injected and'd qualifier + 
relevant tables related to said tenant.




That is also a good idea. :)


- some increase in RAM usage due to duplicated loading of code and JVM
If you don't want to do that and are committed to doing this in one 
instance, the next best way is to tag the root object with the 
tenant.  But you said separate databases, so that is ruled out.


You mean data categorized by tenant?

The application already supports this kind of architecture. We deploy 
one application with more than one tenant using a shared database in 
very exceptional cases. But that is not the rule. In most cases we 
can't take the risk of providing wrong information for a customer.


We've never had that problem - but I understand it's theoretically 
possible as is providing the wrong connection dictionary ;-)




Yes. One tenant per instance with separate databases is the safer way. 
But has the higher maintenance cost.


Every solution has pros and cons. As I said, I'm not in a hurry to 
implement this kind of architecture. But I would like to take decisions 
based on good arguments and the result of some experiments. Not because 
of a technological problem. As, in theory, EOF can support multiple 
databases in one application, I think it is worth making some tests in 
this direction.


Anyway, I'm taking all your comments into consideration before I take 
the final decision. :)


Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Multi-Tenant Data Architecture

2009-09-23 Thread Henrique Prange

Hi Cheong,

Cheong Hee (Gmail) wrote:
I read with great interest as I encountere the same situation some time 
ago. In practice (at least in my case), it worked to have the app run on 
separate EOF stacks accessing different database.  So , it simplified 
the case to only have one instance in JavaMonitor for multi databases.


Good to hear I'm no the only one trying to implement this kind of solution.




When a session is created, you will need to ensure that all editing
contexts created for that session use the correct
EOObjectStoreCoordinator.  You will also want to ensure that you
don't use defaultAnything in  your code (defaultEditingContext(),
defaultModelGroup() etc.) as these are unlikey to return objects
from the correct EOF stack.  Caveat: this is theoretical, I don't
have any experience doing this.  I don't think that many people
have done this, so you run the risk of finding bugs in seldom
executed EOF code.


My tests concurred so far.  It worked as Chuck mentioned, never use 
defaultanything.  Called OSC right at the session constructor to be safe.




I'll try to follow this advices. Thank you.

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Multi-Tenant Data Architecture

2009-09-23 Thread Henrique Prange

Hi Chuck,

Chuck Hill wrote:


Not so easy when you have more than 20 different instances (and 
counting) running on JavaMonitor. :p


20 does not seem like that many to manage.



Yeah. I'm worried about the future. 100+ instances can become a problem 
to manage.







Cons:
- more instances to administer


That is our main concern. Today we have 20 instances, but this number 
is likely to increase considerably in near future.


If it grows to 40, are you planning on having each instance host all 
40?  I'd look into EOF stack size if you are thinking of having 40 in 
one JVM and there is a significant amount of data per tenant.  That 
might work out to a lot of RAM per instance and so few instances per 
machine.  It is just something to keep in mind.




You are right and I don't have the exact math for this problem. I 
believe one solution will not fit all situations. Some tenants will 
require an entire instance because of the amount of data. But most 
tenants will not require many resources. Of course, this is based on an 
empirical analysis. I still have to measure in different situations to 
determine these magical numbers (number of tenants per instance, 
required amount of RAM and etc).






Writing a bug free multi-tenant application with shared data is time 
consuming and expensive. In the case of this specific application is 
also too risky. Also, a shared database make the backup/restore 
process very difficult. You can backup everything easily, but how to 
revert the data for a single tenant?


The backup / restore is a good point.  Managing many EOF stacks and 
ensuring that one tenant does not see another tenants information might 
be just as complex in either scenario.




Yeah. Whatever solution we chose, I'm convinced it is not a trivial matter.

Cheers,

Henrique
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Updated to 3.5 and now lots of html errors

2009-09-23 Thread Ramsey Lee Gurley


On Sep 23, 2009, at 11:16 PM, Mike Schrag wrote:

I just updated to 3.5.  It's very fast. I like it a lot (^_^)  
However, I'm getting *lots* of red Xs in ERExtensions and  
ERDirectToWeb regarding unclosed br hr ... that sort of thing.   
Now, for my stuff, I like that... but for the wonder frameworks,  
some of those things are correct because they are still using HTML  
doctype so it would be invalid to change them to br/ etc.  Is  
there any way to quiet down eclipse with regard to these on a per  
project/framework basis so I can keep them for my stuff, but  
disable them for ERD2W and ERExt?
Look in your WOLips Development Preferences for your project and see  
if Require Well-formed Templates is checked .. Uncheck it and  
clean build if it is.


Ok, that appears to be doing the trick.  I knew it had to be in there  
somewhere (^_^)




Also... I have been cheating with a //VALID notation that no longer  
works.  I have


CheckboxWrapper: WOGenericContainer {
// ** Because there's no elementName, this is an invisible  
wrapper element.

elementID = wrapperElementID;
name = context.elementID;
formValues = selections;
}

Of course, this works fine, but it gives me a red X.  The trick  
that worked before was...


CheckboxWrapper //VALID
: WOGenericContainer {

That was a bit of overkill because it disabled validation on the  
whole WOD, but it did work.  Now, that's not working... so, any  
hints on how to make my red Xs go away?
i'm amazed that worked before :)  i didn't intentionally disable  
this, but then i never really intentionally ENABLED it. Valid should  
definitely not have disabled for the entire WOD -- are you sure it  
did that? what red 'x' are you getting btw? that elementName is a  
required binding?  if it isn't, then we should remove it from the  
API validation rules for WOGenericContainer.


ms


Oh yes, I remember quite distinctly that it would nuke the validation  
for the whole WOD (^_^)  But that was ok, because I got everything  
else right and never touched it again after I put the //VALID on it.


And yeah, the red X is regarding the missing elementName binding.  I  
was surprised, but WOGenericContainer works without it.  And in this  
case, it is the only way I can produce valid XHTML with this  
component.  Those bindings are copied from Apple sample code, comment  
and all, located at


/Developer/Examples/JavaWebObjects/Frameworks/WOComponentElements/wo- 
resources/Resources/WXCheckBoxList.wo/WXCheckBoxList.wod


Ramsey




smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com