This is as days pass by, by Stuart Langridge

The innovation balance

There's lots of people out there really pushing the envelope of what can be done with the DOM and CSS. You all know this. But, at some point, there comes a time when you hit a wall, and that wall is named Internet Explorer. This wasn't always the case: to get to the Internet E ... [Stuart Langridge]

Syndicated from the SitePoint Stylish Scripting weblog

-----

LugRadio season 2 episode 12

The latest LugRadio episode—Laser guided facials—is now available from lugradio.org. With an Alan Cox interview, complaints about loads of stuff, and more details on LugRadio Live 2005 for your enjoyment. Go thou and download.

-----

Getting the Google juice

Remember how I said that I wanted to go to What The Hack and that it would be cool?
Well, the Google juice is clearly with me. Do a google search for "what the hack" and, apparently, I’m more popular than the What The Hack site itself. Blimey.

The gDesklets shell is a train wreck

Now, I love the idea of gDesklets. And an individual gDesklet is a good concept; you write a “sensor“, meaning a little program that returns some useful output, and write a little XML file which defines how to display said output in a pretty window. Very nice. The actual desklets themselves are cool; they’re well executed, simple, and powerful. What more do you need?

But the project organisation is a train wreck. I’m sorry, but it is. For a start, the main site seems to be http://gdesklets.gnomedesktop.org/. So you go off there and download a gDesklet or two. They arrive as .tar.bz2 files. How are they installed? No idea; the site doesn’t tell you that. The way you actually do it is by dropping the .tar.bz2 archive onto the gDesklets shell, a list of all installed gDesklets. But it’s really difficult to find that out. If it were me, I’d have called the files whatever.gds or something; still make them bzipped tarballs if you like, but don’t give people the impression that they should be unzipping them. All other software that arrives as a tarball is that way so that you can unpack it somewhere appropriate.

Half the time, double-clicking a desklet in the shell throws an error about a sensor not being installed. So…where do I get that sensor? Why doesn’t the shell get it for me? Just make it work! The other half of the time it doesn’t seem to do anything, and then 30 seconds later when my mouse happens to cross the desktop background I notice that it did work and is waiting for me to place the desklet.

And that “gDesklets shell“. It’s a nightmare.

I don’t know whether that’s the desklets’ respective authors’ fault for not filling in the metadata, or whether it’s Debian’s fault for packaging up a load of desklets wrong, or what, but what the fuck is all that? It doesn’t make any sense.

I’d like to help with this project; I think it’s got some real serious potential for delivering little desktop applets that can be truly great. But they’ve got quite a long way to go before it actually works properly, I think, and I doubt they’re interested in my suggestions, since they’d start with “you need to change everything about how you present gDesklets to the world“.

How to make a decent cup of tea

This is a guide for all people out there who have to make tea. Quite possibly you don’t drink tea; instead, like all the other sheep out there, you drink coffee (“oh, I need the caffeine, yeah, I do, I can’t work without it“) or more likely you just buy it at a ridiculously over-inflated price from Starbucks. But you may have to make a round of teas at work, or someone you invite over may want a cup of tea instead of a coffee. This is a simple guide to doing it.
There are lots of guides to making tea out there on the web and in books. They’ll tell you to put the milk in first, or put it in last, to choose Earl Grey tea, or Lapsang, or green tea. This is not one of those guides. It’s an instruction on how to make a single cup of tea, in a cup, with an ordinary tea bag. No Russian Caravan or Assam or anything. Just ordinary tea, like PG Tips or Typhoo or Yorkshire Tea. Here’s the guide.

  1. Put a tea bag in a cup
  2. Boil some water
  3. When the water boils, AND WHILE IT IS STILL BOILING, pour it over the tea bag
  4. Add milk and sugar to taste

That’s it. That’s all you have to do. If you make the tea while the water is actively boiling, it’ll always be pretty reasonable. If the water is not actively boiling, then it doesn’t matter which tea you’re using or when you put the milk in, your tea will taste like ditchwater piss. Boil the water!

This has been a public service announcement on behalf of people sick of drinking shit tea. Thank you.

LugRadio series 2 episode 12 recorded

