Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  Small problems with Yaws.

Guest
Posted: Mon Apr 14, 2008 6:56 am Reply with quote
Guest
Hi,
1):
I can't get this small example working:
ab.html:
<html>
<body>
<form action="/ab.yaws"
method="post"
<p> Input data for sun position calculation:<br>
A1 = <input name="a1" type="text" value="3.14159"><br>
A2 = <input name="a2" type="text" value="2.71828"><br>
<input type="submit">
</p>
</form>
</body>
</html>

ab.yaws:
<html>
<body>
<erl>
kv(K,L) ->
{value, {K, V}} = lists:keysearch(K,1,L), V.

out(A) ->
L = yaws_api:parse_post(A),
A1 = kv("a1", L),
A2 = kv("a2", L),
S = A1 + A2,
P = A1*A2,
{html, io_lib:format("A1 + A2 = ~s - A1 x A2 = ~s", [S,P])}.
</erl>
</body>
</html>

I get a "badarith" error. I think Yaws is treating the variables as
strings and not as float but I couldn't solve it.

2):
How to disable the cache of Yaws so I don't have to reload the same page
many times before seeing the changes?
Thank you!
--
***
Jilani KHALDI
http://www.dotpas.org

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Mon Apr 14, 2008 7:23 am Reply with quote
Guest
Jilani Khaldi wrote:
> Hi,
> 1):
> I can't get this small example working:
> ab.html:
> <html>
> <body>
> <form action="/ab.yaws"
> method="post"
> <p> Input data for sun position calculation:<br>
> A1 = <input name="a1" type="text" value="3.14159"><br>
> A2 = <input name="a2" type="text" value="2.71828"><br>
> <input type="submit">
> </p>
> </form>
> </body>
> </html>
>
> ab.yaws:
> <html>
> <body>
> <erl>
> kv(K,L) ->
> {value, {K, V}} = lists:keysearch(K,1,L), V.
>
> out(A) ->
> L = yaws_api:parse_post(A),
> A1 = kv("a1", L),
> A2 = kv("a2", L),
> S = A1 + A2,
> P = A1*A2,
> {html, io_lib:format("A1 + A2 = ~s - A1 x A2 = ~s", [S,P])}.
> </erl>
> </body>
> </html>
>
> I get a "badarith" error. I think Yaws is treating the variables as
> strings and not as float but I couldn't solve it.

yes. use list_to_float() BIF.

> 2):
> How to disable the cache of Yaws so I don't have to reload the same page
> many times before seeing the changes?

set the #gconf field

cache_refresh_secs = 0


--
vlm

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Mon Apr 14, 2008 12:26 pm Reply with quote
Guest
Lev Walkin wrote:

>> 2):
>> How to disable the cache of Yaws so I don't have to reload the same page
>> many times before seeing the changes?
>
> set the #gconf field
>
> cache_refresh_secs = 0

During development one typically use the -i flag, that implies
cache_refresh_secs = 0

/klacke

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Mon Apr 14, 2008 1:00 pm Reply with quote
Guest
Claes Wikstr

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum