Also see the list of articles, none to be taken seriously.

Developer talk follows. XCode 4 removes the PowerPC compiler, breaking package installers that try to build universal libraries.

When building most Python packages that incorporate native code, setup fails with an error like the following:
> pip install keyring
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
    /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
    keyring/backends/osx_keychain.c:117: fatal error: error writing to -: Broken pipe
    compilation terminated.
    lipo: can't open input file: /var/tmp//cdXmPvrV.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1

That was from pip, but distutils, setuptools, easy_install, and "python setup.py install" should all fail with a similar error.

To fix it, tell the compiler explicitly not to bother with PowerPC. Prefix the build or installation command line with this:

ARCHFLAGS="-arch i386 -arch x86_64"
If the install command needs to start with sudo, insert the above bit of text immediately afterwards, like this:
sudo ARCHFLAGS="-arch i386 -arch x86_64" pip install keyring
If installation doesn’t need sudo (for instance, installing into a virtualenv), you can enter the following command line once and the effect will last across multiple builds or installations for the remainder of the terminal session.
export ARCHFLAGS="-arch i386 -arch x86_64"
Read and Post Comments

How (not) to write Factorial in Java will hit home for any software developer who’s had to deal with over-engineered code.

I’ve come to view layers of abstraction as costing technical rent. It’s a concept worth distinguishing from technical debt. Rather than pushing a cost into the future, technical rent involves paying a manageable up-front cost by building the abstraction in code, and then needing to pay a similar cost each time programmers revisit the code, by rebuilding the same abstraction in their heads.

The worst part is when the layer of abstraction is justified as an intervention against potential technical debt: a small cost now to avoid interest payments in the future. In reality, the small cost has to be paid over and over, even if it turns out that the requirements never change in the particular direction that the abstraction anticipates.

You could call it defensive abstraction. The logic hides several assumptions:

  1. The requirements in that area will change.
  2. The abstraction, out of all possible abstractions, will happen to be the right one to cover the change.
  3. Adding a new case to the abstraction is simpler than changing the caller(s).
  4. At that future time, the programmer will choose taking on technical debt over adding the abstraction as needed. (This mainly applies if the requirements can change while the callers can’t, the practical likelihood of which varies with the situation.)
  5. The mental cost of rebuilding the abstraction, paid repeatedly throughout the life of the codebase, is outweighed by the interest paid on the technical debt, paid only until it’s corrected.

Occasionally the abstraction does actually provide enough benefits to outweigh its future costs, but failure to recognize the existence of those costs leads to poor decisions.

[Expanded from a comment I made on Hacker News.]

Read and Post Comments

This ad has been gracing Rhode Islanders’ Facebook pages for the past few weeks as we come up to the election:

“Against taxing veteran amputees? Lincoln Chafee isn’t. Join the group that’s setting the record straight by clicking ‘Like’!”

So we’re being asked to click Like if we feel the record is wrong on Chafee being not against taxing amputees? Or, more simply, we’re supposed to click Like below the picture of Chafee if we like him? Or we’re supposed to click Like below the picture of Chafee if we actually dislike him, which we should realize because the picture is unflattering?

senatorchafee.com is actually an attack site against Chafee, so the answer must be that we’re supposed to click Like if we dislike him but like logic puzzles.

Presumably the list of people that clicked Like also includes people who like him regardless of how tightly cropped his face appears, along with people who aren’t good at logic puzzles, as well as people who are surprised at the implication that amputees should no longer be subject to any taxes.

So there’s basically no useful conclusion I can draw from the number of people who clicked Like.

Whenever I see empty political attack ads like this, I wonder if they’re secretly put on by the attacked party, in order to paint the opposition as desperate and manipulative while the attacked party gains some sympathy. But then I think some more and come to the unfortunate realization that it would backfire, so that’s not how it works.

Read and Post Comments

Amazon costume screenshot

This costume on Amazon recently caught my attention. The Deluxe version costs about $35. Upgrading to the Super Deluxe shown here costs an additional $19,975, though the pictures look identical.

Is this merely an error, or a diabolically extreme version of an old pricing strategy to make the Deluxe look like a good deal, lowering sales resistance?