We recorded the next episode of LugRadio last night, and I’m really pleased with it. (Not that it’s been mixed yet, but it’ll be out for Monday). We’ve also got a mic stand each now, thanks to our lovely fans who have donated money. Matt described the new freedom that we have because of this as “like wearing the right size pants after months of ball squeezing compromise“, which is superbly phrased in my opinion. Look for it on Monday!

-----

What The Hack 2005

The What The Hack conference, sequel to the HiP‘97 and HAL 2001 hackers conferences, is on in July! Why didn’t I know about this! I’m currently trying to decide whether I can get there, since it overlaps a little with this year’s Men With Big Stones tour. But I want to go. Some thinking to do.

Videoconferencing multiple parties

Apple’s iChat will, in the Tiger release, do this flash thing where, in a multi-party video conference, it tilts the pictures of the other attendees so that it looks like a conference room. Pretty cool. However, I reckon you could go one step better than that. After all, you’re not interested in the background. Moreover, the background doesn’t change, so it should be possible to strip it out on the fly and just show the heads. Excuse the quick mockup below: the people are just those I found in a quick Google Image search for “head shot“.
It would look something like this.
Is this possible? FaceTop seems to strip out backgrounds so I assume that it’s doable, although it’s possible that the FaceTop people are all sitting in front of black walls. I think it’s a pretty cool idea; all you need to do to each image is strip the background—grab the first few frames and see what doesn’t change, although you might end up stripping the person or their hair or something then as well—and then do a perspective transform on the image to tilt it (as iChat does). The Gimp does perspective transforms, so it’s doable (the Python Imaging Library doesn’t, but there is a patch to apply it to 1.1.4 available). I’d have a crack at it myself if PIL did it and if you could alter how GnomeMeeting works using Python, neither of which are true…

FIxing text/plain HTML in Firefox

Firefox, correctly but annoyingly, displays HTML pages served as text/plain as the raw HTML rather than as rendered HTML. Someone has come up with a very useful bookmarklet called Force HTML which fixes this. It’s pretty clever; it just reads the text from the page into a string and then document.write()s it back into the page. I would not have thought of this!
I’d like to make this a GreaseMonkey script, so that I’m never bothered by this problem again, but there are two small issues with that. Issue 1 is that I can’t work out how to discover what the content-type a page was served as from JavaScript. (This isn’t a major issue; I could check for the document element being pre and the page content containing lt and gt characters and guess from that that it’s HTML being served as text/plain, probably.) Issue 2, a bit more seriously, is that when I do implement it as a GreaseMonkey script it crashes the browser. I am guessing that this is because GM runs before proper page load, and replaces the content of the page with a totally different page using document.write(). This probably screws things up. Once I’ve narrowed this down to a test case I’ll submit it as a GM bug, although I suspect Jeremy and Aaron and crew will say: don’t use document.write() to make the whole page disappear when you’re still in the middle of rendering that page.

50 people see

Some bloke has written this cool little Python script where you feed it a Flickr tag like, say, “sunset” and it grabs 50 photos with that tag and averages them together. The results are cool in a modern-art sort of way What I’d like is to have some of these on my wall in that stretched canvas frame sort of picture; where you have a wooden square with the picture on canvas which is stretched over the frame and then stapled behind. PhotoArtistry have a service where they’ll print a photo of yours on canvas and then stretch it onto one of these frames and send you the resulting picture. It seems that an 18“x18” picture will be £44 + VAT + £10 delivery, coming in at £61.70 per picture. That’s pretty steep, since you’d want four or five of them, but they’d look really, really cool. The look of the pictures seems to suit the roughness of canvas to me perfectly. If you just printed them they’d look all shiny and glossy (and even more so if they were, say, in a clip frame) and that’d make them look rubbish. Any other suggestions for how I can display these pictures without a visible frame and without them looking glossy without paying sixty quid per picture?

My new laptop

