You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by fa...@pipoware.com on 2002/08/14 11:35:29 UTC

VeloGUI : A GUI for testing velocity script in real time

Hi,

I've made a simple Swing application for testing velocity script
without any writing/compiling code.
I found it very usefull (but I'm a little bit biased :-) for testing some
syntax and others velocity behaviours without coding anything.


It's a Java Web Start application, so no need to install anything.
Just try it online : http://pipoware.free.fr/velogui.


For the curious:
It's a Swing application with 3 windows.
You put some *simple* java code in the first window for adding object
to a velocity context. The 'context' is a predefined variable.
The dynamic interpreting is made by using BeanShell (http://www.beanshell.org).
The second window is the velocity script. By pushing the 'Merge' button,
you can see the result in the third window.
Ex.:
In the Java code window type 'context.put('name','Velocity');'
In Velocity script window type 'Hello, $name is great !'
Push the merge button
You'll see in the Merge window: Hello, Velocity is great !


PS: This my first *public* application, so I'm really appreciate
any sort of feedback :-)

PSS: you'll find other examples at the end

Franck Arnulfo

-----------------------------------------
v = new ArrayList();
v.add('one');
v.add('two');
v.add('three');
context.put('v',v);
context.put('name','Velocity');
-----------------------------------------
## This is velocity template script

Size of the array : $v.size()

#foreach ($e in $v)
$e
#end
Hello, $name is great !

#set( $a = 'Jakarta' )

Reference: $a

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: VeloGUI : A GUI for testing velocity script in real time

Posted by Gabriel Sidler <si...@teamup.com>.
Hey, this a cool tool to experiment with VTL scripts!
Distribution via Java Web Start is cool, too! I see
many other potential uses.

Great work. Thanks for sharing this.
Gabe

PS:
The example you gave in your email didn't run right away.
I needed to change the single quotes to double quotes to
make bean shell happy.

-----------------------------------------
v = new ArrayList();
v.add("one");
v.add("two");
v.add("three");
context.put("v",v);
context.put("name","Velocity");
-----------------------------------------


fa1@pipoware.com wrote:

> Hi,
> 
> I've made a simple Swing application for testing velocity script
> without any writing/compiling code.
> I found it very usefull (but I'm a little bit biased :-) for testing some
> syntax and others velocity behaviours without coding anything.
> 
> 
> It's a Java Web Start application, so no need to install anything.
> Just try it online : http://pipoware.free.fr/velogui.
> 
> 
> For the curious:
> It's a Swing application with 3 windows.
> You put some *simple* java code in the first window for adding object
> to a velocity context. The 'context' is a predefined variable.
> The dynamic interpreting is made by using BeanShell (http://www.beanshell.org).
> The second window is the velocity script. By pushing the 'Merge' button,
> you can see the result in the third window.
> Ex.:
> In the Java code window type 'context.put('name','Velocity');'
> In Velocity script window type 'Hello, $name is great !'
> Push the merge button
> You'll see in the Merge window: Hello, Velocity is great !
> 
> 
> PS: This my first *public* application, so I'm really appreciate
> any sort of feedback :-)
> 
> PSS: you'll find other examples at the end
> 
> Franck Arnulfo
> 
> -----------------------------------------
> v = new ArrayList();
> v.add('one');
> v.add('two');
> v.add('three');
> context.put('v',v);
> context.put('name','Velocity');
> -----------------------------------------
> ## This is velocity template script
> 
> Size of the array : $v.size()
> 
> #foreach ($e in $v)
> $e
> #end
> Hello, $name is great !
> 
> #set( $a = 'Jakarta' )
> 
> Reference: $a
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: VeloGUI : A GUI for testing velocity script in real time

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 8/14/02 5:35 AM, "fa1@pipoware.com" <fa...@pipoware.com> wrote:

> Hi,
> 
> I've made a simple Swing application for testing velocity script
> without any writing/compiling code.
> I found it very usefull (but I'm a little bit biased :-) for testing some
> syntax and others velocity behaviours without coding anything.
> 
> 
> It's a Java Web Start application, so no need to install anything.
> Just try it online : http://pipoware.free.fr/velogui.
> 

[SNIP]

> 
> PS: This my first *public* application, so I'm really appreciate
> any sort of feedback :-)

How's this then :

  YEAH!!  This is cool!

Some notes :

1) I assume you won't mind if we add to our "Powered by" page and announce
on the Vel website?

2) There is a misspelling : whithout

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: VeloGUI : A GUI for testing velocity script in real time

Posted by Tim Colson <tc...@cisco.com>.
Neat little app and good use of java web start. :-)

Here's a tiny suggestion, perhaps change the label from "Velocity Code"
to "Velocity Template"?

Tim


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Velocity and Piped IO

Posted by "technosf@speakeasy.net" <te...@speakeasy.net>.
Hello All,

I was wondering if anyone has experiance using template output as input to another process/stream? 

I am trying to use pipedIO, used pretty much as described in the Sun tutorials:

            PipedWriter pipeOut = null;
        	PipedReader pipeIn = null;      
  
	pipeOut = new PipedWriter();
            pipeIn = new PipedReader(pipeOut);

            PrintWriter out = new PrintWriter(pipeOut);

My procedure recycles a VelocityWriter on  'out', [trys to] merge the template, returning 'pipeIn'. In testing everything works fine if I recycle the VelocityWriter on StringWriter, but chokes on the PrintWriter, or anything else, instatiated on the PipedWriter. Death occurs at the merge.


Any thoughts?



Thanks in advance...

Martin 







--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Performance of Separate Instance vs Singleton ?

