And another workspace . . .

April 8th, 2008

I have been messing about with CouchDB for a while. Back in 2006 I put together a couple of LotusScript wrapper classes for it using LS2J to do the communications and presenting a friendly API for putting Notes like data in and out of the CouchDB database. Now I have been mucking about with Python and PyGTK trying to build something of a GUI to link with CouchDB. Here are a couple of screenshots to give you a feel of the progress so far. Firstly the workspace, because every client worth having must have a workspace. This one is based on a gtkiconview widget. It really is getting the list of database names directly out of the CouchDB server. The icons are pulled from the filesystem at the moment but I want them to come from each database when I figure out how to work with attachments. They are .png files, I think .svg would work too, along with most other formats you could mention.

This next screenshot shows a form. The form is designed using Glade, a user interface designer which saves UI definitions as XML. The client code reads the XML and inserts the form into a new tab in it’s own user interface. At the moment the form XML is being read from the filesystem, but that too can come from a document in couchDB.

This will probably run on Windows as well as Linux. I don’t think GTK (or the Twisted/Python/GTK collection) runs on Mac at the moment.

Document Freedom day

March 26th, 2008

Happy Document Freedom day!

Today would be a great day to install OpenOffice.org or Lotus Symphony if you haven’t already. If you already use these great tools then today would be a great day to show them to someone else.

The Open Document Format is a well designed modern format which any system creating documents for use in a wordprocessor, spreadsheet or presentation tool can use. Over the last decade or so the free market in office suites has basically been destroyed by the Microsoft monopoly. This happened not because Microsoft were producing better software, the users of Smartsuite, Wordperfect etc. were really quite happy with their software. It happened because Microsoft got themselves into a position where the format of choice for exchanging documents was .doc and .xls and .ppt. It became the defacto standard. The other products reverse engineered this binary format so they could support this defacto standard, but people discovered that the best way to reliably interchange the Microsoft owned format was to use Microsoft software. Not much of a surprise there really. Microsoft won a lot of business by ensuring a lack of a level playing field.

Open Document Format or ODF is an XML based file format which is designed not to just be the format used by one application but by all of them. Microsoft could support ODF as a native file format for Microsoft Office if they wanted to. It is not a software engineering challenge that they can’t rise to. They don’t want to because it would end their convenient distorted marketplace. Moving to ODF as the normal way of interchanging documents between businesses in future will level the playing field and re-enable a free market and free choice of software applications.

The Microsoft binary formats are at the end of their life. Now is the time to choose which direction to go forward. Microsoft want us to use their OOXML format. They desperately want to protect their position and revenue stream, which is understandable,but not my problem.

Document Freedom is in your interest, tell someone about it today.

Almost a workspace

March 9th, 2008

As many of you know, I have been playing with various small Linux based laptops which are going to change the world. One thing I have noticed on some of them is a familiar user interface. This is the Elonex One, it was launched last week in the UK and I was there to play with it, I even did a review. Here is the home screen of the One in tablet mode:

Elonex One

Now lets look at another small Linux laptop, this is the Asus EeePC which in the UK RM are calling the RM Minibook:

EeePC

Does that remind you of anything? Let me give you a clue :-)

Notes on EeePC

I couldn’t get Notes standard for Linux running on it (mainly because of the odd way IBM packaged the install I think) but this is Notes 8 basic for Windows running under Wine.

Of course no article about world changing Linux laptops would be complete without a picture of the One Laptop Per Child XO laptop so here it is:

No workspace on that one, but it is running CouchDB (yes, that URL does start with localhost)

dis29500.org has gone a bit Dojo

February 5th, 2008

I have been updating dis29500.org importing lots of new data in the form of the leaked dispositions and adding a new system for tagging and some Dojo prettyness. Have a play and let me know if anything breaks. Feel free to blog about it too, there will be a bit of a relaunch in the next few days, but it would be nice if the lotus blogosphere got the scoop on it.

The OLPC XO, 30,000 teachers and me

January 22nd, 2008

My followup article on the visit to BETT has now been posted on the OLPC news website I know it is somewhat off topic for my regular Dominux readers, but the BETT show was pretty amazing. You might be at Lotusphere right now with an estimated 8 kilogeeks, but BETT draws in 30 kiloteachers from all over the world. In the picture on the right I am the one who would need some glue and cotton wool if I was wearing a santa suit.

Day 1 of not being at Lotusphere

January 21st, 2008

Well day 3 or so if you count all the days I would have been there if I was. Today is the Opening General Session which I am following live as the expected announcements flood in. So why am I here and not there? Basically when the call for abstracts went out I figured I had nothing much to say this year. Last year was great showing OpenOffice.org integrating with Notes. This year the Productivity Editors AKA Symphony is more of a reality, but I am not that interested in them. I am focusing more and more on work under The Open Learning Centre brand rather than Dominux and I couldn’t really justify the cost. So this year I will spend a week in January wishing I was elsewhere, but on the other hand I will eat in February.