A week ago I bought myself a new laptop. An HP Pavilion dv1000 in fact, in its dv1049 flavour. Came preinstalled with Windows XP, not that I care; I took it out of the wrapper, plugged the battery in, plugged in the mains cable, and put the Ubuntu Hoary install CD in. Never booted the XP installation; I run Ubuntu Linux, me. That all installed pretty much perfectly; there were a couple of small bugs (#7536 and #7571 are they); I admit that #7536 is a showstopper, but it only applied because I’d never booted anything at all on that machine (so the clock was wrong) and they’re fixing it now anyway, so that’s OK.
In short, it’s a lovely machine. It’s got a 14” widescreen layout; “widescreen laptop” is actually marketing speak for short screen, but I don’t mind that; it makes the laptop smaller and more portable, and that’s exactly what I want. Built-in wireless, very nice.
It also doubles as a DVD/VCD player, not by loading one once the OS is loaded, but straightaway; if you boot the machine with a DVD in, it plays that DVD straight away (10 seconds, apparently, from boot to playing). The best thing about this is that this function is a 200MB partition on the drive (so don’t delete it when you blow away XP for Ubuntu!) which is actually a small Linux install! Nice one HP; this sort of thing is an ideal use of Linux. If that were, say, a very cut down Windows Media Centre, it would have cost them loads in licence fees. A small Linux distribution costs them nothing, and can just be dropped on the drive. I suspect that it’s not entirely open, though, since it can play DVDs—I keep meaning to look at it and work out whether it uses libdvdcss or what.

Anyway, I really like it. A couple of tiny niggles; the touchpad seems to think that a one-finger tap is actually a two-finger tap. This is bad, because a two-finger tap means the middle button. I don’t know whether that’s a fault on the touchpad or a consequence of me having fat fingers, but I fixed it by adding
Option          "TapButton2"            "1"
to the “Synaptics Touchpad” section of /etc/X11/xorg.conf, which fixes it. Similarly, I can’t seem to get the corners to work as different buttons, which is annoying; synclient -m 100 shows that I’ve got the parameters for RightEdge etc correct (well, Ubuntu got them correct, anyway), but it’s not recognising a tap to the right of RightEdge and above TopEdge as a corner. Don’t know what’s up there, and it’s not really a major issue. The PgUp/End/Insert/etc keys are in a weird place, but I don’t actually think it’s weird; it’s just different to my work laptop. I wish people would standardise on these; I get no muscle memory as to where those keys are, which slows me down, because they’re totally different on this laptop and the one at work (another HP!). Other than that, it’s bleedin’ great. I am well, well pleased with it, and well pleased with Ubuntu Linux for now being at a stage where it just supports everything on a laptop. Yay!

Just Say No To .NET

Schwuk alerts me to the story of Frank, a new coding hero. Bob Reselman writes about how his development in ASP.NET with Visual Studio.NET and so on lags fiercely behind his cow-orker Frank, who codes in ASP with JavaScript and DOM scripting. Yes, yes indeed.

More on ASP.NET and so forth

Schwuk complains that my snarky note on not using .NET is unfair, as I’m blaming the tools and not the person wielding them. I did actually ask Schwuk by mail whether he felt that the original story came about because:

  1. the JavaScript/ASP/DOM guy is a very good coder
  2. the VS.NET guy is not all that good a coder
  3. JS/ASP/DOM is a better environment than VS.NET/ASP.NET
  4. something else

but we’ll continue the discussion here, I think.

Frankly, I do blame the tools rather than the person wielding them. This isn’t specifically a criticism of VS.NET, but of overarching programming environments in general, and shades back into the “do we need an IDE” debate on which Schwuk and I have commented previously. I am almost wholly convinced that big IDE environments and so forth are actually constrictive, and only make you more productive if you’re doing something that the environment designers anticipated you doing; as soon as you step off that beaten track you become a lot less productive. For example, knocking up a quick few-buttons application in VB is very fast indeed; much faster than doing it some other way. However, if you try and do complex things, I find that Python+Gtk+Sandino’s script is a much faster environment than contorting VB to do it. Now, you can accuse me of being no good at VB here, and blame me rather than the tool…and I won’t argue with your conclusion too much. Maybe I am just a bad coder. But you have to ask yourself: if VS.NET and ASP.NET are good things and make you work better, why is the other guy not using them?
I think that Schwuk’s comment that “Bob is (probably) used to developing larger scale applications and hence much more likely to be bogged down with all the trappings that come with such projects: requirements, reviews etc” is pretty unreasonable; that suggests that the reason that Bob can’t write stuff as fast as Frank is that Bob does lots of “proper” project stuff and Frank just isn’t bothering. Now, I doubt that that’s what Schwuk meant, but that’s how I read that comment, and it seems a bit unfair. It’s entirely possible that all Bob’s .NET trappings aren’t actually making him any more productive.
On the last hand, it’s also possible that Bob, while being less productive, is producing better code and that’s down to his use of a more modern environment. Frank might be faster because he’s not doing certain things (because they’re too difficult), while Bob is doing all that and more besides (because .NET makes it easy for him). Difficult to say. But just because Microsoft and lots of third-party suppliers talk about how .NET will make coding easier or better doesn’t actually make it the case. Anecdotal evidence suggests that some people find it so and some do not; quite probably that’s the case with Bob and Frank, which just makes it one more meaningless example for me to throw at Schwuk; no doubt tomorrow he will be able to find a mirror-image example to throw back at me. This is why conversations are fun, I say. :)

