Re: Obscure Primary Key Gotcha

2006-10-20 Thread Chuck Hill


On Oct 20, 2006, at 3:45 PM, Paul Lynch wrote:



On 20 Oct 2006, at 17:57, Robert Walker wrote:

Oh I see.  I misunderstood the issue slightly.  You are saying  
that EOF accepts user provided PK's as long as the value is >  
1.0.  Gotcha. ;-)


Sounds like time to file a bug report on that one then.


Yes, but how to get past having to admit that I actually have a  
table with a float primary key? :-)


"I'm reporting this on behalf of a friend.  See, he has this primary  
key that is a float..."  :-P


Chuck


--

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 archive@mail-archive.com


WO App Server - Request Handling - Parallel or Sequential ?

2006-10-20 Thread Tanmoy Roy

Hi all,

We have deployed our WO application using Java Monitor in a OSX Box.
We normally have around 10-11 instances of the application running.
Normally we see the Active Sesion count to vary between 8-10 always.
The monitor shows the average request processing time for our
application is around 0.02 secs/request. Also we have seen that the
max number of simulteneous requests is 50.

Now here I have a question, does a single WO instance serves this 8-10
request parallely or is it sequentially. Lets say if we want to
determine the capacity of request handling for our application will it
be correct to say that our application can serve 50x10 requests
simulteneously in 0.02 secs. Or is 50x10x0.02. If anybody has this
kind of calculation or throw some lights on it it will be great.

--
Best,
Tanmoy
___
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 archive@mail-archive.com


Re: Obscure Primary Key Gotcha

2006-10-20 Thread Paul Lynch


On 20 Oct 2006, at 17:57, Robert Walker wrote:

Oh I see.  I misunderstood the issue slightly.  You are saying that  
EOF accepts user provided PK's as long as the value is > 1.0.   
Gotcha. ;-)


Sounds like time to file a bug report on that one then.


Yes, but how to get past having to admit that I actually have a table  
with a float primary key? :-)



On Oct 20, 2006, at 10:36 AM, Paul Lynch wrote:

That's not entirely true.  We have the convention of using integer  
or binary keys, sure.  But, in a relational database, any type is  
permitted for use as a primary key, and WebObjects should support  
this, even if it can't generate a value.  One of the primary key  
generation mechanisms that is supported is for the user to supply  
a value - if you really insist on having a string primary key, for  
instance, then this is the only reasonable approach to take.


So this was exactly that "custom primary key generation scheme" -  
I was trying to supply the value, and EO overrides it when the  
float value is < 1.


I remember being disappointed way back when EOF stopped permitting  
zeros in primary key fields, as it started to make the "primary  
key" concept more of a private WebObjects concept rather than a  
generic relational concept.  They sneaked that in around EOF 2.2,  
as I recall, and didn't even have the decency to wait for a major  
release for such a substantial change.


Paul

On 20 Oct 2006, at 14:42, Robert Walker wrote:

Interesting, but unexpected behavior is exactly what I would  
expect in this situation.  EOF expects one of a couple different  
data types for use as primary keys.  Any type of float value  
(including BigDecimal) is not one of them.  Basically either a  
unary integer PK or a specific binary format is what EOF can deal  
with.  Anything else requires some form of custom PK generation  
scheme.


On Oct 19, 2006, at 3:09 PM, Paul Lynch wrote:


I just came across this, and thought the list might be interested:

I was just working with a legacy database which has a table with  
a single column, which is of course designated as the primary  
key.  It happens to be a float, represented as a BigDecimal.   
The (somewhat dubious) logic behind this design isn't important.


If I add a record to the table (EOGenericRecord), with the key  
field set to a number greater than 1.0, everything is fine.   
However, if I add a record with a value between 0 and 1.0 (which  
is the vast majority of the records required), WO silently  
replaces the value with the next available value from EO_PK_TABLE.


The reason behind this is that EO expects a primary key, when  
supplied by the user, to be non-null and non-zero.  It is  
obviously (and mistakenly) assuming that values less than 1 are  
equal to zero - probably because some programmer in the past  
thought that no one would be dumb enough to use a float as a  
primary key :-).


Incidentally, the above is what happens using OpenBase; the  
MySQL driver just generates an exception claiming it is unable  
to generate a primary key.


___
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 archive@mail-archive.com


Re: stack overflow error

