Some UNIX on Mac OS X Resources

Following up on the idea of configuring Apache with virtual hosts on your own computer, you will probably need to install some extra software to more closely resemble your web host.

So after spending some time with this and my PowerBook this weekend, I have a few key Mac websites, mostly about installing various UNIX programs in OS X. (You’ll need Xcode installed for much of this.)

Marc Liyanage’s site is the place to go for updating your PHP, information on installing MySQL, and ImageMagick.

Comprehensive Perl Archive Network (CPAN) has every Perl module you’d ever want or need. Mac OS X 10.3 ships with the cpan installer. Just type “sudo cpan” at your Terminal prompt and follow the initial setup procedure. After that, most modules can be installed with a simple “install module::name”. If you’re trying to install DBD::mysql because for example you’re trying to setup Movable Type with MySQL, TruerWords has the information you need. Or if you’d rather go the Mac installer route, there’s this.

Fink of course is the program that everyone talks about for installing UNIX software on your Mac. There are lots of pre-compiled binaries ready to go. It’s very easy to use. I am a bit annoyed that it puts things in /sw/bin. Call me a purest, but I like /usr/local/bin better.

Even though it offers 4000+ packages I found several that I was hoping to use that it didn’t have. Screen, jhead, and jpegtran were either not included or listed as being unstable and only available as source. That’s why after a bit a poking around I found what I think might be a better thing:

DarwinPorts seems very cool. I have not used this yet but on initial examination it passed several of my tests. Even though it only has 1700+ packages it did have the 3 that I was looking for. In most cases, the versions on DarwinPorts are newer than the version on Fink. It also looks like I can install these in /usr/local/bin. (To be fair, there’s probably a way to get Fink to install in /usr/local/bin as well.)

I’m seriously considering deleting Fink and going with DarwinPorts.

Local Virtual Hosts For Development

This is brilliant. Setting up Apache with virtual hosts on a local machine that mirrors a live server is a great idea for development. I’ve always setup other directories on the server, not accessible unless you knew what URL to enter. But with this method you wouldn’t even have to be online all the time.

I could take my laptop and sit out in the park and work. Actually, now that I think about it…

Installing J2ME Software On Your Cellphone

Ever gone to a website with your cellphone and had trouble installing the J2ME (Java 2 Micro Edition) software from there? Do you find that it’s much easier to download the files on your computer?

Here’s an easy way to fix that:

You’ll either need access to your own website on the internet or you’ll have to turn on the web server that’s probably already installed on your computer if you’re using the lastest system software like Mac OS X or Windows XP.

  1. Create a directory on your website for your J2ME software. You can call it whatever you like. The simpler the better. Something like “/j2me” might be good.
  2. If you don’t have a .htaccess file in the root level of your website, create one with a text editor.
  3. Add these MIME types to your .htaccess file:
    AddType text/ jad
    AddType application/java-archive jar
  4. Enter the URL for your website and new J2ME directory in your cellphone and save it as a bookmark. Probably something like “” for a server on the internet or “” for a local server on your own computer. Obviously “” and “” should be the name of your website or your IP address.

Then when you find J2ME software on the web that you want to install on your phone all you need to do is this:

  1. Download the J2ME application .jar file and it’s descriptor .jad file to your computer.
  2. Open the .jad file with a text editor.
  3. Make sure the line MIDlet-Jar-URL: is simply AppFilename.jar. Or whatever the .jar file is called.
  4. Upload the two files into the J2ME directory of your website.
  5. Surf to that directory with your cellphone by selecting the bookmark you setup.
  6. Select the .jad file from the directory listing to download it and install your J2ME software.

On The Job

Since I’ve been busy with work I’ll keep it simple with some more pictures:


That is Robert's banana.

"And over here you'll see more big buildings."

Mix magic.

I still need to figure out a way to get these images to automatically display in a sidebar in Movable Type from my album in Gallery. Anyone have any good ideas? I’m figuring it’s going to have to be with PHP. I was at first hoping I could do it with the new RSS feature of Gallery 1.4.4 but it simply posts info about the entire album when it’s updated. It isn’t actually a “latest images” feed. My other idea is parsing the .dat files themselves in the album. But that’s going to require me to learn some PHP. If anyone can help with this I would be mucho apreciado.