Renting films

See, we like watching films and TV. So we’ve signed up with LoveFilm. It’s one of these “rent as many films as you like” schemes, where they send them to you by post. Cool idea. I looked at a few places that do it; LoveFilm and Amazon and Blockbuster and a few others, and LoveFilm seemed like the best deal. We can have three films at a time, and there are 116 films in our queue after an industrious couple of hours last night. That should keep us going for a while :-)

Connecting a DVD player to an old television

Niamh’s television is old. Old enough, in fact, that it doesn’t have SCART or S-Video or composite inputs. Just an RF aerial and a weird little 5-pin DIN socket, whatever that is. I wanted to connect a DVD to it. Now, I know that I could go out and buy a SCART-to-RF modulator, because I did buy one last time I connected a DVD player to that TV; however, it was thirty quid, and I don’t have the one I bought any more (I loaned it to my mother-in-law, who has lost it). So I thought: I’ll google to find out what the little DIN socket is, to see if I can connect it up that way.
On the front page of hits for old hitachi television 5-pin is a post I made explaining how I connected it up with a SCART-to-RF modulator last time. And in that post is a link to Dave Farquhar writing about the same problem wherein he says: connect the DVD player to a VCR, connect the VCR to your telly. So I’ve just done that and it worked perfectly.
I often use the internet for help on stuff. It’s not all that often that the help I get is from my own damned website.

More on Internet Explorer 7.0

The rumours are starting to fly thick and fast about the upcoming IE7.0. Although Microsoft have only said that the new version of the browser will focus on security issues, the web development community has been hoping that MS will take the opportunity to improve some of the area ... [Stuart Langridge]

Syndicated from the SitePoint Stylish Scripting weblog

-----

Using a weblog as a project homepage

This is me in grumpy bastard mode, because it’s 4.45am and I’m up, so I’ll just say: a batch of weblog posts isn’t a good homepage for a project. Useful to people who have been using whatever the project is since version 0.01alpha, yes. Useful to someone who doesn’t know much about the project and is trying to see whether it’s the right thing for them, no.

I'm going to LugRadio Live 2005!

I’m going to LugRadio Live 2005. Are you? If you are, or if you want to, or if you want other people to, display a button or a banner on your website. I’ve got the banner on mine, but if you want something a bit less garish, try the forum thread about this for more banners and buttons and pointers to where to get them.

Moving to del.icio.us, part 4

And finally, we need to actually display links from del.icio.us on the front page. Fetch them from del.icio.us hourly and write out a document snippet, and then include that snippet in the page.

First, how to fetch them: a trivial Python script which uses the del.icio.us REST API to get recent posts:
import xmltramp,urllib2,cgi

def e(s):
  return cgi.escape(s).replace('"','"')

authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('del.icio.us API', 'http://del.icio.us',
  'USERNAME','PASSWORD')
opener = urllib2.build_opener(authinfo)
urllib2.install_opener(opener)
data = urllib2.urlopen('http://del.icio.us/api/posts/recent').read()
dom = xmltramp.parse(data)

out = []
for p in dom['post':]:
  try:
    ext = p('extended')
  except:
    ext = ''
  out.append('<a href="%s" title="%s">%s</a>' % \
  (e(p('href')),e(ext),e(p('description'))))
