Mimicking UIAlertView’s animated transition

For various reasons I ended up writing a UIView that mostly mimics the behavior of UIAlertView. UIAlertView appears on screen with pleasant animated fade in and rubber-band-like bounce of its dimensions. After struggling to reproduce this through trial and error, I gave up and just recorded video of a UIAlertView appearing. I then measured its dimensions over time. It goes through several steps, so to save anyone future effort doing the same thing, here are the phases it goes through (of course I could be a bit off, these are all hand measurements:

Before the animation starts, the view transform is 0.6, 0.6
Then a duration 0.2 animation takes us up to 1.1, 1.1
then a duration 1/15. animation down to 0.9, 0.9
then a duration 1/7.5 animation back to identity.

Here it all is wrapped in a simple method:

float pulsesteps[3] = { 0.2, 1/15., 1/7.5 };
- (void) pulse {
    self.transform = CGAffineTransformMakeScale(0.6, 0.6);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:pulsesteps[0]];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(pulseGrowAnimationDidStop:finished:context:)];
    self.transform = CGAffineTransformMakeScale(1.1, 1.1);
    [UIView commitAnimations];
}

- (void)pulseGrowAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {  
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:pulsesteps[1]];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(pulseShrinkAnimationDidStop:finished:context:)];
    self.transform = CGAffineTransformMakeScale(0.9, 0.9);
    [UIView commitAnimations];
}

- (void)pulseShrinkAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:pulsesteps[2]];
    self.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}

Fanny and Alexander

Sitting through watching Fanny and Alexander for the first time, I couldn’t deal with the whole thing at once just before going to sleep, so I stopped it about half way through when it started getting really dark.

Going through the remainder, I’m glad that I waited.  But before even finishing it I was amazed by a scene enough to stop watching and start thinking.  The film dialog makes mention that the events take place in 1907 (in Sweden).  Grandmother is sitting at a table sifting through a photo album, and her son jokes about how she is sifting through thousands of photographs.  In 1907.  To think that in that era with the great effort that went into taking even a single photo, and someone is already depicted overwhelmed by the mountain of memories:

all these moments

And I know people today who have been taking digital photos vigorously for at least 10 years now, who have stacks of DVDs each of which contains hundreds of photos.  My own collection, assembled mostly since 2004, taken with what I thought was some critical eye to avoiding taking unnecessary shots, is well over 8000 photos.

Thinking about the meaning or lack and weight of all of those images.  Glancing over in the room as I type this I can see the three physical photographs that I brought home with me after my Grandmother died: one of her as a child in her mother’s arms, one of her father standing proudly by a car in pre-war Cuba.  One of her future husband standing on a ship at sea.

Health Riddle

I just had my yearly physical yesterday and they had a questionnaire first that included the bizarre:  “weekly, do you regularly consume juice, coffee, or sports drinks?  If so, how often.”

There was just one answer lumping all three together.  Am I missing something here?  Fruits are full of all sorts of unknown and known goodness.  Coffee is full of caffeine (and some various goodness and badness).  Sports drinks are sugar, elecrolytes, and sugar.  Still scratching my head.

Solved: Bootcamp wake-from-sleep Bluetooth failure

On the iMac I use at work, I use Bootcamp to run Windows XP.  When the system wakes from sleep (suspend) the built-in Bluetooth device fails to wake up.  This is nearly 100% of the time.

Solution: I bought a little USB Bluetooth device, plugged it in, and disabled the built-in device.  After waking from sleep the external USB Bluetooth device ALSO fails to wake, but if I just physically disconnect it and then reconnect it, it comes to life and with a slight delay, my wireless keyboard comes back to life.

Exchange rates

Lovely, I see this on the Lloyds TSB remittance calculator page for today’s exchange rates:

no exchange!

Hopefully just a website error, right?

Region coding hell

I happen to live in Tokyo.  I have friends here and in the US, and London, and various countries actually.  That means I would like to be able to try to play networked games not necessarily just with people who live geographically very close to me, but with friends that live network-topologically close to me.

What does that mean?  To play online games with any degree of smoothness, you can pretty comfortably enjoy the experience with a delay of only about 100-150 milliseconds from your network connection to the other machines you are playing with.  That’s about a 10th of a second.

