Bivvo's blog

Develop/Learn/Share

Starting W/ Octopress

After many different blogging engines I have finally decided to use Octopress. This is just a sample post to see how well it works. I will work on blogging more about many different techologies and some self pondering in the future.

Running Through Koans

In my quest to be a more proficient developer. I recently took it upon myself to go over the ruby koans again. A few months ago I went over them without asking questions of what I was doing each step of the way. It is up to you. To question yourself that you understand each test you pass. For me one such area was grokking :symbols to the fullest. The first time going over it was easy to get every test in about_symbols.rb to pass. Later I had some confusion to how exactly they worked but managed. As time progressed as the koans asked more complex questions of you it becomes imperative that you understand the path that let you to where you are. (Example: triangle.rb)

There are a few things different I did this time around. I made sure to answer questions when the Koans asked them. If there was an item in ruby that behaved different then expected I would make a note of it. I worked on keeping myself in the console while I worked. This meant using a console base text editor. I am using windows but I went with one of the best out there “Vim”. While working with Vim I ended up learning more on using Vim in everyday life. While I am far from a competent Vim user I look forward to using it more in the future. Some new commands that I have learned that I found valuble while doing the Koans are.

  • f(x) : where x is next instance of the character to move to.
  • d(x): delete command. For instance de to delete to end of current work and d$ delete to end of line.
  • p|P: Pasting
  • yy: Yanking (Copying) once I learned Vim’s terminology for this made life more bearable.

While Vim is nice by itself. I found using it in a nicer console makes life even easier. For this I ended up turning to Console2. Having a tabbed console was great when running through the Koans. I would keep one tab open for Vim and another for finding my path_to_enlightenment.rb . Where I feel Console2 falls short is on copying and pasting. While I have it set up to copy on select I was not able to get this functionality to work.

Screenshot

My Console2 environment. One last item that is useful if running through the Koans is this little gem of a powershell script. With some minor modifications I set it up to monitory my koans directory. With this I was able re-run my test every time I saved a file. This made it easy to tab over to my watch window if I got stuck.

It Can’t Be This Easy!

Yes, I am late to the game. In preparing for a presentation I thought I would use some technologies I have been meaning to play with. Two of those would be NancyFx and Simple.Data. After playing with WebForms(I know, I know) and NHibernate for a while I must say it is nice to break with the ceremony. It is nice to have some low friction tools in the .Net ecosystem. We have been too long without.

NancyFx

What a pleasure to use. Instead of needing a bloated framework to even begin a site. You can start a new project in under 140 characters.

1
2
3
4
5
6
7
public class AppModule : NancyModule
{
   public AppModule() {
       Get["/"] = x => return "Hello Nancy!";
   }

}

Simple.Data

If you have used one of the many ORM frameworks out there you are well aware of the ceremony. From creating .hbm files to WSIWYG editors. Simple.Data does away with the pre-generated class and mappings. Instead you point it to your DB and it will infer what is being requested. To use the example from the Simple.Data github page.

1
2
3
4
public User FindUserByEmail(string email)
{
    return Database.Open().Users.FindByEmail(email);
}

All that and you did not have to create the scaffolding necessary to make it all work.

Making It Easy With Appharbor

The cloud… It a big complex beast that seems appears to be hard to grasp. Ec2 I did not get too much into due to having to manage the VM environments. The last time I got to play with Azure it was not so easy to setup and use. I have heard of heroku but I have not gone far down the RoR path at this time. Then I came across Appharbor. There are a few items that made it such an enjoyble experience from the beginning. Some of those would be.

*   Easy to deploy (use git or mecurial)
*   Easy to roll back
*   Runs all unit test before deploying
*   Its just awesome

The only problem that I can see with Appharbor is if you are not used to using git. It could take some getting used to. Once you discover the basics it is pretty easy to manage deployments. There are some caveats when deploying to Appharbor (or any cloud provider) in that your application should be stateless and not write to the disc. If you decide to take advantage of the scalability feature of Appharbor. Not following the stateless rule could come back to bite you. While I have not got to deploy anything of size to the Appharbor at this time. The opportunity to take advantage of it is just too tempting.

to the.. code.