Friday, August 15, 2008

Juggernaut Push Server


Juggernaut is a Rails plugin that allows you to push information out to the client, without them having to specifically request it. For certain domains, a push server is an excellent solution. Juggernaut uses a small bit of Flash to open up a flashxmlsocket from the browser to the push server, and it subscribes to the service. My roommate Taelor has been playing around with it for a little while, and has put together a chat application that creates rooms off of Digg topics. Its called Shovel Chat. He has also made a few blog posts about Juggernaut and using it to create a chatroom with rails at his blog, and has posted the source code on GitHub(note that you will need to go through his blog posts and edit some of the gem's files...)


So, the way the chat app works is that when you request the show action for a chatroom, some flash gets sent to subscribe to the channel on Juggernaut. Juggernaut will then send you a list of all the people in the room. If you type in a message and hit enter, the message gets posted to your Rails app. Inside the controller, the message gets sent to the Juggernaut server, which then pushes the message out to anyone subscribe to that channel. You could achieve a similar effect using AJAX, but you would have to have each client polling the server for updates to the chatroom, but this would be really difficult to scale.


Anyway, I've gotten his source code installed on my machine and have begun playing around with it, and hope to start contributing to his chat_sandbox on github soon. Feel free to make your own fork of his code on github and start contributing, and stay tuned for more updates!

-Ralph

Tuesday, August 12, 2008

The Ruby Hoedown

Last Thursday, my roommate and I packed and headed 3 hours south to the Ruby Hoedown in Huntsville, AL. It was held at the Shelby Center at UAH on Friday and Saturday. This was my first programming conference, so I thought I might jot down a little bit about how it went.


The first presentation was by the guys at Rails Envy. They talked about innovation in Ruby over the past year. I'm a big fan of these guys' podcasts and tutorials, and they gave a great presentation.


Next up was Robert Dempsey, who talked about Cloud Computing with Rails. He made a great argument against all the folks who say that Rails can't scale. He gave us very detailed explanations of what a Cloud is, and what scalability is. He showed us what it takes to use Amazon Web Services to scale a site up, and then gave us a brief descriptions of different utilities out there for scaling with a cloud: Amazon Web Services, Heroku, Joyent, Accelerator, Morph. One particularly intresting platform was Vertebra, which is being developed by the folks at Engineyard.


Vertebra is a "Next Generation Cloud Computing/Automation Framework". Ezra Zygmuntowicz has some slides posted at his blog. The backbone of the system runs on horizontally scalable erlang XMPP servers. XMPP is an IM/chat protocol this is very efficient. Ezra posted this tidbit on his blog: "Just to answer the question about Vertebra being open source or not. Yes vertebra will be open source, the ruby framework, the protocols and security stuff will all be open source. We may go with a commercial license on the workflow engine as that is a large piece of engineering but we have not decided yet. We want to get this out there and see what people do with it as I think there are limitless possibilities here. But we need to lock down the protocol and document everything and we are still experimenting with different parts of the system. I'd hope to have something to release in 4-6 weeks." Yehuda Katz gave a talk about Vertebra on saturday, and I had a chance to chat with him for a few minutes. He mentioned that some of the folks from Heroku were helping out on the project.


Jim Weirich and Joe O'Brien gave a great talk about mocking. This was an interesting talk because they acted it all out like they were 2 developers working on different problems that involved using mocks. The first one involved using a mock object to log in during testing, and in another one, they showed how you can refactor code so that you will be able to use a mock with it. I chatted with these guys at lunch on Saturday for a while.


Rein Henrich gave a very entertaining talk on Ruby Best Practice Patterns. He started off with a comical presentation on code unfactoring. He showed us different methods of making your code so unreadable that you are the only person able to reasonably maintain it. "Job security through code obscurity." Some of the methods he showed us were: un-DRYing your code; naming methods and variables in pig latin; and taking code that is abstracted into several small functions, and dumping it all into one huge one. After the talk on code unfactoring, he went on into his real presentation on best practice patterns. One of my favorites was the execute around method.


Some other notable talks at the conference included: bryanl(blog smartic.us), who talked about why you should "Test all the fucking time"; the truthy gem; Obie Fernandez's great talk on running a successful company; keynote talks by Chris Wanstrath and David Black; Troy Davis did a presentation on Adhearsion, a ruby framework for making and recieving phone calls; Giles Bowkett used Ruby and his program Archaeopteryx, to create music with code; Being a guitar player, Giles presentation was very interesting to me..unfortunately, Archaeopteryx is only availible for the Mac right now.


I had a great time at the conference. It was cool to be around so many other Ruby enthusiasts, and everybody was really nice. I definitely plan on going next year. Jeremy mentioned that he is planning on holding the Hoedown at Opryland Hotel in Nashville(only an hour away!), and that he hopes to get enough sponsors to host it for free. Even if it isn't free next year, I will gladly pay out another $200 to go again. If you've never been to a conference before, I highly recommend it. It was a very gratifying experience.


Well, thats all for now, I know I promised a post about my Google Summer of Code project, but I don't have it all together yet. If you are interested, it is a c-extension to speed up some of Ruby's CGI functions. You can check out the repo on github here. Farewell until next time!



Edit: Also, you can get videos of all the talks at ConFreaks. I spent a while chatting with both of the guys there, and one of them let me plug in my laptop to their powerstrip for the majority of the conference(I need a new battery...).