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.

Sunday, November 16, 2008

Funny English expression of the day

"Rarer than rocking horse shite."

How to replace a bicycle tube/tyre ten times faster than I do

I hate dealing with punctures. I usually spend about 40 minutes dithering at the task, struggling to get the tube out of the wheel, locating the puncture, patching it carefully, leaving it for 5 minutes, coming back to find that I didn't apply it properly, cleaning it with sandpaper and then jamming the inner tube back in under the outer tyre.

So I was a bit embarrassed to see these videos of a guy removing and inserting the tube (and outer tyre in the process, which seems to just speed things up) in about 80 seconds. I'm still a bit skeptical about dealing with the outer tyre, which seems much tighter and stiffer on my hybrid wheel, but I'll have to try it next time!

Tube comes out


Tube goes in


These videos come from the very useful homepage of Jim Langley. (Note: Opera users such as myself may want to identify as Firefox or IE due to some outdated JS-crippling)

Thursday, November 13, 2008

Meteor MMS on the Palm Treo 680

Meteor uses a system which pushes the WAP/MMS/etc configuration to your mobile phone, but strangely don't provide the details online for anybody with an unsupported phone. In fact, when I phoned their customer service I had to push the agent to speak to his supervisor and get the settings, since he had no idea what I was talking about (indicated by his question "Did you say I.T. address or I.P. address?").

It's not possible to specify those settings completely in the Messaging program on the Treo 680; instead, you need to modify (or copy and use) the settings in (main) Prefs->Network. This configuration worked for us:
Service: Meteor MMS Copy
Connection: GPRS
User Name: my
Password: mms
APN: mms.mymeteor.ie

Then in the Messaging program, go to the Preferences menu, select the Network tab, change "Network Configuration" to manual and enter the "Edit..." dialogue, where you can enter the following settings:
Message centre number: +353857000000
Email centre number: [blank]

MMS HTTP Proxy: 10.85.85.85:8799
MMS URL: http://mms.mymeteor.ie
Network Profile: Meteor MMS Copy

This works for downloading MMS messages.

Tuesday, November 11, 2008

the arithmetic calculator exercise in GFA Basic

For a couple of reasons, I tried that arithmetic calculator exercise in GFA Basic (v3.6 for the Atari ST; why not?), and although I selected a somewhat different approach, I think it's really like a non-recursive version of the recursive Lisp version I posted before; with state in variables which persist for the whole loop. This is where side-effects can get mysterious, compared to the neater encapsulation of state in each recursive call's parameters.

randomly entertaining Chinese sentence

I check pretty much every new word I come across in my study materials on dict.cn, which also lists example sentences containing the term.

Here's a nice one I found when looking up the character 肥 (fei2), which according to my book means "(of clothes, shoes) loose*, (of animals) fat":
我被两个肥胖的女人紧紧地挤在中间,以致于要站起来下公共汽车都很难。
I was so tightly wedged between two fat women that it was difficult for me to get up and leave the bus.

:D :D

* although I couldn't substantiate the first meaning from the online dictionary..?

Saturday, November 08, 2008

Common Lisp: arithmetic calculator exercise

Following a post on the Atari ST forum I tried a little exercise to write an arithmetic expression parser for expressions like "24 - 3*9 + 9/3". I was surprised to find it a little difficult, taking about an hour even with the concessions I made (accepting input as a list rather than a string, and not checking for well-formedness of expressions). My code is on paste.lisp.org and I'd love to see any improvements or tips. Embarrassingly, I took two semesters of the final year compiler construction course in DCU and did quite well at it; parsing of programs was a central topic on the course! I guess it's easy to take for granted your skills at 'abstract' coding and notice they need a bit of exercising.

Saturday, October 25, 2008

ntl's expanded internet pipe

