Mon, Jan 23, 2012
![[Icon]](rsc/img/chain_link.gif)
At work, we frequently refer to yaks.
It's a term we picked up from the Perl community. I imagine it's used by other hacker communities as well, but I wouldn't know.
The story goes:
You wake up one morning and think to yourself, "I should mow the lawn this morning!"
Then you realise that you can't, because you don't have a mower: You lent it to your neighbour.
You figure you'll go and get it back from your neighbour, but then remember that you borrowed the neighbour's air compressor at the same time. You'll need to return the compressor if you want to get back your mower.
But the reason you haven't returned the compressor is that the hose ruptured whilst you were using it and you need to fix it before you can return it.
So you'll have to go to a hardware store to get a new hose. But you don't have a car, so you'd need somebody to give you a lift.
Your other neighbour would normally be willing to give you a lift, but he lent you a garden chair a while ago and he'd want that back before he did anything for you. And you haven't returned the chair because the cushion in it ripped and some of the stuffing came out.
So you need to fix the chair first. The chair is stuffed with yak hair. As luck would have it, you have a friend working at the local zoo, which is within walking distance. So you nip down to the zoo, have a word with your friend, and then head off into the yak enclosure.
An hour after you woke up and decided to mow the lawn, and you're at the zoo, shaving a yak. To a casual onlooker, a completely unrelated task; yet at the same time a vital prerequisite.
In programming circles, if somebody says they're shaving a yak, it means they're doing something that's vital if they want to get their main task done, but which doesn't actually get them anywhere towards accomplishing their task. In the same way that shaving a yak doesn't get the lawn mown.
Lately, it seems like a relatively simple goal has been encountering, not so much a succession of yaks, but an entire herd of them.
Here's the problem: Linux doesn't have a single GUI. It has a lot of them. From the simple & lightweight "window managers" to the heavy-hitting windows-like "desktop environments".
The one I've used for many years has been showing its age lately, and with the announcement being made that it was going into maintainence mode, I figured it was probably time to find something new.
Problem is.. I have a very specific setup. The functionality that I want is not the default for anything out there. And part of the reason I stuck with FVWM2 for so long is that nothing else is actually capable of doing what I want.
But I was confident that I could overcome that if I stuck with it. So I started shopping around for a good configurable, light-weight desktop.
Enlightenment is very shiny, but it's not nearly EWMH-compatible enough: A script I use to toggle a window between monitors doesn't work, for example.
I'm currently trying Openbox, but this has two big problems: When I toggle the mouse between monitors, the window it moves to only gets focus about half the time - this intermittent behaviour is infuriating; and there's no detectable way of enabling "warp to window" so when you use alt-tab to switch to a window, your mouse doesn't get moved to that window. Which is stupid. It means, for instance, that if I alt-tab to Firefox, I can't then use my scroll wheel because the mouse pointer is still over an xterm.
Fluxbox has possibilities, but also problems - its menus don't seem to work just by typing a letter, you have to press "return" to make something happen. This is annoying. And there's a weird bug going on where every time I toggle a window between monitors, it resizes it.
In my bid to get all the functionality that I need, I've gone from having a couple of shell scripts to having a rather large Perl program which is gaining more & more features as I try & get everything working the way I want.
It's actually reached the point where somebody at work mentioned that the X11 books by O'Reilly actually contain enough code that you can write your own bare-bones Window manager, and I'm seriously considering it on the grounds that if no other WM will do what I want, maybe my only choice is to roll my own.
But I'm going to have a go at creating a simple Tcl/Tk interface that'll call everything I need via Perl first. Because obviously, that's far easier.
Sigh.
Yaks! Yaks everywhere!!
Tue, Jan 17, 2012
![[Icon]](rsc/img/chain_link.gif)
It's the Information Age. It's easier to communicate now than it ever has been before, via a plethora of different ways.
This is generally a good thing. There are bills being mooted in the USA at the moment that would damage people's ability to communicate via the Internet, and this is why you may have seen the blackout notices on Wikipedia today - the "Nuclear Option" that made tech news a while ago where Google, Wikipedia, Facebook, etc. talked about taking themselves offline in protest. Communication matters.
But it does have its downsides. There are times when you might find yourself regretting that people can follow so much of what you say & do.
For instance, I recently got an email from someone I used to know. Completely unexpected, hadn't talked to them in ages. But suddenly, here was a message from them. Yelling at me for something I had written, which they disagreed with.
Slightly puzzled, I checked the article in question, and it didn't say what they claimed it did. In fact, it had a paragraph devoted specifically to pointing out the reasons why it didn't say what they claimed.
So I sent back a "Sorry you're upset, but it doesn't say that" reply. Rather than accept the correction, they sent a reply that shouted at me a bit more. There was a brief argument, that ended after they sent a "Not talking to you any more" reply.
But human nature can be so distressingly predictable, and I just *knew* that they wouldn't be happy leaving it there. So I gave it a few days, and then took a look at the blog published by my unhappy correspondent. Sure enough, there was a long post about not just our recent exchange, but a whole lot more too.
It was quite a post. It read like an account of the Angel of Reasonableness describing its encounter with a bad-tempered ogre. And obviously, when two people give an account of something, you expect discrepancies - different perspectives, different recollections, and the inevitable personal bias.
But the more I read, the more cynical I became. It went from "harsh" to "unfair" to "near absurd" before I finally came across one point that just couldn't be explained away by subjectivity or hindsight: An accusation that I had said/written something that I knew I hadn't. Just to be sure, I went back to my sent messages and checked. Nope: Clear as day, with no possibility that it could be misread or misinterpreted. I had absolutely, definitely, said the exact opposite of what they claimed I had. This wasn't a faulty recollection or an impassioned over-statement. It was a flat-out lie.
With that in mind, I re-read the post with my cynicism turned up from "They might be exaggerating" to "I know they're lying" and re-interpreted it on that basis. My final conclusion?
It was bullshit.
That pretty much sums it up. It re-writes history in a deliberate attempt to make it look as bad as possible. It over-states, it distorts, and in several places it just outright lies. Even with every possible allowance made, it's not possible to believe that the author actually believed what they wrote. Not without casting grave doubts over their sanity, anyway.
I debated replying, maybe with some screenshots of the various messages/articles/etc. that contradict their account plainly highlighted. But I decided against it - communication is a wonderful thing, but there's such a thing as too much of it. I'd already clearly pointed out discrepancies between what I was accused of and what I had actually said in the earlier argument, all of which were brushed aside & ignored. What would it accomplish to point out yet more?
So I dropped it. They can carry on happy to have got the last word; I can carry on happy that I don't really care.
Funny thing is, if this had happened a while ago - as little as a year ago - it would have bothered me massively. Somebody who I used to be quite close to, saying and thinking such nasty things.. It would have nagged at me all day and kept me awake at night. Maybe that was their intention.
But the last few years have had a lot happen in them, and it appears they've changed me even more than I'd been aware of. If someone wants to rewrite their past to justify being unhappy in the present, they're welcome to. I gave up on being this guy years ago:

