Picon

now macro with dateFormat filter

Hi,

this combination of two core module features doesn't work:
<% now | dateFormat "yyyy" %>

Because dateFormat_filter just handles Date objects but now_macro  
returns a string.
I've update my local copy of dateFormat_filter to create Date objects  
if input is a string.

function dateFormat_filter(input, param, format) {
    var format = param.format || format;
    if (!input) {
       return;
    } else {
       if (typeof input == "string") input = new Date(input);
       return input.format(format);
    }
}

Bye,
Walter

Attachment (smime.p7s): application/pkcs7-signature, 2445 bytes
_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
(Continue reading)

Hannes Wallnoefer | 1 Feb 13:25
Picon
Favicon
Gravatar

Re: now macro with dateFormat filter

Hi Walter,

2008/2/1, Walter Krivanek, VividVisions <walter.krivanek <at> vividvisions.at>:

> I've update my local copy of dateFormat_filter to create Date objects
> if input is a string.

Actually, you can pass a format string to now_macro:

  <% now format="yyyy" %>

If do want the now macro with a filter chain, could just implement a
macro that returns a raw date instead of a formatted string:

function nowdate_macro() {
    return new Date();
}

<% nowdate | ... %>

hannes
Picon

Re: now macro with dateFormat filter

Hi Hannes,

Oh, obviously I couldn't see the wood for the trees, how  
embarrassing. ;-)

Thanks!
Walter

Hannes Wallnoefer (01.02.2008 13:25):

> Hi Walter,
>
> 2008/2/1, Walter Krivanek, VividVisions <walter.krivanek <at> vividvisions.at 
> >:
>
>> I've update my local copy of dateFormat_filter to create Date objects
>> if input is a string.
>
> Actually, you can pass a format string to now_macro:
>
>  <% now format="yyyy" %>
>
> If do want the now macro with a filter chain, could just implement a
> macro that returns a raw date instead of a formatted string:
>
> function nowdate_macro() {
>    return new Date();
> }
>
> <% nowdate | ... %>
(Continue reading)

Kris Leite | 3 Feb 00:07

Question: Is there an easy way to allow app to exchange data?

Sorry, but I could not find in the documentation where two different 
apps can exchange data between them.  The Manage app scans all the apps 
and retrieves information concerning each.  I reviewed the code and 
could duplicate some of it's function but I was hoping there might be an 
easier way to pass data between two running Helma apps.

Thanks for any suggestions,
Kris
Joshua Paine | 3 Feb 01:09

Arc challenge

Paul Graham has a little challenge to show off the terseness of his new 
Lisp dialect.

Here's the original: <http://arclanguage.org/item?id=722>
And here's my go with Helma: <http://arclanguage.org/item?id=1099>

I did learn the difference between res.message and session.message in 
doing it.
Kris Leite | 3 Feb 01:16

Re: Question: Is there an easy way to allow app to exchange data?

One solution that I found was:

var server = Packages.helma.main.Server.getServer();
var dev = server.getApplication('dev');
var devData = dev.getCacheNode();

'devData' now contains a pointer to 'dev' applications data cache 
(app.data).

If there is any easier or better way, please let me know.

Thanks,
Kris

Kris Leite wrote:
> Sorry, but I could not find in the documentation where two different 
> apps can exchange data between them.  The Manage app scans all the apps 
> and retrieves information concerning each.  I reviewed the code and 
> could duplicate some of it's function but I was hoping there might be an 
> easier way to pass data between two running Helma apps.
>
> Thanks for any suggestions,
> Kris
>
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
>
>   
(Continue reading)

Joshua Paine | 3 Feb 01:27

Re: Question: Is there an easy way to allow app to exchange data?

Kris, that seems pretty hazardous. Why not build some simple actions  
to provide access to the data you need, e.g. with JSON, so your apps  
won't be so tightly entangled.

Joshua Paine
LetterBlock: Building the web is child's play
http://letterblock.com/

On Feb 2, 2008, at 7:16 PM, Kris Leite <kleite <at> imcsoftware.com> wrote:

> One solution that I found was:
>
> var server = Packages.helma.main.Server.getServer();
> var dev = server.getApplication('dev');
> var devData = dev.getCacheNode();
>
> 'devData' now contains a pointer to 'dev' applications data cache
> (app.data).
>
> If there is any easier or better way, please let me know.
>
> Thanks,
> Kris
>
>
>
> Kris Leite wrote:
>> Sorry, but I could not find in the documentation where two different
>> apps can exchange data between them.  The Manage app scans all the  
>> apps
(Continue reading)

Kris Leite | 3 Feb 01:33

Re: Question: Is there an easy way to allow app to exchange data?

Hi Joshua,

Good point!  I think you are right, using an URL action is better.

Thanks,
Kris

Joshua Paine wrote:
> Kris, that seems pretty hazardous. Why not build some simple actions  
> to provide access to the data you need, e.g. with JSON, so your apps  
> won't be so tightly entangled.
>
> Joshua Paine
> LetterBlock: Building the web is child's play
> http://letterblock.com/
>
> On Feb 2, 2008, at 7:16 PM, Kris Leite <kleite <at> imcsoftware.com> wrote:
>
>   
>> One solution that I found was:
>>
>> var server = Packages.helma.main.Server.getServer();
>> var dev = server.getApplication('dev');
>> var devData = dev.getCacheNode();
>>
>> 'devData' now contains a pointer to 'dev' applications data cache
>> (app.data).
>>
>> If there is any easier or better way, please let me know.
>>
(Continue reading)

Chris Zumbrunn | 3 Feb 12:07
Gravatar

Re: Arc challenge


On Feb 3, 2008, at 1:09 , Joshua Paine wrote:

> Paul Graham has a little challenge to show off the terseness of his  
> new
> Lisp dialect.
>
> Here's the original: <http://arclanguage.org/item?id=722>
> And here's my go with Helma: <http://arclanguage.org/item?id=1099>
>
> I did learn the difference between res.message and session.message in
> doing it.

Or even simpler:

res.write(
     (session.message = req.data.say)
         ? <p><a href={this.href()}>click here</a></p>
         : res.message
             ? <p>you said: {res.message}</p>
             : <form method="post">
                   <input name="say"/>
                   <input type="submit"/>
               </form>
)

Chris
Hannes Wallnoefer | 4 Feb 11:42
Picon
Favicon
Gravatar

Re: Arc challenge

2008/2/3, Joshua Paine <joshua <at> papercrown.org>:
> Paul Graham has a little challenge to show off the terseness of his new
> Lisp dialect.
>
> Here's the original: <http://arclanguage.org/item?id=722>
> And here's my go with Helma: <http://arclanguage.org/item?id=1099>

Very interesting. I took the occasion to have a look at the Arc
tutorial. As you'd expect, the Arc web framework (if you can already
call it a framework) is quite callback-centric, similar to Seaside.

Since Gobi's Markup.jus actually supports callbacks I tried to come up
with an implementation that actually works along the lines of the arc
example. I had to extend and fix Markup.js, but here's the (working)
result:

function said_action() {
   Html.form({
       callback: function() {
         var foo = req.data.foo;
         Html.link({
           callback: function() { res.write("you said: " + foo); }
         }, "click here")}},
     Html.Input({name: "foo"}),
     Html.Submit()
  );
}

hannes

(Continue reading)


Gmane