Fish Tacos

Give someone a boiled peanut and tell them it’s a boiled peanut, they’ll be like, “This is disgusting”. Give that same person a boiled peanut and tell them it’s a bean that tastes peanuty, they’ll be like, “This is pretty good.” It’s sad that people are so mentally jailed by their own expectations.

Fish tacos are good unless:

  1. you don’t like fish
  2. you don’t like tacos
  3. you have mental impediment

We might also note that fish tacos are not the same kind of tacos you eat in a crispy corn shell with ground beef, lettuce, and shredded cheese, in case anyone doesn’t know. (I could see that being a little weird.) Fish tacos are actual Mexican tacos, which means fish, shredded veggies, a squeeze of lemon or lime, and a bit of salsa or avocado maybe, on soft corn tortillas. Lots of people who claim to hate fish tacos would love it if you threw the same ingredients on a bun and called it a fish sandwich, or if you serve it without the tortilla and call it fish slaw. Hell, if you serve you serve it with a tortilla, i.e., the exact same dish, and called it fish slaw.

Music and Notes

  • Language: C++
  • Platform: DOS
  • Licence: Public Domain

This is an early program I wrote in high school. It draws notes on the screen while playing them through the PC Speaker.

Ah, those were the days. Then, I wasn’t afraid to use reckless gotos, bit fields, or far pointers. I happily programmed the BIOS interrupts. The code looks surprisingly well organized and thought out, considering I wrote it a decade ago, although the indentation style is hideous.

Here it is, as is, along with a sample of Christmas music. It requires Borland Turbo C++ to compile (the early versions of which are now free). However, there’s a executable in the distribution.

Download Music and Notes:

Minor Software Packages

FCAP Minor Mode for Emacs

  • Language: Emacs Lisp
  • Platform: Emacs
  • Licence: Public Domain

This is a minor mode for Emacs that automatically capitalizes in Fortran 77, without needing to resort to CAPS LOCK. Also, it conveniently doesn’t capitalize inside strings and comments. I find it extremely helpful and never program in Fortran without it.

ftpupsync

  • Language: Python 2.1
  • Platform: Unix
  • Licence: Public Domain

This is a small script that can synchronize an FTP directory tree with a directory tree on the local disk. It does this by maintaining a catalog of everything it believes is on the FTP server; and updating the catalog whenever it updates the files on the server.

In this way, you can have a mirror of (for example) your website on your local disk, and whenever you make a change to the local mirror, you can run this script to update the pages on your server. It will make and remove directories as needed, and upload and remove files as needed. Only the new and changed files are uploaded. Renaming a file in the local mirror will usually result in that file being renamed on the server.

Unfortunately, it only works in one direction: independently changing a file on the server will not cause it to be downloaded to your local mirror.

I put this script on my web page because I think people will find it useful. However, it has a lot of loose ends untied. There’s no documentation; you’ll have to read the source to figure out how to use it. It won’t work on Windows as is, for it uses some Unix-specific calls, but it shouldn’t be hard to modify it so that it will. Finally, there is no built-in way to create the catalog. You’ll have to create the initial catalog yourself (maybe by modifying the script to just output a check file).

I still use this script to keep my static files up to date.

Papers I’ve Written for School

These are some academic papers I’ve written for school, all for Aerospace Engineering courses. Although none of these are genuine research, nor were any published in journals, I have encountered an occasional proceedings or business publication that cites the web version of these papers.

Searching for Lyapunov Functions using Genetic Progamming (PDF Version §)

Self-Tuning Control with Control Allocation (PDF Version †)

A Discussion of Methods of Real-Time Airplane Flight Simulation (PDF Version ‡, slightly modified from what I turned in)

Composite V-22 Blade Design

Helicopter Dynamic Stability

Boundaray Layers

The Hodograph Transformation

Project Asterius: Mission to Europa

Three months in Los Angeles without a car

It can be done.

Today I got my car back after two months in the shop after a month sitting in my garage unused (when I was too busy to attend to it). [1]

But I want to make it clear that good public transit was a big part of my decision where to move to where I live now (Santa Monica), and that my job is fortuitously right across from a bus terminal on the other end of the line. [2] In fact, I had been taking the bus to work for about a month before my car’s transmission started to go. Around the same time I had a big project at work that was nearing a deadline, and so I never got around to taking the car in for service till a month later.

So for that month and the next two, I took buses (and, in a couple cases, a train) everywhere. Granted, I don’t exactly have a vibrant social life, and I have a lot of the stores I need within a few blocks of my apartment. Also, I found that at no point did I have a need to hit anything like a Target [3], which would have been a pain. But the bus was able to get me where I needed to go: doctor’s appointments, destinations here and there, and downtown L.A.

