Fork me on GitHub

Tagged: jaxer RSS

  • britg 7:00 am on June 8, 2009 Permalink | Log in to leave a Comment
    Tags: , jack, javscript, jaxer, narwhal,   

    The Brave New World of Server-Side Javascript 

    Not the B Team

    Not the B Team

    Every once in a while I hear whispers of server-side javascript and I get just as excited as the next person. But, I’ll admit that until recently a phrase like “Javascript on Rails” was on the same level as a phrase like “McGyver vs. The A Team – The Movie.” Fictonal. But awesome in theory.

    (Don’t worry, they eventually join forces in the sequel)

    But what about Jaxer?

    My limited experience with server-side javascript (SSJ) has been through Jaxer, from Aptana.  It touts some cool functionality, like loading the DOM server-side and built-in database drivers for MySQL, with the former allowing for DOM manipulation and integration with libraries like jQuery.

    The extremely original Gear logo

    Ubiquitous "Gear" Logo

    But, in its attempts to blur the lines between client and server execution, Jaxer has made sacrifices in its extensibility. It is meant to be plugged into another system. For instance, I don’t know of an easy way to expose data through a RESTful JSON/XML API (like so many sites are doing nowadays) using Jaxer alone.

    What I’m really looking for in SSJ is something akin to the ecosystem surrounding languages like Ruby and Python.  That’s why I was pleasantly surprised to stumble accross a few projects that aim to do just that.

    Narwhal – Javascript Standard Library and Interactive Console

    The foundation of any good ecosystem is a standard library.  Enter Narwhal, “a flexible javascript standard library.”

    There are a lot of things to like about this project, but the primary benefit is its attempts to play nice with multiple javascript runtimes like Rhino and V8cgi.  Also, this project is embracing Mozilla’s ServerJS standard which I think is important for its longevity and interoperability.

    Setup is a breeze, you can simply clone the project from github:

    git clone git://github.com/tlrobinson/narwhal.git

    Once you add narwhal/bin to your $PATH, you can use the convenient symlink js to enter an interactive javascript console similar to irb or python.

    Jack – Javascript’s “Rack”

    Interestingly enough, Narwhal came into existence as it’s author, Tom Robinson, was working on Jack.

    JSGI is a webserver interface for JavaScript inspired by Ruby’s Rack (http://rack.rubyforge.org/) and Python’s WSGI (http://www.wsgi.org/).

    Jack is an implementation of JSGI compatible handlers (to connect to web servers), middleware (to intercept and manipulate requests to add functionality), and utilities (to make using JSGI easier).

    Setup is also breezy. Simply clone Jack into the same directory you cloned Narwhal into:

    git clone git://github.com/tlrobinson/jack.git

    Since you’ve already added narwhal’s bin directory to your path, lets just make a symlink to jackup from there.

    From your narwhal/bin directory:
    ln -s [path/to/jack]/bin/jackup jackup

    Run jackup -h for usage.

    So, what’s next? Where’s Javascript on Rails?

    With Narwhal and Jack, you can start writing basic web apps. Looking at the example.js script in jack/examples we can see the basic request/response structure. Looks familiar huh?

    var Jack = require("jack");
    
    var map = {};
    
    // an extremely simple Jack application
    map["/hello"] = function(env) {
        return [200, {"Content-Type":"text/plain"}, ["Hello from " + env["SCRIPT_NAME"]]];
    }
    
    // apply the URLMap
    var app = Jack.ContentLength(Jack.URLMap(map));
    //...

    While these two pieces are a good start to a vibrant server-side javascript ecosystem, there’s still a long ways to go to before it’ll be on par with Ruby and Python.

    What SSJ needs is its Django/Pylons/Rails/Merb. There are a couple of projects I’ve found in the wild that are using Jack and Narwhal, but they appear to still be in very rapid flux.

    Nitro

    Nitro provides a library of carefully designed middleware and utilities for creating scalable, standards-compliant Web Applications with JavaScript.

    Helma NG

    Helma NG consists of several components that can be used together or alone:

    1) A compact JavaScript runtime environment based on Mozilla Rhino. It adds
    to Rhino a reloading module system that is compatible to the ServerJS
    Securable Module proposal.

    2) An interactive shell with support for autocompletion and history.

    3) A module library implemented in JavaScript, covering basic functionality
    such as extensions to the built-in objects, file I/O, logging, persistence,
    client and server side HTTP support and more.

     
    • nlsmith 2:22 am on June 19, 2009 Permalink

      Nice post.

      You can do REST/JSON with Jaxer (see http://www.aptana.com/jaxer/guide/develop_web_s…), though it's a pain to get running, and Jack would be much better suited to this type of thing.

      As far as the JS on Rails type of thing, check out ActiveJS (http://activejs.org/.) It has a way to go yet, though any contributions would be appreciated. It does have code to make it a ServerJS module, though I haven't seen it in use. All of the modules either work with Jack and Jaxer or could be made to with a little work.

      Another project that might be of interest to you is Persevere (http://persvr.org/.)

      Server-side JavaScript has been around for over 10 years, but it just now is starting to get exciting. In fact, in my day job I work on “classic” ASP in JavaScript. Exciting times.

      Thanks,

      Nathan

    • britg 2:51 am on June 19, 2009 Permalink

      Interesting, thanks for pointing me to those two projects. Perservere looks very interesting, and I immediately associated it with CouchDB because of the RESTful HTTP interface and JSON storage. But two bullets that jumped out at me that I don't know that CouchDB can tout yet is (plus I'm sure there are many more differences):

      # Comet-based data monitoring capabilities through HTTP Channels with Bayeux transport plugin/negotiation support

      # Data-centric capability-based object level security with user management, Persevere is designed to be accessed securely through Ajax with public-facing sites

    • Rob 11:54 am on July 4, 2009 Permalink

      You may also want to look at the open source M/DB:X which is an HTTP-interfaced hybrid JSON/Native XML Database. JSON objects are converted to and stored as XML DOMs which can be analysed, modified, transformed and searched in the XML domain and returned as JSON strings. See http://www.mgateway.com/mdbx.html for more information

  • britg 11:08 pm on August 26, 2008 Permalink | Log in to leave a Comment
    Tags: , aptana cloud, jaxer   

    Why Aptana is Quickly Becoming the Killer Stack 

    Anyone who knows me knows that I am a huge fan of Aptana.  (The recent acquisition of the pyDev plugin and its eventual incorporation into the IDE only solidifies that position.)  Their suite of services are quickly turning into the killer app stack for a large majority of web developers including myself and if you’re a developer who hasn’t given Aptana a try, I highly recommend you do – it’s free.

    Yes, everything they’re doing has been done before.  And yes bigger and badder players have offerings in the IDE, cloud hosting, and developer community sectors, but it’s all about consolidation baby, and Aptana wins hands down in that arena.

    The IDE Is Key

    The foundation of any good development stack is not the test or deployment servers.  It’s not the language,  documentation, or even the community.  It’s the IDE, damnit.  Because, really – what connects all the other layers?  It should be the IDE, and that’s exactly what the Aptana IDE does.

    The Aptana devs have done an excellent job in providing much more than just a text editor with syntax highlighting.  With the soon to be released Aptana IDE 1.2, you get project management, remote asset management with FTP, SVN and their new aptanacloud interface, database management, code tutorials and assistance for popular libraries and frameworks.

    No, Aptana will probably never be as good a PHP editor as Zend Studio.  And it’ll probably never be a replacement for Cyberduck or Filezilla for file management, or Amazon’s web services for cloud computing.  And you’ll probably still try to ping the jQuery docs only to realize they are still slow as hell (good alternative here, btw).  But, in the Get Stuff Done web development world, having a working solution for all these built in to your IDE is invaluable.

    The Future is in The Cloud

    As a relatively new entrant into the web technology world, I would venture to say that the biggest and most exciting development during my short tenure is Cloud Computing.  But, I’ve said it before, and I’ll say it again – managing Amazon Web Services and EC2 instances is hard work.  Google App Engine fixes the hard work problem, but you’re forced into Google’s narrow framework and constraints.

    Aptana’s new Cloud service is right smack-dab in the middle.  You’re given a sliding scale of server size, a couple of customization options, and bam! you’ve got a web server.  There’s no 50 step, command line based, get-one-step-wrong-and-you’re-hosed process to build and deploy a machine instance.  But, you also don’t have the fine-grained control of exactly what software your server runs.

    That’s an easy trade-off for the web application developer, because execution on the core functionality of your app is what matters.  No one really cares how you’ve squeezed every last ounce of optimization into your server cluster (though there’s nothing wrong with that pursuit).

    Oh, by the way, did I mention that Aptana Cloud is integrated with the Aptana IDE on every level – database management, source control, resource management, deployment, etc. etc?  Yeah, it is and it kicks ass.  Go sign up for the early access program and see for yourself.

    Javascript is the New Cranberry

    You know how you can walk down the juice aisle at your local grocery store and see 50 different juices and cranberry just seems to be involved with every damn one of them?  That’s javascript in the web world.  More often than not, JSON is the platform of choice for APIs and web services.  AJAX pervades just about every Web 2.0 application.  Hell, it’s even made it into our databases with CouchDB.

    Hey, there’s nothing wrong with that – Jeff Attwood may hate working with javascript – but I kinda sorta almost maybe like it!  Especially when working with frameworks like jQuery, javascript can be a fun experience when it adds interactivity and wow-factor to your web application.

    Enter Aptana’s end-to-end Javascript solution – Jaxer.  Damn, they thought of everything!  If web developers are spending so much time in their code interfacing with javascript APIs and writing Javascript UI interactivity, why not put javascript on the server side and use it as your middleware?  I like it.

    Hell, I can see in the near future a scenario where Javascript is the only scripting language in an entire application.  Front end javascript, with Jaxer on the server, and CouchDB as the data-store.

    Oh, and did I mention that Jaxer is integrated into the Aptana IDE with a debug console, profiler, etc? Ok, you get the point.

    So Why Did I Write This?

    Sounds like I’m a pretty hardcore Aptana fanboy, doesn’t it?  Well I can assure you the Aptana team hasn’t paid me should be paying me to say all this, damnit.  Oh well, I’ll throw in a diss just for good measure.  For some ungodly reason, the Aptana IDE only just recently added a word wrap feature.  Yes, you read that right – word wrap.  Word.  Wrap.

    Ok, they maybe might have had some sort of plausible excuse, but damn – Word. Wrap.  That’s sort of like a television not having volume control, or a keyboard without the tilde – you don’t miss it until you don’t have it.

     
    • Aptana Management 9:19 pm on August 26, 2008 Permalink

      Good Article. Please tell me where I can send the check.

    • britg 9:24 pm on August 26, 2008 Permalink

      haha, thanks “Aptana Management”

    • philip 9:53 pm on August 26, 2008 Permalink

      I like the Javascript stack of Jaxer but I want to see more of how I can integrate that with my existing large server side libraries in PHP and Java.

    • britg 5:23 am on August 27, 2008 Permalink

      Yeah, I agree – that's the biggest hurdle that Jaxer has in front of it.
      How does it fit in with all the legacy code that most people have.

      It really does take a brave soul to base an entire application on such a new
      technology.

    • Brad B. 9:06 am on August 27, 2008 Permalink

      Not one mention of Eclipse?

    • britg 9:12 am on August 27, 2008 Permalink

      The fact that they built it ontop of eclipse is great, especially with the
      plugin architecture. I thought about putting in something about that, but
      decided to lean more towards the more innovative aspects of the IDE – like
      cloud integration, jaxer server, etc.

    • Ian Selby 11:21 am on August 27, 2008 Permalink

      RE: the jaxer integration with php, etc.

      Jaxer is actually set up as a filter (in apache at least), not an interpreter like PHP, so it plays very nice with these languages. In my first week at Aptana I tested this myself and was quite happy with the results… if you want to see a very simple example, check out http://jxrgallery.aptanacloud.com. The file uploading and display is done via jaxer, but the image thumbnail / reflection processing is done via php scripts. Simple, but it works!

    • britg 11:31 am on August 27, 2008 Permalink

      Nice demo! I'm not familiar enough with apache innards to understand the
      filter vs. interpreter concept, that is interesting that the two can work
      together. I remember reading this in the jaxer discussions, but it didn't
      really sink in that a developer wouldn't use jaxer as the sole middleware in
      their app. Very cool

    • Anthony Damasco 2:44 pm on August 27, 2008 Permalink

      What about Eclipse?

    • Andrija 5:47 am on October 8, 2008 Permalink

      “the Aptana IDE only just recently added a word wrap feature”.

      I just downloaded the latest version, still RC, but there is no word wrap. Do you know how to turn on word wrap function in Aptana?

    • britg 5:55 am on October 8, 2008 Permalink

      Check out the response to the word wrap issue report here:
      http://support.aptana.com/asap/browse/STU-534?f…

      He explains how to turn on wordwrap.

    • Andrija 9:42 am on October 8, 2008 Permalink

      Thank you very much!
      It works in Aptana Studio, build: 1.2.0.017963, and I'm not using the pro version.
      Best Regards
      Andrija

    • Carl 9:46 pm on October 13, 2008 Permalink

      Do you know anyone using the product on Linux? The support seems to be really lacking.

    • gochi 2:16 am on January 17, 2009 Permalink

      Good article and good writing skill thanks for sharing this.

    • Budget Tracking Software 12:36 am on March 2, 2009 Permalink

      I've been trying to find out more about this – thanks for a great post!

    • Budget Tracking Software 10:50 pm on March 2, 2009 Permalink

      I'll have to give this a try – thanks for the demo!

    • goji juice 6:00 pm on May 26, 2009 Permalink

      Aptana Studio is an open source integrated development environment (IDE) for building Ajax web applications. It includes support for JavaScript, HTML, DOM, and CSS with code-completion, outlining, JavaScript debugging, error and warning notification and integrated documentation.

    • of mesothelioma 11:46 am on August 2, 2010 Permalink

      Thanks for writing this article – I've as of yet heard very little about Windows Mobile 6, so it was nice to read about it.

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel