On Tue, Sep 18, 2012 at 3:04 PM, Paul Read <[email protected]> wrote:
> I simply added this line:
>     response->printf(dr, "Count params: %d",count(dr));
>
> But it did not complain until runtime that I had missed the 'param->'
>
> I assume that prior to 'Running the HTTP Server' the code is compiled and
> therefore I should see the error in the output from dudac straight away
> rather than having to run the browser to force the error.
>

The problem is that is a warning:

  main.c:10:5: warning: implicit declaration of function ‘count’
[-Wimplicit-function-declaration]

i need to think about how to trap those warnings and print them to
STDOUT at least before to run the service..


> Paul
>
>
>
> On 18 September 2012 21:55, Eduardo Silva <[email protected]> wrote:
>>
>> On Tue, Sep 18, 2012 at 2:53 PM, Paul Read <[email protected]>
>> wrote:
>> > When is the code compiled?  I asked as I edited the main.c and restarted
>> > the
>> > server via the same command line as before.
>> >
>> > Instead of the error being detected initially it did not fail until I
>> > refreshed the browser.  So it appeared as a runtime error to me rather
>> > than
>> > a compile time error
>> >
>> > Maybe I am missing something here!
>>
>> Every time you run ./dudac -w /path/to/webservice, the source code is
>> compiled on fly. If you error is located on runtime in a callback you
>> will not realize it until you point to the callback through the
>> browser.
>>
>> Whats the specific error ? maybe i can improve the output for that
>> exception...
>>
>> >
>> > Paul
>> >
>> >
>> >
>> > On 18 September 2012 21:41, Eduardo Silva <[email protected]> wrote:
>> >>
>> >> On Tue, Sep 18, 2012 at 2:37 PM, Paul Read <[email protected]>
>> >> wrote:
>> >> > Ah I see, was some how expecting to have to compile the code to
>> >> > binary
>> >> > before launching dudac to host it.  Did not think dudac would do it
>> >> > all
>> >> > for
>> >> > me - very useful!
>> >> >
>> >> > So in the end I did this:
>> >> >
>> >> > ./dudac -f -w /home/pi/duda-examples/001_hello_world
>> >> >
>> >> > and can happily see Hello World in my web browser via
>> >> > http://192.168.1.39:2001/hello/
>> >> >
>> >>
>> >> Good :)
>> >>
>> >> > Cheers!
>> >> > Paul - noobie hat definitely still in situation
>> >> >
>> >> >
>> >> >
>> >> > On 18 September 2012 21:30, Eduardo Silva <[email protected]> wrote:
>> >> >>
>> >> >> On Tue, Sep 18, 2012 at 2:28 PM, Paul Read <[email protected]>
>> >> >> wrote:
>> >> >> > How do I compile the 001_helloworld?
>> >> >>
>> >> >> check the step #3 from the previous email,
>> >> >>
>> >> >> best,
>> >> >>
>> >> >> > Paul
>> >> >> >
>> >> >> > On 18 September 2012 17:47, Paul Read <[email protected]>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Brilliant! Hope to try it out in next couple of days
>> >> >> >>
>> >> >> >> Paul
>> >> >> >>
>> >> >> >>
>> >> >> >> On 18 September 2012 06:20, Eduardo Silva <[email protected]>
>> >> >> >> wrote:
>> >> >> >>>
>> >> >> >>> As promised, here is the info that you need to start playing
>> >> >> >>> with
>> >> >> >>> Duda:
>> >> >> >>>
>> >> >> >>> 1) Clone DudaC (Duda Client Manager):
>> >> >> >>>
>> >> >> >>>     # git clone git://git.monkey-project.com/dudac
>> >> >> >>>
>> >> >> >>> 2) Clone Duda Examples
>> >> >> >>>
>> >> >> >>>    # git clone git://git.monkey-project.com/duda-examples
>> >> >> >>>
>> >> >> >>> 3) Go into DudaC directory and start the Hello World example:
>> >> >> >>>
>> >> >> >>>    # cd duda
>> >> >> >>>    # ./dudac -g
>> >> >> >>>    # ./dudac -f -w /path/to/duda-examples/001_hello_world
>> >> >> >>>
>> >> >> >>> 4) Now open your browser at: http://localhost:2001/hello/
>> >> >> >>>
>> >> >> >>> Comments:
>> >> >> >>> ------------------
>> >> >> >>> - When you run 'dudac -g', it will download Monkey and Duda
>> >> >> >>> sources
>> >> >> >>> from their respective GIT repositories and set the development
>> >> >> >>> environment for you. You only need to run that command once
>> >> >> >>> unless
>> >> >> >>> you
>> >> >> >>> want to update your local copies if some patches were applied to
>> >> >> >>> the
>> >> >> >>> master repositories
>> >> >> >>> - The '-f' flag means 'fast-run', so it will not try to build
>> >> >> >>> Monkey
>> >> >> >>> again for the web service, instead it will just perform the
>> >> >> >>> setup
>> >> >> >>> - The '-w' flag specifies where the web service sources are
>> >> >> >>> located,
>> >> >> >>> it will check the code, compile, configure the web server and
>> >> >> >>> launch
>> >> >> >>> the web service.
>> >> >> >>>
>> >> >> >>> The source code of hello world looks like this:
>> >> >> >>>
>> >> >> >>>   #include "webservice.h"
>> >> >> >>>
>> >> >> >>>   DUDA_REGISTER("Duda I/O Examples", "Hello World");
>> >> >> >>>
>> >> >> >>>   void cb_hello(duda_request_t *dr)
>> >> >> >>>   {
>> >> >> >>>       response->http_status(dr, 200);
>> >> >> >>>       response->printf(dr, "Hello World!");
>> >> >> >>>       response->end(dr, NULL);
>> >> >> >>>   }
>> >> >> >>>
>> >> >> >>>   int duda_main()
>> >> >> >>>   {
>> >> >> >>>       map->static_add("/", "cb_hello");
>> >> >> >>>       return 0;
>> >> >> >>>   }
>> >> >> >>>
>> >> >> >>> I am still working in some formal documentation, but you can see
>> >> >> >>> a
>> >> >> >>> draft of the API available here:
>> >> >> >>>
>> >> >> >>>      http://duda.io/api/response.html
>> >> >> >>>
>> >> >> >>> Feel free to write to this mailing list with your questions,
>> >> >> >>>
>> >> >> >>> cheers,
>> >> >> >>>
>> >> >> >>> On Fri, Sep 14, 2012 at 2:41 PM, Eduardo Silva
>> >> >> >>> <[email protected]>
>> >> >> >>> wrote:
>> >> >> >>> > Hi Paul,
>> >> >> >>> >
>> >> >> >>> > On Fri, Sep 14, 2012 at 2:09 PM, Paul Read
>> >> >> >>> > <[email protected]>
>> >> >> >>> > wrote:
>> >> >> >>> >> Hi
>> >> >> >>> >>
>> >> >> >>> >> Brand new here so apologies for some daft questions.  Firstly
>> >> >> >>> >> very
>> >> >> >>> >> impressed
>> >> >> >>> >> how quick it was to get Monkey up and running on my Raspberry
>> >> >> >>> >> Pi
>> >> >> >>> >> :-)
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>> > we are glad you like it :)
>> >> >> >>> >
>> >> >> >>> >> I want to be able to control the GPIO of the Pi via a
>> >> >> >>> >> webserver.
>> >> >> >>> >> I
>> >> >> >>> >> am
>> >> >> >>> >> using
>> >> >> >>> >> WiringPi (https://projects.drogon.net/raspberry-pi/wiringpi/)
>> >> >> >>> >> to
>> >> >> >>> >> control the
>> >> >> >>> >> GPIO which also works a treat.  Now I want to join Monkey and
>> >> >> >>> >> WiringPi
>> >> >> >>> >> together.  So I can send a GET command to the RPi which then
>> >> >> >>> >> changes
>> >> >> >>> >> the
>> >> >> >>> >> GPIO (at this stage I don't need the RPi to do any other HTTP
>> >> >> >>> >> stuff).
>> >> >> >>> >>
>> >> >> >>> >> Very happy at writing C/C++ but am brand new to:
>> >> >> >>> >>
>> >> >> >>> >> * Linux
>> >> >> >>> >> * RaspberryPi
>> >> >> >>> >> * gcc/cc
>> >> >> >>> >> * Monkey-Project
>> >> >> >>> >>
>> >> >> >>> >> So my question is, how best should I do this?  Potential
>> >> >> >>> >> options
>> >> >> >>> >> I
>> >> >> >>> >> believe
>> >> >> >>> >> are:
>> >> >> >>> >>
>> >> >> >>> >> 1.  Compile my WiringPi code into Monkey-Project somewhere
>> >> >> >>> >> somehow
>> >> >> >>> >> 2.  Create my WiringPi code as a CGI exe and make Monkey call
>> >> >> >>> >> it
>> >> >> >>> >> somehow
>> >> >> >>> >> 3.  Create my WiringPi code as a FastCGI exe and make Monkey
>> >> >> >>> >> call
>> >> >> >>> >> it
>> >> >> >>> >> somehow
>> >> >> >>> >> 4.  Plugins?
>> >> >> >>> >> 5.  Another undiscovered way...
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>> > I understand perfectly your requirements. The answer to your
>> >> >> >>> > main
>> >> >> >>> > question is "Duda".
>> >> >> >>> >
>> >> >> >>> > Duda[0] is a C framework which aims to expose a friendly C API
>> >> >> >>> > to
>> >> >> >>> > create web services on top of Monkey. So what you really need
>> >> >> >>> > is
>> >> >> >>> > to
>> >> >> >>> > map specific URL address as internal commands, so your C web
>> >> >> >>> > service
>> >> >> >>> > links to the WiringPi library and you use it from there.
>> >> >> >>> >
>> >> >> >>> > Duda is under (heavy) development and i am almost ready to do
>> >> >> >>> > the
>> >> >> >>> > first release. Also i am planning to write some basic How To's
>> >> >> >>> > for
>> >> >> >>> > this weekend so you could start right away with your
>> >> >> >>> > implementation,
>> >> >> >>> > give me a 2-3 days to have something and then you send me some
>> >> >> >>> > feedback, sounds a good deal ? :)
>> >> >> >>> >
>> >> >> >>> > [0] http://duda.io
>> >> >> >>> >
>> >> >> >>> > best,
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>> >>
>> >> >> >>> >> Again apologies if daft questions
>> >> >> >>> >> Thanks
>> >> >> >>> >> --
>> >> >> >>> >> Paul
>> >> >> >>> >>
>> >> >> >>> >> http://www.readiescards.co.uk
>> >> >> >>> >>
>> >> >> >>> >>
>> >> >> >>> >> _______________________________________________
>> >> >> >>> >> Monkey mailing list
>> >> >> >>> >> [email protected]
>> >> >> >>> >> http://lists.monkey-project.com/listinfo/monkey
>> >> >> >>> >>
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >>> > --
>> >> >> >>> > Eduardo Silva
>> >> >> >>> > http://edsiper.linuxchile.cl
>> >> >> >>> > http://www.monkey-project.com
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> --
>> >> >> >>> Eduardo Silva
>> >> >> >>> http://edsiper.linuxchile.cl
>> >> >> >>> http://www.monkey-project.com
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Paul
>> >> >> >>
>> >> >> >> http://www.readiescards.co.uk
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Paul
>> >> >> >
>> >> >> > http://www.readiescards.co.uk
>> >> >> >
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Monkey mailing list
>> >> >> > [email protected]
>> >> >> > http://lists.monkey-project.com/listinfo/monkey
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Eduardo Silva
>> >> >> http://edsiper.linuxchile.cl
>> >> >> http://www.monkey-project.com
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Paul
>> >> >
>> >> > http://www.readiescards.co.uk
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Eduardo Silva
>> >> http://edsiper.linuxchile.cl
>> >> http://www.monkey-project.com
>> >
>> >
>> >
>> >
>> > --
>> > Paul
>> >
>> > http://www.readiescards.co.uk
>> >
>>
>>
>>
>> --
>> Eduardo Silva
>> http://edsiper.linuxchile.cl
>> http://www.monkey-project.com
>
>
>
>
> --
> Paul
>
> http://www.readiescards.co.uk
>



-- 
Eduardo Silva
http://edsiper.linuxchile.cl
http://www.monkey-project.com
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to