Friday, May 28, 2010

Why you shouldn't multitask

Two great articles on why multitasking is not only bad for getting work done, but also damaging to our bodies and brains: here and here (yes, I know one of them is from the Daily Mail, pretend it isn't!). Well worth reading - I'm going to try to stop multitasking as much as possible (no more half-watching TV in the background, reading email/articles, talking, listening to MP3s all at once and so forth).

A couple of choice quotes:

"He found that just being in a situation where you are able to text and email - perhaps sitting at your desk - can knock a whole ten points from your IQ. This is similar to the head-fog caused by losing a night’s sleep."

"An American study reported in the Journal Of Experimental Psychology found that it took students far longer to solve complicated maths problems when they had to switch to other tasks - in fact, they were up to 40 per cent slower.
The same study also found multitasking has a negative physical effect, prompting the release of stress hormones and adrenaline.
This can trigger a vicious cycle, where we work hard at multi-tasking, take longer to get things done, then feel stressed, harried and compelled to multi-task more."

"Using brain-scans he’s found that if we multi-task while studying, the information goes into the striatum, a region of the brain involved in learning new skills, from where it is difficult to retrieve facts and ideas. If we are not distracted, it heads to the hippocampus, a region involved in storing and recalling information."

Thursday, May 20, 2010

Monday, May 17, 2010

Legislators and corporate donations

Was reading the Wikipedia article about a senator with some disturbing views on homosexuality (his office said he "does not hire openly gay staffers due to the possibility of a conflict of agenda"), Israel (that America should base its Israel policy on the text of the Bible, WTF!) and the rights of prisoners (saying he was "outraged by the outrage" over relevations of abuse in Abu Ghraib, and one of nine senators to vote against an act prohibiting "cruel, inhuman or degrading" treatment of individuals in U.S. Government custody).

Then I saw this part. Inhofe is highly sceptical of the climate change, an issue which I'm somewhat undecided about. Fair enough, but surely receiving a $429,950 "donation" from the petroleum industry is a serious conflict of interest?

U.S. senators make huge decisions on bills and treaties, as well as appoint high level government officials and judges. Surely if they can receive donations from any source, then effectively it means the richest corporations and industries can unfairly influence government policy?

Would it not be better (democratically speaking) if there were no such donations and politicians received some fixed amount for their campaigns from government coffers?

Tuesday, May 11, 2010

Automated refactorings... check that they work!

Many modern IDEs provide automatic, context-sensitive refactorings, especially for statically-typed, popular languages like Java. While you should use these wherever it saves time, you should check that they preserve semantics on the code they transform.

For example, in the following test code, Eclipse will offer to "exchange left and right operands for infix expression" when you try a quick fix (cmd-1 on a Mac, ctrl-1 elsewhere) at the '&&' on line 2. The refactoring transforms "(a || b) && c" into "c && a || b".

 boolean a = true, b = true, c = false;
boolean original = (a || b) && c;
boolean swapped = c && a || b;
assertTrue(!original); // ok
assertEquals(original, swapped); // fail


Note that the parentheses have disappeared - at first I assumed that they must therefore be unnecessary and "c && a || b" is therefore equivalent to "c && (a || b)", but figured that the parser should evaluate from left to right (which would produce different results). Being unconvinced one way or the other, I made a simple testcase to verify that both expressions were logically equivalent, which failed.

I'm not sure why Eclipse removed the parentheses, and it doesn't really matter - the point is, keep an eye on what your code transformation utility is doing - don't assume that it must produce correct output. This was one of those cases where the logic bug might not show up for a while, and the existing unit tests wouldn't have caught it, unless I bothered to run a (probably outdated and slow) integration test.

Abandoned locks

When people arrive back to where they locked their bicycle and find it vandalised, they often just abandon them forever, so you find bike racks with a certain percentage of rusting, ruined bikes.
Fair enough but... why do they leave them locked there, if they're never coming back? The locks are sometimes more expensive than the bike (or at least a new wheel). Why not take the lock home? Then a) people can recycle the bike if they want, b) people can use that parking slot and c) the victim at least doesn't have to buy a new lock for €€€ in future!

Saturday, May 08, 2010

Thoughtless showers

(from Wikipedia article on brainstorming)
Some governmental organisations (The Welsh Development Agency and the Department of Enterprise, Trade and Investment in Belfast) have reached the conclusion that the term 'brainstorming' is offensive to people with epilepsy (see political correctness) and have suggested the alternative "thought-showers".

Oh you stupid, stupid people. You hideously moronic, making-reasons-to-get-offended-about-clearly-inoffensive-things obsessive wankers. You waste public tax funds to research what existing terms could be deemed offensive to somebody by reading it in some contrived and obviously unintended context - something which is completely out of your mandate.

Happily, the article continues:
However, research by the National Society for Epilepsy found of those affected by epilepsy questioned, 93% considered the term inoffensive. A specific comment states that changes need not be made since that could promote an undesirable image of epileptics being easily offended.

Here's a tip for (predominantly) UK government-funded organisations: do your job. Don't waste your time and money determining which terms might offend somebody somewhere if viewed in some funny way. That's not your job.

Thursday, May 06, 2010

Vote for against change, or something

Accidentally caught a political ad on BBC between/after snooker the other day, by the DUP/UUP or some-other-wankersUP. The guy went on about how if you let xxx in, they'd let all the Scottish and Welsh nationalists break up "the union", so you should vote him in instead.
Then, immediately after he says his piece, the words "VOTE FOR CHANGE" appear on the screen.

WAT??? Wasn't he just campaigning AGAINST change?

Opera 10.53 on the Mac: Crash central

The latest release builds of Opera for the Mac are atrocious, crashing all the time. All. The. Fucking. Time. And with seemingly random user interactions leading up to the crash, which kind of suggests a race condition, memory allocator or some other effectively random bug, although I have so many damn tabs open, many of which have JS stuff going on in the background, that it's hard to tell.

Another thing which makes it even harder to tell, is the rubbish stack trace provided when it crashes. A major downside to having closed-source software like Opera is that you can neither properly investigate these crashes nor solve them properly. Why not provide at least some kind of assertions or at least filename/line numbering in the stack traces? AFAIK, adding that sort of debug info, even for a shitty language like C++, isn't that big of a performance hit.

And if they're purposely obscuring debug info because Opera is closed source, then WHAT THE FUCK. Nothing "damaging" would be leaked by such information. Blargh!

Sunday, May 02, 2010

Using tor/Vidalia to access BBC iPlayer (etc) outside the UK

There's a decent article explaining how to set up tor/Vidalia to access sites like BBC's iPlayer which only allow connections from certain countries (like England). Not mentioned in the article (although someone added a comment about it) is that now you do not need to manually select exit nodes in the UK - you can specify exitnode countries in your torrc files by putting a two character country code in braces. This makes the process much easier!

I'm running on a Mac with Vidalia, so the setting file (you can find the location of it in the Vidalia settings dialog's advanced tab - but it's probably ~/Library/Vidalia/torrc) ends with:
ExitNodes {GB}
StrictExitNodes 1

Note that the country code is GB and not UK, which a couple of posts/articles online misleadingly state.

There's another problem with the recent Mac builds - the geoip file is in the wrong place, leading to log messages like the following:
[Warning] Failed to open GEOIP file /Applications/Vidalia.app/share/tor/geoip. We've been configured to use (or avoid) nodes in certain countries, and we need GEOIP information to figure out which ones they are.

That was solved like this (from the terminal):
cd /Applications/Vidalia.app/
mkdir -p share/tor/
cp Contents/Resources/geoip share/tor/

Then stop and restart tor.

Update: StrictNodes should now be StrictExitNodes.

Wednesday, April 28, 2010

Opera and the CPU

Opera 10.51 is running on my work PC under Windows Vista, with 2gb RAM and 2.66ghz Core2Duo. There are about 50 open tabs, and one of them is playing a Youtube video. CPU usage is listed in the Task Manager as around 2-3%, with 300mb of physical RAM used.

The most recent Opera (10.10 I think... actually 10.52 was apparently released today, but 10.10 still reports that there are no new updates) on my 2.33ghz C2D Macbook with 2gb RAM in the same configuration except without any Youtube videos playing, uses 10% CPU according to top, and 20-30% with a video playing. And that's with the Flashblock userjs - before it was much higher.
Why? Is it because my PC has a half-decent graphics card and the Macbook doesn't?

Tuesday, April 20, 2010

US government finally admits most piracy estimates are bogus


(link)

A nice, measured treatment of the flaws (especially the common citations of bogus or non-existent work) in pro-IP surveys and studies, usually commissioned by "content industries" (organisations like the MPAA, RIAA, BSA etc) which often contain "specific and alarmist rhetoric".

It's US-centric but has some very sane and generally applicable points, like: "For instance, these studies ignore the obvious points that pirating goods leaves consumers with more disposable income, which is likely spent elsewhere in the economy. Effects on the economy as a whole, then, are terribly speculative and seem more likely to be simply redistributive".

Thursday, April 15, 2010

Distinguishing between "choking" and "panicking"

If you've ever "choked" in any kind of performance (e.g. when you're far ahead in a snooker game and just need this one, simple shot to win, you can do this, just keep your shoulder down and your elbow straight, follow through with the cue and WHAT THE-), then this utterly superb article will have you nodding your head in acknowledgement, understanding and compassion.

