[erlang-questions] UBF(A) vs ETF / UBF(C) vs gen_fsm

Sat Sep 25 17:49:08 CEST 2010

Dr Armstrong,

Some comments...

On Sat, 25 Sep 2010 20:39:43 +1000, Joe Armstrong <erlang@REDACTED> wrote:

>  I've been thinking ...
> It would be really great if I could send messages from a browser
> to erlang.
> I want to add an extra button to firefox that when pressed
> analyzes something about the current page and sends a message
> to an erlang server.
> I was reading about solvent
> http://simile.mit.edu/wiki/Solvent
> some quotes
> " Interactively highlight parts of the page you wish to scrape,
> directly in your browser, and obtain the right XPaths for them
>   Edit and execute the scraper code directly in the browser, making
> the development cycle fast and incremental
>  Save and publish the scraper with the required metadata, so that
> others can discover it
>  ..."
> This is *exacty* what I want to do - highlight some text in the
> brower - as I release the mouse the highlighted text is sent
> to and erlang server to be analysed and stored.
> IMHO bookmarking a site is not interesting - it's some small fragment
> on a page that interest me - I want to:
>      a) highlight it
>      b) edit the highlighted bit (ie throw me into an editor)
>      c) store the edited result
> (later I might even be able to "pre-read" a new page finding
> what might be interesting for me in the page :-)

This sounds very interesting. If I've understood correctly, you want the
results delivered to you on the Erlang side as HTML snippets or JSON with
embedded HTML strings?

Also, where you say "throw me into an editor" -- do you mean a editor in
the word-processing sense or an editor in the html authoring sense (like
in Solvent?) The former would be easy (Mozilla have that infrastructure
already), the latter substantially more involved.

> This is very generic - if I could isolate "analyze something about the
> current page" into a convenient js module then I could do all sort of
> fun things.
> This seems to require a Firefox plugin - any idea how to write this?

Yes and No. No because I've never actually written a Firefox
extension/add-on before. Yes because writing one is basically a
subset/specialised form of a XULRunner/Mozilla Framework application which
I do have knowledge of.

If you want to have a crack at it yourself (you know the saying "if you
want something done properly..."), you probably want to start with the XUL
tutorial, then the Extension tutorial, then as a reference the official
free e-book "Creating Applications with Mozilla" which goes through the
Mozilla framework...


You might need the js debugger too...


> If I want to start a collaborative project where do I advertise for
> smart javascript programmers who know the firefox internals.

I'm not sure where you'd advertise (Stackoverflow maybe), but I can advise
on what to advertise for...

You might want to specifically advertise for a programmer familiar with
the Mozilla Application Framework -- of which JavaScript is just an
element (XUL/XBL/XPCOM/RDF-XML being the major other bits.) This will weed
out the hobbyists. Another thing to look out for is the fact that the
Mozilla flavor of JavaScript is not quite the same as the typical
JavaScript. That is, the js used in web-pages is "narrower" than the js
used in Firefox extensions/XULRunner apps -- those familiar with the
former (prototype/jquery types) are unlikely to be useful with the latter.
For example, extension writers frequently access Mozilla C++ interfaces
via js and navigate a different DOM (the internals you refer to.) Their
code looks alien to web js programmers. So, familiarity with ns (netscape)
interfaces and the Firefox/XUL DOM is something else you should
specifically ask for.

IMO, rather than advertise, your best bet is to look for a Firefox
extension that has some characteristics of what you're looking for, then
contact the author. You can browse/search for extensions here...


> The erlang stuff is easy :-) but the js is tricky - (and I guess this  
> group is
> not the best lace to ask js questions?)
> (( where is the best group for this (ie js questions)))

The Mozilla add-on forum is where you'll find Firefox extension types who
speak "Mozilla" JavaScript...


That said, I'm going to put a day aside and try to whip something up
myself (assuming I've understood what you want.) I'm very interested in
being part of this project -- especially to learn more about Erlang. It's
also a good excuse to make the Mozilla Framework -> Firefox Extension
migration I've been meaning to do.

- Edmond -

> On Thu, Sep 23, 2010 at 3:19 PM, Edmond Begumisa
> <ebegumisa@REDACTED> wrote:
>> Thanks Scott, I was trying to figure out how to do that... documentation
>> links I was referred to are a bit scattered at the moment. I'm sure when
>> they get round to working on them the Gemini UBF tools will spread.
>> - Edmond -
>> On Thu, 23 Sep 2010 06:43:36 +1000, Scott Lystig Fritchie
>> <fritchie@REDACTED> wrote:
>>> Edmond Begumisa <ebegumisa@REDACTED> wrote:
>>>>> Having parsed the JSON (or UBF(A) ) the parse trees would be
>>>>> essentially the same thing so the contract checker would be easy.
>>> eb> Ditto! It's actually that blog entry that got me to look at UBF
>>> eb> (what ever happened to part II of that BTW!?!) I've been
>>> eb> contemplating using Gemini's UBF-JSON to make life easier on the
>>> eb> XULRunner side. I don't know if you've had a look at/recommend  
>>> their
>>> eb> implementation...
>>> eb> http://github.com/norton/ubf-jsonrpc
>>> Yes, that's what the ubf-jsonrpc package does.  There's also the option
>>> of using the http://github.com/norton/ubf stuff as-is to implement a
>>> "JSF" server, which is straight JSON across a TCP socket (i.e., without
>>> any JSON-RPC HTTP stuff).
>>> IIRC, it's just a server-side configuration option {proto, ubf} or
>>> {proto, jsf} or {proto, ebf} to have an Erlang server speak UBF(A),
>>> "JSF", or UBF-terms-encoded-with-term_to_binary(), respectively.
>>> -Scott
>>> ________________________________________________________________
>>> erlang-questions (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

More information about the erlang-questions mailing list