Archive for December, 2010

Always remember: you can’t “expires header” an HTTP POST

Posted on December 17th, 2010 in Apache | 1 Comment »

This includes ajax content (which to the server is just a standard HTTP request.) This makes sense since POST should only be used for storing or updating data.

Thanks to this page.

Multiple instances of Dropbox

Posted on December 14th, 2010 in dropbox, productivity | No Comments »

Cool tip for those that have a work Dropbox and also have a personal Dropbox. Here’s how to run both!

I just set it up and it works great. Turning bash scripts in to os x apps using Automator is also a good tip.

Thanks to this guy.

Pretty printing XML with xmllint

Posted on December 10th, 2010 in Uncategorized | No Comments »

Today I was debugging some long XML responses and I went online to find a pretty printer so that I could read them easier. A quick Google search turns up a decent XML beautifier:

Unfortunately one XML response in particular was over 200kb which choked the above parser. I searched for 5-minutes and couldn’t find another one that didn’t require downloading and setting up. My next bet was to ask the geniuses in the irc #emacs channel if this is something emacs might do and got a quick answer: Use xmllint.

I did a quick check if I have this program with which xmllint on both my OS X machine and my remote Centos server – sure enough it was there. Here’s how to use it:

Just dump your xml in a text file (xml.txt) and run the following:

xmllint -format xml.txt --output xml2.txt

Additionally, if you’re a TextMate user you can just go to BUNDLE > XML > Tidy.

The wonders of git bisect

Posted on December 5th, 2010 in git | 2 Comments »

I had a bug that crept up on me that wasn’t found until right before a production push. I rolled back the last two commits locally but saw that the issue was still there on the iPhone. Now I’ve heard about the wonders of git bisect but hadn’t had the opportunity to use it – until now and was pleasantly satisfied at how well it did it’s job.

Locating the problem commit:

To quickly locate the exact commit that the issue was introduced I picked an arbitrary date of 15 days ago and saw that the bug didn’t exist at that time. I ran git bisect specifying master as bad and the the commit of 15 days ago as good. git bisect then picks random commits between those two commit ranges until I find the first bad commit. The process involves me calling git bisect bad or git bisect good as I refreshed the iPhone screen. The bug was found in less than five minutes (having called git bisect six times). Fixing the bug however, took a little longer…

For a greater look into git bisect peep this link.

Bonus round

Once you find the problem commit, you can show the details of the comment by doing:

git show 97d7c26dba17ba1a46fb9c6f0bf0e954a92aec74

Cat a specific file by doing:

git show 59010bee586296f0676a9e2255b2bade6b8cea74:public/js/jellycar3/tap.js

What to grab the previous commit before that file and copy it to your local branch? Just do (while in whichever branch):

git show 59010bee586296f0676a9e2255b2bade6b8cea74^:path/to/file/tap.js > tap.js