MongoMapper with Sinatra Example

If you have worked with Ruby on Rails Activerecord before you know how it makes working with databases very easy by giving you objects to deal with communication with the database. MongoMapper is an Object-Document-Mapper (ODM), it takes a lot of ideas from Activerecord and in turn should be very familiar. I found MongoMapper a good fit for people that want to use Sinatra ,because you are able to simply make your model classes right within the application file.
Read more →

MongoDB, added Ruby in to the mix

To keep with the previous posting I made with MongoDB, I am going to show some Ruby code of how to connect and push data in to your database. If you take a look at the MongoDB driver page you see that there are a good number of programming languages that are supported by MongoDB.org along with tons that are supported by the community. My languages of choice is Ruby. It’s a Supported language from MongoDB.
Read more →

My experience with Heroku

I haven’t done too much publishing of web applications for my own stuff. At work we have an Ops team that deals with setup and deployment of our code. I have used Rackspace cloud and AWS for setting up servers before but mostly just for testing and nothing for production. As a developer I want to focus on the code and not fine tune an application server. I want to be able to write code, push it out and scale without putting much thought in to it.
Read more →

LinkedIn authentication with Sinatra

To take the authentication with Sinatra a bit farther you may want to use another service to do your authentication against. This is some sample code adapted from a Rails example. This code takes use of the linkedin gem from Wynn Netherland to do the authentication and also make some calls to the LinkedIn API. There are other gems that just do authentication for many services like Facebook and Twitter but for this sample I wanted to be able to make additional calls to the LinkedIn API.
Read more →

Authentication with Sinatra

One of the things I’m heavily looking in to is Sinatra, it’s a micro-web framework which I feel gives you more freedom over your project and lets you rapidly prototype things out. You are able to keep a full app in one file which is perfect for use with Github’s Gist. Sinatra lets you quickly build web apps in a short amount of time with less complexity then a Rails app.
Read more →

Playing around with Amazon SNS in Ruby

For a upcoming Ruby project that I plan on working on I want to be able to send small messages to myself with information from a form that gets filled out. Amazon has just updated Simple Notification Service to be able to send SMS messages along with emails. This fits in perfectly with what I’m looking for. Looking on Amazon’s Github page for the aws-sdk gem I didn’t see any sample code for using SNS and googling I couldn’t find any right away.
Read more →

Updated World of Warcraft Armory code

I haven’t been playing World of Warcraft for a bit, but I guess they did some big updates to the armory which stopped the code I had written before from running correctly. (Link to the old code, Ruby and Groovy) After looking in to what has changed, I found out they added a new REST API for Battle.net which lets you pull data easily without the need of tricking the server to pass you XML.
Read more →

Project Euler 001

Made this posting sometime ago but I’ve been forgetting to actually post it. When I was looking up some information on Scala I found a great video tutorial on youtube made by MadocDoyu, which can be found here. In part of the video he introduces the Project Euler, this project seems really interesting. I plan on solving problems time to time using many of the languages I have looked at. I’m hoping this will keep my skills in these languages up to date.
Read more →

Comcast data usage, put a fork in it!

Yesterday I was looking around for some new Ruby gems to help with web scraping (also sometimes called screen scraping), I found Nokogiri which is a great gem for dealing with HTML/XML data. One of the great things about Nokogiri is that it lets you use CSS3 selectors to find the data your looking for. This kind of makes it like using jQuery but in Ruby. For working with one page and not interacting with a site Nokogiri is fine, but if you need something more, Mechanize most likely will do the trick.
Read more →

Install JRuby on Mac OS X

Same idea as the Groovy and Grails posting, most of the steps are the same but here they are. Download JRuby from http://www.jruby.org/, as of writing this the latest release is 1.6.0. I’m downloading the tar file, I believe it the same as the zip file just different format used to compress the files. $ cd Downloads $ tar -xzf jruby-bin-1.6.0.tar.gz Now lets move it to our /usr/share folder and make the needed symbolic link.
Read more →