2006-10-20 Thread Robert Walker
This may be obvious, but are you absolutely sure your recursive function always has an escape path?  It's pretty easy to get into an infinite loop without realizing it when implementing recursion.On Oct 20, 2006, at 3:31 AM, Ulrich Köster wrote:You could attach a debugger to the deployed application and set a exception breakpoint for the StackOverflowError.UliAm 19.10.2006 um 19:37 schrieb Ken Anderson: I occasionally receive this message on a WO app I have:com.webobjects.foundation.NSForwardException for java.lang.StackOverflowErrorIt's during some pretty deep recursion, so I would really like to expand whatever stack is being used... the problem is, I'm not really clear how to do that.  I've tried expanding the stack with -Xss, but that doesn't seem to help (and some documentation leads me to believe that's for the C stack, not the Java stack).Has anyone run into this?  Any ideas?Thanks,Ken___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/ulrich%40assense.comThis email sent to [EMAIL PROTECTED] ___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/robertwalker1%40mac.comThis email sent to [EMAIL PROTECTED]  --Robert Walker[EMAIL PROTECTED]  ___
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 archive@mail-archive.com

Re: Obscure Primary Key Gotcha

2006-10-20 Thread Robert Walker
Paul,Oh I see.  I misunderstood the issue slightly.  You are saying that EOF accepts user provided PK's as long as the value is > 1.0.  Gotcha. ;-)Sounds like time to file a bug report on that one then.On Oct 20, 2006, at 10:36 AM, Paul Lynch wrote:That's not entirely true.  We have the convention of using integer or binary keys, sure.  But, in a relational database, any type is permitted for use as a primary key, and WebObjects should support this, even if it can't generate a value.  One of the primary key generation mechanisms that is supported is for the user to supply a value - if you really insist on having a string primary key, for instance, then this is the only reasonable approach to take.So this was exactly that "custom primary key generation scheme" - I was trying to supply the value, and EO overrides it when the float value is < 1.I remember being disappointed way back when EOF stopped permitting zeros in primary key fields, as it started to make the "primary key" concept more of a private WebObjects concept rather than a generic relational concept.  They sneaked that in around EOF 2.2, as I recall, and didn't even have the decency to wait for a major release for such a substantial change.PaulOn 20 Oct 2006, at 14:42, Robert Walker wrote: Interesting, but unexpected behavior is exactly what I would expect in this situation.  EOF expects one of a couple different data types for use as primary keys.  Any type of float value (including BigDecimal) is not one of them.  Basically either a unary integer PK or a specific binary format is what EOF can deal with.  Anything else requires some form of custom PK generation scheme.On Oct 19, 2006, at 3:09 PM, Paul Lynch wrote: I just came across this, and thought the list might be interested:I was just working with a legacy database which has a table with a single column, which is of course designated as the primary key.  It happens to be a float, represented as a BigDecimal.  The (somewhat dubious) logic behind this design isn't important.If I add a record to the table (EOGenericRecord), with the key field set to a number greater than 1.0, everything is fine.  However, if I add a record with a value between 0 and 1.0 (which is the vast majority of the records required), WO silently replaces the value with the next available value from EO_PK_TABLE.The reason behind this is that EO expects a primary key, when supplied by the user, to be non-null and non-zero.  It is obviously (and mistakenly) assuming that values less than 1 are equal to zero - probably because some programmer in the past thought that no one would be dumb enough to use a float as a primary key :-).Incidentally, the above is what happens using OpenBase; the MySQL driver just generates an exception claiming it is unable to generate a primary key.   --Robert Walker[EMAIL PROTECTED]  ___
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 archive@mail-archive.com

Re: in WOString

2006-10-20 Thread Mike Schrag

escapeHTML = false

On Oct 20, 2006, at 12:31 PM, John Huss wrote:


Is there a way to create a line break  in a WOString?

Binding the string how produces  
instead of John ___ 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/mschrag% 40mdimension.com This email sent to [EMAIL PROTECTED] ___ 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 archive@mail-archive.com

in WOString

2006-10-20 Thread John Huss

Is there a way to create a line break  in a WOString?

Binding the string how produces  
instead of John ___ 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 archive@mail-archive.com

Re: Obscure Primary Key Gotcha

