» tagged pages
» logout

sorted by: recent | see : popular
Content Tagged with Aptana + Ajax

The Ajax side of AIR

AIR 1.5 has been released at MAX this week.

For the folks that like to write AIR apps that at least have some JavaScript, you will be happy to see that WebKit has been updated:

The version of WebKit included in AIR has been updated to a newer version. The updated version includes Squirrelfish, a new bytecode interpreter that improves the execution speed of JavaScript for common actions. Our internal tests show that HTML-based AIR applications run as much as 35% faster for many types of operations. We have also added support for interactive debuggin fo Ajax-based AIR applications.

There is also a nice sample app that uses jQuery called BlackbookSafe.

Aptana is also helping you out with their new Studio plugin for AIR debugging:

Today's release of the Adobe AIR Development Plug-in for Aptana Studio (beta) features, you guessed it — JavaScript debugging for Adobe AIR apps along with support for Adobe AIR 1.5 which Adobe announced earlier this week.

Ajax: Ajaxian

Aptana Jaxer 1.0 released, brings together the Aptana trinity

Paul Colton of Aptana has announced the Jaxer 1.0 release. This comes on the heels of the general availability of Aptana Cloud, and of course their Studio product that ties things together.

First, Jaxer 1.0:

If you've already been using Jaxer you're likely familiar with its database, file system and socket APIs and its ability to not only run JavaScript and process the HTML DOM at the server, but also to expose server-side functions to the Web such that a HTML page can call back to those functions directly from the Web page. Thus Ajax communications could not be any easier with Jaxer: You just write a server-side function, "proxy it" with one line of code, then call it from the Web browser as if that function were part of the web page. Jaxer handles the client/server communications, data transformations, and provides the client-side function with its return value (either synchronously or asynchronously).

Recently we've added even more capabilities based on community feedback. These including support for RESTful APIs as well as native support for JSON to supplement the E4X (XML for JavaScript) support that's been there all along (thank you Mozilla!). The combination of these means you can easily create RESTful services that can be consumed by a wide array of Ajax applications, Web gadgets, Facebook or OpenSocial apps, and even Adobe Flash or Microsoft Silverlight based apps since those support JavaScript too. Plus mobile devices like the Apple iPhone and phones from other manufacturers are nearly all supporting JavaScript and Ajax. As you can imagine we're excited to see JavaScript become more and more the lingua franca of Web applications. It's already ubiquitous on the client side and now you can use it confidently on the server side.

We sat down with Paul, Uri Sarid (CTO), and Kevin Hakman (Director of Evangelism) to talk about this release in particular as well as the other recent news and the grand plan.

We have the audio directly available, or you can subscribe to the podcast.

There are a series of nice new screencasts to give you a quick feel for it all. Learn more about Jaxer, Cloud, and Studio.

Ajax: Ajaxian

Aptana Jaxer 1.0 RC

The Jaxer team has released a release candidate for Jaxer 1.0.

Here a synopsis of all the new features and improvements that have gone into this latest release candidate:

  • Jaxer.Sandbox: HTTP-level control; support readyState, toHTML, waitForCompletion
  • Built-in, extensible dispatching for RESTful and RPC service requests
  • Fast, native JSON support
  • Improved APIs for HTTP Request and Response
  • More flexible handling of application configuration
  • Many bug fixes, smaller improvements, and cleanups

They are moving pretty fast, so are looking for feedback before they wrap up a final 1.0 release.

Ajax: Ajaxian

Aptana Jaxer Benchmarks

Jaxer has been out in beta for a while and is nearing its 1.0 release. Many comments on Ajaxian about Jaxer have been about performance benchmarks. Uri Sarid, CTO of Aptana, has compiled some initial benchmarks including comparisons to PHP and Ruby on Rails. (Jaxer comes out in between the two):

We wanted to answer a simple question: how does Jaxer, with its server-side DOM and JavaScript, perform relative to these other popular alternatives?

