Getting your feet wet with OpenMocha

Paul Adams of Webmonkey is getting your feet wet with Ruby on Rails . So, I thought we could just compare how the same exercise would play out in Mocha.

Paul starts by pointing you to the installation instructions so you can install Ruby and Rails. He says  "However you get your RoR on your system, the procedure is pretty simple once it's installed", whatever that means ;-)  Next, he points out that you also need to install a database system such as MySQL or PostgreSQL.

Then he creates a "bookmarker" database and adds a "bookmarks" table. Then he types "rails Bookmarker" to create a new Rails app. Then a "config/database.yml" file to point to the previously created database. Then he types "ruby ./Bookmarker/script/generate scaffold Bookmark" to create the app's components based on that database. Then he starts the server and goes to http://oursite.org:3000/bookmarks. Finally he edits a template to add links to the bookmarked URLs.

Now let's see what we have to do in order to get there with Mocha:

  • You need to have Java installed
  • download OpenMocha
  • extract the downloaded archive
  • execute ./start.sh (or start.bat on Windows)
  • create an admin account at http://oursite.org:8080/register
  • copy the authentication code to the server.properties file
  • login at http://oursite.org:8080/login

Actually, this already completes our exercise, but lets say you want to add a new, separate Bookmarks application.

  • copy apps/main to apps/bookmarks
  • add "bookmarks" on a new line to the apps.properties file
  • restart OpenMocha
  • go to http://oursite.org:8080/bookmarks/login

Done. Don't believe me? Try it!

Ok, I admit this turned out to be a silly exercise. But hey, I only promised to get your feet wet - and believe me, that you did more than you realise. Welcome to OpenMocha! You really do have a working web application without writing a single line of code. And as you will see in a forthcoming example, you can now customize this application further by adding code, extending its functionality or overriding any default behavior.

25.07.2005, 13:22


People flocking to see global warming

In the Swiss Alps, a rapidly melting glacier has become the latest must-see on the travel circuit.
 
Since the beginning of the summer, the remains of the Trift Glacier have been made more easily accessible thanks to a new cable car service and the opening of a spectacular suspension footbridge .

"The glaciers in the Alps are melting," Baumberger continues. "We have almost too much water in summertime and that’s a problem. The advantage of glaciers is that they store water, regulating the circulation. If the glaciers disappear, the water will not be impeded on its way down the slope and that will cause flooding in the lowlands."

"If you want to replace the function of a glacier, you have to build a dam, which can technically regulate the flow of water," he adds.

25.07.2005, 09:25


Rails vs Struts vs Mocha

I just read " Ruby on Rails and J2EE: Is there room for both? " where Aaron Rustad compares Rails and Struts in three steps:

  1. The front controller
  2. The action and the model
  3. The persitence framework

 So, how does our Mocha environment compare?

 

 

The "front controller" in Helma would look for a stored object whos parent node structure matches the name hierarchy of the requested URL. Unless the next element in the requested URL specifies an alternative action method, the "main" action method of that object's prototype would then be called. The URL might look something like...

    http://localhost/orders/4/delete/

...where "4" would be a child object of "orders" and "delete" would be an action method of its prototype. Similar to Rails, the file structure can be used to define this prototype structure...

    app/Order/delete.hac

...but that method can also be set anywhere else in the code, even during runtime:

    Order.prototype.delete_action = function(){
         var parent = this._parent;
         parent.removeChild(this);
         res.redirect(parent.href());
    }

 

While the 'list' action could be specified as a parameter of the parent.href() call, this would most likely not be necessary.  In OpenMocha, the main action of the parent object will generate that list.

So, we already covered steps 1 and 2, the front controller and the action and model. Now, what about step 3?  There is no step 3. The objects are automatically stored in the embedded db.

Alternatively, the objects can also be mapped against a relational db, controlled through a type.properties file .

18.07.2005, 22:55


The JavaScript Manifesto

"Here it is : the website of the newly formed DOM Scripting Task Force, set up under the auspices of the Web Standards Project ." Along with a manifesto for cleaning up the last ten years of client side javascript.

And since I've been busy with the OpenMocha release, I have some additional catching up to do:

But there is more... For example, I just found Behaviour : To add an onclick event to every list item <li> in a page - you would write something like this:

Behaviour.register({

    'li' : function(element){

        element.onclick = function(){

            // Your onclick event goes here

        }

    }

});

18.07.2005, 18:28


OpenMocha is ready for a spin

OpenMocha is an open source Internet and Website application development framework for Mocha developers. Quick soft-coding and clean hard-coding in Javascript on the client-side AND the server-side.

