It’s Like Frames All Over Again
Hello Blog! Long time no writey.
Well!
Ajax. A wonderful thing. But. Here’s what it is: when I refresh a page, I want it to be the same thing again, except if it’s been updated on the server side. Idempotent, or whatever the kids are calling it now. But what with all this Ajax stuff (which again, great, in its place), I’m finding more and more sites (and especially those that like to call themselves ‘web apps’) which alter content within the viewed page and then don’t hold those alterations through a refresh. See the BBC’s iPlayer site. It has various panels, one of which is the most important, headed ‘Today’ and ‘Yesterday’. It defaults to Yesterday, and I need to click on Today to see the programme I’m waiting to appear. If I refresh it, it goes back to the default of Yesterday, and I need to press the Today button again. But I refreshed Today, and I want to see the Today resource.
Ring any bells? Not really searchable; doesn’t survive a refresh; somewhat tricksy and user-unfriendly?
It’s Like Frames All Over Again.
Now, it’s all in transition right now, HTML and such, but: breaking the back button = Frames All Over Again. Breaking the refresh button, FAOA. Breaking the ctrl/command-click to open the resource in a new tab — FAOA.
We fixed this, ages back. Stop unfixing.
Filed under: html | Leave a Comment
Tags: html, web
Wouldn’t it be great if …
… I could use Spaces to switch between two different displays shared using Leopard’s ever-so-nice Screen Sharing?
Use case: I’m lying on the sofa in the living room with my little PowerBook on my lap, and I want to fiddle with a site I’m working on in Textmate, and switch between that code view (which I normally have on display 1 on my office machine) and a browser view of the site (display 2).
I could do this with Spaces, if Screen Sharing would let me see both displays at the same time in separate windows.
Apple?
Filed under: OS X | 3 Comments
Herbs