Fri, Dec 30, 2011
![[Icon]](rsc/img/chain_link.gif)
The previous JS example was all well & good - it used a closure to store the data it needed - but it was a 'public' variable - you could intrude on the object and change the value yourself. This is bad, of course.
THIS is far better: Instead of creating a function object, you have the function create and return a new object, which has access to the lexical scope of the function that created the variable.
Nothing else can access that scope, so you now have a nice private variable. This same approach can give you private data, private methods.. it lays the groundwork for entire encapsulated modules, without having any cluttering of namespaces or use of global variables.
In fact, it's almost like using a slightly old and crippled version of Perl. It's that good.
Try it yourself in your browser's console: Paste the code below in. You can still run count_hundred.count() to increment the value, and I've added the .get() method as well, to return the count without incrementing it. But ONLY by using these methods can you get the value: The data is protected from tampering by its scope.
This is something I just didn't think you could do with JS. I'm almost starting to like it.
var counter = function (start){
start = typeof start == 'number' ? start : 0;
return {
count: function() { return ++start;},
get: function() { return start;}
}
};
var count_hundred = counter(100); Wed, Dec 28, 2011
![[Icon]](rsc/img/chain_link.gif)
I hate Javascript.
Mostly because of things that aren't really its fault, to be fair:
But when you look under the hood.. it's no better! Global variables, weird scoping (A helper function defined inside a method gets the global object bound to 'this' instead of the object bound to the method's 'this', FFS), godawful class syntax...
So when somebody at work recommended a book called "JavaScript: The Good Parts" my immediate reaction was "It must be a very short book! Ha! Ha!"
It is.
150 pages, and 50 of it's appendices. Only 100 pages could be written about what's good about JS.
The blurb on the back of the book? Well, it begins:
Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad
This seemed promising.
And it is. It's a damn good book. It throws out all the cruft and the useless "Hello, world" nonsense that most JS books blither on about, and just tells you about what JS got right and how to use it properly.
Don't use the class syntax. JS isn't classical: It's prototypal. An object isn't an instance of a class; you make a new object by linking to the prototype of the type of object you want.
Don't think of it as anything to do with Java, don't think of it with your C hat on. It's more functional than procedural: Put your Lisp/Haskell/Higher Order Perl hat on. Don't think about global variables, think about data stored in closures.
And suddenly if you want, say, iterator objects, you don't have a bunch of global variables or bad class syntax. You can dump all of that and create objects with closures that you can pass around by reference. And it's almost like you're using a decent language again!
var Counter = function (start){
this.counter = typeof start == 'number' ? start : 0;
};
Counter.prototype.count = function (){
return this.counter++;
};
var count_zero = new Counter();
var count_hundred = new Counter(100);
var count_badly = new Counter('wibble');
As simple as that, you can now get the output:
- count_zero.count(); 0 - count_zero.count(); 1 - count_hundred.count(); 100 - count_hundred.count(); 101 - count_badly.count(); 0 - count_badly.count(); 1
All nice and sane. And, compared to what you usually see in JS, quite elegant.
If the rest of the book is as helpful as the first third, I live in hope that I may yet be able to add "Just use raw JS" to the existing list of "Use Jquery" and "Learn EXT" that I currently have available for making web pages dynamic.
Mon, Dec 26, 2011
![[Icon]](rsc/img/chain_link.gif)
You know those people who send out smug little essays at the end of each year, to everyone they've ever met, detailing how well everything has gone over the last year?
Well.. this isn't one of those.
So. 2011.
The year started out reasonably well: The kittens we'd got after the puppy was put to sleep were doing well, and unlike the year before, I hadn't been repeatedly stuck at Gatwick Airport in a futile attempt to reach my parents for Christmas. But the good omens proved misleading, as my car became unreliable enough that I was forced to switch to my motorbike.
You might say I was being unfair to the car - after all, it had only caught fire twice whilst I had been driving it - but after it refused to start for the nth time, leaving me stranded at work and obliging Tina to come and get me - which would have been easier if her GPS hadn't thrown a fit and forced her to navigate by watching the planes coming into land at the nearby Gatwick - I felt that the best thing to do was switch to my reliable new Honda cycle.
This worked well for a while, although I got through a lot of hot drinks as the winter grew colder. Sadly, it was at this time that some of Tina's pupils accidentally slammed her hand in a door.
In fairness, they didn't do it deliberately and they were horrified when they realized what they'd done. But heavy fire doors don't care about intentions, and she was left with a hand full of broken bones.
Naturally, being so competitive, I had to one-up her, and promptly found a patch of icy road on my way to work suitable for having an accident on. I then phoned my boss at work and explained that I had made every effort to get to work, and was in fact a mere two miles away, but was no longer capable of moving the bike. Or myself. Or my right arm.
After a long few hours in hospital, I was sent home and went back via Tina's workplace, where I told her startled co-workers that she had apparently had enough of me being late with the rent.
So we were both somewhat battered, and it wasn't an easy phonecall to make to my parents, what with my mother having a deep-seated dread of her sons being on motorbikes. As luck would have it, my brother helpfully supplied a useful distraction by falling on a tennis court and shattering his wrist into an impressive number of pieces. A mere shoulder fracture paled by comparison.
So January wasn't really the best start to a year, for either of us. February came and went, as February's do, with little of note happening other than the kittings having their first experience of the outside world. Tina's intrepid Base, having looked longingly out at the garden for months, was very taken aback when she finally found the door to be open, and started at it suspiciously for a long time. My little Aidy, in the meantime, had no interest in the great outdoors, but was very unhappy about being separated from me, so in the end it was her that came out first, to join me on the garden seat. Base more than made up for lost time, though, being the first cat to leave the garden, and the first to climb a tree. And the first to get into fights with other cats. So it goes.
Come March, my shoulder began to recover enough that I could me at least a little more mobile, and we had to look at the transport situation. My bike was clearly out of the question for the rest of the year, I had to get back on four wheels.
It was clearly the electrics that were the problem on the Fiesta. Despite using correct technique on several occasions, it simply would not start no matter how often I clouted it.
We tried replacing the battery, the ignition switch, the starter motor.. no luck with any of them. In the end, I had no choice but to flog the car to WeBuyAnyCar.com for a not-unreasonable sum, and get a new car.
Sadly, what with the crash and everything, I couldn't afford a reasonably-good second-hand car from a private sale. So I had to get a more-expensive car from a dealer, since those come with monthly repayment options rather than requiring the lump sum up front.
We went on a tour of the local car-sellers, but ultimately it was the nearby Honda dealer that we wound up going back to, where we struck up a friendship with a salesman named Craig, whom we saw a *lot* more of than expected by the end of the year.
In Tina's life, her whole department got moved out of the science block for the school to do site-wide renovations; and it's always fun trying to do science lessons without any science equipment. But she DID get a job offer from a near(ish) private school, which she accepted and then spent the rest of the academic year stressing about whether or not it was a good decision - "The devil you know" and all that..
Since the new job would mean a commute north for both of us, it made sense to start thinking about maybe moving somewhat north, since petrol's getting dearer by the day and both of us were bored by the pace of life in our current town. So the DIY work that had needed doing since we moved in gained a new urgency, and it was at last considered time to redecorate the bathroom. What with the last owner having considered it a good idea to install a shower mounted on an uncovered plasterboard wall...
Sadly, a large part of the plaster came away when the wallpaper was stripped, so it turned out to be a rather bigger job than originally hoped for. So the room was still unfinished when Tina came to her final day at her school and began the holidays. I was back at work by this point, and due at the Perl conference in Latvia, which I duly attended.
Latvia, by the way, is a great place - I enjoyed it almost as much as Romania, which is a fabulous country. Perl Conferences are also well worth attending if you're a developer.
Whilst I was away, the bathroom was finally replastered and finished. Around the same time, the birthday present I had ordered well in advance for Tina at the beginning of the year finally turned up, only a few months late. This IS the peril of ordering products from companies that don't actually exist yet...
Tina then started at her new place of work, which has far better kids but somewhat less effective staff. It was also a substantially longer commute, and she began to burn through petrol at an alarming rate - it pretty much swallowed up her pay rise. A solution of sorts to this problem came in the form of a hole in my tooth, necessitating a trip to the dentist. Tina kindly offered to drive me there, but on the way back, we discovered the hard way that somebody had spilled oil on the wet road,
So that was the end of her Mini. Ultimately, we both walked away from the accident, slowly and gingerly, but still upright on our own two feet. I added a new pair of glasses to the unpleasantly large dentist bill on my previously-unused credit card and we bought a large box of Smarties, or as the pharmacy calls them, Ibuprofen.
I have a whole bunch of medical appointments to get to in the New Year, the fun never ends... but I'm hopeful I'll get some money out of the insurance companies (I'm arguing with three of them at the moment) before the end of 2012.
By this time, our mate Craig at Honda had sold two more cars through Tina, so when it came time to sort out a replacement car for her commuting needs, we hobbled into the showroom, bandaged and bruised for the second time to ask, hypothetically, how fast he could sort us out with another new car.
I immediately deflected his accusing gaze by explaining that MY car was still perfectly fine, it was HER that needed a new car in a hurry this time.
And that was fine, until a few days later when she drove my car around to have it assessed for repairs, after a muppet in a car park reversed into me whilst I was stationary. Yep, my third accident of the year! A grand's worth of damage, which my unfortunate new acquaintance wound up paying out of his own pocket since he didn't want to go through insurance.
So now we BOTH have Honda Jazz's, and it's amazing how her fuel bills have shrunk since she went from a supercharged Mini Cooper to a sensible, if dull, Honda supermini. Possibly the fact that we're both so paranoid about driving these days that we never get up to particularly high speeds might have something to do with it, too.
So we end the year with a whole lot more bruises, broken bones, and scars than we started it with. We also start it with both of us paying off new cars that we were forced to buy at very short notice. The insurance money will help with that, eventually, but in the meantime we're feeling like a rather pelican farmer - surrounded entirely by large bills. Oh, and my little Aidy has been diagnosed with a heart murmur, so she's on a diet and a close watch from now on.
Still.. mustn't grumble!
:: Next >>
![[Links]](http://geekblog.oneandoneis2.org/skins/112/rsc/img/chain_link.gif)
Back to using FVWM2 - everything else too annoying. Still got a load of stuff to add to my Perl window-controlling prog. tho...
24/01/12
Facebook Syndication Error
28/01/12
![]()
I last listened to:
Johann Pachelbel - Canon in D major
Most recent photo:
Submersible houseboat