[erlang-questions] how: ot: real time web pages?

Dale Harvey harveyd@REDACTED
Sun Dec 2 12:12:28 CET 2007


I would also recommend using a javascript library to help with the
javascript, things like
innerHTML can act differently across browsers and libraries like jquery,
yui, scriptalicious
help get away from filddling cross browser requirement, the dom selection is
usually worth
them alone

$("#12345").html("..... some html")

another possible implementation would be flash, in which you can have a
remote socket
connection that is used to notify updates to the client that a value has
updated. it also
has graphing libraries in flex and certainly more powerful for drawing
output.

canvas tags and svg are quite severely restricted in browser requirements,
however drawing
line graphs in javascript is quite tricky so you might want to look around
for existing code

On 02/12/2007, Joe Armstrong <erlang@REDACTED> wrote:
>
> It is extremely doable - it takes about 25-50 lines of javascript, and
> a little erlang http server
>
> Here is an outline of the method.
>
> 1) Wrap the regions you want to change with unique tags
>     <div id="12345"> ... </id>
>
> 2) To change the content within this tag you need to execute a
> javascript statement
>
>     document.getElemenById("12345").innerHTML = "..... some html""
>
> 3) To do this you need some javascript that calls erlang - the erlang
> should NOT return immediately
> but return when the next update is required. The erlang return value
> should return a string which contains the
> "document.getElementByCommand command" - on getting the return value
> the javascript just "eval's" the result
>
> 4) Every time erlang returns you update the region on the page and
> immediately call erlang again
> which suspends until the next update comes.
>
> I don't actually have short example of this - I have code for this
> wrapped up in a lot of other
> junk that obscure the simplicity of the solution.
>
> At this stage I would really recommend that you learn javascript. I
> started by doing the exercises at
>
> http://www.w3schools.com/js/
>
> To do anything nice in a browser you need to learn javascript.
>
> You also need to setup some server side stuff ( a little http server -
> this can be as easy or  difficult
> as you like ...)
>
>
> /Joe
>
>
>
>
> On Dec 2, 2007 8:25 AM, Jouni Rynö <Jouni.Ryno@REDACTED> wrote:
> > I start from what I would like to have:
> > A web page with a real time updated display of numerical values and
> > graphs. Think about typical process displays in industry,
> > temperatures, voltages and some graphs showing parameter history.
> > Maybe some graphical layout of hardware, to show how each parameter
> > is connected to each other.
> >
> > To achieve that, I would need a  web page template format, where I can:
> > - define named text fields, which shall be updated
> > - define named graphics, which can be updated
> > - and some code to generate the real page and connection functions
> > for (comet style?) communication with the page and erlang process
> > feeding the data
> >
> > Currently I have all that implemented as Tcl/Tk canvas (thanks to Ola
> > Samuelsson and ewish, which was distributed with Erlang back in 97 or
> > so?)
> >
> > As my understanding of "javascript" is practically zero, I would like
> > get a hint on how to do this. Googling shows a lot of options, most
> > of the systems not quite being there. Should it be simply javascript
> > and svg, changes updated via attributes. Or canvas tag (complicated
> > with text fields?) Or haxe and flash (for which I did not find
> > examples, how the update mechanism would work) Or something else?
> >
> > Is this doable? Some examples existing already?
> >
> > Jouni
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
* http://hypernumbers.com
* http://arandomurl.com/
* http://www.flickr.com/photos/daleharvey/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071202/74662562/attachment.htm>


More information about the erlang-questions mailing list