This was not designed to be an all-encompassing shoot-out, or a detailed study of everything you might want to do in a web app. Instead, we took a few common tasks — making database requests, using JSON, etc. — and implemented them as you might expect in the three platforms. We made enough DB requests and JSON calls and so on to give us a reasonable number of milliseconds to measure. But we also wanted to make the repetitions representative of what you might find on somewhat intensive real-world page, so we're not making a million DB requests, just a hundred, for instance. And we included one benchmark of serving an almost-static page: the "almost" was to make sure we were measuring the time the platform took to really read through the page, in case it had dynamic content in it. (Otherwise, if the page were truly static, you could always arrange for the web server to serve it without involving the platform.)

The tests include page scraping tests (e.g. mashup work), database performance, file I/O, JSON, and programatical loops.

Ajax: Ajaxian

Aptana Jaxer | Aptana

Dom processing server, extraction et analyse de page web server-side, text mining

json: del.icio.us/tag/json

Form access control via jQuery and Jaxer

Tom Kirkpatrick has written about writing one form, and using access control to map it to various roles using jQuery and Jaxer.

This is a simple pattern. You never want to use client code to manage access, for obvious reasons. The approach is to use the server to spew out HTML that makes sense, and then parse in the input and check access control.

Using Jaxer, this is all taken care of in JavaScript, and you can use libraries such as jQuery to do work there.

One solution to the roles issue is to manipulate the DOM on the server before it heads to the client. The magic lies in the 'server-nocache' directive which tells Jaxer than "the code should only run on the server, and that the code or should not be cached and will therefore not be available during callbacks."

HTML:
  1.  
  2. <script runat="server-nocache">
  3.  
  4. // some kind of authentication to get current users role
  5. role = getRole()
  6.  
  7. // remove private form elements
  8. $((role == 'employer') ? '.employee.private' : '.employer.private')
  9.   .remove();
  10.  
  11. // disable irrelevant form elements
  12. $((role == 'employer') ? '.employee input' : '.employer input')
  13.   .attr('disabled', 'disabled');
  14.  
  15. // no need to inject Jaxer client framework (saves about 20k)
  16. Jaxer.response.setClientFramework();
  17. </script>
  18.  

Of course, to be safe, you need to always test access control incoming, and not rely on the HTML that you send down.

Ajax: Ajaxian

Another Jaxer 1.0 Release Candidate with new APIs

Greg Murray has blogged about a new release candidate for Aptana Jaxer that contains a lot of new features.

Kevin Hakman told us about the release:

We've had server-side JS database APIs all along, but now handing result sets is even easier. There's also now full fine grain control and access to the entire communication cycle with APIs for message headers, redirects, content and types. Speaking of types… for the first time with Jaxer, you can return content types other than HTML including JSON, XML, GIF, etc… Yes, even GIFs. Jaxer has a fresh new Image API that among other things can convert Canvas to static images and serve them up. Like, Greg, I too really like the idea of using Jaxer for easily creating JSON data services which is a rapidly growing trend as developers discover the powerful capabilities of JSON more and more. In Jaxer, it's very cool since it's all native JavaScript on the client, on the wire, and on the server. There's even enhanced JSON serialization to make it even easier than before on both client and server. JSON services also open Jaxer to be useful in combination with rich internet clients other than Ajax UIs such as Flash, Flex or even Silverlight since all those support JavaScript on the client and can consume JSON data. For Ajax and RIA developers this is a boon since you can now write your client-side and server-side code in the same language. And if you prefer XML data services Jaxer's native E4X (ECMAScript for XML) support means you can handle XML docs natively in JS on Jaxer as well.

This release also includes a totally new concept: a secure sandbox which as Greg explains, "lets you load, on the server, pages from other domains and allow their JavaScript to execute without giving them access to the Jaxer API or your own server-side code, but still gives your code access to their window objects and anything inside them". For anyone who has ever done screenscaping for mashups or other applications, this really helps a lot since Ajax pages have historically thwarted scraping operations. With this feature in Jaxer you can securely get a remote page, execute its functions, and scrape the resulting DOM nodes (yes, you need not do tedious manipulations with strings) and voila!

