Wednesday, October 31, 2007

Haskell Substring Function

Somewhere out there a programmer is wondering, "Why doesn't Haskell seem to have a substring function? Why is this brave new world of functional programming so harsh and cruel?" (Well, maybe not the second part.) The isInfixOf function in Data.List does what you want. It isn't called "substring" because it also works with other types besides String. (See also isPrefixOf, isSuffixOf.)

I haven't seen this mentioned in Haskell tutorials so I'm posting it here.

Prelude> :m +Data.List
Prelude Data.List> "bc" `isInfixOf` "abcd"
True
Prelude Data.List> "zz" `isInfixOf` "abcd"
False

Friday, October 26, 2007

Cardboard - The Ultimate Camouflage

680 News reports that thieves concealed themselves inside a cardboard box in order to break into businesses at night and steal from them.

Detective Sergeant Reuben Stroble said anyone driving by would see the box and simply assume it was a delivery for the business.

"The concealment, I mean, no one would ever think of someone being inside a box in front of a storefront window in the middle of the night," said Det. Sgt. Stroble.

Video gamers will recognize the cardboard box camouflage as a signature trick from the Metal Gear Solid series of games. When I played those games, I thought that was a silly gimmick that was very unlikely to actually work in the real world. What's next? Will we discover that random barrels and crates really do contain power-ups?


Tuesday, October 16, 2007

Tales of Garlic

The other day we went to a local grocery store that specializes in international foods, and I got a jar of "Garlic in Oil with Herbs" from Poland. It turned out to be quite good, and so a few times a week I would open up the jar, take out one or two cloves of garlic, and eat it as a snack.

Then a few days ago, I decided to read the label more carefully, to find out the exact ingredients and the nutritional information. I was shocked to discover that according to the label the jar contains 2 servings! Eating half a jar of garlic at one sitting is considered a serving. I can't even imagine doing that.

Wednesday, October 10, 2007

I Need To Work On My Lip-Reading

The new Bionic Woman TV show has the worst-mixed soundtrack I have ever heard. The latest episode sounds approximately like this:

"BAD MUSIC, whisper, BAD MUSIC, mumble, SOUND EFFECT, whisper, SOUND EFFECT, mumble."

At least 1/4 of the spoken words were too soft in the mix to be understood. It's like the sound engineers decided, "Hey, let's turn down those lines of dialogue because they're drowning out the dumb BLOOP-BLOOP-BLOOP noise that we worked so hard on."

Planning a What?

When I saw this headline . . .

Christina Aguilera Planning Duet With Aretha Franklin


. . . for a second I thought it said they were planning a duel. Now that would have been exciting! Flintlock pistols at 40 paces, at dawn?

Monday, September 17, 2007

Kumoricon 2007


I covered Kumoricon 2007 for JLHLS again this year. It was my third year at the convention, which was bigger than ever. The costumes were great, and it was a lot of fun.


Sunday, August 19, 2007

The Uh-Oh Level

My girlfriend has the habit of saying "uh-oh!" with no further explanation. Often this happens when we are in different rooms, so I can't immediately see what the problem is. So today I told her that from now on after saying "uh-oh" she should say a number between 1 and 10 to indicate the severity of the issue. For example, "uh-oh 1" would mean something like, "uh-oh, I can't decide which pair of shoes to wear." But "uh-oh 10" would mean something like, "uh-oh, the house is on fire, and also some zombies are trying to break down the front door to come in and eat our brains."

We'll see how this works. So far I have gotten an "uh-oh 3" which meant "I can't find my iPhone."

Tuesday, July 17, 2007

Hollywood Version

Here's a mental game to keep you amused. Next time you're in a boring situation, imagine that instead you're in the Hollywood Version of the same scene. All the people around you are glamorous A-List celebrities. They are exchanging incredibly witty banter that took the screenwriters many drafts to get just right. The surroundings are impeccably designed and perfectly lit. And whatever it is that you are doing is not just some random, boring activity, but it is in fact a "pivotal moment" that fits perfectly into the clever plot and drives it forward.

The more over-the-top you imagine it, the better.

There's something quite funny about doing this exercise. You realize how completely unlike the Hollywood Version the real version is. I'm not sure why that's funny, but it is.

Thursday, June 28, 2007

Early Summer Chatter

What To Get

Her: While I'm up, can I get you anything?

