Evan Miller | 28 Apr 21:27 2011
Picon

Re: questions on conventions

Alternatively, to avoid all clashes we could have a "model_prefix"
config option, e.g.

{model_prefix, sd}

Then your model files would be called

sd_user.erl
sd_post.erl

etc.

There could be a separate "table_prefix" config option for supporting
multiple CB apps in the same DB.

On Thu, Apr 28, 2011 at 2:23 PM, Evan Miller <emmiller@...> wrote:
> Yes, Erlang's "user" module is unfortunate.... would it help to have a
> "-table" model attribute like
>
> -module(luser, [Id, Name]).
> -table(users).
>
> ?
>
> On Tue, Apr 26, 2011 at 6:59 AM, Seven Du <dujinfang@...> wrote:
>> user is just an example, module names could conflict with when you are
>> working on big projects and specially working with legacy DBs and that's why
>> I think it should support customized tables names.
>> the view solution is kind of a hack and it's more complicated in psql since
>> you also need triggers to make the view updatable.
(Continue reading)

Evan Miller | 28 Apr 21:37 2011
Picon

Re: Database Schema Changes

Hi Graeme,

Data model migrations are an ancient source of downtime; I think it's
unavoidable with schema'd databases. That's why I was originally so
excited about Tokyo Cabinet.

As for solutions, I think you've covered the ways people out there do
it. Ideally we'd have some built-in tools in CB to assist with
temporary table creation and the rest.

E

On Mon, Apr 25, 2011 at 11:04 AM, Graeme Defty
<graeme.defty@...> wrote:
> Hi, Evan.
>
> I have had a little more time to think about this. I suspect it is a
> database-specific problem. You may not see it in TC, but with Mnesia (and
> most 'relational' d/b backends, I suspect) it is necessary to define the
> size of a tuple which will be stored in a table (i.e. number of columns in a
> row, in relational terms),
>
> That means that the 'gradual' replacement of records as I described it is
> far from trivial. It would seem that I will need to
>
> - update the software
> - change the schema, and
> - update alll affected records to the new schema
>
> all in one atomic process, with the application disabled throughout.
(Continue reading)

Evan Miller | 28 Apr 21:42 2011
Picon

Re: Upgrading problem

On Mon, Apr 18, 2011 at 11:29 AM, Graeme Defty
<graeme.defty@...> wrote:
> Making progress, though this is undoubtedly the toughest upgrade so far.
>
> My earlier problem as that I did not realise that the 'make app ...' command
> would create a new directory OUTside the boss directory. Sadly, I had the
> boss directory alongside my working project, so the 'make app...' produced a
> nice name clash and all hell broke loose. (A warning in the readme might be
> in order ;-) )

Ah... sorry

>
> I have now performed a proper merge (I believe) of the framework and my app,
> and I am getting two errors in compiling previously clean code. Both
> problems are with Unsafe_variable messages.
>
> As an example, I have a function which looks like this:
>
> parse(Model, Str, Limit) ->
>     Parts = parse(Model, Str, Limit, []),
>     {year, Year} = lists:keyfind(year, 1, Parts),
>     if Year < 100 ->
>         NewYear = Year + 2000,
>         if NewYear > Limit, Limit > 0 ->
>             TrueYear = NewYear - 100;
>             true    -> TrueYear = NewYear
>         end;
>        true       -> TrueYear = Year
>     end,
(Continue reading)

Seven Du | 26 Apr 13:59 2011
Picon

Re: questions on conventions

user is just an example, module names could conflict with when you are working on big projects and specially working with legacy DBs and that's why I think it should support customized tables names.

the view solution is kind of a hack and it's more complicated in psql since you also need triggers to make the view updatable.


On Tuesday, April 26, 2011 at 10:11 AM, Graeme Defty wrote:

As I recall, this is not a Boss problem so much as an Erlang one.

The problem is that there is already a module somewhere in standard
Erlang libraries (I forget the exact details) a use of 'user' and you
are clashing with this. I now use usr which works fine, of course, bit
is a bit of a pain.