Brandon has an excellent MT plugin called Photo Gallery that is really easy to use. Unfortunately since it does use MT tags and MT uses static pages right now, it doesn’t update with new images as I post them. I would have to trigger a rebuild every time a new photo wound up in my album.

For Whom The Coffee Breaks

I’m helping out a new show. Tomorrow we are going to do a temp mix on a couple of reels so that a studio executive can give notes over the weekend. Unfortunately the first reel just showed up this morning and the I haven’t seen the second one yet. Might be a late night.

It’s super secret but I smuggled this picture out. 😉

Secret Picture

Sucks To Be You

I run a lot of different pieces of software to try and figure out what’s going on with my website. gave me the choice of Webalizer or Analog. Plus I’ve got Sitemeter and ExtremeTracking javascripts loading at the bottom of the pages. Not to mention my Refer page. Maybe it’s overkill but this site is still in the “building” stage. How do most people find my site? Who are my return visitors? What pages are the most popular? That kind of thing.

So when I was checking out my stats for the first two days of August I was annoyed to find forum avatar leechers—people who had directly linked to the images on my site for display on another site instead of downloading them and providing them on their own. It’s just rude. They are eating my bandwidth. Not enough to cause me overage trouble but it’s still shows a complete disregard for me. Basically every ISP on the planet gives out a bit of webspace with your account. Not to mention the tons of free places. How hard is it to save that image to the desktop and upload it to your own server?

Plus it totally blows away my legitimate tracking. Especially when people use them as forum avatars on popular sites. (And when they post alot.) One girl in Australia who was linking to a picture of Barbarella from my old Right Turn Clyde site managed to rack up 2200 hits on that picture in 2 days! And some guy in Italy had 1000 hits on a picture of The Donnas from that old site of mine. Of course those rocket to the top of all the lists in my tracking knocking out stuff that I really want to know about.

So I decided to get even using Apache’s nifty little mod_rewrite:

I added this to my .htaccess file:

RewriteEngine On

RewriteCond %{HTTP_REFERER} ^* [NC]
RewriteRule .*barbarella.jpg$ /images/i_steal_bandwidth.gif

RewriteCond %{HTTP_REFERER} ^* [NC]
RewriteRule .*donnas5.jpg$ /images/i_steal_bandwidth.gif

So now Ms. Australia looks like this:

Barbarella Steals Bandwidth

And this guy is so bad-ass I almost crapped myself:

Toro Steals Bandwidth

You can find lots of solutions on websites to block all image requests that don’t come from your own site, but I use my site to serve images and files for lots of different things—my own forum avatars on numerous sites, example screenshots for software that I beta test, etc. It would be a real pain to have to continually go in and add new sites for access. So I set this up to just block those two. Of course there are others leeching from me. But those were the worst.

And of course this solution doesn’t solve my tracking problem. But revenge can be sweet. I’ll block them totally in a week or two:

RewriteEngine On

RewriteCond %{HTTP_REFERER} ^* [NC]
RewriteRule .*(jpg|JPG|gif|GIF)$ - [F]

RewriteCond %{HTTP_REFERER} ^* [NC]
RewriteRule .*(jpg|JPG|gif|GIF)$ - [F]

Henchman Inventory and Battle AI v1.03

The new version of Tony K’s henchmen smartening, monster toughening, inventory improving add-on to Neverwinter Nights is available. I just finished up putting together the Mac installer. Windows version here.

Here’s some more info for the uninitiated:

This highly configurable modification of NWN improves the intelligence of friends and foes, both inside and outside battle. Since its original release in July 2002, it has been tested by hundreds of people in the BioWare community. The mod works with or without the expansions. You can use it to play the Official, SoU, and HotU campaigns, as well as compatible fan-made modules. Prominent features are: 1) Improved battle tactics for all NPCs, especially with regard to weapon switching and spell casting; 2) Random roaming capability for monsters in the module; 3) Access to the inventory of familiars and animal companions; 4) Improved yet still legal feats and spell selection for the six standard OC henchmen; 5) More useful behavior (buffing, item-gathering) for henchmen outside battle. Most features can be turned on or off during installation.

