Classes and Dojo are very cool

Tonight I am looking for a way to make different presentation styles in the attachment viewer.  I figure I would look into making the different presentations with JavaScript classes and with a little bit of inheritance to boot.   Unfortunately JavaScript does not support classes very well and there are a thousand ways to accomplish this, just Google it and you will see.  I of course chose Dojo to get this done because it was dead simple!

I want to have three presentation styles to start – film strip (default), thumbnails, and slide-show.

The main reason  I wanted to have this be like a class hierarchy is because the title part (where it is File: filename) needs to be re-used and eventually I will have common actions under the title like “open“, “save“, “share“.  So I need a base method in a shared class that can be inherited by the subclasses.  Using dojo.declare, the base class is the following:

dojo.declare("showStyle", null, {
 showHeader : function(id){
 showAttachment : function(id, att, idx){
 showTitle : function(id, att){
     var title = document.createElement("div");
     title.innerHTML = "<b>File:</b> <i>" + + "</i><br>    ";
     title.innerHTML += "<small><a href="#" onclick="openAttachment('" + att.file_url + "');return true;" title="Open this file">open</a></small> ";
     title.innerHTML += "<small><a href="#" onclick="viewAttachment('" + att.content_url + "');return true;" title="View this file">view</a></small> ";
     title.innerHTML += "<small><a href="#" onclick="viewAttachment('" + att.content_url + "');return true;" title="Share this file on Facebook">share</a>";
     title.innerHTML += "</small><br><hr>";                  

 showFooter : function(id){

Pretty basic right?  The two parameters in showtitle() are the DOM id the HTML will be inserted into and the “att” is the attachment JSON object. The other methods are stubbed out but I could have default implementations of them in the future.

Now for a subclass!   I won’t go into the details but each subclass will implement a showHeader(), showAttachment(), showFooter() and will be called by the framework.  Here is the reworked original code and put into the “filmStrip” subclass.   Notice the statement in red below.  This tells JavaScript to call the showTitle() method which is implemented in the base class.

dojo.declare("filmStrip", showStyle, {    
    showAttachment : function(id, att, idx){
    var codeArea = document.getElementById("code");    

    this.showTitle(id, att);

    if (att.content_url != null && att.content_url.length > 0){

        var node = document.createElement("div");
        node.setAttribute('id','attachment_' + idx);


        var xhrArgs = {
            id : 'attachment_' + idx,
            type : att.type,
            preview_url : att.preview_url,
            url : att.content_url,
            handleAs : "text",
            preventCache: true,
            content: {
            id: 'attachment_' + idx

        load : function(response, args){
           document.getElementById( = response;

           var func = getScript(this.type);

           if (func != null)
               func(, this.preview_url);


     if (statusArea != null)
         statusArea.innerHTML = "<br>Item not recognized: " +;            


The end result is, because of inheritance, the code just processes the object like its a base “showStyle” object.

var style = null;

if (_showStyle == 1)
      style = new slideShow();
else (_showStyle == 2)
      style = new tileSyle();
      style = new filmStrip();

if (style.showHeader){
 for (var a = 0; a < attachments.length; a++) {
      var att = attachments[a];
      if (att.type && att.type == "attachment"){
           style.showAttachment('attachmentArea',, a);
 if (style.showFooter){

All software should implement CTRL+ and CTRL-

I must be a FireFox advocate or at least like the zoom in and out shortcuts because I find myself using CTRL+/- in many places like Notes, Symphony, etc.  The only problem is the keys do nothing in them!

Who is with me?

CouchDB scales, it’s not a slogan, its science!

Check out this impressive write-up about CouchDb.   Remember Dr. Cox at Lotusphere 2010 and the CERN project?

Metson says the learning curve for CouchDB is quite shallow. In fact, DMWM had a summer intern with some programming experience, but no experience in CouchDB, who was able to build a simple data quality evaluation application using the database. The only drawback, Metson says, is that you may need to do a lot of unlearning if you’re well versed in SQL. “The more you know Oracle, the harder it is to pick up,” he says.

Link:  Why Large Hadron Collider Scientists are Using CouchDB

The Cloud, is it a platform or just more of the same?

I have been digging into the various “cloud” offerings on the net and trying to see if there is a common ground in this space and as usual it appears the usual players are making bets on their “cloud” offerings. When you start seeing sites like, LinkedIn, Facebook, or API’s like Microsofts Azure, all using different technologies to provide applications within “their cloud” it quickly shows people are off in their own camps.   I have been reading up on the DeltaCloud (Many clouds. One API. No problem) which is attempting to solve this disparity with a wrapper approach. As long as you have a particular clouds “module” installed on the server, your code can connect to and participate in that cloud. The API’s seem to be very basic out of the gate but I think the direction is worth watching.  Amazon has a huge web presence and companies like Eucalyptus have even standardized on its API’s for their own back-end so it makes me wonder if there will be camps but not many camps in the end.

Using the same application programming interfaces (APIs) that Amazon deploys for its Amazon Web Services (AWS), Eucalyptus allows users to set up their own private clouds and move workloads among internal servers, or to and from AWS. The software is available both as free, open-source code and as a paid version. – PC World

Do we need the same for collaboration?  Open Social (Many sites, one API – sound familiar?) is suppose to fix that but it isn’t totally adopted by all players either.

A common API means you have less to learn to build for multiple websites. OpenSocial is currently being developed by a broad set of members of the web community. The ultimate goal is for any social website to be able to implement the API and host 3rd party social applications. – OpenSocial

If we really want a true cloud then there is going to have to be some level of common API, data model, and interfaces across the players otherwise developers and IT will be needed for the integration points.  As more and more stuff moves to the cloud you may see more and more job openings for “ developer” or “OpenSocial developer” or “AWS experience a plus”.

I think this is a frontier of opportunity for any IT person or developer – which is one of the reasons I love this industry.  It is forever changing and challenging.

The Inventor’s Guide to Trademarks and Patents

If you want to learn how to get money for your intellectual property or patent something in the software world then you should check out this book. I was just re-arranging my books and found this little gem. It has a lot of great ideas and pointers for where to get started.

What is your web site worth?

Just playing around tonight I noticed a section of a site I hit that showed the “value” of their site. This intrigued me because I wondered how they could possibly know that? So I scoured the net and looked for as many services as I could to see my sites value and it clearly looks like this is not a scientific approach by no means. My highest value is $46,000 and my lowest is $98, that’s useful…

My site is worth $17,367.
How much is yours worth?

This website is worth
What is your website worth?

My site is worth $119.
How much is yours worth?

var base=”;;document.write(“”);

My blog is worth $564.54.
How much is your blog worth?

Poll: Do you or your customers develop or use applications on

I have been checking out this week and it is a pretty extensive cloud based solution for developing, deploying, and using applications in the cloud.  I checked out their Eclipse based development videos and the development environment looks pretty comprehensive.  I would like to hear if anyone who reads this blog has any real experiences they would like to share about it.  I am also interested to hear how many of my readers have real exposure to

If you use in any manner, application use, develop for, deploy on, integrate with or any of the above please take some time to post your answer below and possibly a comment on your experiences.

If you are a Lotus customer I would like to hear how you integrate your XPages, Domino or Notes applications with

Thanks in advance!

[poll id=”14″]