Here are the features:

  • Application context settings that allowing for easier app configuration, app properties, database settings, etc...
  • Database API enhancements with richer APIs for working with result sets.
  • Server-side image manipulation including server-side canvas support and ability to convert to other image types.
  • Native command execution API so that you can run system commands and handle the output from those.
  • Asynchronous server-side JavaScript processing lets you implement callbacks in your server-side code too.
  • Ability to return custom content types (e.g. json, xml, gif, html, etc...)
  • Full control of the request/response lifecycle including setting redirects, headers, content, etc...
  • Secure sandbox supporting cross domain calls, sandboxed JavaScript execution, META refreshes, ...
  • Serialization support for JavaScript objects to and from XML, E4X and JSON.

Uri Sarid has a great post that shows how you can do DOM Scraping with Jaxer, and updates it for this latest release:

There's a lot of other new goodness in Jaxer 1.0, as well as the official released version of the Mozilla engine found in Firefox 3. So for example getElementsByClassName is natively implemented (see John Resig's speed comparison), in addition to the other Mozilla features such as built-in XPath functionality and a very robust DOM feature set — just what you need for some serious 'screen scraping', mashups, and content repurposing.

Let's see it in action!

It includes code that shows the Sandbox in action, as well as the DOM work:

JAVASCRIPT:
  1.  
  2. // Gets a fragment of the remote page's HTML, after some cleanup 
  3. function getFragment(title, url, isClassName, identifier, classesToRemove) 
  4. { 
  5.     var sandbox = new Jaxer.Sandbox(url)
  6.     var contents = sandbox.document[isClassName ? 'getElementsByClassName' : 'getElementById'](identifier)
  7.     var container = addToPage(title, contents)
  8.     if (classesToRemove) 
  9.     { 
  10.         if (typeof classesToRemove == "string") classesToRemove = [classesToRemove]
  11.         classesToRemove.forEach(function(className) 
  12.         { 
  13.             removeNodeList(container.getElementsByClassName(className))
  14.         })
  15.     } 
  16.     return container.innerHTML
  17. } 
  18. getFragment.proxy = true
  19.  

Ajax: Ajaxian

Talking to .NET on the server with Jaxer

What does your CEO do? Paul Colton, CEO of Aptana, gets his fingers dirty. He just wrote a post about accessing COM objects from JavaScript with Jaxer.

This is possible as the JavaScript is running on the server, and this server is running on Windows. You can download the source code to check it all out.

HTML:
  1.  
  2.      <body>
  3.          <script runat="server-proxy">
  4.              function rotate(angle)
  5.              {
  6.                  var img = COMObject("ImageProcessor.ImageProcessing");
  7.  
  8.                  img.LoadImage(Jaxer.request.documentRoot + "/photo.jpg");
  9.                  img.RotateImage(angle);
  10.                  img.SaveImage(Jaxer.request.documentRoot + "/new.jpg");
  11.              }
  12.          </script>
  13.          <input id="angle"/>
  14.          <input type="button" value="Rotate"
  15.                         onclick="rotate(document.getElementById('angle').value);
  16.                                 document.getElementById('img').src =
  17.                                 document.getElementById('img').src + '?' + new Date()"/>
  18.          <br />
  19.          <img id='img' src="new.jpg"/>
  20.      </body>
  21. </html>
  22.  

Ajax: Ajaxian

Talking to .NET on the server with Jaxer

What does your CEO do? Paul Colton, CEO of Aptana, gets his fingers dirty. He just wrote a post about accessing COM objects from JavaScript with Jaxer.

This is possible as the JavaScript is running on the server, and this server is running on Windows. You can download the source code to check it all out.