fp = open('/var/www/kryogenix.org/scripts/index.curlies.cached','w')
fp.write('\n'.join(out))
fp.close()
Then throw a line in crontab to actually run it, with crontab -e:
@hourly python /var/www/kryogenix.org/scripts/get-delicious-recent.py
And finally a brief snippet to include it in the index page, which is a Castalian page:
<?cas
CACHED_COPY = '../scripts/index.curlies.cached'
pfp = open(CACHED_COPY)
response.write(pfp.read())
pfp.close()
?>

and that’s it. Move complete. No more maintaining my own linklog. :)

(Updated: changed the crontab call and the script so that if there’s a failure it doesn’t just blank out index.curlies.cached!)

Moving to del.icio.us, part 2

OK, all my short‘n‘curly links from the last 15 months, since I set up the linklog, imported to del.icio.us with the magic of delicious.py and a trivial Pytohn script to parse the pyblosxom files. I have lost some of the via information, but that’s because del.icio.us won’t let me have a via name and a via URL, so I’ve just stuck “(via: whoever)” on the end of the description (and, indeed, that’s what my updated del.icio.us posting bookmarklet does too).

I can’t help but feel that I’m joining the del.icio.us party really really late and I should be using something like Wists instead…but it doesn’t seem to have all the rough edges knocked off it yet. Maybe I’ll go for it in 2008 when all my contemporaries have been into it for two years.

Moving to del.icio.us, part 3

A trivial bit: the short‘n‘curlies RSS feed, which was at http://www.kryogenix.org/pyblosxom/pyblosxom.cgi/linklog/index.rss, now redirects to my del.icio.us feed. That was pretty easy; it’s possible that this will cause a republishing of the items therein though. It shouldn’t, because they’ve all been created at del.icio.us with the old dates, but if it does I apologise and I don’t know how I could have stopped it.

-----

Using del.icio.us

OK, I’ve decided to start using del.icio.us for short‘n‘curly management. One quick thing: I’ve hacked the bookmarklet so that it pulls out referrer information. My new one is post to del.icio.us. Now to actually start using it…

Not at SxSW

I tell you what, I wish every single weblog I read didn’t have a post in it explaining how much fun the author is having at SxSW. Bastards. Just keep rubbing it in.

Unicode shit

Incidentally, I posted the previous post about the IDN vulnerability from BloGTK on my Linux box, and I cut-and-pasted the Unicode “a” from Firefox from the original advisory into that BloGTK window. That Unicode “a” made it from Firefox, into BloGTK, over the XML-RPC wire to kryogenix.org, into a file, then back out of a file into this weblog post. I was utterly, utterly convinced that it wouldn’t work and it’d say “pH6;sd98ypal.com” or something. I must have got it all right somewhere.

The Official Kryogenix.org Unicode Policy is “everywhere and every time anything at all asks you about ‘encoding’ or anything like that, say ‘UTF-8‘“. This lacks rigour when you compare it with Joel Spolsky’s Unicode primer but, well, it worked. That’ll do, pig, that’ll do.

Fixing the IDN problem in Mozilla

Most people will have come across the IDN vulnerability in Mozilla and other browsers, where www.pаypal.com was registered, with the first “a” actually being a Unicode character, а, that looks like an “a“.
I think Mozilla should fix this by displaying non-ASCII characters in the Location bar in red. So http://www.pаypal.com/ would actually look like http://www.pаypal.com/. This isn’t unfair to non-ASCII users, since their URLs won’t look weird; an entirely Russian URL would be entirely in red, and therefore wouldn’t stand out.

Back button and Undo in Ajax applications

Alex has been working with the Back button in Ajax applications as part of the Dojo toolkit. Thinking about this, in an Ajax application, I think that Back and Forward map to Undo and Redo. Sort of. What I’m trying to decide is, if you could implement Undo on the Back button and Redo on the Forward, would this actually be a good idea? Does that break the semantic of what those buttons mean? I don’t think that it does, because “do an action” means, in a web browser, “click a link“, pretty much. (Or possibly “drag something“, but in general it’s “click something“.) People are used, on the web, to thinking “click on this…and the Back button takes me back to where I was before I clicked it“. So, clicking something in an Ajax app, which doesn’t actually navigate to a new page but instead just does something, would be “undone” by clicking Back, because the semantic is “the Back button takes me back to where I was before I clicked that last thing“.
This will likely annoy serious web developers, because they know that Back doesn’t mean “return to the state before the last click“, it means “go back to the previous page” (modulo frame-ish things). But that’s because an Ajax application isn’t like the web-as-was; “Back” and “Forward” don’t make that much sense when the page metaphor is broken anyway.
Note that I’m not talking about implementation detail here; Alex’s method seems to be the approach. But essentially what Ajax apps could do is provide an “undo stack” in the same way as client apps do; the implementation of making the back/forward buttons trigger this is then simply a call to one of Alex’s iframes when you move back or forward in the stack, and every action needs to write itself into the undo stack so that it can be undone.
This is rather rambly. I need to work up a demo to explain what I mean, perhaps.

