Why I love Gentoo

After doing an emerge world on an older box I get:

* Messages for package sys-libs/com_err-1.40.4:

* PLEASE PLEASE take note of this
* Please make *sure* to run revdep-rebuild now
* Certain things on your system may have linked against a
* different version of com_err -- those things need to be
* recompiled.  Sorry for the inconvenience

In other words, “This update is going to break your system. We kind of screwed up. Something changed. Here’s how to fix it.”

So now I don’t have to google around frantically trying to figure out why randomserviced is suddenly failing. And the Gentoo guys even apologize.

Honesty, transparency, and humility in software. Go figure.

Unscientific reviews of various (mostly PHP) web shopping carts

Some time back I did a review of various web shopping carts.  In particular I needed a cart into which we could integrate a minor, third-party payment processing system.  We also wanted something that had the following functionality:

  1. multi-currency
  2. multi-lingual
  3. registration management
  4. mailing list management

These are the carts that I found in the order they were discovered and reviewed.

APIs and Frameworks

Started on the assumption that we would want to build and manage our own shopping cart.  It quickly become apparent that a customizable stand-alone application would get us more functionality with less mucking around.

  • Webforce Cart
    Very simple shopping cart class.  After a quick review, decided that it would be better to use something inside a framework like Cake or Symfony.
  • sfShoppingCart
    Shopping cart module for Symfony.  Played around with this but quickly realized that, even in a framework, maintaining a custom cart would fairly troublesome for my simple needs.
  • phpShop
    Another simple, rails-esque cart.  Seems to be a framework built specifically for the shopping cart.  Would still probably use sfShoppingCart over this.
  • Quick.Cart
    Very nicely done, simple cart.  Installed and played around with it a bit.  Difficult to modify the layout; template updating problems.

Stand-Alone Applications
Lots and lots of apps out there.  I was surprised, however, to discover that many of them are branches of earlier code bases.

  • Nexternal Solutions “Ecommerce Shopping Cart”
    Aggressive Google advertising.  Ugly.  ASP-based.  No way.
  • osCommerce
    This has been around a long time; looked at this originally five years ago for another project.  Lots of web shops out there using osCommerce, but developers complain that it is difficult to integrate and maintain.   Admin interface looks like it needs work.
  • Zen Cart
    Fork of osCommerce and, now, possibly the most famous open source shopping cart solution.  Installed and mucked around with it.  Confusing, clumsy interface, though better than the osCommerce original.  Lots of complaints from developers.  Many recommend switching to CubeCart.
  • CRE Loaded
    Another Fork of osCommerce with a corporation behind it.   Nice marketing website.  Same poor admin interface.
  • osCMax
    Yet another fork of osCommerce with (maybe) Drupal integration.
  • xt:Commerce
    And yet another fork of osCommerce.  Corporate backing like CRE Loaded.  Seem to be pursuing global distribution; based out of Germany.  Spanish version on the way.
  • Miva Merchant
    Looks as though this might be the most “enterprise” of the shopping carts.  Starting price:  $995.00.  Pricey.
  • X-Cart
    Comparable to CubeCart but no free version.  Lots of complaints that cost of additional modules rapidly builds up.
  • AgoraCart
    Nasty green interface.
  • Squirrelcart
    Weird.
  • phpCart
    Looked great, but seems to have been replaced by PHP Super Cart which appears to be… even yet another fork of osCommerce.  Ugh.
  • CubeCart
    Good reviews.  Open source and very reasonable commercial models (one-time payment as opposed to recurring  licensing fees).   Easy to localize.  Good currency manager.  Stylesheet-based templates are a little awkward.  Very active development and fairly strong community support including skins and modules.

In the end we went with CubeCart.  So far it’s been “okay”.  Template organization is indeed haphazard; it can be difficult to figure out which templates apply to which step in the purchasing process.  Documentation is also fairly thin on the ground.  And though we paid for support, the replies that come back are fairly unsupportive.

Nevertheless, integrating the third party payment system was not too difficult.  I can recommend CubeCart.. with reservations.  Look around for your own alternatives and settle on this if it seems suitable.

Configuring Debian for UTF-8

Easier to configure than I thought it would be. The defacto document on this lists a series of convoluted steps to get UTF-8 working.  All you really need to do is as follows:

  1. Launch the local configurator via # dpkg-reconfigure locales
  2. Select the locales you would like to support. I need Japanese support so I selected ja_JP.EUC, ja_JP.UTF-8, and en_US.UTF-8 in addition to already available locales. Click “Ok”.
  3. Choose the default locale from the list; make sure it is a UTF-8 locale. Click “Ok”.
  4. Login to another shell.