So, the next time someone tells you it’s impossible to live in L.A. without a car, I am proof that it’s definitely possible.

Still, I’m really happy to finally have the car back. In fact, I was so happy I went to the supermarket and filled up a whole cart.

Footnotes:

[1] Two months in the shop was for three reasons, 1. I have a Saturn, and my repairs were covered under warranty, but there aren’t any Saturn dealers left near where I live, so I had to take it to a non-Saturn GM dealer, which means they had wait for parts to come in, 2. rather than ordering parts for both repairs I needed at the same time, they ordered the second set of parts after the first repairs, 3. the guy fixing my car took a one-week vacation where nothing was done, and 4. they didn’t call me when it was done so it sat finished for a week.

[2] Or was, rather. You knew that as soon as I found such an arrangement my company was going to find a way to mess it up. Soon after I moved, they moved my desk to a building two miles down the road. But since all my work remains in my old building, I work in that old building in a lab, for now.

[3] At least not until two days before I got the car back.

Time to watch the Simpsons

This fall, I’ve decided to do something I haven’t done in more than ten years: I’m going to watch a full (all-new) episode of the Simpsons.

I distinctly remember the last time I saw the Simpsons: it was 1999 and I was in a Penn State dining hall. It was the one where Mr. Burns masqueraded as a doped-up alien.

When I was at Penn State, the Simpsons was the show. If the Simpsons was on any channel in the lineup back then, every public TV would be showing it (the only exceptions to the rule being football games and this movie). And since I had to eat, and since the dining halls had public TVs, I ended up seeing it pretty often.

Back then I expected maybe three or four more years out of the Simpsons, since it clearly wasn’t as good as it had been in the early 90s. At some point I probably uttered something under my breath like, “I’m never watching the Simpons again. Well maybe if it’s still on ten years from now (yeah right) I give it another try.”

I don’t know if I uttered those exact words, but it has been ten years, it’s still on, and so I will give it another try.

Looks like seasons typically start around the end of September. I will keep this blog post updated.


Update:

I watched the Simpsons on October 3, 2010; first time I watched a full episode in more than a decade. Because I haven’t watched it in so long, I am uniquely qualified to assess how well the show is now compared to how it was ten or more years ago, since I am not biased by ten years of new shows in between. Admittedly this is a small sample size, but here’s my verdict:

No, it’s not as good. The Simpsons characters always seemed to be stereotypes to me and not real people, but now they seem to be nothing more than substrates to carry jokes. Nothing remotely made me go, “Ha, that’s so Homer” or “That’s so Bart”, but I had lots of “Marge being Marge again” moments.

And the show is still using the same old storylines. I’m not sure if I happened to watch the first episode in ten years implying a Lisa/Nelson romance, or if it’s a running thing.

Nevertheless I did chuckle a few times, meaning it’s still better than a lot of shows out there.

Nickling and Diming

One of the main complaints consumers have is about companies who “nickle and dime” them all the time, meaning that they charge small fees for a bunch of things that aren’t part of the up-front, advertised cost. Airlines charge fees for baggage, food, and earphones that aren’t part of the ticket prices. Banks and credit cards charge all sorts of financing and usage feeds. Hotels charge for extra blankets. And so on.

Personally, I say bring it on.

First of all, we have to address a common myth. People think that companies resort to nickling and diming in order to squeeze out every little bit of profit they can, no matter how petty. Although it’s true that the goal of nickling and diming is to increase profits, the idea isn’t to profit directly off of petty things.

The fact is, these companies already know how much money to charge so as to maximize their profit margin (or, for airlines, to minimize their losses). Nickling and diming customers will acutally reduce their margins, unless the price increase is offset by a lower base price. And that is exactly what the real purpose of nickling and diming is: to allow those companies to charge less money for their basic service while maintaining their margins.

“But isn’t that false marketing?” you ask.

Well, yes, sometimes it is, when the fee is unavoidable. But here’s the thing: most nickle and dime fees aren’t unavoidable. They’re mostly for add-ons: optional amenities on top of the basic service.

Personally, I hardly ever use these optional amenities, and I’m rather happy to know I’m not subsidizing other customers’ usage. In fact, I sometime rue how many amenities the basic service includes, thinking how many dollars I could have saved if I didn’t have to subsidize those amenities for other customers (especially in hotels). And, when I do use optional services, I’m happy to pay for my own consumption, rather than burden other customers with it. The sword cuts both ways for me.

