You were not offensive at all, relax!

:)


On 14 July 2015 at 13:41, Luca Finzi Contini <[email protected]>
wrote:

> @emacstheviking, yes I did not mean to be offensive, I am just a newbie in
> CB development and it struck me as counterintuitive to have 'sort-of'
> object-oriented-like features like THIS:function() in a natively non-OOP
> language.
> Thank you for the links, I will sure read them as soon as possible!
> Luca.
>
> 2015-07-14 14:31 GMT+02:00 emacstheviking <[email protected]>:
>
>> I believe the "trickery" is pmod_transform, which despite being not taken
>> into the language as a standard feature is widely used by a lot of
>> projects. It's very useful, I used "erlando" for a lot of Erlang stuff and
>> it's great.
>>
>> Checking therse links out might give you some more information...
>>
>> https://github.com/erlang/pmod_transform
>> https://github.com/rabbitmq/erlando
>>
>> http://www.erlang.org/doc/man/erl_id_trans.html
>>
>>
>>
>>
>> On 14 July 2015 at 12:42, Luca Finzi Contini <[email protected]>
>> wrote:
>>
>>> Thank you Graeme! I will try this one, looks very promising. I was just
>>> thinking something similar, i.e. that CB does some compile-time trickery
>>> and translates the THIS:function(...) to something like function(..., <all
>>> THIS attributes>).
>>> Thank you!
>>>
>>>
>>> Il giorno martedì 14 luglio 2015 05:04:23 UTC+2, graeme defty ha scritto:
>>>>
>>>>
>>>> It's a while since I got tangled in this stuff, but is it possible that
>>>> it is related to the fact that models are passed to their methods as the
>>>> first (hidden) parameter?
>>>>
>>>> Try removing the "THIS:" and I think you may find that it works.
>>>>
>>>> NewFilename = apply_gamma_factor(OriginalFilename, GammaValue),
>>>>
>>>>
>>>>
>>>> If you really want the "THIS:" where you have it to explicitly provide
>>>> the module for the call , try passing it also as the first parameter to the
>>>> call.
>>>>
>>>> NewFilename = THIS:apply_gamma_factor(THIS, OriginalFilename, GammaValue),
>>>>
>>>>
>>>> g
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 13 July 2015 at 17:07, emacstheviking <[email protected]> wrote:
>>>>
>>>>> First glance.... apply_gamma_factor/2 .... at a brief look the failing
>>>>> call seems to be supplying more than two arguments... check your code and
>>>>> make sure you are calling it how it expects to be called perhaps!?
>>>>>
>>>>> Sean.
>>>>>
>>>>>
>>>>>
>>>>> On 9 July 2015 at 12:17, <[email protected]> wrote:
>>>>>
>>>>>> Hi all,
>>>>>> I am quite new to ChicagoBoss and I am struggling to just add a
>>>>>> simple function to an existing model module.
>>>>>> My module is image.erl.
>>>>>>
>>>>>> I have a function called create_processed_file():
>>>>>>
>>>>>> create_processed_file(FileType, Size)  ->
>>>>>>
>>>>>>
>>>>>> lager:info("-=> Stepping into create_processed_file <=-"),
>>>>>> OriginalFilename = THIS:get_filename(FileType, Size),
>>>>>> GammaValue = THIS:gamma(),
>>>>>> NewFilename = THIS:apply_gamma_factor(OriginalFilename, GammaValue),
>>>>>> NewFilename.
>>>>>>
>>>>>>
>>>>>> I added THIS:apply_gamma_factor/2.
>>>>>>
>>>>>> The function is defined at the end of the file:
>>>>>>
>>>>>> apply_gamma_factor(Filename, Gamma) ->
>>>>>> lager:info("-=> GAMMA PROCESSING : ~p", [Gamma]),
>>>>>> ProcessedFilenamePart = "_gamma_" ++ io_lib:format("~4.2f", [Gamma]),
>>>>>> NewFilename = "/tmp/" ++ filename:rootname(filename:basename(Filename)) 
>>>>>> ++ ProcessedFilenamePart ++ filename:extension(Filename),
>>>>>> case (Gamma == 1.0) of
>>>>>>     true ->
>>>>>>         % if gamma == 1.0 let's just copy the original image with the 
>>>>>> new file name.
>>>>>>         lager:info("[apply_gamma_factor] - gamma = 1 - copying ~s to ~s 
>>>>>> . ", [Filename, NewFilename]),
>>>>>>         {ok, _} = file:copy(Filename, NewFilename);
>>>>>>     false ->
>>>>>>         % if gamma /= 1.0 then we need to create the processed image.
>>>>>>         case filelib:is_regular(NewFilename) of
>>>>>>             false -> %% send to graphicsmagick for processing
>>>>>>                 GammaCmd = io_lib:format("gm convert -gamma ~f ~s ~s ",
>>>>>>                     [Gamma,
>>>>>>                         Filename,
>>>>>>                         NewFilename]),
>>>>>>                 os:cmd(GammaCmd);
>>>>>>             true ->
>>>>>>                 undefined
>>>>>>         end
>>>>>> end,
>>>>>> NewFilename.
>>>>>>
>>>>>>
>>>>>>
>>>>>> I cleaned, built and restarted my CB application and every time I get
>>>>>> the same error:
>>>>>>
>>>>>>
>>>>>>
>>>>>> *13:08:34.929 [info] -=> Stepping into create_processed_file
>>>>>> <=-13:08:34.946 [error] gen_server gsd_report_server terminated with
>>>>>> reason: no function clause matching
>>>>>> image:apply_gamma_factor("./data/exams/5/c/6/5/a3a9-7762-450e-9dca-f738934cd773/image-5c65a3a9-7762-450e-9dca-f738934cd77...",
>>>>>> 2.0,
>>>>>> {image,"image-5c65a3a9-7762-450e-9dca-f738934cd773",<<"visible">>,undefined,{{2015,3,26},{14,5,52.0}},...})
>>>>>> line 19613:08:34.947 [error] CRASH REPORT Process gsd_report_server with >>>>>> 0
>>>>>> neighbours exited with reason: no function clause matching
>>>>>> image:apply_gamma_factor("./data/exams/5/c/6/5/a3a9-7762-450e-9dca-f738934cd773/image-5c65a3a9-7762-450e-9dca-f738934cd77...",
>>>>>> 2.0,
>>>>>> {image,"image-5c65a3a9-7762-450e-9dca-f738934cd773",<<"visible">>,undefined,{{2015,3,26},{14,5,52.0}},...})
>>>>>> line 196 in gen_server:terminate/7 line 804*
>>>>>> So it enters the create_processed_file function but somehow cannot
>>>>>> 'see' the apply_gamma_factor/2 fuc, instead it looks for a function with
>>>>>> more parameters.
>>>>>> Could you please help me in solving this problem?
>>>>>> Thanks in advance
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "ChicagoBoss" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> Visit this group at http://groups.google.com/group/chicagoboss.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/chicagoboss/6d8cb159-f10d-4c1e-a379-147a40e8b210%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/chicagoboss/6d8cb159-f10d-4c1e-a379-147a40e8b210%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "ChicagoBoss" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/chicagoboss.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/chicagoboss/CAEiEuU%2BuCaY_oandHCnbiq8d4w%3DvLanGV-VCX%3DqXKPUuK6q%3Dvw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/chicagoboss/CAEiEuU%2BuCaY_oandHCnbiq8d4w%3DvLanGV-VCX%3DqXKPUuK6q%3Dvw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "ChicagoBoss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> Visit this group at http://groups.google.com/group/chicagoboss.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/chicagoboss/72a3e755-a65d-4493-8a15-6de4b01dacd8%40googlegroups.com
>>> <https://groups.google.com/d/msgid/chicagoboss/72a3e755-a65d-4493-8a15-6de4b01dacd8%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "ChicagoBoss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/chicagoboss/XJHXwGO46BU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> Visit this group at http://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/chicagoboss/CAEiEuUKM4CRoKnOUsHVFHWq2G4XBw-qD9YNVsiaTy2cMsHCT4w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/chicagoboss/CAEiEuUKM4CRoKnOUsHVFHWq2G4XBw-qD9YNVsiaTy2cMsHCT4w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/CAK%2BP1tGzKuCC9Vvtq14yGXQDWQ0Fsf%3DR%3D5wEmDNGoF2SeHJsow%40mail.gmail.com
> <https://groups.google.com/d/msgid/chicagoboss/CAK%2BP1tGzKuCC9Vvtq14yGXQDWQ0Fsf%3DR%3D5wEmDNGoF2SeHJsow%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CAEiEuULdXy4Fv68mC061VwSC3UfEk-dPLGqa6KY5OAfL3e7OgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to