2006-10-20 Thread Paul Lynch
That's not entirely true.  We have the convention of using integer or  
binary keys, sure.  But, in a relational database, any type is  
permitted for use as a primary key, and WebObjects should support  
this, even if it can't generate a value.  One of the primary key  
generation mechanisms that is supported is for the user to supply a  
value - if you really insist on having a string primary key, for  
instance, then this is the only reasonable approach to take.


So this was exactly that "custom primary key generation scheme" - I  
was trying to supply the value, and EO overrides it when the float  
value is < 1.


I remember being disappointed way back when EOF stopped permitting  
zeros in primary key fields, as it started to make the "primary key"  
concept more of a private WebObjects concept rather than a generic  
relational concept.  They sneaked that in around EOF 2.2, as I  
recall, and didn't even have the decency to wait for a major release  
for such a substantial change.


Paul

On 20 Oct 2006, at 14:42, Robert Walker wrote:

Interesting, but unexpected behavior is exactly what I would expect  
in this situation.  EOF expects one of a couple different data  
types for use as primary keys.  Any type of float value (including  
BigDecimal) is not one of them.  Basically either a unary integer  
PK or a specific binary format is what EOF can deal with.  Anything  
else requires some form of custom PK generation scheme.


On Oct 19, 2006, at 3:09 PM, Paul Lynch wrote:


I just came across this, and thought the list might be interested:

I was just working with a legacy database which has a table with a  
single column, which is of course designated as the primary key.   
It happens to be a float, represented as a BigDecimal.  The  
(somewhat dubious) logic behind this design isn't important.


If I add a record to the table (EOGenericRecord), with the key  
field set to a number greater than 1.0, everything is fine.   
However, if I add a record with a value between 0 and 1.0 (which  
is the vast majority of the records required), WO silently  
replaces the value with the next available value from EO_PK_TABLE.


The reason behind this is that EO expects a primary key, when  
supplied by the user, to be non-null and non-zero.  It is  
obviously (and mistakenly) assuming that values less than 1 are  
equal to zero - probably because some programmer in the past  
thought that no one would be dumb enough to use a float as a  
primary key :-).


Incidentally, the above is what happens using OpenBase; the MySQL  
driver just generates an exception claiming it is unable to  
generate a primary key.


___
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 archive@mail-archive.com


Re: Obscure Primary Key Gotcha

2006-10-20 Thread Robert Walker
Paul,Interesting, but unexpected behavior is exactly what I would expect in this situation.  EOF expects one of a couple different data types for use as primary keys.  Any type of float value (including BigDecimal) is not one of them.  Basically either a unary integer PK or a specific binary format is what EOF can deal with.  Anything else requires some form of custom PK generation scheme.On Oct 19, 2006, at 3:09 PM, Paul Lynch wrote:I just came across this, and thought the list might be interested:I was just working with a legacy database which has a table with a single column, which is of course designated as the primary key.  It happens to be a float, represented as a BigDecimal.  The (somewhat dubious) logic behind this design isn't important.If I add a record to the table (EOGenericRecord), with the key field set to a number greater than 1.0, everything is fine.  However, if I add a record with a value between 0 and 1.0 (which is the vast majority of the records required), WO silently replaces the value with the next available value from EO_PK_TABLE.The reason behind this is that EO expects a primary key, when supplied by the user, to be non-null and non-zero.  It is obviously (and mistakenly) assuming that values less than 1 are equal to zero - probably because some programmer in the past thought that no one would be dumb enough to use a float as a primary key :-).Incidentally, the above is what happens using OpenBase; the MySQL driver just generates an exception claiming it is unable to generate a primary key.Paul___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/robertwalker1%40mac.comThis email sent to [EMAIL PROTECTED]  --Robert Walker[EMAIL PROTECTED]  ___
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 archive@mail-archive.com

Re: [Wonder-disc] Helper Functions

2006-10-20 Thread Mike Schrag
Namespacing is definitely the tricky part at the moment.  I tried to  
address _basic_ namespace support in a straightforward way, figuring  
once people use it, other ideas would come up.


I was thinking that ERExtensions might have the "main" set of helpers  
for the base types (String, NSTimestamp, primitives, etc), which you  
could extend in your own apps.  Alternatively, WOOGNL could depend on  
ERX (it doesn't now) and we can put the main helpers in there.  The  
OGNL option organizationally makes a little more sense, I think.


I've not really done anything with AOP, so I'm open for suggestions/ 
recommendations here.  Every time I've looked at AOP it sort of  
looked insane and I scurried away :)