The goal of OpenMocha is to maximize the fun and productivity of Javascript development by blending the gap between browser and server based scripting.

With OpenMocha, a new project can be quickly soft-coded by creating custom Mocha Objects using the web browser. As the project matures, these Mocha Objects can be re-factored and hard-coded in separate code files. The two approaches can be mixed at any time, patching hard-coded applications through soft-coding even during runtime.

OpenMocha intends to stretch and scale between fast all-in-one deployment and complex integration in best-of-breed environments.

14.07.2005, 17:06

The limits of harmonization

My response to Richard on his " How does harmonisation work? " post:

As I mentioned before, I certainly see harmonization as a crucial factor in a direct democracy. The two concepts are directly linked. The more harmonization, the more democracy.

However, I fear the system you are describing could in the real world manifest itself as an incubator for technocracy. Breeding an elite of people that are willing to involve themselves in the process. Specially if you start to stack this process through various levels of "hierarchy", like you have described in a comment to a previous post , this "danger" becomes more and more significant.

I believe your system suppresses some factors that contradict with the concept of harmonization but are also important factors in a direct democracy.

Should "emotional disagreement" be ignored? The harmonization process requires involvement and reasoning that not everybody will be willing or able to contribute. The wisdom of instinct is an integral factor in a direct democracy. People must have the right to vote on an issue even if they can not articulate their concern and their vote is based more on a gut feeling than on facts. This is a feature, not a bug.

What about the interests of those not interested? Harmonization can't be mandatory. Or even if you think it can be, I don't think it should be. Even in your ideal scenario where the outcome of the harmonization process at higher levels would in theory still reflect every individuals consent, I believe that a safety mechanism that allows the people to force an issue to a vote should be a requirement. Those that didn't participate in the process for whatever reason get a chance to veto its outcome.

Harmonization is about reaching a consensus for "change" but "change" is only half of the story. There is also an already existing consensus for "no change", the result of a previous harmonization process, the status quo. The decision between "change" and "no change" should happen outside of the harmonization process. This is where the direct vote of the people controls the process.

When individuals involve themselves in different interest groups and the system forces these interest groups through harmonization in order to reach a consensus then that outcome will likely be accepted by the people in a vote. There is no need to eliminate the direct vote from the process. It does not contradict with harmonization but it makes the process safer and allows it to be designed more efficient.

While harmonization in my opinion shouldn't replace referendum and initiative, it does make the concept of political parties obsolete. A direct democracy does not have a "governing party" and would never have an "opposition". In a direct democracy interest groups form around specific topics and work together to achieve concordance. The composition of the executive and the government then reflects that concordance.

I like your description of harmonization and I do know that it works. But I see it as a puzzle piece in a larger concept. Harmonization as the "best practice" for building consensus and achieving "governance in concordance" between all the different interest groups. At any level where policies are discussed and rules are drafted, the harmonization process should be applied to develop consensus. But the direct vote by the people should keep that process under control.

02.07.2005, 22:06

Le Conseil fédéral au Mont-Soleil

Les Sept Sages dans le Jura bernois.

Le Conseil fédéral a entamé ce matin sa course d'école de deux jours dans le canton de Berne. Après une excursion en bateau sur le lac de Bienne , les Sept Sages se sont rendus en hélicoptère au Mont-Soleil, au-dessus de St-Imier .

Les conseillers fédéraux sont ensuite montés à bord d'un char attelé pour rejoindre la centrale éolienne et solaire . Ils visiteront le bâtiment ainsi que l'obervatoire astronomique .

Ils découvriront ensuite le musée et la fabrique de montres Longines à Saint-Imier. Une rencontre d'une heure aura lieu avec la population. L'événement sera convivial et sans protocole.

30.06.2005, 18:37

Amiga History Guide

I'm glad I do not have to read it because I remember it :-)

10.06.2005, 09:05

>>> The people must lead the executive, control the legislature and be the military

