Dec 11 2008

CMS FAIL

Don\'t require what you\'ve already collected


Jun 23 2008

Drupal 7 Schema

For my own edification and to facilitate the addition of UUIDs to Drupal, I have used SchemaSpy to create an overview of Drupal’s database schema as generated by today’s HEAD.


Jun 23 2008

Generating UUIDs in PHP (for Drupal)

I have begun my quest to convert Drupal over to using UUIDs instead of IDs so that merging/branching drupal databases will be easier.

The first thing to figure out is how best to generate UUIDs in PHP. The naive pure-php approaches that use rand() have quickly proven to be non-viable (generating 10 of them hasn’t completed after several minutes), at least on my test virtual machine, presumably on account of running out of randomness.

The OSSP UUID module for PHP5 is much better, generating 60k “type 4″ (completely random) uuids per second. However, the memory usage grows the more UUIDs you generate, so that could be an issue. So despite the fact that this module implies a C module that has to be available to PHP, I’m going to use it.

I will try to keep my implementation open to creating UUIDs in the DB, as PostgreSQL uses the same library to create UUIDs, so no sense in reinventing the wheel. MySQL UUIDs are broken in any sort of replicated environment (in that you can get the same UUID repeatedly from a given SELECT UUID();) so I must have a language-level version available.

So now that I’ve elected to settle on the OSSP UUID module, I can take the next steps towards making it work in Drupal.


Jun 1 2008

Some Notes on Living in the Clouds

So I’m working on a steampunk-ish game that occurs in a gas giant – usual “colonization effort gone bad, descendants with primitive tech” sort of situation, except these folk actually have to stay afloat lest they be crushed to death by the pressure.

  • Humans can live at up to 60bar for at least a week; presumably, if you didn’t need to decompress them, they could live much longer.
  • Pressurizing quickly without changing the percentage oxygen is a recipe for dizziness, convulsion, and death.
  • Long term exposure to high pressure can cause bone death. Not clear whether this is on account of the lower % oxygen necessary or on account of the subjects being de/repressurized.
  • The clouds in a gas giant are quite possibly much akin to the atmosphere above 18th century london; full of soot, tarry particles, and metallized hydrocarbons. This is apparently on account of convection, precipitation, and evaporation, and ofc works better the hotter the gas giant.
  • Deeper layers (and potentially different bands) would see the precipitation of some pretty spiffy molecules, including diamond, apparently; good reason to risk your life “diving”.
  • While I have yet to find a really good excuse for a layer or band of CO2 enriched atmosphere, were there to be one, it could be much akin to venus’ atmosphere, including the sulfuric acid clouds. Soot filled sulfuric acid clouds sounds lovely, doesn’t it?
  • Looking into diving bells, I realized that if the colony ship was a big (think km in diameter) concave bell-shape (used to catch the light from solar-system based lasers until the Bussard ramjet can take over) then when the ship has to “land” in the the gas giant, it can serve as a giant diving bell containing enough O2 enriched atmosphere for a small city. Since the rocket nozzle would have to withstand hydrogen plasma accelerated to nearly the speed of light, it would be robust against at least a few bar of pressure.
  • Since victorian tech is not too good with the whole membrane thing, the kind of Scuba-style apparatus you’d need to hang out outside is kind of off-limits. If I posit some sort of mutualist parasite that provides O2 in exchange for nutrients, then I have an easy way of differentiating the “working class” from the elites who get to live in a controlled atmosphere their whole lives – it makes the infected literally “outsiders”.

Apr 3 2008

trivial NAT with virtual interface

I’m very spoiled by the virtual interface feature of Linux, and routinely have quite a few IP addresses associated with one virtual interface.

I’m building a cluster now, where all the machines have only private interfaces save one; obviously, I’d like the internal machines to be able to do their own updating, etc.

So I need to put in some sort of NAT. The problem is, iptables doesn’t recognize virtual interfaces, so you can’t NAT using the source/dest interface as your trigger. So here, then, is the simplest way I’ve found to set up SNAT on a virtual interface, assuming all your IP addresses are on eth0 and you are using a 10 network (in the example, 10.23.0.x) as your internal network:


cat 1 > /proc/sys/net/ipv4/ip_forward
iptables --table nat --append POSTROUTING -d !10.23.0.0/24 -j MASQUERADE


Jul 18 2007

y kant bash spel

so ok, if I typo and do “aptitude uipdate”, should it not know what I mean?

In the case that arguments or their values have a finite set of valid inputs, it seems like one could readily have the correct version printed as a “did you mean this? if so, press enter, if not, press n” instead of saying “unknown command”.

Maybe I can implement this – bash completion seems to do something similar already, so either this feature is available and I don’t know how to use it, or i can use its completion libraries to do the similarity search.


Apr 4 2007

mindsweeper prototype 0.1

If you have an OS X mac, it would be delightful of you to download this little simplistic “game” I wrote and tell me if it is playable for you. Update: The first version I uploaded was Intel-only. The current version is Universal, but that makes it 11mb, so I also created an intel-only version and a ppc-only version, which are about 7mb each. I also put up a web-applet version that requires the free Unity player; it’s only 1mb but I have no idea how big the player is :)
(Rules: use the arrow-keys to move the camera, click on any group of balls to make them go away, try to get rid of all the balls.)

If you want more balls (lots, I haven’t tuned it), hold down space bar for at least .5 sec.

Because the beads spawn really fast, the “setup” of the game might be very slow for you; please be patient, once the scene is built it should be playable even on a sub 1ghz g4. The main UI problem to be aware of at the moment is that you can’t click on beads in the back; you have to rotate the scene around until the beads are facing you (at least partially).

I am especially interested to hear:

  1. if it responds quickly to mouse clicks, even if everything moves slowly afterwards;
  2. if it ever makes beads disappear that should not (i.e. only touching beads of the same color should disappear).
  3. For the persistent, can you ever get rid of all the beads, or even get down to few enough that the bottom row has a permanent gap?
  4. Are there too many beads for “a level’s worth”? Too few?

This is going to eventually be a little puzzle game called mindsweeper. It plays at a fine pace for me on my MacBook Pro at 1400×900, but I’d be curious to know how it is for you. I would especially appreciate any crash reports. You are free to do whatever you want with the above-linked file with the obvious caveat that this software is distributed with no warranty or guarantee of any kind. If it eats your machine and sleeps with your sex partner of choice I cannot be held responsible.

Thanks for your help!


Nov 30 2006

Some thoughts on matrix-less graphs.

I’ve been lately thinking about graphs that have no matrix. An example of a matrix graph is the traditional planar coordinate plane you’re probably familiar with: the x,y graph where each element (vertex, in graph terminology) has an identity of two real numbers identifying its coordinate. Subsequently, to make this a graph, we draw lines (edges) in between points (vertices).

Usually, when graph theorists talk about graphs, there’s some explicit or implicit (e.g. they draw a picture of the graph on a piece of paper) coordinate plane. Having started to read through James Tauber’s excellent Poincaré Project I’ve got a clear idea of what a coordinate system (aka Metric Space is, now; it’s a set where every element of the set has a distance function that gives us a postive numerical value for any two elements of the set)
Without a matrix or coordinate system, there is no set of real numbers providing identity to a vertex.

Therefore, the only meaningful identity of a vertex in a matrix-free graph is its relationships.

We can consider a vertex to be a set of edges to other vertices; however, this suggests that every vertex would have to contain every other edge, becaue the set {vertex, vertex} that represents one edge would expand until it contained all the edges in the graph.

So it would be very helpful if each vertex had some identity, even if the identity isn’t something that can be mapped onto a matrix.

We’ll imagine that every vertex has an identity that can be represented as a binary sequence of arbitrary length.

Now we can store the {vertex,vertex} structure much more compactly; a given edge can be considered to be the symmetric difference (the XOR value) of the sequences.

If all of the vertex identities are unique, this suffices to uniquely represent a given state of connectivity.

However, the XOR value can be arbitrarily large, and so it would be better to find some guaranteed small value that still avoids collisions.

