Puakma: Under the hood

I'm Brendon Upson, jack-of-all-trades, master of one or two. I'm talking about life running a small ISV tackling business issues and leaping technology hurdles in a single bound.

webWise Network Consultants is based in Sydney, Australia and develops the groundbreaking Tornado Server technology.

Off the air

Filed under: by Brendon Upson on 2007-05-25

/sigh

On Tuesday this week someone in the telephone exchange plugged the office phone line into the equivalent of the null device :-( WNC were off the air for 2 days until the  line was correctly reconnected. Very very very very annoying and absolutely nothing I could do about it.

THelstra's awesome customer service rules again (NOT) 

New DenyAccess role

Filed under: by Brendon Upson on 2007-05-17

Tornado has been gettin' plenty of l-o-v-e over the last few days. Just implemented a new system role of "DenyAccess" so that groups of users can be locked out of an application.

 Also now included some extra checking to allow the ResourceAccess role to work properly even when the design element type is not included in the URL, eg the programmer did not use the "?OpenResource" command in the URL.

Geekin' out with upgrades

Filed under: by Brendon Upson on 2007-05-16

This week I updated the server running www.puakma.net We're now running a Core2 duo setup, rather than the old P4 that was chugging away for the last 2 or 3 years. On ehting that amazes me is that the assembly of hardware just gets better and better. The full disassembly (of the old kit) and assembly of the new took only about 15 minutes. No more thermal paste to mess with :-) No more CPU fans with odd fitting clips to struggle with.

The software was another story :-(

Of course Linux hates the new jmicron SATA IDE controllers (Mmmmm 6 on the main board!) and we kept core dumping each time I tried to upgrade the kernel. Then there's the Marvell gigabit ethernet which has some really crappy linux drivers. This causes the built in ethernet to suddenly stop - and spew out a million "sky2" messages as the server shuts down. The jmicorn issues is resolved (set to AHCI mode) and the network card has been replaced by another. All in all took way more hours than it should... but it's done now.

Fingers crossed for a spanking new MacBook Pro (with Santa Rosa and LED backlight) to be released in the next couple of weeks.... before tax time. The MacBooks have just been upgraded so we must be sooooooo close! Gimme gimme.

New venture

Filed under: by Brendon Upson on 2007-05-13
I am currently in the plannign stage of a new venture. It is UNBELIEVABLE the number of domain names that are parked for speculation purposes. It seems people make a business out of buying domain names and sitting on them. So far xwqquia77sff4.com seems like my best bet. Catchy huh?

Ajax

Filed under: by Brendon Upson on 2007-05-11

A couple of years ago I got hold of some ajax code and have been using it in a number of apps. In the last week we have been working on a new UI for a customer app and I wanted to use the ajax pattern to render substantial portions of the UI in order to make the app behave in a much snappier fashion. But I came across a wee problem to solve.

The issue is that a particular code snippet was called from two different places. I wanted to execute the ajax call then the callback method to do something different depending on what parameter was passed to the method. To do this I needed my callback method to accept none or more extra parameters - dynamically. 

So lets say you have a page which is loaded with a &id=5 parameter in the URL. inside the page (in a div) there is a list of items that "belong" to 5, so the URL to load the inner div must also include the &id=5 parameter. Now it gets a bit harder. Suppose you want to delete one of those items, you create an action (serverside) to do the delete, invoke it via an ajax call, and when the call returns you want to send another ajax call to re-get the div's contents (to refresh the list minus the one that was deleted).

The old ajax code we had would only allow the specifying of the callback method to be invoked when the ajax call returned, it would not accept arbitrary custom parameters. Normally I hate loose typing but in this case, I like it ;-) With a couple of tweaks to /lib/ajax.js the job was done. We can now add up to three additional parameters to an ajax callback method.

Tornado p-tags: inside the <P@List

Filed under: by Brendon Upson on 2007-05-10

There has been a small bug for a while now in combo boxes where if the value of the combo box matched multiple entries in the list, then the bottom most entry would appear highlighted. The function that creates the html representation of the combo box had grown over time and had a lot of warts as new functionality was added. Here's some of the things you can do with a List p-tag:

  • Set the choices dynamically from an action
  • Set the choices from a keyword
  • Set the choices from a choices="a,b,c" tag attribute
  • Set the choices via a datasource="SELECT distinct Surname FROM PERSON" attribute to get the data direct from the database
  • Support a missingvaluetext="Not in list" attribute so that when there is no entry in the list that matches one of the choices, the text "Not in list" is displayed
  • Display a "read only" version when ?ReadPage is used in a URL

The great thing about p-tags is that just by changing the tag type (eg change "<P@List" to "<P@Checkbox") and the html representation is changed with no underlying code changes. Even better, action code can change the tag type on the fly, so if for example you want a field to vanish or become read only, change its type to "void" or "computed".

This is one of those portions of code where optimisation is important. I remember the first time I wrote it (in about august 2001), being a Java newbie I just used Strings and concatenated them together, a la: String s = "text" + s2 + "moretext" + s3; The funny thing with combos and list boxes, is that there can be thousands of entries (for example, imagine a list of employee names in a large company). That little String concatenation has a nasty effect on memory: Strings are immutable, each time you concatenate one with another, a third new object is created which causes a heavy hit on the garbage collector (and memory allocation). Soon after, I moved all the code to use a StringBuffer - the performance increase was huge.

In the newest change, there used to be a loop where the html "select" and "option" tags were made. This has now been replaced with a new HTMLDocumentItemChoice object which takes care of its own rendering. The logic and loop is now much smaller and uses less memory with performance on par (or a little better, 20,000 choices takes approximately 380ms to render on my laptop) with the old code.

 

Shaj: New Customer

Filed under: by Brendon Upson on 2007-05-07

We're almost at the end of another project for a customer. They are running Fedora Core and have a Tornado app to manage their office. I decided we should hook up tornado to their Linux system accounts so today began the quest to find a solution. Shaj. Great piece of software! All I had to do was write a new tornado Authenticator to access the Shaj libraries - took about 10 minutes ;-) ...and have rolled the ShajAuthenticator into puakma.jar so all tornado users now have access to it. 

For more info, http://opensource.cenqua.com/shaj/ Then I thought I'd go the whole hog and wrote another tornado app to change the current user's Linux passwords (for general system access and Samba). That took a little longer, but the net result was well worth it.

So far so good with the 4.0.0 beta. Speed seems quite a bit faster due to the better caching of a applications, and even better haven't broken anything (yet).

 

What is the past tense of "ping"?

Filed under: by Brendon Upson on 2007-05-04

I'm going with "pung" :-)

Just loaded the first cut of Tornado 4.0.0 to this server. Let the beta test begin!