Dave Allen dies

Dave Allen, the comedian, has died aged 68. He was hilarious. He’ll be missed.

Helping the Internet Explorer team

Chris Wilson, lead program manager for the web platform in Internet Explorer, has posted to the IE development weblog asking for people's opinions on which standards IE7 should best attempt to support. While there's a lot of "IE doesn't support standards!" warcrying ou ... [Stuart Langridge]

Syndicated from the SitePoint Stylish Scripting weblog

-----

Some Policemen and a Moral

I’m a fan of G. K. Chesterton. Not just his books, but his essays, his poetry, (to some extent) his philosophy and politics, and the way he lived his life. Of all his great works (The Man Who Was Thursday being high on the list) the best, I think, is a short essay he wrote and published in Tremendous Trifles in 1909 called Some Policemen and a Moral. Thanks to the wonder that is things going out of copyright and the Herculean efforts of Project Gutenberg I can republish it here for you to enjoy, and I have done so because you need to read it. It’s very short, so it won’t take you long. In amongst Chesterton’s characteristic, and glorious, baroque verbosity and fanciful images (there lies within a tree which “may reflect with a dark pride that it was wounded by a gentleman connected with the Liberal press“), lieth also a message (as the title may have made obvious). I imagine that most of the readers of this site will agree with the sentiments expressed therein. A snippet here, which is like movie trailers in that it shows you the best bits before you start and so the rest may seem a pale filler between that already seen:

I was certainly accused of something which was either an offence or was not. I was let off because I proved I was a guest at a big house. The inference seems painfully clear; either it is not a proof of infamy to throw a knife about in a lonely wood, or else it is a proof of innocence to know a rich man. Suppose a very poor person, poorer even than a journalist, a navvy or unskilled labourer, tramping in search of work, often changing his lodgings, often, perhaps, failing in his rent. Suppose he had been intoxicated with the green gaiety of the ancient wood. Suppose he had thrown knives at trees and could give no description of a dwelling-place except that he had been fired out of the last. As I walked home through a cloudy and purple twilight I wondered how he would have got on.

-----

Minor tweak

I’ve updated the discussion of my sorting tables script to tell people what to do if they want the data sorted when the page is generated, which will hopefully stop people mailing me to say “how do I make sorttable run when the page loads?”

-----

Random things

More cleaning up Kept New things in Bloglines

  • Seth Nickell’s essay about Sabayon makes it look like one of the coolest things I’ve seen in ages. Help desktop sysadmins by allowing them to fire up and configure a user profile (or user group profile) in an Xnested X session. Wow. Cool.
  • rds’ points about Linux users’ laissez-faire attitude to security deserves a real post, but I’m not going to get time. Suffice to say that yes, he’s right, we need to be more aware—Paul Vixie once famously said that “if I can get you to ‘su and say’ something just by asking, you have a very serious security problem on your system and you should look into it”—but I think he underestimates the amount of damage hostile code can do as a user in a world of single-user desktop Linux machines, and he also underestimates the amount that application authors try to avoid bad situations: Apache disavows all privileges, for example, and Hula isn’t supposed to run as root, it was just that way because of a bug in the initial release, which was being fixed.
  • Ian Bicking talks about professionalism in much the same way I do; it’s a code word for staid, stuck-in-the-mud, mindlessly carrying on according to some contentless plan handed down by your betters rather than innovating. The true progress comes when you salt “professionalism” with un professionalism, or the other way around; anarchic groups of hackers don’t get much done (don’t claim that major open source projects are like this, because they are not; there are leaders and process), and “professional” places don’t do a lot of innovation. The interface between the two—the “edge of chaos“, as Michael Crichton has it—is where stuff really happens.
  • More comments on Python vs. .NET stuff from a conversation I had with Reggie Burnett. Again, something I ought to compose a proper reply to but haven’t had time…
  • Python, Quixote, and Cheetah together is the way forward for web applications, says Edd Dumbill: “Quixote plus Cheetah could be the direct (and free) Python answer to ASP.NET“.

