Grilled Beer Can Chicken

Cooking has been a growing passion of mine. I’ve been going through recipes to try out w/ my wife. Last night we tried grilled beer can chicken (which she’s a great fan of). It turned out extremely tasty! Easily the juiciest chicken I’ve ever experienced.

Well that was exciting…

Today I decided to bite the bullet and migrate hosts to a private server. Happy to finally be back up and running after some rather slow and painful DNS migrations but the site is back and I’ll be hammering out bugs as time goes on. Stay tuned!

Apache and Node.js on the same Ubuntu box

First encounter.

I’ve been pretty excited to pick up Node.js for awhile now and I sat down today to get the ball rolling. I’ve installed node before and ran the basic ‘hello world’ example at work so I wanted to get right into it. Since I was anxious to at least get something out there on hour zero so I jumped straight into Heroku and created an app. While the process worked great and I got something up I was so excited about node that I committed to picking it up and putting it on my home server.

And that’s the first blocker. Sure – I want to put it on my home server… but I run a lot of other things on my home box. One of those things is a preexisting LAMP stack that hosts some tools that it would be tough to replace or go without. So that’s when my googling started.

I knew going into this that I was going to need to either need a second IP address or use a proxy. It may go without saying, but since I wasn’t about to call my ISP and order a second address, wait for the upgrade to take effect, and then pay the extra fees, I decided that the proxy was the path of least resistance ;)

Not surprisingly there are a lot of tough to follow brain dumps out there on the subject. Everyone has a stackoverflow question or forum post on how to tackle this problem and even a few “is this even ok?” questions.

So without delay, here’s my solution:

Install node and npm

Thankfully this one is pretty straight forward. Follow these steps and you’ll be set. https://gist.github.com/isaacs/579814#file-node-and-npm-in-30-seconds-sh
My only one add here is that I actually needed to add the local bin folder /Users/dschreck/local/bin to my ~/.bash_profile on MacOSX. I did not have this problem when installing on my Ubuntu box though.

Edit local server, /etc/hosts and open ports

I knew I was about to start redirecting from localhost to localhost, so I wanted to ensure that my Ubuntu server knew that d-corner.net was the same as 127.0.0.1 to prevent any type of 503′s. Along this line I also went ahead and opened the 5000 port on my home network. You can choose any por of your own, anything in that range should work.

Edit Apache

And now for the important stuff… the Proxy!

 sudo a2enmod proxy
 sudo a2enmod proxy_http

This will install the Apache2 mod_proxy to /etc/apache2/mods-available/ and /etc/apache2/mods-enabled/

Then, I needed to edit my default conf:

ProxyRequests Off
<Proxy *>
 Order deny,allow
 Allow from all
 </Proxy>
 <Location /node>
 ProxyPass  http://d-corner.net:5000
 ProxyPassReverse  http://d-corner.net:5000
 </Location>

Then kick it all off with:
sudo service apache2 restart

Spawn a node instance & Hello World!

Next I went ahead and created two files: web.js and package.json

web.js:

var express = require("express");
var app = express();
app.use(express.logger());

app.get('/', function(request, response) {
    response.send('Hello World!');
});

app.get('/test', function(request, response) {
    response.send('This was only a test');
});

app.use(function(err, req, res, next){
  console.error(err.stack);
  res.send(500, 'Something broke!');
});

var port = process.env.PORT || 8080;
app.listen(port, function() {
    console.log("Listening on " + port);
});

package.json:

{
  "name": "node-example",
  "version": "0.0.1",
  "dependencies": {
    "express": "3.1.x"
  },
  "engines": {
    "node": "0.10.x",
    "npm": "1.2.x"
  }
}

After this we can then run npm install from our node app directory, then:

sudo node web.js

Point our browsers to
d-corner.net/node… and… success. :)

Hope this helps others!

Relearning the Web

Over the last few years the web has continued to mature, which is very exciting for the generation that grew up during the 90′s. Yet at the same time I can see my favorite go-to web technologies becoming old and washed up, for example, I’ve been using PHP for over 13 years now. While PHP continues to be one of the most popular languages on the web it’s still one of the most disliked.

What’s so dated? LAMP.

First, don’t get me wrong, I love LAMP. Lots. I’ve scaled up LAMP to serve millions of unique players for our games at Zynga. Doing so was exciting and it was tough. I was lucky to have great mentors and colleagues helping along the way. But even before I joined Zynga I was tipped off to nginx, one of the few servers written to handle the C10K problem.

So, why didn’t I pick up nginx? It was fresh and new and while working in LAMP at a constant crunch … well, it’s tough to stick your head up to look around. The same goes for other additions to the “go to” web… CouchDB and other NoSQL databases have taken the web by storm over the last 5 years. Node.js is one of the fastest languages out there powering the web, yet I haven’t started using it.

