Apr 10

App Engine with Ruby, Python, and Perl

Comic, Perl, Python, Ruby, Tech with tags: 9 Comments »

App Engine with Ruby, Python, and Perl

Since I am still in London, my sarcasm quotient extends just a little more than usual (it’s pretty high in the US to start with, even if it is the “lowest form of humour”).

I had a fair amount of email from people, and saw some blogs, complaining about the fact that Google App Engine currently supports Python only. On the video, and in the docs, it is frequently mentioned that other languages are to come, and that the infrastructure itself is language neutral. We have to start somewhere!

I personally have a slight Ruby preference, but there is a funny thing about Python. Hardly anyone really hates it. It may not be the language of choice for many people, but a lot of people are telling me:

  • Ah, was hoping to try more Python
  • I was looking for an excuse to code a Django app
  • I can deal with that. Thank god you didn’t force Java

This is a little like the iPhone SDK being Objective-C. People are picking it up. I think this happens then your desire to play with the new toy is greater than your religion!

I am very excited to see more languages and features on Google App Engine, but I know that I just have to be a bit patient, and in the meantime, I had been looking for an excuse to code a Django app.

Apr 08

Web Archeology: XML Binding Language (XBL)

Tech, Web Browsing with tags: , , 7 Comments »

Archeology

First came IE behaviours (HTC), which allowed you to bind script and binary behaviour to tags via CSS, for IE only of course. Mozilla decided that it needed a language to tie behaviour to XUL widgets and XML elements in general, and they created the first version of XBL.

I met Jonas Sicking of Mozilla for the first time recently, and found out that he is working on XBL 2.0, a spec that was edited by none other than Ian Hickson. That man is a machine!

XBL 2.0 cleans up the original work from Mozilla, and gives you a really nice way to add scripting behaviour to tags.

The example application below gives you a good view of how you could implement ‘an inaccessible implementation of the proposed HTML5 details disclosure element: it opens and closes when clicked, and reflects its current state in the element’s “open” attribute.’

<xbl xmlns="http://www.w3.org/ns/xbl">
 <binding element="details">
  <template>
   <div>
    <div><content includes="legend:first-child">Details...</content></div>
    <div state="hidden" id="container"><content/></div>
   </div>
  </template>
  <handlers>
   <handler event="click" phase="default-action">
    this.open = !this.open;
   </handler>
   <handler event="DOMAttrModified" attr-name="open" attr-change="addition" phase="target">
    this.shadowTree.getElementById('container').setAttribute('state', 'visible');
   </handler>
   <handler event="DOMAttrModified" attr-name="open" attr-change="removal" phase="target">
    this.shadowTree.getElementById('container').setAttribute('state', 'hidden');
   </handler>
  </handlers>
  <implementation>
   ({
     get open() { return this.boundElement.hasAttribute('open'); },
     set open(val) {
       if (val)
         this.boundElement.setAttribute('open', 'open');
       else
         this.boundElement.removeAttribute('open');
       return this.open;
     },
   })
  </implementation>
  <resources>
   <style>
    #container[state=hidden] { display: none; }
   </style>
  </resources>
 </binding>
</xbl>

What I find interesting is how you bind this behaviour via CSS a la IE behaviours:

details { binding: url(details.xml#details); }

You can also do so programatically:

$$('details').each(function(el) {
  el.addBinding("details.xml#details");
});

Once you have this behaviour setup, you are fully embedded in the DOM. You see ‘details’ as a true node, rather than a processing hack that would put in divs and spans in their place. You will notice the shadowTree that let’s you have a full DOM behind the scenes.

Imagine if this spec was implemented by a series of browsers. Is there a way to have a shim that could take XBL 2 and map it to IE behaviours? That is a question for Dean Edwards ;)

In general, this seems like a great extension point to let us take generic behaviour and reuse it. It could be a great way to add functionality to older browsers too, just as we were able to add alpha transparency to IE via binary behaviours.

Do you see value?

Other posts on Web archelogy:

Apr 07

Web Archeology: Java Pluglet API

Ajax, Java, Tech, Web Browsing with tags: , 3 Comments »

Stone Henge-esque

Even since Ben and I looked at the notes for the first version of Mozilla that supported XMLHttpRequest, which suddenly took the technology from “Some ActiveX for IE” to “Ajax”, I have been interested in hidden technologies that maybe never made it. In those notes for that release we saw no mention of XMLHttpRelease, but technology such as FIXptr was prominently mentioned.

Also, something interesting about Ajax is exactly the fact that the technology was available since 1997, but didn’t make it big until many more Dilbert calendars later.

This points to the fact that there may be some hidden gems in the past that could also be resurrected in the now! As I look back in time, I thought I would talk about any that interest me in some way. Hence, the Web Archeology set of postings. If there is a technology that I am missing, please let me know!

Today I am going to talk about the Java Pluglet API. This technology is part of the Blackwood project at Mozilla, where it was created in 1999 by Igor Kushnirskiy & Akhil Arora.

Let’s walk back to 1999 for a second. Imagine working on Mozilla in a world where you had to futz with a lot of XPCOM and C++ to build things. XUL came about a way to reach out via more Web-y technology to get work done (XML, JavaScript, CSS, etc). In 1999, Java was a sexy language, and everyone was getting ready for fantastic server side Java with great technology like EJB ;)