Thanks to undersea fibre-optic cabling, this means that california is actually right next door, and I should reasonably be able to play with people both next door and across the pacific ocean.  An amazing feat.

In fact, Microsoft’s renowned Live paid multiplayer network service allowed me to purchase a prepaid year subscription in Tokyo, and since their network is global, connect in theory with people in california with no trouble.

Problem is, even though their network treats every user like they live in one big space, on top of that they have region-coding that says that when you create an account, you have to pick a region.  This has nothing to do with the region you are actually physically in.  This is the region that you want to play in, and you can pick regions that are network-topologically very far away, say, the UK.

But it happily accepts whatever setting you want.

They then insist that you pick a language that is defined by your region, so if you choose North America, you can only pick English.  What happened to Spanish and French?  Sorry, we all know in America only english is spoken, right?  Sure.

If I choose Japan, sure enough, even though the system can show me text in whatever language I please, my only choice is Japanese.

Ok, fine, so I choose America, since it has English as a choice.

Unfortunately that means that in-game, if I ask to join a multiplayer game, it doesn’t try to find people nearby me to play with, it finds people that are online in the selected region.  This is moronic, since it ends up choosing someone in montreal speaking French, over someone right next door to me that, while I may have the same trouble understanding, at least has a good ping to me.
It gets worse.  In Japan I bought both the pre-paid one year subscription and, in order to buy online content, $15 of their scrip currency, live points.  Except that while their account creation system lets anyone in the world choose to create an account tied to a locale that is nowhere near them, their scrip redemption system insists that if you buy a scrip card in a specific region, that scrip card can only be used in the locale of that area.

So here I am, having bought, in Tokyo, at the same time, both a one year account card and $15 worth of points to use with that account, stuck with an account that is tied to games in north america and points that it refuses to let me redeem, since my account is now “in” north america.

After spending about 30 minutes talking about this with a microsoft representative on the phone, he said that for some reason he cannot cancel the account, and he cannot change the account locale to Japan, and he cannot issue me a credit to create an account in Japan.  In fact, he cannot refund the scrip points either.

In short, because of their idiotic partially applied region-coding, they may as well have sold me a pair of gills.

All this when I could have just bought a PS3 and enjoyed FREE networked multiplayer gaming.

On the Japanese Diet, from the news

This article on The Age website has near the end this quote:

Japan’s meat consumption had increased by 900% since 1955, in part because expanding incomes had enabled families to supplement the sparse national diet of rice, fish and miso soup with more Western-style food.

Which made me laugh because just before reading this, for lunch I had multigrain (16!) rice with miso-saba (fish), and miso soup, something I eat about 3 times a month simply because there’s a nice little place nearly in front of my office that has it.

But 900%! Wow. All those insanely old very healthy active japanese people in their 90s did not grow up eating tons of meat, they ate that “rice, fish, and miso soup” diet.

Rikaichan ALT support merged to main Rikaichan build

I haven’t tested the official 1.01 build yet, but since it incorporates the ALT image support I added, my own build is probably nolonger necessary.  Rikaichan 1.01 announcement

A great speech on competition and government subsidies

By the president of Cypress Semiconductor speaking before congress, in the 1990s.  Well worth reading.

Commenting on how mathematics (and everything else) is taught to children

Some comments on Marvin Minsky’s writing on this mistaken ways in which we teach children.  First: his article.

Looking at the systemic failures of the US education system leaves me unable to see a viable route to a high functioning system[1].  This leaves me wondering, when I  have children, how to deal with educating them when even the very best private OR public schools have to conform to a very broken system, and when home schooling might even be illegal.

The only solid answer I can come up with is to move, though I am not sure where to.  I live in Tokyo right now, but the school system there is even worse.

On a different note, I was surprised that Minsky makes the mistake of suggesting that it is a positive thing that subjects other than math are taught by bombarding students with tons of new words to remember (names, dates, etc), saying “[in other areas] each pupil learns hundreds of new words in every term. You learn the names of many countries and organizations, the names of leaders and battles and wars

The students by and large “learn” these useless data points one week, regurgitate them for the test, and then forget them when the testing is over.  We would do far better to teach people to think for themselves, to analyze information as it comes at them, and to focus, in as much as we really want them to remember history, on the relation of people and events as a narrative story, rather than obsessing on meaningless dates.

[1] world-leading in meaningful terms, not just learned-knowledge tests.