Me: Yeah . . . uh . . . a monkey.

Her: Let me rephrase that, can I get you anything that I reasonably could get?

Me: Well . . . um . . you could make us a pot of that "Monkey-Picked Oolong" tea.

Her: Why, because it was touched by a monkey?

Me: It has "monkey" in the name.


Slap Therapy

My brother: Slap me.

Me (suspicious): No.

[Note: if my brother wanted to spar, he would probably say something like "want to do some sparring?" Or if he wanted to try out some particular move, he would say "try to slap me." But just saying "slap me" as if he expected it to succeed made me think he was up to something.]

My brother: Come on, I won't hit you back. Slap me.

Me: No, I don't want to.

My brother, turning to my girlfriend: Slap me.

[She slaps him very lightly, almost a pantomime slap.]

My brother: Not like that, really slap me.

[She really slaps him.]

My brother: See?

Me: I don't understand the point of this.

My girlfriend: Hmm. Slapping him was kind of cathartic!

Me: Hey, you've invented a new type of therapy! You should write a book, and go on Oprah.

Sunday, June 10, 2007

An Army


Her: Time to clean the floor.

Me: We really need to have an army of robots for that.

Her: Nah, I'll just use the Swiffer.

Me: An army of robots would be cooler.

Her: Well . . . I guess it would be cooler.

Me: But eventually they'd rebel.

Her: And kill us.

Me: . . .

Her: I'll stick with the Swiffer.

Sunday, May 13, 2007

Smart Cars? Why Not Smart Drivers?

From abc.net.au:
'Intelligent' cars fitted with sensors to predict traffic flow can deliver the same fuel efficiency as hybrid vehicles, a new study shows.

[...] 'intelligent' cars are conventional vehicles fitted with sensors and receivers called telematics, which work in a network, swapping information about the traffic ahead.

This traffic information is then relayed to the car to stop the vehicle or slow it down so that the ride is smooth, avoiding the stop-start phenomenon that drains fuel.

[...]

They calculated that a hybrid version of the car would deliver fuel economy of 15-25% over the unconverted vehicle.

But this saving was matched when the benchmark car was fitted with basic telematics that predicted traffic flows as little as seven seconds ahead, as determined by Australian driving conditions. [link]

Wouldn't smarter drivers be just as effective as smarter cars? Wouldn't that be cheaper, too? The only way to get drivers to drive more smoothly is to have a computerized car override their bad decisions? How sad. And if we're going that route, maybe the car should refuse to start at all during peak traffic hours.

It is possible to get better mileage simply by changing driving habits. See Hypermiling.

Friday, May 11, 2007

Sunday, May 06, 2007

Iron Monkey's Law of the Imagined

We think we enjoy our imagination because it simulates reality, but the truth is that we enjoy reality because it stimulates our imagination.

We May Outlive the Net


[Note: This is a World Without Oil post.]

We may outlive the Internet. To everyone blogging and podcasting about a World Without Oil, I admire your efforts, but I also must ask: what's your Plan B for when the power goes out? This energy crunch will not just be about gasoline and driving. The electrical grid is vulnerable, too.

"In fact, severe power shortages and rolling blackouts will now become a daily occurrence around the country over the next few years, according to NERC, because the antiquated power grid will be continuously stretched beyond its means - mainly a result of electricity deregulation, whereby power is sent hundreds of miles across the grid to consumers by out-of-state power companies instead of being sent directly to consumers by their local utilities, which is what the grid was designed for."(link)

Suppose you have off-grid electricity -- you have solar panels or windpower, or your own backyard wood burning steam engine connected to a generator. Maybe you even have a hand-cranked laptop. Cool! You're still ready to browse the web! But has your ISP made similar preparations? What happens if these disruptions cause them to go out of business? Where will your net access come from then?

So far most people treat the oil shock like it is "the" crisis, but in truth it is only "a" crisis, one of many, and unfortunately it is the one that will multiply all the others. For example, we know consumers feel the shock to their budgets at the gas pump. But some at the same time will face rising mortgage payments from their subprime ARM loans. Maybe they could have handled one of these problems at a time, but not both at the same time.

Here's another one: if the honeybee die-off takes a heavy toll on America's crops, we get the double whammy of reduced supplies of food at the same time as higher costs to transport it. One or the other of those would have been bad enough, but both? The oil shock creates a multiplier effect on other problems.

