Archive for the ‘howto’ Category

Importing Drupal to WordPress

Tuesday, March 18th, 2008

Drupal is great software but is a bit much for a simple website, and it's small user base relative to WordPress makes it difficult to find high quality plug-ins. The final straw was that Drupal is really slow on my current host (Dreamhost) because it makes tons of database queries and Dreamhost keeps my database on a separate server to keep costs down.

I decided to switch to WordPress last night and managed to transfer all of the data in a couple hours of work. The key was this sql script to transfer everything, which is a little bit old and required installing WordPress 2.0, importing, and then upgrading to the latest version because they changed the table format in 2.2 or so. Now I'm just working on cleaning up some old posts that didn't transfer cleanly (no good wiki syntax in WordPress, I probably should have switched it awhile ago though) and am happy so far.

Building LayoutEditor on Leopard

Monday, February 18th, 2008

In order to build tiny things like circuits or MEMS you need to first design them. Typical software is something like L-Edit, which only runs on Windows and costs an arm and a leg. The other day I was looking around for a better option, one that was open source and cross-platform. Luckily I found LayoutEditor, which satisfied both of these requirements and runs great. However, the most recent Mac binary release is about 6 months old, so I've cobbled together some instructions for building the latest source yourself. It's pretty easy so bear with me.Here are instructions for building and installing the following on MacOSX 10.5:

  • QT
  • Freetype2
  • LayoutEditor (2008-02-05)

Here's what you need before you get started:

  • The latest developer tools, which are not installed by default but should be on your Leopard DVD or can be downloaded from Apple for free.
  • A little patience.

With that said, here's what you do:

  • Open /Applications/Utilities/ In the following instructions there are chunks of text that you will need to copy and paste into the terminal.
  • Download and install QT, a library used by LayoutEditor for cross-platform goodness. You can get a binary release from Double-click the installer and follow their instructions.
  • Install Freetype2
mkdir src
cd src
curl  -O
tar xzf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
sudo make install
sudo ln -s /usr/local/include/freetype2/freetype/ /usr/local/include/freetypecd ..
  • Download and build LayoutEditor
curl -O
tar xf layout-20080205.tar.bz2
cd layout
qmake -spec macx-g++
  • Install LayoutEditor
mv bin/ /Applications/
mv macros/ ~/Library/
mkdir ~/Library/Application\ Support/layout/
mv doc/ ~/Library/Application\ Support/layout
mv macros/ ~/Library/Application\ Support/layout

If you're curious, we needed to make the freetype symbolic link so that the build process would go smoothly. Then we needed to pass a few arguments to qmake so that it didn't try making a bunch of XCode projects and giving you errors. Finally, we moved the application and the docs/macros folders to their appropriate places.There you have it. You should be able to goto your applications folder and run layout now. Before you get started be sure to read the documentation, especially this primer.I've tested these instructions but if you have any errors or questions please let me know so that they can be updated.

Update (2/26/08)

If you get this error while building freetype

cd builds/unix;
checking build system type... i386-apple-darwin9.2.0
checking host system type... i386-apple-darwin9.2.0
checking target system type... i386-apple-darwin9.2.0
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** [setup] Error 77

that means that when you installed the developer tools you unchecked the "duplicate everything in /usr" option, which is key for building unix stuff. Reinstall the developer tools. (Thanks Nahid)

Update (8/21/08)

Jürgen, the insanely talented author of LayoutEditor, is now providing a precompiled Universal binary, so these instructions aren't strictly necessary unless you really want to build from source for one reason or another. I just used LayoutEditor to design a reticle using macros, which turned out to be incredibly efficient. Once I work out a few of the kinks in the overall process I'll write up some instructions to share.

Pick Wiki Software

Friday, January 18th, 2008

I currently use Mediawiki on a few different servers:my research group, a class I TA'ed for and it's related classes, and another research website or two. So I'm a big fan of it for certain sites. A wiki allows people to share data and allows people to put together decent looking pages by using the site skins. On the class site, it makes it easy for the other staff to post information and files without digging into any files and provides constant backups.

Other Options (Twiki and Drupal)

A few days ago I decided to look for wiki software capable of WYSIWYG editing. Mediawiki has a few options but nothing that is easy for end users. The one that really stood was TWiki, which had a WYSIWYG editor built-in and has hundreds of plug-ins. It uses a file system for data storage rather than a database (e.g. MySQL) like MediaWiki, which is nice for smaller installations. It also page-by-page permissions built-in, while MediaWiki requires a plug-in. On the other hand, the installation was much less straightforward and the massive number of options and required setup can be overwhelming, even for someone relatively experienced.

This was all great, and I started looking into transitioning our MediaWiki data over to it (there are plug-ins for that too). That's when I realized that TWiki has horrible syntax. And I mean really, really horrible; it is whitespace sensitive.

For example, to make a bulleted list you need " *" (three spaces then an asterisk) and for a sub-bullet you need six spaces and a bullet, etc. In MediaWiki it doesn't care about white space and is just a matter of *, **, *#*#, for bulleted and numbered lists. Then there are headers. Man, I don't even remember what TWiki used, something like "---+" and then more pluses or something. How am I going to explain that to people? And the WYSIWYG editor is only marginally better than the MediaWiki ones, in other words not usable.


I switched this website from Mediawiki to Drupal for about a year and then switched to WordPress because a blog engine just made more sense. Here's what I like about Drupal:

  • Many, many more modules for Drupal than Mediawiki.
  • A better organized development community; the software gets better faster.
  • Modules for integration with Gallery and anything else you could imagine.
  • Support for Mediawiki markup (the bright spot on Mediawiki).
  • Support for blogs/stream of thought updates.

In the end Drupal was too clunky to maintain for a simple website, although it would be good for more complex content management. Also I found it a bit slow, but that's just me.

Making Time

Tuesday, December 11th, 2007

Everybody should watch this talk by Randy Pausch. You should also watch his other recent talk because it's absolutely incredible. If you don't have time to watch it then it means that it is meant for you.

This American Life

Sunday, November 11th, 2007

If you enjoy listening to This American Life on NPR and don't find their weekly free podcast enough, here's a little script to download all of their old episodes. It probably isn't condoned, but I figure that if I had listened to the show from the start and taped them off of the radio they wouldn't have minded, so trying to charge listeners to dip into past shows seems pretty arbitrary. I'd rather just donate to NPR as a whole. I adapted some code from here so that it works on any system with python installed . Here are step-by-step instructions for MacOSX/Linux/whatever:

  1. Copy and paste the code below into a file called ''''''. Save it in your home directory.
  2. Start up the terminal (/Applications/Utilities/, type '''python''' and hit enter.
  3. All of the shows (up to #342) will be downloaded to your home folder. Shows #5 and #8 don't seem to exist.
#!/usr/bin/env python
from urllib import urlretrieve
import urllib2
for i in range(1,5) + range(6,8) + range(9,389):
urllib2.urlopen("" % i)
urlretrieve("" % i, "%d.mp3" % i)
print "Succesfully downloaded %d.mp3" % i

Update (Sept 12, 2009): I verified that the script still works and it goes up to episode #389 now.

In Your Computers, Tracking Your Thoughts

Tuesday, September 18th, 2007

The most valuable thing I got out of Google this summer was getting in the habit of writing down what I'm doing on a regular basis. At the end of each day (or each week), writing down what you've done and what you're going to do next makes taking the next step that much easier. About a year ago I tried keeping monthly snippets after reading some motivational piece in Science, but a month is just long enough to get you out of the groove and to lose track of things. Writing more frequently takes the emphasis away from big, grand thoughts and turns it more into a source of reference material.

With that in mind, I decided to setup a system for myself tonight. The first choice was desktop, web, or paper. I chose web because it's searchable, is easy to backup and is available from anywhere. First I checked out Backpack, but decided that paying for something when you can do just as good for free was silly.

With it narrowed down to free, open-source CMS systems I decided to go with a blogging setup because a daily post, single user format works better that way than with a wiki. The two main contenders then were WordPress and MovableType. I've used WordPress in the past so I installed it and tried it out for a few minutes until I read about a sweet iPhone interface for MovableType. The upshot of WordPress is that Dreamhost has a one-click install for it, but the slick iPhone setup could not be contained. Installing MovableType took just a few minutes, and a little .htaccess magic made it nicely hidden away. We'll see how it goes.

Beer Brewing

Sunday, March 18th, 2007

I've been brewing beer on a very irregular basis since the summer of 2002 and have made 7 batches thus far. Everything that I've learned has been based upon a few used books, friends and family and keeping meticulous records.

Why Brew Beer?

Jordan and I started brewing beer for two reasons. First, we had just graduated from high school and were not of legal drinking age yet. Second, good beer is expensive. A 12-pack of Sierra Nevada will set you back about the same amount in dollars and brewing seemed like a reasonable way to make any flavor of beer for the price of Pabst Blue Ribbon.

A more recent motivation to learn more about the basic processes involved is that (Saccharomyces cerevisiae) is the probably most intensely studied eucaryotic cell in history. It's genome composed of about 6000 genes was completely mapped in 1997 and there is plenty of information out there. There's also plenty of information about the yeast life cycle and ideal growth conditions. Brewing beer is just a practical application of insanely complicated biochemistry to create a tasty beverage and reduce your chance of scurvy.

Fermentation Temperature Control


Bottling has a much lower initial cost and time investment than kegging, however it will quickly become apparent that the investment in a good kegging system will pay for itself very quickly. Between the 2-4 hours required to setup and bottle 5 gallons of beer and the ongoing cost of replacement bottles for the ones that grew all kinds of interesting things, kegging is cheaper in the long run.

With that said, you will need the following to bottle one 5-gallon batch of homebrew:

  • (60) Relatively clean 12 oz. glass bottles (no screw-on caps)
  • (60) Bottle caps
  • (1) Hand-held bottle capper
  • (1) Beer filled glass carboy
  • (8 feet) 1/4" ID clear hose
  • (1) Bottling Tube
  • (1) Bottle scrubbing brush
  • (1 cup) Corn sugar
  1. Make the priming solution
    • Bring the corn sugar and 16 ounces of water to a boil. Stir until the sugar is dissolved. Cover, remove from heat and let cool until needed again.
  2. Sanitize the bottles, caps, bottling tube and clear hose
    • Fill a sink with cold water and iodine cleaning solution per the instructions on the bottle
    • Quickly scrub the insides of the bottles with your scrubbing brush to remove any grime
    • Place them upside down on paper towels and allow to dry as long as possible.
  3. Prepare for bottling
    • Place the carboy on a very high surface to generate enough surface for racking to the bottles.
    • Add the priming solution to the carboy. It will diffuse fairly uniformly by the time that you fill the bottles.
    • Place the clear tube in the carboy and lower to within 1-2" of the yeast sediment line
    • Attach the bottling tube to the clear hose, hold it above the carboy. Insert the valve side into your mouth and press with your tongue. Suck until enough beer is in the tube to start a siphon
    • Gather as many bottles as is convenient on the ground for easy access. Sit with them.
  4. Bottle!
    • Press the bottling tube to the bottom of a bottle and fill until the beer is at the very top of the bottle. The displacement of the bottling tube will correct the apparent fill level (Be sure to fill the bottles with enough beer, or else there will be excess oxygen in the bottles that will allow hearty aerobic bacteria to grow quickly and take over your beer more quickly than normal)
    • Bottle until all of the bottles are full or you run out of beer. Don't be afraid to leave a small amount of good beer in the carboy to minimize the amount of yeast that ends up in each bottle.
  5. Cap!
    • Carefully place the bottle caps on all of your bottles and then cap them. Once you get the technique down it should go fairly quickly.


Keeping it cold: Building a kegerator on the cheap.

to be continued...

Write your own Wedding Script

Sunday, March 18th, 2007

Our friend Andrew performed the ceremony at our wedding. We wrote up the script together beforehand using Writely. We wanted something to the point and the ceremony lasted about 7 minutes I think. Without further ado, here's the script:


Minister: Dearly beloved, we are gathered here together today to join together this man and this woman in holy matrimony. We are here to celebrate their union and to honor their commitment to one another. Today, J and C proclaim their love to the world and we rejoice with them.

In marriage, we give ourselves freely and generously into the hands of the one we love, and in doing so, each of us receives the love and trust of the other as our most precious gift. But even as that gift is shared by two people who are in love, it also touches the friends and family members who in various ways support and contribute to the relationship. All of you are J's and C’s community, and each of you has played some part in bringing them to this moment. This is why gathering as a community is such an important part of a wedding ceremony. J and C are now taking a new form as a married couple, and in this form, they become part of our community in a new way.

I'm proud to say that i am part of J and C's community, and have had the privilege of witnessing these two interact over the last three years. From the beginning it was evident that their relationship was somehow different than those of their peers; something about how they looked at each other, or the care and compassion that they showed for each other from the very beginning.

I recall one particular incident when the three of us were driving in a car together. It was after their second year in college and summer was just beginning. C was moving to her new apartment, and we were helping her move. I asked, why aren't you living together? It seemed like an obvious question. They both looked at each other and didn't have an answer for me. It seemed like they just hadn't thought about it. At that point, it was already obvious to me and probably many of you that they were meant for each other. And sure enough, they moved in together one year later. the following year they went to Yosemite for C's birthday and returned newly engaged. Hearing of their engagment was much the same as hearing that they had moved in together, it just seemed like it was inevitable

A vast, unknown future stretches out before you. The future, with its hopes and disappointments, its joys and its sorrows, is hidden from your eyes. But it is a great tribute to your belief in each other that you are willing to face those uncertainties together. May the pure, simple love with which you join hearts and hands today never fail, but grow deeper and surer with every year you spend together.

The Marriage Vows

J and C, we are here to remember and rejoice with you and to recount with one another that it is love that guides us on our path, and to celebrate as you begin this journey together. It is in this spirit that you have come here to today to exchange these vows.

Minister: (To the groom) J, do you take this woman to be thy wedded wife? To have and to hold from this day forward, for better or for worse, for richer, for poorer, in sickness and in health, to love and to cherish; from this day on so long as you both shall live?

Groom: I do.

Minister: (To the bride) C, do you take this man to be thy wedded husband? To have and to hold from this day forward, for better or for worse, for richer, for poorer, in sickness and in health, to love and to cherish; from this day on so long as you both shall live?

Bride: I do.

The Rings

Minister: The wedding ring is an unbroken circle symbolizing unending and everlasting love.

J, have you a token of your love for C?

(A hands Joey the ring)

Minister: C, have you a token of your love for J?

(M hands C the ring)

Minister: Traditionally, the passage to the status of husband and wife is marked by the exchange of rings. These rings are a symbol of the unbroken circle of love. Love freely given has no beginning and no end. Love freely given has no giver and no receiver - for each is the giver and each is the receiver. May these rings remind you always of the vows you have taken here today.

Minister: J place this ring on C's finger and repeat after me:

This ring, a gift for you, symbolizes my desire that you be my wife from this day forward.

Groom: (repeats)

Minister: C place this ring on J's finger and repeat after me:
This ring, a gift for you, symbolizes my wish that you be my husband from this day forward.

Bride: (repeats)


Minister: J and C, you have given and pledged your promises to each other, and have declared your everlasting love by giving and receiving rings. By the authority vested in me by the State of California, I now pronounce you husband and wife.

(To the groom) You may kiss the bride.


Minister: Ladies and Gentlemen, I present to you .

An RSVP Application in Ruby on Rails

Friday, March 9th, 2007

I wrote an RSVP program for our wedding in Ruby on Rails. It includes live search and editing using AJAX which was ridiculously easy with Rails. It also has a shadow table to which all changes are written in case one of your guests gets all drunk and uppity while signing up. Here is the source code, including the pretty graphics. Feel free to use it for anything and let me know if you find it useful.


The database schema is included. You can import it with:

mysql -u username dbname < schema.mysql

RSVP rails code and schema

Create a Nice Looking Skin for Mediawiki

Saturday, March 3rd, 2007

The default installation of MediaWiki is extremely functional but not too easy on the eyes. There are some nice examples of skins online. Particularly good looking examples are the Hula and Beagle projects. The Beagle guys are really nice and released their skin, which I used as an example for this website's previous incarnation. There were a couple of bugs on the Beagle skin that I fixed and simplified for this site.

In order to customize the skin you will need to walk through the code. Here's a brief description of the files.

  • Beagle.php: Specifies where everything fits together. If you want to move the navigation bar, eliminate the searchbar or enable Google Analytics this is the place to do it.
  • main.css: Specifies everything from text style, size and color to the look of the navigation bar.
  • logo.png: The Dogully tree logo up at the top of your screen
  • title_bg.png: The orange gradient that sits behind the logo. Specified in main.css