Re: [Zope-dev] dtml-in batching badly

2001-06-20 Thread Michael Bernstein

seb bacon wrote:
 
 * Joachim Werner [EMAIL PROTECTED] [010618 20:28]:
   That's not the behaviour I'd expect.  Can anyone confirm this is a
   bug?
 
  As LEE Kwan Soo has already said, it is not a bug, but a clever (too
  clever?) feature that should maybe not be enabled by default. Every second
  week or so somebody runs into this and thinks it is a bug.
 
 Thanks for the hint, folks.
 
 I'm not a zope newbie, and this still bit me.  IMO there's something
 fairly wrong with the current setup.  either the default behaviour
 should be changed to orphans=0, or the visibility of default values
 for tags should be improved (from the book: orphan=int The desired
 minimum batch size - no mention of defaults).
 
 Furthermore, the 'feature' doesn't work as I'd expect.  In the example
 I posted, for the sequence (1,2,3,4), I got:
 
  batch 1: 1
  batch 2: 2 3 4
  batch 3: 3 4
  batch 4: 4
 
 This isn't in batches of at least 3... If it were iterating in minimum
 batches of 3, shouldn't that be:
 
  batch 1: 1 2 3
  batch 2: 2 3 4
  batch 3: 2 3 4
  batch 4: 2 3 4

Orphan control shouldn't actually set the desired minimum
batch size, it should set the size at or below which the
last batch should be combined with the next to last batch.

If my batch size is five, and orphan is set to three, and I
have a set of eight records that I am iterating through, I
will get a single eight record batch, because the orphan
setting tries to prevent the last batch having three or less
results by combining them with the previous five.

Orphan settings typically do not override where the batch
starts (that would be a 'widow' setting) only where it ends,
which is why you are getting increasingly smaller batches.

However, the fact that you are getting four batches (rather
than just one) is arguably a bug. A batch size of one,
combined with an orphan setting of three, should actually
give the following result:

 batch 1: 1 2 3 4

But the algorithm doesn't seem 'smart' enough to roll-up the
batches by recursing through them in reverse order. Arguably
though, you should never set your batch size smaller than
the orphan size, so this isn't really an issue.

Michael Bernstein.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] dtml-in batching badly

2001-06-20 Thread Dyon Balding

Michael Bernstein wrote:
 
 But the algorithm doesn't seem 'smart' enough to roll-up the
 batches by recursing through them in reverse order. Arguably
 though, you should never set your batch size smaller than
 the orphan size, so this isn't really an issue.
 

so maybe the dtml batching code should just set the orphans to
the batch size if it is greater than the batch size?  that would
at least eliminate some of the confusion with batching.

-d

-- 
| Dyon Balding . Software Engineer . HiringTools.Monster.com
|   [EMAIL PROTECTED] . +1 415 288 3375

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] dtml-in batching badly

2001-06-19 Thread seb bacon

* Joachim Werner [EMAIL PROTECTED] [010618 20:28]:
  That's not the behaviour I'd expect.  Can anyone confirm this is a
  bug?
 
 As LEE Kwan Soo has already said, it is not a bug, but a clever (too
 clever?) feature that should maybe not be enabled by default. Every second
 week or so somebody runs into this and thinks it is a bug.

Thanks for the hint, folks.

I'm not a zope newbie, and this still bit me.  IMO there's something
fairly wrong with the current setup.  either the default behaviour
should be changed to orphans=0, or the visibility of default values
for tags should be improved (from the book: orphan=int The desired
minimum batch size - no mention of defaults).

Furthermore, the 'feature' doesn't work as I'd expect.  In the example
I posted, for the sequence (1,2,3,4), I got: 

 batch 1: 1
 batch 2: 2 3 4
 batch 3: 3 4
 batch 4: 4

This isn't in batches of at least 3... If it were iterating in minimum
batches of 3, shouldn't that be: 

 batch 1: 1 2 3
 batch 2: 2 3 4
 batch 3: 2 3 4
 batch 4: 2 3 4

It's ugly!

seb


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] dtml-in batching badly

2001-06-18 Thread seb bacon

Hi,

First, I don't post to this list normally; is it the best place to
discuss an apparent bug?  

Anyway, the lowdown:

If you iterate over a list with a batch size of 1, it messes up
towards the end of the sequence.  For example, the following code:

 dtml-call REQUEST.set('hoo',(1,2,3,4))
   dtml-in hoo 
 calling lt;dtml-in hoo size=1 start=dtml-var sequence-itemgt;:br
 dtml-in hoo size=1 start=sequence-item 
   dtml-var sequence-item
 /dtml-in hr
 /dtml-in

produces the following output:

 calling dtml-in hoo size=1 start=1:
 1 

 calling dtml-in hoo size=1 start=2:
 2 3 4 

 calling dtml-in hoo size=1 start=3:
 3 4 

 calling dtml-in hoo size=1 start=4:
 4

That's not the behaviour I'd expect.  Can anyone confirm this is a
bug? 

Cheers,

seb 

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] dtml-in batching badly

2001-06-18 Thread LEE, Kwan Soo

No it's not a bug(in code) but a feature.
May You call it a bug (in usability), though.

What causes it is that the orphan value defaults to 3 when not explicitely set.

See the online help for in tag.

LEE Kwan Soo
¢—ƒzùšŠYb²Öh¥àÞ¿:)zŠà†Ûiÿùb²Û3¢—¨®æj)fjåŠËbú?Ί^uëÍ¡Êè²Êh²Û(¬tÌ-éܡا¥jם–+-²m§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)y©ç¢éÜzm§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)


Re: [Zope-dev] dtml-in batching badly

2001-06-18 Thread Joachim Werner

 That's not the behaviour I'd expect.  Can anyone confirm this is a
 bug?

As LEE Kwan Soo has already said, it is not a bug, but a clever (too
clever?) feature that should maybe not be enabled by default. Every second
week or so somebody runs into this and thinks it is a bug.

To the DC people: Do you think it would break any code badly if the default
behaviour was orphans=0?


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] dtml-in batching badly

2001-06-18 Thread Casey Duncan

Joachim Werner wrote:
 
  That's not the behaviour I'd expect.  Can anyone confirm this is a
  bug?
 
 As LEE Kwan Soo has already said, it is not a bug, but a clever (too
 clever?) feature that should maybe not be enabled by default. Every second
 week or so somebody runs into this and thinks it is a bug.
 
 To the DC people: Do you think it would break any code badly if the default
 behaviour was orphans=0?

Here is a (again perhaps too clever?) suggestion. Make the orphan value
equal zero by default
if size = 3. Otherwise keep it at three.

I'm not oppossed to making it zero all the time either.

-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )