Archive for June, 2011

Brazilian Jiu-Jitsu

Friday, June 24th, 2011

I’ve been practicing Brazilian Jiu-Jitsu at UCLA for the last few months. I’m so new I don’t even have the funny pajamas. And I always hurt after class. Today is no exception. I feel like I was hit by a truck.

Last night we were taught the twister roll! That should have been exciting, but my knee popped the first time my partner rolled me and I think that put a damper on the rest of my evening. It doesn’t hurt, and I can walk on it just fine, so I have no idea what happened in there.

The class meets in Wooden Training Center at UCLA, in the blue room. The mat (floor padding) in that room is covered with some very rough vinyl, so whenever you rub your skin against it, some of that skin is going to stay on the mat. I have a chunk of skin missing out of my right foot. Scraped off by the mat. Stingy!

This summer there are about 50 people in the class, and the room can only handle about 20 people comfortably. That means for most of the class, we’re standing around watching others do drills, or we’re trying to practice techniques in a tiny area while keeping a constant eye out for neighboring groups.

We’re two classes into the first summer session now, and I don’t feel like I’ve improved at anything. I’m up against vastly more experienced partners than in my beginner class last Spring, so they’re illustrating my lack of experience and technique. Hopefully some of theirs will rub off on me over the next couple months.

regular expression to check for prime numbers

Thursday, June 23rd, 2011

http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/

The way it works in checking if n is prime is to make n copies of some character. (The original article uses 1’s to confuse us with the \1 pattern match, so I’ll use “x” instead.) It first trivially checks for 0 or 1 of those (0 and 1 are not prime). Then it checks for (xx+?)\1+ which will iterate over successively minimal matches of two or more x’s, and then see if the remaining x’s can be matched by copies of that minimal match from the beginning. If it can be matched, the number was obviously not prime (we just divided it into some unknown number of equal segments). If it can’t be matched, it tries the next most minimal initial matching.

As an example, let’s take 15. We create the test pattern “xxxxxxxxxxxxxxx” and run it through its paces to see if it matches our composite pattern.

  • Does it match “” or “x”? Nope.
  • Does it match “xx”\1+? Hmm. “xx” “xx” “xx” “xx” “xx” “xx” “xx” “x” Nope!
  • Does it match “xxx”\1+? “xxx” “xxx” “xxx” “xxx” “xxx” YES! NOT PRIME!

If we used 17 instead, we’d never find any substring that could be repeated to match the rest of the pattern, and our match would fail, meaning that 17 is prime!

Racing Bruce Lee

Thursday, June 23rd, 2011

I dreamed I was racing Bruce Lee up a hill. There were a bunch of stairs separated by open spaces. Kind of like a terraced parking lot, or the stairs going up the hill at Pierce College. Anyway, Bruce Lee was faster than me, but my long legs let me catch my stride better on the stairs, so I’d be able to catch him and start to pass him on the stairs. But every time I got ahead of him, he’d reach out and pull me back while he pushed himself forward against me! So I started grabbing his arm and pulling him back while I pulled myself forward. We were laughing and grappling with each other all the way up the hill. Neither one of us got tired.

has it been that long already?

Tuesday, June 14th, 2011

Apparently I forgot how to post on here for a while. I’ve been condensing my thoughts into Facebook-style snippets, and that’s becoming unrewarding. I’m going to start posting here more regularly, I swear!