Soon after moving here last year, we decided to get our TV, broadband and phone service through ntl rather than get TV from them and broadband/phone through Eircom or some reseller, since Ireland has apparently the most expensive line rental in the world (?? thanks, Tony O'Reilly for exploiting the competition-free market and Comreg/competition authority for allowing it).

They recently retooled their broadband packages, so that the old 6mbit price now gets you 10mbit and for €10 more per month you can get 20mbit (I wouldn't bother with that unless I was sharing with a few people, though).
I had to call up to get it though, since they weren't nice enough to automatically shift me over to the new package - this is really something ISPs should do when they improve their packages.

It's working pretty good too - close to the quoted 10mb:

Thursday, October 23, 2008

Lexmark X4550 wireless woes with OS X

I picked up a fairly cheap Lexmark X4550 wireless printer/scanner/copier about 6 months ago and soon noticed that it stopped working every time I restarted the router.
After a long conversation with a fairly patient technical support guy at Lexmark proved mostly fruitless, I dug a little further and ran a packet sniffer (Wireshark) over an attempted print job.

This prompted me to double-check the printer settings, which showed a device URI of lexnet3://192.168.1.3:1. Which is certainly wrong, as the printer is at 192.168.1.4. I'm not sure why it doesn't just use DNS properly, but anyway.

Trying to correct this, I stumbled across this post explaining how to modify the device URI via the CUPS web interface available on OS X. And it works! Good old Unix!

article: "Early Childhood Education: The Key to Success in Life"

Anyone who has or expects to have children should read this article about preschool learning as soon as possible.

After emphasising some of the importance and benefits of preschool education, it lists some basic and simple ways in which you can help educate your bairns. As usual with such material, there are 'obvious' things that never occurred to me - like placing a young baby face-down from even one month of age, because he will naturally want to raise his head which will help build up his back muscles which will improve general strength and co-ordination. The paper-crumpling trick is clever too.

Well worth a read!

Friday, October 10, 2008

classy typing tutor

This is the funniest-looking educational game I've ever seen. Check out the screenshot :D The description for the game calls it "an educational children’s casual game". It certainly would have appealed to my childhood self.

. o O ( "Cop smearer"?? )

Sunday, August 24, 2008

Ireland's gradual transformation to a police state

Well, here we are. The Department of Justice, Equality and Law Reform have made it so that all migrants to Ireland from outside the EU must be fingerprinted (and their details shared with who knows how many foreign agencies). And of course, the costs for this are passed on to the migrants themselves - they will pay another €50 on top of the old €100 "registration" fee to lose their privacy. I have to wonder what practical use there will really be for the fingerprinting.

The "Land of the 100000 welcomes" is long dead and buried by this point. What disturbs me is all the people who feel that all foreigners should be fingerprinted and they're lucky they're not just sent home immediately anyway. What if all Irish citizens had to be fingerprinted? Would that be okay? No? So why the double-standard, and where does it stop?

Saturday, August 23, 2008

Refactoring threats

Entertaining quote of the week (a comment on an article about a newbie employee running a "NEVER RUN THIS" database recreation script after being told not to) from a user on thedailywtf.com:
Re: Do not run this script, ever!
2008-01-25 15:45 • by morry (unregistered) 173406

I've always thought it's better to put these things into the positive, i.e. don't use "don't". For example:

RUN THIS SCRIPT WHEN YOU WANT TO BE FIRED

EXECUTE THIS PROGRAM WHEN LIFE NO LONGER HAS MEANING FOR YOU

IF YOU LIKE EVERYONE HATING YOU, THEN START THIS JOB

MAKING TOO MUCH MONEY? DO THIS TO REDUCE YOUR PAYCHECK TO 0!

GET ESCORTED OUT BY MERELY PUSHING THIS SHINY RED BUTTON

Thursday, August 14, 2008

Stupid thing of the day

Eclipse (the popular Java IDE) has an update manager which allows it to automatically fetch and install or upgrade new versions of various components and plugins.
However, it can't upgrade itself from version 3.3.2 to 3.3.4.

WTF.

Wednesday, July 30, 2008

"Who gives a shit?" attitude -> better mental performance

This article was a big surprise to me. The gist is that using the executive function of your brain (switching from deliberation to implementation - making and acting on decisions) has a strong negative impact on all sorts of mental activities.
For example, deciding whether to have cake or cornflakes for breakfast could be enough to make you perform poorly at an interview later on.

A further implication of this (to me) is that people who coast through much of the day like zombies (especially in the morning), not making many decisions, are much better able to perform when they need to, because they haven't depleted those resources yet.

The moral of the story: if you want to improve your overall mental performance, get into the habit of saying "who gives a shit?" about irrelevant decisions like where to put the furniture or whether the curtains need to be washed again this week. Don't deliberate over mundane issues. Don't waste your energy. Just pick the first reasonable option. I'd like to know if strategies like this can minimise this effect, or if we really have to go around like cattle - I know I do, most of the time... Is that what girlfriends are for? To decide where the couch and TV should be and what washing powder to use, so that I can reserve my brain power selfishly for 'clever' use later (which rarely happens)? Seems a little unfair, really...

I have more questions. How do we recover from the effects? How long does it take? Can we speed it up? What about meditation, or induced alpha/theta/delta brainwaves (i.e. by listening to binaural beats, say)? Why does it happen?

Enough rambling (I guess...), I'm off to dodge some decisions! Probably.

Wednesday, July 23, 2008

(Auto-)Growing Panes

In another Swing-related weirdness note, it seems that a certain combination of apparently logical options regarding GridBagConstraints and a JTextArea will cause the JTextArea and enclosing JPanel to expand horizontally by gridBagContraints.ipadx pixels per step, forever.

After scratching my chin in confusion, I whittled out the following minimalish example that demonstrates the result:

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.border.LineBorder;

public class TextAreaExample {
public JPanel createContentPane() {

JPanel contentPane = new JPanel();

JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
// ipadx > 0 causes textarea panel to grow horizontally forever if linewrap is set!
c.ipadx = 1;

JPanel leftPanel = new JPanel();
leftPanel.add(new JLabel("Left"));
mainPanel.add(leftPanel, c);

JPanel logPanel = new JPanel();
logPanel.setLayout(new BoxLayout(logPanel, BoxLayout.PAGE_AXIS));

JLabel label = new JLabel("Hello");
logPanel.add(label);

// create misbehaving textarea
JTextArea log = new JTextArea(10, 40);
log.setLineWrap(true);
log.setBorder(new LineBorder(Color.BLUE));
logPanel.add(log);

mainPanel.add(logPanel, c);

JPanel rightPanel = new JPanel();
rightPanel.add(new JLabel("Right"));
mainPanel.add(rightPanel, c);

contentPane.add(mainPanel);
return contentPane;
}

private static void createAndShowGUI() {
JFrame frame = new JFrame("JTextArea growth test");

TextAreaExample demo = new TextAreaExample();
frame.setContentPane(demo.createContentPane());

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}


I can get around it by setting a preferred size on the JTextArea (a size of 0,0 seems to do the trick without changing the initial layout), but what the hell?

Monday, July 21, 2008

Swing and a miss

Does this method Javadoc from the Swing API confuse you? It confuses me:
/**
* Sets the the vertical alignment.
*
* @param alignmentX the new vertical alignment
* @see #getAlignmentX
* @beaninfo
* description: The preferred horizontal alignment of the component.
*/
public void setAlignmentX(float alignmentX) {


As you can see, the method description and param seem to conflict directly with the beaninfo description. I was sure the first two are a typo, copied from the alignmentY equivalent, but let's have a look at setAlignmentY:
/**
* Sets the the horizontal alignment.
*
* @param alignmentY the new horizontal alignment
* @see #getAlignmentY
* @beaninfo
* description: The preferred vertical alignment of the component.
*/
public void setAlignmentY(float alignmentY) {


???

Also, using it is confusing and the docs don't seem very helpful. I created a JPanel using a vertical BoxLayout, so that as you .add(component)s they stack up beneath each other.
To the empty box panel I added a JLabel with the text "Log" and beneath that, a JTextArea which would hold the log output.

However, I noticed on running the program that the label was not left-aligned - instead, it was indented by about 40 pixels beyond the log textarea beneath. Worse still, when text appeared inside the JTextArea, the label above would jump horizontally right, bizarrely. So the most logical thing to do seemed to be to call label.setAlignmentX(Component.LEFT_ALIGNMENT) to keep the label aligned to the left side of its containing box.
Seemed to be the logical thing to do. But no, this caused no obvious change. Various combinations of this did nothing, until I made the same call on the textarea underneath.

So if you have a vertical box containing a label with a textarea underneath it and you want the LABEL to be left-aligned, you have to tell the TEXTAREA to left-align itself.

...WHAT?

Wednesday, July 09, 2008

The great antivirus scandal of 2008

This report is pretty scary. It's understandable that everybody overlooks the fact that virus scanners can be vulnerable, especially when they're built with lots of 3rd-party plugins (e.g. upx/zip/arj/rar/etc unpackers).

But the fact is, you can become automatically infected by a virus without running the infected program/trojan yourself; the virus scanner scans it automatically, but the file is designed to exploit a vulnerability in your virus scanner and you become infected.
That's a lot more dangerous than having no AV software and just being careful which programs you run...

Symantec is among the worst here, with about 32 vulnerabilities listed compared to 6 or 7 in FProt, AVG and BitDefender.
Personally, I think it serves AV vendors right for coding their products in languages as dangerous as C and C++, which are so vulnerable to buffer overflow mistakes. And nobody can code without mistakes. And the frequency of mistakes increases with code size, of course. They should have written their scanners/plugins in a better programming language (e.g. Lisp).

Tuesday, July 01, 2008

Update on Gambit-C Scheme benchmarks

Thanks to some helpful comments from a few people on my previous post about Gambit-C Scheme, I rebuilt and ran (with a larger minimum heap size specified) those few benchmarks I was bothered pulling off their site and the shootout site for SBCL (which is a very fast Common Lisp implementation I'm interested in using as a kind of reference).

The results in general are much better:

time ./fannkuch -:m20000 11 > output_fannkuch

real 0m9.931s
user 0m9.465s
sys 0m0.172s

time ./fasta -:m20000 25000000 > output_fasta

real 0m29.843s
user 0m25.220s
sys 0m2.700s

time ./binary-trees -:m20000 16 > output-binary-trees

real 0m2.770s
user 0m2.581s
sys 0m0.089s

time ./pidigits -:m20000 2500 > output
real 0m3.322s
user 0m3.093s
sys 0m0.110s


A range of improvement is apparent, with binary-trees benefitting a lot and pidigits not really getting much better.
I picked a 20 meg heap because a) it seems wasteful for individual programs to reserve (and probably waste) huge chunks of memory, if you're running a lot of programs b) when I tried higher values up to 50 megs on the fasta benchmark, it was faster, but only by another .2 seconds or so; about 1-2%... and c) Most other languages, and in this case SBCL, don't seem to request more than about 20 megs for their initial heap size either.

Of note is the fact that the prebuilt version produced slightly faster code than the version I compiled myself, specifying the optimisations mentioned in the INSTALL.txt document. Not sure why... These numbers are for the Gambit I compiled myself, and I didn't feel like dumping it and re-installing the prebuilt version just yet.

Anyway, these are nice results!