The MSNR Stack Step 1

I’ve been letting the idea for the MSNR stack ruminate in my mind for a while now and it was finally time to pull the trigger.  There are an endless array of node frameworks sprouting up but at the end of the day I think its important to do what your comfortable with and for me that’s MVC and SPAs that don’t step it your MVC aka the MSNR stack.

Today I took a very important step toward that goal by setting up my first very own server!  Well it’s not the first time I’ve set up a server or anything but it’s the first time I’ve done it outside of a VM!  I purchased an old HP G5 DL380 recently and decided it was high time to get it up and running.

The first thing I did was mount the sucker:

Then I wired it up, got it some juice (power) and some food (internet) switched it on and it was like the jet of my dreams taking off in my basement.  (The fans are really loud on start up…)

After that I installed Ubuntu 12 LTS since it was certified for my hardware.  Once the install was done it was time to get node installed.  I used a package available here from joyent with great success.

Then I had to make sure it would actually show something if I navigated to it.  By default node does not serve anything like nginx or lamp.  You need to create an application in order for something to display enter the Hello World app:

I’m a fan of nano so I did :

nano ~/hello_world.js

Then I got to work writing my first app (which I stole from the node site).

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(80);

Once it was all ready I did my CTRL+X  Y and Enter to save my file.  Then finally it was time to test!

sudo node ~/hello_world.js

At this point if you did everything right all you should see is a flashing underscore.  You’ll need to use sudo if you are using port 80 like I am.

Finally I wanted to see my master piece in action so I logged on to my domain registrar, created a new subdomain, went to the Advanced DNS editor and redirected the sub-domain to my IP address.  Once that was setteled I went into my At&T 2WIRE router and went into my firewall, selected my server and set it to accept traffic on port 80 (by clicking the Server link and the Web Server selection).

TLDR for all those who skip to the bottom (like myself).

  1. Get a server
  2. Install Ubuntu
  3. Install Node
  4. Create a Node App
  5. Point a Domain to your IP Address
  6. Ensure your Router/Firewall are ready for the traffic.

DONE

http://dev.motoandmustache.com/

Not too bad for an evenings work.

Visibility in Lists with a Simple Script

For those occasions where you find yourself creating complex objects that are lists where you need control visibility here is a simple script that will save you a lot of headache.

I came across this needing while working with a list of locations on a project.  The objects were to complex for a table and needed to be dynamic enough to allow end users to easily add additional locations.  What I did was create a Section and bind it to my location list.  Then I proceed to put my various sub fields and sub-objects into that section.  Then at the bottom I put a couple of buttons that fired boundary events to add and delete items to my list.  Simple right?

repeater

Continue reading…