ogs.jpg

Well I have had an amazing day today!

January 10th, 2008

Back in December The Open Learning Centre (which is myself and Alan Lord - The Open Sourcerer ) was invited to meet up with The Open Forum Europe to discuss ways we could work together. They invited us to go to the BETT show and help out on their stand talking about Open Source software. I said I would bring along my OLPC laptop as an example of Open Source in education.

Come last week, my laptop had not arrived. We had nothing to show, not much to say. HELP!! We needed a new plan. I borrowed a bit of space on the olpcnews.com website to appeal for anyone with an OLPC to let us borrow it for BETT. A couple of days later we got a call from Tomi Davis, the chief executive of OLPC Nigeria who lives in North London offering some laptops. Yesterday we went to see him and he lent us three of the most excellent OLPC XO laptops. We had a good play with them whilst munching meatballs in the IKEA restaurant then we were ready. Today was manic. The OLPC laptop was on BBC breakfast news this morning. We had loads of people come up and tell us they had just seen the laptop on the TV. One teacher told us that just seeing the laptop made his vist to BETT worth the effort. Tomi joined us for the afternoon and we were interviewed on camera by the show TV crew. We made loads of interesting contacts in the UK and abroad, everyone wants these laptops and they want Open Source software in their schools. Today BECTA (nice bunch of folk, they liked the laptops too) released a report on Microsoft Vista and Office 2007 I think their conclusions are just as appropriate for business as for schools.

So today we have been demoing someone else’s laptops on someone else’s stand which we got at the last minute through an appeal on someone else’s website and they are all really really happy that we did it!

Google Charts with Formula language

December 7th, 2007

Google just released a new toy for us to play with, the Google Charts API. It really is very simple, just construct a URL in a particular way and it gives you a png file.

Lets say for example you have 12 months of sales figures in millions of pounds as below (these are not the actual Dominux sales figures)

sales:=12:15:16:18:25:30:28:42:32:35:36;

then you need to encode this by replacing the numbers with letters where A=0, B=1 etc.

valuecodes:="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
coded:=@Implode(@Transform(sales;"v";@Middle(valuecodes;v;1));"");

and now generate a url and put it in an img tag
"<img src=\"http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=s:"+coded+"\">"

so shove all that into some computed text and make it passthru html to get

The Slashdot effect

December 4th, 2007
dis29500.org was on the front page of Slashdot this morning at 6am. Initially the site could not cope, but then it was running as a virtual machine with 128MB ram and hosting dis29500.org, A Story For Bedtime, The Open Learning Centre, The Open Sourcerer, Fondoo.net plus routing email and running couchDB and running the Red5 flash streaming server. It now has 450MB or ram and it is very responsive. It would have been nice to see a Domino server slashdotted, and I certainly could have written dis29500.org in Domino, I am just more interested in doing interesting things with technology that I don’t know like the back of my hand.

Visits based on hour of day

434
Statistics
1.02
%
387
Statistics
0.91
%
584
Statistics
1.37
%
199
Statistics
0.47
%
205
Statistics
0.48
%
324
Statistics
0.76
%
509
Statistics
1.2
%
245
Statistics
0.58
%
462
Statistics
1.09
%
2662
Statistics
6.27
%
3665
Statistics
8.63
%
2943
Statistics
6.93
%
2748
Statistics
6.47
%
2829
Statistics
6.66
%
3604
Statistics
8.48
%
3867
Statistics
9.1
%
2917
Statistics
6.87
%
2672
Statistics
6.29
%
2512
Statistics
5.91
%
2401
Statistics
5.65
%
2195
Statistics
5.17
%
1826
Statistics
4.3
%
1363
Statistics
3.21
%
930
Statistics
2.19
%
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Visits based on day of month

480
Statistics
1.13
%
1825
Statistics
4.3
%
1601
Statistics
3.77
%
26312
Statistics
61.94
%
195
Statistics
0.46
%
117
Statistics
0.28
%
91
Statistics
0.21
%
118
Statistics
0.28
%
124
Statistics
0.29
%
40
Statistics
0.09
%
369
Statistics
0.87
%
233
Statistics
0.55
%
99
Statistics
0.23
%
84
Statistics
0.2
%
193
Statistics
0.45
%
151
Statistics
0.36
%
59
Statistics
0.14
%
103
Statistics
0.24
%
339
Statistics
0.8
%
127
Statistics
0.3
%
149
Statistics
0.35
%
1355
Statistics
3.19
%
728
Statistics
1.71
%
487
Statistics
1.15
%
1579
Statistics
3.72
%
723
Statistics
1.7
%
1479
Statistics
3.48
%
703
Statistics
1.65
%
1370
Statistics
3.22
%
923
Statistics
2.17
%
327
Statistics
0.77
%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3