> Copyback License
> Looking at FreeBSD 6 and Beyond
> Qualified Minority Veto
> The Doom of Representative Democracy
> Violence in a real democracy
> Concordance and Subsidiarity
> Wrapping Aspects around Mocha Objects?
> Future of Javascript Roadmap
> Baby steps towards Javascript heaven
> Mac OS X spreading like wildfire
> Trois petits filous à Faoug
> Jackrabbit JSR 170
> Rich components for HTML 5
> More Java Harmony
> Mac goes Intel
> Google goes Rumantsch
> Oxymoronic Swiss-EU relations
> Rico and Prototype Javascript libraries
> Paul Klee - An intangible man and artist
> Incrementalism in the Mozilla roadmap
> Mocha multi-threading
> Moving towards OpenMocha
> Google goes Portal
> What Bush doesn't get
> Unique and limited window of opportunity
> Persisting Client-side Errors to your Server
> Dive Into Greasemonkey
> Brown bears knock on Switzerland's door
> The experience to make what people want
> "Just" use HTTP
> Yes, what is gather?
> A Free Song for Every Swiss Citizen
> Java in Harmony
> Jan getting carried away
> Evil Google Web Accelerator?
> JSON.stringify and JSON.parse
> Ajax for Java
> The launching of launchd
> Timeless RSS
> Kupu
> SNIFE goes Victorinox
> AJAX is everywhere
> Papa Ratzi
> How Software Patents Work
> Ten good practices for writing Javascript
> Free-trade accord with japan edges closer
> Mocha at a glance
> Adobe acquires Macromedia
> Safari 1.3
> View complexity is usually higher than model complexity
> Free Trade Neutrality
> SQL for Java Objects
> Security Bypass
> Exactly 1111111111 seconds
> Kurt goes Chopper
> Choosing a Java scripting language
> Spamalot's will get spammed a lot
> The visual Rhino debugger
> The Unix wars
> EU-Council adopts software patent directive
> FreeBSD baby step "1j"
> Never trust a man who can count to 1024 on his fingers
> Visiting the world's smallest city
> Finally some non-MS, non-nonsense SPF news
> Swiss cows banned from eating grass
> Ludivines, the "Green Fairy" of absinthe
> First Look At Solaris 10
> EU Commission Declines Patent Debate Restart
> Alan Kay's wisdom guiding the OpenLaszlo roadmap towards Mocha?
> 1 Kilo
> Re: FreeBSD logo design competition
> Schweizer Sagen
> Europas Eidgenossen
> XMLHttpRequest glory
> Art Nouveau La Chaux-de-Fonds 2005-2006
> The Beastie Silhouette
> The Number One Nightmare
> Safe and Idempotent Methods such as HEAD and TRACE
> Sorry, you have been verizoned.
> Daemons and Pixies and Fairies, Oh My!
> Sentient life forms as MIME-attachments: RFC 1437
> Web Developer Extension for Firefox
> Refactoring until nothing is left
> Brendan, never tired of providing Javascript support
> Catching XP in just 20 Minutes
> Designing the Star User Interface
> Rhino, Mono, IKVM. Or: JavaScript the hard way
> Re: SCO
> Judo
> Convergence on abstraction and on browser-based Console evaluation
> Today found out that inifinite uptimes are still an oxymoron
> New aspects of woven apps
> Original Contribution License (OCL) 1.0
> Unified SPF: a grand unified theory of MARID
> BSD is designed. Linux is grown.
> 5 vor 12 bei 10 vor 10
> Mocha vs Helma?
> Schattenwahrheit: Coup d'etat underway against the Cheney Circle?
> Abschluss Bilaterale II Schweiz-EU
> From Adam Smith to Open Source
> Linux - the desktop for the rest of them
> Big Bang
> Leaky Hop Objects
> Return Path Rewriting (RPR) - Mail Forwarding in the Spam Age
> Microsoft Discloses Huge Number Of Windows Vulnerabilties
> Steuerungsabgabe statt Steuern
> Anno 2003: deployZone
> The war against terror
> The war against terror (continued)
> The relativity of Apple's market share
> Are humans animals?
> Anno 1999: Der Oberhasler
> Anno 1998: crossnet
> Geschwindigkeit vs Umdrehungszahl
> Anno 1997: Xmedia
> "The meaning of life is to improve the quality of all life"
> Anno 1996: CZV
> How do I set a DEFAULT HTML-DOCUMENT?
> Global Screen Design Services



Forum for Direct Democracy

Javascript server-side

Helma Project


Christoph Zumbrunn
2610 Mont-Soleil, Switzerland
+41 329 41 41 41
chris@zumbrunn.com
IRC: zumbrunn on freenode.net
Jabber: chris@zumbrunn.com
Skype: ChrisZumbrunn
Listening to: worldradio.ch
Xing profile