I don’t deny that the actual economics is more complicated than I’ve presented here, nor that there are many shady uses for the “hidden fee”. But the bottom line is, most of the time, nickling and diming customers reduces my price. So I say, more nickling and diming.

Nonfiction Book Title Rules

Nonfiction is one of the most popular genres of books sold today. It’s also the genre with the absolute least amount of imagination when it comes to book titles. In fact, all nonfiction titles follow five basic rules.


Rule 1: All nonfiction books must have both a title and subtitle.

There are no exceptions to this rule. All nonfiction, every single book ever published, adheres to this rule.

Rule 2: The title will be in one of these three forms:

1. <single_proper_noun_or_name>

2. <optional_definite_article> <option_proper_noun> <noun> <preposition> the <noun_phrase>

3. <adjective> <plural_or_collective_noun>

Rule 3: The subtitle will be in one of these five forms:

1. A <adjective> Look at the World of <noun> in <optional location>

2. The Story/Untold Story/Tragedy/Triumph/Defeat/Victory/Lessons of the <optional_proper_noun> <noun> in <optional_location>

3. How the <proper_noun> Expedition/Voyage/Incident/Experiment/War <optional_prepositional_phrase> Changed the World/Ended Slavery/Is Destroying America

4. A Journey into <abstract_place>

5. The Day/Night/Hour <something_bad_happened>

Rule 4: Only the subtitle is allowed to identify the book’s contents.

The title alone should never, ever be sufficient to allow someone to guess what the book is about. Preferrably, the title shouldn’t have anything to do with the contents except in the most abstract, metaphorical sense.

Rule 5: The word “secret” may appear anywhere in the title or subtitle even if it violates Rules 2 and 3.


That’s it: these five rules are sufficient to cover the title of all nonfiction books ever published. Let’s take a look at some examples of valid titles.

  • Great Bass: A Comprehensive Look at the World of Fly-Fishing in Steamboat Springs, Colorado
  • Dark Valleys: The Untold Story of the Fall of the Amazon Hunter
  • Men of the Tundra: How the Chadwick Expedition Changed the World
  • The Pendregoth Scandal: A Journey into the Secret Dark Mind of Barry Goodfellow
  • Frozen Blankets: The Night the Cold Came to Okruk
  • Bronze Rain: Lessons of the Ambush in Chicketaw Valley
  • Broken Eggshells: How the War of America’s Youth on our Police Force is Destroying America
  • Thomas Jefferson: A Journey into the Secret Life of the Slaves at Monticello
  • Secret Sailors of the Silent Service: How the Bluefin Voyage Changed the World

HTML Redemption Language

  • Language: Python
  • License: BSD-style

HTML Redemption Language, or HRL for short, is an HTML-preprocessor. It’s basically a macro package, with built-in Python scripting. It redeems HTML by adding useful tags such as <include>, <macro>, <if>, and <python>. The last tag allows the web site designer to embed Python “scriptlets” in the HRL source to perform complex preprocessing tasks.

HRL is a preprocessor, designed to be invoked manually by the user to generate the web site. It is not fast enough to generate web pages on the fly. HRL is based on an ancient package called hsc.

Documentation

The file doc/manual.html in the distribution contains the documentation for HRL.

Here is a very simple example of what HRL can do. In document.hri:


<macro name="document" req="title" container>
  <html>
    <head>
      <title><e val="((title))"></title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
      <h1><e val="((title))"></h1>
      <content>
    </body>
  </html>
</macro>

In index.hrl:


<include file="document.hri">
<document title="My Home Page">
  Hi! this is my web page! <p>
  <python>
    from time import time, ctime
    hrl.doc.write ('Page last generated on ' + ctime(time())
                   + '.<br>')
  </python>
</document>

What happens here is the file document.hri defines a macro, <document>, that encapsulates the whole web page. The file index.hrl includes document.hri, then uses the <document> macro in lieu of <html><head><body>. In the output, the content of the <document> tag gets inserted into the macro definition where the <content> tag appears. Any other file could also include document.hri and use the <document> macro. This makes it easy to maintain a consistent style across many web pages.

Also, note the Python script that prints out the time the page was generated.

Yet HRL is far more powerful than this simple example demonstrates. For instance, you can do things such as nesting <python> tags inside of <macro> definitions, allowing you to write very powerful macros, and add hooks that can change and modify regular HTML tags. In addition, HRL has useful features such as decimating whitespace and replacing entities. See doc/manual.html for more details.

