-
Notifications
You must be signed in to change notification settings - Fork 0
Archive Trac demo app recap exe
Legacy Trac archive page imported from
demo_app_recap_exe. Source: https://genapp.rocks/wiki/wiki/demo_app_recap_exe. Review age, links, and examples before treating as current.
Having covered how to control application's GUI elements (labels, title etc.) with JSON definitions, we would like to mention in conclusion that JSON is also used in GenApp framework for passing user-entered parameters (mass & speed of light) to the executable (performing actual computations on the server); similarly, executable organizes computational results (energy value) into JSON which is streamed back to the GUI ("Energy [J]" field). Details on how it works is a topic of separate discussion which may be of interest to GenApp framework developers. For users, on the other hand, we want to present a concise vision of the process for an obvious reason that it is user's responsibility to modify the codes (executables) they wish to deploy on the web using GenApp tools.
As mentioned earlier, the Demo's application executable, {{{bin/penergy}}} (written in Python), is already "wrapped" to satisfy GenApp's architecture requirements on accepting JSON input and producing JSON output.
Let's examine the {{{bin/penergy's}}} JSON related code snippet:
The input and output JSON data (passed from the GUI to executable and produced by executable and passed back to the GUI, respectively) look as follows:
- input JSON:
{
"m" : "mass_value" # entered from GUI
"c" : "speed_of_light" # from the GUI (default non-editable value)
}
- output JSON:
{
"e" : "energy_value" # computed from executable and streamed out back to GUI
}
NOTE: the "keys" in these JSON data ("m", "c" and "e") correspond to the *"id"*s of the corresponding input and output fields in the module definition file.
Due to its popularity with web development, JSON parsers are available for most popular languages:
ABAP, ActionScript, Ada, AdvPL, ASP, AWK, Bash, BlitzMax, C, C++, C#,
Ciao, Clojure, Cobol, ColdFusion, D, Dart, Delphi, E, Fantom, FileMaker,
Fortran, Go, Groovy, Haskell, Java, JavaScript, LabVIEW, Lisp, LiveCode,
LotusScript, LPC, Grimoire, LPCJSON.Lua, M, Matlab, Net.Data, ObjectiveC,
OCaml, PascalScript, Perl, Photoshop, PHP, PicoLisp, Pike, PL/SQL, pljson,
PowerShell, Puredata, Python, R, Racket, Rebol, RPG, Rust, Ruby, Scheme,
Squeak, Symbian, Tcl, VisualBasic, VisualFoxPro
Therefore, executables written in other programming languages can be "wrapped" in an analogous manner.
