Debug your Apache mod_rewrite Rules!

Apache mod_rewrite is incredibly powerful but it’s also a PITA if you’re trying to do something advanced. Luckily, you can log mod_rewrite’s activities and better understand why your rules aren’t working.

Just add RewriteLogLevel and RewriteLog to your Apache VirtualHost config:

 <VirtualHost *:80>
 # ...

RewriteLogLevel 8
 RewriteLog /var/log/apache2/rewrite.log

# ...

I suggest log level 8 but you can try lower. Logging rewrites will be SLOW: do not enable in production.

Sample rewrite log output:

 [perdir /var/www/] RewriteCond: input='/small/asdfsadf/avatar.jpg' pattern='^(.*)/(.*)/(.*)' => matched
 [perdir /var/www/] RewriteCond: input='/var/www/' pattern='-f' => matched
 [perdir /var/www/] rewrite 'small/asdfsadf/avatar.jpg' -> '/small/avatar.jpg'
 [perdir /var/www/] internal redirect with /small/avatar.jpg [INTERNAL REDIRECT]


Pretty print to console in Node.js

JSON.stringify is pretty cool, in fact you can use it to print javascript data structures in a more readable format.

Of course modern browser javascript consoles already format nested data for you, but this is really helpful when using console.log() in Node.js

console.log(JSON.stringify(window.location, null, 2));

// prints...
  "ancestorOrigins": {
    "length": 0
  "origin": "",
  "hash": "",
  "search": "",
  "pathname": "/category/web-dev/",
  "port": "",
  "hostname": "",
  "host": "",
  "protocol": "http:",
  "href": ""

JSON.stringify documentation

Analyzing mysql slow query log

I had yet to have a need for a tool to analyze a MySQL slow query log, after some searching I came across a tool I already had!

Most MySQL installs come with the utility mysqldumpslow which is great for parsing your slow query log. I needed to sort by lock time so I just ran the following:

[code]mysqldumpslow -s l mysql-slow.log | less[/code]

I'm in love with git

A month ago I switched to git from subversion when I started at RealSelf. Now I’m in love.

Why I liked git before:

  • Distributed
  • Fast
  • Github
  • (hip)

Why I love git now:

  • Branching does not disrupt workflow


# …working on myBranch…

git stash

git checkout someOtherBranch

# …make your changes to someOtherBranch…

git commit

git checkout myBranch

git stash pop

# and I’m right back where I left off!


  • Rebase


# instead of:

git merge master

# and getting a messy commit log.. do this:

git rebase master

# and your commits starting after you branched
# are rewound and applied on top of the latest from master


  • The command line interface is so powerful and usable that I don’t rely on GUI tools (except for resolving conflicts)
  • Pull requests (Github again)

Disable Java plugins to avoid drive by installs

As a computer repair technician I clean up a lot of computers with Java based malware. Java is known for its zero-day vulnerabilities and as a popular vector for cross-platform attacks. Not to mention the fact that Java Runtime Environment (JRE) updates never remove old versions, and Java installs and enables plugins for all popular browsers (Chrome, Firefox, and IE). Continue reading “Disable Java plugins to avoid drive by installs”

Mockingbird doesn't want casual users

This morning a friend forwarded me this email from Mockingbird.

Dear Mockingbird customers,

Mockingbird’s taking flight

We’re excited to announce that Mockingbird will launch on August 15, 2010 — with multi-user collaboration!

Details on the paid plans:

Active Projects Users Price/month
Personal 2 Unlimited $9
Team 10 Unlimited $20
Pro 25 Unlimited $40
Unlimited Unlimited Unlimited $85

There will also be a free account available that allows 1 project with 3 pages.

You can archive finished projects, which won’t count toward your active project limit. You won’t be charged for months during which you have no projects active.

What you need to do

Projects made with beta accounts will be automatically archived and will not be accessible after August 15, 2010. Customers who choose to upgrade to a paid plan may re-activate beta projects, but free accounts will not be able to access old beta projects, so please make sure to log into your Mockingbird account to export PNG or PDF versions of any projects you need.

Beta discount

Your feedback has made Mockingbird better, and we’d like to thank you by offering a coupon for 25% off the first three months of any paid plan. Keep your eye out on your inbox for the coupon code when Mockingbird launches.

Questions or comments?

If you’ve got questions about the transition out of beta or want to get in touch with us for any other reason, we’d love to hear from you. Email us at

Thanks for all your support, and we look forward to continuing to help you make great wireframes.
– The Mockingbird Team

In a nut shell they are saying thanks for testing, all projects are now archived so export them. If you want your old projects back, pay us. Wow.. Awesome. Thanks!

I jumped on Twitter, first off I never use Twitter but I figured it might be worth a try.

Thanks @gomockingbird for throwing casual users under the bus, hope you enjoyed all the testing that was done with no reward except a coupon

@willlangford We really do want to be usable for casual users, and it seems like many don't use more than 1-2 pages, hence our free plan.
@gomockingbird archiving current projects and only allowing paid users to reactivate old projects is what got me.
@willlangford If you need to keep your projects longer, just let us know, and we'll happily do so. Also, share links will keep working

Wow. Didn’t expect that.

I guess I just have to tweet a complaint to get my projects extended, so everyone else that is in the same boat as me has to ask? What’s the harm in letting your free beta testers to keep their current projects? Oh… right.. Mockingbird doesn’t want casual users that could see the benefits of a quick HTML5 mockup tool so they won’t eventually become paid users and tell friends and colleagues alike how great of an application it is.

My project is exported.. who knows what they will do in the future but don’t consider your projects safe with this startup.

A good reason to dump OpenDNS

namebench DNS Benchmark Results

Like me, you’ve probably read all sorts of great things about the public DNS service OpenDNS, but one thing you should find out for yourself is how it will impact the speed of your web browsing.

After using OpenDNS name servers for months at work I started to notice that page load times at home (on a much slower connection) were considerably more “snappy” with my ISP provided DNS servers. A quick Google brought up the comprehensive Open Source namebench DNS benchmark tool.

A run of namebench resulted in a pretty html file with numbers and graphs that confirmed my suspicions. My ISP’s (Comcast) DNS servers were 174.4% faster than OpenDNS on average, with Google’s Public DNS coming in a close second place.

It should be noted that namebench is rather smart and it rifles through your browser history in order to compile a personalized set of domains for its testing, so my results are potentially unique – and this is just one test (actually I did three, I also used Alexa top domains for a source to avoid DNS caching – and the results were all similar), at one location. Although once I switched to my ISP’s DNS servers I experienced a noticeable difference in page load times.  Not to mention that my results may change in the future due to server load, poor caching, etc. But with OpenDNS, there was always a slight wait before a page would even start to load, and now that wait is gone. And that’s on a 36Mbps downstream connection.

My points are simple:

  1. Switching to OpenDNS (or any other DNS service) may be a bad thing.
  2. Your DNS server does matter.
  3. namebench is awesome.

It may be a matter of milliseconds but it all adds up, many large websites require dozens of DNS queries for ads, images, scripts and more. Do your own testing before believing the hype.

Regardless, OpenDNS is still a great service: if I ever have the need for a basic content filtering system I will turn to OpenDNS.

Download namebench (for Windows, Mac, or Linux/Unix) and see for yourself how your current DNS stacks up.

Fix a malfunctioning BlackBerry Trackball [video]

A friend of mine had a couple Bolds with trackball issues, we went as far as taking one of them apart and attempting to clean the trackball mechanism with no luck. I finally came across this method on a forum and we were amazed by the results – so amazed that we recorded the process on the second Bold with an HD Flip.