erlangweb-users Mailing List for Erlang Web (Page 3)
Brought to you by:
etcerlangweb,
paulgray
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(40) |
Dec
(25) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(7) |
Feb
(17) |
Mar
(10) |
Apr
(3) |
May
(10) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
(12) |
Oct
(9) |
Nov
(11) |
Dec
(7) |
| 2010 |
Jan
(3) |
Feb
(10) |
Mar
(18) |
Apr
(20) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Graeme D. <gra...@gm...> - 2010-03-20 03:38:04
|
Hi,
I am sure everyone else is displaying dates fine, so it must be me,
but I have tried all the combinations i can think of.
The data in my database looks good (as io:format-ed after reading) but
displays as an integer.
My _types record contains this:
dob = {date,[{format, "YYYY-MM-DD"},
{description, "Date of Birth"}]}
and my html looks thusly:
<p>date of birth: <wpart:lookup key="player:dob" format="date" /></p>
but the display is just a number :
date of birth: 61661174400
i.e. the date in seconds.
What am i doing wrong?
Thanks,
graeme
|
|
From: Jeffm <je...@gh...> - 2010-03-19 05:33:18
|
Alright folks I'm an idiot. I must have started a copy in the
background with the bin/start script and it was the one answering
requests. It wasn't until I tried the trace that you suggested below
that I notice that I wasn't getting requests to the instance I was
looking at. Thanks.
I did notice one thing while debugging. If you don't have the brackets
in the regexp in the dispatch.conf file balanced and attempt to start
erlang-web, say via bin/start_interactive, you get something like
=PROGRESS REPORT==== 19-Mar-2010::11:58:36 ===
application: inets
started_at: nonode@nohost
{"init terminating in
do_boot",{badarg,[{e_conf,dbms,0},{e_db,start,0},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
The first time this occurred there was a list of integers in the
erl_crash.dump which happened to decode to an erlang error. This can
also be seen in the log messages on screen once you know what your
looking for but can still be hard to see.
For example,
exception exit: {bad_return,
{{eptic,start,[normal,[]]},
{'EXIT',
{{badmatch,{error,{"unmatched
parentheses",24}}},
[{e_dispatcher,divide,3},
{e_dispatcher,install,0},
{lists,foreach,2},
{eptic,start_link,0},
{application_master,start_it_old,4}]}}}}
If possible I'd like to put in a feature request that this error be
caught and a meaningful error displayed.
Jeff.
On 19/03/10 12:18 AM, Roberto Aloi wrote:
> You might want to debug what's happening behind the scenes.
> In Erlang, it's extremely easy to trace functions, so that you can check
> which function has been called, when, and what it's returning.
>
> In your case, you might be interested in the function:
> e_dispatcher:dispatch/1
>
> Tracing functions will help you (a lot!) in understanding how the whole
> Erlang Web framework works.
>
> For more information on how to trace Erlang functions, have a look to
> this quick reference:
> http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/
>
> Regards,
>
> Roberto Aloi
>
>
|
|
From: Roberto A. <rob...@er...> - 2010-03-18 13:36:52
|
On 03/18/2010 08:37 AM, Elena Bobrova wrote:
> hmm...
> This rule in dispatch.conf
>
> {dynamic, "^/item/show/(?<id>[0-9]+)$", {browser, show_item}}.
>
> does not work for me for "/item/show/1".
>
> You can try this one:
> {dynamic, "^/item/show/([0-9]+)$", {browser, show_item}}.
You might want to keep that "id", since it could be extremely helpful.
In your controller, you'll be able to refer easily to that parameter by
name, instead of scanning the list of all available arguments.
Cheers,
Roberto Aloi
--
University of Kent - Erlang Solutions Ltd.
Twitter: @prof3ta
Blog: http://aloiroberto.wordpress.com
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: Roberto A. <rob...@er...> - 2010-03-18 13:36:52
|
On 03/18/2010 07:43 AM, Jeffm wrote: > Following the tutorial at > > http://wiki.erlang-web.org/Tutorial/Step1_Setup > > with release 1.4 of erlang web. I get up to testing /item/show/1 but I > get a 404 in the web browser. My first suspicions was that I'd mistyped > the dispatch rules in dispatch.conf, so I cut and pasted them from the > tutorial then restarted erlang web. I also added an io:format/2 to the > browser:show_item/1 to see if it at lest made it this far...doesn't > appear that it does. The log says, > > e_mod_gen module, error: 404: "/item/show/1" > > What should I check next? You might want to debug what's happening behind the scenes. In Erlang, it's extremely easy to trace functions, so that you can check which function has been called, when, and what it's returning. In your case, you might be interested in the function: e_dispatcher:dispatch/1 Tracing functions will help you (a lot!) in understanding how the whole Erlang Web framework works. For more information on how to trace Erlang functions, have a look to this quick reference: http://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/ Regards, Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Twitter: @prof3ta Blog: http://aloiroberto.wordpress.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: Elena B. <ele...@gm...> - 2010-03-18 08:37:11
|
hmm...
This rule in dispatch.conf
{dynamic, "^/item/show/(?<id>[0-9]+)$", {browser, show_item}}.
does not work for me for "/item/show/1".
You can try this one:
{dynamic, "^/item/show/([0-9]+)$", {browser, show_item}}.
On Thu, Mar 18, 2010 at 9:43 AM, Jeffm <je...@gh...> wrote:
> Following the tutorial at
>
> http://wiki.erlang-web.org/Tutorial/Step1_Setup
>
> with release 1.4 of erlang web. I get up to testing /item/show/1 but I
> get a 404 in the web browser. My first suspicions was that I'd mistyped
> the dispatch rules in dispatch.conf, so I cut and pasted them from the
> tutorial then restarted erlang web. I also added an io:format/2 to the
> browser:show_item/1 to see if it at lest made it this far...doesn't
> appear that it does. The log says,
>
> e_mod_gen module, error: 404: "/item/show/1"
>
> What should I check next?
>
> thanks,
> Jeff.
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Erlangweb-users mailing list
> Erl...@li...
> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> http://www.erlang-web.org/
>
|
|
From: Jeffm <je...@gh...> - 2010-03-18 07:59:22
|
Following the tutorial at http://wiki.erlang-web.org/Tutorial/Step1_Setup with release 1.4 of erlang web. I get up to testing /item/show/1 but I get a 404 in the web browser. My first suspicions was that I'd mistyped the dispatch rules in dispatch.conf, so I cut and pasted them from the tutorial then restarted erlang web. I also added an io:format/2 to the browser:show_item/1 to see if it at lest made it this far...doesn't appear that it does. The log says, e_mod_gen module, error: 404: "/item/show/1" What should I check next? thanks, Jeff. |
|
From: Gilbert R. <erl...@la...> - 2010-03-01 13:06:27
|
On Fri, Feb 26, 2010 at 11:02:27AM +0000, Piotr Kaleta wrote: > Hi Gilbert, > > I have just committed a patch which is solving the issue with keys not found in the dict: http://bitbucket.org/etc/erlang-web/changeset/b84207bf52bb/. > We didn't want to store keys in the dictionary as atoms to prevent user from creating lots of atoms in controller, which could result in system running out of memory and a crash. > Thank you for pointing out that issue and good luck with your further erlang-web development! > Thank you, your patch works fine. Regards. |
|
From: Piotr K. <pi...@er...> - 2010-02-26 11:02:48
|
Hi Gilbert, I have just committed a patch which is solving the issue with keys not found in the dict: http://bitbucket.org/etc/erlang-web/changeset/b84207bf52bb/. We didn't want to store keys in the dictionary as atoms to prevent user from creating lots of atoms in controller, which could result in system running out of memory and a crash. Thank you for pointing out that issue and good luck with your further erlang-web development! Kind regards, Piotr Kaleta ----- "Gilbert Roulot" <erl...@la...> wrote: > On Tue, Feb 23, 2010 at 08:23:42AM +0000, Michal Ptaszek wrote: > > > > You're welcome. > > > > > > I found another issue with DTL. When I use {{ variable }} in a > > > template, > > > and set the value with wpart:fset("variable", "Hello"). Erlydtl > > > doesn't find > > > it. > > > > ... > > > > Which version of erlydtl are you using? > > > > The one that is bundled with standard Erlang Web contains a patch > > for erlydtl_runtime: when accessing the request dictionary, the > > key will be first transformed into a string, an if the value is not > > found, the original atom will be used (erlydtl_runtime:18). > > > Hello, > > I am using erlydtl 0.5.3. I do see the code around line 18, but in my > case find_value at line 5 is used or fetch_value at line 38. Both > fail. > > > fetch_value is called by the use of {{ hello }} > fetch_value(Key, Data) -> > case find_value(Key, Data) of > undefined -> > throw({undefined_variable, Key}); > Val -> > Val > end. > > Key: hello > Data: [{"get",[]}, > {"__https",false}, > {"__ip",{194,79,152,115}}, > {"__cookies", > [{"eptic_cookie","nonode@nohost-9933714052825178113"}]}, > {"session",[]}, > {"__path",[]}, > {"__cookie_key","nonode@nohost-9933714052825178113"}, > {"__controller",front}, > {"hello","Hello world!"}] > > find_value at line 5 is called when using {% if hello %} Hello {% > endif %} > find_value(Key, L) when is_list(L) -> > proplists:get_value(Key, L); > > Key: hello > L: [{"get",[]}, > {"__https",false}, > {"__ip",{194,79,152,115}}, > {"__cookies", > [{"eptic_cookie","nonode@nohost-9933714052825178113"}]}, > {"session",[]}, > {"__path",[]}, > {"__cookie_key","nonode@nohost-9933714052825178113"}, > {"__controller",front}, > {"hello","Hello world!"}] > > > Here's the relevant controller code: > index(_Args) -> > wpart:fset("hello", "Hello world!"), > {template, "test/index.html"}. > > And the template > <html> > <head> > </head> > <body> > <h1> {% if hello %} Hello ! {% endif %}</h1> > </body> > </html> > > > > This is on a fresh install, downloaded with > hg clone https://bitbucket.org/etc/erlang-web/ > > > > Regards > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Erlangweb-users mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlangweb-users > http://www.erlang-web.org/ --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: Gilbert R. <erl...@la...> - 2010-02-24 17:02:59
|
On Tue, Feb 23, 2010 at 08:23:42AM +0000, Michal Ptaszek wrote:
> > You're welcome.
> >
> > I found another issue with DTL. When I use {{ variable }} in a
> > template,
> > and set the value with wpart:fset("variable", "Hello"). Erlydtl
> > doesn't find
> > it.
> >
...
>
> Which version of erlydtl are you using?
>
> The one that is bundled with standard Erlang Web contains a patch
> for erlydtl_runtime: when accessing the request dictionary, the
> key will be first transformed into a string, an if the value is not
> found, the original atom will be used (erlydtl_runtime:18).
>
Hello,
I am using erlydtl 0.5.3. I do see the code around line 18, but in my
case find_value at line 5 is used or fetch_value at line 38. Both fail.
fetch_value is called by the use of {{ hello }}
fetch_value(Key, Data) ->
case find_value(Key, Data) of
undefined ->
throw({undefined_variable, Key});
Val ->
Val
end.
Key: hello
Data: [{"get",[]},
{"__https",false},
{"__ip",{194,79,152,115}},
{"__cookies",
[{"eptic_cookie","nonode@nohost-9933714052825178113"}]},
{"session",[]},
{"__path",[]},
{"__cookie_key","nonode@nohost-9933714052825178113"},
{"__controller",front},
{"hello","Hello world!"}]
find_value at line 5 is called when using {% if hello %} Hello {% endif %}
find_value(Key, L) when is_list(L) ->
proplists:get_value(Key, L);
Key: hello
L: [{"get",[]},
{"__https",false},
{"__ip",{194,79,152,115}},
{"__cookies",
[{"eptic_cookie","nonode@nohost-9933714052825178113"}]},
{"session",[]},
{"__path",[]},
{"__cookie_key","nonode@nohost-9933714052825178113"},
{"__controller",front},
{"hello","Hello world!"}]
Here's the relevant controller code:
index(_Args) ->
wpart:fset("hello", "Hello world!"),
{template, "test/index.html"}.
And the template
<html>
<head>
</head>
<body>
<h1> {% if hello %} Hello ! {% endif %}</h1>
</body>
</html>
This is on a fresh install, downloaded with
hg clone https://bitbucket.org/etc/erlang-web/
Regards
|
|
From: Roberto A. <rob...@er...> - 2010-02-24 16:31:54
|
Hi all, glad to announce the e_auth, e_auth_dets and e_auth_mnesia components are now available on BitBucket: http://bitbucket.org/etc/ Enjoy, Roberto Aloi -- University of Kent - Erlang Solutions Ltd. Blog: http://aloiroberto.wordpress.com Twitter: @prof3ta --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: Roberto A. <rob...@er...> - 2010-02-24 10:34:54
|
Hi Elena, I don't see any problem in releasing these components. As far as I know, e_auth_mnesia and e_auth_dets should be completed and tested. An incomplete e_auth_ldap should also be available. I'll go trough the code in the afternoon or tomorrow - at latest - and I'll release them in bit bucket if the managers are ok with it. Cheers, Roberto Aloi University of Kent - Erlang Solutions Ltd. -- Blog: http://aloiroberto.wordpress.com Twitter: @prof3ta --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: Elena B. <ele...@gm...> - 2010-02-23 09:39:10
|
Hello All I'd like to know the 'destiny' of e_auth and e_auth_dets libs. As I can see they are not in the main branch. And I had impression that they are available now only in http://wiki.erlang-web.org/Tutorial as an examples of e_components. So, 1. Is e_auth somewhere/somehow supported? 2. Where the last version of these libs can be found? (even if the are not supported now) Thank you! |
|
From: Michal P. <mic...@er...> - 2010-02-23 08:41:20
|
Hi All,
One of the Erlang Web users - Elena Bobrova - prepared
a set of patches to the framework which have been recently
applied on the main repository.
The changes include:
- "application/force-download content type for both
e_mod_inets and e_mod_yaws server callback modules
- configurable session duration by 'extend_time' parameter
in project.conf file (the default value was/is 30 minutes)
- option for bypassing saving the uploaded multipart file
to the disk ('upload_to_disk' parameter in 'project.conf'
file)
We do appreciate all the improvements you made Elena: thank you!
Best regards,
Michal Ptaszek
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: Michal P. <mic...@er...> - 2010-02-23 08:23:56
|
Hi Gilbert,
----- "Gilbert Roulot" <erl...@la...> wrote:
> On Fri, Feb 19, 2010 at 08:44:50AM +0000, Michal Ptaszek wrote:
> > Hi,
> >
> > We are very happy with the patches you provided:
> > good job! Both of them have been applied on the
> > Erlang Web's sources (changeset 4a2530c5e23d) and
> > will be included in the next release.
> >
> > Thank you for your contribution!
> >
>
> You're welcome.
>
> I found another issue with DTL. When I use {{ variable }} in a
> template,
> and set the value with wpart:fset("variable", "Hello"). Erlydtl
> doesn't find
> it.
>
> What happens is erlydtl_runtime:fetch_value is looking for the atom
> viariable in
> the dictionary, but the dictionnary has string keys.
> wpart:fset(variable, "Hello")
> doesn't work.
> In order to fix this, I modified the dictionnary passed to
> erlydtl_runtime to turn
> its keys from strings into atoms:
>
> --- a/lib/wpart-1.4/src/erlydtl_expander.erl Tue Jan 19 10:58:02
> 2010 +0100
> +++ b/lib/wpart-1.4/src/erlydtl_expander.erl Fri Feb 19 18:32:39
> 2010 +0100
> @@ -24,7 +24,10 @@
>
> process_xml(Mod) ->
> case e_dict:get_state() of
> - {ok, Dict} ->
> + {ok, Dict1} ->
> + % turn strings in Dict1 into atoms. Because erldtl
> + % looks for atoms in it
> + Dict = lists:map(fun ({Key, Value}) ->
> {list_to_atom(Key), Value} end, Dict1),
> case Mod:render(Dict) of
> {ok, Html} ->
> [
>
Which version of erlydtl are you using?
The one that is bundled with standard Erlang Web contains a patch
for erlydtl_runtime: when accessing the request dictionary, the
key will be first transformed into a string, an if the value is not
found, the original atom will be used (erlydtl_runtime:18).
>
> I'll contribute patches as I go if more are needed. I guess DTL
> support doesn't see lots
> of use along erlang-web users :)
>
>
> Regards
Thank you!
Michal Ptaszek
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: Gilbert R. <erl...@la...> - 2010-02-19 17:54:51
|
On Fri, Feb 19, 2010 at 08:44:50AM +0000, Michal Ptaszek wrote:
> Hi,
>
> We are very happy with the patches you provided:
> good job! Both of them have been applied on the
> Erlang Web's sources (changeset 4a2530c5e23d) and
> will be included in the next release.
>
> Thank you for your contribution!
>
You're welcome.
I found another issue with DTL. When I use {{ variable }} in a template,
and set the value with wpart:fset("variable", "Hello"). Erlydtl doesn't find
it.
What happens is erlydtl_runtime:fetch_value is looking for the atom viariable in
the dictionary, but the dictionnary has string keys. wpart:fset(variable, "Hello")
doesn't work.
In order to fix this, I modified the dictionnary passed to erlydtl_runtime to turn
its keys from strings into atoms:
--- a/lib/wpart-1.4/src/erlydtl_expander.erl Tue Jan 19 10:58:02 2010 +0100
+++ b/lib/wpart-1.4/src/erlydtl_expander.erl Fri Feb 19 18:32:39 2010 +0100
@@ -24,7 +24,10 @@
process_xml(Mod) ->
case e_dict:get_state() of
- {ok, Dict} ->
+ {ok, Dict1} ->
+ % turn strings in Dict1 into atoms. Because erldtl
+ % looks for atoms in it
+ Dict = lists:map(fun ({Key, Value}) -> {list_to_atom(Key), Value} end, Dict1),
case Mod:render(Dict) of
{ok, Html} ->
[
I'll contribute patches as I go if more are needed. I guess DTL support doesn't see lots
of use along erlang-web users :)
Regards
|
|
From: Michal P. <mic...@er...> - 2010-02-19 08:45:06
|
Hi,
We are very happy with the patches you provided:
good job! Both of them have been applied on the
Erlang Web's sources (changeset 4a2530c5e23d) and
will be included in the next release.
Thank you for your contribution!
----- "Gilbert Roulot" <erl...@la...> wrote:
> Hello,
>
> I am working on a website in erlang-web, and here are two problems I
> stumbled upon that
> required modification or erlang-web source code.
>
> First, password fields in form with confirmation would alway return an
> error saying
> the password didn't match. It was caused by wtype_password:validate
> who would
> feed ["password", "password"] to utf8_api:ustring. The result is one
> string:
> "passwordpassword" instead of ["password", "password"].
>
> Here is the change I made to correct this:
> --- a/lib/wparts-1.4/src/wtype_password.erl Tue Jan 19 10:58:02
> 2010 +0100
> +++ b/lib/wparts-1.4/src/wtype_password.erl Thu Feb 18 18:09:11
> 2010 +0100
> @@ -45,8 +45,13 @@
> end
> end;
>
> +validate({Types, [RawString1, RawString2]}) when is_list(RawString1)
> and is_list(RawString2) ->
> + validate2({Types, [utf8_api:ustring(RawString1),
> utf8_api:ustring(RawString2)]});
> +
> validate({Types, RawString}) when is_list(RawString) ->
> - String = utf8_api:ustring(RawString),
> + validate2({Types, utf8_api:ustring(RawString)}).
> +
> +validate2({Types, String}) when is_list(String) ->
> case wpart_valid:is_private(Types) of
> true ->
> {ok, String};
>
> My second problem was with DTL templates. While wpart template's
> parent include
> mecanism works well with templates sepparated in subdirectories, DTL
> caused problems.
>
> Here is an exemple of the directory structure that cause problem:
> - templates
> - base
> - base.html
> - half.html
> - frontpage.html
> - article
> - article.html
>
> while an extends "half.html" works well in frontpage.html , it does
> not in article.html.
> And if you do an extends "base/base.html" in it, erlydtl tries to load
> article/base/base.html
> Trying to do extends "../base/half.html" doesn't fix the problem as it
> then tries to load
> article/base.html inside half.html
>
> In order to make DTL have the same behavior, I give DTL the template
> directory
> throught its doc_root option.
>
> --- a/lib/eptic-1.4/src/e_cache_ets.erl Tue Jan 19 10:58:02 2010
> +0100
> +++ b/lib/eptic-1.4/src/e_cache_ets.erl Thu Feb 18 18:09:11 2010
> +0100
> @@ -93,7 +93,7 @@
> XML;
> cache(File, erlydtl_expander) ->
> Mod = list_to_atom(string:join(string:tokens(File, "/.-"), "")),
> - case erlydtl:compile(File, Mod) of
> + case erlydtl:compile(File, Mod, [{doc_root,
> e_conf:template_root()}]) of
> ok ->
> ets:insert(?MODULE, {File, {date(), time()}, Mod}),
> Mod;
>
>
>
> Erlang-web is otherwise quite nice to work with. Thanks for the good
> work.
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Erlangweb-users mailing list
> Erl...@li...
> https://lists.sourceforge.net/lists/listinfo/erlangweb-users
> http://www.erlang-web.org/
Best regards,
Michal
---------------------------------------------------
---------------------------------------------------
WE'VE CHANGED NAMES!
Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.
www.erlang-solutions.com
|
|
From: Gilbert R. <erl...@la...> - 2010-02-18 17:49:35
|
Hello,
I am working on a website in erlang-web, and here are two problems I stumbled upon that
required modification or erlang-web source code.
First, password fields in form with confirmation would alway return an error saying
the password didn't match. It was caused by wtype_password:validate who would
feed ["password", "password"] to utf8_api:ustring. The result is one string:
"passwordpassword" instead of ["password", "password"].
Here is the change I made to correct this:
--- a/lib/wparts-1.4/src/wtype_password.erl Tue Jan 19 10:58:02 2010 +0100
+++ b/lib/wparts-1.4/src/wtype_password.erl Thu Feb 18 18:09:11 2010 +0100
@@ -45,8 +45,13 @@
end
end;
+validate({Types, [RawString1, RawString2]}) when is_list(RawString1) and is_list(RawString2) ->
+ validate2({Types, [utf8_api:ustring(RawString1), utf8_api:ustring(RawString2)]});
+
validate({Types, RawString}) when is_list(RawString) ->
- String = utf8_api:ustring(RawString),
+ validate2({Types, utf8_api:ustring(RawString)}).
+
+validate2({Types, String}) when is_list(String) ->
case wpart_valid:is_private(Types) of
true ->
{ok, String};
My second problem was with DTL templates. While wpart template's parent include
mecanism works well with templates sepparated in subdirectories, DTL caused problems.
Here is an exemple of the directory structure that cause problem:
- templates
- base
- base.html
- half.html
- frontpage.html
- article
- article.html
while an extends "half.html" works well in frontpage.html , it does not in article.html.
And if you do an extends "base/base.html" in it, erlydtl tries to load article/base/base.html
Trying to do extends "../base/half.html" doesn't fix the problem as it then tries to load
article/base.html inside half.html
In order to make DTL have the same behavior, I give DTL the template directory
throught its doc_root option.
--- a/lib/eptic-1.4/src/e_cache_ets.erl Tue Jan 19 10:58:02 2010 +0100
+++ b/lib/eptic-1.4/src/e_cache_ets.erl Thu Feb 18 18:09:11 2010 +0100
@@ -93,7 +93,7 @@
XML;
cache(File, erlydtl_expander) ->
Mod = list_to_atom(string:join(string:tokens(File, "/.-"), "")),
- case erlydtl:compile(File, Mod) of
+ case erlydtl:compile(File, Mod, [{doc_root, e_conf:template_root()}]) of
ok ->
ets:insert(?MODULE, {File, {date(), time()}, Mod}),
Mod;
Erlang-web is otherwise quite nice to work with. Thanks for the good work.
|
|
From: jacky z. <jac...@gm...> - 2010-01-20 08:46:19
|
Hi Michal, You are welcome! Thanks to you guys for providing such a useful tool. Regards. Jackyz On Tue, Jan 19, 2010 at 6:16 PM, Michal Ptaszek < mic...@er...> wrote: > Hi Jacky! > > We are very pleased with your opinion about Erlang Web. > Thank you for your warm support! > > Patch you sent have been reviewed and applied to the > framework's sources - the changeset is b44a6e460554 > (http://bitbucket.org/etc/erlang-web/changeset/b44a6e460554/). > > I've added also utf8_api:ustring call in wtype_password > (to behave in the same way as wtype_string and wtype_text). > > Thank you very much! > > ----- "jacky zhao" <jac...@gm...> wrote: > > > Hello, > > > > I have been using Erlang-Web for a while, that's a real time-saver. > > > > I possiblly found a *problem* in wtype_string and related basic > > wtypes. Here > > is the detail. > > > > When validating a input string(for example, the UTF-8 encoding string, > > like > > Chinese/Japanese/Korean characters), the wtype_string:validate > > function is > > using utf8_api:ulength try to decode utf8 from bytes to string, and > > then get > > the correct length. It's a carefully design, but no enought. The > > returned > > string needs to be decoded as well. > > > > The attached file is a rough patch. > > > > Basically, I just changed the utf8_api.erl to export a new function > > ustring() and use it in wtype_string, wtype_text and wtype_password. > > It's > > just try the utf8 decoder anyway, if falure(eg, not a utf8 encoding > > string), > > just return the input string. In most case, this is a acceptable > > solution(utf8 is widly used), but may not fit for all scenarios. > > > > To solve the problem totally, possiblly we needs to modify the > > e_mod_inet.erl add some code to detect the charset value in request's > > http > > content-type header(such as {"content-type", "form-post-url-encode; > > charset=ANY_ENCODING"}), and using the right decoder(such as: big-5, > > shift-js, gbk and so on) to parse the input. But it's hard to find > > those > > decoders in Erlang, and the utf8 is the most adaptable and standard > > choice. > > > > Regards. > > > > Jackyz. > > _______________________________________________ > > Erlangweb-users mailing list > > Erl...@li... > > https://lists.sourceforge.net/lists/listinfo/erlangweb-users > > http://www.erlang-web.org/ > > Best regards, > Michal Ptaszek > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become > ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > |
|
From: Michal P. <mic...@er...> - 2010-01-19 10:34:28
|
Hi Jacky! We are very pleased with your opinion about Erlang Web. Thank you for your warm support! Patch you sent have been reviewed and applied to the framework's sources - the changeset is b44a6e460554 (http://bitbucket.org/etc/erlang-web/changeset/b44a6e460554/). I've added also utf8_api:ustring call in wtype_password (to behave in the same way as wtype_string and wtype_text). Thank you very much! ----- "jacky zhao" <jac...@gm...> wrote: > Hello, > > I have been using Erlang-Web for a while, that's a real time-saver. > > I possiblly found a *problem* in wtype_string and related basic > wtypes. Here > is the detail. > > When validating a input string(for example, the UTF-8 encoding string, > like > Chinese/Japanese/Korean characters), the wtype_string:validate > function is > using utf8_api:ulength try to decode utf8 from bytes to string, and > then get > the correct length. It's a carefully design, but no enought. The > returned > string needs to be decoded as well. > > The attached file is a rough patch. > > Basically, I just changed the utf8_api.erl to export a new function > ustring() and use it in wtype_string, wtype_text and wtype_password. > It's > just try the utf8 decoder anyway, if falure(eg, not a utf8 encoding > string), > just return the input string. In most case, this is a acceptable > solution(utf8 is widly used), but may not fit for all scenarios. > > To solve the problem totally, possiblly we needs to modify the > e_mod_inet.erl add some code to detect the charset value in request's > http > content-type header(such as {"content-type", "form-post-url-encode; > charset=ANY_ENCODING"}), and using the right decoder(such as: big-5, > shift-js, gbk and so on) to parse the input. But it's hard to find > those > decoders in Erlang, and the utf8 is the most adaptable and standard > choice. > > Regards. > > Jackyz. > _______________________________________________ > Erlangweb-users mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlangweb-users > http://www.erlang-web.org/ Best regards, Michal Ptaszek --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com |
|
From: jacky z. <jac...@gm...> - 2010-01-15 09:30:19
|
Hello,
I have been using Erlang-Web for a while, that's a real time-saver.
I possiblly found a *problem* in wtype_string and related basic wtypes. Here
is the detail.
When validating a input string(for example, the UTF-8 encoding string, like
Chinese/Japanese/Korean characters), the wtype_string:validate function is
using utf8_api:ulength try to decode utf8 from bytes to string, and then get
the correct length. It's a carefully design, but no enought. The returned
string needs to be decoded as well.
The attached file is a rough patch.
Basically, I just changed the utf8_api.erl to export a new function
ustring() and use it in wtype_string, wtype_text and wtype_password. It's
just try the utf8 decoder anyway, if falure(eg, not a utf8 encoding string),
just return the input string. In most case, this is a acceptable
solution(utf8 is widly used), but may not fit for all scenarios.
To solve the problem totally, possiblly we needs to modify the
e_mod_inet.erl add some code to detect the charset value in request's http
content-type header(such as {"content-type", "form-post-url-encode;
charset=ANY_ENCODING"}), and using the right decoder(such as: big-5,
shift-js, gbk and so on) to parse the input. But it's hard to find those
decoders in Erlang, and the utf8 is the most adaptable and standard choice.
Regards.
Jackyz.
|
|
From: Michal P. <mic...@er...> - 2009-12-07 08:23:52
|
Hi, ----- fr...@fr... wrote: > Hi, > > in the shop tutorial from the erlang-web wiki when adding the field > description are we changing the schema on the mnesia db? Nope, we are only changing the model's constraints which is not held in the database, it is just on the framework side. No schema modifications are needed. > When I run in interactive move db_init:init(). I get > db_init module, mnesia's schema already exists, if you want to delete > it, run mnesia:delete_schema/1 > do I also lose the data while deleting the schema? Yes, deleting the schema causes also the data loss. > > How to just add modifications to an existing mnesia db? If you would like to change the existing table (SQL-like ALTER TABLE) you should use mnesia:transform_table/4 function (http://www.erlang.org/doc/man/mnesia.html#transform_table-4). > > Thanks in advance. > Kind regards, -- Michal Ptaszek www.erlang-consulting.com |
|
From: <fr...@fr...> - 2009-12-05 16:47:36
|
Hi, in the shop tutorial from the erlang-web wiki when adding the field description are we changing the schema on the mnesia db? When I run in interactive move db_init:init(). I get db_init module, mnesia's schema already exists, if you want to delete it, run mnesia:delete_schema/1 do I also lose the data while deleting the schema? How to just add modifications to an existing mnesia db? Thanks in advance. |
|
From: Michal P. <mic...@er...> - 2009-12-04 07:24:55
|
Hello Johann, ----- "Johann Höchtl" <joh...@gm...> wrote: > Sorry, the last message was not specifiy enough, and I cant't reply to > > myself, so.... > > Hello, > > I am completely new to Erlang and -web. > > I would like to use the pre-installed yaws web server on ubuntu 9.10 > (V. > 1.82) but the install script commes with it's on version. > > In order to keep a 'clean' system, I used to version of yaws from > ubuntu > 8apt-get install yaws). > > The yaws configuration is in /etc/yaws, docroot is /usr/share/yaws and > > yaws itself is in /usr/lib/erlang/lib/yaws-1.82, with /usr/lib/yaws > exists but is empty. > > Given this setup, wht makes a sensible setup for a 'systemwide' > isntallation of Erlang web, including using a pre-installed version of > yaws? > > I read > http://sourceforge.net/mailarchive/message.php?msg_id=5EDE8C61-35F2-47A5-AEB8-3C191C84EAD5%40kuty.be > but unfortunaltey that didn't help me. > > Is there a configuration switch which enables the install to re-use > an > existing yaws instead the included? > > If not, what should I do to manually set it up? Basically there are two ways of running Erlang Web: using interactive and embedded mode. In interactive mode every module is loaded into the VM only on demand (that is when you call any function from that module or trigger the load by invoking code:load(Mod)). In latter - embedded mode - all the code needed by your release is loaded during the Erlang system start. A list of modules to load is taken from .app files of the applications you want to use in your release (and that applications are specified in your .rel file). If you want to reuse the global yaws installation you should do the following things (I'm guessing - I've never done it before): a) for interactive mode you should modify the bin/start_interactive script's last line and add '-pa PATH_TO_YOUR_YAWS_EBIN_DIR' before '-pa lib/*/ebin'. This will cause loading Yaws 1.82 code instead of the Erlang Web's bundled one b) for embedded mode change bin/compile.erl escript and change the make_basic/0 function to call 'code:add_path(PATH_TO_YOUR_YAWS_EBIN_DIR)' before loading the other paths Other way to do this is simply remove the bundled yaws version and link your yaws directory into lib folder of Erlang Web. Then change only the top Emakefile and modify the paths to the linked yaws folder (e.g. by calling something like "sed -i -e 's/1.85/1.82/g' Emakefile"). Then recompile the code (recreate the release by calling ./bin/compile.erl release yaws NEW_VSN). If any more help is needed, do not hesitate to ask. > > Thank you, > > Johann > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Erlangweb-users mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlangweb-users > http://www.erlang-web.org/ Best regards, -- Michal Ptaszek www.erlang-consulting.com |
|
From: Johann H. <joh...@gm...> - 2009-12-02 18:13:51
|
Sorry, the last message was not specifiy enough, and I cant't reply to myself, so.... Hello, I am completely new to Erlang and -web. I would like to use the pre-installed yaws web server on ubuntu 9.10 (V. 1.82) but the install script commes with it's on version. In order to keep a 'clean' system, I used to version of yaws from ubuntu 8apt-get install yaws). The yaws configuration is in /etc/yaws, docroot is /usr/share/yaws and yaws itself is in /usr/lib/erlang/lib/yaws-1.82, with /usr/lib/yaws exists but is empty. Given this setup, wht makes a sensible setup for a 'systemwide' isntallation of Erlang web, including using a pre-installed version of yaws? I read http://sourceforge.net/mailarchive/message.php?msg_id=5EDE8C61-35F2-47A5-AEB8-3C191C84EAD5%40kuty.be but unfortunaltey that didn't help me. Is there a configuration switch which enables the install to re-use an existing yaws instead the included? If not, what should I do to manually set it up? Thank you, Johann |
|
From: Johann H. <joh...@gm...> - 2009-12-02 17:55:39
|
Hello,
I am completely new to Erlang and -web.
I would like to use the pre-installed yaws web server on ubuntu 9.10 (V.
1.82) but the install script commes with it's on version. As I am on
AMD64 the included .so - files wouldn't make sense anyway.
Is there a configuration switch which enables the install to re-use an
existing yaws instead the included?
If not, what should I do to manually set it up?
Thank you,
Johann
|