Mycelial CodeFlower

I found this cool D3.js plugin called CodeFlower recently. I decided to make a codeflower for the Mycelial source code. It’s interesting to see an app clustered visually like this.

To make a codeflower you just need to download the perl script “CLOC” to count the lines of code in your app. The codeflower plugin then takes that clocfile and turns it into a json array to be used with D3.js

Check out the codeflower: Mycelial CodeFlower

codeflower

Finding Work/life Balance as a Consultant Living in Lake Tahoe

Do you love where you live? Does it amaze you and keep you curious and engaged?

The Tibetans say the secret to happiness is building up all three legs of the Tripod of Happiness. The Tripod of Happiness is about having something to do, someone to love, and somewhere to be. I think a lot of people don’t truly satisfy the third leg of this tripod.

I program all day, thus I stay very connected to the latest happenings in the technology world. Yet I also immerse myself in the mountains of Tahoe on a daily basis and it does wonders for my clarity of thought and overall well being.

I think this dichotomy makes me a better programmer. Nearly every day I brainstorm various problems while I’m out walking on the shores of Fallen Leaf Lake, for example. The clean air and perfect Tahoe temperature does wonders for your mind. It’s no surprise that people like Bertrand Russell and John Steinbeck spent time out in this area. John Steinbeck wrote his first novel while staying on as a caretaker for a cabin at Cascade Lake, the lake right next to Fallen Leaf.

I sometimes hike this little trail in the late afternoon to Fallen Leaf Lake: fallen leaf

I also have a great secret spot which I call the Lair of the Bear. It’s out near Baldwin Beach but it isn’t a designated trail. I duck some barbed wire and hike through the woods to a beautiful meadow. I quite often run into a family of bears out there so I generally find myself exceptionally focused while walking. From what I hear, it’s not a good idea to surprise a mamma bear with her cubs. As long as you keep your distance they are totally fine with humans, though.

This is one of those few hikes in which you can’t brainstorm a programming problem because you have to be completely in the moment to keep an eye out for the bears (so I can spot them before my dog does. I don’t want him to charge them and get into hot water). This kind of in-the-moment/on-edge thinking also seems to be healthy for the human mind. I feel charged and energized after walking out there. I think it is a similar phenomenon to what rock climbers experience. Rock climbers talk about getting a high from having to put their entire mind into the present tense and focus on the next handhold.

Below is a pic of the meadow in the Lair of the Bear. There is a slow-moving river and pond nearby. I often lay down and relax in the grasses while my dog entertains himself by hunting for frogs. Lair of the Bear

Don’t get me wrong, there are things which I definitely miss out on by living in Tahoe. I love the Bay Area tech scene, for example. The closest Ruby group to me is in Reno (1.5 hours). It’s a great group but they only meet once a month. It would also be nice to grab beers with other developers more frequently. Networking with startups and other developers is almost nonexistent in Tahoe. I wonder if the perfect solution is spending half the week in the Bay Area and the other half in Tahoe? I guess I just need to find a way to have a house in both locations (still working on that).

So, the question is, do you have all three legs of the tripod in your life? Do you love where you live? I’d be curious to hear from other people who have a good balance between the natural world and our high tech one.

The pic below is a beach within walking distance from my house and I quite often go there for lunch. Pretty nice lunch spot, eh? Tahoe Beach

Are you looking for a good developer? Check out my work! AppRaptor: Web Application Development & Design

Making a Site That Can Handle #1 on Hacker News

I recently launched my new consulting site, AppRaptor. I was completely surprised to see it vault all the way to #1 on Hacker News and stay there for a couple hours.

The unfortunate thing was my server couldn’t handle all of that traffic. At the height of the surge, I was seeing 287 concurrent users hitting my site.

I learned a lot about what not to do when developing a site which doesn’t require dynamic content.

My big mistake was I wasn’t expecting more than a handful of upvotes on HN so I just put the site on my Linode 512 (512 Mb of RAM). I usually do most of my development in Ruby and Rails and deploy to Heroku but I was lazy and already had a linode setup and configured for PHP. What made the performance infinitely worse was I was using PHP to factor out common code to ease the development process. This site didn’t have any dynamic content and shouldn’t have used a server side language at all. A massive performance hit is an unacceptable trade off for ease of development (turns out you can have your cake and eat it too with middleman app. I talk about this below).

During the surge I should have immediately converted the site to static HTML. Instead, I wasted my time trying to optimize the max_clients and the timeout variables in apache.conf. Messing with apache didn’t help with 287 concurrents.

There were a lot of good suggestions on HN for improving the performance during the surge. Thanks to HN users krallin and bradgessler for pointing me to S3, Cloudfront, and Middleman for static site hosting and development workflow.

I’m now hosting AppRaptor with an Amazon S3 Bucket and Cloudfront as a CDN. Just for the sake of amusement I did a brief loadtest with blitz.io to see what the performance would be like with this new stack. I did a rush from 1-250 users in 60 seconds and it had 0 errors and 0 timeouts. Screenshot of the test is below:

blitz test

Setting up S3 for static site hosting with Cloudfront was pretty simple. The only gotcha you should be aware of is the bucket will initially interpret your css style sheets as an octet/stream data type, and consequently your design won’t show up. You just need to manually go into the properties of those css files and change them to “text/css”.

The biggest pain about developing a static site, however, is having to repeat yourself with shared code (headers, footer, etc…). Turns out a great solution for this problem is Middleman. With Middleman, you can use all of your favorite dsl’s, like HAML and SASS. It even allows you to build your site with embedded ruby. When you’re ready to deploy your site to your S3 bucket, just type “middleman build” and it creates static html for your project. Needless to say, it’s pretty sweet for optimizing your workflow.

Of course, this stack will not work if you have a site that requires dynamic content. But if you want to survive a massive HN surge with a static site, I highly recommend this approach.

Thanks to HN for all of the great comments and critique on my new consulting site, AppRaptor!

Moving From Tumblr to Octopress

I’m changing my blogging engine from tumblr to octopress because, quite frankly, I am bored with tumblr. Octopress is pretty cool. This blog is being deployed to Github pages, which is great for handling traffic spikes. Many thanks to Dru Riley for pointing me to this nice octopress theme. It’s much better than the default, in my opinion.

If you want to see my old blog posts, they can be found on 3solarmasses.