New for v1.03: Improved beholder and mind flayer AI. Better check if creatures can use items. Changed weapon equip routines to work better with dual weapons. Fixed problems with area effect spells and AI checking saves. Fixed problem with auto unlock and henchman saying they can’t do it when they can open the lock. Fixed don’t summon flag not being copied in original OC during level up. Low level associates are now buffed from the buff all dialog option. Turned off monster wander in Luskan tower level one to prevent them fighting each other. Check readme for details.

Phuture Phreaks

Since I’ve been on the subject of cellphones recently:

Here’s the one for l33+ h4x0rz with m4d sk1llz, the Motorola A780. It’s supposed to be coming out at the end of the year. It supports IMAP4 and POP3 email and WAP2, WML, XHTML and HTML web browsing. Supports the EDGE network. Plays MP3s, WAVs, WMAs and AACs. Has a camera, SyncML, pretty much everything you’d want. And it runs Linux! All it needs is a little QWERTY keyboard and you’d be totally set.

A Bit About Gallery Photo Moblogging

It turns out that the email to Gallery gateway that I set up was uglier than I thought. I would strongly recommend not using these scripts to post photos from your camera phone to a webpage. I thought it was just that my implementation of procmail was bad because I didn’t really know what I was doing. Well it was bad, but the scripts aren’t very good either. At least the one isn’t. I’m still learning Perl so I only have a bit of an idea of what’s going on, but it definitely does a few bad things. I would stay away from it unless you’re willing to rewrite some sections. The parsing of the mime attachments is the real culprit. It decodes the mime attachment and reads the raw data into a new file and generates a random name for it with a .gif extension instead of looking at the actual name of the attached file.

This is a much better way to do it. You’ll need to learn a bit about procmail—though you have to do it with those bad scripts above anyway. Instead of the flakey script, you use the nice Unix C-program ripMIME., my hosting service, does an amazing job of having many, many programs pre-installed on all their servers. If you look at the list of Perl modules they have installed, it’s staggering. Or at least I think it is. Maybe those are standard on most web servers. I don’t know. Anyway, they already had ripMIME installed so I didn’t have to compile it myself.

Infinite Ink has an amazing starting guide to procmail. I’m certainly no expert now but it taught me enough to set up a couple of proper recipes on a special Gallery gateway email address I created to send pictures from my phone and have them posted to my Gallery webpage. This article by Zig, and this one by Phil, have some nice specifics about dealing with the Qmail mail transfer agent on and interfacing it with procmail. There’s also a ton of information here at PairUsers—not only about email but pretty much every aspect of anything you might want to do with your website.

This is a simplified version of the ~/.procmailrc file that I setup to handle the email to Gallery gateway:


# prevent qmail (the program that is calling procmail
# as a filter) from delivering the original mail. We'll
# handle all delivery from here, thankyouverymuch.

# This is for support of the virtual mailboxes on
# The $MYACCOUNT variable is sent to Procmail when it is envoked from Qmail.
# You need to change "my_account" and "" to your own.

#### End Variables section; Begin Processing section ####  

# This is setup for virtual mailboxes on
# You need to change ""
# and "phoneemailaddress" and "http://gallery" and "uname" and
# "pwd" and "album". Also change path to "".
* ^Delivered-To:.*
* ^Content-Type:.*multipart/mixed
* ^From:.*phoneemailaddress
| ripmime -i - -d $HOME/tempdir/ --syslog_on --no_nameless &&
  ./ -l http://gallery -u uname -p pwd -a album $HOME/tempdir/* &&
  rm $HOME/tempdir/*

# If email comes in for mygatewayemail and it doesn't match any of the
# rules above, trash it.
* ^Delivered-To:.*

As it exists right now, it will only really work for accounts if you swap out the placeholders I mention in the comments for your own information. Unless there are other web space providers who set up their mail like Pair does. It seems a little unique to me. But the basic idea is there for people at other places. I strongly suggest you go through Infinte Ink’s quick start guide to learn how it works and then compare my recipe to the one that jmullen provided in the link above to see how I had to adapt it to my particular situation.

For extra security, a password system should be implemented as well. But as long as you keep your gateway email address private, this should keep out most spam. You could even add in a check for other headers that might show in email sent from your phone. There are probably a few other bits that would make it a little more unique and a little less possible to spam.