OK, so as promised here’s a pic of the old herb garden. From left, that’s rosemary, thyme, three tomato plants (at the back), lemon thyme, courgette and mint. In the box, from left, there’s parsley, two sage plants, and marjoram. The tomatoes, courgette, small sage plant and parsley are all from seed — the rest were bought from flower shops or greengrocers. Apparently supermarket plants are to be avoided as they’re generally started hydroponically and are therefore very fragile.
These are next to a west-facing window in our kitchen. We don’t have a south-facing window in the flat, so this is next best. They don’t get a great deal of light as a) this is Glasgow and b) we’ve got fairly high buildings on all sides that block much of the sun, so I’ve augmented the light with a daylight-balanced bulb I’d been using in the office.
It’s been a lot harder than I thought it’d be to establish herbs from seed. Only the sage has really got going, and the parsley a bit as well. The courgette and tomato plants have been a surprise though — the courgette actually seems about to flower, which I’m pretty excited about (I want it mainly for the flowers rather than the fruit).
The rosemary, thyme and lemon thyme have already seen good use in the kitchen, and seem pretty hardy. I’m hoping that with spring supposedly on its way that things are going to be good from now till summer. In any case, it’s been a really nice way to spend a few minutes each day.
Filed under: Windowsill Gardening | Leave a Comment
My rubbish herbs
OK, a quick update:
Chives: rubbish, all dead. I thought these were meant to be easy.
Sage: Vibrant.
Rosemary: gave it a haircut today, made lovely spaghetti with said rosemary, chilli, garlic etc. Good.
Parsley: oddly vibrant.
Thyme: trying hard. Not dead yet.
Mint: supposed to be very aggressive, in fact dead.
Courgettes: one dead owing to inexpert re-potting. One appears OK.
Tomatoes: appear to have plateaued, but alive.
Lemon thyme: fine.
Basil: wee but appear OK.
More and photos later.
Filed under: Uncategorized | Leave a Comment
Recent musical epiphanies
OK, the inaugural music post.
First off, just to discourage any dilettantes, this will not be one of those blogs where I actually post songs, or entire albums, to download. While I’m against DRM of all kinds, and I think the music industry at present doesn’t know New Year from New York as far as sales models go, I would like musicians to get paid. On a sliding scale. I don’t care whether U2 or Coldplay get paid or not, because they’re shit and they have enough money. But I won’t be posting about them. I’ll be posting about, generally, people who don’t sell very many records and are signed, if at all, to labels who give them decent deals. Artists, if you will.
Ahem. So, recently I’ve been having one of those little musical renaissances — you know, when you’ve been in a grumpy rut for ages about music per se, not buying anything, only listening to stuff your friends do, etc. And then it all opens out and seems new again. Last time I can remember was when I discovered techno in about 1998 (I know, I know) and started buying everything the entire Underground Resistance mob had ever put out. That was a good three years worth of finding out about stuff I’d completely missed out on, having been an indie kid as of 1988 and having reflexively dismissed anything sans guitar. Holy crap, when I first heard the bassline of Derrick May’s Nude Photo … sigh.
Lately, it’s been another prejudice that’s bitten the dust.
I’ve always had something I’ve called the Punk Rock Nerve. It’s always twitched on detection of anything remotely prog. Even the stuff that we all thought was prog back in the day — Sonic Youth, Butthole Surfers, etc. — really wasn’t. I tried, once, to listen to Yes‘ Yessongs, after becoming intrigued by Red House Painters‘ cover of Long Distance Runaround, and being just utterly horrified.
(As an aside, I recently had a go at King Crimson’s Red and was fine until the vocals came in. Then the old Nerve went. Arrgh).
But I have a good friend who swears by a lot of that stuff. The better end, mostly (Can and its alumni, plus assorted Kosmiche acts, Wyatt, etc.) , although there’s some stuff I really can’t countenance, like the Cluster album he gave me for my birthday which sounds like someone going bbtthhhhhvvv into a microphone for an hour and a half. He played a bunch of stuff on the car stereo when we were driving up to Skye the other weekend, amongst which were the really hard to find Holger Czukay, Jaki Liebezeit and Jah Wobble album Full Circle, which was extraordinary dubby techno from 1983, Czukay’s Movies, which pinged my My Life in the Bush of Ghosts jones, and Wyatt’s new album Comicopera.
(NB: not all these links go to Wikipedia. Just seems like most do because the intertube is not otherwise interested in treating their subjects as a resource.)
So, Comicopera. In the car it was a bit quiet, so I just heard the whispering drums (Wyatt playing for the first time since his accident, apparently), The Voice, and the odd squeak of horns and tremble of percussion.I’ve always really wanted to like Robert Wyatt. About 10 years ago I bought a compilation called Going Back a Little Bit, and had a good old listen, but it was all too jazzy, too proggy, and the old nerve made me, reluctantly, sling it on the Bad Shelf. But I was intrigued, and I have iTunes, so I bought Comicopera, and holy crap. It’s just utterly beautiful from the get-go — Wyatt sings a song by Anja Garbarek called Stay Tuned, and in his mouth it sounds like that Beckett quote — ‘Perhaps my best years are gone. When there was a chance of happiness. But I wouldn’t want them back. Not with the fire in me now.’ (From Krapp’s Last Tape).
And it goes on from there, with heartbreaking lyrics written by his wife about Wyatt’s daytime drinking, raging, despairing diatribes about the duplicitous Iraq murderfest, sweet, funny in-jokes about Coltrane, and one track which is just the purest celebration of playing music I’ve ever heard.
‘On the Town Square’ — I was going to describe it, but ach, just go buy the album. This song says everything you need to know about why a record by a 60-something Londoner is the best album I expect to hear this year. Stuff about communitarianism, joy, reflection, improvisation.So: nary a twitch from the Nerve. And it sent me off to re-find all sorts of stuff I missed, of which more later. Till then — Comicopera, by Robert Wyatt. If you care about music, you’ll like it.
Filed under: Music, Uncategorized | 2 Comments
Deferred functions in Javascript
Okey dokey. So as my first little peek at some of the actual programming I’ve been up to over the past couple of years, here’s a little implementation of a way to defer arbitrary functions until arbitrary conditions have been met.
One of the first problems I came up against when developing Bxs came to light when I was figuring out how to build editable XUL listboxes for given MySQL tables dynamically at application startup, and then share information between them as they were building and after they were built.
Example: I have a table describing a list of exhibitions, each row having the usual stuff like title, dates etc., and also a field for the exhibition venue, which is a ‘has-one’ relationship to another table. I want the exhibitions listbox to display not the id number of the relevant venue, but the name of the venue and the city it’s located in. I want the app, as it’s booting up, to recognise that the given field relates to another table, check if the listbox for that table has built itself yet, and if so, to grab the relevant details from that listbox. If the related listbox hasn’t built, the requesting table tells it to build, waits until it’s built, etc.
The problem is: how do I tell the exhibitions listbox when the venues listbox has built?
The way I did it was using object.watch(). Here’s the implementation:
when = function(obj,prop,fn) {
if (obj[prop] && obj[prop] !== undefined) {
return fn();
}
if (!obj.deferredFunctions) {
obj.deferredFunctions = {};
}
if (!obj.deferredFunctions[prop]) {
obj.deferredFunctions[prop] = [];
}
obj.deferredFunctions[prop].push(fn);
var ready = function(newVal) {
obj.unwatch(prop);
obj[prop] = newVal;
obj.deferredFunctions[prop].forEach(function(el,idx,arr) {
var _fn = el;
arr[idx] = null;
return _fn();
});
delete obj.deferredFunctions[prop];
return obj[prop];
}
obj.watch(prop,function(myProp,oldVal,newVal) {
if (newVal !== undefined) {
return ready(newVal);
}
});
};
/* Example pseudo-code: */
when(listbox.venues,'ready',function() { listbox.exhibitions.updateLabels(); });
The big problem with this implementation is that it can’t return a value unless the prop you’re waiting for is already set when you call when(). But I’m fairly proud of it. It has a nice natural calling syntax and gets a lot of stuff done in not much code.
Filed under: Javascript, XUL | 3 Comments
Why not Rails … yet?
So straight off the bat, why did I decide on PHP as the server-side technology to use for my little project?
Well, first of all, I knew more about it than any other scripting language — meaning I knew enough of the language itself and its structure to be reasonably confident in turning out good, object-oriented code from the get-go; I knew enough about its pitfalls for the learning curve to be reasonably shallow; and I knew how to get it deployed quickly and easily.
Since then, I’ve read a great deal about Ruby and Rails, and I now nurse the idea that at some point I can migrate the server-side of the app to Rails. My experience writing a whole lot of fairly in-depth Javascript spoiled me for writing PHP (it became really frustrating not to have things like first-class functions, object and array literals, array comprehensions and the like when switching from the client to the server-side code), and I really yearned for the power and beauty of the Ruby language. And Rails just seems like the most forward-looking approach to coding for the web that’s out there at the moment. The Zend Framework makes a lot of stuff easier for me, but it has the slightly faux-enterprise feel that a lot of PHP projects have (big long horrible class names etc.) and, at the moment, no convincing architecture for models or ORM (I know, I know).
So why not Rails … yet?
Well, there’s been a fair amount written about this already, but I’m afraid I fall into the camp (ghetto?) that fears the deployment and maintenance issues that Rails presents at the moment. With PHP, when I want to deploy, I just upload the code and there we go. If I screw something up, I just fix it, upload the code and there we go. Yep, I’m on a shared server. And I really don’t want to be responsible for administrating my own (virtual) server — there are big gaps in my knowledge, as a self-taught programmer, which I’d really prefer that, for now, someone else deal with. The idea that when I start a Rails app it’s running until I stop it or (shiver) the sysadmin has to, because I’ve done something stupid which has resulted in runaway resource consumption, gives me the fear. PHP’s shared-nothing, request-to-request architecture is like a lovely comfy blanket in comparison.
If we could have a mod_ruby and a Rails that worked with the simplicity of PHP right now, I’d switch, right now. Until then, or until I become a lot more confident in my sysadmin-fu, I’m sticking with PHP — reluctantly.
Filed under: PHP, Rails, Ruby | 2 Comments
Tags: PHP, Rails, Ruby, zend framework
Bxs — a XUL CMS/Data manager
When my girlfriend’s gallery started to take off and she needed a content-managed website, I started to think in terms of a generalised data-management web application that would look and feel familiar to her and others like her; in effect I wanted to make something that looked and worked something like a cross between Access, Excel and iTunes.
A couple of years (!) later I had something like that working pretty well, built using PHP (on top of the Zend Platform, eventually) on the server side and Mozilla’s XUL on the client side.
I looked at a bunch of different stuff before settling on XUL (n.b., this was pre-AIR/Apollo), including the nascent widget engines (YUI Ext etc.) that were starting to appear at the time. I settled on XUL because it was there, fairly mature, fairly well-documented and available cross-platform via the Mozilla browsers.
Another note: this is ‘remote’ XUL I’m talking about. The app isn’t a Firefox plugin — all the code is stored on the server and delivered to the browser on login to the system.
In the next few posts I’ll start to detail some of the issues I came up against building the thing, and some of the solutions I found.
Filed under: Javascript, XUL | 2 Comments
Hello, World
OK, I’ve started a blog. I guess my main intention with this is to write a little about some of the things I’ve been doing with Javascript, XUL and PHP, of which more later. But there’ll also be some documentation of my recent adventures in cooking and windowsill gardening, and no doubt some musical recommendations too. I hope I can garner a little audience, especially for the programming stuff, as I’d really appreciate some discussion of what I’m doing; I’m self-taught, and probably a bit isolated as a result.So here we go!
Filed under: Greetings | Leave a Comment
Search
Recent Entries
Categories
- Greetings (1)
- html (1)
- Javascript (2)
- Music (1)
- OS X (1)
- PHP (1)
- Rails (1)
- Ruby (1)
- Uncategorized (2)
- Windowsill Gardening (1)
- XUL (2)