Intentional or not, I’d be curious to see before-and-after sales data for the Deluxe to know whether it worked.

Putting items in the “Save for Later” cart is great for watching Amazon adjust prices: every time you open your shopping cart to buy something else, it details all the changes that have taken place. And most of the prices do change, almost every day. Sometimes the price on a particular item starts to drop steadily, a few dollars a day over several days, until it approximately matches the discounted prices competitors are offering at the time. Then it snaps back to regular price a few days later. Sometimes the motion is more complicated, presumably due to algorithms beyond my ken that adjust the price by pennies at a time.

It must be fun to run a store where you can do this kind of thing as an experiment.

Read and Post Comments

My silly hack, written and presented at Music Hack Day Boston 2010 last weekend.

 

1. A problem

For an increasing number of us, the same device we use to play music also handles email and GPS directions. Listen with me for a few moments of my drive.

2. A solution: “In 500 feet...”

Let’s throw a ridiculous amount of technology at it!

We analyze the phonemes of the speech and map each syllable to a MIDI note.

 

We’ll use Yamaha’s Vocaloid speech synthesizer available as part of the Canoris API to sing the GPS directions, overlaying the lyrics.

 

3. Another problem: “Keep going straight”

So now we’re listening to the Byrds.

As speech technology improves, this could get confusing.

 

4. Another solution: Musixmatch lyrics lookup

We’ll look for songs that contain “dangerous” phrases, and just not play them.

Python code listing

5. Technique

The current iteration required hand tweaking to get the timing right, but this is the roadmap:

Extract melody from channel 4 of karaoke MIDI file (.kar)

If no MIDI source available, synchronize syllables to Echo Nest beats, and use root of chord for corresponding timestamp from analysis.

In the future, the same technique could be used to change the lyrics for an entire song.

Stay tuned for more information and source code.

Read and Post Comments

Jeff presents Joomla! I present Drupal! The two web site frameworks go head to head at our next meetup this evening.

More info and RSVP form.

Read and Post Comments

If you’re going to be in the downtown Providence, RI area tomorrow, Thursday Sept. 13, please join us for the monthly Web Developer Lunch Hour meetup.

This time, my coworker Chris will demo Ruby on Rails.

Please RSVP [meetup.com].

Read and Post Comments

Check out the beta of the new RI Nexus site, full of news and resources about information techonology and digital media in Rhode Island.

I wrote some new Drupal modules to support it. Feedback and suggestions are welcome!

Read and Post Comments

Thanks to Noosphere Networks, I’m releasing a script that helps developers of web sites built with Drupal to maintain separate development/test and production sites, pushing changes from test to production as needed. This is challenging with a stock Drupal installation. Changes to PHP code are no problem, because it lives in the filesystem and can be copied or committed to a revision-control system like Subversion. But a lot of Drupal’s configuration work take place within its web administration interface and is saved to the database, where production content such as user accounts and comments is also stored.

The desire to do this frequently comes up on Drupal’s forums, and the typical workarounds have some large drawbacks (involving some combination of extended downtime on the production site, duplication of work, and the loss of content, comments, and user account changes made in the interim).

This small script attempts to solve that by categorizing Drupal’s tables and moving only the right ones at the right time, while handling details such as merging sequence numbers. It also dumps Drupal’s databases to disk in a format that works well for checkin to a revision control system.

This is free software, licensed under the GPL.

Theres a more ambitious project called AutoPilot that aims to do this and more in the future, but its ability to merge test sites into production without losing production content isn’t available yet, and I needed something now.

Be warned, though, that this is an alpha release, intended for those with familiarity with MySQL and Drupal’s table layout. If you have CCK fields, there may be some manual work required when you modify your field layout because CCK tends to change your database schema, and Migraine does not currently attempt to automate all of those changes. It will detect them and warn of the problem, however.

See more information at the Migraine project page.

Read and Post Comments

I’m holding the next PHP meetup for the RI area tomorrow evening (Tuesday) at Trinity Brewhouse in downtown Providence.

If you’d like to join us for free-form discussion of web development, PHP, and various types of beer, please RSVP.

Read and Post Comments

Next Page »