Spot the diff

November 24th, 2007

Wikipedia or wikis in general have a really really cool feature, the history tab. It shows the differences between two versions of a page down to the word, you can easily see what has been added, what has been removed and what has been changed. Behind all this is a diff algorithm. The diff algorithm used by Domino Wiki was written by John Resig and released under a creative commons license, it works really well but it is written in Javascript. This is great for web applications and it does work in the Notes client as Javascript to some extent, but I want a version in LotusScript.

Step one is to understand the algorithm.

Firstly, there are some redundant functions. Function randomColor() and function diffString2() can both go, they are a distraction. Function escape() is useful on the web, but irrelevant in the notes client so that can go. Function diffString() and function diff() are the ones that we need to examine.

There are no comments in the code and lots of short cryptic variable names, so lets rewrite it with comments to explain what it is up to.

function diffString( o, n ) {
//o and n are strings, the old string and the new string
//first trim the ends of the strings s+$ means whitespace (s) followed by end of input ($)
  o = o.replace(/s+$/, '');
  n = n.replace(/s+$/, '');
//now call the diff function and put the result in a variant called out. More on this later.
//the parameters of the diff function are two arrays, the question mark is a kind of shorthand if statement
//if the string is "" then it passes in an empty array [] else it does an @explode on the strings and passes in that.
  var out = diff(o == "" ? [] : o.split(/s+/), n == "" ? [] : n.split(/s+/) );
  var str = "";
// it is now going to make an array of all the whitespaces in the original strings
//this allows it to put back the correct type of whitespace (space, tab, newline etc.) in the correct position
//personally I don't care very much. I would be happy with all whitespaces ending up as " " in the output
  var oSpace = o.match(/s+/g);
  if (oSpace == null) {
    oSpace = ["n"];
  } else {
    oSpace.push("n");
  }
  var nSpace = n.match(/s+/g);
  if (nSpace == null) {
    nSpace = ["n"];
  } else {
    nSpace.push("n");
  }
// out is an object with various properties, we will work out the exact structure later.
  if (out.n.length == 0) {
//if the new string is empty then the whole of the old string is in <del> tags
      for (var i = 0; i < out.o.length; i++) {
        str += '<del>' + escape(out.o[i]) + oSpace[i] + "</del>";
      }
  } else {
    if (out.n[0].text == null) {
//this is another test for the new string being empty so more <del> tags
      for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
        str += '<del>' + escape(out.o[n]) + oSpace[n] + "</del>";
      }
    }
//now we loop through word by word in the new string
    for ( var i = 0; i < out.n.length; i++ ) {
      if (out.n[i].text == null) {
//the line above looks a bit wrong, but the .text property of out.n[i] doesn't do what you think it does.
//if out.n[i].text is null then that means that the word in the new string has been inserted
        str += '<ins>' + escape(out.n[i]) + nSpace[i] + "</ins>";
      } else {
        var pre = "";
//now append any words from the old list that followed the current word from the new list
//these are stored in the row property of out.n[i]
        for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
          pre += '<del>' + escape(out.o[n]) + oSpace[n] + "</del>";
        }
now we add the words that appeared in both lists. out.n[i] won't be populated for inserted words.
        str += " " + out.n[i].text + nSpace[i] + pre;
      }
    }
  }
//and hand back one string with markup for differences to the caller.
  return str;
}

I hope the comments help a bit, but it doesn’t totally make sense yet until we understand the structure of the “out” object. I used the sample text from John Resig’s article:

diffString(“The red brown fox jumped over the rolling log.”,“The brown spotted fox leaped over the rolling log);

after running it gives output like this:

The <del>red</del> brown <ins>spotted</ins> fox <del>jumped</del> <ins>leaped</ins> over the rolling log.

I used a stringify function to convert the “out” object to JSON code, so here is what the object looks like as JSON:

{

“o”:[

{”text”:”The”,”row”:0},

“red”,

{”text”:”brown”,”row”:1},

{”text”:”fox”,”row”:3},

“jumped”,

{”text”:”over”,”row”:5},

{”text”:”the”,”row”:6},

{”text”:”rolling”,”row”:7},

“log.”

],

“n”:[

{”text”:”The”,”row”:0},

{”text”:”brown”,”row”:2},

“spotted”,

{”text”:”fox”,”row”:3},

“leaped”,

{”text”:”over”,”row”:5},

{”text”:”the”,”row”:6},

{”text”:”rolling”,”row”:7},

“log”

]

}

so out has 2 properties, n and o. They are both arrays of things, the things can either be scalar text or arrays.
The arrays have a property called “text” and a property called “row”

That is enough for now, I will dig into the diff function next which builds this out object, then I will try to reimplement the whole thing in Lotuscript.