In conclusion I guess the only thing we can do as web developers is continue to be students of the Web. To learn about, and get excited about, these new projects just as we did our firsts. So here’s to relearning the web.

The Future of my Blogging

While this goes without saying, I haven’t actually updated this blog in a very long time. I believe it’s a combination of a few things:

  1. It’s tough to think of, and then work to completion, the level of complexity I’d like to provide in my tutorials.
  2. I really want to make my own blog instead of this clunky WordPress
  3. I find myself using other medians (like Facebook or Twitter) to write on in lieu of a full blog.

Number one is my own fault, really, and I have a plan on how to tackle this one. Number two is what’s actually gotten me to write this post. I’ve been working on my own personal blog system off and on over the last couple months, putting maybe a total of three to four dev days into it. While it’s coming along nicely and I find it enjoyable I’ve ultimately decided that I shouldn’t use it as an excuse to not write. Lastly I believe using Facebook and Twitter are really just an easy shortcut for me, so I’d like to try and commit to something with more depth to it.

So, there you have it. Over the next month I plan on rolling out a series of changes to hopefully get my blog life back in running order.

Learning Python the Disappointing Way

So, earlier today I decided that I was finally going to get down to it, and really dedicate some time to Python. A few years ago I took the dive at http://www.diveintopython.net/ and never finished the job. But today, after some googling, I decided to try out Learn Python the Hard Way - and man was I disappoint.

I don’t want to blast the author (Zed Shaw) – I think he’s fighting the good fight. And I agree, I may not have been the targeted audience for his book. But at a certain point I realized that the book had some fundamental flaws in it.

1. I’ve never used print ” ” so many times in my life.

So here’s a thought: If by chapter/example 25 you’re still going over the basics of chapter 5, we have a problem. I get it, it’s CLI and there’s not a whole lot else to do. But when I feel the lesson has more text being output via print than actual meaningful lesson it’s pointless. Halfway through the book it felt like the examples were only so meaty because they had such extremely verbose outputs. An extra credit task for an early chapter was even “Fix your typos” – like… comon… really?…. really?

2. Moar meat.

There is literally an exercise dedicated to “go google python.” I get it, you want to get Novice Programmer interested in the language they’re learning, and to be exposed to other projects. But there’s better ways to do that. How about instead of telling me to go search through thousands of open source projects you dissect one of your favorites in the book?

3. We didn’t even get to the good stuff.

By the final 4 or 5 examples we started to get into meaningful content. Things that started to reflect “Real World” examples of programming in Python. By it just ends, and tells you to go off and have a great time with life. I blazed through the first 50 examples in hopes to get to something interesting, and when you finally had my attention – you stopped. Why? I’m a nice guy, people like me, why would you do something so mean to your readers?

All in all, I like where his heart’s at. I just wish a book that had such awesome referrals  would give me an awesome time.

RockMelt Browser – Future of Browsers?

I recently have installed the RockMelt browser and I have to be honest, I’m somewhat impressed. It’s based off of the webkit engine, same look and feel as Google chrome browser, but with integrated social networking.

To be honest, this feels like the future of everything, right? Our phones are like this, our desktop widgets, the websites we go to all have ‘Like This’ or ‘Tweet This’ – so why not our browser?

What I think is done well, is the little side widget aka ‘App Edge’ – that allows me to quickly see the latest Facebook news updates, and then another one that is for notifications.

Not to mention the App Edge allows for easy (and I mean EASY) RSS subscriptions, allowing for even more ease to keep up to date. Add in the the left side ‘friend edge’ – where I can “star” my favorite friends on Facebook and easily chat or post to their wall. Or I can browse through all of my friends, see if they’re online, etc.

But it’s not all sunshine and rainbows…

RockMelt, while impressive, in its current state feels like it could be easily replaced by an addon to Google Chrome. I have yet to see anything that truly makes it impossible to clone without some trickery of an addon package. If Google could allow for Chrome addons, they could easily kill RockMelt, as they already have a huge acceptance. I could imagine though, that Google would want to reserve this tactic if they ever were to release a social network.

All in all, I’ll be using RockMelt, and hope for some more major addon releases.

Adding Syntax Highlighting – Yay!

So I’ve finally added in some syntax highlighting to my blog, and I’ve gone ahead and updated a bunch of back posts.

Hopefully this will increase the readability of my posts, along with easing some user experience. I’ve also gone ahead and fixed up/tweaked a few items for this theme I’m using.

Along with these changes I’ll also be gearing myself towards writing here again. Yay.