The same effect

ClearCase’s sole purpose is to make my life difficult. The company could save vast amounts of money by using cvs/subversion/etc and employing an unskilled worker to kick me repeatedly in the balls. They’d get the same effect, with the adding bonus of occasionally developing some software.

I have days like that. Not specifically about ClearCase (we use Subversion for all the projects that I can’t get out of Visual SourceSafe), but it’s not the only commercial product that makes you feel like that.

-----

Why I like Python

Schwuk makes reference to a post of Rory’s on why Python is no good. As Schwuk says, I might get annoyed by this, and he’s pretty much correct here.
You see, I think that a reasonable proportion of Rory’s complaints are a bit lacking. Take his complaint that you have to explicitly pass “self” to methods:

Sure, having to add self to a parameter list once isn’t any big deal, but three-hundred methods later, when the ink is worn off the S, E, L, and F keys, you might be thinking differently about it.

Take a glance at your close-curly-bracket key: }. Has the ink worn off that? If it has, then I’ll start to listen to your complaint more. If it hasn’t then, well, obviously extra unneeded characters, like C’s curly brackets, aren’t that big a deal, eh?

I would have respected a choice to have ditched all 1.x hacks, but instead they were carried over to 2.x, so now we had the choice of doing things procedurally or Object Orientedally (yeah – I made that word up – bite me). What a bloody mess! Let’s see… Do I want to work with functions on my strings, or do I want to work with members of the string object? I hate that kind of crap.
I utterly don’t agree here. OO gives you the power to write decent proper applications; I entirely agree, and I pretty much find that anyone writing anything even vaguely substantial in Python uses OO to do it. But constricting the user to write in OO style is a massive pain in the arse when you just want to throw out a quick script. I find myself doing things like
grep "some regexp" /some/file | \
python -c "import sys;print '\n'.join([x.split()[3] for x in sys.stdin.readlines if x.split()[6] == 'word'])"
If I had to wrap that in a load of OO bullshit it’d be loads more complex for no reason. Similarly, a lot of the Python I write is short scripts to, say, grab an RSS feed and rip some data out of it (the thing that reposts my SitePoint articles here is like that). Again, this is a quick procedural script: start at the top and work through the lines. They quite often don’t even use functions. If I had to swaddle that in OO bollocks it’d be more complex and slower to write and I would derive no benefit from it.

Notate bene primus: Perl people are saying “what’s all that sys.stdin.readlines() shite? This is what perl -n is for!” They’re right; Perl is even better at this sort of thing than Python is. I find that Python hits the sweet spot between the two; others differ.

Notate bene secundus: yes, I suppose I could do similar stuff with a sed/awk pipeline without going into Python. Fuck off.

Notate bene tertius: “orientedly“.

He’s right about all the underscores, though. Constructors being called __init__ is a pain in the arse.

In short, I disagree. However, each to their own and all that…

Update: further discussion on Schwuk’s original post.

Customising GMail with GreaseMonkey

GreaseMonkey is a Firefox extension that allows you to add "user scripts": bits of JavaScript which are attached to a particular URL or set of URLs that run when that URL is visited. In essence, it's like having a bookmarklet that does something useful to a page and ha ... [Stuart Langridge]

Syndicated from the SitePoint Stylish Scripting weblog

-----

Google thinks I have a virus

I’m just about to write a post about GreaseMonkey for Stylish Scripting and I wanted to check if Simon had written about it there before. Best way to find that out? Well, I’d have thought a Google search for inurl:http://www.sitepoint.com/blog-post-view.php greasemonkey. And when I do that, I get this:

The text is:

We’re sorry…but we can’t process your request right now. A computer virus or spyware application is sending us automated requests, and it appears that your computer or network has been infected. We’ll restore your access as quickly as possible, so try again soon. In the meantime, you might want to run a virus checker or spyware remover to make sure that your computer is free of viruses and other spurious software. We apologize for the inconvenience, and hope we’ll see you again on Google.

