Home
vgs_rss' Journal -- Day [entries|friends|calendar]
vgs_rss

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

Multiple File Uploads with Aptana Jaxer [21 Mar 2008|11:40am]
10:52 20.03.2008
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.  
  2. <script type='text/javascript' runat='server'></a>
  3. var message = "";
  4.  
  5. for (fileCount=0; fileCount <Jaxer.request.files.length; fileCount++){
  6.     var fileInfo = Jaxer.request.files[fileCount];
  7.        
  8.     var destinationFilePath = Jaxer.Dir.resolvePath(fileInfo.originalFileName);
  9.     fileInfo.save(destinationFilePath);
  10.  
  11.     message += "<br>" + [
  12.                 "Saved to : "       + destinationFilePath
  13.         ,       "original filename : "                 + fileInfo.originalFileName
  14.         ,       "temp filename : "          + fileInfo.tempFileName
  15.         ,       "contentType : "             + fileInfo.contentType
  16.         ,       "size : "                     + fileInfo.fileSize
  17.         ].join("<br />");
  18.        
  19. }
  20. document.write(message);
  21. </script>
  22.  

read more at Ajaxian
post comment

Ajax on Embedded Devices such as the BarracudaDrive [21 Mar 2008|11:40am]
11:59 20.03.2008
Ajax on Embedded Devices such as the BarracudaDrive

There is something cool about being able to write an Ajax app on an embedable device.

The people behind BarracudaDrive have released a free version of the BarracudaDrive Ajax application server for the Linksys NSLU2 and the Unslung Linux firmware.

Developers can customize and write their own applications by using the integrated scripting language Lua Server Pages, which is based on the super fast scripting language Lua. The server includes its own integrated database engine, thus making it possible to create configuration less database powered applications such as the CMS. The server also includes the Bindows Ajax framework.

The integrated scripting language Lua Server Pages (LSP) is similar to how ASP and PHP works. BarracudaDrive LSP applications are deployed as standard ZIP files. The ZIP files, which are in the "applications" sub directory are loaded and mounted as read only file systems by the web server. The server can also load "non deployed" applications. The "non deployed" Lua Server Pages (LSP) are compiled on demand just like PHP and ASP pages are compiled.


read more at Ajaxian
post comment

Why getBoundingClientRect is important [21 Mar 2008|11:40am]
12:30 20.03.2008
Why getBoundingClientRect is important

We posted about PPK's thoughts on CSSOM which included him dissing getBoundingClientRect() and getClientRects():

I feel this part of the specification is not yet ready. At the very least, the relation of TextRectangle boxes to actual elements should be defined in the case there's more than one TextRectangle box, because I don't understand what to expect (and I suspect browser vendors don't, either, because Firefox and Opera never report more than one box, anyway).

John Resig, on the other hand, thinks that getBoundingClientRect is awesome (high praise, for a method).

What makes this method so especially handy is that the alternative means of computing an element's offset position is so horribly slow and buggy that it borders on the comical.

The general purpose of this method, or of similar implementations, is to allow the user to get the visual top/left position of an element (such that if they absolutely position an element from the document it would be on top of the desired element - making things like tooltips possible, to name a single application). This means that you have to take into account a huge number of quirks.

To illustrate the point he points us to the jQuery implementation of .offset(), which is ugly indeed.

He also shows how much faster it is by creating a test page and a movie demonstrating the difference.


read more at Ajaxian
post comment

SMD: Pluggable Web Services [21 Mar 2008|11:40am]
12:46 20.03.2008
SMD: Pluggable Web Services
JAVASCRIPT:
  1.  
  2. {target:"/jsonrpc", // this defines the URL to connect for the services
  3.  transport:"POST", // We will use POST as the transport
  4.  envelope:"JSON-RPC-1.2", // We will use JSON-RPC
  5.  SMDVersion:"2.0",
  6.  services: {
  7.    add : { // define a service to add two numbers
  8.    parameters: [
  9.      {name:"a",type:"number"}, // define the two parameters
  10.      {name:"b",type:"number"}],
  11.    returns:{"type":"number"}
  12.  },
  13.  foo : {   // nothing is required to be defined, all definitions are optional.
  14.    //This service has nothing defined so it can take any parameters
  15.   //and return any value
  16.  },
  17.  getNews : {
  18.    // we can redefine the target, transport, and envelope for specific services
  19.    target: "/newsSearch",
  20.    transport: "GET",
  21.    envelope: "URL",
  22.    parameters:[ { name: "query", type: "string", optional: false, default: "" } ],
  23.    returns:{type:"array"}
  24.  }
  25. }
  26.  

What is that? Does it look a little WSDL-y without the XML? This format is Service Mapping Description (SMD), and Kris Zyp talks about how it enables pluggable Web services.

With the schema about you can wire it together (example using Dojo):

JAVASCRIPT:
  1.  
  2. var services = new dojox.rpc.Service("http://mydomain.com/mySMD");
  3.  
  4. var newsDeferred = services.getNews({query:"dojo"});
  5. newsDeferred.addCallback(function(returnValue) {
  6.     alert("A news item: " + returnValue[0]);
  7. });
  8.  

Neil Roberts asked about cross domain SMDs and Kris said:

Yes, we will use JSONP, although we use a special form, where the callback function will be derived directly from the name of the SMD, in order to allow for static creation of SMDs that can be accessed cross-domain.


read more at Ajaxian
post comment

OpenID and OAuth in the browser? [21 Mar 2008|11:40am]
13:59 20.03.2008
OpenID and OAuth in the browser?

Originally posted on my personal tech blog

When I was looking over Brad Neuberg’s Paper Airplane thought experiment I noticed the single sign on feature, where you login to the browser, and then you are done.

I realized that this is what I actually want. Having one signon via OpenID is really nice. It allows me to plug in “http://almaer.com” as my identifier. However, I always have to go around finding the OpenID option (if it exists) and put that in.

What I really want is for the browser to do that work for me. If a site groks OpenID the browser should be able to pass that over without having me intervene at all. It could hide the entire login process if we came up with a microformat to let all sides know what is going on.

It would be a breath of fresh air to be able to jump through sites leaving comments on blogs, and checking out my todo list, all without me once having to actually login.

I wonder if a Gear could be made with a complementary microformat / server side handshake that could then give us single sign-on in all of the browsers.

As Brian McCallister suggests:

HTML:
  1.  
  2. <link rel="openid-auth" href="..." /></a>
  3.  

Does this make any sense? Would you like the browser to handle all of this for you? I would.


read more at Ajaxian
post comment

navigation
[ viewing | March 21st, 2008 ]
[ go | previous day|next day ]