ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Madunic <haj...@imag.net>
Subject Re: AW: random number generator
Date Tue, 24 Jul 2007 13:42:04 GMT
Thanks.

I've seen a few posts regarding antelope. Where can I down load the latest copy.
I've googled it but was uncertain which was the latest release.

Thanks

Mario

Quoting Dale Anson <danson@grafidog.com>:

> Yet another option, use the math task from antelope 
> (http://antelope.tigris.org).  Here's an example from the docs:
> 
>     <!-- demo calculating a random number between 0 and 100 -->
>     <math result="result">
>         <op op="rint">
>             <op op="*">
>                 <num value="100"/>
>                 <op op="random"/>
>             </op>
>         </op>
>     </math>
>     <echo>a random number between 0 and 100: ${result}</echo>
> 
> 
> Dale
> 
> 
> Jan.Materne@rzf.fin-nrw.de wrote:
> > <project>
> >     <tempfile property="temp.dir"/>
> >     <mkdir dir="${temp.dir}"/>
> > </project>    
> >
> > Jan 
> >
> >   
> >> -----Ursprüngliche Nachricht-----
> >> Von: Mario Madunic [mailto:hajduk@imag.net] 
> >> Gesendet: Samstag, 21. Juli 2007 16:25
> >> An: Ant Users List
> >> Betreff: Re: random number generator
> >>
> >> Thank you Gilbert,
> >>
> >> it works like a charm.
> >>
> >> Mario
> >>
> >> Quoting Gilbert Rebhan <ant@schillbaer.de>:
> >>
> >>     
> >>> Hi,
> >>>
> >>> Mario Madunic wrote:
> >>>       
> >>>> Hi,
> >>>>
> >>>> I'm trying to generate a random number to be used as a 
> >>>>         
> >> temporary directory
> >>     
> >>> name
> >>>       
> >>>> through a multi step xslt process. I'm using Ant 1.6.5 and 
> >>>>         
> >> Java 1.6.0-b105
> >>     
> >>>> I receive the following error
> >>>>
> >>>>    [random] Jul 20, 2007 9:11:27 PM org.apache.bsf.BSFManager exec
> >>>>    [random] SEVERE: Exception :
> >>>>    [random] java.security.PrivilegedActionException:
> >>>> org.apache.bsf.BSFException: JavaScript Error: Internal Error:
> >>>> org.mozilla.javascript.EcmaError: ReferenceError: "self" 
> >>>>         
> >> is not defined.
> >>     
> >>> if you're already use BSF with <script> task i would recommend
> >>> JRuby, get the JRuby.jar from =
> >>>
> >>> http://dist.codehaus.org/jruby/jruby-complete-1.0.jar
> >>>
> >>> so it's a simple as =
> >>>
> >>> <target name="depends">
> >>>    <script language="ruby">
> >>>    <![CDATA[
> >>>      $project.setProperty "myrand", rand(4711).to_s
> >>>    ]]>
> >>>    </script>
> >>> </target>
> >>>
> >>> <target name="main" depends="depends">
> >>>    <echo>
> >>>      $${myrand} == ${myrand}
> >>>    </echo>
> >>> </target>
> >>>
> >>> main:
> >>>       [echo] ${myrand} == 718
> >>> BUILD SUCCESSFUL
> >>> Total time: 1 second
> >>>
> >>> Just put an integer to the Kernel#rand method.
> >>> If you want a floating point number, just use
> >>> rand without (integer) =
> >>>
> >>> <script language="ruby">
> >>>    <![CDATA[
> >>>      $project.setProperty "myrand", rand.to_s
> >>>    ]]>
> >>>   </script>
> >>>
> >>>
> >>> Regards, Gilbert
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >>> For additional commands, e-mail: user-help@ant.apache.org
> >>>
> >>>
> >>>       
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> >> For additional commands, e-mail: user-help@ant.apache.org
> >>
> >>
> >>     
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message