Chris Zumbrunn's Mochazone
> The A-Z of Programming Languages jumps to Javascript
> Fresh Javascript IDE in Ganymede Eclipse release
> Helma at the Linuxwochen in Linz
> Brendan on the state of Javascript evolution
> Is AppleScript done?
> ES4 Draft 1 and ES3.1 Draft 1
> Want ES4 in Helma today?
> SquirrelFish!
> ES4 comes to IE via Screaming Monkey
> Apple's position on ECMAScript 4 proposals
> Helma Meeting Spring 2008
> Attila Szegedi about Rhino, Helma and Server-Side Javascript, and scripting on the JVM in general
> Helma 1.6.2 ready to download
> Larry Lessig's case for creative freedom
> Earthlings - Can you face the truth?
> The Story of Stuff
> A Quick Start to Hello World
> The Overlooked Power of Javascript
> Adobe's position on ES4 features, plus the Flex 3 SDK source code is now available under the MPL
> Solar cell directly splits water for hydrogen
> Asynchronous Beer and Geeking and other opportunities to talk about Helma, Rhino and Javascript on the server-side
> Openmocha and Jhino updated to 0.8
> Even more Server-side Javascript with Jaxer
> e4xd and jhino - javascript server-side soft-coding
> Additional Filename Conventions
> Update to Helma 1.6.1
> Netscape, the browser, to live one more month
> SimpleDB vs CouchDB
> Helma powered AppJet - Takeoff!
> CouchDB for Helma
> Bubble bursting friendship bracelets
> Evolving ES4 as the universal scripting language
> Helmablog and an article in Linux Pro Magazine
> More praise for Helma
> Javascript as Universal Scripting Language
> So, what's up with World Radio Switzerland?
> Helma Conspiracy Theory
> JSONPath and CouchDB
> Hold the whole program in your head, and you can manipulate it at will
> Keeping track of localhost:8080
> Rhino 1.6R6 with E4X fix and patches for Helma
> Helma 1.6 is ready!
> Junction brings Rhino on Rails to Helma
> Javascript for Java programmers
> The server-side advantage
> John Resig on Javascript as a language
> Rhino on Rails
> Release Candidate 3 of Helma 1.6.0
> ECMAScript 4 Reference Implementation
> Antville Summer Of Code 2007
> Helma 1.6.0-rc2
> Using H2 with Helma
> Helma warped around existing db schemas
> Rocket the Super Rabbit
> Bootstrap is out of the bag
> The last mention of Microsoft
> Helma 1.6.0-rc1
> Introducing Planet Helma
> Helma ante portas
> Fixing Javascript inheritance
> Shutdown-Day the Helma way
> Upcoming Helma 1.6, new reference docs and IRC channel
> Making Higgs where the Web was born
> Jala for Helma
> See you at Lift'07
> More on Javascript Inheritance
> Mocha Inheritance
> Helma 1.5.3
> Fresh Rhino on Safari
> Truly Hooverphonic!
> Helma 1.5.2
> RFC 4329 application-ecmascript
> Helma 1.5.1 ready to download
> Aptana - Eclipse reincarnated as a Javascript IDE
> Building the Conversational Web
> Drosera steps in to debug Safari
> Helma 1.5.0 has been released!
> Helma 1.5 RC2 is ready
> Helma 1.5.0 Release Candidate 1 available for download
> FreeBSD Jails the brand new easy way
> Javascript 2 and the Future of the Web
> Frodo takes on chapter 3
> No Rough Cut :-(
> Welcome to Helma!
> 40th Montreux Jazz Festival
> trackAllComments
> Rails' greatest contribution
> Consensus vs Direct Democracy
> A candidate for CSCSJS or a Mocha Fetchlet
> A (Re)-Introduction to JavaScript
> coComment Roundup
> Track your comments
> Sketching image queries and reinventing email
> ECMAScript - The Switzerland of development environments
> I love E4X
> Tutorial D, Industrial D and the relational model
> Stop bashing Java
> E4X Mocha Objects
> Logging and other antimatters
> Stronger types in Javascript 2
> Javascript Diagnosis & Testing
> Homo Oxymora
> Yeah, why not Javascript?
> Moving beyond Java
> Spidermonkey Javascript 1.5 finally final
> Helma Trivia
> Finding Java Packages
> JSEclipse Javascript plug-in for Eclipse
> Catching up to Continuations
> Mighty and Beastie Licenses
> Tasting the OpenMocha Console
> "Who am I?", asks Helma
> Savety vs Freedom and other recent ramblings
> Mont-Soleil Open Air Lineup
> Rhinola - Mocha reduced to the minimum
> OpenMocha 0.6 available for download
> E4X presentation by Brendan Eich
> What is Mocha?
> Do you remember Gopher?
> The current.tv disappointment
> OpenMocha Project Roadmap
> MochiKit Javascript Library
> Getting your feet wet with OpenMocha
> People flocking to see global warming
> Rails vs Struts vs Mocha
> The JavaScript Manifesto
> OpenMocha is ready for a spin
> The limits of harmonization
> Le Conseil fédéral au Mont-Soleil
> Amiga History Guide
> More >>>