Tuesday, May 22, 2012

Gnome Shell - Netbook Interface - Part II - quick update

It turns out that I got something horribly fundamentally wrong with my last post. I knew there'd be some mistakes.

I found the style guide - found here.

Firstly, the applicationObject would have to change to:

function applicationObject() {
    // change this to allow for .desktop file information
    // to come in and an icon and localised text to be
    // returned.
    let self = new St.BoxLayout(
            { vertical: true,
            style_class: 'application' });
    self.icon = new St.Icon(
            { icon_name: 'applications-system',
            icon_type: St.IconType.FULLCOLOR,
            style_class: 'applicationIcon' });
    self.lblName = new St.Label(
            { text: 'calculator' });
    self.add_actor( self.icon );
    self.add_actor( self.lblName );
    self.connect( 'button-press-event', _tellMe )
    return self;

Why? The "this" variable is disregarded if you have a return value. I'm also going against one of the design patterns in the style guide - namely, I'm getting my object to return a type - self, which is basically a St.BoxLayout object.

This is inheritance. Later on in the guide, it also states the method for inheritance they suggest doesn't allow for inheriting from a GObject type. I'm not sure if I'm missing the point, but I think this is a way around that restriction. Don't quote me on that.

It appears to work though I guess I really should test it...

The other thing I've discovered - if I start looking glass while I have my "interface" showing, it starts to respond to mouse clicks... Now if I could just figure out what's happening for it to start responding to clicks.

Gnome Shell - Netbook Interface - Part II

It seems these posts have become horribly popular though I am infinitely unqualified to teach anyone about gnome shell. I don't know javascript... At all... This is going to get interesting.

So it turns out that Gnome-Shell has been forked already. I'm pleased to have learnt this. I would like to be able to ultimately offer a bunch of different interfaces based upon need and preference in parallel with each other as well as Gnome Shell and Unity. In other words, rather than an extension, I'd really like to create a fork. Still - humble beginnings. I barely know how to walk. Of course, if I do manage to pull this off, it should make an interesting log of just how many times I got it all so very wrong.

So I'm desperately trying to learn Javascript. In particular, I'd love to figure out how to sort out the whole classes debacle. It turns out javascript doesn't really have classes. (Sorry - forgot to do my geek speak warning...).

Instead, everything is an object. Including functions. So, you could use a function as a class:

function testClass () {
    this.something = 3;

So in order to use this I would then do something like:

myObject = new testClass();
global.log( myObject.something );

So this gives me properties but what about methods? Two ways - define it internally such as the following:

function testClass () {
    this.something = 3;
    this.square = function( number ){
        return Math.pow( number, 2 );

Or I can do it externally using the prototype keyword:

function testClass () {
    this.something = 3;

testClass.prototype.square = function( number ){
    return Math.pow( number, 2 );

The preference of the gnome-shell developers seems to be the first method - define them internally. So with that piece of information in hand (got to love the long routes taken when trying to learn something for the first time), we'll actually make a start on the netbook interface.

One of my design patterns is to simply extend GUI elements. This is completely contrary to my rant about separating out the GUI bits and doing the logic elsewhere - though it can be argued that given that we're only doing GUI bits, that paradigm doesn't really apply here anyway.

So the GUI element I'm looking at. Think about the application icons. They all share a whole bunch of attributes (probably those defined in an application's .desktop file - normally found in /usr/share/applications on a Debian based system. I'm not sure if this is the same in Redhat/Slackware etc. based systems). So it'd be silly not to use a class. But, because I like things to be fairly tidy, the GUI bit should just contain all of those extra bits of information. So it'd be something like this:

So essentially, I want to return a boxLayout object (with the vertical property set to true) which contains an Icon and a Label (we probably want to make this a bit more flexible in the future. i.e. Categories are the same thing only with the icon and label in a hbox - a boxLayout object with the vertical property set to false).

By this reasoning, we should be able to do something along the lines of:

function applicationObject() {
    self = new St.BoxLayout({
            vertical: true,
            style_class: 'application'});
    this.icon = new St.Icon();
    this.name = new St.Label();
    self.add_actor( this.icon );
    self.add_actor( this.name );
    return self;

Of course this is missing a bunch of things. What happens onClick? Where does it get the information about the icon from? And the name of the application? So okay - it needs a lot of work. This is what I have so far:

const St = imports.gi.St;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
const Shell = imports.gi.Shell;
const Lang = imports.lang;

let button, menu;

function _tellMe(){
    global.log('Can\' get this to work' );

function applicationObject() {
    // change this to allow for .desktop file information
    // to come in and an icon and localised text to be
    // returned.
    self = new St.BoxLayout(
            { vertical: true,
            style_class: 'application' });
    this.icon = new St.Icon(
            { icon_name: 'applications-system',
            icon_type: St.IconType.FULLCOLOR,
            style_class: 'applicationIcon' });
    this.lblName = new St.Label(
            { text: 'calculator' });
    self.add_actor( this.icon );
    self.add_actor( this.lblName );
    self.connect( 'button-press-event', _tellMe )
    return self;

function _showMenu() {
    if (!menu){
        menu = new St.BoxLayout(
                { vertical: false,
                style_class: 'menu',
                height: Main.layoutManager.primaryMonitor.height - Main.panel.actor.height,
                width: Main.layoutManager.primaryMonitor.width,
                reactive: true });
        menu.set_position(0, Main.panel.actor.height);
        menu.visible = false;
        something = new applicationObject();
        menu.add_actor( something );
    if (menu.visible) {
    else {

function init() {
    button = new St.Bin(
           {style_class: 'panel-button',
            reactive: true,
            can_focus: true,
            x_fill: false,
            y_fill: false,
            track_hover: true});
   let icon = new St.Icon(
           {icon_name: 'applications-system',
            icon_type: St.IconType.FULLCOLOR,
            icon_size: 24,
            style_class: 'system-status-icon' });
    button.connect('button-press-event', _showMenu);

function enable() {
    Main.panel._leftBox.insert_child_at_index(button, 0);

function disable() {

.menu {
    color: #ffffff;
    background-color: rgba(10,10,10,0.3);
    border-radius: 5px;
    padding: .5em;

.application {
    icon-size: 3em;
    font-size: 48px;
    border: 1px;
    border-radius: 10px;

.applicationIcon {
    icon-size: 3em;

So I've got the start of something. It's not brilliant (yet)... I'm missing something - and I've got a feeling it's a one-liner. At the moment I can't click on the icon. It's showing, but it's not reactive/responsive in anyway whatsoever. Rather, it's like an overlay. It's there, but I can't for the life of me figure out how to make it respond to clicks. Anyone got any hints?

Wednesday, May 16, 2012

Clarifying My User Interface Woes

I think I've figured out what's bothering me about computer user interfaces. We've been doing it oh so wrong for years.

Think about your average secretary. Those indispensable people who somehow are able to keep track of a million and one things. Think about how their work space looks.

Post it notes everywhere. Even worse, a desktop that looks just plain disgusting.

And what have we offered to try and alleviate this situation?

In just about every operating system there's a post it replacement. There's even one on my android phone (though I would argue a phone interface isn't made in anyway whatsoever to be productive).

In Unity, desktop icons are disabled by default. You can get nautilus to manage the desktop, but then, why do something badly that we've always done badly? So if we were to redesign it, with these users in mind, what would the desktop look like?

I've stated my unease with geeks dictating how we work. Why aren't they working with the user to come up with something that solves a bunch of their problems?

So, if I were to redesign the desktop - I'd do away with the idea of one desktop. I would instead look for a tabbed interface (much like the netbook interface). You'd then be able to create a new tab (folder?) which you could arrange icons (visual representations + captions) into logical workflows. i.e. you could create a tab called "Invoicing", which would contain a link to timesheets (in order to generate invoices if you didn't have an automated system for doing so) and a link to an invoice template and a link to a folder with old invoices in it.

What about the good old post it notes around the computer? Why try to put it on the computer? And if you really do need it there, wouldn't it be more useful to have it in the cloud to be accessible on other machines? A really quick search brings up listhings - the sign up needs just an email address and password. No other details asked for.

Of course, there'd have to be a few major changes to make this happen in Linux. For starters, Gnome doesn't seem to be all that concerned about documents. Sure, you can create symbolic links and move those links to your desktop. But that's just not simple.

What if you didn't allow anything but links (desktop files)? The user's encouraged to file their documents properly in their home folder (or network share as the case may be) but they're also given all of the convenience that they've probably been seeking.

The question though - am I the only one who thinks this would be brilliant?

Saturday, May 12, 2012

A Quick Tribute To XKCD

At one stage I found I was easily spending around 3 hours a day going to my daily websites. Things like web comics, news etc. BoingBoing.net, HackADay.com, LXer.com, theDailyWTF.com (worse than failure) etc. It just goes on and on.

Recognising it as problem I've cut out almost all of them. I go to LXer.com fairly regularly. I occasionally load up theDailyWTF.com. But I ALWAYS go to xkcd.com and go through any comics I missed. Here's a tribute song to it posted on youtube.

xkcd reached an odd status a couple of years ago when it was making a point about wikipedia (I'm convinced that Randall Munroe hates Wikipedia or at the very least is determined to point out all of the flaws). Here's the comic:

I didn't think the comic was that great myself. But what happened next though was fascinating. An entry suddenly showed up on Wikipedia about the made up word "Malamanteau". But it wasn't the entry that was interesting - it was the discussion. Just how passionate people got about whether it should be included or not. I wouldn't recommend reading through it all though it's interesting to note just how long that page is.

Recently there was this:

You just know someone has had to have done it... Someone's got to have recorded themselves singing it. It turns out loads of people have. One tried to do it to "supercalifragilisticexpialidocious" rather than look up "Modern Major-General" (if only we had some sort of way to easily look up tunes and information and stuff). A load of them talked or mumbled their way through it seemingly forgetting that it's a song thus sung (and most of these claimed that they did it due to requests). But one - one had horses.

Oh and I'd be remiss if I didn't include this rendition. This smug looking guy really does bring the theatre to it.

Just before you start denouncing xkcd as horribly nerdy, there's sometimes quite a bit of sentimentality:


Or might describe a truth:

Pickup Artist


If you'd not seen or heard of xkcd.com before today.... You're welcome.

Thursday, May 10, 2012


Belief can be oh so wrong at times. I was surprised to get this in the mail (copied verbatim):

Dear Nilesh,
Over these years, as your Registered GP at Epsom Medical Care, I believe our relationship has grown in the form where you have continued to bestow your trust in my abilities and I have reciprocated with sound medical advice....
I stop there because of the word "believe". Wow! In the first instance, I'm able to book an appointment under the name Nevyn at this practise - I listed it as my preferred name. The grammar of the letter gets progressively worse.

But secondly, I have not visited this doctor in a long time. Years. I would rather go to a local A&E (Accident and Emergency) and be seen by a stranger rather than go this particular practitioner. Why?

  • When it turned out I had a piece of glass in my knee he referred me on to someone else (so I was told - I was never actually given their details) - who never called. He never followed up on it. I removed the piece of glass myself using a pair of eyebrow plucking tweezers despite his insistence that it was horribly complicated and that I needed a specialist.
  • During a consultation, I pointed a lump near one of my armpits (it's still there). I was told that the consultation was only for the issue I had primarily come in for and that I would have to make another appointment to have that seen to.
I'm determined that I am going to write a letter back to this practitioner and point out just how wrong his belief is.

But this brings up another question. Why am I registered as a client of this practitioner? Have you ever watched Sicko? Another Michael Moore infotainment film about the lack of socialised healthcare in America.

There's a downside to socialised healthcare. As much as I point America out as capitalism gone oh so horribly wrong (trust in the greedy/market) there's always some interesting counterpoint. In hospitality and the use of tips, those serving you are doing their best to earn those tips in order to make a living whereas we, in a lot of cases, get lousy service because tips aren't essential for a someone in hospitality to make a living. Of course, my argument is that it is wrong to exploit people in that way. If they're doing a job, they should get paid for that job.

But in terms of healthcare, they're limited only by dollar signs. Here, the concern is still money, but it's about cutting costs. If everyone is paying exactly the same amount, there is no incentive to provide great healthcare. Good healthcare maybe though I would argue my experience shows that good healthcare is a bit hit and miss.

At one stage I was away on holiday and, being a mild asthmatic, needed an inhaler. I went to a clinic, wheezing, asking if I could make an appointment in order to get a script for an inhaler. No can do. The doctor is all booked up and I wasn't registered with that doctor. The receptionist didn't look in the slightest bit apologetic or sympathetic.

I'm of the opinion that we have it very wrong in New Zealand. Yes, we have socialised healthcare, just like any other first world, and most other, countries with the exception of America. A few years ago someone decided you could only take full advantage of this if you registered with one practitioner or practise. I've never been keen on doctors. For the most part, I find the whole practise to be like going for a $10 haircut. In, wait quite a while, seen to in the shortest possible time (I've probably spent more time with nurses than doctors), and out again. Anything long term? Not a chance. Heaven forbid I end up with a long term illness.

Oh - avoid the St Lukes Medical Centre - apparently where this practitioner is moving to. Needless to say, it's very unlikely I'll be moving my "business" there.

Sunday, May 6, 2012

Retailers Urged To Take More Responsibility For Sale of Solvents

I just thought I'd make a note about a story in the news tonight. It's the sort of story that has me thinking there's just something seriously wrong with the world.

And this is it: there has to be personal responsibility. Retailers can not be held responsible for the use of the things they sell.

I don't know about you but I'm always irritated at the supermarket on a Friday night when they won't sell me a bottle of wine - their reasoning - "I think you've had a drink". Let's face it, we've had a love hate relationship with retailers for a long time. Are we really expecting those same people who sell our kids cigarettes to keep our kids safe from products which can actually be used in safe ways?

In 1999 a woman, Janet Pike, was stabbed and killed in the West Auckland ACC office by a man by the name of Johnny Manu. He had visited Janet, gone down to The Warehouse, went looking for a baseball bat, and when he found they didn't have any of those in stock, brought a knife.

No one at the time suggested that The Warehouse should be held responsible for selling him the knife. The other telling bit, he was determined. His original plan fell by the wayside. The result was just as horrible.

It turns out Johnny Manu had had a long history of violence and robbery.

So a teenager "huffing" - if he couldn't get the butane from that dairy, probably would have gone down to the local super market. There's a very good chance there were signs that something wasn't right. The people he was hanging out with or behavioural changes. But that's not easy to spot either. Puberty makes things really difficult - not just for the teenager going through all of those changes, but the people who care about those people trying to keep them safe.

The point is - it doesn't help to transfer blame about.

Tuesday, May 1, 2012

Computer Gaming Ratings?

I watched a program last night on gaming. I haven't really been into gaming in a big way for a while. Normally I'll buy a new computer, play a game or two for a couple of weeks and then put it aside. The addiction thing... well I haven't ever really been that addicted. I mean, I've used it as a distraction. When my father had a heart attack, I found myself up at the local Internet "cafe" most nights but knew it to be a distraction. Anyway, here's the episode I was watching:

It starts off really weak. However, by the end of it, it had me thinking and relating things back to my own experience.

I had a friend who would spend time with a friend of his and that friend's wife and they would, for days on end, play a game. The game in question was one of the first massive multiplayer online role playing games. This friend of mine brought the manuals to the game before even getting a computer. He studied it. When he did get a computer, he dropped out of university in favour of playing this game. At a party, he described having a conversation with someone. The penny didn't drop that this conversation wasn't entirely real until he said "and then a dwarf sat down on the log beside us".

It's one of those moment's I'll never forget. It wasn't the dropping out of university that made me realise that this guy had a problem. It was the integration of an online experience with the real world. The fact that he could talk about an experience online as if it really happened in some real context. He didn't hesitate in telling us about the online conversation - remembering that this is well before voice chat in games became common place.

This guy was a bit younger than me and my friends. At his age we were carting our computers off to each other's places for the weekend where we'd get next to no sleep and play games against each other. There was the legendary performance of my best friend and I as we held off 3 players - we didn't win. We just held our own and made them winning a hard won affair. We were in a room next to each other and were communicating with very minimal clues as to what each of us were doing. i.e. "Got guard. Going below". "Up high. Need back up". etc.

The difference though? We were in the same vicinity. I would get up and make us all a pasta meal for dinner (cooking for any parents that were around) and we'd sit around and talk or we'd go down to the bakery and grab something for lunch. We'd stop and talk to each other. Even for the bigger (50 or so people) impersonal events, I remember stopping for a moment, getting out of my chair and finding the person who had been a thorn in my side during a certain game. We'd stopped, shared a pizza and talked for a little while.

Enter this TED talk:

During the Christmas holidays one of my friends was getting really irritated with his son who was crying over not being able to unlock some secret level of some game. He was trying to explain to his son that it doesn't matter. It's a game. It only really matters to him.

After watching that TED talk, I wonder if that was perhaps attacking his culture. I don't really like it when people attack my culture (whatever that might be - I'm a little lost on this point myself). It's important to him now and that's what's important (I think I might have said something in a previous post about "living the moment" i.e. it's less important to deal with what did happen and much more important to deal with the present perception of what happened).

The question is, what do you do? The first video says that gaming can go down one of two directions. Compulsion satisfaction and compulsion manipulation. I don't think I would quite frame them in this context. For example, some online maths programs, while manipulating a compulsion, have kids learning with an enthusiasm with which they wouldn't have otherwise. And Compulsion satisfaction, although earlier in the clip it does define this as a compulsion to learn, has certain negative connotations. It's not as cut and dry as framed in that clip.

The second video says we should really be working with kids to learn things from games and avoid attacking what is essentially our kid's culture.

Meanwhile, we have ratings on games. They're rated in the same way as movies though (I completely disagree with the way things are rated - sex gets a higher rating than violence though one we have to deal with, the other we could survive without). The rating system doesn't take into account the fact that games are interactive. Besides which, rating systems should be taken more as a guide rather than a hard and fast rule.

So, the question is, how should we define games as being more harmful than other games? Does the game have elements or completely subscribe to bits which are described as immoral game design? Is this just another learning opportunity? i.e. would problem gambling be better avoided more if these elements were brought to light?