The auto-increasing id helper is a bit of a funky case.  You're not  
really "formatting" anything in that case -- you're generating (if i  
understand you correctly).  You could probably trick it into working,  
but I can't think of a "natural" way to do it with the current syntax.


This is all pretty new (we've only been using it here for about a  
week), so let me know if you have suggestions for it.


ms

On Oct 20, 2006, at 4:01 AM, Cornelius Jaeger wrote:


hi mike

that is way cool.

what would be the preferred way to make standard helper classes  
that everyone can use and subclass, in terms of namespace etc.
i imagine a bunch of standard string helpers and date time  
formatters etc would be useful.
any way to make mixins happen using aop? so i can have my  
StringHelper with a truncate method, mix it into my person class  
and pass it a method parameter, say description, and a length  
parameter, say 20.
and of course for ajax auto increasing id helpers for using id's in  
worepetitions etc. would be very useful.


any thoughts


Cornelius

On 20.10.2006, at 00:41, Mike Schrag wrote:


This addition is part of the WOOGNL framework and should appear in
tonight's build:

=== Overview ===
It is often the case in a WOD file that you want to apply formatters
to various
bindings, but only certain specific components actually support the
concept of
a formatter.

There are several approaches to solving this problem.  One is to
create formatter
methods on your models (i.e, person.displayName() that returns
firstName() + " " + lastName()).
This suffers a design flaw in that you don't want what is essentially
view code in your
models.  Another approach is to define these methods in a
WOComponent, but then you have the
problem that you can't reuse the value very easily (you need it in
every component).  You could
create a new WOComponent that just renders in this format, but then
you can't pass it as the
value to another binding.

Rails addresses this with the concept of a helper function.  Helper
functions are easily reusable
formatting methods for use in your views.  WOHelperFunctionHTMLParser
provides a similar type of
functionality for use in WOD bindings.


=== Example Usage ===
As an example, say you have a Person class and you want a common
display name (like in the example
above).  With WOHelperFunctionHTMLParser, you would do the following:

1) Create a class like the following (in any package):
public class PersonHelper {
public String displayName(Person person) {
return person.firstName() + " " + person.lastName();
}
}

2) In a WOD file:
PersonName : WOString {
value = currentPerson|displayName;
}

(that is a pipe between currentPerson and displayName)

3) Set ognl.helperFunctions=true in your Properties file.

4) Profit.

Likewise you can make StringHelper, BooleanHelper, etc.  You want to
use "yes" or "no" when
you display booleans?

in Java:
public class BooleanHelper {
public String yesNo(Boolean value) {
String yesNoValue;
if (yesNoValue == null || !yesNoValue.booleanValue()) {
yesNoValue = "no";
}
else {
yesNoValue = "yes";
}
}
}

in your WOD:
RandomValue : WOString {
value = currentPerson.isAdmin|yesNo;
}

The above examples use WOString, so /technically/ you could use
formatters for these.  Here's
an example where that wouldn't work out:

HeaderFooter : HeaderFooterWrapper {
title = currentPerson|displayName;
}

The examples here only define a single method, but you can define as
many helper methods inside
of the Helper classes as you'd like.


=== How Does it Work? ===
In the parser stage of loading your WOD file, helper function
bindings are replaced with the
much larger WOOGNL expression that is able to resolve your request,
so behind the scenes this
is using the same OGNL that you know and love.

The helper class to use for a particular value is determined by the
type of object th

Re: stack overflow error

2006-10-20 Thread Ulrich Köster
You could attach a debugger to the deployed application and set a  
exception breakpoint for the StackOverflowError.


Uli
Am 19.10.2006 um 19:37 schrieb Ken Anderson:


I occasionally receive this message on a WO app I have:

com.webobjects.foundation.NSForwardException for  
java.lang.StackOverflowError


It's during some pretty deep recursion, so I would really like to  
expand whatever stack is being used... the problem is, I'm not  
really clear how to do that.  I've tried expanding the stack with - 
Xss, but that doesn't seem to help (and some documentation leads me  
to believe that's for the C stack, not the Java stack).


Has anyone run into this?  Any ideas?

Thanks,
Ken

___
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/ulrich% 
40assense.com


This email sent to [EMAIL PROTECTED]


___
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 archive@mail-archive.com