Wednesday, November 2, 2005

Party Tricks

This page is developing a life of its own. It's getting updated frequently with useless random information. I'm embracing the inevitable and intend to make it look like what it has become: a blog.

Geeky party tricks:
  1. The Doomsday Algorithm[Wikipedia article]: calculate the day of the week for any date instantly.
  2. Do Cube Roots of 9-digit Numbers in Your Head

Tuesday, November 1, 2005

Elements of Style

I had heard of William Strunk's Elements of Style long ago. I finally saw what all the fuss is about when I found this online HTML version of the book [alternate link].

Much of this 1918 work is still relevant today. I was surprised to find that many misused and/or hackneyed words and phrases have been around for many years.

When I write English, I borrow techniques I use to write code. I start with a syntactically correct body of text that gets the job done. I then revise and optimize: I reword, rephrase, replace and remove lines, aiming for clean, concise, efficient and effective writing.

The analogy isn't perfect. With prose, I'll throw in extra words if I like the way it sounds, but for code, I'll sacrifice style for performance.

Some of the rules in Elements of Style seem to achieve the same goals, though they are explained from a nonprogrammer's viewpoint!

Drums, Engines, Sudoku, Poker Chips, Dodecahedrons

Some links I don't want to forget:
  1. Drumkit implemented in Flash
  2. Animated Engines.
  3. Sudoku at Number-Logic.com: I've lost a lot of time here recently. I only recently discovered these frustrating puzzles, but according to the Wikipedia entry on Sudoku, they've been around since 1979.
  4. Poker chip tricks have also been eating up my time of late. Note there are different ways to do poker chips tricks.
  5. 12-sided calendar: print and construct your very own dodecahedral calendar.

Web Authoring Notes

My notes on creating web sites are slipshod and haphazard. This would be fine since I wrote them for myself, but it's getting to a point where even I'm having trouble wading through the chaos to find information I want.

I've started reorganizing that part of my site. Some of the material
is more suitable for a blog than a reference.

Thursday, October 20, 2005

HTML Notes

I switched the main website from HTML 4.01 Transitional to Strict. I can't remember why I chose to use transitional in the first place. The only deprecated HTML I had was an align attribute in an image tag.

Students in the CS105 class I'm TAing have asked about indenting using straight HTML. This reminded me of a page describing hacks to indent using HTML. (I'd use CSS to do it, but we don't expect them to know CSS well.)

Saturday, October 15, 2005

Rubik's Revenge

I bought a Rubik's Revenge (a 4x4x4 Rubik's Cube) a long time ago. I did figure out a solution, but it's extremely slow. The 3x3x3 method I learnt when I was a kid is also fairly inefficient.

I was curious how people speed things up for both types of cubes. After browsing for a bit, I've decided the approach best for me is:
  1. Reduce to 3x3x3 case as described by Chris Hardwick. Now standard Rubik's Cube algorithms can be used.

  2. Solve the cross.

  3. Solve the first two layers except for one corner piece. Originally I had planned to follow the "ZB" system, which has you solve the first two layers except for one corner piece and one adjacent edge piece, but this leads to numerous cases for step 2 of the system. For now, I'd rather sacrifice a few moves to get one more edge piece in place to cut down the number of cases for the next step.

  4. Perform step 2 of the ZB system to put the last first-layer corner piece in place while at the same time orienting the last-layer edges. They are the last few cases on this page. (I don't think I could ever memorize the entire ZB system. I lose a few turns putting the last middle-layer edge in place, but I only have to learn a small fraction of the cases.)

  5. Either orient the last layer ("OLL"), and then permute the last layer ("PLL"), or for more efficiency, achieve both goals simultaneously.
One of the above sites also points to a site with videos of people posessing an amazing amount of digital dexterity.

Friday, September 30, 2005

Virtual Hosting

I finally added the following to Apache's srm.conf
NameVirtualHost *

<VirtualHost *>
ServerName wingchun.stanford.edu
DocumentRoot /var/www/wingchun
</VirtualHost>

<VirtualHost *>
ServerName rooster.stanford.edu
DocumentRoot /var/www
</VirtualHost>
so now rooster.stanford.edu and wingchun.stanford.edu look like different sites. However, for reasons I don't understand yet, in order to get SSL working on my whole site, I had to add an extra DocumentRoot directive to the VirtualHost _default_:443 section needed by mod_ssl.

I reinstalled the mod_dav Apache module, this time to play with some calendar and bookmark applications. I used to have it running a long time ago (see Netcraft's history of this site).

Recently I've been exploring a frequently-changing list of interesting bookmarks, containing (among other things) links to ephemerally popular pages like how to turn your hamster into a fighting machine.