Almost all web pages on my site were generated using HRL, using these very advanced features.

Downloads

HRL is licensed under a BSD-style license. The current version is 0.5, released May 11, 2006.

Status

As of July 4, 2010, I’ve jumped on the dynamic web content bandwagon for my web sites. I no longer use HRL to generate my web sites, and so I’ve officially discontinued work on it.

For web templating, I now use Mako. Mako has all the features that I wanted when I first designed HRL, and is fast enough to be used for dynamic content. If Mako had been around ten years ago I probably wouldn’t have written HRL.

Dice3DS

  • Language: Python
  • License: BSD-style
  • Platform: Windows, Linux, Mac

Dice3DS is a set of Python modules for dealing with 3D Studio format files. I have released it under the terms of a BSD-style license.

3D Studio is a 3D graphics modeling and rendering program that saved it images in a rather simple binary file format known as 3DS format. Although 3D Studio has not released the details of the 3DS format, it has been reverse engineered by some ambitious people, and I used the information to write Dice3DS, a Python package that slices and dices 3DS files.

Dice3DS requires Python 2.6, and numpy 1.1.0. (Earlier versions of Python, going back to 2.2, might still work but are no longer officially supported.) The view3ds script additionally requires any or all of PIL, PyOpenGL 3, PyGame, and Pyglet. PIL and PyOpenGL is enough for most cases.

Examples

Here is an example of creating a 3DS file from scratch, and writing it to output. In the snippet, pointarray is a n-by-3 numpy array listing vertex coordinates, and facearray is an m-by-3 listing of point indices making up a face.


from Dice3DS import dom3ds
import numpy

def output_model(facearray,pointarray,filename):

    n = len(pointarray)
    m = len(facearray)

    # First, add a fourth column to facearray for the face flags.
    # Dice3DS pretty much ignores these flags, but they're required by
    # the 3DS format.

    padfacearray = numpy.zeros((n,4),numpy.uint32)
    padfacearray[:,:3] = facearray
    padfacearray[:,3] = 7

    # Create a smoothing group array.  When the whole model is to be
    # smooth, it is appropriate to set the array to all ones.

    smoothing = numpy.ones(m,numpy.uint32)

    # Create an N_TRI_OBJECT, which is basically a big list of
    # triangles.  This object lists the vertices, faces, smoothing
    # groups, and the transformation matrix, which is set to identity.
    #
    # Note that you can initialize a 3DS chunk in one of two ways: by
    # passing keyword arguments to its constructor, or assigning
    # attributes.

    obj = dom3ds.N_TRI_OBJECT()
    obj.points = dom3ds.POINT_ARRAY(npoints=n,array=pointarray)
    obj.faces = dom3ds.FACE_ARRAY(nfaces=m,array=padfacearray)
    obj.faces.smoothing = dom3ds.SMOOTH_GROUP(array=smoothing)
    obj.matrix = dom3ds.MESH_MATRIX(array=numpy.identity(4,numpy.float32))

    # Create a named object.  Give it the name OBJECT, and set its
    # object to the N_TRI_OBJECT created above.

    nobj = dom3ds.NAMED_OBJECT(name="OBJECT",obj=obj)

    # Now, create the stuff that appears in every (or almost every)
    # 3DS file.

    dom = dom3ds.M3DMAGIC()
    dom.version = dom3ds.M3D_VERSION(number=3)
    dom.mdata = dom3ds.MDATA()
    dom.mdata.scale = dom3ds.MASTER_SCALE(value=1.0)
    dom.mdata.objects = [ nobj ]

    # Output the 3DS file

    dom3ds.write_3ds_file(filename,dom)

Scripts

Dice3DS provides is two scripts, dump3ds and view3ds:

  • dump3ds dumps the a 3DS file to output in human-readable form.
  • view3ds is a simple 3DS model viewer.

Downloads

Dice3DS is licensed under a BSD-style license.

Version 0.13 is the most recent version, released 5 October 2010.

If you do Subversion you can get the latest updates here:

Links

Here are links to the homepages of the libraries used by Dice3DS:

Here are some links to other libraries and information about the 3DS file format:

About the name

I originally was going to call it Utility3DS or Util3DS. (Lib3DS was taken, and Py3DS is just lame, as all Py* names are). However, Utility is a boring and aesthetically unpleasing name, and didn’t sound right. (I couldn’t call it 3DSUtil because it needed to be a legal Python symbol.

So, I decided to name it Dice3DS in honor the famous cliche “It slices, it dices!” Definitely cooler and more euphonic than Util3DS.

Frontier Theme