Furthermore, it leaves ‘edginess’ implicit; for the most part, edges between vertices have some meaning, whether it be ‘vertex is connected to vertex’ or ‘vertex occured before vertex’ or ‘vertex sucker punchced vertex at a kegger once’ so let’s further say that every edge also has an identity that can be represented as a binary sequence of arbitrary length.

Now we’re looking for compact representations of {vertex,edge,vertex} triplets. We can represent any triplet as a vector, and happily all the cool kids are into vector calculations these days.

Using a bloomier filter instead of a simple XOR should get rid of the arbitrary size problem of vector representation. I think I understand the general idea of bloomier filters, but Chazelle et al. use a lot of notation I find opaque at the moment.

An interesting question to me at the moment is the matter of distance functions. It’s one thing when we’re talking about simple spatial mapping, but I’m mostly curious about how to do spatial representations of nodes that are associated through qualitative or semi-quantitative relationships. A fairly straightforward example of this is the representation of a family tree; while there are ‘quantitative’ relationships (bob and jill begat jane, etc) there are also qualitative relationships (jill divorced bob) that need to be represented. There are other, more complicated qualitative relationships I’d like to graph, and in a perfect world I’d figure out some set of operations that could allow me to convert arbitrary qualitative relationships into some form of vaguely meaningful spatial relationships.

All of this is getting me exited about (one day) developing for the PS3; having all those vector processing units available would let me do some really expensive calculations – particularly ones where I need to consider the relative positions of a substantial portion of a set in order to represent them in an ordinal space (e.g. 3d) – and still give near real-time feedback to the user.


Oct 10 2006

PayPal and automated suspicion

So today I discover that, not only have I received a low winning bid on my auction of my old G5, but my PayPal account access was limited, because “We have observed activity in this account that is unusual or potentially high risk.” Initially, PayPal asked me to confirm my address and SSN, called me to be sure I was me, and made me provide a tracking number for the machine I’d shipped. I did so, providing PayPal with proof that I am the same meat person who has had an account with them for 6 years.

Here’s where it gets wierd. They decide I’m still suspicious: in fact, at this point Amber, a PayPal employee, suspects I stole the G5 I sold on ebay:

Please complete the steps below so that we may review your account further:

- Fax copies of the original bills of sale or invoices referencing your purchase or acquisition of the items you are selling along with the name and telephone number of your supplier(s)

If you are faxing information, you must use the cover page provided by PayPal. The cover page contains information specific to you and using it ensures that your documents are routed and handled in a timely manner. To print the cover page, log into your account and click on the fax documents link on the “Limited Account Access Details” page.

The best part about this email is that there is no fax documents link, nor any page with that title. (a case where an href is worth a hundred words.)
So now I have to dig up proof that the machine is mine, something slightly complicated by the fact that Vika bought it for me.

The main interesting bits here are:

  1. I was declared suspicious by an algorithm.
  2. The algorithm’s ‘reasoning’ is deliberately obfuscated from me.
  3. The human (Amber) who reviewed the case made the situation worse, not better, and demanded I follow impossible instructions.
  4. The human I called could do nothing save modify the page to show the link.

Between this, identity theft and no-fly lists, I’m feeling like we’re well on our way to computer mediated injustice, where algorithms will be judge, jury, and executioner, and the targets will be so random that no effective defence will be mounted.

Anyway, this really shows up my “PayPal is grand” perkiness of the past. I’ll use craigslist instead of ebay to sell anything else, and will try to avoid paypal if at all possible.

Weird, how pointlessly wrong one’s feelings about corporations can be. I had warm fuzzies about PayPal- they’d made my financial life much easier, in the past- but this frisking really blows it. It’s like someone you’d been casually seeing for a while turn paranoid and accusatory for no good reason.


Aug 5 2006

Xterminator: needful thing on mac

If you use X11 under os x, and are irritated by its default behaviour, you need the Xterminator. Xterminator lets you change the preferences of your X11 to make it more handy (launch on start, don’t show in dock, etc.)