Posted by Stephen Riek <st...@yahoo.co.uk>.
Thanks for the confirmation and speedy reply, Geir. Set my mind at ease.
Stephen.
 "Geir Magnusson Jr." <ge...@adeptra.com> wrote:

On Monday, November 11, 2002, at 10:26 PM, Stephen Riek wrote:

>
> I may be misunderstanding the Velocity architecture. When
> used as a singleton in a website where almost all pages/requests
> use Velocity templates, would the Velocity engine then become
> the limiting factor or bottleneck since there may be many
> simultaneous requests but only one Velocity Engine to handle
> them ?

No - it just means that any usages of Velocity w/in the same JVM will 
share the same instance, which really boils down to the same 
configuration and resources (such as cached templates...). [This 
doesn't apply when using Velocity in a servlet 2.2+ container where the 
velocity jar is in each webapp, and there is more than one webapp, but 
this is a fine point...]



> The Separate Instance docs state that "New in version 1.2, the
> separate instance allows you to create, configure and use as
> many instances of Velocity as you wish in the same JVM (or web
> application.) " This means that I could create, say, 10 Velocity
> engines, but how do I direct the servlets to share these in
> much the same was as a database connection pool will be shared
> between several threads ?

No need. The reason why you would do this is to keep those 
webapps/servlets from using the same set of cached templates, or if you 
wanted each to have a different configuration.

There are places where access is synchronized to resources, but 
compared to the cost of processing requests or rendering, the overhead 
of such serialization should be negligeable.

-- 
Geir Magnusson Jr 203-355-2219(w)
Adeptra, Inc. 203-247-1713(m)
geirm@adeptra.com


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 





---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.

Re: Performance of Separate Instance vs Singleton ?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Monday, November 11, 2002, at 10:26 PM, Stephen Riek wrote:

>
> I may be misunderstanding the Velocity architecture. When
> used as a singleton in a website where almost all pages/requests
> use Velocity templates, would the Velocity engine then become
> the limiting factor or bottleneck since there may be many
> simultaneous requests but only one Velocity Engine to handle
> them ?

No - it just means that any usages of Velocity w/in the same JVM will 
share the same instance, which really boils down to the same 
configuration and resources (such as cached templates...).  [This 
doesn't apply when using Velocity in a servlet 2.2+ container where the 
velocity jar is in each webapp, and there is more than one webapp, but 
this is a fine point...]

> The Separate Instance docs state that "New in version 1.2, the
> separate instance allows you to create, configure and use as
> many instances of Velocity as you wish in the same JVM (or web
> application.) "  This means that I could create, say, 10 Velocity
> engines, but how do I direct the servlets to share these in
> much the same was as a database connection pool will be shared
> between several threads ?

No need.  The reason why you would do this is to keep those 
webapps/servlets from using the same set of cached templates, or if you 
wanted each to have a different configuration.

There are places where access is synchronized to resources, but 
compared to the cost of processing requests or rendering, the overhead 
of such serialization should be negligeable.

-- 
Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)
geirm@adeptra.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Performance of Separate Instance vs Singleton ?

Posted by Stephen Riek <st...@yahoo.co.uk>.
I may be misunderstanding the Velocity architecture. When 
used as a singleton in a website where almost all pages/requests
use Velocity templates, would the Velocity engine then become
the limiting factor or bottleneck since there may be many 
simultaneous requests but only one Velocity Engine to handle
them ? 
The Separate Instance docs state that "New in version 1.2, the 
separate instance allows you to create, configure and use as 
many instances of Velocity as you wish in the same JVM (or web 
application.) "  This means that I could create, say, 10 Velocity
engines, but how do I direct the servlets to share these in 
much the same was as a database connection pool will be shared
between several threads ? 
Thank you very much,
Stephen




---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.

RE: VeloGUI : A GUI for testing velocity script in real time

Posted by Peter Romianowski <me...@gmx.de>.
What a cool idea! This could simplify testing for huge
applications. One "enhancement" would come into my mind:
Could you add a load/save-dialogue for both the beanshell
skript and the template?

Keep on working on this! It rocks!

cheers,
Peter

-----Original Message-----
From: fa1@pipoware.com [mailto:fa1@pipoware.com] 
Sent: Wednesday, August 14, 2002 11:35 AM
To: velocity-user@jakarta.apache.org
Subject: VeloGUI : A GUI for testing velocity script in real time


Hi,

I've made a simple Swing application for testing velocity script
without any writing/compiling code.
I found it very usefull (but I'm a little bit biased :-) for testing
some
syntax and others velocity behaviours without coding anything.


It's a Java Web Start application, so no need to install anything.
Just try it online : http://pipoware.free.fr/velogui.


For the curious:
It's a Swing application with 3 windows.
You put some *simple* java code in the first window for adding object
to a velocity context. The 'context' is a predefined variable.
The dynamic interpreting is made by using BeanShell
(http://www.beanshell.org).
The second window is the velocity script. By pushing the 'Merge' button,
you can see the result in the third window.
Ex.:
In the Java code window type 'context.put('name','Velocity');'
In Velocity script window type 'Hello, $name is great !'
Push the merge button
You'll see in the Merge window: Hello, Velocity is great !


PS: This my first *public* application, so I'm really appreciate
any sort of feedback :-)

PSS: you'll find other examples at the end

Franck Arnulfo

-----------------------------------------
v = new ArrayList();
v.add('one');
v.add('two');
v.add('three');
context.put('v',v);
context.put('name','Velocity');
-----------------------------------------
## This is velocity template script

Size of the array : $v.size()

#foreach ($e in $v)
$e
#end
Hello, $name is great !

#set( $a = 'Jakarta' )

Reference: $a

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>