HTML:
  1.  
  2.      <body>
  3.          <script runat="server-proxy">
  4.              function rotate(angle)
  5.              {
  6.                  var img = COMObject("ImageProcessor.ImageProcessing");
  7.  
  8.                  img.LoadImage(Jaxer.request.documentRoot + "/photo.jpg");
  9.                  img.RotateImage(angle);
  10.                  img.SaveImage(Jaxer.request.documentRoot + "/new.jpg");
  11.              }
  12.          </script>
  13.          <input id="angle"/>
  14.          <input type="button" value="Rotate"
  15.                         onclick="rotate(document.getElementById('angle').value);
  16.                                 document.getElementById('img').src =
  17.                                 document.getElementById('img').src + '?' + new Date()"/>
  18.          <br />
  19.          <img id='img' src="new.jpg"/>
  20.      </body>
  21. </html>
  22.  

Ajax: Ajaxian

Leveraging Ext JS on the Server via Jaxer

When Aptana released Jaxer, it really excited the community because you could now leverage your client-side skills on the server end of things. Rich Waters of Ext JS talks about how to leverage Ext JS on the server via Jaxer. The code created by Rich creates a Ext JaxerStore which allows you to run queries and directly put them into a Ext Store. This has the benefit of leveraging the same Ext language syntax you've become accustomed to for server-side processing by allowing Jaxer to wrap client and server-side communications up allowing either synchronous or asynchronous calls between the client and server.

I asked Rich why would developers do this versus doing a simple Ajax call to a template sitting on a server:

The template bit lets you generate the html before the page is served up so that no extra client side calls are necessary. I think the Ext template system is really slick and easier than even a lot of other existing server side templating systems. More or less it was also just an example to get people thinking about what could be done now that Ext can be run server-side.

The code snippet allows you to make the calls to Jaxer very easily:

JAVASCRIPT:
  1.  
  2. Ext.onReady(function() {
  3.    var store = new Ext.data.JaxerStore({
  4.        table : 'demo',
  5.        fields : [
  6.            {name : 'name'},
  7.            {name : 'phone'},
  8.            {name : 'email'}
  9.        ],
  10.        readerConfig : {
  11.            sortInfo : {
  12.                sort : 'name',
  13.                dir : 'asc'
  14.            }
  15.        }
  16.    });
  17.  
  18.    // create the Grid
  19.    var grid = new Ext.grid.GridPanel({
  20.        store : store,
  21.        columns : [
  22.            {header : "Name", sortable : true, dataIndex : 'name'},
  23.            {header : "Phone #", sortable : true, dataIndex : 'phone'},
  24.            {header : "Email", sortable : true, dataIndex : 'email'}
  25.        ],
  26.        viewConfig : {
  27.            forceFit : true
  28.        },
  29.        stripeRows : true,
  30.        height : 350,
  31.        width : 680,
  32.        title : 'Jaxer Demo Grid',
  33.        renderTo : Ext.getBody()
  34.    });
  35. });
  36.  

which would then populate a grid control and render it accordingly.

The source code to this new functionality can be downloaded here.

Ajax: Ajaxian

Aptana Cloud: A sneak peak

Aptana Cloud

Dougal Matthews has been playing with Aptana Cloud in a beta form. He wrote up this piece that walks you through the functionality with screenshots:

After creating a project it then is automatically available in the cloud options.

When you click on the project under the cloud menu you are taken through a (very easy to use) wizard for configuration. This runs your through a few steps, setting up a site name, picking a payment plan (the beta is free), payment details and so on. Most of these screens are fairly standard, however the service selection is quite interesting. I imagine these prices are not final, so just take them with a pinch of salt.

The payment scheme seems to be quite flexible and we can see a large number of services that are included, PHP being the main server side language at the moment, with Aptana Jaxer still being a beta… (Ruby of Rails is on the ‘coming soon’ list). The prices range from the cheapest being 256 MB ram and 5 GB hard disc for $0.99 a day, up to 2 GB of ram and 25 GB hard disc for $8.22 a day. Seems fairly reasonably priced.

After set-up is finished, it phones home and does some magic.

This is an important step for Aptana, as it not only gives us a good general cloud service, but it also gives you the perfect place to play with Jaxer. I am looking forward to seeing more.

Ajax: Ajaxian

Aptana Cloud: Develop on your desktop, sync out to the cloud

Aptana have announced their cloud platform initiative, Aptana Cloud.

