Tuesday, June 24, 2008

Wacky Amazon reviews

There's nothing quite as fun as the Amazon reviews on an even slightly controversial book. Here's a particularly good example. One K. Leyendecker, from (surprise) Texas, has copy-and-pasted the same review onto five books for children which involve homosexuality. Apparently 'Gos' (God's brother with the speech impediment?) doesn't like the gays. Funnily enough, one of the books has another negative review, from a lesbian couple who liked the pictures, but were unimpressed with the storyline.

Also amusing are the reviews on Colleen McCullough's historical novels about the late Roman Republic. Because all the negative ones are entirely at cross-purposes. "This book has naughty words in it" sits beside "There's far too much boring history in this; more sex please", "There are no admirable characters" (why is this a flaw?) sits beside "she's obsessed with Caesar", "If you want accurate historical novels about Rome, read Graves" (eh?) sits beside "It's too precise; I prefer Graves, with all his inaccuracy" (quite right; I Claudius is great but largely made up) and so on and so forth. A few people are also offended by the extreme length of the books; generally about 800 pages. It's really quite strange; the vast majority of the reviews are very positive, but there are people who seem to consider the things patently unreadable.

I love this:
I'm fairly certain she included every single Roman name ever found in any ancient document anywhere, and since this is Rome, they're all pretty much the same. You're constantly having to either turn back the page to try to remember who the ten dozen people mentioned on this page are, or simply skimming over it, assuming (usually correctly) that they are utterly irrelevant to the basic story.

Highly recommended, by the way, if you're the sort of person who isn't scared of 800 page books about people with similar names backstabbing (figuratively and occasionally literally) each other. I Claudius is shorter, but contains more incest and mad great-aunts.

Wednesday, June 18, 2008

Going back to the dark side

As I may have mentioned here before, I haven't been eating chocolate for a good while. Initially it was a health thing; eventually, though, I just found I didn't like it anymore.

So anyway, today I had a dark chocolate kitkat with my coffee. Yep, they come in dark chocolate now. There's also a 'fine dark chocolate kitkat', it seems; in this case, 'fine' means '6 fewer calories'. Well, forget that; if I'm having a kitkat, it may as well be the one with six extra calories. Actually, Nestle's website informs me, the 'fine' version is differenciated by having proper bitter dark chocolate. Hmm.

It turns out that kitkats with nice black coffee are actually lovely. Oh, dear.

If you find me in a few weeks dead and 100 stone, it may just be a chocolate overdose.

Monday, June 16, 2008

Judicial Activism, and Uncommonly Silly Laws

The phrase 'judicial activism' is often invoked (typically, but not always, by those who support keeping society like it was back when men were men (unless they were black, or poor, or something), women were possessions, and everyone was equal as long he was white, rich, male and Christian) against judges who try to interpret law in the context of modern society. (Please note that I am not saying that these judges are always right, but quite frankly in the Western world they have a good track record).

It's an interesting one, though. It's most often a factor in multi-judge no-jury superior courts, and can have great impact upon society, for better or for worse.

What fascinates me is those judges who seem to believe that a law is unjust, but nevertheless argue that it is constitutional, so must be upheld. Isn't that a strange concept? Having to uphold something even though you think it is wrong, because of the way a centuries-old document is phrased?

The thing is, this crops up most frequently where the law is being stricken down anyway. Both in Griswold v. Connecticut (1965; ruled that laws prohibiting married couples from using contraceptives were unconstitutional) and Lawrence v. Texas (2003; ruled that Texas law, and by extension laws in twelve other states, prohibiting homosexual sex were unconstitutional), one judge said that while the law was an "uncommonly silly law" it was constitutional.

It is, of course, very easy to make a decision like that when you know that the "uncommonly silly" law is done for, anyway. I do wonder what these judges would have done if they had had the deciding vote. Would they have protected the constitution (or their reading of it), or gone with sanity? These were not silly little issues which didn't matter, remember; they effected tens or hundreds of millions of people. Difficult decision, and I'd imagine that many defenders of the constitution have jumped ship in the past to prevent horrendous injustice.

All is not lost

Well, it turns out that, even though we have of course, by rejecting the Lisbon Treaty, embarrassed ourselves in front of Europe, and screwed ourselves for the future, we have made one small gain.

Apparently, the Neo-Nazis love us! Le Pen, for instance, is overjoyed.

On the other side of the pond, I doubt America's horrible, horrible Neo-Cons are too devastated, either.

Proud to be Irish, much?

It's the end of the world as we know it...

Tesco's new advertising tells you that you're comparatively poorer than you were, and that Tesco can help you with this. It's a little scary that the economic trouble has gotten to the point where they're comfortable saying that.

Care for a Wall Fish?

Time Warner Cable is a US cable company which is bringing in expensive low-capped Internet service on a phased basis, to replace their uncapped service. I bet they're popular.

Anyway, on a whim, I decided to take a look at their price list. All a bit ho hum, except for one item. It's under installation.

"Wall Fish $75". Erm, I'm sorry, what? No explanation is offered. The Internet is unhelpful on the subject. Wikipedia tells me that it was a Roman euphemism for this:

I doubt that that is what Time Warner means, though; at any rate I hope it's not.

Sunday, June 15, 2008

Bike Sex case

That man who was caught having sex with a bicycle (eh? How does one have sex with a bicycle) in Scotland was given three years probation a few days ago. He was also placed on the Sex Offenders' Register. He was caught with the vehicle when a cleaner used the master key to unlock his bedroom door in a hostel.

Now, okay, it's weird, and he should probably have told the cleaner not to come in, but really, if a cleaner had unlocked his door when he was masturbating, or having sex with a person, would it have been an issue? Surely one has a reasonable expectation of privacy in this sort of circumstance? Is having sex with a bicycle in itself to be considered illegal? If so, why, and how on Earth are they defining sex?

Update: Apparently, he continued shagging the bike when the cleaners came in. Okay, maybe it's more reasonable then. He also referred to them as 'hens', though this may be a Scottish thing. Of course, then, his offence isn't really having sex with a bicycle, it's exhibitionism or something.

There was also an electrician who was allegedly having sex with a pavement, but that's just silly.

Bandwidth charging makes it to the US!

I hear that the big American ISPs are about to start charging for bandwidth. Now, of course, a lot of the rest of the world has been doing this for years, but at least some of the US ISPs seem to be going a bit mad, with quite expensive plans allowing 5GB per month, and other such silliness. I am reminded of the Asimov story involving a horribly over-complicated and expensive tax system; when this was pointed out to the necessary-plot-element-dictatorial-leader-with-no-access-to-economists, he switched over to poll tax.

On the one hand, really low bandwidth restrictions are over-the-top, and may actually effect the way people use the Internet out of fear of going over (the over-use charges are silly, too); I doubt Google is overly impressed.

On the other hand, though, no-cap Internet service probably isn't really a great idea. Inevitably, a small number of people will use the lion's share; UK ISPs give figures along the lines of 5% of users using 95% of capacity. It really isn't terribly fair that your Internet access slows to a crawl because your neighbour is downloading a few terabytes of porn, and bandwidth is not free, even for the ISPs.

It'll be interesting to see how this one plays out. Hopefully, it won't scare people off the Internet too much.

Fuel-crisis-tastic

Apparently, there's a petrol shortage in the UK, with about 7% of stations out of fuel. Some of those which still have fuel are rationing. Now, it's artificial, due to a truck strike, but still, sign of things to come? A bit scary; this has never really happened before in my lifetime.

Saturday, June 14, 2008

Fox-News-Tastic

Fox "News" is a propaganda channel for crazed racist troglodytes, popular in America; shocking, eh?

Anyway, the wonderful Gawker has compiled some of the more amusing things that Fox I-Can't-Believe-It's-Not-News said about Barrak Obama, noted Muslim/Atheist terrorist (no, really, this is what a surprising proportion of the American population seems to believe).

Have a look. It's hilarious, or at least it would be except that you have to assume that if people think Fox is news, they will take it somewhat seriously. It runs the full gamut from racism to accusations of terrorism to incitement to murder. I'm pretty certain a lot of it would be classed as illegal hate-speech in Europe. As, possibly, it should be; it's the duty of the media not to actually lie to stupid people.

Haircut-y mishap


Lessons learned; 'fairly short' sounds pretty much like 'very short', especially when the barber (barbress? What's a female barber?) is talking to someone across the room while you say it.

Oh, well, it's actually reasonable enough; it's just shorter than I've had it for ten years or so.

Caprine Rapper

According to eMusic, Lil' Kim (a popular rapper person) has brought out a new album called... wait for it... MS GOAT.
Okay, so GOAT stands for something. Still absolutely bizarre.

Fake Acorn Review!

I just found something rather odd. It's a review of a newish (2005) Acorn Archimedes clone, running RiscOS 5. If you're about my age and Irish or English, you may remember the Acorn Archimedes as that strange thing that your primary school got to replace their BBC Micros just before you finished primary school. Oh, it looked very modern and amazing at the time...

The review in question is of a 600MHz ARM machine (that's about the same as the old iPhone's processor) with 512MB RAM and a 120GB hard drive, costing 1300 pounds. Yep, that's pounds sterling; 1700 euro or 2500 dollars.

It's really, really odd to see something like this; I had assumed that the Archimedes was extremely dead. It even has a new operating system; RiscOS 5. I wonder just who, exactly, the target market is?

Monday, June 9, 2008

iPhone!

Well, Apple announced a new iPhone today. Oh, I am excited! It looks lovely; slimmer than the old one, better battery life, faster, 3G, GPS, and, most significantly, way cheaper; Jobs alleged that it would be under $199 everywhere that it's being sold! It'll be available on the 11th of June; I'm going to be sorely tempted, I know...

Watching the stock price was quite interesting; Apple's fell throughout the keynote, then surged up when the 3G iPhone itself was announced. If you had some nerves, you could make a fair bit of money on Apple's keynotes; this is always the pattern. Research in Motion's (the Blackberry people), meanwhile, fell sharply, then recovered slightly; they're still a bit down. Not surprising; given that the new iPhone has Exchange integration and so forth, it's easy to see that it could be a threat.

There were two other interesting announcements. The first, I feel, is a terrible mistake on Apple's part. They're relaunching an enhanced .mac service at me.com, with email, calendars, photos, files and so forth syncing to the phone. The big mistake, in my mind, is that they are going to be charging for this; $99 a year. You might think that many people would be willing to pay for the convenience. Which leads me to the other interesting announcement.

One issue a lot of people had with the iPhone SDK was that you can't have apps running in the background; this would, on the face of it, make it very hard to write an app which notifies the user, or does something, when something happens. Noticing this deficiency, Apple are releasing a service which allows third parties to push messages to peoples' phones, notifying them that something has happened. With this, and the Google APIs, it seems to me that one could more or less replicate the me.com functionality with Google's services quite easily, and for free, or at least for far cheaper than Apple are doing it. Everyone already has Google accounts, too. I'd be amazed if me.com is a success.

One other thing; no video-conferencing with forward-facing camera, as was much-claimed beforehand. No loss, say I; I've never been convinced that anyone uses videoconferencing except to impress people in big corporate conference rooms, or to show dodgy Internet people their naughty bits. Exhibitionists will just have to stick to Nokia for now.

All in all, I'm really impressed... and I really want one. (an iPhone, not an exhibitionist). I supppose I could justify it to myself on the basis that I might write apps for it and sell them on the app store...

Oh, also, MacOS 10.6 is coming out in a year or so. It doesn't look terribly interesting so far, though besides the now-mandatory faster Javascript, they'll apparently be doing clever things with GPUs and many-core computers. Making a HPC bid, perhaps? Cray already have the glamour supercomputer market sewn up, I suspect...

The beginner's guide to Clojure

What is Clojure, I hear you ask? Well, as you know, in the last decade or so, Sun's Java thing has taken the world by storm. Few can deny that it is acceptably fast for most purposes, nor that it will run just about anywhere with sufficient prodding and coaxing, nor even that it has plenty of handy libraries for every occasion, and a GUI library which, while revolting, is a great deal less revolting than most other very cross-platform GUI things; I'm looking at you, TK.

The problem is that Java the Language, as opposed to Java the Virtual Machine or Java the Rather Strong Sort Of Coffee, Now Out Of Favour And Replaced By Varieties From Famine Hotspots, is really, really, amazingly bloody awful. Shockingly bad. It's like C++ with a memory manager stuffed in and most of the useful stuff sneaked out the back door. Things aren't all bad; the Java implementers are slowly adding scary things like generics, and who knows, there may be closures and multiple inheritance and unsigned integers before the decade is out! Okay, well maybe the century. Anyway, the point is that as it stands Java is unusable, except by masochistic website developers who somehow think that it being a pseudo-industry-standard forgives all, and that writing endless reams of crap again and again and again builds character, anyway.

How, then, do we get the admitted convenience of the JVM without having to wrap things in endless other things just to make them vaguely usable? Fortunately, more Java-tolerant people than I have looked into the issue, and have produced other languages targeting the JVM. Lots of them. They are legion.

Some are re-implementations of nice-ish languages, like Python, Ruby, and Common Lisp. These, sadly, tend to have one thing in common; they don't work properly. Then there are endless Schemes, as is required for any VM whatsoever, a variety of scary BASIC derivatives, frankly sick and twisted things like COBOL for the JVM, nasty things designed by XML fetishists... and then there are the oddities. Clojure is one such, as is Scala. These are effectively new languages, albeit heavily influenced by older tongues, for the JVM.

Clojure, which, I think, was the original point of this ramble, is a Lispish, brackety creature; it also has funny concurrency stuff, of which more anon. It's really quite nice, though it has its quirks.

A big problem with these funny little new languages is generally that there is no acceptable way to work with them without going mad. There's no IDE, no tools, no debugger... Fortunately, this turns out not to be the case with Clojure. There is a port of the SLIME backend (SLIME is a nice Emacs interaction mode for Common Lisp). The one tiny little problem is that nowhere on the great wide Internet, as far as I can see, is there any guide to getting this stuff set up.

Here we go, then.

First, you'll want the SVN version of Clojure. The packaged version Will Not Do for these purposes, it seems. Actually, aha, fooled you, you'll want Apache Ant first; it is a scary tool for building Java projects. Yes, of course it has plenty of XML; did you even need to ask? Get it and install it, then in your checkout, type 'ant jar'. This will cause a JAR file (a ZIP of compiled Java code) to appear before you in short order.

You'll then want to get all three things from here. One is a script to run Clojure conveniently, one is a standard Emacs mode, and the third is the SWANK backend. Set up the script, and put the other two somewhere.

Right. You will now want a .emacs file something like this:

(setq slime-lisp-implementations
'((clojure ("/Users/robertsynnott/bin/clojure") :init clojure-init)))

(add-to-list 'load-path "/Users/robertsynnott/clojure/clojure-mode/")
(require 'clojure-mode)

(add-to-list 'load-path "/Users/robertsynnott/clojure/swank-clojure/")
(require 'swank-clojure)
(add-to-list 'load-path "/Users/robertsynnott/lisp/slime/")

(require 'slime)

(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
(slime-setup)


Obviously, you should substitute paths on your own system; mine has quite enough to be doing.

You may now restart Emacs, and type M-x slime. All going well, you should be presented with a Clojure REPL. You may now open a file to put stuff in; the mandated extension is '.clj', displeasing in that, to me at least, it suggests both Common Lisp and Java; Clojure is neither. Possibly I am being over-paranoid. Depending on the phase of the moon, you may or may not have to do M-x clojure-mode to get things to behave, at that point.

You now have Clojure running! Try typing '4'; you will note that you get '4' in return. This pleasing result can be replicated for even very large numbers.

What's Clojure like? Lisp-ish... mostly. There are extra types of bracket, you see. [] are for arrays and various other things; {} are for dictionaries/hash tables. A function looks like this:

(defn bla ([x] x)
([x y] (+ x y)))


You will note that there's a weird pattern matching thing going on here; (bla 4) will return 4 while (bla 4 5) will return 9. lets are similar:

(let [[a b c] [1 2 3 4]]
b)

That gives you 2; it's a little like a combination between a Common Lisp let and destructuring-bind. I actually quite like this; it looks like the sort of thing CL should have.

There are also multimethods! They're not as cabable as those in CLOS, to be sure, but a fair bit better than Java's OO system. They operate on dictionaries as objects, for some reason.

Then there are the weird concurrency things. One is a Software Transactional Memory system, meaning that it behaves a bit like a database, it seems; the other is something similar to Erlang's message passing. I like these; so much nicer than mucking around with proper threads.

There are also quite nice semantics for talking to scary ol' Java, when it becomes necessary.

I've barely scratched the surface, of course, but the online guide is well worth a look, if you're interested.

Would I actually use it? Hmm, well, now, I'm not sure. There's certainly an appeal; if I was doing something which might ordinarily call for Java, Clojure might be a nice substitute. Your mileage may vary, of course, but I'd say it's definitely worth looking into.

Sunday, June 8, 2008

Embarrassing iPhone article from CNN, and Flash musings

The iPhone is on everybody's mind right now, or at least on the minds of all us obsessive Apple followers. It seems fairly certain that a new version, probably 3G, will be released tomorrow.

Here's CNN's take (on the speculative patent-based third-generation iPhone, which they think is the fourth-generation one because the second-generation one due out tomorrow has '3G' in it, you see...). Besides the talk of noted always-just-round-the-corner vapourware Wi-MAX, there's this gem:

Just how will Apple meet expectations? Using the patent application as a guide, Apple appears to be making room on the iPhone for flash memory, which means an end to Apple's standoff with Adobe (ADBE) that's kept iPhones from easily viewing a plethora of Internet videos.

Apple has said that Adobe's flash media player, which is on hundreds of other phones, doesn't perform up to Apple's standards for the iPhone.
Erm. Right. Having more Flash memory makes Macromedia/Adobe Flash faster, you see. The fourth-generation (fifth, or possibly nineteenth in CNN land) will have Java memory to make Sun's Java faster, and possibly Office 2009 memory to make Exchange faster.

Honestly, I realise that they're not a technology writer, but could they at least have someone proofread this crap?

Also, what is going on with that Flash thing, I wonder? The iPhone isn't dramatically slow, and most non-video Flash apps aren't that demanding. If I had to guess, I would say that it was more of a manifestation of Adobe's slowness to port to new platforms (no x86-64 version, yet, remember), and possibly a bit of payback for Apple's cruelly grabbing the Carbon rug from beneath their feet; the next version of Photoshop for MacOS will only be 32bit, allegedly, because Carbon (Apple's old, creaky, SDK, used by Photoshop, MS Office, MCL, various others, and for that matter, I believe, Flash) never made it into the 64bit world; they'll have to switch to Cocoa for that.

Could that be the issue with Flash-on-iPhone? iPhones don't do Carbon at all, I don't think; it's entirely possible that Adobe just didn't have a suitable plugin in time.

Words of wisdom from Fathers for Justice

Apparently the plight of fathers in the UK currently is 'the biggest breach of human rights since the Holocaust'. So sayeth madman on roof of MP's house wearing Superman costume. And they're offended that no-one takes them seriously?

Saturday, June 7, 2008

SingStar PS3

SingStar's a console kareoke game, where you have to sing along with songs, and get points based on how well you do. It's great! Well, I love it; your milage may vary.

Anyway, previously it was a PS2 only thing; there were about 30 titles, each with 20 or so songs and music videos. With their PS3 version, they've done something clever; you can download songs (with videos) for 1.49 euro. It's terribly addictive; I can't wait til the next new batch of songs turn up for it! The odd thing is that you'd expect that they'd make more money on the version where you have to buy new disks for 50 euro or so; possibly the 1.49 impulse purchase thing works out better for them.

The trouble with video blogging

Much has been made of the potential of videos on the Internet. Thousands of people do 'video blogs', and any new web framework or whatever worth its salt will have roughly 50 narrated screencasts of how to make a blog or clone Reddit or whatever.

The thing is, does anyone actually watch these? The equivalent in text is nearly always easier to follow, quicker to read, and less bloody irritating. I've never sat through a whole episode of a 'video log', or, indeed, one of the web framework videos. And yet I read lots of normal blogs, and articles on web frameworks and similar. I seriously doubt that I am alone in this.

They're more trouble for the maker as well; you need equipment, and somewhere to put the things, and I suspect they take longer to make than the equivalent would to write. Then there's the whole 'putting video of yourself talking on Internet' psychological aspect. I know I wouldn't really be able to deal with this; I can barely look at still photos of myself without vague irritation, and cringe if I ever hear my voice recorded.

Robert Scoble, noted ex-Microsoft person who blogs enthusiastically about Web 2.0 stuff, is a prolific video blogger, producing hour-long videos where he talks. Why, exactly, this is better than an audio recording of him talking, or, indeed, than the text version thereof, is unclear, but he, and many others seem to be really, really keen on the idea. He even, apparently, films the damn things in HD; quite why anyone would want the image of Scoble going on on their screen to be a higher-resolution version is unclear. Showing off would be my suspicion.

So, am I just a weird luddite? Or is it the case that no-one actually watches these things?

Thursday, June 5, 2008

Big Brother-tastic

Apparently, today is the first day of the Big Brother of the month.

One of the candidates (Luke) is, well, 20, business student, doesn't drink, doesn't smoke, wears suits all the time. I fully expect him to be pregnant and addicted to heroin by the end of it.

He is also annoyed by people who think he has a speech impediment; he says he doesn't. Erm, I'm not sure if that's the sort of thing that's for you to decide, dear.

Update: There's also a really horrendous gay. I may have to become a straight for a few months to avoid association. I mean, I'm all for tolerance, but he's sort of the gay equivalent of those straight guys who... well, actually I've never met anyone as extreme in the opposite direction. The gay equivalent of Paris Hilton, perhaps.

Wednesday, June 4, 2008

Death of a stupid-looking pseudo-car

Apparently GM is looking to offload the Hummer brand on anyone who will take it. Turns out people don't really want a 10mpg 6 tonne converted pickup truck these days, even if it does make them feel more secure about their naughty bits.

Yay! I saw one in the flesh, once or twice; absurd objects.

Argh!

So, I was sort of getting over the whole getting old thing. But apparently, it reduces your sarcasm abilities! I won't stand for that, I can tell you.

Wikia Search, and a cat

Wikia, Jimbo Wales' company, launched a search engine a while back. No-one really noticed, because it was dreadful (especially the ranking; it's pretty nonsensical), but it got a bit of publicity today, for reasons I'm not clear on.

Anyway, look what happens to the header if you search for 'cat':

It's not a bad cat, I suppose, but felines of far higher grade can be found with little effort on Google Images.

I'm not sure why anyone thought that endless tiled pictures of cats (or whatever; things turn up for quite a few searches) was a particularly sensible idea. It looks pretty dreadful, generally.

New glasses

I just got new glasses today. I'd been using my free spare pair for the last few months, after the first one vanished (like an old oak table); they finally fell apart on Friday, when I was visiting the Pav in Trinity.

They're... well... almost exactly the same as the old ones. I didn't conciously try for that; it just happened. They're a bit lighter, though.

Also, SpecSavers is very keen that you take sunglasses as your free spare; presumably they are cheaper. I've never worn sunglasses yet (except in this picture) and I don't really plan to start now.

It's slightly overwhelming being able to see properly again, after a few days' break. Information overload. Everything looks very shiny and real. Ooh, pretty.

Tuesday, June 3, 2008

Yet another argument for the Internet to be shut down

Apparently, there are brothels in Second Life (that absurd online role playing game with the economy that's collapsing even quicker than the real world's). Apparently, a person of the male persuasion pays about 6 dollars (that's real dollars) for service. Erm, what service, exactly? The various news sources mentioning the silliness are silent on the matter. Apparently, one brothel owner makes $50,000 (real money) a year on it; probably on about 20% of the takings.

Yes, people are paying hundreds of thousands or millions of dollars for poorly-animated sex on an unreliable online service. You couldn't make this stuff up. It's actually more pathetic than those premium-rate sex lines advertised on dodgy satellite channels.

Michael Arrington has been slighted! Hide!

Apparently someone who has a website didn't know what TechCrunch was. Arrington seems to be dazed and horrified; see his comments.

I've always thought the man was a bit full of himself, but this by far the best example I've seen in recent months.

You have to assume that he never leaves Silicon Valley; otherwise the fact that no-one had the first clue who he was would presumably make him see sense.

Little UI slipup for Apple


This appears on Safari password boxes when you use HTTP authentication without HTTPS. "Your password will be sent in the clear". I mean, I know what they're trying to say, but it's hardly the most obvious message, now, is it? The phrase only appears a few hundred times on Google.

It's surprising here because Apple is famed for its dialogs, especially since the release of MacOS X. The Windows Vista usability guidelines (which even Microsoft don't seem to be to inclined to follow) even take some inspiration from them.

BBC being even more BBC than usual

Note that four out of the five most popular items are totally absurd. That's high, even for BBC.

Monday, June 2, 2008

Loop the Loop

Along with the fancier CLOS features, and format, one of the things I found most jarring when I first learned Common Lisp was the loop macro. In a world of brackets, it's a strange creature; a small domain specific language for looping and iteration.

Like, funnily enough, CLOS (but not format; I still hate it), loop is one of the CL features I am now most addicted to, and miss the most when using other languages. It was apparently only added to the standard more or less at the last minute, and replaces (but is backwards compatible with) a much simpler loop. I'd be fascinated to learn just how it came about, but the Internet is unhelpful on the subject.

What's loop like? Well, you can iterate over lists, vectors, and hash-tables (with destructuring of elements, if you like), use multiple for-loop like counters, assign variables, do things conditionally, return early, have initial and finally operations, and gather results into lists. It really is a little mini-language.

The syntax for hash tables is particularly weird: (loop for var being the hash-keys/hash-values in hash-or-package ...). I mean, why? Maybe it was to discourage people from doing this, when it comes to it, rather weird operation. :)

Collecting is my personal favourite; with loops within loops, you can turn nasty things like XML into nice things like lists of nested CLOS objects. In particular, using loop seems nearly always a bit nicer than using mapcar;

(loop for i in *alist*
collect (princ-to-string i))

vs

(mapcar (lambda (x) (princ-to-string x)) *alist*)

A matter of taste, I suppose, but there you are.

Ultimately, I believe, loops compile into big scary blocks for do statements; do statements being generally considered too horrible for direct use.

I suspect that the list comprehensions you see in Python and such were either inspired by loop, or vice versa. They're not even vaguely as capable, of course.

Facebook, for all your Meeting Sex needs

I just had a look at the stuff that Facebook has just released as open-source. Scary PHP code with magic_quotes evading deviced embedded at random, mostly, but then there's this, an interface definition which includes the field 'meeting_sex'.

Sadly, this doesn't involve rumpy-pumpy in front of the video conference system; it actually defines which genders the user is interested in.

Which is interesting, really; in the application, this is presented as 'interested in', rather than meeting; possibly Facebook originally had aspirations of taking on OkCupid?

Operating system irony

I was reading this rather interesting article on Windows's horrible old Win32 API, versus Apple's tactic of effectively scrapping MacOS pre-10 in favour of an all-new API and operating system.

When, suddenly, Safari's UI elements started to vanish. I've never seen this before, but I suspect that it's something along the lines of the higher-profile Windows-running-out-of-window-descriptors problem that tends to crop up if you leave XP running for a few weeks.

I blame Eclipse; it's been running for a few days and does tend to cause the Windows problem on Windows.

All was well after a reboot, of course, but it was irritating and disconcerting nonetheless. Bad, naughty Apple!

Sunday, June 1, 2008

Twitter tells all

Here's a disarmingly honest, yet embarassing, post about Twitter's recent brokenness from their official blog.

Choice quote:

Q: Is it true that you only have a single master MySQL server running replication to two slaves, and the architecture doesn’t auto-switch to a hot backup when the master goes down?
A: We currently use one database for writes with multiple slaves for read queries. As many know, replication of MySQL is no easy task, so we've brought in MySQL experts to help us with that immediately. We've also ordered new machines and failover infrastructure to handle emergencies.

Right, okay, it's not super-easy. I mean, your average person who writes crap websites by copying and pasting bits of PHP probably couldn't do it. But, erm, if you're running a quite popular service with stupid amounts of funding, it's probably something you should be able to manage.

And that's without even mentioning partitioning. I really don't understand what their issue is.

The post in question doesn't exactly give me much hope for Twitter's future, quite frankly, especially now that people like Google and Facebook, who both maintain vastly larger IM systems with less trouble, are muscling in on their territory. I bet the VCs who funded the thing are cringing right now...

Reddit's wonderful comment markup

Today, I posted the following as a comment on Reddit:

Note the italics. You see, I tried to say 'mod_lisp'; Reddit evidently thought that the underscore meant that I wanted emphasis. Unfortunate on a site where weird underscored names are likely to be used often, really.

Still, I quite like it; it looks a bit like one of those funny bibles where random words are in italics, doesn't it? Try reading it aloud. MOD-proxy. Makes you sound like a mad preacher.

Oh, also; 285 milliseconds ago. Really? 285 milliseconds since what, exactly? It being submitted? It being put in the database? Who can say, really? And why the high precision? Most people limit themselves to 'seconds ago' at absolute worst...

Aspect Oriented Programming

A while back, I was reading a lovely article by the wonderful Verity Stob (I was searching through her archives) about Aspect Oriented Programming. It's one of these new all-the-rage things, apparently introduced in 1997. Now, looking at it... erm, isn't it a partial implementation of the Common Lisp CLOS :around, :after, :before etc. methods?

What's next? New! JLoop! Format for .NET! COND for COBOL! Destructuring-bind for Delphi!

(Damn, I just Googled, and I'm far from the first person to notice that.)

Giant mushrooms

See? Giant mushroom! It's not one of those flat ones, either, the ones that are supposed to be giant. It's just a freakishly huge normal one.

It was delicious.