help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Re: Java GLPK to Javascript GLPK bindings


From: Nigel Galloway
Subject: Re: [Help-glpk] Re: Java GLPK to Javascript GLPK bindings
Date: Thu, 31 Mar 2011 05:52:49 -0700

Yeah right, and all in one evening. I'm glad I don't work for you.

According to Wikipedia  Safari supports NPAPI and npruntime, so the
following may apply.

I attach Sudoku.html which is a mofification to the actual version. Open
it in a browser and press Solve. The interesting lines are:

Line 9

    <form onsubmit="Solve()" action="">

and at the end

<script type="text/javascript" language="JavaScript">
<!--    Begin
    function Solve() {
        document.write("Nigel was here!")
    }
// End -->
</script>

Well, everyone else would probably want it to solve the problem. To do
this we need a plugin (or an ActiveX server on windows).

The one I have written, so far, is called Sudoku and exports one
procedure Solve(). Then if we change the line document.write("Nigel was
here!") to Sudoku.Solve() it solves the problem. Sudoku.Solve() uses
functionallity provided by npruntime to evaluate JavaScript to obtain
the text in elements A..G1..9 and IAJAAR.HPP to interface to glpk see:

http://master.dl.sourceforge.net/project/iajaarh/Callback_examples/IAJAAR_H.hpp.xps.
 

The function Solve() in the html isn't necessary as one can write:

 <form onsubmit="Sudoku.Solve()" action="">

This demonstrates that it is possible to invoke GLPK from HTML as if it
were JavaScript, and call JavaScript from GLPK.

If you keep the function Solve() in the HTML it would be possible to
extract the info from the form using JavaScript and pass it as a
parameter to Sudoku.Solve(), thus not needing to evaluate JavaScript
from within the Plugin.

It is possible to write IAJAAR as a plugin and export all the
functionallity of IAJAAR to JavaScript, then possibly write something
like:

 http://master.dl.sourceforge.net/project/iajaarh/Callback_examples/test.py.xps

in JavaScript.

-- 
  Nigel Galloway
  address@hidden


On Wed, 30 Mar 2011 06:04 +1100, "Noli Sicad" <address@hidden> wrote:
> Hi Nigel,
> 
> > I tried this last night on WebKit and have GLPK solving Sudoku problems
> > entered on a form using JS to extract the information from the form,
> > submit it to the GLPK plugin when the Solve button is pressed, and
> > display the result page.
> 
> In case you have already created the Javascript GLPK bindings and GLPK
> plugin for WebKit. Is this correct?
> 
> PhoneGap uses Safari Mobile WebKit.  Javascript GLPK bindings and GLPK
> plugin can be use as a plugin.
> 
> PhoneGap plugins
> https://github.com/phonegap/phonegap-plugins
> 
> The good thing about PhoneGap is, it works in 6 mobile platforms (i.e.
> iPhone, Android, WebOS, Meego, Phone Win 7, BlackBerry and RIM OS).
> 
> Hope to see your javascript GLPK bindings and GLPK plugin.  I think it
> would be good to be included in GLPK wiki book.
> 
> Thanks.
> 
> Regards, Noli
> 

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow

Sudoku

 


reply via email to

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