Hannes Wallnoefer | 8 Sep 21:52
Picon
Gravatar

new experimental object.dontEnum() function

I just committed support for a new dontEval() function on the Object
prototype. Calling this with a variable number of string arguments
will cause the DONTENUM attribute to be set on the given properties so
they won't be included in for..in loops on the object.

This will be very useful when we extend standard prototypes like
Object.prototype and Array.prototype in helmaLib. Some example code:

    var obj = {foo: "bar", bar: "foo"};
    obj.dontEnum("bar", "foo");
    for (var i in obj)
        res.debug(i);

Some closer to real world sample code might look like this:

   Array.prototype.indexOf = function(obj) { ... }
   Array.prototype.lastIndexOf = function(obj) { ... }

   Array.prototype.dontEnum("indexOf", "lastIndexOf");

Should we use some more frightening name, such as __dontenum__() to
underscore the non-standardness of this feature?

hannes
Hannes Wallnoefer | 16 Sep 02:43
Picon
Gravatar

Fixes in Java object script wrapping code

I just fixed two bugs related to wrapping/extending Java objects in
Helma (see <http://helma.org/docs/properties/class.properties/>):

* class names in class.properties may now be superclasses or
interfaces of actual classes.

* Helma prototype inheritance now works for prototypes that
wrap/extend Java objects.

have fun,
Hannes
Hannes Wallnoefer | 16 Sep 11:18
Picon
Gravatar

res.writeln()

I made a small change in res.writeln() to make it for non-HTML
documents. The <br /> tag is only appended to the line if the content
type is either the standard "text/html" or "application/xhtml+xml",
which is the recommended content type for serving XHTML. Otherwise,
just a plain newline character will be appended to the line.

This makes res.writeln() useful for non-HTML, non-XHTML documents.
Hope this is useful to you. If there is another (X)HTML content type I
forgot please let me know!

hannes
Juerg Lehni | 16 Sep 11:24
Gravatar

Re: res.writeln()

Is there a function I could use if I'm writing HTML code and I would  
like to have a line break in the HTML code, but without the <br /> ?

Somehow I would expect writeln to allwas only do this, regardless of  
the content type.

Jürg

Am 16.09.2005 um 11:18 schrieb Hannes Wallnoefer:

> I made a small change in res.writeln() to make it for non-HTML
> documents. The <br /> tag is only appended to the line if the content
> type is either the standard "text/html" or "application/xhtml+xml",
> which is the recommended content type for serving XHTML. Otherwise,
> just a plain newline character will be appended to the line.
>
> This makes res.writeln() useful for non-HTML, non-XHTML documents.
> Hope this is useful to you. If there is another (X)HTML content type I
> forgot please let me know!
>
> hannes
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
>
Chris Zumbrunn | 16 Sep 11:43
Gravatar

Re: res.writeln()

On Sep 16, 2005, at 11:24 AM, Juerg Lehni wrote:

> Is there a function I could use if I'm writing HTML code and I would 
> like to have a line break in the HTML code, but without the <br /> ?
>
> Somehow I would expect writeln to allwas only do this, regardless of 
> the content type.

In OpenMocha I added a method to the String prototype for this:

"Hello World".crlf()

I could make that part of the new helmaLib.

Chris
Hannes Wallnoefer | 16 Sep 12:52
Picon
Gravatar

Re: res.writeln()

2005/9/16, Chris Zumbrunn <chris <at> zumbrunn.com>:
> On Sep 16, 2005, at 11:24 AM, Juerg Lehni wrote:
> 
> > Is there a function I could use if I'm writing HTML code and I would
> > like to have a line break in the HTML code, but without the <br /> ?
> >
> > Somehow I would expect writeln to allwas only do this, regardless of
> > the content type.

If I could choose again I would implement it that way. Alas, changing
this now would break too much application code. Or would it?

> In OpenMocha I added a method to the String prototype for this:
> 
> "Hello World".crlf()
> 
> I could make that part of the new helmaLib.

 I don't like the idea of creating a new String object just for the
purpose of appending newline characters. For the purpose of writeln(),
I think writeln() is both more intuitive and efficient. Do you have a
use for this outside the writeln scenario?

hannes
Hannes Wallnoefer | 16 Sep 13:07
Picon
Gravatar

Re: res.writeln()

2005/9/16, Hannes Wallnoefer <hannesw <at> gmail.com>:
> > On Sep 16, 2005, at 11:24 AM, Juerg Lehni wrote:
> >
> > > Is there a function I could use if I'm writing HTML code and I would
> > > like to have a line break in the HTML code, but without the <br /> ?
> > >
> > > Somehow I would expect writeln to allwas only do this, regardless of
> > > the content type.
> 
> If I could choose again I would implement it that way. Alas, changing
> this now would break too much application code. Or would it?

Ok, I'm willing to make that switch. The change to explicitly write
out any <br> or <br /> tags in the app is really trivial, and this
really was a hack in the first place.

But let's do some survey first: Antville doesn't seem to use
res.writeln() at all. Gobi uses it quite a bit, but that's ok. The
manage app uses it only once. What about your apps? How bad would
semantically changing res.writeln() hit your apps?

Hannes
Stefan Rinner | 16 Sep 13:42
Picon

Re: res.writeln()

>
> But let's do some survey first: Antville doesn't seem to use
> res.writeln() at all. Gobi uses it quite a bit, but that's ok. The
> manage app uses it only once. What about your apps? How bad would
> semantically changing res.writeln() hit your apps?

just grepped through my helma folders and it seems that more or less  
all my uses of res.writeln() are for debugging or some small tests  
and experiments, so it wouldn't be a big problem for me

- stefan
Paul Alexandrow | 16 Sep 14:11
Picon

Re: res.writeln()

The helma applications I'm working with (including twoday and derivatives) 
only contain a handful res.writelns. Not to much of a problem.

And btw: I'm ++ for that switch anyways.

-paul

----- Original Message ----- 
From: "Hannes Wallnoefer" <hannesw <at> gmail.com>
To: <helma-user <at> helma.org>
Sent: Friday, September 16, 2005 1:07 PM
Subject: Re: [Helma-user] res.writeln()

2005/9/16, Hannes Wallnoefer <hannesw <at> gmail.com>:
> > On Sep 16, 2005, at 11:24 AM, Juerg Lehni wrote:
> >
> > > Is there a function I could use if I'm writing HTML code and I would
> > > like to have a line break in the HTML code, but without the <br /> ?
> > >
> > > Somehow I would expect writeln to allwas only do this, regardless of
> > > the content type.
>
> If I could choose again I would implement it that way. Alas, changing
> this now would break too much application code. Or would it?

Ok, I'm willing to make that switch. The change to explicitly write
out any <br> or <br /> tags in the app is really trivial, and this
really was a hack in the first place.

But let's do some survey first: Antville doesn't seem to use
(Continue reading)

Chris Zumbrunn | 16 Sep 14:16
Gravatar

Re: res.writeln()

On Sep 16, 2005, at 2:11 PM, Paul Alexandrow wrote:

> The helma applications I'm working with (including twoday and 
> derivatives) only contain a handful res.writelns. Not to much of a 
> problem.
>
> And btw: I'm ++ for that switch anyways.

No problem for me either. I'm not using writeln() at all.

Chris

Gmane