What if the Java developers could get in on the browser action and develop rich plugins for Mozilla? This is where the Java Pluglet API comes in. It allows you to do just that, mimicking the C++ side of the house:

It was a conscious design decision to have the Pluglet API resemble its C++ counterpart as much as possible, while being able to reflect all of its functionality to Java, so that Plug-in writers will not have to learn yet another API. This concern, in our opinion, outweighed other alternatives which offered a cleaner, more Java-like look. Support for other Plug-in APIs can be easily added by contributing adaptors.

How you register the pluglet is via mime types. You could create application/wicked-cool and when that comes back from the server, Mozilla will say “hmm, I don’t understand this mime type, Pluglet Engine do you?”

At a high level the idea of writing extensions in Java makes total sense to me. It is obviously cross platform, but still low level enough, with a huge library set to get a lot done.

Isn’t this dead?

Probably? Ed Burns did step up to the plate though and reenergized the project recently. As part of the resurrection you can now interface directly between the Java side and JavaScript itself.

If you squint a little, you see an interesting plugin path for the browser. I often say that I would love for Gears to be made using Java instead of C++!

Apr 02

Teasing through a Twitter

Tech with tags: 2 Comments »

Twitter Tease

There is a class of tweets that somehow bug me. They aren’t the @someoneElse haha right buddy ones, which can be irritating, but I blame Twitter for those. Quotably does the right thing, but this really needs to just be done by Twitter itself in my opinion.

The irritant is the teaser. No offense to RWW (I love the site), but this is a good example:

Teaser

I don’t want to know that at some point something is going to happen. No inside joke here, just post the darn thing and tweet that.

No teasing!

Apr 01

Optimistic Adcurrency: Google and Oracle partner to create AdSense for Databases

Tech 5 Comments »

Chris Anderson thinks that the future of business is free, and Google continues to drive the advertising business model.

Today, Google has partnered with Oracle to give yet another vector for advertising, close to the content, from your database.

There are two distinct services involved:

AdSense for DB Delivery

The AdSense for Oracle Recommendation Engine creates indexes close to the content in database tables (that you can tune). These indexes contain recommended ads that are pulled along with the data when you query it.

Imagine a shopping cart system that has the AORE installed. When the cart software queries for products you get the advert back in the result:

SELECT * FROM products WHERE name LIKE '%Wii%' LIMIT 1
+--------------+---------+----------+----------------------------------------------------------------------------------------------------+
| name         | price   | quantity | ad                                                                                                 |
+--------------+---------+----------+----------------------------------------------------------------------------------------------------+
| Nintendo Wii | $499.99 | 2        | Buy Nintendo Wii Now, Wii In stock, Ships Same Day, Free Shipping & No Tax, www.WiiHustler.com/Wii |
+--------------+---------+----------+----------------------------------------------------------------------------------------------------+

Since this is at the database level, you have full control on how and where to place the ad in your product (not only Web products, this could be in rich desktop clients).

I expect to see hybrid options where people can get the free ad supported software, or pay to not see the ads.

But this is only half of the offering, we also have…

AdSense to DBAs

As we worked on the engine, we quickly found that DBAs themselves were very good targets for advertising. To supplement your Oracle licenses, you can turn on AdSense to DBAs which turns on the ad column for all tables as a way to directly advertise to the DBA running the queries.

SELECT * FROM accounts LIMIT 1
+--------------+-------------+----------+----------------------------------------------------------------------------------------------------+
| name         | number      | amount   | ad                                                                                                 |
+--------------+-------------+----------+----------------------------------------------------------------------------------------------------+
| bank         | AO203943456 | $333.98  | Remote DBA Oracle Support: supported by the most respected DBAs in the industry tusc.com/orclspt   |
+--------------+-------------+----------+----------------------------------------------------------------------------------------------------+

We believe that this will be the revolution known as optimistic adcurrency.