Finally, what about our aging population? Younger people might be able to use bicycles instead of their cars, and they may well benefit from the extra exercise, but what about senior citizens? Is grandpa, who can barely walk up a flight of stairs, going to suddenly jump on a mountain bike and start pedaling 20 miles a day? I don't think so.

When I say we may outlive the Internet, I realize those are strong words. I do think that in the future there will still be computers -- for those who can afford them, at least -- and some of those computers will still be networked together. I suppose there will still be web pages, too, but there will be far fewer people reading them. The Internet as the powerful social and cultural force that we know today may be dead. Easy, frequent, reliable access to the Internet by huge numbers of people may be a thing of the past.

We will need other tools. And we will need some other form of entertainment, one that does not depend on electricity. Better start building those Thunderdomes.

[Update: July 7, 2008. It appears that there is now some evidence that the food supply is being impacted by the lack of honeybees.]

Monday, April 09, 2007

Club Sakura 2007


Here are some images from Club Sakura at Sakuracon 2007.



This one (above) was a 15 second time lapse shot.



Sunday, April 08, 2007

Sakuracon 2007 Cosplay

Here are a few more preview pictures from my Sakuracon 2007 coverage for JLHLS. Starting with the picture above, I really like it when cosplayers do cool poses like this one. This was not entirely a pose for the camera -- she was already sitting like this before I came over to take the photo.

This handmade samurai-style leather armor was incredible, made from thick leather plates it had a real feeling of substance. It was one of my favorites from the convention. This cosplayer told me he had worked on it for three years, on and off, and he learned how to make it by researching it on the internet.


This costume was made of a cool fluffy material that caught my eye right away. It had a natural look (well, as natural as neon blue can be anyway), like a real animal.

Stay tuned for more, I got a lot of good pictures from the convention, and I am writing an article about it for JLHLS.

Sakuracon 2007

I am in Seattle covering Sakuracon 2007 for JLHLS. I will post some preview images here in advance of my main article. These two cosplayers were having fun, and really getting into character. (They are dressed as Kei and Yuri from Dirty Pair.) I asked them to pose outdoors to get the city lights in the background and they agreed. Moments after I shot this picture it started raining, so our timing worked out well.

Saturday, March 24, 2007

The Manliest Purchase

Today I bought a chainsaw to cut up some fallen tree branches in my yard. I did not realize it until today, but apparently a chainsaw is the manliest, most impressive, sexiest thing you can buy. Other customers at the store looked at me in wide-eyed admiration, as if I were buying a jetpack or time machine. One guy told me, "wow, that looks serious!" The girl at the cash register smiled at me and explained that I was welcome to come by her place and help her with her yard.

I swaggered off towards the parking lot, grasping the chainsaw under one arm as if to say, "look, not only do I possess this extremely cool chainsaw, but with my huge muscles I can lift it with one hand as if it were a mere trifle, like a box full of feathers!" People look at you with more respect when you're carrying a chainsaw, even one that is still in the box. I think this must be what buying a Ferrari feels like, only much cheaper.

So I highly recommend buying a chainsaw, it is extremely fun. Buy one even if you don't need it. You can always return it the next day.

I told this story to my brother, and he immediately said I had ruined the effect by not also buying a hockey mask at the same time.

And that brings me to one of my brother's stories about buying things. He once told me that he went to Home Depot to get some caulk, and he couldn't find it, so he wandered around looking for it, getting more and more frustrated. I said, "why didn't you ask someone where it was?"

"Because I didn't want to have to say it," he said.

"Huh?" I thought about this for a bit before I caught his meaning. "Oh, I get it, you didn't want to have to say caulk out loud." I laughed. "That's silly. So what did you do?"

"I thought up another way to ask for it, so I called it that stuff that you use for sealing cracks. And it worked, they knew what I was talking about."

"But don't you think you're being a bit crazy? I mean, caulk is just what it's called. That's what everyone says. You're in a store, so they're not going to think you mean anything else."

"It's just really embarrassing," he said, "to have to tell some stranger that you want the caulk."

Sunday, March 04, 2007

Photomanipulations

Lately I've been doing some photomanipulation art using GIMP:
It is fun to find interesting stock photos on deviantART and then think up a way to make them into something more. Wake the Zombies was the trickiest to do, but Geisha Gunslinger is probably my favorite.