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