Aptana Cloud plugs right into your IDE to provide instant deployment, smart synchronization, and seamless migration as you scale. Aptana Cloud is ideal for developers who use scripting languages to create Ajax, Facebook, mySpace and all other sorts of Web applications.

The key is that this isn't a infrastructure play, which they clearly point out:

Aptana Cloud is architected to complement Cloud infrastructure providers like Amazon, Google, Joyent and others. To get started we've selected Joyent who serves up some of the largest of all Facebook apps.

This shows that their platform is designed to go meta, allowing you to deploy to various clouds in the future.

I think that the number one meme from Web 2.0 Expo last week was the "cloud", coming off of the excitement of Google App Engine. With Aptana Cloud we will see sophisticated tools to make us productive in the cloud. I am very excited to see that it won't be too long until developers will be able to build an application, hit DEPLOY, and be done. This is a huge win.

For developers:

  • IDE plug-in integrates Cloud development, deployment and management life-cycles right into Aptana Studio in either its standalone or Eclipse based editions
  • Instant deployment of projects to Cloud
  • One click sync your project to the Cloud, or provide fine grained sync control too
  • Integrated service management consoles
  • Configure desired memory size and disk size
  • Develop and instantly preview remote files right inside your Studio desktop environment
  • Subversion source control.

As Ajax developers, the vision of Jaxer in the cloud is very interesting too. The entire application using JavaScript, and deployed up into the cloud, all through the nice IDE.

I was also pleased to read that not only Ruby on Rails, but Python is on the docket. After developing Django applications and playing with Google App Engine, I would love to be able to use Studio for Python code too. Not that Emacs (X or GNU) isn't great, Steve!

Darryl Taft wrote:

Aptana adds extra value via IDE integration, deployment automation and active monitoring and notification services, Hakman said. “It's like the ease and simplicity between iTunes on your desktop and its connectivity to services on the Web,” he said.

For developers, the IDE plug-in integrates cloud development, deployment and management lifecycles right into Aptana Studio in either its standalone or Eclipse-based editions, Hakman said. "The ability to deploy stuff to the cloud from Eclipse is part of this as well."

Other developer features include instant deployment of projects to the cloud; one click can sync your project to the cloud or provide fine-grained sync control; the technology features integrated cloud services management, enables users to provision their cloud right from Aptana Studio, configure desired memory size and disk size, develop and instantly preview remote files right inside the Studio desktop environment, and includes Subversion Source Control.

Can't wait go get an invite. If you want one too, request an account.

Also, Aptana Studio just passed 1,5 million downloads. Impressive.

Ajax: Ajaxian

Server-side jQuery, E4X, and more with Jaxer

Davey Waterson of the Aptana Jaxer team has posted an article on using jQuery on the server-side with E4X and more that shows an example of server-side Ajax with a popular framework.

The article describes a polling application that features:

  • Using jQuery server-side to manipulate a DOM before it's sent to the client
  • Doing some database / SQL interactions, server-side in javascript of course
  • User sessions in javascript (Jaxer.session.set('status', status);)
  • Using E4X on the server-side.

There are fun little features such as nuking portions of the page if the permissions call for it:

JAVASCRIPT:
  1.  
  2. $((status == 'voter') ? '.nonvoter' : '.voter').remove();
  3.  

Since the application delivers no JavaScript itself, this would all work even if the user has JavaScript turned off, on a simple mobile phone, etc.

Ajax: Ajaxian

Multiple File Uploads with Aptana Jaxer

Dealing with file uploads can be a test of a Web framework. I personally long for the input type="file" to be improved with items such as multiple="true" for multiselection, let alone showing the status of the upload (20% complete).

The Jaxer folks have posted on Easy File Uploading using Aptana Jaxer which shows how you can tinker in JavaScript to get everything you need in a very simple way:

To receive the data from the form when submitted we put some Jaxer code into the page the form will be submitted to. The code below should be in script block with a runat = 'server' attribute, which makes the code run serverside and doesn't present it to the client so you don't expose any serverside filenames or folder structures.

HTML:
  1.