Spontaneous Noise

Just another WordPress weblog

This blog is riding into the sunset. I'll be keeping a new one at Working Concept instead.

April 18, 2010

Spontaneous Noise, Now Quieter

I’m moving the blog to my company website at Working Concept. You’ve been warned.

http://www.workingconcept.com/blog

February 24, 2010

Rolling Your Own SVN Server

I recently decided that putting all my projects into one subversion repository was a bad idea. If each project has its own repository, there are some benefits:

  1. My revision comments make lots of sense and follow a logical path.
  2. My revision numbers are more meaningful, and pertain to each project directly.
  3. I can easily share access to one project with someone else if I need to, without exposing all of my work or potentially sensitive information.
  4. I can join the rest of the world that’s using subversion properly.

So why wasn’t I doing this sooner? I learned to use subversion this way, and it actually helped when I decided to use Beanstalk. Beanstalk is awesome, provides lots of hooks and cool features, and is just lovely. The obstacle in my repository-for-every-project quest was Beanstalk’s limit on repositories. With the $15/month account, I could only have 10 repositories. I could pay more for additional repositories, but I’m cheap and ambitious and there seemed like there had to be a better way. And there was. Here’s how I set up stylish subversion hosting with unlimited repositories for $19.95 a month.

Step 1: Sign up for Linode account.
I loved Slicehost but was always curious about Linode; you get just a little bit more for a teeny bit less, and like Slicehost they seem to have a great reputation. I signed up for a Linode 360 account, which gets me blazing fast access to 16GB of storage, 360GB of memory, and 200GB of transfer per month.

Step 2: Prep Linode account.
Linode’s control panel makes it easy to get set up quickly. I installed Ubuntu 8.04 LTS (free). Done.

Step 3: Set up the server.
Equally brainless was installing VirtualMin GPL (free) using the install script, which is designed to work with Ubuntu 8.04. VirtualMin makes it easy to set up virtual hosts and repositories with a web-based GUI. I love the shell, but I find it easier to administer the web server with a GUI like VirtualMin. My brain only has room for about 10 terminal commands before I have to start looking things up. I then followed PickledOnion’s iptables setup instructions (scroll down to find it) to secure things a bit.

Step 4: Make some test repositories.
Log into VirtualMin, set up a virtual server, and add some repositories. Ridiculously easy. I access my subversion repositories via a URL like https://example.com/svn/repository-name. Tested connecting with Versions, and everything worked just fine and very quickly. I dumped my Beanstalk repository, then imported it to the new server using VirtualMin.