What’s up with that? Other Google searches work, and I consider it highly unlikely that my machine is infected with a virus or spyware.

The wooden spoon of overcomplexity

So, we released the new LugRadio site and it ran really slowly. Now, it’s built on PyBlosxom, and it’s pretty complicated in parts; some pages include other pages by reading them off the filesystem, some include server-parsed versions of those pages; a CGI can’t output SSIs, so I had to do it myself with urllib; etc etc etc. It was dead slow. So I was trying to think of the best way to solve this; I thought about using PyBlosxom’s static rendering or running PyBlosxom under mod_python (no link provided as the HOWTO that’s out there is out of date and wrong; apparently there’s stuff in CVS which does it too, but I don’t want to run CVS and it relies on WSGI which I don’t understand either). And then Matt mailed me and said “can we use caching to speed the site up?” And I thought: why am I trying to do this a really complex way? Since the site doesn’t do anything interactive (it does build pages dynamically, but the resultant HTML for that page is the same every time), why don’t I just spider the lot and serve the resultant saved static HTML? So that’s what I did, with the command
wget --no-host-directories \
--directory-prefix=/var/www/lugradio.org/static \
-p -E --mirror http://secretlocation.lugradio.org/
so the previously existing pyblosxom version now exists at http://secretlocation.lugradio.org/ and www.lugradio.org points at the statically saved HTML in /var/www/lugradio.org/static. And, because it’s all plain HTML files, it works like blazes. The wget command is cronned to run hourly. That’s it.

I’m a bit worried that I’m overlooking simple and good solutions in order to be more complex. That’s not only not a good thing, it’s exactly what I complain at other people about; overcomplicating a solution is not a good thing, and the KISS principle dictates not doing it. I need a slapping for not doing it the simple way. I’ll be installing complicated “frameworks” and so on next. If that happens, shoot me.

LugRadio Live!

Well, episode 10 of season 2 of LugRadio is out, and lots of stuff has changed.
For a start, we’ve got real permalinks to episodes! Look! FInally we creak our way into 2003! This all comes as part of the brand new site design, done by Matt, and is a present from us to ourselves on our first birthday as a radio show. Fuck me, it’s been a year. Stream-of-consciousness musing on this coming soon.
Secondly, I have learned that a complex pyblosxom site with lots of pages #including lots of other pages, with lots of plugins, is too slow to run on a medium-power machine when it gets hit a lot by downloaders. Sorry if you were a victim of that. So the site is now blazingly fast because it gets mirrored hourly to static HTML and that’s what gets served up. This only works if your pages don’t actually contain any dynamic content—i.e., they are generated dynamicaly, but when the next punter comes along the page that is generated dynamically is the same—but that’s OK, because lugradio.org exactly meets that criterion. I need to investigate running PyBlosxom under mod_python rather than as a CGI, but I don’t really get mod_python (and I totally do not get WSGI stuff), so this static HTML renderer thing was a quick hack that will hopefully solve the problem. The mod_python learning experience will solve it for kryogenix.org too, mind.
The most important thing revealed in the episode, however, apart from it being called “Ginger Ball of Fury” (guess who that was about?) was…

LugRadio Live is happening!


Yes, on Saturday 25th June 2005, the Molyneux Stadium, home of the famous Wolverhampton Wanderers, plays host to the UK’s premiere free software event. Come on, you know that the Expo’s pretty crap nowadays and full of corporate rubbish and the only reason you go is to see cool people: come to LugRadio Live instead! (or as well, if you insist) We’ll have cool talks, exhibitors (but no-one in suits), lots of cool people, and beer. What more could you ask for?
Watch the LugRadio Live page for more detail, and there’s also the LugRadio Live forum over at forums.lugradio.org. We’d love to see you in Wolverhampton.

Bring out your leeks

Ah, the first of the month, when a young man’s fancies lightly turn to a fucking huge deluge of mailman reminders.
It is St. David’s Day, though, so a hearty “Dydd Gwyl Dewi hapus” to all my readers from the land of close-harmony singing and double Ls. I’ll try and eat some cheese on toast and a leek for lunch.

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.