help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help using cgi-bin package for Octave


From: Alexander Barth
Subject: Re: help using cgi-bin package for Octave
Date: Mon, 2 Sep 2013 11:41:09 +0200



On Mon, Sep 2, 2013 at 10:50 AM, c. <address@hidden> wrote:

On 2 Sep 2013, at 10:42, Alexander Barth <address@hidden> wrote:

> Dear Eduardo,
>
> On 27/08/13 18:07, Eduardo D. da Costa wrote:
>> Dear Alexander
>>
>> I have been trying to use the cgi-bin package for Octave you kindly
>> made available at
>> http://modb.oce.ulg.ac.be/mediawiki/index.php/CGI_programming_with_Octave.
>>
>> I tried with success your "Hello word".
>>
>> I am trying now to do this exercise:
>> 1) ask for a number  X
>> 2) a) if the number is odd then say in a clean new page "The number X is odd"
>>    b) if the number is even then say in a clean new page "The number X is even"
>>    c) if neither, say, in a clean new page, "Please use an integer"
>> and allow  redoing the all thing again.
>>
>> I have tried different things and could not  get this working.
>> Is it impossible?
>> If it is not impossible could you please help me by telling me how to do it?
> This is very well possible.
> * first check if the parameter "number" is provided (using this
> http://octave.sourceforge.net/cgi/function/@cgi/has.html)
> * if not, return a page asking to provide one
> * if yes, try to parse the variable using str2double (not str2num because str2num uses the eval
> function)
> * if parsing failed or if the variable is not an integer return the page "Please use an integer"
> * use function mod(x,2) to see if the variable is odd or even and return a corresponding page.
>
> All pages should include a link to your cgi script allowing to enter a new number.
>
> Such a web-page would be the first step. If you get more familiar with web-programming, it is better
> not to mix too much HTML code and octave code (or any other server-side code). You can use
> XMLHttpRequest (http://en.wikipedia.org/wiki/XMLHttpRequest) to trigger from _javascript_ in your
> web-page the octave code on your server, return the result in JSON (or XML), and update your
> web-page using _javascript_ (without a full refresh; this programming model is sometimes called AJAX).
> I used this for instance in the following web-page:
> http://data-assimilation.net/Tools/divand_demo/html/.
>
> Please use in future the octave mailing list (in CC). Other users might ask themselves similar
> questions.
>
> Cheers,
> Alex
>
>
>
>>
>> Your help will be greatly appreciated.
>>
>> Thank you a lot in advance,
>> Eduardo
>

Alexander,

What about adding a link to your CGI package wiki page here:

http://wiki.octave.org/Main_Page#Available_Packages

or even reproducing that papge itself together with the other
package tutorials on the Octave wiki?

Dear Carlo,

Thank you for the suggestion. I added the links of my packages to the wiki page.
Those links are already included in the Url field of the DESCRIPTION file, but I don't know if it is used anywhere.

Regards,
Alex


 

c.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]