That’s it!

# locale charmap should now return “UTF-8”.

Remote PHP Debugging with Emacs

It’s an Emacs weekend here at blog.arithm.

I was recently asked if it was possible to do remote PHP debugging with Emacs. We’re talking about Emacs, so the answer is:  Of course!  How to do it:

  1. Grab Tohru Fujinaka’s GEBEN library.  It’s an aging alpha release, but works fairly well.
  2. Make sure you also have CEDET installed.  I’m using the 1.0 pre4 release.
  3. Drop debugclient somewhere in your path.  (Here Emacs is running on Windows, so I just threw it into the C:\WINDOWS\ directory.)  Make sure the executable is named “debugclient” and not “debugclient-0.9.0” or whatever.
  4. If you’re using the standard xdebug port 9,000 (recommended), make sure that port is open on your firewall.  For most folks these days that means opening up the default OS firewall as well as forwarding a port from the router.  See the exceptional portforward.com for more information on router port forwarding specifics.

Now, assuming you already have xdebug plugged into PHP, modify php.ini or an .htaccess file with the following settings:

  • xdebug.remote_enable = true
  • xdebug.remote_handler = dbgp
  • xdebug.remote_host = your_client_ip

For security reasons it’s wiser to do this via .htaccess on directories that permit only authenticated access.

To debug, ask Emacs to listen for connections by going into GEBEN Mode with Meta-x geben. You should see “xdebug started.” in the status row at the bottom of the Emacs window.

Run your PHP script with the xdebug switch on, eg.

http://www.example.com/script.php?XDEBUG_SESSION_START

If everything is setup correctly, Emacs will load the source of script.php (be wary of security!) and allow you to step through the code.

Available commands are:

spc step into/step over
i   step into
o   step over
r   step out
b   set a breakpoint at a line
u   unset a breakpoint at a line
g   run
q   stop

Some gotchas: I’ve noticed the GEBEN expects the first keystroke to be “space”; often it will freeze otherwise.  GEBEN may also run into problems on certain session-related PHP commands.

Happy debugging!

Set Emacs’ HOME directory in Vista

Rather than allow Emacs to assume HOME is c:\ (which will cause Vista to winge every time you want to modify your .emacs file), try the following:

setx HOME "%USERPROFILE%"

This will make home something like c:\Users\username.

Now you can keep your .emacs in a far more rational place and not have to wake up the Vista security troll whenever you want to do some tweaking.

Undo in Emacs

There are a variety of ways to “undo” something in Emacs.  Unfortunately some of the keystrokes work in some environments, while others do not.  Here’s a quick rundown:

  1. Meta-x undo — Will undo only the most recent changes.  Cannot be used multiple times.
  2. Ctrl-x u — Undo.  Consecutive repetitions will undo earlier and earlier changes.
  3. Ctrl-_ or Ctrl-/ — Same as Ctrl-x u, however does not work in some envrionments.
  4. Ctrl-Shift-Minus — Same as Ctrl-x u, however does not work in some environments.

For whatever reason I can never remember the Ctrl-Shift-Minus sequence when I find myself in an environment where Ctrl-_ and Ctrl-/ don’t work.

Keep in mind that Emacs undo is a bit different from traditional undo:  Undo actions themselves are recorded as actions.  This can be confusing.

In some environments, Ctrl-x Ctrl-_ will reverse the order of undo.  I avoid this out of fear that it will cause the universe to implode.

See the Emacs info node for more good undo lore, such as how to use “selective undo” which restricts undo actions to changes performed in the current active region.  (Very useful.)

Shell: Fish

I have a new favorite shell: fish.

Fish is awesome for variety of reasons, but primarily because Fish:

  1. Emphasizes command and parameter discovery, as well as overall usage transparency with truly useful default settings, over tweakability.  (After all, who really has time to trick out the shell on every damn box you log into?)
  2. Has extremely powerful default tab completion and history search.
  3. Highlights syntax with pretty colors.
  4. Has multiline editing that actually works.
  5. Simplifies directory navigation.  (Aspects of which remind me of the old AmigaDOS CLI.)

Be sure to check out the fish change log for insight into recent-ish enhancements.  Some very cool though obscure features in fish.