20 March 2009

Ressurection : xSiteable Framework

I've just started in my new job (yes, more on that later, I know, I know) and was flipping through a lot of my old projects over the years, big and small, and I was looking for some old Information Architecture / prototyping tool / website generator application I made with some help from IA superstar Donna Spencer (nee Maurer) back when I lived in Canberra, Australia.

I found three generations of the xSiteable project. Generation 1 is the one a lot of people have found online and used, the XSLT framework for generating Topic Maps based websites. I meant to continue with generation 2, the xSiteable Publishing Framework (which runs the Topic Maps-based National Treasures website for the National Library of Australia) but never got around to polishing it enough for publication, and before I came to my senses I was way into developing generation 3, which I now call the xSiteable Framework (which sports a full REST stack, Topic Maps. And yes, I'm still too lazy to polish it enough for publication (which includes writing tons of documentation), at least as of now, but I showed this latest incarnation to a friend lately, and he said I had to write something about it. Well, specifically how my object model is set up, because it's quite different from the normal way to deal with OO paradigms.

First of all, PHP is dynamic, and has some cool "magic" functions in the OO model which one can use for funky stuff. Instead of just extending the normal stuff with some extras I've gone and embraced it completely, and changed my programming paradigms and conventions at the same time. Let's just jump in with some example code;
// Check (and fetch) all users with a given email
$usercheck = $this->database->users->_find ( 'email', '' ) ;
Tables are are contextually defined in databases, so $this->database->users points directly to the 'users' table in the database. (Well, they're not really table names, but for this example it works that way) The framework checks all levels of granularity, and will always return FALSE or the part-object of which you want, so for example ;
// Get the domain of a users email address
$domain = $this->database->users->ajohanne->email->__after ( '@' ) ;
Again, it's like a tree-structure of data, a stream of granularity to get in and out of the data. This does require you to know the schema (and change the code if you change the schema), but apart from that, in a stable environment, this really is helpfull (it's also cached, so it's really fast, too).

You might also have noticed ... users->ajohanne->email .... Where did that "ajohanne" bit come from? Well, as things are designed, again the framework will try to find stuff that isn't already found, so "ajohanne" it will automatically look up in designated fields. All objects that extend the framework have two very important fields, one being the integer primary identifier, the second one the qualified unique name (so not a normal name as such, but a most often a computer generated one that isn't normally a number. Often systems will use things like a username, say, as a qualified name, and hence "ajohanne" was my username in one such system). Why do this?

Well, PHP is dynamic, so in my static example above, explicitly using 'ajohanne' as part of the query, isn't the best way to go in more flexible systems, but just pop your found user in dynamically instead;
$domain = $this->database->users->$username->email->__after ( '@' ) ;
Easy. And this applies to all parts of the tree, so this works as well ;
$domain = $this->database->$some_table->$some_id->$some_field->__after ( '@' ) ;
No, from the two examples above we might see a different pattern, too. All data parts has unrestrained names, all query operations use an underscore, and all string operations uses two underlines. (__after is a shortcut for substr ($str, strpos ( $str, $pattern ) ), and I've got a heap of little helpers like this built in ) Through this I always know what the type of the object interface is, and with PHP magic functions these types are easy to pull down and react to. As some of my objects are extendable, I need to pass _* and __* functionality up and down the object tree.

Traditionally, we use getters and setters ;
$u = $obj->getUsername() ;
$obj->setUsername ( $u ) ;
I turn them all into properties, so ;
$u = $obj->username ;
$obj->username = $u ;
But they are still full internal functions to the object, and this is another magic function in PHP ;
class obj extends xs_SimpleObject {
function getUsername () {
...
}
function setUsername ( $value ) {
...
}
}
The framework isn't just about object persistence. In fact, it is not about that. I hate ORMs in the sense that they still drag your OO applications back into the relational database stoneage with some sugar on top. In fact what I've done is to implement a TMRM model in a relational database layer, so it's a generic meta model (Topic Maps) driving that backend and not tables, table names, lookup tables, and all that mess. In fact, crazy as it sounds, there's only four tables in the whole darn thing. I'm relying on backend RDBM systems to be good at what they should be good at; clever indeces, and easier joins in a recursive environment (which, when all data is in the one table, it indeed is recursive), where systems use filters to derive joins instead of doing complex cross-operations (which takes lots of time and resources to pull off, and is the main bottleneck in pretty much any application ever created which has a database backend.

A long time ago I thought that the link between persistent URI's for identity management in Topic Maps and the URI (and using links as application state) in REST were made for eachother, and I wanted to try it out. In fact, that fact alone was the very inspiration for me to do the 3rd generation of xSiteable, hacking out code that basically has one URI for every part of the Topic Map, for every part of the TM API, and for other parts of your application. Here's some sample URIs ;
http://mysite.com/prospect/12
http://mysite.com/api/tm/topics/of_type:booking
http://mysite.com/admin/db/prospects
At each of these there are GET, PUT, POST and DELETE options, so when I create a new prospect, it's a POST to http://mysite.com/prospect or a direct PUT to http://mysite.com/prospect/[new_id], for example.

All in all, this means I have many ways into the system and its data, none of them more correct than the other as they all resolve to topics in the topic map. This lowers the need for error checking greatly, and the application is more like a huge proxy for a Topic Map with a REST interface. It's a cute and very effective way of doing it. I'm trying various scaling tests, and with the latest Topic Maps distribution protocols that I can use for distributing the map across any cluster, it's looking really sexy (although I still have some work to do in this area, but the basics rock!).

Anyway, there's a quick intro. I guess I should follow this up with some more coded details of examples. Yeah, maybe next week, as I need to get some other stuff done now, but I like the object model I've got in place, and it's so easy to work with without losing the need for complex stuff. Take care.

Labels: , , , SOA ROA WOA REST SOAP WS architecture,

13 March 2009

And so a new era begins

Well, yeah, it would be easy to think my headline had anything to do with changing my life, move to the other side of the planet, new job under new circumstances doing new and kick-ass things (more on all this later), but no, this is about how I wanted to "just have a look" at something which buggered my computer up, and how it changed things for the better.

So, many eons ago, I was a Linux hacker. Well, not a true hacker, but I used to adminster a Red Hat box and create some custom programs in C++. Hmm, must have been, like, about 15 years ago, as part of my civil service (military service is mandatory in Norway, which didn't fit well with my non-violent ideals) which was at the same time I ventured into the Internet as well. So, a long, long time ago, in a place I'd rather just forget about, I fiddled and meddled in the dark arts of software computing. I've always stayed in contact with Linux, but my main OS from that time on has always been in various evil Windows incarnations.

Last week I bought a new computer, a slick Toshiba Satellite P300, that came with Windows Vista. Ugh. I had big reservations against Vista, but I was in a hurry, and thought to myself that surely, it can't be that bad, right?

Well, it was. Slow, sluggish, confusing, and I seemed to have little or no control over who went online to download anything they felt like. I thought, in a quiet moment while the internet connection was bogged down by the virus program or the updater or some other bloody download I couldn't figure out, that perhaps I should finally check out my good old friend, Linux, to see what he was up to these days. I went to the distro I know has got a good load of feedback, Ubuntu, downloaded an ISO (Gutsy Gibbon, 7.10) and burned myself a CD. I popped it in, and without thinking too clearly installed it using the automatic partitioning tool.

It's that tool that made a boo-boo of sorts, and managed to wreck my Windows install; I couldn't boot into it anymore, no matter how much I tried to fix it (I've got a bit of partitioning and formatting experience through the years, luckily). So I was more or less forced to have a deep look at it to see if it could do the things I need to do.

First, the whole install took no time at all. Vista felt like an eternity with multiple restarts (over 50 minutes on my laptop), Ubuntu just copied files over, did some juggeling, and one restart (about 20 minutes). Nice.

Secondly, the Gnome desktop environment is great. I installed some extra Compiz stuff as well, and I'm quite blown away with the options, effects and stuff you can do. The standard applications and tools is more than enough for most things, perhaps with the exception of something for all the web developers out there, but that brings me to the next point;

Installing Apache2, PHP5 and MySQL/SQLite was amazingly easy, even with the extensions I need, just "sudo apt-get" a few packages, and the rest is done for you. Locate the config files in /etc/apache2 and /etc/php5, and I was done in 5 minutes, including setting up a few projects that I work on that simply Just Worked (TM) straight out of the box. I was never able to get this right so fast on Windows, and yet here it was almost too easy. I'm very impressed.

Same with NetBeans, Ruby, Python, Firefox and extensions, it all just is find the file for the packager (based on the Debian packager) and the rest is easy. The selection of software is very good, and I've been using my system as a professional for a couple of weeks without a single hitch. It's found all my hardware as well, except perhaps my Lexmark 7600 series Wireless printer (which I haven't really seriously tried to install yet, only poked around) and some glitches with hibernate and suspend (but given the time it takes for this baby to properly close and boot up again, I'm not really saving much time trying to hibernate anyways).

All in all, my first impressions are really positive, and I'm glad I had an install glitch; I love my new Ubuntu, and I can't wait to get more serious about it and Linux again. I think I've made the permanent switch.

Labels: laptop, linux, ubuntu, vista

4 March 2009

Want to feel like a second-class citizen?

Want to feel like a second-class citizen? Easy; move to a small town down the coast of Australia, and work from home with Internet-stuff for a company abroad, and feel the small-town "injernett-whatsi-bobby" pull-the-other-one mindset as you try to just rent a house to live in.

What fun this was. I can't show "payslips" as the company exists in "the injernett", a mythical place where no paper exists, and if there's no paper, there's no traversal of real things that will satisfy real-estate agents. No matter how I tell it or what I write or how I document (even my friggin' contract wasn't good enough because it was just printed off my printer! Unlike their shit?!), unless I'm a bloody janitor or pool-cleaner who gets cash in hand and gives people little receipts it seems I can't get a house around here.

I think this crash between old and new ways of earning a living is biting my bum right now. Anyone with a clue who could help out? (If you got property here you rent out and read this by accident, could you notify your real-estate agents that they truly suck? Thanks) We're in Kiama just south of Wollongong (my wife is from here, and she did indeed warn me of their backwards ways) but I foresee we will have to move elsewhere unless something comes up pretty soon.

Apart from that, things are going great, but more on that later after this silliness is sorted.

Labels: kiama, real estate, rental, wollongong

29 January 2009

Lots of changes, big and small

Phew!

Yeah, low blogging for quite some time, again because life throws me lemons when I strictly ordered potatoes. I like potatoes, but then, through a bizarre twist of fate, I've taken a liking to these lemons as well. Let me tell you a bit about them.

Where to begin? Well, I've been back in Norway for about a year now, with varying degrees of adaption-trouble and Australia-withdrawal-symptoms, but also good times in the woods, in the snow, at work and around the house. It can't all easily be summarized, but I think "busy" sums it up pretty neatly. Not an overwhelming amounts of either good nor bad, we're more or less balancing it all.

Right, the big news first; we're moving back to Australia (Kiama, 1.5 hours south of Sydney on the coast ... meet me by the blowhole!) on the 17th of February, in roughly three weeks time (but there's a 10% chance we hold off the actual move for about 6 months, if the price is right and deals fall through). What? Yes, we're moving back to the sweltering sun, the warm salty seas (the seas here are also salty, but not very warm) and a somewhat easier lifestyle. Well, at least, that's our excuse. That's what we're aiming for.

No, there is no big drama involved. We just decided, after thinking about it waaaaay too much, that Australia is a better place to live for us right now. The reasons are many and varied, but chief among them is my wife's tightly knitted extended and lovely family which we feel we need, the beach (!!!), the easier climate (these days we use about 40 minutes to get out the door on a cold day), the proximity to sub-tropical rainforest, did I mention the beach?, and, well, some other challenges I'll write more about later when all things fall into place.

Yes, I got a new job. Yes, I'll be doing exciting things. Yes, it will blow my mind, and yes, indeed, I'll be working more intensly with Topic Maps. And I'll be leaving the consultancy world behind, and indeed the library world I sometimes immerse myself in, and work for a company that's head-quartered in the east (but not far east), so lots of new things to consider and experiences to adapt to.

Let me first point out that my employer Bekk Consulting AS is the darn best friggin' consultancy gig in town (or, now with Bekk Trondheim, I dare say the country!), and I owe them everything! They've taught me right from wrong, taught me to be structured and all grown up (for the most part), gave me heaps of really interesting challenges, and have nurtured me through some tough times and being a great support. Frode B is the best boss I could ever hope to have, even in his anal retentive correctness and profssional manner there's a wonderful cheekiness that I'll miss dearly. Thanks, and thanks to all my collagues there, past and present; you're a great bunch, you really are. Oh, and if you're a good developer/BMC/UX person and want an Oslo gig, tell Frode I sent you, ok?

I've was holding a seminar in Bergen for the west-coast library sector, which I think went pretty well. I'll summarize it and post the slides when I get the chance. I had a great time and I met a lot of really nice and interesting people. Oh, and I'm doing the seminar once more before I leave, in Fredrikstad in February somewhere (13th?), so I'm looking forward to that.

In other news, I've been thinking lots about programming and development paradigms, where Topic Maps fit into it, why we're doing this again, and other IT issues that I seem to rile against. I think the whole IT sector has landed on a rather stigmatized platform from which we try to create good software, and we're failing because stigma leads to rigidity. More on this later, as well.

Anyways, that's the "first post" of the new year, a year that will go down in the history of me and my family as, um, very interesting.

30 November 2008

Monteverdi and me and tonight

I am in total awe, almost to the point of being at a loss for words. Although, as most of you know I'm never really at a loss for words, so indeed there is something I need to say.

I love Monteverdi. But of course, you knew that, no surprises there. But I was surprised a few weeks back while reading the newspaper; Terje Kvam and the Oslo Domkor (choir of Oslo main cathedral) was going to perform Monteverdi's Marian Vespers (of 1610 fame) tonight! And of course I went; I've been waiting for this moment my whole adult life, for something as momentous as this happening up here in the cold north.

First, let me explain just how crazy this is. The Vespers is a collection of music which is regarded some of the most challenging and beautiful music, for many the defining piece of work to separate mouse from men. It's an amazing piece, it's rather out of the common practice of its time, revolution and tradition all mixed up in a magnificent duality of old and new. Monteverdi who was just starting out in writing opera (and being damn successful at it with one of the first operas "L'Arianna" he wrote for the Gonzagas and performed in 1607), but he wasn't happy with his current boss. He probably thought that writing a piece of music that shakes some booty could be a good way to attract different employer (and he even dedicated it to the pope, probably kissing some Roman butt), and so he did. In 1610 it was published, and the world became richer.

So, anyway, here Terje Kvam decides to tackle this amazing work. You would think this could go so-so, but if you read between the lines you see names such as Rolf Lislevand (superstar lutenist of Jordi Savall coop fame), impressive tenors Joshua Ellicott and Johan Linderoth (these guys *got* Monteverdi, and more or less made this concert what it was), Njål Sparbo (always lovely to hear his bass) and assorted people from Norsk Barokkorkester and of course the Oslo Domkor itself which always has one of the nicest tones around. (My best friend Magnus' mum sings in the choir, and this night was her last concert with them after 18 years in it)

Here's my poor-quality camera-phone shot of the intro ;



This was an amazing concert, on a high international level. I've heard the vespers more than any other piece of work, I've got all available recordings of it (including a few that should have been burned and forgotten ever happened!), I know the music and lyrics off by heart ... and this concert blew me away! I was sitting there crying it was so good! The tone of this choir is amazing, and the soloists were fantastic, every single one of them (and especially the tenors; amazingly good!) , the band in fantastic form with the amazing Rolf Lislevand upfront.



Now, it's not too late to see this for yourself. Tomorrow (sunday, 30th of November, 2008 at the Trefoldighetskirken next to Deichman main library down town) they're doing it again. I know Magnus is going to be there, and if I get tickets (and permission from my wallet) I'll be there again. It's the one concert I would never want to end. If you're in Oslo, like this kind of music and want a kick-ass version of a piece of music that was written to kick-ass, you know what to do. I dare you!

Labels: baroque music, monteverdi, music, oslo domkor, terje kvam

10 November 2008

Bad start of the week, thanks to Steven Spielberg and George Lucas

I woke up I a crappy mood this morning. Sure, it was pouring outside, and the family is under a coughing/drooling/snot/sleepless spell these days, but the main reason I feel like this is because last night me and the wife watched "Indiana Jones and the Kingdom of the Crystal Skull." Spoilers galore warning.

What dreck! I've been thinking about it since last night, and this is just not only a bad Indiana Jones movie, but a bad movie, period! Here you've got a kick-ass cast, killer director and otherwise good filmmakers, and somehow they end up raping the good name of Indiana Jones, piss in the well of good films, break rules of good taste, and generally make me lose respect for people I normally love.

Let's start at the beginning, before the movie was even made. They announced it as "back to basics" and "that good ol' Indy feeling", pulled in a stellar cast including my all-time male favorite British actor John Hurt, and all-time female favorite actress Karen Allen (since Starman, co-starring with my all-time favorite male American actor Jeff Bridges), Aussie vixen and all-round amazing seductress Cate Blanchett, Steven Spielberg to direct, Lucas to produce. This just couldn't fail, I thought.

Ok, so "that good ol' Indy feeling" has a few guidelines;
  • Introductory segment before film proper
  • Slightly exadurated fight scenes
  • Good dialog
  • Not stupid
  • Interpersonal relationships
  • Adventure for a cause, not for magic
  • On the edge believable story-line based on real myths
The introduction here is gone, and we leap straight the film, and it follows that story throughout the whole movie. Where's our gentle, humourus and interesting entree?

Then we get lots of fight and chase scenes that are just plain dumb, that adds nothing to the story and could well have been left on the cutting room floor. The fighting itself is mostly of the comic kind, like fighting with swords with your legs split between two cars driving and having bushes and vegetaion slap your jewels at high speed. Yeah, that kind. And then there's the guy who gets eaten alive my big ants and dragged down their lair, which looks cool but is so far fetched from reality it looks stupid in an Indy movie. Yeah, that kind.

The dialog is haphazard, almost as if the actors haven't seen eachother for 20 years and are trying to find out how to communicate again. It's as if the script thought that talking and interaction was boring, and can we get to the cool CGI effects and chase scenes, eh? And some of those interactions are just plain unbelievable, such as when Indy sees Marion again for the first time in many, many years. Even the lead up to that moment was stupid (Shia LeBeuf saying his mums name is Marion didn't ring any bells? How many women in your life is called Marion? Pathetic), and you're also telling me that two people who love eachother, even with a rocky past, don't at least stay in contact? And especially she who knows her son is Indy's son? Give me a friggin' break. And what about Shia's introduction? He just walzes in, talks about some old former friend, and basically sets up the whole adventure which Indy swallows without a thought, and Voila! they're on a plane to Peru in search of ... uh, whatever. Where's character development, or, you know, characters that at least have some base in reality? Not here.

Next up; the movie shouldn't be stupid. But it does get stupid. No, not your average "balancing on the suspension of disbelief" cliff, but jumping right off it with a clowns nose and big shoes on playing the trumpet while plummeting. So, what's so stupid? Well, aliens, to begin with. And the Ox being posessed by an alien being from having looked at a crystal skull for too long. Or Indy being half-possesed by being forced to look at said skull. Or the main baddy having some mind-reading skills. or the main baddy having a rapier fetish she brings with her in a suit-case on crazy adventures and missions. Or Indy's frind Mac who betrays them, what, three or four times? I lost count, but how stupid can you be after the first betrayel? Indy movies have as little magic in the as possible, while this one pours it on and makes it the driving force of the movie. Unbelievable.

In one scene Indy proclaims that only he should return the skull, going into a cave, not because of some greater good but because the skull told him to. And yet they all go in. And Indy doesn't belive in magic, only causes. And yet they go in. For what reason? To return something, when Indy clearly wants these things in museums and collections for study purposes? Brrr.

The story is just plain bad! I saw the "making of" on the DVD where Spielberg talked a bit about how Lucas tried to put aliens in there, going back and forth. Spielberg rightly said it was a bad idea, but Lucas was persistent and they ended up with "transdimensional beings" ... *rolling eyes* For fraggs sake, how stupid can you get? I can only assume that Lucas has been listening too much to lunatic vonDänicken and thought it clever to put the crystal skulls and the Mayan / Incas / Indian myths together in a hotch-potch story, but trust me, Lucas should not go anywhere near aliens ever again. Not only that, but the alien looks just like the ones from Close Encounter of the Third Kind? And the story is resolved by the alien(s) leaving in their flying saucer, removing all evidence, as opposed to the site being covered by agents, or some government conspiracy, or whatever? A self-ersolving theme? What the heck is going on here?

There were so many details that irritated me throughout this flick I don't even know where to start. Using a snake to pull Indy out of a sinkhole? Marion saying "trust me" instead of Indy? The alien(s) is evil? And archeologist? The skulls are magnetic, yet made of crystal? LeBeuf put his shiny motorcycle in an unprotected marketplace, and it's still there when he gets back? There's ninja-like Indians at the cemetary? Who don't follow them into the crypt because Indy's got a gun? A russian female commander / scientist / phsycic with a rapier fetish? They made Cate Blanchett look ugly?!?! Indy gets fired because FBI raided his office? (One would think that would be a common practice around Indy by now) He once was involved in an alien rescue mission without knowing they were aliens? He survives a nuclear blast from hiding in a fridge, which gets slung far, far away with great force, and he exits alive? Shia can do the Tarzan trick, jumping from liane to liane faster than two military cars? And those two cars racing along a shere cliff? (I sometimes have to remind myself that these cars actually have breaks ...) And on and on, lots of stupid little things.

I didn't have too big expectations for this flick, but one would think that people of this caliber could pull it off reasonably well. The IMDB ratings give it (right now) 7 out of 10. I will never trust the IMDB ratings again. I give it 3 out of 10. So, what's the 3 for?

Good effects (which is ironic, given the promise before filming that CGI was to be minimal if any, and ended up as 30% of the movie!), beautiful scenery and great cinematography. It looks really good. But Indy is more than that, and I was very disapointed.

Good to get that out of my system. Now back to work.

Labels: indiana jones, lucas, movies, spielberg

31 October 2008

An amazing and beautiful digi-analog kick-ass clock

I stumbled upon this $1.8 million mechanical clock featuring a massive time-eating grasshopper made its debut at the University of Cambridge Friday, and famed cosmologist Stephen Hawking was on site to introduce the strange and provocative timepiece. I can't even remember what I was searching for, but it's one of those great moments of flying half-blind through the intertubes.Oh, and this is my first Digg post as well. I mean to blog a lot more stuff I find interesting, but never take the hassle to log into Blogger. This will make it easier, so ... uh, I'll see you again soon then?

read more | digg story

20 October 2008

I went to TMRA 2008, and all I got was the best days of my life ...

Update: I've added an embedded version of the slides at the bottom of the post; my cool animations and lots of fonts are wrong, but hey, you can read it at least. :)

Not to put too much sugar in your otherwise fine brew of tea, but being at TMRA 2008 this year was one of the most fantastic experiences I've had so far. Not only did I catch up with some old friends, I met some new ones I know I'll stay in touch with. So much smart and easy-going folks gathered in one place ... I'm surprised it didn't disintegrate in a puff of logic as that there really must be some cosmic law against it. Although, I see the TED conferences still churning out good stuff, so it must be allowed. And yes, I do equate TMRA with TED; it was that great.

This year I was invited to hold the opening keynote speach, which I called "You're all crazy - subjectivelly speaking", a romp on the Topic Maps community, a plea to remember epistemology in all things data modeling, and the message that being "subject-centric" is not a technical feat; it's about social processes and agreement (or, at least, rough understanding of eachother).

I used a few cheap interactive ploys to hold the audiences attention, with making them audibly disagree or agree with certain assertions I made up on the screen. It was very effectice as raising the collective awareness to the issues I was trying to point out, and especially helpful when I needed to point out that there are some things we all disagree with. And not only that, but things we should disagree with.I think people in general thought it was a good speach, and the feedback was great, so thanks to all for that.

I'd like to thank Lars Marius Garshol and Lutz Maicher for inviting and encouraging me, Patrick Durusau, Jack Park (you need a website or blog, mate!) and Robert Barta for just being who you are, and every one else for making me once again believe so strongly that the Topic Maps community is the best thing since recursive properties and frames theory!

I'm sure I'll write more on what went down at TMRA 2008, but right now I need to make porridge for my kids. Later.

Labels: , tmra 2008,