Phoobox – An MVC Version of PHP Fusebox

Pretty early in my professional programming career, I got hooked on the Lasso/FM stack, which most people probably never heard of… and for this reason I was able to get the Lasso code introduced to the 99 Bottles of Beer website – “One Program in 1,500 variations”. My other contribution at that time was to figure out the right combination of Lasso 3.6.x and FMPro Japanese to produce workable double-byte characters. This was all before the year 2000.

I graduated to ColdFusion and used that for several years. This wasn’t all pain and misery, I did get introduced to the inner workings of the JVM and to the Fusebox 3.0. framework. In its purest form, it was a great way to organize code, but really did not help separate logic from display and things like MVC were off in the distance in Fusebox 4.0+. Debugging was a huge pain as all routes went through a single file so all errors were invariably in the index.cfm file. Grr. When 4.0 came along, the bloat caused me to abandon the framework and I discovered the power of MVC in Mach-II.

I graduated to PHP and saw the near limitless number of frameworks and was lost in a sea of mediocrity. The current state of affairs is much better than it was in 2004. I saw this as an opportunity to port the Fusebox framework to PHP and deal with a lot of the shortcomings I felt needed fixing… and that brings us to Phoobox.

I basically cherry picked the parts of Fusebox I loved (routing, nested layouts, circuit-wide settings) and added object oriented PHP to the mix, giving the framework the true power of MVC. It allowed me to amass a huge library of classes that I could pick and choose for each project and in the parlance of red bull, gave me wings. I’m happy to finally share this framework with the world, but am doing this piecemeal. I want to eventually share my entire class library, but the code must be reviewed and embarrassing comments removed. I will also share some of the advanced capabilities of the framework, such as form rendering and validation; css/javascript tidy, minify, and obfuscation; and templating plugins.

Check out the README.md for more info on Phoobox.

Cleaning House

Welcome to the new design. There is still a bunch of stuff missing, mainly my non-blog related pages. I’m going to miss my Instapaper-like reading queue the most so this will be fixed fairly shortly. I still have a bunch of new hooks to write into new APIs so stuff will gradually make its way back here. I’ll also start writing a bit more content now that I have some time. And say hi to my new logo.

Unfollowing 400,000 People on Twitter

About nine months ago, I was near the magical 1.1 ratio when I suddenly could no longer follow anyone. I unfollowed to about a 1.0 ratio, but this didn’t help and of course no word back from Twitter. I also noticed that my followers were still growing even though I wasn’t following back. This was a bit of a surprise so I let the experiment run…

  • No new friends – I was bound by a bug in Twitter, nothing I could do here (after three months, this was fixed)
  • Unfollow deadbeats – I kept a bot going that unfollowed people that were not reciprocally following
  • Unfollow abandoned accounts – If the account did not tweet for 4 days, unfollow
  • Unfollow bots – keywords in tweets/descriptions and number of total tweets got flagged and unfollowed
  • Unfollow non-English speakers – even Japanese accounts (which I could read), kanji, cyrillic, greek, hangul, and kana. No offense to anyone, I just can’t parse info that fast.
  • Unfollow spammers – keywords would flag my bot and the user unfollowed

This left me with about 20,000 friends which I attempted to weed out manually over the course of a few weeks. I also tightened the screws on the bot params above and caught more in my net. Then I started catching too many false positives. I was at 8k friends by this point so I decided to be indiscriminate and unfollowed everyone. Everybody but Dave McClure (this was purely just a fluke). Twitter shows me following almost 400 people now, but that actually isn’t true – 350 of those users are invisible to me. Invisible users are fine, but I still see their crap in my feed. I’m sure this will get straightened out as my info propagates.

So I pulled a “Scoble” on everyone? I guess, but this was a carefully controlled process over a nine-month period. It was only when I unfollowed everyone the jig was up. Did I lose a ton of followers doing this? No, I’m actually getting more followers now than I ever did.

Why did I do this? I use lists, a lot, but they just were a pain. I also didn’t like the signal I was sending people – I’m not thrilled by the f4f community and all I got in my @ stream was “follow me!” or my favorite, “follow me or i unfollow u”. I don’t want to be part of that community and really just want to user twitter in a new way – to remain informed, to network, and chat with friends.

The last thing is the amount of auto-tweeting I do – I have a ton of feeds from my other networks set up to tweet, the only external source is the Slashdot rss feed (yes, I parse app store information to tweet about iOS app price drops, a huge effort behind the scenes). So I will most likely cut down on the auto-tweets. My first step towards this is a curation of my own Tumblr feed.

If I unfollowed you, don’t be offended, I will get back to following you soon.

bin/gen_build:391:in `dynamic_lib’: undefined method `[]‘ for nil:NilClass (NoMethodError)

It’s all good and fine that TextMate wants to go GPL 3.0. I believe in paid libre software. I was just kind of blown away by the toolchain required to build the thing – boost, ninja, etc. Each of these projects had to be built and installed. Whatever. I downloaded a release from git and attempted to build and got the error in the title:

bin/gen_build:391:in `dynamic_lib’: undefined method `[]‘ for nil:NilClass (NoMethodError)

flustered, i just killed the source download and did a git clone directly from the repository. This worked fine. Built and installed. I’m a BBEdit person though. Morning wasted.

(13)Permission denied

This apache error is the bane of my existence. It is sometimes nearly impossible to figure out even though I know the fundamentals of the httpd web server. On mountain lion, you should generally debug this like so:

  1. Make sure the user/group specified in httpd.conf is www/www
  2. Make sure the directory has execute permissions for www
  3. Make sure the directory has a default (index.php or index.html)
  4. Make sure that default is readable by www
  5. Make sure that ALL encapsulating directories are executable by www (readable)

It is this last point that I want the emphasize because I had this issue moving to Mountain Lion (OS X 10.8). Your user Documents directory is 700 and is owned by you. If you try to serve a file anywhere below this directory, you’ll have problems. So there are two things you can do to find out if the error is due to parent permissions:

  1. go to the web root and do `ls -leahG` on that directory, cd ../, rinse, repeat; taking note of all permissions.
  2. use the spectacular parsepath.pl tool. Throw this into /usr/local/bin and give it execute permissions and run it on your default index file.

From number 2 above, you’ll get something like this:

d 0755 root:wheel /
d 0755 root:admin /Users
d 0755 beetle:staff /Users/beetle
d 0700 beetle:staff /Users/beetle/Documents
d 0755 beetle:staff /Users/beetle/Documents/Projects
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb
d 0755 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb/web
f 0644 beetle:staff /Users/beetle/Documents/Projects/aaa/bbb/web/index.php

Boom. /Users/beetle/Documents has 700 permissions and www is denied. chmod this to 755 and everything should be good. You could also modify the parsepath.pl file to give you `ls -leahG` info as well.

Another thing I learned during this process is /etc/paths is a fine location to store your path info. Update this file and source /etc/bashrc will get you on your way. Neato.