I believe there may be an alternative which allows you to mask the
built-in 'user' (If you google around a bit you will find the
discussions) but that may not be a good idea either.

g

On 26/04/2011, Jose Luis Gordo Romero <jgordor <at> gmail.com> wrote:
+1

I too have encountered this limitations, if you use the mysql backend, you
can create a view:

For module name collisions:
CREATE OR REPLACE SQL SECURITY INVOKER VIEW `ausers` AS SELECT * FROM users;

For module shared db's with rails:
CREATE OR REPLACE SQL SECURITY INVOKER VIEW `posts` AS SELECT id, name,
created_at as created_time FROM posts;

This code changes will break many things but will help new developers.

Best

--
Jose Luis Gordo Romero
<at> jgordor <http://twitter.com/jgordor> - http://www.freemindsystems.com



2011/4/25 Seven Du <dujinfang <at> gmail.com>

greetings,

The boss looks really nice, I can't help to play a bit.

I created a model user.erl and created a table named users in pgsql got
the
following error:


=ERROR REPORT==== 26-Apr-2011::00:14:46 ===
Can't load module that resides in sticky dir

=ERROR REPORT==== 26-Apr-2011::00:14:46 ===
{function_clause,
[{admin_view_error_html,'-render_internal/2-fun-2-',
["code reload failed: user",
[{counter,1},
{counter0,0},
{revcounter,1},
{{revcounter0,0},
{first,true},
{{last,true},
{parentloop,undefined}]]},
{lists,mapfoldl,3},
{admin_view_error_html,render_internal,2},
{admin_view_error_html,render,2},
{boss_web_controller,render_view,4},
{boss_web_controller,trap_load_and_execute,2},
{boss_web_controller,process_request,1},
{boss_web_controller,handle_request,3}]}


I fixed it by changing user to auser. So question is


Is or will there a way to customize the model or table name, e.g. I really
want to table name to be users not ausers.

In Rails it is possible to do that with :table_name => blah etc. so I
guess
we can do in erlang with -table_name(blah) ?

It gona be useful say we working on legacy databases but want to avoid
table name and module name collisions.

And another convention is that Rails use created_at but Boss use _time for
timestamp fields, wouldn't it be better to follow the same convention?


Thanks,
Seven
--
Seven Du
About: http://about.me/dujinfang
Blog: http://www.dujinfang.com
Proj: http://www.freeswitch.org.cn

Julien | 27 Apr 16:29 2011
Picon

Re: Start.sh do not work when start-dev does...

No news on this issue ? It's really a blocking one... how to get on
production ?

On 3 avr, 23:07, Julien <thewis...@...> wrote:
> Well... is there a deep problem withstart.sh?
>
> Thanks
>
> On 31 mar, 23:19, Julien <thewis...@...> wrote:
>
>
>
>
>
>
>
> > Nope, this change tostart.shdoesn't change anything... :(
>
> > On 31 mar, 20:14, Evan Miller <emmil...@...> wrote:
>
> > > On Thu, Mar 31, 2011 at 12:58 PM, Julien <thewis...@...> wrote:
> > > > Thanks ! it worked...
>
> > > Cool, pushed the fix to GitHub and will cut a new release soon.
>
> > > > Just strange behaviour : it doesn't seem to connect to my tyrant as
> > > > the dev server did (no data at all when in production, but all my data
> > > > when in development)..
> > > > Did I miss something ?
>
> > > I think I know the problem. Try changingstart.shto move "-config
> > > boss" before "-s boss". If that works I'll get this fixed too
>
> > > > Thanks a lot Evan for your patience (Chicago Boss is amazing).
>
> > > > On 31 mar, 15:55, Evan Miller <emmil...@...> wrote:
> > > >> Try replacing all the stuff starting with "-run" with this:
>
> > > >> -eval 'boss_load:load_all_modules("ebin")' -s init stop -noshell
>
> > > >> On Thu, Mar 31, 2011 at 8:29 AM, Julien <thewis...@...> wrote:
> > > >> > I tried...
> > > >> > I got this error :
>
> > > >> > erl -pa /Users/julienmarie/Documents/workspace/ChicagoBoss/ebin -run
> > > >> > 'boss_load:load_all_modules("ebin")' -s init stop
> > > >> > Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:4:4] [rq:4] [async-
> > > >> > threads:0] [hipe] [kernel-poll:false]
>
> > > >> > {"init terminating in do_boot",{undef,
> > > >> > [{'boss_load:load_all_modules("ebin")',start,[]},{init,start_it,1},
> > > >> > {init,start_em,1}]}}
>
> > > >> > Crash dump was written to: erl_crash.dump
> > > >> > init terminating in do_boot ()
> > > >> > make: *** [all] Error 1
>
> > > >> > :(
>
> > > >> > On 31 mar, 14:17, Evan Miller <emmil...@...> wrote:
> > > >> >> With 0.5 you need to type "make" in your project dir before runningstart.sh
>
> > > >> >> Sent from my iPhone
>
> > > >> >> On Mar 31, 2011, at 0:00, Julien <thewis...@...> wrote:
>
> > > >> >> > Hi,
>
> > > >> >> > When I launch my app withstart.sh, here's what I got. What's wrong ?
>
> > > >> >> > Error:
> > > >> >> > {undef,
> > > >> >> >    [{store_controller,new,
> > > >> >> >         [{simple_bridge_request_wrapper,mochiweb_request_bridge,
> > > >> >> >              {{mochiweb_request,#Port<0.2948>,'GET',"/",
> > > >> >> >                   {1,1},
> > > >> >> >                   {9,
> > > >> >> >                    {"host",
> > > >> >> >                     {'Host',"localhost:8001"},
> > > >> >> >                     {"connection",
> > > >> >> >                      {'Connection',"keep-alive"},
> > > >> >> >                      {"cache-control",
> > > >> >> >                       {'Cache-Control',"max-age=0"},
> > > >> >> >                       {"accept",
> > > >> >> >                        {'Accept',
> > > >> >> >                            "application/xml,application/xhtml
> > > >> >> > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
> > > >> >> >                        nil,
> > > >> >> >                        {"accept-encoding",
> > > >> >> >                         {'Accept-Encoding',"gzip,deflate,sdch"},
> > > >> >> >                         {"accept-charset",
> > > >> >> >                          {'Accept-
> > > >> >> > Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
> > > >> >> >                          nil,nil},
> > > >> >> >                         {"accept-language",
> > > >> >> >                          {'Accept-Language',
> > > >> >> >                              "fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4"},
> > > >> >> >                          nil,nil}}},
> > > >> >> >                       nil},
> > > >> >> >                      {"cookie",
> > > >> >> >                       {'Cookie',
>
> > > >> >> > "_victoire_session=97781f4632490d92f74949d0dfe1a9d676faa87d;
> > > >> >> > _boss_session=39773348d90c6eb2240d84490e3e07a787dceb4b;
> > > >> >> > _parisondemand_session=a588706ce2748ae3c73db3a634293c9ccc2a0b3d"},
> > > >> >> >                       nil,nil}},
> > > >> >> >                     {"user-agent",
> > > >> >> >                      {'User-Agent',
> > > >> >> >                          "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
> > > >> >> > 10_6_4; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/
> > > >> >> > 10.0.648.204 Safari/534.16"},
> > > >> >> >                      nil,nil}}}},
> > > >> >> >               "/Users/julienmarie/Documents/workspace/ParisOnDemand/
> > > >> >> > static"},
> > > >> >> >              false,[],[],none}]},
> > > >> >> >     {boss_web_controller,execute_action,3},
> > > >> >> >     {boss_web_controller,trap_load_and_execute,2},
> > > >> >> >     {boss_web_controller,process_request,1},
> > > >> >> >     {boss_web_controller,handle_request,3},
> > > >> >> >     {mochiweb_http,headers,5},
> > > >> >> >     {proc_lib,init_p_do_apply,3}]}
>
> > > >> --
> > > >> Evan Millerhttp://www.evanmiller.org/
>
> > > --
> > > Evan Millerhttp://www.evanmiller.org/

Evan Miller | 28 Apr 18:51 2011
Picon

Re: Numeric for in ErlyTDL

On Wed, Apr 13, 2011 at 7:23 PM, Andre Nathan <andrenth@...> wrote:
> On Wed, Apr 13, 2011 at 3:05 PM, Andre Nathan <andrenth@...> wrote:
>> I want to create a number of divs based on a numeric field in one of
>> my models. Is there a way to do this with ErlyDTL? If not, what's the
>> best approach?
>
> I managed to do this by creating a new ErlyDTL filter called
> "range_from" so that I can do this:
>
>  {% with range=some_number|range_from:1 %}
>  {% for i in range %}
>  <div>
>  </div>
>  {% endfor %}
>  {% endwith %}
>
> Two questions:
>
> 1) Is it a bug that I can't write {% for i in some_number|range_from:1
> %} directly instead of using "with"?

Yes, this is a bug in ErlyDTL; I'll put it on the to-do list.

> 2) Is there a place in my app that I can add this custom filter so
> that boss will see it? I did it by editing erlydtl_filters.erl
> directly, which is not really clean...

Sorry, there isn't a way to hook in custom filters at the moment...

E

>
> Thanks
> Andre
>

--

-- 
Evan Miller
http://www.evanmiller.org/

Evan Miller | 28 Apr 19:27 2011
Picon

Re: common display

You probably want to use blocks or an include tag.

http://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include

E

On Tue, Apr 19, 2011 at 11:27 PM, subha <subha.sri08@...> wrote:
> Hi
>
>      Thanks for your reply regarding external style sheet.. I have
> one more question that where i need to put common display content..
> all template rendered by single controller must use this common
> display..
>        In rails we will put in layout folder in the name of
> controller name for common display.. Is there any facilities like this
> in chicagoboss .. I know the use of custom tags in chicagoboss.. but i
> have to manually call this in all template if i want commom display..
>
> Thanks&Regards
>
> Subha J

--

-- 
Evan Miller
http://www.evanmiller.org/

Evan Miller | 28 Apr 21:08 2011
Picon

Re: Start.sh do not work when start-dev does...

Hi Julien,

I'm afraid I can't reproduce this issue. When I create a fresh project
and set it up to connect to a non-loopback tyrant server, it seems to
correctly connect in production mode. There does appear to be a bug
with the /admin interface which doesn't always clear the browser cache
correctly, but the data is correctly stored in the database.

If you can demonstrate the problem with a series of reproducible steps
(ideally starting with a fresh install), I can look into it further.

Sorry this took so long to look into.

Evan

On Wed, Apr 27, 2011 at 9:29 AM, Julien <thewiseup@...> wrote:
> No news on this issue ? It's really a blocking one... how to get on
> production ?
>
> On 3 avr, 23:07, Julien <thewis...@...> wrote:
>> Well... is there a deep problem withstart.sh?
>>
>> Thanks
>>
>> On 31 mar, 23:19, Julien <thewis...@...> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Nope, this change tostart.shdoesn't change anything... :(
>>
>> > On 31 mar, 20:14, Evan Miller <emmil...@...> wrote:
>>
>> > > On Thu, Mar 31, 2011 at 12:58 PM, Julien <thewis...@...> wrote:
>> > > > Thanks ! it worked...
>>
>> > > Cool, pushed the fix to GitHub and will cut a new release soon.
>>
>> > > > Just strange behaviour : it doesn't seem to connect to my tyrant as
>> > > > the dev server did (no data at all when in production, but all my data
>> > > > when in development)..
>> > > > Did I miss something ?
>>
>> > > I think I know the problem. Try changingstart.shto move "-config
>> > > boss" before "-s boss". If that works I'll get this fixed too
>>
>> > > > Thanks a lot Evan for your patience (Chicago Boss is amazing).
>>
>> > > > On 31 mar, 15:55, Evan Miller <emmil...@...> wrote:
>> > > >> Try replacing all the stuff starting with "-run" with this:
>>
>> > > >> -eval 'boss_load:load_all_modules("ebin")' -s init stop -noshell
>>
>> > > >> On Thu, Mar 31, 2011 at 8:29 AM, Julien <thewis...@...> wrote:
>> > > >> > I tried...
>> > > >> > I got this error :
>>
>> > > >> > erl -pa /Users/julienmarie/Documents/workspace/ChicagoBoss/ebin -run
>> > > >> > 'boss_load:load_all_modules("ebin")' -s init stop
>> > > >> > Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:4:4] [rq:4] [async-
>> > > >> > threads:0] [hipe] [kernel-poll:false]
>>
>> > > >> > {"init terminating in do_boot",{undef,
>> > > >> > [{'boss_load:load_all_modules("ebin")',start,[]},{init,start_it,1},
>> > > >> > {init,start_em,1}]}}
>>
>> > > >> > Crash dump was written to: erl_crash.dump
>> > > >> > init terminating in do_boot ()
>> > > >> > make: *** [all] Error 1
>>
>> > > >> > :(
>>
>> > > >> > On 31 mar, 14:17, Evan Miller <emmil...@...> wrote:
>> > > >> >> With 0.5 you need to type "make" in your project dir before runningstart.sh
>>
>> > > >> >> Sent from my iPhone
>>
>> > > >> >> On Mar 31, 2011, at 0:00, Julien <thewis...@...> wrote:
>>
>> > > >> >> > Hi,
>>
>> > > >> >> > When I launch my app withstart.sh, here's what I got. What's wrong ?
>>
>> > > >> >> > Error:
>> > > >> >> > {undef,
>> > > >> >> >    [{store_controller,new,
>> > > >> >> >         [{simple_bridge_request_wrapper,mochiweb_request_bridge,
>> > > >> >> >              {{mochiweb_request,#Port<0.2948>,'GET',"/",
>> > > >> >> >                   {1,1},
>> > > >> >> >                   {9,
>> > > >> >> >                    {"host",
>> > > >> >> >                     {'Host',"localhost:8001"},
>> > > >> >> >                     {"connection",
>> > > >> >> >                      {'Connection',"keep-alive"},
>> > > >> >> >                      {"cache-control",
>> > > >> >> >                       {'Cache-Control',"max-age=0"},
>> > > >> >> >                       {"accept",
>> > > >> >> >                        {'Accept',
>> > > >> >> >                            "application/xml,application/xhtml
>> > > >> >> > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
>> > > >> >> >                        nil,
>> > > >> >> >                        {"accept-encoding",
>> > > >> >> >                         {'Accept-Encoding',"gzip,deflate,sdch"},
>> > > >> >> >                         {"accept-charset",
>> > > >> >> >                          {'Accept-
>> > > >> >> > Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
>> > > >> >> >                          nil,nil},
>> > > >> >> >                         {"accept-language",
>> > > >> >> >                          {'Accept-Language',
>> > > >> >> >                              "fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4"},
>> > > >> >> >                          nil,nil}}},
>> > > >> >> >                       nil},
>> > > >> >> >                      {"cookie",
>> > > >> >> >                       {'Cookie',
>>
>> > > >> >> > "_victoire_session=97781f4632490d92f74949d0dfe1a9d676faa87d;
>> > > >> >> > _boss_session=39773348d90c6eb2240d84490e3e07a787dceb4b;
>> > > >> >> > _parisondemand_session=a588706ce2748ae3c73db3a634293c9ccc2a0b3d"},
>> > > >> >> >                       nil,nil}},
>> > > >> >> >                     {"user-agent",
>> > > >> >> >                      {'User-Agent',
>> > > >> >> >                          "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
>> > > >> >> > 10_6_4; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/
>> > > >> >> > 10.0.648.204 Safari/534.16"},
>> > > >> >> >                      nil,nil}}}},
>> > > >> >> >               "/Users/julienmarie/Documents/workspace/ParisOnDemand/
>> > > >> >> > static"},
>> > > >> >> >              false,[],[],none}]},
>> > > >> >> >     {boss_web_controller,execute_action,3},
>> > > >> >> >     {boss_web_controller,trap_load_and_execute,2},
>> > > >> >> >     {boss_web_controller,process_request,1},
>> > > >> >> >     {boss_web_controller,handle_request,3},
>> > > >> >> >     {mochiweb_http,headers,5},
>> > > >> >> >     {proc_lib,init_p_do_apply,3}]}
>>
>> > > >> --
>> > > >> Evan Millerhttp://www.evanmiller.org/
>>
>> > > --
>> > > Evan Millerhttp://www.evanmiller.org/

--

-- 
Evan Miller
http://www.evanmiller.org/

Evan Miller | 28 Apr 21:09 2011
Picon

Re: Start.sh do not work when start-dev does...

BTW if you post your start.sh and start-dev.sh scripts I'll see if
there's something obvious there...

On Thu, Apr 28, 2011 at 2:08 PM, Evan Miller <emmiller@...> wrote:
> Hi Julien,
>
> I'm afraid I can't reproduce this issue. When I create a fresh project
> and set it up to connect to a non-loopback tyrant server, it seems to
> correctly connect in production mode. There does appear to be a bug
> with the /admin interface which doesn't always clear the browser cache
> correctly, but the data is correctly stored in the database.
>
> If you can demonstrate the problem with a series of reproducible steps
> (ideally starting with a fresh install), I can look into it further.
>
> Sorry this took so long to look into.
>
> Evan
>
> On Wed, Apr 27, 2011 at 9:29 AM, Julien <thewiseup@...> wrote:
>> No news on this issue ? It's really a blocking one... how to get on
>> production ?
>>
>> On 3 avr, 23:07, Julien <thewis...@...> wrote:
>>> Well... is there a deep problem withstart.sh?
>>>
>>> Thanks
>>>
>>> On 31 mar, 23:19, Julien <thewis...@...> wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> > Nope, this change tostart.shdoesn't change anything... :(
>>>
>>> > On 31 mar, 20:14, Evan Miller <emmil...@...> wrote:
>>>
>>> > > On Thu, Mar 31, 2011 at 12:58 PM, Julien <thewis...@...> wrote:
>>> > > > Thanks ! it worked...
>>>
>>> > > Cool, pushed the fix to GitHub and will cut a new release soon.
>>>
>>> > > > Just strange behaviour : it doesn't seem to connect to my tyrant as
>>> > > > the dev server did (no data at all when in production, but all my data
>>> > > > when in development)..
>>> > > > Did I miss something ?
>>>
>>> > > I think I know the problem. Try changingstart.shto move "-config
>>> > > boss" before "-s boss". If that works I'll get this fixed too
>>>
>>> > > > Thanks a lot Evan for your patience (Chicago Boss is amazing).
>>>
>>> > > > On 31 mar, 15:55, Evan Miller <emmil...@...> wrote:
>>> > > >> Try replacing all the stuff starting with "-run" with this:
>>>
>>> > > >> -eval 'boss_load:load_all_modules("ebin")' -s init stop -noshell
>>>
>>> > > >> On Thu, Mar 31, 2011 at 8:29 AM, Julien <thewis...@...> wrote:
>>> > > >> > I tried...
>>> > > >> > I got this error :
>>>
>>> > > >> > erl -pa /Users/julienmarie/Documents/workspace/ChicagoBoss/ebin -run
>>> > > >> > 'boss_load:load_all_modules("ebin")' -s init stop
>>> > > >> > Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:4:4] [rq:4] [async-
>>> > > >> > threads:0] [hipe] [kernel-poll:false]
>>>
>>> > > >> > {"init terminating in do_boot",{undef,
>>> > > >> > [{'boss_load:load_all_modules("ebin")',start,[]},{init,start_it,1},
>>> > > >> > {init,start_em,1}]}}
>>>
>>> > > >> > Crash dump was written to: erl_crash.dump
>>> > > >> > init terminating in do_boot ()
>>> > > >> > make: *** [all] Error 1
>>>
>>> > > >> > :(
>>>
>>> > > >> > On 31 mar, 14:17, Evan Miller <emmil...@...> wrote:
>>> > > >> >> With 0.5 you need to type "make" in your project dir before runningstart.sh
>>>
>>> > > >> >> Sent from my iPhone
>>>
>>> > > >> >> On Mar 31, 2011, at 0:00, Julien <thewis...@...> wrote:
>>>
>>> > > >> >> > Hi,
>>>
>>> > > >> >> > When I launch my app withstart.sh, here's what I got. What's wrong ?
>>>
>>> > > >> >> > Error:
>>> > > >> >> > {undef,
>>> > > >> >> >    [{store_controller,new,
>>> > > >> >> >         [{simple_bridge_request_wrapper,mochiweb_request_bridge,
>>> > > >> >> >              {{mochiweb_request,#Port<0.2948>,'GET',"/",
>>> > > >> >> >                   {1,1},
>>> > > >> >> >                   {9,
>>> > > >> >> >                    {"host",
>>> > > >> >> >                     {'Host',"localhost:8001"},
>>> > > >> >> >                     {"connection",
>>> > > >> >> >                      {'Connection',"keep-alive"},
>>> > > >> >> >                      {"cache-control",
>>> > > >> >> >                       {'Cache-Control',"max-age=0"},
>>> > > >> >> >                       {"accept",
>>> > > >> >> >                        {'Accept',
>>> > > >> >> >                            "application/xml,application/xhtml
>>> > > >> >> > +xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
>>> > > >> >> >                        nil,
>>> > > >> >> >                        {"accept-encoding",
>>> > > >> >> >                         {'Accept-Encoding',"gzip,deflate,sdch"},
>>> > > >> >> >                         {"accept-charset",
>>> > > >> >> >                          {'Accept-
>>> > > >> >> > Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
>>> > > >> >> >                          nil,nil},
>>> > > >> >> >                         {"accept-language",
>>> > > >> >> >                          {'Accept-Language',
>>> > > >> >> >                              "fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4"},
>>> > > >> >> >                          nil,nil}}},
>>> > > >> >> >                       nil},
>>> > > >> >> >                      {"cookie",
>>> > > >> >> >                       {'Cookie',
>>>
>>> > > >> >> > "_victoire_session=97781f4632490d92f74949d0dfe1a9d676faa87d;
>>> > > >> >> > _boss_session=39773348d90c6eb2240d84490e3e07a787dceb4b;
>>> > > >> >> > _parisondemand_session=a588706ce2748ae3c73db3a634293c9ccc2a0b3d"},
>>> > > >> >> >                       nil,nil}},
>>> > > >> >> >                     {"user-agent",
>>> > > >> >> >                      {'User-Agent',
>>> > > >> >> >                          "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
>>> > > >> >> > 10_6_4; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/
>>> > > >> >> > 10.0.648.204 Safari/534.16"},
>>> > > >> >> >                      nil,nil}}}},
>>> > > >> >> >               "/Users/julienmarie/Documents/workspace/ParisOnDemand/
>>> > > >> >> > static"},
>>> > > >> >> >              false,[],[],none}]},
>>> > > >> >> >     {boss_web_controller,execute_action,3},
>>> > > >> >> >     {boss_web_controller,trap_load_and_execute,2},
>>> > > >> >> >     {boss_web_controller,process_request,1},
>>> > > >> >> >     {boss_web_controller,handle_request,3},
>>> > > >> >> >     {mochiweb_http,headers,5},
>>> > > >> >> >     {proc_lib,init_p_do_apply,3}]}
>>>
>>> > > >> --
>>> > > >> Evan Millerhttp://www.evanmiller.org/
>>>
>>> > > --
>>> > > Evan Millerhttp://www.evanmiller.org/
>
>
>
> --
> Evan Miller
> http://www.evanmiller.org/
>

--

-- 
Evan Miller
http://www.evanmiller.org/

Evan Miller | 28 Apr 21:23 2011
Picon

Re: questions on conventions

Yes, Erlang's "user" module is unfortunate.... would it help to have a
"-table" model attribute like

-module(luser, [Id, Name]).
-table(users).

?

On Tue, Apr 26, 2011 at 6:59 AM, Seven Du <dujinfang@...> wrote:
> user is just an example, module names could conflict with when you are
> working on big projects and specially working with legacy DBs and that's why
> I think it should support customized tables names.
> the view solution is kind of a hack and it's more complicated in psql since
> you also need triggers to make the view updatable.
>
> On Tuesday, April 26, 2011 at 10:11 AM, Graeme Defty wrote:
>
> As I recall, this is not a Boss problem so much as an Erlang one.
>
> The problem is that there is already a module somewhere in standard
> Erlang libraries (I forget the exact details) a use of 'user' and you
> are clashing with this. I now use usr which works fine, of course, bit
> is a bit of a pain.
>
> I believe there may be an alternative which allows you to mask the
> built-in 'user' (If you google around a bit you will find the
> discussions) but that may not be a good idea either.
>
> g
>
> On 26/04/2011, Jose Luis Gordo Romero <jgordor@...> wrote:
>
> +1
>
> I too have encountered this limitations, if you use the mysql backend, you
> can create a view:
>
> For module name collisions:
> CREATE OR REPLACE SQL SECURITY INVOKER VIEW `ausers` AS SELECT * FROM users;
>
> For module shared db's with rails:
> CREATE OR REPLACE SQL SECURITY INVOKER VIEW `posts` AS SELECT id, name,
> created_at as created_time FROM posts;
>
> This code changes will break many things but will help new developers.
>
> Best
>
> --
> Jose Luis Gordo Romero
>  <at> jgordor <http://twitter.com/jgordor> - http://www.freemindsystems.com
>
>
>
> 2011/4/25 Seven Du <dujinfang@...>
>
> greetings,
>
> The boss looks really nice, I can't help to play a bit.
>
> I created a model user.erl and created a table named users in pgsql got
> the
> following error:
>
>
> =ERROR REPORT==== 26-Apr-2011::00:14:46 ===
> Can't load module that resides in sticky dir
>
> =ERROR REPORT==== 26-Apr-2011::00:14:46 ===
> {function_clause,
> [{admin_view_error_html,'-render_internal/2-fun-2-',
> ["code reload failed: user",
> [{counter,1},
> {counter0,0},
> {revcounter,1},
> {{revcounter0,0},
> {first,true},
> {{last,true},
> {parentloop,undefined}]]},
> {lists,mapfoldl,3},
> {admin_view_error_html,render_internal,2},
> {admin_view_error_html,render,2},
> {boss_web_controller,render_view,4},
> {boss_web_controller,trap_load_and_execute,2},
> {boss_web_controller,process_request,1},
> {boss_web_controller,handle_request,3}]}
>
>
> I fixed it by changing user to auser. So question is
>
>
> Is or will there a way to customize the model or table name, e.g. I really
> want to table name to be users not ausers.
>
> In Rails it is possible to do that with :table_name => blah etc. so I
> guess
> we can do in erlang with -table_name(blah) ?
>
> It gona be useful say we working on legacy databases but want to avoid
> table name and module name collisions.
>
> And another convention is that Rails use created_at but Boss use _time for
> timestamp fields, wouldn't it be better to follow the same convention?
>
>
> Thanks,
> Seven
> --
> Seven Du
> About: http://about.me/dujinfang
> Blog: http://www.dujinfang.com
> Proj: http://www.freeswitch.org.cn
>
>

--

-- 
Evan Miller
http://www.evanmiller.org/


Gmane