Step 5: Split projects from old setup into their own individual repositories.
I was sailing along feeling clever and upbeat, and then this step was like a punch below the belt. For your benefit, dear reader, I’ll share what worked rather than the grim tale of how I got there.

  1. SSH’d into server via Terminal.
  2. Dumped my current repository.
    svnadmin dump /home/domain/svn/oldrepo > oldrepo.svndump
  3. Split off a single project into its own dump, dropping unrelated revisions and renumbering them. (Note: folder structure is important here, and you should know that a project in my old repository had a path like “/projects/projectname/trunk/”.
    cat oldrepo.svndump | svndumpfilter --drop-empty-revs --renumber-revs include /projects/projectname > projectname.svndump
  4. Keep filtering dumps until your paths work for a new repository. You’ll know if this isn’t working because you’ll get import errors. Long story short: view the dump source with a text editor and make sure that no paths are committed to the new repository that reference non-existing folders. My three steps basically create a tags folder and make sure that trunk gets moved back one level.
    cat projectname.svndump | sed -e 's,^Node-path: projects/projectname,Node-path: tags,' > projectname2.svndump

    cat projectname2.svndump | sed -e 's,^Node-path: tags/trunk,Node-path: trunk,' > projectname3.svndump

    cat projectname3.svndump | sed -e 's,^Node-copyfrom-path: projects/projectname/trunk,Node-copyfrom-path: trunk,' > projectname4.svndump

If you’ve lived through step 4, now all you have to do is create a repository for your project and import your last filtered dump (projectname4.svndump).

Step 6: Add a touch of awesomeness with Warehouse.
Beanstalk is sexy and made it easy for me to share code with others. At this point I was thrilled to have unlimited repositories, but resigned to say goodbye to Beanstalk’s good looks and friendliness. Then Warehouse brought sexy back. I just happened upon Warehouse, a web-based subversion browser that’s built on rails. And it just happened to go open source!

I deployed a few Ruby on Rails apps in the past, and all I remembered was that it wasn’t as easy as plopping PHP and MySQL somewhere. Ultimately the setup was simple, thanks to the last step:

  1. Add a subdomain wildcard for the server in the DNS manager.
  2. Create a MySQL database for Warehouse, upload everything to the server’s web root, and run the installer.
  3. Update Ruby, Rails, and Gems.
  4. Install Phusion Passenger alongside Apache so there aren’t any more steps to install this app. (This is awesome, by the way.)

You can figure out the rest on your own. Enjoy your new repositories, your web-based browser, and your awesome new subversion hosting!

References:

January 13, 2010

Debugging PHP with Webgrind

I just caught a post over at BKWLD about using Webgrind with MAMP to debug PHP. I had to upgrade MAMP to 1.8.4 to take advantage of the newer Zend Optimizer, but once I did things went pretty smoothly. If you’re not already using Webgrind (a front-end for Xdebug), you should be.

January 10, 2010

The 2009 A List Apart Survey

I just finished taking the 2009 A List Apart Survey. If you’re a web designer/developer and you haven’t already taken it, go ahead:

November 18, 2009

Time Capsule Hard Drive Upgrade

Two of us share the Time Capsule for backup and storage, and we’ve outgrown the 500GB limit. I saw hardmac.com’s year-old article on replacing the Time Capsule hard drive and decided to upgrade my own.

The article already explains the process perfectly well, so I won’t get into that. I will say that I ordered a 1.5TB Western Digital Green Drive (same series that they recommended), and the drive itself is amazing! The Time Capsule barely makes any noise anymore, without any noticeable loss of speed. It’s only a few feet away from our living room couch, so we’d always hear it spin up and click away while reading/writing. Last night we both took turns putting our ear to it just to be able to hear anything! I expected it to be quieter, but I had no idea it would be nearly silent even at full load.

November 16, 2009

Edit in TextMate Lives Again with QuickCursor

I complained before that my beloved “Edit in TextMate” input manager wandered off into the woods when I upgraded to Snow Leopard and started using 64-bit apps. I work with lots of sites using ExpressionEngine, and “Edit in TextMate” made life quicker/easier when editing templates. (We can have a lively debate about saving templates as files later.)

Ricky at IF/THEN pointed me to QuickCursor, which is like a more grown-up “Edit in TextMate.” QuickCursor stays calm as I change Safari tabs, and never seems to lose the connection between the browser window’s textarea and the TextMate window. It lets me choose the keyboard shortcut, and you’ll never guess what I made it.

Bonus: you can add various “Edit In…” applications with shortcuts. What’s not to like? Get it for yourself!

November 15, 2009

Hostgator + Postini

If you’ve got a Hostgator account and are interested in using Google’s excellent Postini mail filtering service, the following should get you up and running. Please note that I’m not an IT guy, I’m not speaking on Hostgator’s behalf, and I’m not responsible if mobs come after you with pitchforks or you encounter email issues.

  1. Sign up for Postini, and look for a welcome email with MX server settings that you should use.
  2. Use cPanel to make sure your desired mailboxes are set up and working. (Obvious but necessary.)
  3. Find either your website’s IP address or the hostname of the server you’re on. You can use any basic Whois tool, like cqcounter.com’s.
  4. In Postini’s admin tool, tell the delivery manager to send Postini’s messages to your mail server. Click the “Inbound Servers” tab, select an option from the “Choose Org:” dropdown, and click the “Delivery Mgr” nav item. Find the “Edit” button and click it. You’ll now see “Email Servers and Load Balancing.” Make sure that one of your email servers is the hostname or IP address from step #3, and set “% Conn.” to 100% unless you have another mail server to route to.
  5. Update your Hostgator MX records to automatically send all mail to Postini for processing. If “Edit MX Entry” is an option in cPanel, you can do it yourself. Otherwise you’ll need to chat with a Hostgator support specialist or file a support ticket. You want to change your MX entries (which tells the server where to send email) with those referred to in step #1. Make sure that you select the checkbox that says “Always accept mail locally even if the primary mx does not point to this server.” Otherwise you won’t get your filtered mail from Postini.
  6. Wait a while and see what happens.
  7. If anything seems fishy, or even if everything seems to be working well, use Postini’s “System Tests” (again in the admin panel) to make sure that everything is routed properly.

A final note: I learned the hard way that you need to use valid email addresses everywhere. By default, your Hostgator account will reject any incoming emails that aren’t going to a valid address. My daily Quarantine Summaries weren’t showing up in my inbox even though I was getting filtered mail because I told Postini to send me messages from “do-not-reply@spontaneousnoise.com,” which didn’t exist. SMTP message tests failed because Postini tried to send from “test@spontaneousnoise.com,” which also doesn’t exist. Creating an alias for that address allowed the test to work.

November 13, 2009

Goodbye Slicehost, Hello BlipBleepBloop

A week ago, I logged into the Slicehost admin panel, took a deep breath, and looked down at my index finger. I held my breath and clicked, and deleted my beloved Slice. Despite the fact that Slicehost will always have a special place in my nerdy little heart, I’m moving on.

The talented and wonderfully-bearded Scott Thiessen and I have started a new project called BlipBleepBloop. It’s our own tiny hosting company that we’re using for clients and to which we’re inviting a handful of folks.

I’m proud to be running all of my sites and email off of a Blip account, which will inherently improve our service since both Scott and I are running our own sites there. Everything has been comfortably stable and speedy, and we’re working hard to pretty up cPanel. (Which we’re both thrilled about since we’ve each encountered so many shamelessly ugly themes in our past.)

Since we don’t have the ability to offer subversion hosting, I’ve moved my repositories to Beanstalk, which I couldn’t be happier with.

Want to know more about BlipBleepBloop packages? You won’t find any specs or ordering info on our website, so send us an email if you’re interested. That’s the idea: small and personal.

September 25, 2009

ActionScript 3 Memory Optimization

I was recently finishing up a kiosk project wherein a Flash projector would have to run fullscreen 24/7, and was having a terrible time pinpointing a memory leak that left the projector unresponsive after only a few hours. While I was able to improve memory usage, I couldn’t get the app to stay calm over an extended period. The end result was a workaround that had the projector restart itself after an inactive waiting period.

The Problem
I was working with a proprietary AS3 framework that relied on multiple SWFs and XML for configuration and content. The piece involved lots of lossless images (dynamically loaded) and only needed to run as a projector from a Windows machine. It also communicated with an external series of lights via a MAKE Controller board. Initial testing of the app went smoothly, but letting it run overnight turned it into a sluggish memory hog.

Improving Memory Usage
There were a few tips I followed from various sources to streamline the app’s memory usage. Ultimately they weren’t enough to solve the big problem, but I watched the numbers drop in Apple’s Activity Monitor.

  • Remove unused event listeners.
  • Clear unused display objects by setting each obj = null.
  • Make sure you’ve deleted any child display objects with .
  • Stop all Timers to free up the memory that they use. myTimer.stop();

Final Solution
We came to two options: use a third-party product for compiling a more efficient Flash .exe (such as Screenweaver, Zinc, or MProjector), or create a reliable workaround that would simply restart the kiosk app and avoid the memory leak in the first place. The client needed files delivered quickly and did not have extra budget, so we ended up choosing the latter. We avoided the problem by adding a timer that would restart the Flash piece after 10 minutes of inactivity. (This was done by using FSCommand to call a batch file, since we’re using windows, immediately closing the Flash app, and having the batch file execute the Flash app again.) This ended up working pretty well and allowed us to deliver everything on time.

There are more discussions about memory optimization with Flash projectors (and Flash in general), but I never found any silver bullets. Here are a handful of links that were helpful:

Similar Issue:
http://blog.joshbuhler.com/2005/04/25/how-long-can-flash-run/

Grant Skinner on Resource Management: http://www.gskinner.com/blog/archives/2006/06/as3resource_ma.html

Detecting Memory Leaks in Flash and Flex:
http://www.websector.de/blog/2007/10/01/detecting-memory-leaks-in-flash-or-flex-applications-using-wsmonitor/

Self-Restarting Projector:
http://www.actionscript.org/forums/showthread.php3?t=195367

Monitor and Restart Crashed Windows Programs:
http://www.knas.se/knasRestarter.aspx

September 22, 2009

HP P1006 and Snow Leopard

The update to Snow Leopard has been mostly uneventful: zippier performance, minor visual updates (mostly silly), and the destruction of two very important things:

  1. My beloved ‘Edit in TextMate’ service, which I use in Safari to edit form contents like ExpressionEngine text inputs.
  2. The use of my printer, the teeny-but-reliable HP P1006 laser printer.

So far, #1 is still up in the air, but Apple just released new drivers yesterday for the HP P1006 printer (along with some others).

Get them here!

Update: It’s clear that things aren’t entirely fixed. I can print with the new drivers when the printer is connected to my iMac, but I had to jump through a few hoops to continue printing via the Time Capsule. If you’re still having trouble, email me or check out this thread: http://discussions.apple.com/thread.jspa?threadID=2130605.