The Bus Ride Home, Sinatra Singing on OS-X

This is just a quick getting started I walked through to get Sinatra going on OS-X.

sudo gem install sinatra
sudo gem install shotgun
sudo gem install haml
sudo gem install unicorn

After installing these things I created a new folder in a Rubymine Project.

New Empty Project in Rubymine

New Empty Project in Rubymine

I added a Ruby Class named SinatraSingsOsx to the project. I then realized that Rubymine did not detect that I had installed Sinatra, so I did a quick find in Rubymine to find and get it synced/installed so that Rubymine was aware of the gems.

Rubymine IDE

Rubymine IDE

Using the gem quick install in Rubymine I chose the documentation and dependent gems.

Rubymine Gem Quick Install

Rubymine Gem Quick Install

Once those were synced up I added the following Ruby Code to the file I created in the project.

require 'rubygems'
require 'sinatra'

get '/' do
  "Verified: Server is up and running!"
end

I then right clicked on the ruby file and selected the “Run the sinatra_singing_osx” which starts up the webrick web server and such.

Rubymine Run Page Dialog

Rubymine Run Page Dialog

Then navigate to http://localhost:4567 and you’ll see the results of the code.

Sinatra Web Application Running in Chrome

Sinatra Web Application Running in Chrome

Now that I’ve run the application in Rubymine I wanted to do the same with Shotgun using the same Ruby code. The first thing I needed to do was stop the server running that Rubymine had launched. If you look at the bottom of the IDE you’ll see the window displaying the current server status.

Web Server Executing

Web Server Executing

On the left hand side of this status window click on the large red button. This will stop the service. To verify just scroll to the bottom of this status window and you will see the message “Process finished with exit code 1“.

Now that I had the server cleaned up and stopped, I started a terminal again and navigated to the directory that the *.rb file is in that I want to start (host/run/execute, I’m not really sure what the appropriate word would really be at this point). So once at the appropriate path (machineName:SinatraSingingOSX adron$) I typed:

shotgun -p 4567 sinatra_singing_osx.rb

Once this executes the same server that Rubymine uses, the WEBrick, will startup the application again. I launched the browser to assure this ran as expected and got the same results as if running it through Rubymine. I guess, it all really depends, want to just start building and checking things out or want to build with an IDE like Rubymine. It all really boils down to taste and what you’re working with. I’ve been going back and forth between pure text editor and IDE just to familiarize myself with both avenues of using Rails and coding with Ruby.

After the verification I hit Ctrl + C to stop the web server. This basically works on the msysgit in Windows, on OS-X, or on whatever distro of Linux you have running. The cool thing is, so does Rubymine. I figured if I was going to work toward familiarization of an IDE and using the terminal I’d use commands and IDEs that would work on whatever OS I’m running. It’s all good synergies that way. 🙂

I wanted to keep this entry pretty short. With that in mind I simply logged what I worked on while en route home on the bus one evening. So on the next bus ride I’m going to tackle getting some specific notes with Sinatra, getting this all pushed into Heroku (of course, I’m all about the Cloud, you didn’t think I’d put it up on a shared host did you!) Until then, chow.

ASP.NET MVC + Other Cleanup o’ The Day #1

Cleanup #1:

Here, let me help.  Replace this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Baseline
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}

With this:

using System.Web.Mvc;
using System.Web.Routing;

namespace Baseline
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute("Default", "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}

It’s not a huge cleanup, but it is cleaner. Got some other ideas to add? 🙂

The Beginning of Something New, FOOD!

Ok, so I’m sure about 90% of geeks & coders are also foodies at the same time. We all like to eat. A good many of us also like to partake upon a beer, whiskey, scotch, mixed drink, or all of them in a sitting once in a while. What am I leading up to? That’s simple, I’d love to get geeks together; .NETters, Rubiests, Railers, PHPers, Objective-Cers, Cloud/Grid/Utility Computing, Netops, Devs of this, Devops or any of a host of interests to have dinner, grab brunch on the weekend, or simply a cup of coffee. Now, the hard part, as it always is when herding cats is to get them herded at the same time to the same place. That’s when I fell into a thought, why not have multiple meals during the month and pick various days and times so people can meet up at their choice of time each month. With that in mind, here’s my first sample set of options, we can all vote, and then I’ll setup and calendar and get things arranged for meet ups. If you have food choices and such, let me know and we’ll do another vote for each meet. That way we don’t get bored or tired of the same place.

Here’s the schedule options, please vote: Take Our Poll

…and please do, retweet to your fellow Seattleite Geek or Nerd.

ALT.NET Day #3 & #4

The main conference day of the ALT.NET Conference was pretty awesome. With sessions going on diving deep into technical topics and other things, like where the women are in technology. In addition to the great sessions multiple open source software projects where in progress at the same time. Being able to pair up or just review code with people on these projects was truly awesome!

The Open Source Projects

There were the stated open source project and I also started an additional project that I’ve titled Regiztry.  It’s located on Github at https://github.com/Adron/Regiztry.

The Various Sessions

The sessions covered a range of topics, from the RESTful technology with Glenn Block to Reactive Extensions with a host of extremely smart people laying out the usage.

I laid out a session also on .NET and bringing the gap with Ruby on Rails in the startup realm. This session I hope to elaborate on a little bit with a subsequent blog entry.

Overall, another kick ass year for the ALT.NET Conference. I enjoyed it a lot, as I see via Twitter that a lot of other people did too! Always a good thing! So until next year, to all those I met it’s been great, cheers!

ALT.NET 2011 Day #2

Day #2 kicked off a bit late for me. I arrived around 9:30am which was a bummer, but I at least got a bit of breakfast. The first session I went to was the reactive extensions session. Again though, I was late, so I ended up lost from the get go. That was unfortunate. In addition, all of my computers I brought were either unprepared (didn’t have a VM setup on the Mac yet) or broken (the Win7 box wouldn’t boot Windows Explorer anymore, thank goodness for Launchy). In spite of all that I got lunch with a host of devs at Black Raven Brewery. Absolutely great beer there!

After that the nitty gritty hacking finally got started! I attended the AppHarbor Session (@AppHarbor) given by the founders Michael (@friism) and Troels (@troethom) and decided to start a project myself. I immediately had some bad ass cohorts jump on the team! Eric Ridgeway, Ryan Eastabrook, and Joe Balfantz. We got started, in spite of massive OS and System Failures.

The project that we started is called Regiztry and is available via a repo on Github. The idea for this project actually started with a conversation I had with Rodica Buzescu (@rodica) several months ago. The idea is a contribution, or sharing system, to work with or help out startups. Keep in mind, they’re not all landing VC money! I’ll have more descriptions about how this project is going and better descriptions of it in the near future right here on Composite Code. If you’d like to help out startups, the project, or just code with some awesome people like Eric Ridgeway, Ryan Eastabrook, and Joe Balfantz then message me on Github me.

Anyway, that’s what I got for day #2.