Not only does it explain and separate the notions of panicking (reversion to instinct) and choking (loss of instinct) under pressure with dramatic examples, it introduces the interesting form of choke that is "stereotype threat" (which seems to correspond with something I wrote a while ago):
"Steele and others have found stereotype threat at work in any situation where groups are depicted in negative ways. Give a group of qualified women a math test and tell them it will measure their quantitative ability and they'll do much worse than equally skilled men will; present the same test simply as a research tool and they'll do just as well as the men."

Ultimately, we're faced with a Schrodinger-type paradox, whereby external, theoretically irrelevant variables (audience, expectations, prize, etc) influence performance on a task:
"We have to learn that sometimes a poor performance reflects not the innate ability of the performer but the complexion of the audience; and that sometimes a poor test score is the sign not of a poor student but of a good one."

Tuesday, April 13, 2010

Redundant T&C's


(http://www.meteor.ie/terms_and_conditions/billpaymax/)
These fair use conditions are such that a Customer's usage of this tariff plan shall not exceed 45,000 minutes of calls and/or 5,000 texts per month.

1 month = (max) 31 days = 31*24 hours = 31*24*60 = 44,640 minutes.

Since it's physically impossible to exceed 45,000 minutes of calls in any 44,640 minute period... why have that condition in the contract at all?
It's like having a "friends and family" discount with a condition that you can only apply the discount to a maximum of 7 billion people.

Saturday, April 10, 2010

Üter

Was walking to the train station with the childe on the way home from town, going by Leinster House. To prompt the dawdling girl into hurrying up I told her the Garda stationed at the gate would catch her if she was bold, which naturally caused her to sprint away at full pelt. As we passed, the young cop called out: "Ah don't make me run, I'm full of chocolate!"

Good to see a Garda with a sense of humour (and a decent knowledge of Simpsons episodes) :D

Friday, April 09, 2010

Subclipse: "An existing connection was forcibly closed by the remote host"

Subclipse "suddenly" stopped working, so I couldn't commit or synchronise to a svn repository anymore:
RA layer request failed
svn: Commit failed (details follow):
svn: OPTIONS of 'http://big-long-svn-path': Could not read status line: An existing connection was forcibly closed by the remote host.


Maybe a recent update of TortoiseSVN bolloxed it up, who knows... anyway, I worked around it by going to Team->SVN in Eclipse's preferences dialogue and changing the client in the "SVN Interface" section from JavaHL (JNI) to SVNKit (Pure Java). Works so far, although I had to re-enter the username/password which had been stored before.

Wednesday, April 07, 2010

Interregnum



Saw a nicely vandalised sign in the DCU car park today which reminded me (pleasantly) that this is Ireland. Someone had crossed out three letters so it read:

NO SMOKING BEYOND THIS POINT


Chinese character frequencies

After a long time of somewhat naïvely trying to learn Chinese by adding production flashcards for new words (where the front side is a English term with hints to avoid guessing an answer that was correct but not the one on the back side, and the back side is Chinese characters and phonetic pinyin), I realised the task was far too difficult and time-consuming. For each of those cards, I'd write the characters on a graphics tablet and speak them, then flip the card and fail it if I made any mistakes in either the writing or speech. This was needlessly laborious since there was so much redundancy and opportunity to make small mistakes even if most of the answer was correct (writing out 印制电路板 (printed circuit board) many times was extremely tedious and unproductive).

So some reading on Glowing Face Man's blog led me to switch things around a bit, changing my deck so that the only characters I would write (production) were single characters, of which there are still very very many (over 20,000!) but the most common 3,000 account for over 99% of what you'll see in actual modern Chinese. All the other cards changed to recognition, where the front side is the Chinese characters and the back side (what I speak out loud before flipping the card) is phonetic pinyin and a (sometimes rough) English translation. Rather than mess about with Anki's deck format or exporting/modifying/importing, I wrote a dodgy AppleScript program to automate moving through the deck interface and sending keystrokes to cut, paste and rearrange the text... even crappy automation can be better than changing 2,500 cards manually. In fact, it would still be better even if it took the same amount of time, because of the sense of reward that it spurs.

This has helped immensely, reducing the pain and greatly increasing throughput and efficiency. However, learning the characters still takes time - my current plan is to go through the 3,000 most common ones and learn them as production cards before carrying on with sentence recognition cards.

But why 3,000 characters? Why not half or twice that? And which ones?

That's answered here - a computer program can quickly go through a huge corpus of text and produce a sorted listing of characters by frequency. Predictably, the first couple of hundred characters account for a huge fraction of written Chinese: 200 characters will get you 55% understanding (that's "most" Chinese already, heh), 400 will get you 70%, and so on. (Of course, when I say "understanding", I'm ignoring the fact that you need to learn the grammar, idioms and so on, and which of many possible meanings a character will take on in different contexts.)

A quick plot of the numbers provided produces a roughly logarithmic shape, showing diminishing returns (given the roughly constant time required to learn characters):



So it looks like the payoff is small by the time you're hitting around 2,500 characters (98.5%), but it would be nice to say that you only don't know <1% of written Chinese when you hit 3,000 characters (99.2%), and only add more unfamiliar characters to the deck as you encounter them during reading, less and less often.

Saturday, April 03, 2010

Tip of the Tongue learning is bad!

This article came as a surprise - my default assumption was that "working through" this tip of the tongue state until I came upon the answer. The research demonstrates that the time you spend agonising and searching for the answer causes the same thing to happen next time - you're "practicing" the stuck condition.

So the best thing to do is to have a short timeout (10 seconds was better for future remembering than 30 seconds, in the study) whereupon you give up and look up the answer, or make a note to check later or something. Anything but keep struggling until you remember the answer the hard way, since it only facilitates the same wrong mental paths in future.

Two more suggestions...
1. When you struggle with a tip of the tongue thought, whichever way you manage to resolve it, make an entry for it in an SRS program like Mnemosyne or Anki.
For example, the researcher who carried out the study said that she often struggled to remember the word "obsidian". So when you notice that you tend to struggle with this word, you add a flashcard to your SRS with "glassy lava rock" on the front, and "obsidian" on the back. Then when reviewing the cards, if you can't remember the answer after 5-10 seconds, you give it a fail mark. If you remembered it quickly, give it a passing mark. The SRS program will take care of the rest, managing the transition of the properly-learned knowledge into your long-term memory.

2. When you see a friend (or a child!) struggle for a word and you can guess what word it is, put them out of their misery ASAP, and if they say "ahh, I would have got it, why did you tell me?" then explain why!

Tuesday, March 30, 2010

Blinkenwords

Uploaded a small utility called Blinkenwords on RubyForge. It's a simplistic RSVP (rapid serial visual presentation) program which takes input from the clipboard (shortcut: up arrow key) and displays it (shortcut: down arrow key) in vertical chunks. You can change the number of words in each block (from 1-10 at a time) and change the speed in words per minute (shortcuts: -5 wpm => [, +5 wpm => ]).

There's lots of similar programs out there, some implemented as Javascript programs - I only wrote this because none of the ones I tried rendered text as I wanted to see it (i.e. reading in vertical columns, 3 words per column, but not scrolling a 3-line textbox one line at a time). It has a couple of very basic heuristics which insert a slight pause when a group of long words or end of sentence/clause is detected. Also, I took the opportunity to add easy keyboard shortcuts to streamline things (i.e. copy some text, switch to Blinkenwords, press up key (paste), press down key (play text), left/right keys (skip backwards or forwards)).

Whether reading this way helps or hinders speed and comprehension is questionable (see this blog post I wrote a while back on the topic of speed reading), so this is pretty experimental and YMMV (if you can even get it working - had some troubles with source file encodings and a couple of other things). Personally, I find it useful when there's lots of drudgery-reading to be done (e.g. catching up on forums/lengthy emails/news articles), but have problems with difficult, dense texts.




Update: You can download a Windows build of Blinkenwords is here. I used a very impressive program called OCRA to automatically bundle the Ruby interpreter and required libraries into a single 4mb(not enormous) packed executable.

Plink beta 0.60 broken

Spent about 20 minutes wondering why Plink (part of the free PuTTY SSH suite) was acting extremely oddly on my machine - not displaying help when run with no arguments, and completely ignoring PuTTY saved session configurations, and generally not working at all.

On the off-chance, I downloaded the snapshot release of Plink (from the same page) and it worked straight away. Argh! A completely useless buggy version has been the official release since 2007?!

Sunday, March 28, 2010

Polaroid TLU-02241W blank screen oddness

Picked up a Polaroid TLU-02241W LCD flatscreen TV cheapish on eBay a year or so ago, intending to set it up for use with my Atari STe, which didn't happen until today (and is still pretty crappy with the horrendously low quality RF cable - will need to pick up a special 13-or-something pin DIN to SCART cable).
When I received the TV I did a quick test and it seemed fine, but turning it on this time only displayed the Polaroid logo on boot and then the display seemed to power itself off, even though the blue LED showed that it was still "on". Also, it seemed to pick up some analogue broadcast via the RF cable and produced a good sound output.

A quick Google indicated that this model (and many other Polaroid TVs) has serious problems, particularly relating to bad quality electrolytic capacitors in the power/control boards. While watching a series of videos on Youtube showing how to identify and replace the dodgy caps, I went back in and booted the TV again, this time repeatedly hitting the menu button on the remote. Surprisingly, it went from the logo to a blue screen with a working OSD. Problem solved, even after turning the TV off and on without the same button mashing.

Sounds like it will eventually fail, with all the bad reviews, but for now it seems ok. If you're seeing the same symptoms, see if this works.


Update: Problem not solved - came back again the next day and no amount of button mashing will help it. Also, tilting the screen backwards or forwards causes the power LED to flicker and go dim, which is disturbing. Looks like it's a painful capacitor replacement job which is somewhat likely to fail anyway if it turns out to be another problem.

Poor show, Polaroid!

Saturday, March 27, 2010

Phone IQ test failure

*phone rings*
GF: "Hello?"
Caller: "Hi is that Danny?"
GF: "No, I think you've got the wrong number... Ok bye!"

...... *6 or 7 seconds pass... phone rings*
GF: [It's the same number, you talk to her this time]
Me: "Hello?"
Same caller: "Hi, Danny?"
Me: "Eh... no, I'm pretty sure you have the wrong number."
Caller: "Oh right! Sorry."
Me: "Ok, good luck."

...... *5 seconds pass... phone rings*
Me: [Just leave it, answer again if she does it in an hour or so]

*voicemail icon flashes, we check the mailbox*
Same caller: "Hi Danny, this is Anne-Marie here at Classic Cuts, just checking if 1pm on Wednesday is ok with you. Bye!"



Why would someone dial the same number twice and, after being told twice that they've got the wrong number, dial AGAIN and leave a voicemail for "Danny", even though the voicemail greeting clearly identifies as someone other than Danny?
What could possibly explain simultaneously having the ability to dial phone numbers and speak English, while being unable to comprehend the most obvious facts? If you call a number TWICE and are told that it's a wrong number, it's STILL going to be the wrong number the third time.

Top Tip: No amount of redialling the same wrong number will cause Danny to answer the phone.

Sunday, March 21, 2010

Freeline skates... feasible for transport?

After my bike was robbed [smiley face indicating that I'm loudly shouting "cunt!"] in November or so, I figured I'd experiment with alternative forms of transport, hoping to find something more casual and less stealable (i.e. something I don't leave outside my house only locked to itself might be appropriate).

Doing a bit of looking around online, I was intrigued by so-called "Freeline" skates (Wikipedia article appears a bit anaemic), which are very much like the old snakeboard, albeit without the connecting bar between the two plates. To propel yourself forward, rather than kicking off the floor like with skateboards and inline skates, you use your hips, legs, shoulders, arms and whatever you can to swing your body weight around and turn your feet so the skates follow a kind of S-curve.
It's called "non-holonomic motion" and I found it very difficult to understand via textual descriptions which were far superior to this one, so basically you just have to try it until you get the knack, which took me quite a while on the Freelines.
So I picked up a pair on eBay around Christmas (very expensive too, ended up around €110 delivered from the UK).




The initial hurdles


1. Standing on the skates without doing the splits. As you stand on the skates, the axis of movement is just off horizontal so the skates want to slide out to your left and right and you accidentally do Jean-Claude Van Damme sidesplits. Most people, including myself, can't really do that without our legs falling off and exploding, so you quickly learn to control the relative position of the skates with your inner thigh muscles.

2. Rolling across the room with losing your balance. This is presumably the same with any kind of skates/skateboard, but exacerbated by the fact that these behave in a slightly more unexpected way due to the wheels being angled slightly differently: there is a distinct left skate and right skate, so when they're side by side the wheels make a shallow V-shape. Getting used to this means rolling back and forth on flat ground by a railing or low wall so you can pull/push yourself and keep steady with your arms, until eventually you can coast a few metres unaided. Or get a friend to hold one hand and walk back and forth, but that's limited by their patience since it can take a long time.

3. Launching from stop without pushing against a wall. It's difficult to even stand still on the skates - a little bit like on a bicycle. Sometimes you see bicycle couriers with gearless bikes and no freewheeling clutch, stopped at a traffic light (yes, many bicycle couriers actually stop at lights :D) and very slowly inching forwards and backwards on the spot rather than putting their foot down. You can do a similar trick with these by angling your feet into a T-shape, but it takes practice, and actually pushing off from that position to get moving is even more difficult (I tried it about ten times and succeeded once, and awkwardly at that).

Normally, to push off moving from right to left, you put both skates in front of you, then knock the right skate over away from you and step onto it so your toes are also touching the floor. Then you put your weight on those toes and place your left foot on its skate, and push in that direction (without extending too far or your right foot will fall off the skate), pulling the right skate upright with your foot as some of your weight moves onto the left skate.

4. Propelling yourself! After all the other challenges, this one is pretty easy, to begin with anyway. Your feet will probably start to do this automatically in step 2, when you're just trying to roll without falling. Essentially, as one foot is moving in an upwards curve, pushing it forward will increase your speed, and similarly when it's on downwards curve.

Then what?


Well, I only got them to replace my bike, so all the tricks people do with them (mostly pirouettes, riding on one foot and dropping/stomping the second skate, switching etc) are not really relevant. If I ever get supremely good at riding the things, maybe I'll experiment a bit.

Mostly, I want to find out if I can travel any kind of significant distance on them, somewhere between walking and cycling speed. A measly 8km/h for 4km (the distance between my house and DCU) would suit me just fine, but so far I have to stop riding after about 1km (about 10 minutes) because I get pains in the following places: the middle of the soles of my feet, my calf muscles, my instep. By then my thighs basically just run out of energy and I start moving more and more slowly and my form gets sloppy.

I don't know if this is poor general fitness (I'm a lazy, lazy man who likes sitting on his arse with a laptop or playing PS2 for hours on end), or specific muscle conditioning that needs to happen for everyone, or if I'm literally physically incapable of adapting to the skates for longer periods, or even if the skates are just not suited for that kind of travel, especially over the crap, laughable pavement conditions we have here in Dublin (stupid 1 inch deep, 3 inch wide drainage channels between every few houses, cracks and bumps everywhere, corrugated concrete driveways which make skates trundle and vibrate like a broken shopping cart).

That said, if you're going at a reasonable speed you can get over small cracks and drains by leaning slightly onto your back foot - that way the front skate can bounce past the obstacle and even if it gets caught and stops dead, you just hop off since they're not tied to your feet. If your front skate gets caught and most of your weight is on that foot, your balance can be thrown off badly.
And I've seen a couple of videos on Youtube which suggest that people can and do cover more significant distances on them - about 34km in this one.

One recent change that's working much better for me is focusing more on my back foot to push myself forward, rather than trying to drag myself with the front foot which causes it to slip out of position and seems to tire me out. Maybe it's just more efficient for the way I happen to distribute my weight on the skates. Who knows. Even if it turns out to be a complete failure, it'll be a fun failure!

Saturday, March 20, 2010

Snappy?

(trying to reassure scared 2-year old daughter at 3am)

Me: Ok, if there's a monster there, just give it a kick.
Aela: How 'bout YOU kick monster.

Tuesday, March 16, 2010

Irish wit

Saw this today and had to save it... classic lowbrow humour, Dublin-style!

Saturday, February 27, 2010

Stage Irish in "Murder, She Wrote: The Celtic Riddle"

Just watched "Murder, She Wrote: The Celtic Riddle", set in Ireland. I've seen worse imitations of Ireland by American films and TV (notably an episode of the old Mission Impossible where people were terrified of a fake banshee and the carriage of death or something, jeeeeez that was pathetic), but still, it seems at least 75% of the 'Irish' cast were not only American, they seemed to have spent less than 10 minutes practicing their Irish accents... the better ones manage to mix some kind of Irish accent in with English, Scottish and a bit of a Russian twinge. The worse ones (e.g. the spiky-haired mechanic modelling his look after Johnny Rotten who sounds more Scandinavian than anything, and the blonde male cop) make a complete bollox of it, or just give up completely. I guess almost all the dialogue scenes were filmed in the States? Otherwise there's really no excuse for hiring Americans with bad stage Irish accents to play Irish characters - if it was filmed in Ireland, why would you ship American actors over to do a crappy job?

Can you imagine an Irish film crew flying to the USA and bringing Irish actors over to play Americans, with horrible cheesy accents that don't convince anyone?

Apart from the actors, there are cars you don't see here (e.g. Chevrolet police cars or the big Ford van which tries to drive someone off the road) and obviously fake number plates (with non-existent county codes)... which is to be expected I guess. Plenty of modern films and TV series simply do without number plates altogether (Fringe, IIRC), which kind of spoils the realism IMO.

Some stupid did not do the research mistakes:
  • Who... WHO refers to the Irish language as "the Gaelic language"? Christ on a bike, do some research!

  • The same supposedly Irish character also failed to recognise Ogham script (which is fairly distinctive) but then later seemed to know about its history... which is it - does she know about it or not? Be consistent, damnit!

  • A letterhead addressed to "Dublin BT238479, Ireland" or similar - Ireland is not in the UK and we don't use UK postcodes!! WTF

Other than that, it was basically an extra-long episode of Murder She Wrote. It kind of petered out a bit, perhaps because I was getting distracted by the silly errors, or perhaps the 45-minute format worked better for the series?

Replacing the electromagnetic clutch brushes on a Micra CVT

Soon after buying my first automatic transmission car, a ten year old Nissan Micra (K11) with the CVT gearbox, I found that the carbon brushes which supply power to the electromagnetic clutch tend to wear down.

The clutch operates (as far as my limited understanding goes) by passing a current through some kind of magnetic powder (maybe just iron filings? Anyone know what this is?) which fills the gap between the driving (engine-side) and driven (gearbox/wheels side) plates. When the engine is at idle, no (or very little) current is passed through the powder so the engine spins without transferring force to the driven side.

As you hit the throttle and engine speed increases, the current passed through the powder is raised and the powder becomes magnetised, sticking together more strongly and transferring more of the rotational force from the engine to the wheels.

The electrical current is supplied by a pair of carbon brushes which rest against turning discs (I think they're called slip rings, which just slot onto a splined axle), since you can't just stick a wire into something that's constantly spinning. After a while, both the brushes and the slip rings start to wear down - hopefully the brushes more and the rings less, since the brushes are easy to replace while the slip rings are probably almost impossible (i.e. cheaper to buy a new car than to get the clutch out, open it up, replace a part, put it back together and re-install it in the car, argh). When the brushes wear down, springs in the brush holder push them further out until a certain limit, they either lose contact completely or periodically slip out of contact briefly, triggering the "N-CVT" warning light on the dashboard. As they wear out of reach of the clutch wheel/slip disc arcing can occur which is apparently a bad thing, too.

So anyway, my Micra had started to get sluggish, needing more revs than before, and I figured it might be the clutch brushes. I checked the web for similar problems and solutions and found a LOT of problems and NO solution other than buy a new brush holder/new gearbox/new car.

Nissan refused to talk to me on the phone, telling me to call local dealers instead. Two separate dealers quoted me a laughable €218 for the whole brush holder assembly, which is apparently all they will give you short of an entire new clutch (again, more than the cost of the car).

This seemed a lot of money when it was just the carbon brushes which had worn down. So I took the brush holder assembly out anyway.

Where is it? Here, on the front of the transmission bell housing:
(edit, new pic to help locate it)



You can disconnect the power plug by pressing a tab on the left side of the upper half and pulling it upwards. Blurry closeup of power socket:


The hole down into the clutch after removing the brush holder. Looks... not so great:


And the brush holder after removal:


Knackered. Right down to a stub on the engine-side brush and while not so bad on the driven side, the spring was jammed up with cruddy carbon deposits and failing to push the brush out to maintain contact with the slip ring.

So I disassembled and cleaned it (on the left is another brush from a mk3 Ford Fiesta's broken alternator... similar!):


The brushes looked so similar to what you'd find in an alternator, serving the same purpose anyway, that I went to a shop ("Electro Maintenance" in Baldoyle) to find something suitable. A guy came out of the back room and took the disassembled holder away before coming back with some Delco alternator brushes, for which he charged a pretty reasonable €7. He also suggested that I snip off the old brushes, leaving just the bit of wire that was somehow attached to the metal mount, and then solder the copper wire of the new brush on top of that. Before doing this, we threaded the old black plastic insulation piece onto the wire, fed the spring through and cut off the excess wire (to stop the brush from falling out the end of the holder!).



Soldering the new wire onto the bit of old wire (no idea how the old wire is attached to the metal so nicely but still conducting current):


And reassembled after soldering:




Note the slight slant in the brush faces where they contact the clutch wheel/slip rings - the longer edge is on the bottom and the shorter edge on the top (where the power socket is pointing). This is what the wear pattern in the old brushes looked like, so I oriented the new ones in the same way (if I'd bought brushes without a slanted edge, I might have used sandpaper or emery cloth to file one in, since it probably helps them fit into the clutch properly).

Also, if you have a multimeter, check the continuity from pin to brush for both pairs. Each pin should form a circuit to the brush on the same side.

After installing the brush holder (much easier than removing it, bizarrely - it took about 5 minutes of gently sliding it around and twisting to get it out, after removing the battery and its tray* and moving a relay box out of the way), I sat in the car and gingerly started the engine. It fired up, and I listened for any horrible scraping noises and watched the N-CVT lamp on the dashboard, which didn't light up. Knocked off the engine and did a self-test of the gearbox (put it in D, ignition on but don't start engine, brake on, accelerator on, cycle Ds-D-N-R-P, accelerator off, brake off, start engine) which reported okayness (N-CVT indicator flashes one long, then seven short and repeats).

* Note: I recently checked the brushes again and was able to get the holder out without removing the battery or its tray. If you have the right screwdriver or a ratchet with screwdriver bit, you can get it out in less than 10 mins! I did have to lie under the car and ask my SO to hold the ratchet end in place though.

I carefully reversed and turned from the cramped shed into the cramped laneway and drove home. Feels a bit more responsive so far but I was literally a 2 minute drive from my house so no chance to get it up to speed.

Hopefully the fix is ok and won't trash the clutch or wear down within 2 weeks - time will tell. (It'd be pretty funny if it completely failed within a couple of days :/)

Replacement from Nissan: €218
DIY hack job with alternator brushes: €7 + time (one hour if you're smart, 4 hours messing about if you're me).


Hope this helps anyone in the same boat!

Update 26/10/2011: it worked fine for over a year and a half, until...

...Until I stupidly drove through at least a foot of water in a flood on Monday (yeah, who'd have thought it might rain in Ireland). This seemed to short out the coil and some kind of safety interlock started switching it off despite my repeated attempts to stop and restart it. Eventually after an hour or so hanging around near where I'd parked the dying car, it managed to get going again, albeit warning me that the clutch's coil circuit was shorting (IIRC, the fourth flash during the self-test mentioned above).

If I'm lucky, either the brushes have simply worn down, or a bit of trapped water is occasionally making a short in the connector. If not, water may have leaked into the clutch and contaminated the powder or something, I don't know. That hole is near the bottom of the engine, so for all I know the bell housing has a pool of water in it, bathing the clutch and promising rust or some other disaster.
I wonder if it's the same type of clutch used in the older Subaru Justy - it looks like they can lose their powder, which would not be good.

30/10/2011
Finally got round to removing it, which just took a couple of minutes this time - amazing how much easier some jobs are in direct sunlight rather than in a dark garage. Last time I removed the battery and its tray and pulled a bunch of stuff out of the way, needlessly.

Turned out the brushes were hardly worn at all, but they were very wet. When I replaced them last year, the generic alternator brushes may have been slightly too long for the available space, and I was afraid to break something so didn't tighten the brush holder's bolts nearly enough, leaving a gap large enough for water to pour in as I foolishly rammed the car through floodwater.
Might be a good idea to file down the brushes a tad before installing them, enough to push the brush holder absolutely flush in its socket and screw it in tight enough to prevent water entering the clutch housing.

Friday, February 12, 2010

What is the proposer's occupation?

Looking up insurance quotes on a few different sites, I found a funny form on Britton Insurance's website, which asks among other things, "What is the proposer's occupation?".

The choice available is quite amazing - here are some examples:

Bacon Curer, Baggage Handler, Bailiff, Baker, Bakery Assistant, Bakery Manager, Bakery Operative, Balloonist, ... Skipper, Slater, Smallholder, ... Stock Controller, Stock Manager, Stockman, Stocktaker, Stockbroker, Stone Cutter, Stone Sawyer, Stonemason, ... Sub-postmistress, ... Tachograph Analyst, Tacker, Tailor, Tank Farm Operative (WTF?), Tanker Driver, Tanner, Tarmaccer, Tarot Reader/Palmistry Expert


I'd like to put down balloonist, but it would be a wishful lie.

Saturday, February 06, 2010

Sign language on kids' TV

There's an episode on CBBC of "Lazytown", a kids' show from Iceland of the "eating fruit and getting enough sleep gives me the energy to be a muscular annoying man!" variety. BBC have a woman (uncredited) overlayed like a subtitles track, only she's conveying the speech and sounds with sign language.

The interesting thing is it appears to have been done entirely in one take - I haven't been watching all the time, but had my eye on it for about half the programme and didn't notice any fadeouts/cuts. Signing a whole episode of a somewhat hyperactive children's show in one go, conveying the tone of voice with body language and doing a couple of songs on the way - that is damn impressive!

Tuesday, February 02, 2010

Toyota/Lexus stuck accelerator crash

Saw this article about an extremely dangerous suddenly-stuck-on-accelerator problem in the Lexus ES 350. The awful headlined crash in the USA involved a driver realising his accelerator was stuck on and the car speeding out of control toward a busy intersection, so he called 911 and prayed that they would be ok, which they weren't.

This is tragic, but surely in this situation, you would try the following things:

1. Knock it into neutral/reverse
2. Handbrake
3. Stamp on the footbrake anyway, maybe it actually does work
4. TURN THE ENGINE OFF so it doesn't keep accelerating at least

Rather than these things:

1. Call the police and expect them to somehow help
2. Pray
3. Nothing else

Certainly, Toyota/Lexus is at fault for allowing a car out to market with a severe and dangerous problem which was reported and dismissed many times, but that doesn't help this guy and the other three people who died in the crash - surely there was a better option to avert or mitigate a high-speed collision than dialling 911 and praying that everything would be ok. The fact that the driver was an off-duty highway patrol officer just makes the outcome even more incomprehensible.

Why didn't they knock it out of gear and/or turn off the engine? How is calling 911 going to help avert a crash that is seconds away?

Sunday, January 17, 2010

installing rsdl on OS X i386 via rubygems

I was getting this problem trying to install rsdl, a wrapper program for ruby which initialises SDL/Cocoa:

Jehannum:SDL-1.2.14 oisin$ sudo gem install rsdl
Building native extensions. This could take a while...
ERROR: Error installing rsdl:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for ruby_sysinit()... no
checking for ruby_run_node()... no
creating Makefile
creating rsdl.c

make
gcc -arch ppc -arch i386 -Os -pipe -fno-common -I"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0" -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -c rsdl.c
gcc rsdl.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch ppc -arch i386 -lruby -lpthread -ldl -lm -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -o rsdl
ld: warning in /usr/local/lib/libSDLmain.a, file is not of required architecture
ld: warning in /usr/local/lib/libSDL.dylib, file is not of required architecture
Undefined symbols for architecture ppc:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccEkUyfQ.out (No such file or directory)
make: *** [rsdl] Error 1


The solution was to add an ARCHFLAGS environment variable which stops it trying to build a ppc version:
Jehannum:SDL-1.2.14 oisin$ sudo env ARCHFLAGS='-arch i386' gem install rsdl
Building native extensions. This could take a while...
Successfully installed rsdl-0.1.2
1 gem installed
Installing ri documentation for rsdl-0.1.2...
File not found: lib

The "File not found" message at the end doesn't seem to matter.

It's handy that SDL, SDL_image and SDL_gfx seem to build and install the UNIX way (./configure && make && sudo make install) with no problems - at first I was worried by the lack of a .pkg installer for SDL but it seems to work fine so far. Cool!

Tuesday, January 12, 2010

Schneier: "Stop the Panic on Air Security"

A good article by Bruce Schneier on the tendency for overreaction to dramatic and rare events, such as hijackings and attempted underwear bombings, while ignoring far more common dangers which don't make the news headlines.

We're doing these things even though this particular plot was chosen precisely because we weren't screening for it; future al Qaeda attacks rarely look like past attacks; and the terrorist threat is far broader than attacks against airplanes.

We're doing these things even though airplane terrorism is incredibly rare, the risk is no greater today than it was in previous decades, the taxi to the airport is still more dangerous than the flight, and ten times as many Americans are killed by lightning as by terrorists.
...
We can see the effects of this all the time. We fear being murdered, kidnapped, raped and assaulted by strangers, when it's far more likely that the perpetrator of such offenses is a relative or a friend. We fear school shootings, even though a school is almost always the safest place a child can be. We worry about shark attacks instead of fatal dog or pig attacks -- both far more common. In the U.S., over 38,000 people die each year in car crashes; that's as many deaths as 9/11 each and every month, year after year.


Nothing he hasn't really said before, but well stated and all the more significant these days, given the hilarious ban on liquids and the ridiculous fiasco of Newark Airport being temporarily shut down and causing hours of delays because an innocent Chinese student crossed a laughable rope barrier to give his girlfriend a goodbye kiss.
Of course, instead of admitting that security was basically a joke (on the one hand, you're made to take off your shoes, be frisked, have your luggage X-rayed and possibly have someone examine your bits in a full-body scanner, then you enter the 'secure' area which is separated from the 'insecure' area by a cinema-waiting-line rope) and that they overreacted badly, New Jersey Sen. Frank Lautenberg stated that "what he did was a terrible injustice" to the thousands of people who were inconvenienced. Even though it was what airport security did that caused the inconvenience...

Let's stop the panic!

Thursday, January 07, 2010

No Nokia PC Suite on the Mac? Try Gammu!

With almost every mobile device I've had, the amount of freedom to run arbitrary software (especially software you've written yourself) has been low. Obviously needlessly low, too.
I once bought a USB datacable for my old Sagem X-5 to upload ringtones and Java programs without having to upload them to a webserver and download them with the Sagem over WAP/GPRS. I got ringtones working, but it turned out that it was impossible to upload Java programs over the cable.
Why? Well, there's no apparent technical reason for it - but it works out in the operator's favour, forcing you to download (from yourself) over their very expensive data service - at that time, it cost €0.02 per kilobyte with Meteor, which works out at €20.48 per megabyte, a shocking waste of money!

Similarly, when I bought my Nokia 6230i back in 2006, I soon discovered that while it could download Java applications with no problem, it was impossible to install them via its MMC card. The JAR/JAD would appear in its filesystem browser, but it would declare it an "unrecognised format".
Nokia did, however, release a package called the Nokia PC Suite, which was a reasonably comprehensive tool for doing lots of different things with the phone, including the installing of Java programs. And it worked via data cable and Bluetooth. Great!

Except that now, I don't have a Windows PC (at least, one with Bluetooth or a data cable). And it only runs on Windows (surprise!). My Macbook has built-in Bluetooth and can send files via the built in utilities, but the same "unrecognised format" issue pops up.

So that was the end of my frustrating search, until yesterday... enter Gammu!

This open-source program comes with a host of features for working with different types of phones, including my 6230i, and I was able to upload and install a Java application to the phone with Gammu over Bluetooth, finally!
What's the catch? Well... Gammu itself is a command-line tool so installing a program looks like:

Jehannum:Downloads oisin$ gammu nokiaaddfile Application Bart1.4
[snip debug warnings]
Searching for phone folder: *********
Information: Declared JAR file size is different than real. Fixed by Gammu.
Adding "Bart" version created by Bart
Writing JAD file: 100 percent
Writing JAR file: 100 percent


And Gammu uses a textual configuration file - mine looks something like:

Jehannum:~ oisin$ cat .gammurc
[gammu]

port = 00:16:BC:xx:xx:xx
model = 6230i
connection = bluerfphonet
synchronizetime = no
logfile = /Users/oisin/gammu.log
logformat = textall
use_locking = no


The port value can be found in Apple's "Bluetooth Explorer" in Devices->Show Device Discovery (cmd-D), under your phone's name (but replace the hyphens with colons).

Also you have to build the program from source which requires installing CMake and MySQL, but these have automated installers which caused no brainache. Getting Bluetooth to work required a small fix to one of the build scripts, but this has since been fixed so the latest version should work out-of-box.

So, if you have a Mac and a phone which requires Windows-only software to install applications, try Gammu.


. o O ( Now if I could only find a simple way to upload programs of my choosing to my iPod Touch without having to jailbreak the thing or pay Apple, again :/)

Tuesday, December 29, 2009

Re: "China Blames Online Games for Drugs, Murder, Teen Pregnancy"

Reposting for posterity here a comment I made on this article in response to some guy asking "When did your children were listening to Chaikovskiy or Shopen LAST TIME?" - implying that it's a positive and appropriate step for China to dictate how the people should entertain themselves because of some cultural degeneration that has taken place in the Western world due to our poor choice in music, computer games or whatever else:

@Kolyan:

There would be no Tchaikovsky, Chopin, Scriabin, Dave Brubeck, Debussy, Yoko Kanno, Freddie Mercury or other clever and creative composers if governments decided and enforced what everybody should enjoy or create.

People DID commit murders, take drugs, get pregnant as teens and of course, piss their lives away, long before the age of digital computers. There were stupid, psychotic and unwise people among us throughout history - if you want to improve that then improve the education system (rather than making it a soulless rat-race) and improve social conditions (not least, healthy freedom of speech).

And re: family life being damaged - are you kidding? The internet has served to bring people closer together that may have otherwise grown apart. I chat to cousins, aunts and uncles on Facebook who live in other countries and who I might not otherwise see for years.

Sure, people get sucked into rubbish games and waste their lives, but this is a fault of the person, not the games (or pornography or whatever you want to blame). Perhaps without the social outlet of gaming, some of these people would end up addicted to heroin or committing suicide - what good could banning online gaming really do? At least these people have some sense of community and friendship.

China, stop micromanaging the people and trying to tell them how they should (or should not) entertain themselves. It's absolutely none of your business, and a very inappropriate step into personal liberties.

Monday, December 07, 2009

PicArt

This video forced me to leave the room and crouch in the kitchen, doubled up and crying with laughter, for about 3 minutes. Even thinking about it is threatening to set me off again...

Wednesday, December 02, 2009

Desk Topography

The general arrangement of my desk:
  • The z-axis (which passes through the gravitational centre of the earth) is ordered such that, on average, higher items are more recent. Papers at the bottom of the z-axis are sometimes partially chemically bonded with the desk. (That is to say, new shit is randomly piled upon old shit which is stuck to an eight month-old coffee stain)

  • Although the x-/y-axis positions of items are extremely noisy, there is a tendency for locality to correspond with the degree to which papers are topically related. (This means that everything is scattered all over the place, except for things that I had piled together for some unknown reason some months ago)

  • Rubbish follows a Gaussian distribution from the central boundary of a disc 10cm from the keyboard and ending at arm's reach... (This implies that the rubbish bin is slightly out of arm's reach and is thus underutilised)

Monday, November 23, 2009

IDLE & Python 2.6 escaping mishap

Here's an odd one that can catch out a newbie (well, me, at least):

x = '\x0'


Do that in the interpreter and it'll tell you "ValueError: invalid \x escape"... put it in a source file and execute it with F5 and nothing will happen, other than focus switching to the interpreter window. No message, no nothing. Had to do a binary(ish) search, commenting out the whole program minus one print statement and checking that it runs, then commenting out about half the file and homing in on the buggy line that way - I was writing a unit test which checked that the output of a particular function was a zero byte (the most trivial case of about 12 tests).

When you do it in the IDLE/Python 3.1 bundle, you get a notification as expected, but not in the 2.6 version for the Mac. Pity pygame doesn't work in Python 3 yet.

Sunday, November 15, 2009

Children as a hardware stress test

Phoned Medion because their data CD for this el cheapo car GPS system was just ejecting after ~10 seconds when I put it in my Macbook. The guy says "well it's not designed to run on Apple computers, we can't support them. You'll need to use a Windows machine."
So I says "wtf do you mean? All the computer is for, is to transfer map files from the CD onto an SD card which goes in the device. If it's not running any software on the computer then why would it matter what operating system I had?" and that was pretty much where I lost him. Figured it was some kind of completely braindead and needless copy protection that failed on OS X machines and went looking for torrents... unsuccessfully.

Then stuck in a DVD today and the same thing happened - doh! - just the disk getting pulled in, faint clicking for 10 seconds then the disk ejects. I tilt the laptop and hear something sliding about in the drive. Shit! Did some belt or mounting snap off?
Checking prices on eBay for a new 'superdrive' - cheapest is about €45 with postage, not bad but ouch, and opening the machine to swap DVD drives is a slog.
Maybe I can at least shake the broken object out of the drive and see if it's really screwed or maybe a fragment of a broken CD or something...
Hold the laptop with the DVD slot facing the floor, tap gently for 20 seconds, poke around in the slot with a playing card and what comes out?

A poxy 2c coin. Children FTWTF. Works now tho!

Sunday, November 08, 2009

Funny Chinese expression of the [arbitrary time period]


显怀 (xiǎnhuái): To look pregnant / Obviously pregnant

Thursday, October 29, 2009

An entertaining exchange between Irish Youtubers

In a video of a Garda car apparently being burnt out while the Gardaí were busy raiding a house in Limerick (I guess?), a heated and very entertaining exchange on the subject of dole spongers and caviar developed. This is the kind of ridiculous but witty banter that I'd miss if I left Ireland:

chris2009xx (2 weeks ago) +3
sound like traveller dole skangers, we have to pay for your dole which you use to buy hash then you have loads of children for the child benefit and retire at 15 and go into fas centres then when 18 comes you sponge the dole then have children and the trend continues. you scum get council houses and wreck them we pay for them to be done up then. then you claim footwear allowance and use the money to buy more hash, then we pay to feed you in prison, you even get free runners/trainer shoes there

eiregc09 (2 days ago) +1
and you know all about it dont ye while your sitting at home drinkin your glass of champaigne and eating your caviar you sound like a right fuckin guard thinkin your all posh ye fuckin ignorant stuck up cunt im not even from limerick and its none of your business anyway proctor do ye know who proctor is remember that fool out of police academy the film

richieobrien1 (2 weeks ago)
u wouldnt want to be talking bout me..im working full time since i left school at 18..ive a good job too..

gobsiter (1 week ago) +1
dealing is not a job

Tuesday, October 20, 2009

Nice latency

Tracing route to www.l.google.com [66.102.9.147]
over a maximum of 30 hops:

1 1 ms <1 ms <1 ms 136.206.48.254
2 1 ms <1 ms <1 ms 136.206.13.254
3 2 ms 1 ms 1 ms 193.1.244.37
4 1 ms 10 ms 1 ms inex.google.com [193.242.111.57]
5 1 ms 1 ms 1 ms 72.14.239.132
6 1 ms 1 ms 1 ms 72.14.232.235
7 3 ms 2 ms 2 ms 64.233.174.18
8 1 ms 2 ms 2 ms lm-in-f147.1e100.net [66.102.9.147]

Trace complete.


Pinging boards.ie [89.234.66.107] with 32 bytes of data:
Reply from 89.234.66.107: bytes=32 time=3ms TTL=60
Reply from 89.234.66.107: bytes=32 time=2ms TTL=60
Reply from 89.234.66.107: bytes=32 time=3ms TTL=60
Reply from 89.234.66.107: bytes=32 time=3ms TTL=60


...Ok, it makes no noticeable difference that latency is 20ms lower here than at home, but it looks cool!

Wednesday, September 09, 2009

Speed reading: can we significantly increase reading rate without losing comprehension?

No.

There is no quick fix, according to current scientific evidence. The popular techniques suggested by speed reading books (e.g. elimination of subvocalisation, avoiding regressions or "back-skipping" by force of will or by hiding "already read" words with card, trying to take in more words per fixation and reducing the number of fixations) all do more harm than good, either reducing comprehension, reading rate or both.

Important tip: look for peer-reviewed scientific studies on the subject before accepting the claims of commercial pseudo-scientific books. Also, study skills websites often don't do this, and can publish suggestions which are actually harmful.

Friday, August 28, 2009

Three annoying things

1. TV advertisements that say things like "eliminates up to 100% of dandruff flakes" or "up to 100% grey coverage" - typically ads for shampoo and the like.
Like, I can defeat up to 100% of ninjas by doing nothing, since "up to 100% of ninjas" means "x ninjas, where 0 <= x <= the total number of ninjas". A building could be up to 100% demolished by throwing a large rock at it, which is to say that it will be only very slightly damaged. Saying that a shampoo removes "up to" 100% of dandruff is saying nothing.
Stupid wishy-washy meaningless-statement-making assholes.

2. People who stand at a pedestrian crossing but don't hit the button, presumably on the assumption that they will automatically get a green light and the button does nothing but tell them to wait for the scheduled light change which would have happened anyway (which is only sometimes the case).

There are some crossroads where the pattern is like:
(A) west turning south cars only (and pedestrians crossing between NW/NE or NE/SE if the button was hit in the previous A, B or C),
(B) east and west cars only,
(C) north and south cars only.

If a pedestrian hits the light switch on the northwest, northeast or southeast corner, then they can cross at the next A.
What happens about 20% of the time, is that one or two plonkers stand at one of the lights and wait until A, upon which they still don't get a signal to cross because they never hit the button. Then they frown in confusion and eventually jaywalk at the next opportunity, cursing the system. Or you arrive at the crossing, mash the button and grimace at them, having watched them stand there like a muppet for about 30 seconds and miss the crossing timeslot.
Dumb. If you're standing in front of the button, just fucking hit it.

3. People who cross a road and casually hit the button as they walk past, even though they're not going to wait for a crossing signal. Instead, cars and cyclists have to stop and wait uselessly for nobody to cross, since the guy who hit the button is already out of sight, back on the pavement.
If you're going to just cross the road anyway, DON'T hit the fucking button!

Thursday, August 20, 2009

Software patents: broad, stifling and unfair

(posted comment on ZDNet article "Examine the patent that made selling Microsoft Word a crime")

The problem with patenting processes or algorithms - not necessarily even in computer software - is that we end up with extremely broad or obvious patents whose sole purpose is to allow the patent holder to eventually sue large companies and get (obscenely) rich, and not to safeguard investment in new inventions and products as was originally intended.

If you write a program using simple common sense and happen to "re-invent" something that's patented, that's a strong hint that the patent is too general or obvious.

This is why we have ridiculous patents on "not having to click on a control for it to display dynamic content in a web browser" (Eolas), or "method of swinging on a swing" (United States Patent 6368227, which in itself should be evidence that the US patent system needs to be destroyed and rebuilt by people with an IQ above 30).

What's next? "A method of lifting heavy objects by using one's legs, not one's back"? Or, following Eolas's lead, "not having to say 'abracadabra' and turn around three times before turning on a computer"?
And how is $280m a reasonable amount of "damages", when i4i has produced nothing that could be damaged? Where is their competing product which is suffering in the marketplace due to competition with the patent-infringing Office?

And to those arguing that Microsoft/everyone should do their "due diligence" by researching patents, have you ever written a computer program? Can you really imagine searching for patents that might cover every single aspect of the code you're writing?
Programmers produce code that solves the problems at hand. They do not think "hmm, maybe what we need is to store some text separately to where the formatting information for that text is stored. That makes sense. Better check if that is software-patented!"
Imagine trying to speak to someone while having to look up every individual word you use to check that it's not in some arbitrary blacklist. It would be an unproductive nightmare.
And on top of that, patent search is extremely difficult because they're often worded in an inconsistent, generic or confusing way.

Software patents do nothing good for anybody other than patent trolls and lawyers. For everyone else in the world, they only hold back science and progress. Get rid of software patents in the US now, and keep them out of the EU too.

Wednesday, August 19, 2009

OS X panics

A recent kernel panic on my Macbook looks quite familiar - I think it's been happening now and then since I got the machine in late 2007. This time, and probably most of the other times, it was showing video on Youtube, which suggests there might be a bug in the video driver (or err... the video card :/), but there's not much information to base a confident guess on.

The crash report looks like:
Tue Aug 18 17:58:36 2009
panic(cpu 1 caller 0x00194B15): "pmap_flush_tlbs() timeout: "
"cpu(s) failing to respond to interrupts, pmap=0x46c7ae0 cpus_to_respond=0x1"
@/SourceCache/xnu/xnu-1228.12.14/osfmk/i386/pmap.c:4582
Backtrace (CPU 1), Frame : Return Address (4 potential args on stack)
0x343f3be8 : 0x12b4c6 (0x45ec20 0x343f3c1c 0x13355c 0x0)
0x343f3c38 : 0x194b15 (0x465018 0x46c7ae0 0x1 0x195234)
0x343f3ca8 : 0x197eb4 (0x46c7ae0 0x26b46000 0x0 0x0)
0x343f3d88 : 0x16087d (0x46c7ae0 0x26b46000 0x0 0x71f9)
0x343f3de8 : 0x163170 (0x1c67c40 0x46c7ae0 0x26b46000 0x0)
0x343f3f58 : 0x1ab39c (0x4f7983c 0x26b46000 0x0 0x3)
0x343f3fc8 : 0x1a15fd (0x68b8900 0x0 0x1a40b5 0x68b8900)
No mapping exists for frame pointer
Backtrace terminated-invalid frame pointer 0xbfff7e88

BSD process name corresponding to current thread: firefox-bin

Mac OS version:
9J61

Kernel version:
Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009;
root:xnu-1228.12.14~1/RELEASE_I386
System model name: MacBook2,1 (Mac-F4208CAA)

System uptime in nanoseconds: 810215756731744


A quick Google turned up mostly useless assertions on forums like "it's probably a faulty logic board or memory stick - reboot into single user mode and run memtest". In my experience, when memory goes bad, it's much more impressive than an occasional (something like once every month or two) panic. Searching a bit more carefully, I turned up some kernel source code released by Apple (cool!):

xnu-1228/osfmk/i386/pmap.c -> pmap_flush_tlbs(...)

if (cpus_to_signal) {
deadline = mach_absolute_time() + LockTimeOut;
/*
* Wait for those other cpus to acknowledge
*/
for (cpu = 0, cpu_bit = 1; cpu < real_ncpus; cpu++, cpu_bit <<= 1) {
while ((cpus_to_signal & cpu_bit) != 0) {
if (!cpu_datap(cpu)->cpu_running ||
cpu_datap(cpu)->cpu_tlb_invalid == FALSE ||
!CPU_CR3_IS_ACTIVE(cpu)) {
cpus_to_signal &= ~cpu_bit;
break;
}
if (mach_absolute_time() > deadline) {
force_immediate_debugger_NMI = TRUE;
panic("pmap_flush_tlbs() timeout: "
"cpu %d failing to respond to interrupts, pmap=%p cpus_to_signal=%lx",
cpu, pmap, cpus_to_signal);
}
cpu_pause();
}
if (cpus_to_signal == 0)
break;
}
}


I won't make any pretense at understanding most of this, but it looks like, for that panic to occur, the condition (!cpu_datap(cpu)->cpu_running || cpu_datap(cpu)->cpu_tlb_invalid == FALSE || !CPU_CR3_IS_ACTIVE(cpu)) is never met, so we keep waiting and checking until our deadline passes.
The timeout appears to be 12500000 mach time units, which apparently are equivalent to nanoseconds on my laptop - so 0.0125s, or 1/80th of a second.

So if we revisit that condition, we can assume that we get to a stage where, for at least 1/80th of a second, the inverse of the test is always true (or happens to be, every time it's checked - could be a race condition I suppose?): (cpu_running && cpu_tlb_invalid && CPU_CR3_IS_ACTIVE(cpu))...

I'm too lazy to look up what CPU_CR3_IS_ACTIVE(cpu) (a macro that expands to ("(cpu_datap(cpu)->cpu_active_cr3 & 1) == 0)") signifies, but the whole CR3 mess is some kind of i386 control register for dealing with virtual memory paging. Beyond these most basic observations, I'm pretty clueless about the problem, so would love to hear from anyone if you have any ideas.

Monday, May 18, 2009

Torrenting on the Mac

After a few years of using Azureus (or Vuze now) without major problems other than kind of large CPU and especially RAM usage, a friend suggested I give µTorrent a try since they now have Mac builds. I did, and after the first two builds which suffered from a CPU hogging bug, was surprised to find version 0.9.1.2 running smoothly for a couple of days, using about 2-5% CPU and 22MB of RAM with DHT, Peer Exchange and outgoing encryption enabled (before switching these on, it was taking about 0.6% CPU!).

That's pretty impressive IMO - previous BT clients I'd tried (Tomato, Transmission and the built in one in the Opera web browser) either seemed a bit cut-down and/or just didn't seem to download at the same speeds Azureus had achieved. So far µTorrent has worked very quickly, and has the further benefit for me of reliably working with pasted torrent URLs - Azureus almost always times out when downloading .torrent files via HTTP (no idea why; maybe a Java thing, but it happened on both my Mac and Linux boxes).

The only cons so far are that it's not open source, and that there's no Linux build... but I don't use my Linux box these days anyway. Give it a try if you're exploring BT clients on the Mac!

Friday, April 24, 2009

media filler: 'offensive' Baby Shaker

(see CNN article)
The 'Baby Shaker' app is about as stupid as the 'controversy' over such a meaningless little thing.

Typical media nonsense... 'outcry' from politically correct whingers, so what? There are always people who will get offended at something.
It's equivalent to a teenager's poorly-scrawled graffiti - offensive to anyone who WANTS to get offended, but otherwise completely trivial.

There are people being tortured and murdered, drink drivers doing hit'n'runs out there, and THIS is what makes the news? That's just silly.

Also silly is that Apple (and others in similar 'outcry' situations, like Youtube) respond so quickly and arbitrarily to take down applications like this. Not specifically in this case, because it is clearly a stupid and tasteless program, but in general when hosting providers like Youtube, Apple and some web hosts receive complaints about the 'offensive nature' of some content and they immediately (and perhaps without discussion with the author) take down the content - again, there are always going to be people out there who like to get offended at anything.
What it boils down to is that sometimes free expression suffers due to politically correct or simply malevolent, loud complainers.
Indeed, in probably all hosting provider contracts, they specifically assert the right to delete any content deemed offensive. How can this work, though, if offensiveness is in the eye of the beholder, which it most certainly is?

Friday, March 06, 2009

Lexmark X4550 wireless woes with OS X, part DEUX

The Mac drivers for the Lexmark X4550 (listed as '3500-4500 series') are a little twitchy in that, after not using the printer/scanner for a while via its wireless interface (e.g. after the wireless router has restarted), it will no longer connect to the Mac to scan nor will the Mac connect to it to print. The typical case when trying to scan and upload to a computer on the network is that the printer will display "Downloading application list" on the LCD panel after you select the desired computer to scan to, and then after about a minute, "Cannot retrieve application list".

Anyway, the scabby workaround for me is a little script which simply kills and restarts a pair of Lexmark driver services:

$ cat ~/bin/restart-lexmark-x4550.sh

killall LexmarkNetworkServices
killall "3500-4500 Series Button Monitor"
open "/Library/Application Support/Lexmark/LexmarkNetworkServices.app/"
open "/Library/Application Support/Lexmark/3500-4500 Series Scanner.bundle/Contents/SharedSupport/3500-4500 Series Button Monitor.app/"


This seems to do the trick. Of course, it would be better if Lexmark would fix their drivers, but after the last phone calls I had with their tech support I don't think this is a big priority for them (it was an outsourced-to-India tech support line, where the guy did almost everything he could to pronounce that it was a problem with my router or my computer or something, rather than actually passing on information about a probable bug to the dev team... although he did seem to have a decent technical grasp of the troubleshooting steps he performed which makes him infinitely better than the Acer helpline which appears to go to a call centre in Scotland with lots of ignorant people in it. Whoops, my comment in parentheses is longer than the preceding paragraph, boo!).

Monday, February 16, 2009

Human logic is creativity

From The Society of Mind, Marvin Minsky's excellent book (Picador edition, p. 189):
I do not mean to say that there is anything wrong with logic; I only object to the assumption that ordinary reasoning is largely based on it. What, then, are the functions of logic? It rarely helps us get a new idea, but it often helps us to detect the weaknesses in old ideas. Sometimes it also helps us clarify our thoughts by refining messy networks into simpler chains. Thus, once we find a way to solve a certain problem, logical analysis can help us find the most essential steps. Then it becomes easier to explain what we've discovered to other people - and, also, we often benefit from explaining our ideas to ourselves. This is because, more often than not, instead of explaining what we actually did, we come up with a new formulation. Paradoxically, the moments in which we think we're being logical and methodical can be just the times at which we're most creative and original.

I think the last two sentences are enlightening and in strong contrast to the popular assumptions that "logical" thinking is an antithesis of creative thinking.

Monday, February 02, 2009

Chinese text input on OS X: ITABC vs FIT

After growing somewhat accustomed to (the disappointment of) the ITABC Pinyin Chinese input method that comes with OS X, I configured my Vista work box to add the MS Pinyin input method which I soon discovered was far superior to Apple's ITABC. Partly this is due to some crasher bugs in ITABC (which I've reported and never heard back about, so maybe it only happens on my Mac?) - for example, typing any string with "shish" in it will cause part of it to crash, so that SCIM must be manually killed to force the input method system to restart before Chinese can be typed again.
More importantly however, it's just so much easier to type in the input method for Windows. I can type a full sentence and, often enough, the whole thing will be interpreted as I intended, or the small number of corrections can be elegantly entered without deleting interceding correct characters. In the Apple ITABC method, it has a strange heuristic of trying to forcibly group pairs of characters at a time, even when two single characters are much more likely. This results in an erroneous offset which often propagates all the way through the sentence so that in practice one ends up correcting the input method every character or two (by hitting space and selecting the correct match) and/or accepting then going back and correcting input manually. Not only this, but some words like 儿 completely throw off the parser - if you type 'dianer' the result is '嗲呢日' (dia3 ne ri4) rather than the obvious '点儿'.

After using the Microsoft Pinyin IME briefly in college and coming home to be stuck with this again, I decided enough was enough, and started searching for alternative input methods. My brief search took me to OpenVanilla, something else that didn't work well, and finally "Fun Input Toy", a beguilingly-named input method which I downloaded from here.
After installing it mostly blind because my Chinese is absolutely not good enough to run programs or read technical documents (or, eh, any documents except for kids' books really) and wincing at the Chinese-only menus, I soon got it working (because the "Next" button in the installer wasn't translated, but you know the position it's in anyway :D). I was initially impressed, but decided to keep my enthusiasm somewhat checked before jumping to conclusions. Not for long though, because it soon became apparent that writing Chinese sentences with FIT is much easier and quicker than ITABC, and it's not as buggy.
By way of comparison, here's the result of typing the string "zheshougemeiyounashougenamehaoting" in both input methods without corrections:
ITABC: 折寿个没有拿手个那么 (4/12 -> not gonna even try translating that mess)
FIT: 这首歌没有那首歌那么好听。(12/12 -> "This song is not as nice as that song.")

Note that in ITABC, once I'd typed the pinyin string, I had to hit space once to start parsing, which yields 折寿, then space again for 个, again for 没有, again for 拿手 and so on. Note that it terminates after 那么 because it only accepts input of up to 10 characters, which means breaking mid-sentence (in practice, after only a few words because the parser gets so confused).
Also note that I typed sentences like this a few times under both systems to allow any learning mechanisms to observe my use of less common words like 歌 (ge1: song).

Also note how ITABC and FIT look once I've typed the entire string in and not hit space yet:

ITABC:


Fun Input Toy:


The FIT input window clearly shows much more information (such as the fact that it parses as much of the sentence as possible, with appropriate options for corrections, compared to ITABC only parsing a couple of characters at a time; usually two).

In summary, ITABC is pretty awful, FIT is very nice. And it's free, so use it!

Thursday, January 15, 2009

Karma headlines

(two successive headlines on Digg)

Sex Offender Wins Lottery For Sex Abuse Victims
Made popular 2 days ago
www.huffingtonpost.com

Sex Offender Who Won Alaska Lottery Beaten With Iron Pipe
Made popular 3 hr 14 min ago
www.mcclatchydc.com

Sunday, December 28, 2008

women and maths and chess...

Two New Scientist articles caught my attention recently:

The first is a bit of mathematical obviousness which points out that: "There are few women at the top of science because there are so few women in science. It's simple statistics."
It uses the German chess federation's statistics to support the theory: there, men outnumber women by 16 to 1 (so if all other (significant) things are equal, there should only be a (1 - 15/16 ** 3 = roughly 18%) chance of a woman being in the top three, if I understand rightly).
Which begs the question, why are there so few women in chess/science/etc? Well, this is the subject of the second article...
Which is about a study where they split the (all female) subjects into two groups. One group was told that women perform poorly at maths due to genetics, and the other group was told that women perform poorly at maths due to social factors. Then they gave both groups the same maths tests and found that the 'genes make women bad at maths' group answered half as many questions correctly as did the 'society makes women bad at maths'.
This supports the idea that women being (statistically) worse at maths is probably wholly due to the negative, self-reinforcing erroneous stereotype that women are genetically predisposed to suck at it. Boo society!

I must admit to allowing myself to openly stereotype people more often than I'd like (i.e. than never), but seeing the power of negative stereotypes to destroy the performance of the maths test subjects it's time to at least keep such preconceptions to myself as much as possible.

Wednesday, December 24, 2008

mini cd/dvd -> Macbook -> oops!

As I inserted the mini CD for the Tevion "Potent Pad" (which I was sure only contained Windows drivers anyway), I thought "uh, how will a slot loading drive pick up a mini CD?". After a few seconds of silence once I had inserted the disc (and poked it in further with an envelope, to bollox things up further), it became apparent that I should have stopped and thought about it, rather than simply thought about it and carried on regardless...

A quick web search yielded predictable advice such as "power off the machine and use a paperclip to extract the disc" or "disassemble the machine and DVD drive to remove the disk". Since I wasn't keen on scratching the optical mechanism to ruin or dismantling the computer, I kept scrolling until I found the following blatantly obvious and blatantly sensible suggestion from 'ashleyman':
"Or just tip it so the drive faces the floor and give it a few taps!!"

This served me well and I safely removed the CD within 5-10 seconds of gently shaking and tapping the laptop with the slot facing down. Sometimes the solution is so obvious that you can completely pass it by!

Wednesday, December 03, 2008

OS X isn't all that great...

It seems like every week or so, OS X prompts me with some system updates that necessitate a reboot (usually Safari and iTunes - why the hell do I need to reboot my computer just because Safari was updated? This is the kind of behaviour people criticised Windows for in the past). I usually leave the dialogue box in the background for a couple of days until I'm ready to reboot, then go ahead.
Every once in a while (month), when I allow it to restart to "finish" updating, nothing happens. I start manually closing programs after getting warnings that each individual program failed to close (although manually closing them causes no problems at all). This time, the Software Updater seemed to hang as well, even though I had already told it to restart my Mac.

In the end, the machine seemed to shut down but the fan was still spinning. After hitting the power button a few times and waiting a minute or two, I held it to force a power-off and reboot. Then, instead of seeing the "Installing updates" dialogue you usually get when rebooting after installing updates, I just got my usual login screen, and sure enough, logging in as normal (after a ridiculous 4 minute delay before the Finder menu would respond to mouse clicks, WTF?) and opening the System Updater started the whole process from scratch.
LAME. Absolutely lame.