tag:blogger.com,1999:blog-358687622024-03-05T18:02:03.443-08:00Dead Programmer SocietyTo the day that the programmers start running the asylum. Carpe Codex!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.comBlogger198125tag:blogger.com,1999:blog-35868762.post-8939098540894042752012-02-11T08:21:00.001-08:002012-02-11T08:24:45.257-08:00The Blog Drought Is EndingAfter taking so much time off of any serious blogging (there might have been a guest post or two somewhere), I'm finally starting to feel the urge again to write something longer than 140 characters. The last year has been an incredibly busy one with The Hybrid Group, KidsRuby, and so much other goodness.<br /><br />So if any of you are still with me, I've returned. Hello!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-76680719153232340542010-11-30T23:05:00.000-08:002010-11-30T23:16:06.348-08:00Gabba: A Ruby Gem For Doing Server Side Google Analytics Tracking<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.thehype.fm/wp-content/uploads/2009/05/yo-gabba.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 385px; height: 394px;" src="http://www.thehype.fm/wp-content/uploads/2009/05/yo-gabba.jpg" border="0" alt="" /></a><br />Yo, Gabba! Gabba, hey? <a href="https://github.com/hybridgroup/gabba">Gabba</a> is a Ruby gem to do easy server-side <a href="http://google.com/analytics/">Google Analytics</a> tracking of page view and custom events. Gather around and I'll show you how it works.<br /><br />Google Analytics is the gold standard of website traffic reporting. In addition to tracking page views, one of the interesting capabilities it has is to track custom events. These could be shopping cart checkouts or video plays from clicking on a button in a Flash player.<br /><br />The way that Google Analytics is implemented is using the typical tracking image technique. An image is fetched from the server, and based on the infomation pased with this request, the information about the visit is tracked. One twist on this is that Google Analytics generates the tag for the "traxel" using a piece of asynchronous JavaScript. This means that clients without javascript are not able to use Google Analytics to track visitor metrics... or does it?<br /><br />There is another lesser-known way to integrate that can generate the needed info entirely on the server. This is normally used to handle older mobile browsers that do not have JavaScript implementations. Since all you are doing is fetching a 1x1 pixel GIF image, all you really need is the magic URL.<br /><br />This is in fact exactly what you would need to do if you want to track custom events, the only real difference being the specific parameters passed to Google Analytics.<br /><br />There are a number of cases where you might want to track custom events for non-browser devices or other unique situations. Tracking when a purchase is completed, or when a video is played by Flash player or a phone call is initiated, are just a few things you might want to track entirely on the server, with no browser interaction at all.<br /><br />I did a bit of searching, but did not find any Ruby library that did what I needed. You know what that means! Fire up the editor, I'm going in! And that is how the gabba gem was born.<br /><br />It is very easy to use:<br /><pre><br /># track page views<br />Gabba::Gabba.new("UT-1234", "mydomain.com").page_view("something", "track/me")<br /><br /># or track custom events<br />Gabba::Gabba.new("UT-1234", "mydomain.com").event("Videos", "Play", "ID", "123")<br /></pre><br /><br />That is all there is to using it. Simple way to get server side Google Analytics tracking of page view and custom events. Fork <a href="https://github.com/hybridgroup/gabba">gabba</a> on github, or just "gem install gabba" and start tracking all your fun stuff.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com6tag:blogger.com,1999:blog-35868762.post-2135204267457963582010-11-17T07:20:00.000-08:002010-11-18T09:20:10.498-08:0010 Cool Things From RubyConf X<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://rlv.zcache.com/x_hat-p148311112721548543qz14_400.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://rlv.zcache.com/x_hat-p148311112721548543qz14_400.jpg" border="0" alt="" /></a>This last week was the fantastic <a href="http://rubyconf.org/">RubyConf X</a>. It has been ten years of RubyConf and in celebration of this notable occasion, the organizers located it in New Orleans and opened up the registration to a lot more people then most years past. This had the clearly foreseeable consequence of turning the conference into a really fun time!<br /><br />So here, in no particular order, are 10 cool things I saw or heard at the conference.<br /><br /><h2>1. Rite</h2><br />During <a href="http://twitter.com/yukihiro_matz">Matz's</a> keynote he introduced "Rite" which is a embedded version of Ruby designed to run on devices such as digital TVs, and other neat small gadgets. It will have a different implementation that the CRuby implementation, optimized for the smaller lower powered profile of the next generation gadgets. The project is sponsored by the Japanese government and is already being used in development by a major game company that could not be named but is will known. My palms started sweating the minute I heard about it, and I am already getting excited about the prospect of <a href="https://github.com/deadprogrammer/flying_robot">flying_robot</a> 2.0 based on Rite.<br /><br /><h2>2. Evergreen w/CoffeeScript</h2><br /><a href="http://twitter.com/cjkihlbom">CJ Kihlbom</a> and <a href="http://twitter.com/jncoward">Jonas Nicklas</a> gave an excellent overview of client-side UI testing. They also demoed their own highly useful <a href="https://github.com/jnicklas/evergreen">Evergreen</a> testing framework which works together with Ruby and Jasmine looks like a very succinct and useful approach toward browser testing. Writing specs in CoffeeScript looks very tasty.<br /><br /><h2>3. Gentlemanly Git Tricks</h2><br /><a href="http://twitter.com/CHACON">Scott Chacon's</a> talks on git always leave me feeling knowing both more than I did, and less then I thought I did, at the same time. This session also had a hilarious and yet useful section on 'how to be a gentleman' including tips on whiskey, how to dress, how to tip, and how to treat a lady. Keeping it classy, Scott!<br /><br /><h2>4. "F-Bombs, Zeds, _whys and a Missing Brain Area"</h2><br />The keynote speeches from <a href="http://twitter.com/pragdave">Dave Thomas</a>, <a href="http://twitter.com/dhh">David Heinemeier Hansson</a> and Matz could not have been more different on the surface, and yet had a similar theme: defy the limitations of the status quo, and seek out new ideas that are actually better. Dave's admonishment of the community to get over our gender bias, David's F-bombs, weed photos, and cry of "Freedom!", and Matz's love of diversity from _why to Zed, and adopting of David's amusing yet appropriate term "freedom-patching" in lieu of the less pleasant-sounding "monkeypatching" were all different ways of showing our desire as a community to seek out these truths. As long as we keep talking to each other, and also listening with an open mind.<br /><br /><h2>5. Ruby 1.9.2 is Ready</h2><br />Several people have been saying it, I am been using it from some testing, and <a href="">Jim Wierich</a> said it in the 'hallway track': Ruby 1.9.2 is ready for prime-time. If you are not transitioning your apps to 1.9.2 you should be. Performance, and cool tools like minitest are just two reasons to do it today.<br /><br /><h2>6. Beyond The Code</h2><br /><a href="http://twitter.com/paulca">Paul Campbell</a>, <a href="http://twitter.com/objo">Joe O'Brian</a>, <a href="http://twitter.com/keavy">Keavy McMinn</a>, <a href="http://twitter.com/jondahl">Jon Dahl</a>, <a href="http://twitter.com/mojombo">Tom Preston-Werner</a> and several other interesting developers spoke about more than just programming. Hacking business, art, music, and code, are all just aspects of hacking. RubyConf is a great place to find out not just about Ruby code, but the motivations and inspiration behind people we respect, and look to to improve ourselves.<br /><br /><h2>7. Lightning Talks</h2><br />The number of people that are eager to signup for a lightning talk was huge at RubyConf, as always greatly exceeding the available time. Even trimming down each to 4 minutes, there was only time to get thru relatively few, and I was lucky to get to speak about the <a href="http://ticketrb.com">Ticketmaster</a> gem.<br /><br /><h2>8. Kid Programmer Mini-Conf</h2><br /><a href="http://twitter.com/ultrasaurus">Sarah Allen</a>, <a href="http://twitter.com/sarahmei">Sarah Mei</a>, <a href="http://twitter.com/purp">Jim Meyer</a> (who sadly could not make the conference at the last minute), <a href="http://twitter.com/liahhansen">Liah Hansen</a> put together a parallel kids programming track, for the first time ever at RubyConf. The idea was brilliant, and I hope to bring my own son next year to participate.<br /><br />UPDATE: Sarah Mei informs me that <a href="http://twitter.com/maxwellsalz">Maxwell Salzberg</a> is also an organizer of the kids track. My bad!<br /><br /><h2>9. Hallway Track</h2><br />As always, the conversations at RubyConf are amazing. The people who attend are doing amazing things, and the change to hang out for a few days talking is a fantastic chance to learn and find out incredibly useful and interesting things. You have to actually attend RubyConf to experience this, you just cannot get it by watching the videos.<br /><br /><h2>10. Music</h2><br />From the live music in New Orleans, to the DJs, it is really great to have been in a city where music is something living, vibrant, and cherished. Getting to do my music/brain hacking talk on <a href="http://rubyconf.org/presentations/36">"How To Jam In Code"</a> was just the icing on the cake for me in the city of Jazz. Getting to create a bio-computer made of living people is a special privilege, thank you very much to everyone who participated.<br /><br />But most of all, thank you very much to <a href="http://twitter.com/kellyjeanne">Kelly Fowler</a>, <a href="http://twitter.com/chadfowler">Chad Fowler</a>, <a href="http://twitter.com/rich_kilmer">Rich Kilmer</a>, and <a href="http://twitter.com/david_a_black">David Black</a> for doing so very much for all of us. It is a lot of hard work, and we all appreciate it!<br /><br />RubyConf X was a tremendous affirmation of the strength and depth of sharing within the Ruby community. I look forward to seeing what the next ten years have in store for us.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com4tag:blogger.com,1999:blog-35868762.post-27123345626929807132010-03-24T09:44:00.000-07:002010-03-24T10:20:02.143-07:00Happy Ada Lovelace Day 2010<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjWbaMM1I92ZBCDXlXl8kFZB2Osjekg7DdU46aaLMhcB1ps9XYwfAEUI19EG9AGrvHvBLyIWenOQnR-YyRKbV9Qwa_rgjt4XiW-QVMh388fQzRffF2iTMvaJpdrFCHDjfySHgc/s1600/barbie-programmer.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjWbaMM1I92ZBCDXlXl8kFZB2Osjekg7DdU46aaLMhcB1ps9XYwfAEUI19EG9AGrvHvBLyIWenOQnR-YyRKbV9Qwa_rgjt4XiW-QVMh388fQzRffF2iTMvaJpdrFCHDjfySHgc/s200/barbie-programmer.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5452248937117063298" /></a>Once again, it is <a href="http://en.wikipedia.org/wiki/Ada_Lovelace">Lady Ada Lovelace</a> day, and time for me to celebrate some women software developers that I know personally. This year I want to call out four women that I have especially noticed their knowledge and dedication. In no particular order...<br /><br />First, a big shout out to Sarah Mei (<a href="http://twitter.com/sarahmei">@sarahmei</a>). Sarah is a founder of <a href="http://railsbridge.org/">RailsBridge</a>, a non-profit organization dedicated to helping people learn about and make use of Ruby on Rails. She is also a conference speaker who has been going around hyping up the community about one of the subjects most near and dear to my heart: teaching kids programming.<br /><br />Next, a special thanks to Sonia Ramirez, my colleague at <a href="http://hybridgroup.com">our Los Angeles based software development consultancy The Hybrid Group</a>. Sonia is a tireless and detail oriented software developer. She is always eager to learn, and brings a great sense of humor to all of her work with us.<br /><br />Third, a special thanks to <a href="http://www.chariotsolutions.com/">Andrea O.K. Wright</a>. Andrea has been a very active member of the Ruby community, and has given a number of presentations, must recently an incredibly ambitious overview of NoSQL databases at RubyConf 2009.<br /><br />And rounding out this small sampling of the XX chromosome-based programming talent, is a new acquaintance Sarah Allen (<a href="http://twitter.com/ultrasaurus">@ultrasaurus</a>). Sarah is also involved with the RailsBridge project, and is a mobile software developer who has published several projects based on the <a href="http://rhomobile.com/">Rhodes</a> framework. She is also a conference speaker, and published the RubyConf mobile application that we all made use of at <a href="http://www.larubyconf.com/">LARubyConf</a> earlier this year.<br /><br />These persons of the female gender are merely a small sampling of the awesomeness that exists within the Ruby community. They just happen to be ladies that I have either worked with, or benefited from their contributions directly.<br /><br />Thank you all, and have a great Ada Lovelace Day. And get back to some coding!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-63321476481693046082010-03-04T10:30:00.000-08:002010-03-04T10:36:58.654-08:00Configuring Hybrid Ruby on Rails Applications On EY-Cloud<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2081/2219708271_ec0bb4cb80.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 250px; height: 333px;" src="http://farm3.static.flickr.com/2081/2219708271_ec0bb4cb80.jpg" border="0" alt="" /></a>This last weekend, we completed migration of a slightly more complex Ruby on Rails application than the usual to <a href="http://www.engineyard.com/products/cloud/features">Engine Yard's EY-Cloud</a>. It took a few tries, and a tiny bit of research, before we completely understood what to do to get it up and running with all of the needed capabilities. Naturally this was due to gaps in my own knowledge, and I wanted to post about what I had learned, and how awesome EY-Cloud really is!<br /><br />If you do not know about it, EY-Cloud is Engine Yard's cloud platform that is based on <a href="http://aws.amazon.com/ec2/">Amazon's EC2</a>. Readers of this blog know I am not afraid to <a href="http://deadprogrammersociety.blogspot.com/search/label/ec2">get hardcore when it comes to EC2 server configurations</a>, and with EY-Cloud I feel like I can now get the best of everything. But I am getting ahead of myself.<br /><br />Let me briefly describe the architecture of the application I was migrating. The main application is written in Ruby on Rails and uses MySQL as its data store. The app provides UI and an API for interactions with the application, mostly called by a <a href="http://phonegap.com">custom iPhone app written using PhoneGap</a>. The main app is secured using an SSL certificate. In addition, a separate API for a specific high-performance capability is written using Sinatra and DataMapper. This "special API" is also secured via SSL.<br /><br />OK, you got that? Perhaps not, so here is a diagram to illustrate what I am talking about:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.gliffy.com/pubdoc/2008066/M.png"><img style="display:block; margin:0px auto 10px;cursor:pointer; cursor:hand;width: 525px; height: 406px;" src="http://www.gliffy.com/pubdoc/2008066/M.png" border="0" alt="" /></a><br /><br />We call this kind of application a "hybrid" application, meaning that it is built using Ruby on Rails + "something else". For this app, the "something else" is Sinatra + DataMapper.<br /><br />The previous installation used the same basic setup, but was created manually using hand-configured EC2 instances. This required a lot more management to keep the application going, and especially to add or remove instances to the cluster. Backing up the entire configuration by creating custom AMI's was also very labor intensive.<br /><br />This was the scenario that led us to wish to migrate the app from raw EC2 to EY-Cloud. So if you are planning to set something like this up yourself, here are my notes to share my experience migrating a hybrid Ruby on Rails application to EY-Cloud.<br /><br /><b>Prerequisites</b><br />You need to have an account setup with Engine Yard for EY-Cloud. In addition, you should have installed the Elasticfox plugin for Firefox to easily administer the security groups. You can also do this via the command line, but it is a lot more effort.<br /><br /><b>Configure Main Environment & Application</b><br />Configuring your main application for EY-Cloud is a pretty simple process. It basically requires setting up private key access to the git repository and the application settings using the web based interface that Engine Yard provides. There is a complete <a href="https://cloud-support.engineyard.com/faqs/overview/getting-started-with-engine-yard-cloud">article that describes this in detail here</a>. The main steps are:<br /><ul><br /><li>Create main environment</li><br /><li>Create main application and configure access to its git repo</li><br /><li>Config ssh key you will use to connect to instances</li><br /><li>Add ssl certificate, and config main app to use it</li><br /><li>Config any needed gems and unix packages to be used by main app</li><br /><li>Launch app server and separate database server in main environment</li><br /></ul><br /><b>Configure Secondary Environment & Application</b><br />Now you are ready to configure the environment and application for the other public accessible SSL protected service that is part of the application. This needs to be a secondary application because EY-Cloud currently only allows a single SSL cert per environment, and only allows you to associate it with one application. Hence needing a second environment configured. The main steps are:<br /><ul><br /><li>Create specialapi environment</li><br /><li>Create specialapi application and configure access to its git repo</li><br /><li>Config ssh key you will use to connect to specialapi instances</li><br /><li>Add ssl certificate, and config specialapi app to use it</li><br /><li>Config any needed gems and unix packages to be used by specialapi app</li><br /><li>Launch specialapi app in specialapi environment. No database is necessary.</li><br /><li>Copy contents of database.yml from /data/mainapp/shared/config/database.yml on "main app" server to /data/specialapi/shared/config/database.yml on "specialapi" server. Yes, you will need to use SSH to login to both servers.<br /><li>Use keep file on the database.yml location on the specialapi environment to point to the master database in the main app environment. <a href="https://cloud-support.engineyard.com/faqs/questions/making-changes-to-nginx-apache-or-monit-configs-with-keep-files">This page explains about keep files</a>.</li><br /></ul><br /><b>EC2 Security Configuration</b><br />In order to allow the secondary environment to get access to the database located in the main environment, you need to make a small but critical change to the configuration in the EC2 Security Groups. Otherwise the internal firewall at Amazon will not allow the application to access the database. It is very easy to configure this using Elasticfox. Here is how:<br /><ul><br /><li>Setup your EC2 security credentials for your EY-cloud account. You can download them as part of the ey-cloud.yml file</li><br /><li>Once you are connected to that account using elasticfox, click on the "Security Groups" tab. You should see 3 security groups "default", one for the main app named something similar to "ey-myapp_production-12341234" that refers to the main environment, and another one named something like "ey-secondaryapp_production-56785678" that refers to the secondary environment</li><br /><li>Click on the "ey-myapp_production-12341234" group in the left pane labeled "Your Groups" then click on the green checkmark icon at the top of the "Group Permissions" pane. This will bring up the "Add New Permission For Security Group" dialog. Click on the "Group" tab, then choose the "ey-secondaryapp_production-56785678" group from the Groups dropdown, and click on the "Add" button. Your secondary environment should now be able to access the main environment's database</li><br /></ul><br /><b>Conclusion</b><br />It is pretty great to be able to take advantage of both the cool management interface and scalable clustered database and application stack, as well as being able to get down and dirty via SSH, something you really do need in order to configure more complex hybrid Ruby on Rails applications. EY-Cloud provides this kind of capability, and is certainly a lot easier than managing it all yourself. Hopefully, these notes will make it easier for you to migrate your own complex application. Please let me know how it works for you.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com1tag:blogger.com,1999:blog-35868762.post-64219101720390578792010-02-22T11:40:00.000-08:002010-02-22T11:54:46.771-08:00I Was A Guest Blogger At LARubyConf 2010<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://jeanonjean.files.wordpress.com/2009/08/reporter-the-philadelphia-story.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 177px; height: 223px;" src="http://jeanonjean.files.wordpress.com/2009/08/reporter-the-philadelphia-story.jpg" border="0" alt="" /></a>Longtime readers of this blog know that I can really get into writing about Ruby conferences, and I had a great time this last weekend at <a href="http://larubyconf.com">LARubyConf 2010</a>. This time, I got to try some thing new: I was guest blogging the conference for <a href="http://www.thebitsource.com">TheBitSource</a>, which has been providing some great coverage of other tech events like <a href="http://www.pycon.org/">PyCon</a> and <a href="http://www.socallinuxexpo.org">SCALE</a>.<br /><br /><a href="http://www.thebitsource.com/tech-conferences/larubyconf-2010-a-ruby-in-the-sun/">Please check out my complete recap from the 2nd annual Los Angeles Ruby Conference LARubyConf 2010 here</a>. And thanks!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-4198572329988804982010-01-18T08:30:00.000-08:002010-01-18T08:32:13.612-08:00Crossing The PhoneGap For Multiplatform Mobile Applications<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.elvincountry.com/travel-images/02802741.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 214px; height: 185px;" src="http://www.elvincountry.com/travel-images/02802741.jpg" border="0" alt="" /></a>I had first heard of the <a href="http://phonegap.com/">PhoneGap</a> open source framework for multiplatform mobile development last year at the <a href="http://futureruby.com/">FutureRuby</a> conference in Toronto. Honestly, I did not really concentrate on all they were saying at the time, and in the flurry of info including back-to-back mobile sessions with <a href="http://rhomobile.com/">Rhomobile</a>, I did not fully retain a clear picture of what they had to offer. My bad.<br /><br />It was not until late last year, while working on plans for a very cool mobile application, that I was reminded about PhoneGap by one of my colleagues. After a brief evaluation of their benefits vs. the other multiplatform options, we decided to use PhoneGap on this particular project. We have made some amazing progress with using PhoneGap for mobile development since then, and I thought I would share a few of the lessons learned.<br /><br />First of all, a quick explanation of how PhoneGap works. <a href="http://blogs.nitobi.com/jesse">Jesse MacFadyen</a>, one of the programmers at <a href="http://nitobi.com/">Nitobi</a>, the primary developers of PhoneGap, has a <a href="http://blogs.nitobi.com/jesse/2009/11/04/phonegap-for-iphone-exposed/">good blog post</a> where he breaks down how the PhoneGap framework works on iPhone. Here is my much condensed take on what he is saying.<br /><br />All of the mobile platforms supported by PhoneGap have some kind of web browser control. A PhoneGap application is a packaged up application which is a webpage or mini-website, that executes inside whatever web browser control is available on that platform. Add in a standard JavaScript API to a wrapper that accesses the device-specific functionality like GPS or the accelerometer, and you can hook up the JavaScript on your "page" to the hardware. <br /><br />But don't make the mistake of thinking you should just slap together some web pages formatted for mobile. Rather, you can and must think of it as an application that is written in the form of a single web page with a bunch of JavaScript. To access server data, you will need to write some AJAX code to access the remote resources, then update your UI accordingly. The good news is you can use familiar JavaScript libraries such as <a href="http://jquery.com/">jQuery</a> to do so. We chose <a href="http://www.jqtouch.com/">jqTouch</a> to get a very iPhone-like UI.<br /> <br />The PhoneGap framework is under very active development. New code is being committed to their <a href="http://github.com/phonegap/phonegap">github repo</a> frequently. As such, you really do need to have git installed, and some working knowledge of how to use it, to get things setup.<br /><br />In fact, the device specific functionality for each platform is contained within the main PhoneGap git repository as a series of git submodules such as <a href="http://github.com/phonegap/phonegap-iphone">phonegap-iphone</a>, <a href="http://github.com/phonegap/phonegap-android">phonegap-android</a>, etc. This makes it all but impossible to install the latest and greatest without git. Being a git user myself, this does not pose any problem, and if you are not gitmotized yet, this is an ideal time to become so.<br /><br />Here are the series of steps I followed to create my own PhoneGap project...<br /><br /><b>Prerequisites</b><br /><ul><br /><li>Install iPhone SDK (yes, you must join the iPhone developer program)</li><br /><li>Install Android SDK (<a href="http://www.talkandroid.com/android-sdk-install-guide/">http://www.talkandroid.com/android-sdk-install-guide/</a> has some good instructions. I am not using Eclipse, so I skipped all that)</li><br /><li>Install Apache Ant (sudo port install apache-ant)</li><br /></ul><br /><b>Install PhoneGap</b><br /><ul><br /><li>Get latest PhoneGap (git clone git://github.com/phonegap/phonegap.git)</li><br /><li>Get submodules for iPhone & Android (cd phonegap && git submodule update)</li><br /><li>Build iPhone Lib and install</li><br /><li>Build Android libs</li><br /></ul><br /><b>Setting Up A New Multiplatform PhoneGap Project</b><br /><ul><br /><li>Create a new iPhone project using the phonegap-iphone template. The www directory in the new project will be becoming the shared part of your project, with all your UI and application logic</li><br /><li>Create the Android project using the phonegap-android build script. Use the www directory from the iphone project as the www-dir param. You will be replacing this with a reference to the git submodule</li><br /><li>Create a new git repo in the www directory in the iPhone project, and commit all the files in the www directory</li><br /><li>Change directories to the parent of where you want to put the directory for the shared git repo, then clone the repo located at /path/to/iphoneproj/www to /path/to/sharedrepo. You may also want to create a remote branch at this point for the new shared repo</li> <br /><li>Remove the www directory from the iPhone project</li><br /><li>Create a new git repo in the iphone project directory, then commit all files. You may also want to create a remote branch at this point</li><br /><li>Put the shared code into the iPhone project by using "git submodule add" to put a reference to the shared repo into /path/to/iphoneproj/www</li><br /><li>Create a new git repo in the Android project directory, then commit all files. You may also want to create a remote branch at this point, as you probably did for the iPhone project files</li><br /><li>Remove the /path/to/androidproj/assets/www directory from the Android project, and use "git submodule add" to put a reference to the shared repo at /path/to/androidproj/assets/www</li><br /></ul><br />You now should have 3 git repos, with the shared code, the iPhone specific project code, and the Android specific project code, each in their respective places. Much easier and nicer to work on.<br /><br />Anyhow, I hope this info is useful to any PhoneGap developers that want to get things setup cleanly for multi-platform mobile programming. Please let me know any feedback or improvements that people out there come up with, for this neat open source framework for doing JavaScript-based mobile development.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com3tag:blogger.com,1999:blog-35868762.post-72539150969836242862010-01-12T12:12:00.000-08:002010-01-12T12:29:46.352-08:00Sparkline Some Interest With Ruby on Rails<img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 250px; height: 188px;" src="http://farm1.static.flickr.com/29/62568004_cb569e408c.jpg" border="0" alt="" />Recently, I added some <a href="http://en.wikipedia.org/wiki/Sparkline">sparkline</a> graphs to a Ruby on Rails application. A sparkline is a very small graphic that displays a large amount of information, typically shown over time, and usually embedded in some other text. Invented by the father of modern infographics <a href="http://www.edwardtufte.com">Edward Tufte</a>, the sparkline has become a fixture of many online applications that want to visually display some stats in a simple, integrated way.<br /><br />When it come to adding sparklines into a Ruby on Rails application, there are a couple of different options. You can chart the data on the server, output being an image file. You can also chart the data on the client, with a couple of different JavaScript libraries as available options.<br /><br />I started my plan, intending to implement my charts on the client-side. The project that appears to have the most flexibility, speed, and options, is an amazing jQuery plugin called <a href="http://omnipotent.net/jquery.sparkline/">jQuery Sparkline</a>. Unfortunately, the project to which I needed to add the sparklines is a bit older, and does not use jQuery. As a result, I was not able to use jQuery Sparkline for this current project.<br /><br />Another interesting JavaScript sparkline library is <a href="http://github.com/lethain/sparklines.js">lethain's Sparkline.js</a>, but it has not been updated in some time, and is not compatible with current Internet Explorer versions. There is also an interesting looking newer lib <a href="http://github.com/topfunky/topfunky-sparkline-js">topfunky-sparkline-js</a> but I have not tried it out yet. <br /><br />So that brings us to server-side sparkline generation. If you are using ImageMagick/RMagick then @topfunky once again provides, with the Ruby <a href="http://github.com/topfunky/sparklines">sparklines gem</a>. This gem provides lots of options for doing all sorts of fancy sparklines.<br /><br />In my case, I am not using ImageMagick for anything else, so I did not want to install it just for this. What I really wanted was something much lighter-weight, and I was willing to accept a lot fewer options to get it. <br /><br />It turns out that <a href="http://twitter.com/madrobby">madrobby</a> has written a library for generating very simple sparklines in pure Ruby code, called <a href="http://github.com/madrobby/spark_pr">spark_pr</a>. The project uses _why's pure Ruby implementation of a PNG generator to do the low-level work. <br /><br />spark_pr has also spawned an interesting application of it from <a href="http://twitter.com/technoweenie">@technoweenie</a> called <a href="http://rack-sparklines.heroku.com/">Sparkplug</a>, which is a Rack module that generates spaklines from CSV data on the fly, using Rack handlers and Rack caching.<br /><br />Once I had seen Sparkplug's minimal elegance, it seemed spark_pr was the option for me. I decided to incorporate spark_pr into my application. Given that the app was written with a dedicated approach to keeping a clean RESTful interface, and that the database already contained the time-series data, it was quite easy to incorporate. Here is what I had to do:<br /><br />Step 1: Put spark_pr.rb file into lib directory. I just grabbed the code from the repo, and dropped it into my project. You may decide to have a more sophisticated way to do it, such as using git submodules.<br /><br />Step 2: <pre>require "spark_pr"</pre> in your controller<br /><br />Step 3: <pre>include Spark</pre> in your controller<br /><br />Step 4: Add PNG format to controller action that was already returning my time-series data, and return the sparkline PNG data:<br /><script src="http://gist.github.com/275414.js"></script><br />Note that this controller action is already returning XML or JSON. PNG is just another format to be added, if you have a well-designed RESTful controller action.<br /><br />Step 5: Put image_tag that requests the sparkline PNG image file into the view where you want it to appear, like this one:<br /><script src="http://gist.github.com/275578.js"></script><br /><br />Voila! Refresh that view and you should now be looking at your ultra-hipster-chic sparkline graph. It is surprising how much more information comprehension a person has, when they are seeing a visual representation of their data. Plus it looks cool.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-17750937346664989182009-12-31T09:07:00.000-08:002010-01-01T10:08:52.142-08:00Thanks For A Great #code2009<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://edibleink.files.wordpress.com/2009/11/champagne2-1.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 279px;" src="http://edibleink.files.wordpress.com/2009/11/champagne2-1.jpg" border="0" alt="" /></a>It has been an amazing year for both personal and professional code development.<br /><br />Starting with the inspiration to begin <a href="http://flyingrobo.com">Project Flying Robot</a>, to the prestige of presenting at <a href="http://www.larubyconf.com/">LARubyConf</a>, <a href="http://futureruby.com/">FutureRuby</a>, <a href="http://twtrcon.com/">TWTRCON</a>, <a href="http://ignite.oreilly.com/">IgniteLA</a>, <a href="http://parnassusgroup.com/twitterconference/">140 The Twitter Conference</a>, <a href="http://www.rubyconf.org/">RubyConf</a>, and <a href="http://www.conferenciarails.org/">Conferencia Rails</a>, and lastly the year-end fun of starting out the ongoing <a href="http://search.twitter.com/search?q=%23code2009">#code2009</a> Twitter meme, so popular that it spawned a couple of mashups and got picked up by <a href="http://news.ycombinator.com/item?id=1023432">Hacker News</a> and uber-language blog <a href="http://lambda-the-ultimate.org/node/3749">Lambda the Ultimate</a>. <br /><br />In between were numerous meetups, hackfests, code jams, code dojos, pull requests, and casual codeslinging with friends. And the <a href="http://www.makerfaire.com/">Maker Faire</a>! <br /><br />To everyone who welcomed me, listened to me, helped me, or taught me something, I am indeed grateful. Thank you. Let's do this 2010 thing right!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-50542891442779924112009-11-16T08:15:00.000-08:002009-11-16T08:30:05.497-08:00Flying Robot: World Tour 2009 Continues<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.kissfaq.com/tours/kiss_pctour2.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 198px; height: 250px;" src="http://www.kissfaq.com/tours/kiss_pctour2.jpg" border="0" alt="" /></a>As usual, no blog posts = a lot of other activity here at Flying Robot HQ. Among other personal stuff, my brother <a href="http://twitter.com/damenevans">Damen Evans</a> and I have been getting ready for the last public demos of <a href="http://twitter.com/flyingrobot">@flyingrobot</a> for 2009. And we are going out with style! <br /><br />Later this week, we roll up to San Francisco to present at the prestigious <a href="http://rubyconf.org">RubyConf</a>! Then, next week @flyingrobot and I will fly off to Madrid, Spain, to do our first European appearance at the awesome-looking <a href="http://www.conferenciarails.org/">Conferencia Rails</a>.<br /><br />Anyhow, if you have been waiting eagerly for more Flying Robot news and gadgets, be patient. We will be unveiling our mysterious cool new stuff in just a few days...Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-35823859447183401262009-10-10T11:19:00.000-07:002009-10-10T17:05:31.308-07:00PostgreSQL on Ubuntu on EC2: Backing It All Up<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1luLRXKoJM8/SJPNIpIJamI/AAAAAAAAGnQ/QgxlU54iRrU/s400/dean%2Bback.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 300px; height: 400px;" src="http://1.bp.blogspot.com/_1luLRXKoJM8/SJPNIpIJamI/AAAAAAAAGnQ/QgxlU54iRrU/s400/dean%2Bback.jpg" border="0" alt="" /></a>This post continues what I started with <a href="http://deadprogrammersociety.blogspot.com/2009/08/postgresql-on-ubuntu-on-ec2.html">"PostgreSQL on Ubuntu on EC2: The Installation Guide"</a>. Once you have your PostgreSQL database server instance running, you will need to backup two different things: your database data, and the instance itself. The database data will be backed up using Elastic Block Storage (EBS) snapshots. Once we have the instance running the backups correctly, we will then create an Amazon Machine Image (AMI) that will allow you to launch a new instance to replace the database server in case it goes down.<br /><br /><b>Backing Up The Database</b><br />First, we need to connect to our database server instance via SSH using the ubuntu user. <br /><br />We will need to install some dependencies to get our backup script to run:<br /><code><br />sudo apt-get install build-essential<br />sudo apt-get install ruby1.8-dev<br />sudo apt-get install rubygems<br />sudo gem update --system<br /></code><br /><br />You will need to tweak RubyGems so that the update works correctly, as <a href="http://www.videc.at/2009/04/30/rubygems-undefined-method-manage_gems-for-gemmodule-nomethoderror/">described here</a>.<br /><br />Now you can install Gemcutter, which is the new ultra cool repository for gems:<br /><code><br />sudo gem install gemcutter<br />sudo gem tumble<br /></code><br /><br />Finally we are ready to install the Amazon EC2 rubygem:<br /><code><br />sudo gem install amazon-ec2<br /></code><br /><br />Now we can create our backup script. Save this code into the ~/ directory under the name backup_database.rb. You will need to substitute the Amazon ACCESS_KEY_ID and SECRET_ACCESS_KEY, as well and entering the correct EBS volume for the DATABASE_VOLUME constant:<br /><code><br />#!/usr/bin/env ruby<br /><br /> require 'rubygems'<br /> require 'AWS'<br /><br /> ACCESS_KEY_ID = 'YOUR_ACCESS_KEY'<br /> SECRET_ACCESS_KEY = 'YOUR_SECRET_ACCESS_KEY'<br /> DATABASE_VOLUME = 'vol-XXXXXXXX'<br /><br /> puts "Starting database snapshot..."<br /> ec2 = AWS::EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)<br /> ec2.create_snapshot(:volume_id => DATABASE_VOLUME)<br /> puts "Database snapshot completed."<br /></code><br /><br />Due to the finicky way that Ruby runs as part of a cron job, we are best off creating a shell script that then runs the Ruby backup script. Save this code into the ~/ directory under the name backup_db.sh:<br /><code><br />#!/bin/sh <br />cd /home/ubuntu<br />ruby /home/ubuntu/backup_database.rb<br /></code><br /><br />Don't forget to make the backup shell script executable:<br /><code><br />chmod +x /home/ubuntu/backup_db.sh<br /></code><br /><br />Now we just need to configure this script to run as part of a cron job, so that the backups take place automatically. The crontab command brings up the list of configured cron tasks for the current user:<br /><code><br />crontab -e<br /></code><br /><br />This example crontab entry runs the backup daily at midnight, but you may want it to run more frequently:<br /><code><br />0 0 * * * /home/ubuntu/backup_db.sh<br /></code><br /><br />At this point, you should have a fully functional automated backup system. Verify after midnight that the script has run as you expect, by looking to see if a new snapshot has been created, using Elastifox or however you administrate your EC2 instances.<br /><br /><b>Creating The AMI</b><br />Creating the AMI to backup the entire database instance is pretty easy. First, you need to upload the PEM files. Remember you are authenticating as the "ubuntu" user:<br /><code><br />scp -i id_rsa-gsg-keypair pk-YOUR.pem cert-YOUR.pem ubuntu@domU-12-34-31-00-00-05.usma1.compute.amazonaws.com:<br /></code><br /><br />Use your SSH connection into the database server instance to copy the PEM files to the /mnt directory:<br /><code><br />sudo cp /home/ubuntu/*.pem /mnt<br /></code> <br /><br />Now create the bundle. Make sure you use your Amazon account number (without dashes) as the value for the -u parameter. This can take quite a while, so do not get impatient:<br /><code><br />sudo ec2-bundle-vol -d /mnt -k /mnt/pk-YOUR.pem -c /mnt/cert-YOUR.pem -r i386 -u YOURUSERACCOUNTNUMBER<br /></code><br /><br />You can now upload the bundle to your Amazon S3 account, in preparation for making available as an AMI. Use something versioned for the -b parameter which is the name of the bundle:<br /><code><br />sudo ec2-upload-bundle -b my-database-server-1.0-ami -m /mnt/image.manifest.xml -a YOUR_ACCESS_KEY -s YOUR_SECRET_ACCESS_KEY<br /></code><br /><br />Final step is going back to your local machine, and making the newly created bundle available to be used to start a new instance:<br /><code><br />ec2-register my-database-server-1.0-ami/image.manifest.xml<br /></code><br /><br />You can now now launch a brand new database server instance based on this AMI, and it will be a clone of your existing database server. This is the procedure you would follow if you need to restore your database server instance from backups.<br /><br /><b>Restoring Your Database Server From The Backups</b><br />In the case that something goes terribly terribly wrong, you can get back to normal as follows:<br />- startup a new EBS volume from your most recent snapshot backup, <br />- start up a new server from your database AMI<br />- configure your new server instance to use the new volume started from the backup data<br />- switch your elastic IP to point to the new server, or update the references in your application to point to the new server<br /><br />This concludes part 2 of the great PostgreSQL config post for the EC2 cloud. Hopefully it will help you with a nice simple way to take the basic PostgreSQL instance that you got up and running on Ubuntu/EC2 using the directions in the <a href="http://deadprogrammersociety.blogspot.com/2009/08/postgresql-on-ubuntu-on-ec2.html">part 1 post</a>, and add the confidence that backed up data and a completely reproducible configuration provides.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com9tag:blogger.com,1999:blog-35868762.post-39005864098899587292009-09-13T15:42:00.000-07:002009-09-13T16:32:49.086-07:00Happy 200 Posts: My 10 Personal Favorites<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://kedarvideo.files.wordpress.com/2008/08/47000-candles.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 267px; height: 151px;" src="http://kedarvideo.files.wordpress.com/2008/08/47000-candles.jpg" border="0" alt="" /></a>I was shocked to discover this morning that this is to be my 200th blog post. Wow! It has been a good run so far since I restarted the Dead Programmer Society in 2006, and I really appreciate the awesome feedback and support that I have received from the community.<br /><br />To commemorate this personal event, here is a list of my top 10 favorite posts, in no particular order:<br /><br />1. <a href="http://deadprogrammersociety.blogspot.com/2007/05/i-would-rather-be-jazz-programmer.html">"I'd Rather Be A Jazz Programmer"</a><br />2. <a href="http://deadprogrammersociety.blogspot.com/2009/05/fear-and-loathing-at-railsconf-2009.html">"Fear And Loathing At RailsConf 2009"</a><br />3. <a href="http://deadprogrammersociety.blogspot.com/2006/10/programming-zombies-will-crush-you.html">"Programming Zombies Will Crush You"</a><br />4. <a href="http://deadprogrammersociety.blogspot.com/2009/03/twitter-1-2-3-rule.html">"The Twitter 1-2-3 Rule"</a><br />5. <a href="http://deadprogrammersociety.blogspot.com/2008/04/goldilocks-and-three-icons.html">"Goldilocks and the Three Icons"</a><br />6. <a href="http://deadprogrammersociety.blogspot.com/2008/01/money-in-ghetto.html">"Money In The Ghetto"</a><br />7. <a href="http://deadprogrammersociety.blogspot.com/2007/03/i-speak-for-code.html">"I Speak For The Code"</a><br />8. <a href="http://deadprogrammersociety.blogspot.com/2007/01/folly-of-accountabalism.html">"The Folly Of Accountabalism"</a><br />9. <a href="http://deadprogrammersociety.blogspot.com/2006/11/planning-game-vs-crying-game.html">"The Planning Game Vs. The Crying Game"</a><br />10. <a href="http://deadprogrammersociety.blogspot.com/2006/10/architect-is-not-honorary-title.html">"Architect Is Not An Honorary Title"</a><br /><br />Once again, I thank everyone for your support, and I look forward to telling more tales from the Dead Programmer Society.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-88687414962094442482009-08-15T01:27:00.000-07:002009-08-15T06:05:00.622-07:00PostgreSQL on Ubuntu on EC2: The Installation Guide<img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 409px;" src="http://www.popgadget.net/images/russian-doll.jpg" alt="" border="0" />For some time, I have had clients hosting a couple different applications on Amazon EC2 using Ubuntu. One of these apps uses PostgreSQL, and has been running without event for quite a while. Yesterday, I got to catch up for lost time, by spending the entire day wrestling with data recovery issues related to a failed apt-get upgrade on an important database server. Luckily, the awesome <a href="http://twitter.com/esh">Eric Hammond</a> was around on IRC, came to my rescue, and coached my thru my self-inflicted pain.<br /><br />If you are not interested in PostgreSQL, you probably just stop here. Nothing to see folks, move along. However, if you are looking for the well-lit path to getting PostgreSQL installed on Amazon EC2 will all the trimmings, read on.<br /><br />I went to find various web pages to use as source material, expecting since the last time I went through this, someone would have written a nice definitive guide to installing PostgreSQL on Ubuntu, running it on a dedicated instance on Amazon EC2, and using Elastic Block Storage (EBS). Naturally, you want to be using the XFS file system too. However, no such luck: just a big collection of pages of instructions on the various parts, without any nice simple path to getting things working together.<br /><br />Hence, this post tries to provide a set of instructions for getting things working, and avoiding a couple of problems that I have run into while running Postgres in production for the last couple years.<br /><br />Step 0 - You are signed up for Amazon EC2, no? If not, there are plenty of pages with instructions on how to do so.<br /><br /><span style="font-weight: bold;">Step 1 - Choose your AMI</span><br />There are several AMI's available to you. I currently run Hardy 8.04 LTS x86 architecture in the USA, so I am using ami-5d59be34, but you may have other requirements. The <a href="https://help.ubuntu.com/community/EC2StartersGuide">Ubuntu EC2 starter guide</a> has good info on your options.<br /><br /><span style="font-weight: bold;">Step 2 - Launch your instance</span><br />I like to use Elasticfox, cause I am super lazy. The command line works well, also.<br /><br />What size instance? This AMI supports small and medium. PostgreSQL is pretty efficient these days, and especially using a dedicated instance and not running anything but the database server improves raw database performance considerably. You would probably be pretty surprised how well a small instance can perform, but choose medium if you think you will have more significant needs.<br /><br />One key pattern I use for my EC2 hosted apps, is creating security groups in EC2 to separate my database servers from the public internet. I never use the default security group, but instead create a group for each tier of my application like "database", "web", "transcoder" and then allow specific groups to communicate with each other.<br /><br /><span style="font-weight: bold;">Step 3 - Create the EBS Volume</span><br />You can do this via Elasticfox, or via command line. Either way, make sure you do two key things: make sure you create the EBS volume in the same availabilty zone as your database server instance, and also make sure you create a volume with enough space. Here is how you would use the command line tools to create a 10GB volume in the 'us-east-1a' zone:<br /><code><br />ec2-create-volume -z us-east-1a -s 10<br /></code><br />One the volume is ready, attach it to the database instance. For example, this attaches an EBS volume named 'vol-VVVV1111' to the instance 'i-IIII1111' on device /dev/sdh:<br /><code><br />ec2-attach-volume -d /dev/sdh -i i-IIII1111 vol-VVVV1111<br /></code><br /><br /><span style="font-weight: bold;">Step 4 - Connect to the database instance</span><br />You need to SSH in to configure you new instance. Remember, you cannot connect as 'root' user in Ubuntu, you need to connect using the 'ubuntu' user. <a href="http://alestic.com/2009/04/ubuntu-ec2-sudo-ssh-rsync">This page</a> has good details about using sudo and SSH on the official Ubuntu EC2 AMIs.<br /><br />OK, so now you are connected via SSH to your server. Of course, start with the usual update/upgrade:<br /><code><br />sudo apt-get update && sudo apt-get upgrade -y<br /></code><br /><br /><span style="font-weight: bold;">Step 5 - Install XFS</span><br />We will need to install the XFS file system. Actually, your could use some other file system, but XFS is quite mature and has good performance. Plus if you are crazy, you can scale up to a massive virtual RAID drive that will cost $4000 per month.<br /><br /><code><br />sudo apt-get install -y xfsprogs<br /></code><span style="font-weight: bold;">Step 6 - Format the EBS volume using XFS</span><br />We need to install a file system on the EBS volume before we can do anything with it. Here is an example:<br /><code><br />sudo modprobe xfs<br />sudo mkfs.xfs /dev/sdh<br /><br />echo "/dev/sdh /data xfs noatime 0 0" | sudo tee -a /etc/fstab<br />sudo mkdir /data<br />sudo mount /data<br /></code><br />Now we have a /data directory that maps to our EBS volume. Anything we write to /data will be persisted, even if the database server instance itself terminates.<br /><br /><span style="font-weight: bold;">Step 7 - Install PostgreSQL</span><br />Now we need to get PostgreSQL installed. <a href="http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804">This page</a> has a very nice simple set of instructions on how to do that correctly for Ubuntu, but here is a synopsis especially for a headless server. First install Postgres:<br /><code><br />sudo apt-get install postgresql postgresql-client postgresql-contrib<br /></code><br />Now reset the password for the postgres account in the PostgreSQL server:<br /><code><br />sudo su postgres -c psql template1<br />template1=# ALTER USER postgres WITH PASSWORD 'password';<br />template1=# \q<br /></code><br />And then change the password on the user account to match:<br /><code><br />sudo passwd -d postgres<br />sudo su postgres -c passwd<br /></code><br /><br />Now we need to modify the postgres configuration file postgresql.conf. First, to allow other machines to connect to our instance, and also to have PostgreSQL use our nice shiny /data directory.<br /><br /><code><br />sudo nano /etc/postgresql/8.3/main/postgresql.conf<br /></code><br />Change the line containing<br /><code><br />data_directory = '/var/lib/postgresql/8.3/main'<br /></code><br />to<br /><code><br />data_directory = '/data/main'<br /></code><br />Now change<br /><code><br />#listen_addresses = 'localhost'<br /></code><br />to<br /><code><br />listen_addresses = '*'<br /></code><br />and also change<br /><code><br />#password_encryption = on<br /></code><br />to<br /><code><br />password_encryption = on<br /></code><br />Save the file, then open the pg_hba.conf file so we can control who can access the server:<br /><code><br /># DO NOT DISABLE!<br /># If you change this first entry you will need to make sure that the<br /># database<br /># super user can access the database using some other method.<br /># Noninteractive<br /># access to all databases is required during automatic maintenance<br /># (autovacuum, daily cronjob, replication, and similar tasks).<br />#<br /># Database administrative login by UNIX sockets<br />local all postgres ident sameuser<br /># TYPE DATABASE USER CIDR-ADDRESS METHOD<br /><br /># "local" is for Unix domain socket connections only<br />local all all md5<br /># IPv4 local connections:<br />host all all 127.0.0.1/32 md5<br /># IPv6 local connections:<br />host all all ::1/128 md5<br /><br /># Connections for all PCs on the subnet<br />#<br /># TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD<br />host all all 0.0.0.0/0 md5 # wide-open, you may want to make this more specific to your database<br /></code><br /><br /><span style="font-weight: bold;">Step 8 - Move the database files</span><br />We need to stop the PostgreSQL server, move the database files to our EBS volume, then restart the server.<br /><code><br />sudo /etc/init.d/postgresql-8.3 stop<br />sudo mv /var/lib/postgresql/8.3/main /data<br />sudo /etc/init.d/postgresql-8.3 start<br /></code><br />You are now running PostgreSQL on Amazon EC2 using EBS for your database, with the XFS file system. Congratulations!<br /><br />I will write a followup post on how to setup your database server for self-backing up using EBS snapshots, but that is all I have time for right now. Hopefully this pared-down set of instructions has been useful to you. Thanks again to Eric Hammond, and everyone else who's blogs were culled together into this post.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com4tag:blogger.com,1999:blog-35868762.post-66911501862095065112009-07-25T09:37:00.000-07:002009-07-26T18:05:14.950-07:00The FutureRuby Revolution Will Not Be On AOL - Part 2<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.vansabbenauctions.nl/VSA25/802.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 225px; height: 320px;" src="http://www.vansabbenauctions.nl/VSA25/802.jpg" border="0" alt="" /></a><a href="http://futureruby.com">FutureRuby</a> Day 2 began in a seemingly calm and reflective way. Coffees were sipped, and hangovers nursed. As the self-inflicted wounds from the <a href="http://www.joeydevilla.com/wordpress/wp-content/uploads/2009/07/pravda_vodka_bar_3.jpg">Pravda-Vodka-Kalashnikov</a> faded, <a href="http://twitter.com/peteforde">Pete Forde</a>, our leader and spiritual adviser, began a short sermon.<br /><br />His message was simple: Vegas is a horrible place to hold <a href="http://railsconf.com">RailsConf</a>. And we should live in a manner that follows the <a href="http://www.amazon.com/Four-Agreements-Practical-Personal-Freedom/dp/1878424319">"Four Agreements"</a>. Seriously, yes, he said both of these things.<br /><br />Pete told us of the source of his sudden enlightenment: <a href="http://www.jupiterhotel.com/">Portland's Jupiter Hotel</a>. Instead of a Gideon bible, they have copy of Four Agreements in each room. Pete, being a curious guy, started to read the book. To save us time, he summarized it in nice Twitter-sized chunks.<br /><br />1. Use your words for good... do not gossip<br />2. Do not take anything personally<br />3. Do not make assumptions<br />4. Always try your best<br /><br />With our spiritual bootstrapping complete, we proceeded to have a consciousness-expanding session from Collin Miller presentation called "Transc/Ending Encoding". This was NOT about video encoding.<br /><br /><b><a href="http://twitter.com/collintmiller">Collin Miller</a> - "Transc/Ending Encoding"</b><br /><br />If the 60's revolt gave the counterculture heroes like <a href="http://en.wikipedia.org/wiki/Timothy_Leary">Leary</a> and <a href="http://en.wikipedia.org/wiki/Albert_Hofmann">Hoffman</a>, it gave us tech heroes like <a href="http://en.wikipedia.org/wiki/Douglas_Engelbart">Englebart</a> and <a href="http://en.wikipedia.org/wiki/Alan_Kay">Kay</a>.<br /><br />When writing software, we edit text files. We use textual encoding is a way to flatten down information to a simpler structure. But what does editing text lack? There are other options to make programs without text.<br /><br />There is this high priesthood of text, however, programming does not need to be difficult to be useful. The future is the ONLY frontier... so where are we as programmer-monks going?<br /><a href="http://twitter.com/martinfowler"><br />Martin Fowler</a> has his concept of "<a href="http://www.martinfowler.com/bliki/IllustrativeProgramming.html">illustrative programming</a>". As another example, a spreadsheet is non-textual programming.<br /><br /><a href="http://en.wikipedia.org/wiki/Charles_Simonyi">Charles Simonyi</a>'s <a href="http://en.wikipedia.org/wiki/Intentional_programming">Intentional Programming</a> in a different approach. It allows users to change names easily, or even program in two different natural languages. It does this by maintaining a constant set of references to everything in program. By doing this, different users can edit the same source database, without using the same editing style.<br /><br />Another example is Subtext (<a href="http://www.subtextual.org/">http://www.subtextual.org/</a>). In Subtext, everything is just a reference. It is like "googling the code". Subtext uses decision tables, and a syntax tree editor.<br /><br />It was a very interesting talk, and it seems like many people were inspired to think differently about code. I was having <a href="http://www.smalltalk.org">Smalltalk</a> flashbacks, and my brother <a href="http://twitter.com/damenevans">Damen Evans</a> was reminiscing about how cool <a href="http://en.wikipedia.org/wiki/HyperCard">HyperCard</a> used to be.<br /><br /><b><a href="http://twitter.com/drnic">Dr. Nic</a> - "Living with 1000 Open Source Projects"</b><br /><br />Next up was "Dr. Nic" aka Dr. Nic Williams who is actually a PhD in CS, so not just granting himself an honorarium. His talk was called "Living with 1000 Open Source Projects". I have heard Dr. Nic speak before, and he is a very intelligent and funny speaker.<br /><br />There are two types of open source project founders:<br />Type A. Nurture and converse "Do you care?"<br />Type B. People who were previously type A<br /><br />"Who ever looked at their old code and thought 'that's better than what I write now'?"<br /><br />If you look after your old projects, you will end up with 500/hr. week of projects<br /><br />"Open source projects don't scale, but neither does raising pets and children"<br /><br />The question is which OSS projects to maintain? The pet projects you NEED every day<br /><br />Goal: ZERO maintenance<br /><br />How to reduce bad karma from "abandoning" your project:<br />- publish project status<br />- facilitate group therapy<br />- forward emails to mailing list<br /><br />Put a badge on project home page that says last time someone contributed to the project<br /><br />Aim for community to be self-sufficient<br /><br /><a href="http://github.com">Github</a> makes things easier with centralized patches. The <a href="http://github.com/defunkt/github-gem/tree/master">github gem</a> is great for laziness.<br /><br />"Easy to give away commit rights, if you think 'this is not MY project, I just look after it'"<br /><br />Aim: ZERO process cost<br /><br />Aim for Zero<br />- don't use it? do not maintain it<br />- manage expectations<br />- community self-sufficient<br />- zero process cost<br />- zero defects<br /><br />How to use your spare time<br />- find a hobby<br />- talk to your spouse<br />- create more projects<br /><br />"you can do less"<br /><br />Dr. Nic's talk really resonated with many of us. I, for one, immediately on getting back from the conference gave commit rights on two of my projects to two worthy individuals. Wow, what a relief!<br /><br /><b><a href="http://twitter.com/mattknox">Matt Knox</a> - "Crimes Against Humanity, Writ Small"</b><br /><br />After Dr. Nic, was a great talk called "Crimes Against Humanity, Writ Small" from Matt Knox. I have been hanging out for the last couple of years with Matt at various Ruby conferences, but I had no idea how awesome he really is, till he got to show his stuff at FutureRuby.<br /><br />The message behind his talk was really about taking responsibility for one's own actions. This was a very important recurring theme, starting right from Nathanial Talbott's talk at the very beginning of FutureRuby "you write the software for the nukes, you own responsibility if they are used". In Matt's case, the "nukes" in question were adware. The kind that attaches itself to your machine like a vampire squid, and will not let go. <br /><br />Like all roads to hell, Matt's started with the best of intentions. His wonderful idea was killing adware on Windows with <a href="http://schemers.org/">Scheme</a>. As in <a href="http://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a>. That sounds like a really fun job... and it was, at first.<br /><br />From an auspicious start "kill this worm", the job progressed to "kill lots of worms/malicious ad clients". Then the job became "somewhat edgy" aka "kill competitors and keep us from being killed... by anything"<br /><br />As a result of all this, there were major negative repercussions that took down the company. In the aftermath, Matt was able to do some amazing self-exploration. "What just happened? Is this just who I am?"<br /><br />That brings us around to the famous <a href="http://en.wikipedia.org/wiki/Milgram_experiment">Milgram experiments</a>. The incredible part was that 70% went the distance, and did what they thought was "torturing" another human being. Most human evil lives here.<br /><br />What does this mean?<br />- The human brain has a remote root exploit in 70% of the installed base<br />- Knowing is 1/2 the battle<br /><br />Good<br />- don't be evil<br /><br />Better<br />- recognize that people who do evil may not be evil<br />- this makes it easier to not hate them<br /><br />Best<br />- set up structures to insure this does not happen<br /><br />The world forgives. But to provoke forgiveness, one needs to own your actions, and their results.<br /><br />There is a remote root exploit in human brain, but the world forgives.<br /><br />Matt, thank you very much for your bravery and honesty, in sharing what was clearly a very painful learning experience.<br /><br /><b><a href="http://twitter.com/pauldowman">Paul Dowman</a> - "Between the Battleship and the FAILWhale"</b><br /><br />After the raw psychology of Matt's talk, it was not easy for me to switch gears to Paul Dowman's talk "Between the Battleship and the FAILWhale". However, it was full of solid info with why's and how's about scaling. Here are a few highlights:<br /><br />Scalability != performance<br />Performance is faster load time<br />Scalability is handling greater load on same hardware<br /><br />2 kinds of scaling<br />Vertical scaling - increase power of a single unit of your architecture<br />Horizontal scaling - adding units to your architecture<br /><br />Why is scaling so hard? It cannot be an afterthought.<br />Should I forget about my scaling problem till my app is a hit? It's a biz decision<br /><br />Developers and shareholders should talk about the tradeoffs, because scaling has costs: it requires more capital, and makes system more complex.<br /><br />You can do some simple things to prepare to scale, without a major engineering effort. The goal is to be able scale just by adding more servers<br /><br />HTTP Caching like <a href="http://www.squid-cache.org/">squid</a>, <a href="http://varnish.projects.linpro.no/">varnish</a> or <a href="http://github.com/rtomayko/rack-cache/tree/master">Rack::Cache</a><br /><br />Use a queue for anything not needed to render the page right then. You will get a faster response, have a more consistent system load, and have less contention for locks.<br /><a href="http://aws.amazon.com/sqs/"><br />Amazon SQS</a> is pretty cool. SQS is slow but scalable, simple and requires no maintenance or deployment.<br /><br /><a href="http://www.danga.com/memcached/">Memcached</a> is inherently distributed, and you can just add more instance to scale. But it is not a database, so do not treat it like one. Data can/will disappear, since it is not persisted.<br /><br />For scaling your database, you have various options:<br />- Use an RDBMS like <a href="http://www.mysql.com/">MySQL</a> or <a href="http://www.postgresql.org/">PostgreSQL</a><br />- <a href="http://aws.amazon.com/simpledb/">SimpleDB</a><br />- <a href="http://tokyocabinet.sourceforge.net/">Tokyo Cabinet</a><br />- <a href="http://couchdb.apache.org/">CouchDB</a><br />- something else<br /><br />Traditional RDBMS cannot scale horizontally forever. However, a lot of data does fit the table paradigm and SQL is powerful. Do not confuse data storage with data management.<br /><br /><b><a href="http://http://twitter.com/josephwilk">Joe Wilk</a> - "Cucumbered"</b><br />Next up was Joseph Wilk, all the way from London, to talk about <a href="http://cukes.info/">Cucumber</a>. Joe is a very unassuming but smart and witty fellow. The way he structured his talk was really clever. He used BDD itself to describe BDD... brilliant!<br /><br />So why use something like Cucumber? So that the customer can use something less syntactically stripped to describe their needs, THEN translate that to Ruby. It is a token of the conversation, and defines the acceptance criteria for the "customer". It is useful as a design tool, and provides executable documentation for the project.<br /><br />Cucumber has a gateway for different human languages, so that the developer and customer can interact in the customer's own human language. Like Swedish, Spanish, or LOLCATS. In fact there are currently over 30 languages already supported.<br /><br />Really, that is part of getting the most value out of Cucumber, is getting customers using Cucumber THEMSELVES... you can even just send around the "plaintext" using email, Google Docs, whatever allows you to share the plaintext data.<br /><br />The Art of "plaintext"<br />- don't force structure<br />- avoid noise<br />- avoid inconsistency<br />- balance abstraction<br />- use Ruby language building blocks to keep things DRY<br /> <br />There are a couple of cool features that have gotten into Cucumber while I was not paying attention. One is Tagging, which allows you to tag a feature, and run only those features.<br /><br /><code><br />@any plaintext word<br /> <br />cucumber --tags ~@in-progress<br /></code><br /><br />Another is Continuous Integration (Work In Progress) (--wip) which looks very useful since running each and every feature story can be time-consuming and slow down a CI build. Running all of the features as part of a nightly build is a workable compromise, and this look pretty useful to me for Integrity integration etc.<br /><br />It was a very cool talk from Joe, and if you are not using Cucumber you really should be. It is an amazing source of insight into the needs of the user, and a great way to explain WHY you are doing things, not just WHAT you are doing.<br /><br /><b><a href="http://twitter.com/avibryant">Avi Bryant</a> - "Failure: An Illustrated Guide"</b><br />Next up, Avi Bryant gave a fun talk called "Failure: An Illustrated Guide". He basically took us thru 30+ iterations (I lost count) of UI variations trying to create an important part of the functionality for his new site <a href="http://trendly.com/">Trendly</a>. <br /><br />It was interesting to see all of the different attempts that they made, in finally reaching what is a pretty cool and different UI metaphor for visualizing time-series data from website stats. Once the presentation video is online, it is for sure worth watching, not so much because of what they did, but more from how it will make you revisit your own UI.<br /><br /><b><a href="http://twitter.com/jondahl">Jon Dahl</a> - "Programming and Minimalism"</b><br />Jon's talk about "Programming and Minimalism" delved into the comparisons and contrasts of music and programming. He played a number of musical examples that showed stylistic development of musical genres from simple forms, to complex ones, and then evolved to simpler ones as part of a new "branch" of development. <br /><br />It was interesting to consider these parallels, especially since I happened to be sitting next to friend <a href="http://twitter.com/atduskgreg">Greg Borenstein</a>, who's classical musical vocabulary is much greater than mine, and had interesting side-channel comments. Like Avi's presentation, the video/audio is probably needed to in order to get more than a superficial explanation of his points.<br /><br /><b><a href="http://twitter.com/marick">Brian Marick</a> - "Artisanal Retro-Futurism and Team-Scale Anarcho-Syndicalism"</b><br />I was really looking forward to the next talk. Brian Marick is one of the original authors of the "<a href="http://agilemanifesto.org/">Agile Manifesto</a>" and a very interesting thinker. I had heard him bandy about this phrase "Artisanal Retro-Futurism and Team-Scale Anarcho-Syndicalism" and I was eager to hear what it meant. FutureRuby was about to get radical. The <a href="http://www.infoq.com/presentations/marick-retro-futurism">video of this talk</a> is now online, so I really suggest you check it out for yourself.<br /><blockquote><br />"When I say agile, I mean Ruby... the way that Ruby projects are run"<br /><br />"Switching to scrum, at least my job doesn't suck as much as it used to"<br /><br />"I don't want to see on my gravestone, 'he made agile projects suck a little less'"<br /><br />"Even the wage-slave can have joy-in work"<br /><br />"the cubical is the single worst design of people and space to do software development"<br /></blockquote><br />What is "anarcho-syndicalism"? It is a political/economic trade-union movement peaked in 1923, crushed in 1924 by the U.S. government.<br /><br />Here were a few of their tenants:<br />- getting rid of the government, and getting rid of private corporations<br />- worker self management<br />- direct action<br />- worker solidarity<br /><br />Brian suggests adopting some of the ideas of the anarcho-syndicalists but at Team-scale" meaning within your own team.<br /><br />Teams should band together more than they do, and we need more power in the hands of team to counterbalance the power in the corporation.<br /><br />So on to this "Artisanal" thing. Brian used the example of artisanal cheese. The people who make this cheese are very into cheese. They care about the cheese! They do not just do it for profit, profit is the result of their caring.<br /><br />Lastly back to the "retro-futurism". Recently, the New Yorker magazine did an issue about innovation. However, to capture the idea of innovation, they used images from the past, like the jet pack.<br /><br />The idea of "retro-futurism" is trying to recapture the spirit of hopefulness from the past. Books like <a href="http://www.amazon.com/Infinite-All-Directions-Freeman-Dyson/dp/0060915692">Freeman Dyson's "Infinite In All Directions"</a> capture this endless sense of possibility.<br /><br />Do not let the context drive you, you control the context. Brian calls for a revolution in how software development projects are run, and challenges us to be scrappy, care, and keep our spirit of naive optimism.<br /><br />Start doing something about this: go to <a href="http://arxta.net/">arxta.net</a>, and talk to your teammates. And yes, I do have a sticker on my MacBook Pro.<br /><br /><b><a href="http://twitter.com/jessehirsh">Jesse Hirsh</a> - "Fighting the Imperial Californian Ideology"</b><br />The final presentation, from Jesse Hirsh, was even more radical than Brian Marick. Jesse challenged all of us by taking some of those same principles that we had all just agreed with coming from Brian about software, but extended them further. Much further.<br /><br />There have already been a couple of good posts that <a href="http://www.joeydevilla.com/2009/07/15/futureruby-talk-fighting-the-imperial-californian-ideology/">summarize</a> or <a href="http://freelancing-gods.com/posts/future_ruby_and_californian_conflict">comment</a> on Jesse's talk. Go check them out if you want more detail.<br /><br />A couple of books that have influenced Jesse are "<a href="http://en.wikipedia.org/wiki/Snow_Crash">Snow Crash</a>" and "<a href="http://www.amazon.com/Imperial-San-Francisco-California-Geography/dp/0520229029">Imperial San Francisco</a>". The reason this is important is that ideologies are viral. In the mid 1800's the US sent surveyors into California, and once the mineral wealth there are been established, declared war on Mexico to get mines.<br /><br />This was only the first of many "gold rushes" to take place in CA, although subsequent ones would develop other resources than mines. San Francisco technology invented the mining shaft to extract greater amounts of resources from the same mine. Taking those same technological achievements, a mining shaft turned upside down was a skyscraper - mining human labor instead of minerals.<br /><br />The Hearst mining family was the most successful of these robber barons of mining, and the most responsible for many of the negative outcomes that resulted. As an example, Hearst Mining is responsible for 8 of 10 Superfund hazardous waste cleanup sites.<br /><br />But it did not end there. As is well documented, the Spanish-American War, which resulted in the brutal colonial occupation of the Phillipines, was triggered by the first manufactured war, created by the first media mogul <a href="http://en.wikipedia.org/wiki/William_Randolph_Hearst">William Randolph Hearst</a>. <br /><br />San Francisco built all arms, and still responsible for all advanced military technology today. One big example is U.S. nuclear weapons, which are designed at the <a href="https://www.llnl.gov/">Lawrence Livermore National Labs</a>.<br /><br />This all established California as a place where a few small elites could conquer the world. The end of the cold war, was replaced by new imperial project - the California Ideology. The acolytes of this new ideology were <a href="http://www.kk.org/">Kevin Kelley</a>, <a href="http://en.wikipedia.org/wiki/Stewart_Brand">Stewart Brand</a>, and the <a href="http://www.gbn.com">Global Business Network</a>.<br /><br />Many saw the emergence of magazines like <a href="http://www.wired.com/">Wired</a> and <a href="http://en.wikipedia.org/wiki/Mondo_2000">Mondo2000</a> (shout-out to <a href="http://en.wikipedia.org/wiki/R._U._Sirius">RUSirius</a>!) as the frontier of new techno-utopia. However, not everywhere has the silicon valley infrastructure. This new world was still under the dominance of SF.<br /><br />The corrupting influence and domination of SF was exemplified by <a href="http://en.wikipedia.org/wiki/Bay_Area_Laboratory_Co-operative">BALCO</a> - the Bay Area Labratory Co-Operative known for the designer steroids that have altered professional sports irrevocably.<br /><br />When <a href="http://twitter.com/chr1sa">Chris Anderson</a> wrote "<a href="http://www.thelongtail.com/">The Long Tail</a>", Jesse says we all recognized it as brilliant. However, it reinforced the hierarchy to allow the few to get all of the best parts, while relegating everyone else to the skinny end of the long tail.<br /> <br />Jesse goes on to attack Chris's latest manifesto "<a href="http://www.scribd.com/doc/17135767/FREE-full-book-by-Chris-Anderson-Read-in-Fullscreen">Free</a>". He says there is something fundamentally wrong with his argument, however NOT the free part. Jesse says the fatal flaw is the ethic of waste. Chris says that now that bandwidth is in such abundance, we must waste it, because only then can we reach innovation.<br /><br />Jesse rails on waste as an ethic in CA (cars, weapons, mining etc). He prefers a revolutionary wholeism. Wholeism is a flip on relativism. Making everything the same, is NOT the answer, according to Jesse. We are in similar time with social tools like as when AOL took over Internet and turned it into total crap.<br /><br />When you have neighborhoods in the net, you can clean them up. We need to take the best tools available, merge into a coherent vision. Take a page from Barack Obama's playbook and become community activists.<br /><br />Who can you trust? Not the corporation, only your comrades, which is whoever you have social capital with.<br /><br />The struggle for human rights never ends, the question is which side are you on? The era of the nation-state is done, it is time for the new rise of the city-state. Get involved.<br /><br />Jesse had given an intense and fascinating talk. We could not complete the FutureRuby agenda, without some serious rabble-rousing. We surely have to individually take responsibility for what we choose to do with our power as technologists. Agree with Jesse on any individual point, or not, there was a lot of food for further thought. <br /> <br /><b>Aftermath</b><br />The conference sessions were now over, but the FutureRuby festivities had not yet ended. After so many ideas compressed into so little time, we needed to hang out and process things together, while allowing it to be unstructured. <a href="http://twitter.com/meghatron">Meghann</a> had come up with the innovative thought of putting the after-party into 3 different walkable nearby locations: a cool coffeehouse with retro video games, a classic little dive bar with live music, and <a href="http://hackerspaces.org">HackerspaceTO</a>. Not to mention a <a href="http://www.vimeo.com/5592994">hilarious street performance</a> that could only happen somewhere open-minded like Toronto. <br /><br />Jamming on harmonica with a cyborg who played the water organ was just part of my personal awesome experience. Where is that video? So was getting to hang out at HackerspaceTO where they have frickin' laser beams. We timed it poorly, and missed the band dressed in Farscape garb, but there was so much to see and do, right up to the end.<br /><br />FutureRuby was not just a fun conference. And it was not just a chance to learn about a bunch of new things. It opened me up to new possibilities, and helped re-affirm my personal commitment. I thank all of the staff, volunteers, speakers, and attendees for making it an inspirational experience.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-23572173037174101372009-07-16T17:05:00.000-07:002009-07-16T17:07:07.494-07:00I Have Seen The FutureRuby, And It Is Amazing - Part 1<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm2.static.flickr.com/1081/1045078870_28a927b58d_o.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 210px; height: 386px;" src="http://farm2.static.flickr.com/1081/1045078870_28a927b58d_o.jpg" border="0" alt="" /></a>It was with tremendous excitement that my brother <a href="http://twitter.com/Damenevans">Damen</a> and I had arrived in Toronto for <a href="http://futureruby.com">FutureRuby</a>. Not only were we getting to attend the reprise of what had been by all accounts the "Best. Conference. Ever.", but we were going to be speaking about <a href="http://flyingrobo.com">Project Flying Robot</a>. <br /><br />There had been many interesting interactions with various security personnel on the journey, thanks to the many small homemade electronic devices that make up our tiny squadron. All of them were extremely friendly and professional as they carefully unpacked, swabbed, scanned, then repacked our cases full of joysticks, <a href="http://www.arduino.cc/">Arduinos</a>, electric motors, batteries, and many wires. MANY wires.<br /><br />By the hour that we arrived, we were too late to attend <a href="http://failcampto.eventbrite.com/">failCAMP</a> (failed to make it?), but there would be many opportunities to interact with our fellow comrades in Ruby. <a href="http://twitter.com/peteforde">@peteforde</a> and <a href="http://twitter.com/meghatron">@meghatron</a> of <a href="http://unspace.ca">Unspace</a> had designed the conference with the kind of architectural integrity only a geek could conceive. It was not until the final sessions that the master plan became clear, but I will get to that.<br /><br />As a result, the next morning we had no post-fail hangovers to slow us down with our last minute assembly and attempts at troubleshooting, combined with walking all over Toronto. Once the evening came, we were eager to connect with our fellows, and happy to climb the stairs to <a href="http://unspace.ca">Unspace</a>'s cool digs. Pinball machine FTW! And <a href="http://twitter.com/atduskgreg">Greg Borenstein</a>'s <a href="http://www.youtube.com/watch?v=mUoUMko77KM">robotic drummer</a> pounding the skins on Pete Forde's drum kit, controlled by <a href="http://github.com/gilesbowkett/archaeopteryx/tree/master">Archaeopteryx</a>. It was an excellent party, and they had to kick us out at midnight with the reminder of the talks in the early AM, not to mention the festivities yet to come.<br /><br />Opening up the first day of the actual conference with the first talk was <a href="http://blog.talbott.ws/">Nathaniel Talbott</a> with a rabble-rousing speech on <a href="http://blog.talbott.ws/articles/2009/7/15/how-capitalism-saves-ruby-from-corporatism">"How Capitalism Saves Ruby From Corporatism, or, Owning The Means of Production"</a>. This was an immediate shot across the bow of the status quo, and gave us all a clue that the 'collectivist' theme was not just a cool design style for the schwag, but also a serious theme for the conference content.<br /><br />Next on was <a href="http://www.igvita.com/">Ilya Grigorik</a> with <a href="http://www.slideshare.net/igrigorik/lean-mean-tokyo-cabinet-recipes-with-lua">"Lean and Mean Tokyo Cabinet Recipes"</a>. If you do not know about it, <a href="http://tokyocabinet.sourceforge.net/">Tokyo Cabinet</a> is an open source key-value database, that also has server and full-text capabilities. Ilya gave a very hardcore presentation that went all the way into many of the cool things that can be done with TC right now. This was a departure against the traditional SQL way of doing things, and tied in with the revolutionary theme. You HAVE been getting up to speed on one or more non-SQL databases already, haven't you?<br /><br />The next session was one I was particularly eager to hear. <a href="http://austinche.name/">Austin Che</a> spoke about "Programming Life". As in, "Hello World in a petri dish" kind of programming. I had missed the actual workshop, where some lucky people were successful as growing their own <a href="http://www.flickr.com/photos/luismi_cavalle/3718636707/">glowing bacteria</a>. However, the excellent talk from Austin took us on a wild ride through the current state-of-the-art in biohacking. Let me put it another way: we already have the rough biotech equivalents of both Github, with the <a href="http://obda.open-bio.org/">Open Bioinformatics Foundation</a>, and Sparkfun with Auston's own <a href="http://ginkgobioworks.com/">Gingko Bioworks</a>. Other sites like <a href="http://biobricks.org">biobricks.org</a> and <a href="http://openwetware.org">openwetware.org</a> are also there for anyone who wants to get started with this fascinating technology at home.<br /><br />Following this was <a href="http://twitter.com/anteaya">Anita Kuno</a> with "Version Control: Blood Brain & Bones" reminding us that the human mechanism needs to be correctly maintained, and developed for correct performance. She had a bunch of specific eating techniques and foods to share, and almost immediately, it seemed that we were more conscious of what nutritional input we were routing into our individual biocomputers.<br /><br />Next up was one of the best presentations of the entire conference. <a href="http://www.foysavas.com/">Foy Savas</a> gave a talk named "polyglots Unite!" which spoke about multi-language programming, and using a takeoff on Rack named Crack to providing a kind of Rack-adapter for other web-backends other than Ruby. It is a neat concept, and I look forward to seeing where it goes. The presentation itself was absolutely fantastic. The timing, the clarity... in a word, he "killed". One of the best speakers of the conference.<br /><br />Only something pretty different and amazing could follow up that, and <a href="http://www.mishaglouberman.com/">Misha Glouberman</a>'s "Terrible Noises for Beautiful People" satisfied. It was a laptops closed participatory session that had our entire group singing, clapping, and sushing together. Not only that, but we actually played <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway's game of life</a> using musical interaction with the entire group as the cellular automata. You can't do THAT at home! Absolutely brilliant.<br /><br />Next were my brother <a href="http://twitter.com/Damenevans">Damen Evans</a> and I with our <a href="http://flyingrobo.com">"Flying Robot"</a> presentation. Despite a few small technical glitches (hardware!) we pulled it off, and the <a href="http://search.twitter.com/search?q=futureruby+blimp+OR+flying">crowd was enthusiastic</a>. We had a great time, and congrats to the winners of the 2 Blimpduino kits <a href="http://twitter.com/_krispy_">@_krispy_</a> and <a href="http://twitter.com/maplealmond">@maplealmond</a>. There is some <a href="http://www.youtube.com/watch?v=Xuuk3n60UUk">cool video here</a>, and lots of great photos like <a href="http://hyfen.posterous.com/flying-robots-at-futureruby-courtesy-of-deadp">here</a>, and <a href="http://www.flickr.com/photos/jay_tennier/3718902768/in/set-72157621411683706/">here</a>. Thank you to everyone who participated, we had a great time doing it!<br /><br />Once we had demonstrated Ruby air superiority over the skies within the Metropolitan Hotel, it was all mobile all the time for the remains of the day. First, a 3-way talk from the guys at <a href="http://phonegap.com/">Phonegap</a>, followed with a demo by <a href="http://www.adamblum.com/">Adam Blum</a> from <a href="http://www.rhomobile.com/">Rhomobile</a>. I had seen Adam's basic pitch before at <a href="http://www.larubyconf.com/">LARubyConf</a>, one nice change was that they no longer seem to be trying to charge a per-user license. Per-user license, what's that?? I haven't seem one of those since last century, I think.<br /><br />Finally, the sessions for the first day were complete. We all put on our finery, and took over <a href="http://pravdavodkabar.com/">Pravda</a>, a Russian-mobster-styled vodka bar that pulled out all the stops, with many people staggering out of the vodka-freezer with smiles on their faces. My personal favorite moment was when we gave a spontaneous group loud "ahhh-clapping-shushing" in response to the wonderful announcement that <a href="http://www.shopify.com/">Shopify</a> was going to pay to keep the bar open longer. There was large quantities of amazing food as well. That <a href="http://twitter.com/meghatron">@meghatron</a> really knows how to throw a party!<br /><br />After a pleasant stroll through the streets of Toronto, powered by Russian jet-fuel, we collapsed, to get a few comfortable, if short, hours of rest before FutureRuby Day 2.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com1tag:blogger.com,1999:blog-35868762.post-61860566205470852032009-07-05T09:55:00.000-07:002009-07-05T10:47:47.600-07:00Getting Ready For Takeoff At FutureRuby<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Leonardo_Design_for_a_Flying_Machine,_c._1505.jpg/450px-Leonardo_Design_for_a_Flying_Machine,_c._1505.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 300px; height: 213px;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Leonardo_Design_for_a_Flying_Machine,_c._1505.jpg/450px-Leonardo_Design_for_a_Flying_Machine,_c._1505.jpg" border="0" alt="" /></a>I just realized it has been an entire month since my last post. Sorry! In case you were wondering, the always overambitious plans for <a href="http://flyingrobo.com">Project Flying Robot</a> have taken up more time than expected. And <a href="http://www.sparkfun.com">parts</a>. Especially <a href="http://www.digikey.com/">parts</a>.<br /><br />Lucky for us, the benefit of a hard deadline approaches: <a href="http://futureruby.com/">FutureRuby</a> is coming up next week. My brother <a href="http://myfirstairship.blogspot.com/">Damen Evans</a> and I are going to be showing off our latest works in Unmanned Aerial Vehicles (UAV) based on <a href="http://rad.rubyforge.org/">Ruby Arduino Development</a> (RAD). I don't want to let on too much, so as to eliminate the surprise element, but this should be our biggest spectacle yet.<br /><br />So if you're going to be in Canada next week, we look forward to seeing you. If not, I'm sure there will be plenty of video to watch in either amazement or amusement, depending on how well we can pull this off...Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-35424849672806934532009-06-03T21:12:00.000-07:002009-06-03T21:17:33.303-07:00Project Flying Robot: Supporting The Blimpduino<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.makershed.com/v/vspfiles/photos/mkca1-2.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 250px; height: 167px;" src="http://www.makershed.com/v/vspfiles/photos/mkca1-2.jpg" border="0" alt="" /></a>As <a href="http://makerfaire.com/">Maker Faire</a> approached, <a href="http://myfirstairship.blogspot.com/">my brother Damen</a> and I were very busy working on something cool: support for the <a href="http://www.makershed.com/ProductDetails.asp?ProductCode=mkca1">now-shipping Blimpduino kit!</a><br /><br />Thanks to the tireless efforts of Chris Anderson and Jordi Muñoz, the long awaited <a href="http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A44817">Blimpduino</a> kit is now shipping at <a href="http://www.makershed.com/ProductDetails.asp?ProductCode=mkca1">Makershed</a>. As readers of this blog know, we have drawn a lot of inspiration from the Blimpduino. Now, we actually have 2 of them, and you can get your own. For less than $100, plus a few other items, and <a href="http://github.com/deadprogrammer/flying_robot/tree/master">flying_robot</a> software of course, you have everything you need for a complete experimenters kit for Unmanned Aerial Vehicles at home.<br /><br />There are a few mods you need to make to your Blimpduino, if you want to be cool like us, and control/reprogram it using a linked pair of XBee modems. We will post complete directions soon on how to mod your blimpduino into a <a href="http://github.com/deadprogrammer/flying_robot/tree/master">flying_robot</a> using <a href="http://rad.rubyforge.org/">Ruby Arduino Development</a>.<br /><br />In the meantime, you can look at the almost completed <a href="http://github.com/deadprogrammer/flying_robot_blimpduino/tree/master">flying_robot for Blimpduino code here</a>.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com1tag:blogger.com,1999:blog-35868762.post-11328280556159833312009-05-17T15:17:00.000-07:002009-05-17T15:28:31.820-07:00Fear And Loathing At RailsConf 2009<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.moviewallpapers.net/images/wallpapers/1998/fear-and-loathing-in-las-vegas/fear-and-loathing-in-las-vegas-3-800.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://www.moviewallpapers.net/images/wallpapers/1998/fear-and-loathing-in-las-vegas/fear-and-loathing-in-las-vegas-3-800.jpg" border="0" alt="" /></a>We were around Barstow on the edge of the desert, when the drugs began to take hold... wait, that was someone else's story. OK, restart.<br /><br />We were around Barstow on the edge of the desert when the excitement began to take hold... we were on our way to RailsConf 2009! No screaming bats, just loud pumping techno music to power the PT Cruiser. My designer, who was not old enough to be pouring beer on his chest, nor interested in facilitating the tanning process, said "What the hell are you yelling about?". I aimed the Cruiser toward the horizon without slowing down, "I need an In-n-Out milkshake."<br /><br />Las Vegas... what a place. Putting RailsConf there is the sort of idea that makes sense on paper, but could turn a previously mild-mannered group of Ruby programmers into a mob of raging lunatics. Come to think of it, a group of Ruby programmers IS a mob of raging lunatics. Case in point? Video slot machines... the worst odds in vegas, but the best graphics. How will a group of perpetually partially attentive people be able to resist the siren call of millions of sensory distractions each designed to exert psychological pressure to LOOK AT ME? Seems like an interesting Milgram-like experiment.<br /><br />The back of the PT Cruiser was full of musical gear for the RailsConf music jam. With a small but effective PA and a few spare guitars, this session should be the best one yet. Could we play Vegas? Without offending the locals, or running afoul of some Musician's Union enforcers, that is.<br /><br />I had meant to keep meticulous notes, and post a flurry of blog entries as I have done as RailsConf's past. But the dull fog of Vegas combined with the mad dog sentiments already awakened in the Rails community at GoGaRuCo, left me with the sure knowledge that no matter how hard I might try to offend the insiders, no one would even notice with the continuous drunken flame wars that RailsConf Vegas would become quickly known for throughout the Twitterverse.<br /><br />The madness had taken hold long before we hit Vegas, and adding alcohol and neon fueled hyperstimulation only had the effect of pushing us into a raging frenzy. "Tim Ferris? How DARE he tell ME to exercise. Bob Martin? How dare he accuse me of not testing? Everyone else? How dare they dare to dare, or else how dare they not dare to dare! Forgeddaboutit!"<br /><br />Just then my already tenuous sanity began teetering, and I started yelling that the White Rabbit and I had been pair programming together for years. The wild-eyed activist within me leaped into action, and I practically elbowed people out of my way to get to the mic, to ask Uncle Bob the burning question on my mind: "What happened to the social revolution you started with Kent Beck and Ward Cunningham?"<br /><br />From the look in his eyes, I know the question haunted him, just as it still haunts me. If this is the utopia, why are we all fighting so much? "I saw the best minds of my generation destroyed by madness, starving hysterical naked..." and still Twittering away trying to validate justify, explain, strengthen, while simultaneously eroding it, tearing it away.<br /><br />I had to escape, find a place to hide and collect my shattered illusions. Fortunately, the safety zone of CabooseConf greeted me. The comfort and sanity of watching my programming buddies hacking together an LLVM implementation for AVR was like slipping under a warm, soft blanket, after the frenzy that had started while I was sitting in the Reptile Room, watching some giant lizards get ready to feast on fresh ideas.<br /><br />Days had passed, but in the strange netherworld between Vegas's clockless existence, and the constant Twitter flow of new input, I had lost all sense of temporality. It was a surprise that we had already come to the final keynote aka Q&A session. It was an odd demonstration of our shared exhaustion and sensory overload, that pretty much no one wanted to ask any questions.<br /><br />"Time to get out of here!" I said to my designer. We piled the PT Cruiser full of our gear, plying the staff with dollar bills like we were mythical high-rollers. I drove like the wind, but it was not quickly enough. Leaving behind a cloud of gritty, baked dust, we fled from a man-made 24-hour spectacle that even Dante could have never imagined, even if he had taken all the drugs available to an Italian in the 14th century at the same time.<br /><br /><i>With apologies to, and in memory of HST, we need his free spirit now more than ever</i>Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com4tag:blogger.com,1999:blog-35868762.post-78548520356605533502009-04-29T09:28:00.000-07:002009-04-29T17:49:15.372-07:00Heroku Has Launched<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://ecx.images-amazon.com/images/I/510MZNM0WDL._SL500_AA280_.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 280px; height: 280px;" src="http://ecx.images-amazon.com/images/I/510MZNM0WDL._SL500_AA280_.jpg" border="0" alt="" /></a>Well, just a very short time after <a href="http://deadprogrammersociety.blogspot.com/2009/04/heroku-why-havent-i-been-using-you-till.html">I started using</a> <a href="http://heroku.com/">Heroku</a>, they went commercial. Yes, after their very successful beta period, where apparently <a href="http://gigaom.com/2009/04/23/heroku-to-exit-beta-start-charging-for-cloud-computing/">24,999 web sites other than mine were already hosting</a>, Heroku is now offering a paid version of their service. I had a sneak peak at the pricing a few days ahead of time, but I was not able to talk. And despite my intentions of blogging this right away, the other demands on my time have kept me occupied till just now.<br /><br />Heroku is mimicking the successful "freemium" pricing plan of other services, but brings it into the Ruby web application hosting space, within some pretty generous limitations. Yes, exactly. Heroku still allows you to get started with their service at no charge at all. Wow. I do not know of any free web hosting service that does not at minimum plaster your site with hideous ads. Let alone quality Ruby hosting. Let alone Ruby powered cloud computing.<br /><br />As your traffic needs increase, or database storage needs, they have a variety of pricing tiers. Thanks to a slick AJAXified pricing tool, the complexity of so many pricing options is somewhat mitigated. Plus it's fun to play with.<br /><br />The evolution of most startups seems to track really well with Heroku's overall business strategy: as a customer becomes larger and more successful, their increased traffic and database needs will cause them to start paying Heroku. If your venture does not really go anywhere, it is not really taking up much in the way of resources anyhow. This aligns Heroku nicely with the needs of their customers, instead of pitting them against them trying to extract revenues too early in the growth curve.<br /><br />Despite a few growing pains, they have had pretty decent uptime on my app so far. Even with my new app <a href="http://www.thumbfight.com/">Thumbfight</a> getting a few sudden traffic bursts, as well as having a major reliance on <a href="http://twitter.com">Twitter</a> for back-end processing (more about <a href="http://www.thumbfight.com/">Thumbfight</a> in an upcoming post). <br /><br />Heroku is a work in progress, but so is most everything else on the entire Internet. Heroku provides an amazingly easy and insanely cheap way to jumpstart your Ruby-based web application hosting and deployment, while still getting some real expertise. As long as you can work within their current technical limitations, for a Ruby-powered startup, I think Heroku is a great way to go.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-66959397008632818612009-04-18T15:08:00.000-07:002009-04-18T15:34:33.848-07:00Project Flying Robot: Getting RAD With The ATMega328<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://cache.jalopnik.com/assets/resources/2008/04/wind-tunnel.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 247px; height: 165px;" src="http://cache.jalopnik.com/assets/resources/2008/04/wind-tunnel.jpg" border="0" alt="" /></a>I have been wanting to upgrade the hardware used in our <a href="http://dorkbotpdx.org/wiki/dorkboard">Dorkboards</a> for <a href="http://flyingrobo.com">flying_robot</a>, from the ATMega168, to the newer better faster ATMega328. More memory, and a faster UART for serial communications with the XBee modems in the same pinout = easy win. Thanks to a quick shipping turnaround from <a href="http://www.adafruit.com">@adafruit</a> I got them in before the weekend, so I could play a little bit today.<br /><br />The first step was to upgrade my hard-working Arduino Diecimila to a 328. I now have it working great with <a href="http://rad.rubyforge.org/">Ruby Arduino Development (RAD)</a>, but since RAD was really setup for Arduino 12, I had to make a couple changes. Here is what I did:<br /><br />1. D/l and install <a href="http://arduino.cc/en/Main/Software">Arduino 15</a> (brave, I know, since that is the latest release, and many people run one version down from the latest)<br />2. Change my hardware.yml entry<br /><pre>mcu: atmega328p</pre><br />3. Change my software.yml entry<br /><pre>arduino_root: /Applications/arduino-0015</pre><br />4. Lastly, since the ATMega328 bootloader runs at a faster rate, I had to tweak the RAD code itself to support it. The file "/vendors/rad/generators/makefile/makefile.erb" is the template used to create the makefile that compiles and uploads the code to the Arduino. Line 77 in that file controls the baud rate, which needs to be set like this for the '328:<br /><pre>UPLOAD_RATE = 57600</pre><br /><br />Once I had done this, I was easily and quickly able to recompile/re-upload the latest flying_robot code to my test board. Yeah! Hopefully tomorrow I can upgrade <a href="http://github.com/deadprogrammer/flying_robot_rogue_one/tree/master">Rogue 1</a> and try a flight at the new, higher communication speed.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com2tag:blogger.com,1999:blog-35868762.post-13179527447394322622009-04-14T11:23:00.000-07:002009-04-14T12:49:09.304-07:00Heroku, Why Haven't I Been Using You Till Now?<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dinaview.com/wp-content/uploads/2008/06/hero.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 290px;" src="http://www.dinaview.com/wp-content/uploads/2008/06/hero.jpg" border="0" alt="" /></a>Last night, I finally got around to deploying something on <a href="http://heroku.com/">Heroku</a>, an interesting service founded by my formerly LA-based Ruby programming chums <a href="http://adam.blog.heroku.com/">Adam Wiggins</a>, James Lindenbaum, and Orion Henry. I had played with their previous incarnation of the service, now known as "Heroku Garden" but only recently have I gotten to know a little bit more about the incredible offering they have evolved into.<br /><br />Basically, the Heroku crew have addressed the question "how can I deploy my <a href="http://rubyonrails.org/">Ruby on Rails</a>, <a href="http://www.sinatrarb.com/">Sinatra</a>, or other <a href="http://rack.rubyforge.org/">Rack</a>-based web application into a dynamic cloud of servers with ridiculous ease?" They have done this with an ingenious architecture that takes advantage of <a href="http://aws.amazon.com/ec2/">Amazon's EC2</a> to provide their internal infrastructure. This allows Heroku to concentrate on their most important core value proposition, of a simple way to take your Ruby code and just push it into the cloud.<br /><br />Notice I said "push". Heroku requires that you use <a href="http://git-scm.com/">git</a> for source control of your application. You are using git for everything now, right? If not, git with it! Sorry, could not resist that. Anyhow, by simply adding a remote master to your existing git repo that points to Heroku, along with a few Ruby gems that they provide, you can deploy your app just by pushing your current branch to the Heroku master. <br /><br />Doing this, causes your app to get packaged up into "slug". Once you have an active slug, it will be be deployed to a "dyno" within the Heruku grid, which is what a virtual node within their architecture is called. As your app requires more resources, the slug can be deployed to more dynos within "less than 2 seconds for most apps". That is way faster than starting up a new Amazon EC2 instance yourself, and having this extra layer has a number of other interesting benefits as well.<br /><br />Heroku has a quick start guide, which pretty much runs down what you need to do. I had found a slightly more <a href="http://heroku.com/pages/quickstart">simplified quickstart here</a>. I already had an existing Sinatra-based app that I wanted to test on Heroku, so here were my steps:<br /><br />1. Install heroku gem<br /><pre>sudo gem install heroku</pre><br />2. Setup Heroku account info, and upload public key<br /><pre>heroku keys:add </pre><br />This will prompt you for your Heroku account info. If you have not created one yet, better jump over to <a href="http://heroku.com/signup">http://heroku.com/signup</a> and create one<br /><br />3. Create Heroku app from my existing app<br />I just changed so my current directory was the app I wanted to add to Heroku, then entered:<br /><pre>heroku create myappname</pre><br />This creates the new app on Heroku, and creates a remote branch so you can deploy just by pushing the code.<br /><br />4. Deploy my code<br /><pre>git push heroku master</pre><br />That's it! If you have a really simple app, with no database access, you are done. What, you are deploying a Ruby on Rails app and need a database setup? OK, then...<br /><br />5. Run database migrations<br /><pre>heroku rake db:migrate</pre><br /><br />NOW, you are fully deployed and running on Heroku. Unless you are not. I still had a minor problem with my app. I was writing my log file into "logs/production.log" but Heroku does not normally allow write access to disk. The two exceptions to this are the "tmp" directory and "log" directory (notice singular). They do provide an easy way to view your most recent log entries, by typing <pre>heroku logs</pre> which is how I figured out my problem with the log directory.<br /><br />So, here is my total time required to deploy this app on Heroku:<br />- Reading quickstart = 3 minutes<br />- Installing gem and entering account info = 2 minutes<br />- Making my app a Heroku app = 1 minute<br />- Deploying my app for the first time to Heroku = 2 minutes<br />- Figuring out what I had done wrong from the Heroku documentation = 10 minutes<br />TOTAL = 18 minutes<br /><br />Here were my bonus steps:<br />- Reading Heroku docs on using a custom domain with Heroku = 1 minute<br />- Realize I need to rename my app using Heroku command line = 1 minute<br />- Rename my app using Heroku command line = 1 minute<br />- Setting my DNS settings to point to Heroku = 5 minutes<br />- Telling Heroku about my custom domain = 1 minute<br />TOTAL = 9 minutes<br /><br />So there you have it... a fully deployed app, living in the Heroku grid and consequently the Amazon EC2 cloud, in less than 30 minutes, having never used their tools before, including troubleshooting a minor configuration problem. That may seem unfair... and it is. That is exactly the kind of unfair I like on my side!<br /><br />Much credit should go to the Heroku team for creating something extremely cool and functional. Important details are still not available, like pricing etc., but at least for now Heroku, is a great way to easily get your app up into the cloud within literally minutes.<br /><br />What is the future for Heroku? Funded by <a href="http://ycombinator.com/">Y Combinator</a>, they have been quietly working away, and now with Sinatra team leads <a href="http://twitter.com/bmizerany">Blake Mizerany</a> and <a href="http://tomayko.com/">Ryan Tomayko</a> onboard as well, I think we will be hearing a lot from this exciting little company.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com8tag:blogger.com,1999:blog-35868762.post-28656050801407660622009-04-08T10:12:00.000-07:002009-04-12T18:38:42.668-07:00LARubyConf 2009 - Jim Weirich - "The Grand Unified Thoery of Software Development<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://homepage.mac.com/michaelrevans/photos/tetron-cluster-front.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 240px; height: 192px;" src="http://homepage.mac.com/michaelrevans/photos/tetron-cluster-front.jpg" border="0" alt="" /></a>As the 2009 <a href="http://www.larubyconf.com/">Los Angeles Ruby Conference (LARubyConf)</a> drew to a close, our keynote speaker <a href="http://onestepback.org/">Jim Weirich</a> took the podium. I have seen Jim speak several times, and he is both intelligent, as well as down to earth, which is a rare combination indeed.<br /><br />The subject of his keynote would be anything but down to earth. In fact, it would have to be one of the most ambitious talks I have ever seen at a Ruby conference. Only Jim could have pulled it off as he did, with both humor and insight.<br /><br />One thing Jim does is have to conduct Tech Interviews. One question he always asks is "What do you look for in a good design?" Most people's answer: "UMMMMMM..."<br /><br />Then Jim seemingly shifted themes abruptly, to physics. Specifically, subatomic particles.<br /><br />It is known that particles that are charged the same repulse each other. Furthermore, every time you change electric field, there is a changing magnetic field at 90 degree angle.<br /><br /><a href="http://en.wikipedia.org/wiki/James_Clerk_Maxwell">James Clerk Maxwell</a><br />Maxwell discovered 4 equations that describe relation between electrical and magnetic fields. By describing these two entirely separate forces, combines into single force. Maxwell's work probably greatest contribution to science.<br /><br />Then, along came <a href="http://en.wikipedia.org/wiki/Ernest_Rutherford">Ernest Rutherford</a>'s famous <a href="http://en.wikipedia.org/wiki/Geiger-Marsden_experiment">electron experiment</a>. The one where electrons were supposed to evenly deflect onto a screen, but instead occasionally would deflect wildly. As a result, we now know that matter was mostly open space.<br /><br />There are four known forces<br />- electromagnetic<br />- gravity<br />- strong nuclear<br />- weak nuclear<br /><br />The search for the "Unified Field Theory" in physics is a search for a single explanation that accommodates all four forces.<br /><br />This is very much like the search for a single explanation for software design.<br /><br />Some Commonly Accepted Software Design Principles<br />- <a href="http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod">SOLID</a><br />- <a href="http://en.wikipedia.org/wiki/Law_of_Demeter">Law of Demeter</a><br />- <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a><br />- <a href="http://clintshank.javadevelopersjournal.com/smallmethods.htm">Small Methods</a><br />- <a href="http://en.wikipedia.org/wiki/Design_by_contract">Design by Contract</a><br /> <br />Lots of ideas about how to write software, but no grand unified theory.<br /><br />"The Grand Unified Theory of Software Development" <br /><br /><a href="http://www.amazon.com/Composite-Structured-Design-Glenford-Myers/dp/0442805845">Composite/Structured Design</a><br />- Glenford J Meyers - 1978<br /> <br />Coupling & Cohesion - from best to worst<br />- no coupling<br />- data coupling - local data, simple<br />- stamp coupling - local data, structured<br />- control coupling<br />- external coupling - global data, simple<br />- common coupling - global data, structured<br />- content coupling - when you reach inside of modules and mess with them from outside<br /> <br />control coupling<br />- method has flag parameter<br />- flag control which algorithm to use<br /> <br />Symptoms<br />- word OR in description<br /> <br />Example:<br /><pre>Array.instance_methods(true)</pre> and<br /><pre>Array.instance_methods(false)</pre><br /> <br />Which one lists only private methods?<br /><br />Another example, Rails does this:<br /><pre>Customer.find(:all)</pre> vs. <br /><pre>Customer.find(:first)</pre><br /><br />Myers' classification were OK, however failed to extend well to objects and dynamic languages<br /><br />Meilir Page-Jones's book <a href="http://www.amazon.com/Every-Programmer-Should-Object-Oriented-Design/dp/0932633315/ref=sr_1_2?ie=UTF8&s=books&qid=1239585961&sr=1-2">"What Every Programmer Should Know About Object-Oriented Design"</a> has 3 sections, two of which are not too useful, but the third is very interesting. It talks about the idea of Connascence in software design.<br /><br />Connascence - when two things are born and grow up together<br />Two pieces of code share Connascence when a change in one module requires a corresponding change in the other.<br /> <br />CoN - Connascence of Name<br />- when code linked by name<br />- can also apply to databases<br />- class name is NOT, but parameters are<br /> <br />Locality Matters<br />- if you have things grouped together, there is stronger connascence.<br />- as dist increase, you reduce connect between them<br /> <br />Connescence of Position<br />- when the order of the params matters<br /><br />Low/high degree of CoP<br /> <br />When you encounter CoP it is better to transform it to CoN<br /><br />Degree Matters<br /><br />CoP in test data example<br /><pre><br /> User.find(:first)<br /></pre><br /> <br />CoM - Connescence of Meaning<br />- when two bits of code have to agree on the meaning of data<br /> <br />When you encounter CoM it is better to transform it to CoN<br /><br />Contranesence is when things have to change opposite to each other<br />- for example, collision of class names in two different modules<br />- solution is to use namespaces<br /> <br />Another Example?<br />- do not monkeypatch unless you have to, and if so use namespaces<br /> <br />Connascence of Algorithm<br />- Two methods that do different things, but that are bound together by algorithm. For example, two different bits of code in two different languages that have to talk to each other. JavaScript client, Ruby server is good example.<br /><br />CoA -> CoN <br />- also known as DRY<br /> <br />CoT - Connascence of Timing<br />- for example, a race condition<br /> <br />Summary<br />- Connascence is the 'quark' of software design <br />- Not really any tools to analyze code<br />- Seems like there is a relation between connascence and design patterns<br /><br />Wow! Jim had taken us all the way from subatomic particles, to a start towards a unified theory of software design, and tied it all together nicely. And made it fun! It was a tremendous cap on an excellent conference, and we all had really appreciated Jim's contribution.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-35358313167790429822009-04-07T12:19:00.000-07:002009-04-07T12:41:37.993-07:00LARubyConf 2009 - Blake Mizerany - "Sinatra: the Ultimate Rack Citizen"<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjt-GGBRmgCL7wDPDH7yGgvUmBj8grvaLbTXvrP4_vVu_V0QYR5c1ZDeCcpDCgaHn2a5BjEoEIiuqV0ZPNm9cVGU5WD7dGY0IOvJBguP3u-vU09flo50DGNo0aZCNaVMBhFoaH/s1600-h/Picture+1.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 160px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjt-GGBRmgCL7wDPDH7yGgvUmBj8grvaLbTXvrP4_vVu_V0QYR5c1ZDeCcpDCgaHn2a5BjEoEIiuqV0ZPNm9cVGU5WD7dGY0IOvJBguP3u-vU09flo50DGNo0aZCNaVMBhFoaH/s200/Picture+1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5322035063165968658" /></a>I was very happy when the next presenter at the <a href="http://www.larubyconf.com/">Los Angeles Ruby Conference 2009 (LARubyConf)</a> was <a href="https://twitter.com/bmizerany">Blake Mizerany</a>, creator of the very cool Ruby micro-framework <a href="http://sinatrarb.com">Sinatra</a>. As long-time readers of this blog know, I am very into Sinatra. <br /><br />There has been an incredible amount of work going into Sinatra lately, so I was very interested to catch up on what the team has been up to.<br /><br />What is Sinatra? A Ruby Domain Specific Language (DSL) Mapping REST to simple actions<br /><br />Why?<br />- small<br />- fast<br />- great rack and ruby citizen<br />- strong focus on HTTP<br />- HTTP caching helpers built in before it was cool<br />- content negotiation<br />- no boilerplate<br />- dead simple config when the default are not enough<br />- smart configuration<br />- DOCS- sinatrarb.com<br />- extending is easy<br />- rack is the only dependency<br />- very low WTF to LOC ratio (jeremy mcnally's rubyfringe talk)<br /><br />when?<br />- a few controllers models and views<br />- starting any web application<br />- you need reusable apps and/or middleware and/or resources<br />- you need speed<br /><br />who?<br />- heroku<br />- github<br />- taps<br />- integrity<br /> <br />sinatra in your gems<br />- a mini-github for offline repo browsing<br />- a local plugin and play wiki<br />- memcached utilization graphs<br />- config reusable github hook<br /> <br />Example: NotTwitter<br /> <br />As classic Sinatra<br /><pre><br />set :username,<br /> Proc.new { fail "yo"}<br /> <br />get '/' do<br /> ...<br />end<br /></pre><br /><br />Change<br /><pre> require 'sinatra'</pre><br />to<br /><pre> require 'sinatra/base'</pre><br /> <br /> <br />But I want to deploy to Passenger or Heroku! No problem.<br /><br />./bin/install-not-twitter<br /> Copy example config.ru to cwd<br /> Copy .gems file<br /> <br />.ru is a standard Rack config file.<br /> <br />.gems is a Heruku configuaration file that will handle any needed Ruby gems installations<br /> <br /><pre><br /> git init && git add .<br /> git commit<br /> heroku craete<br /> git push heku aster<br /> heroku <br /></pre><br /> <br />3 Awesome Features in Sinatra<br /> pass - I cannot handle this request, try the next route<br /> forward - sinatra as middle ware... done my job, let the next app take over... pop in front of rails metal<br /> use - Sinatra loves rack so much, we made sure not to hide it<br /> <br /> <br />Resources<br /><a href="http://sinatrarb.com">http://sinatrarb.com</a><br /><a href="http://github.com/rack/rack">http://github.com/rack/rack</a><br /><a href="http://github.com/rack/rack-contrib">http://github.com/rack/rack-contrib</a><br /><a href="http://github.com/rtomayko/rack-cache">http://github.com/rtomayko/rack-cache</a><br /><br />If you are doing everything with Rails, you are probably using too much for the job. Sinatra is simple, fast, and extensible. I am using it in two production applications right now, along with Rails. Sinatra handles parts of the application better than how Rails does, so that is how I roll.<br /><br />Especially with the ever increasing momentum behind Rack, Sinatra is a good bet for getting things done. Combined with Rails Metal, and you really have it all.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0tag:blogger.com,1999:blog-35868762.post-85353999912810949982009-04-05T20:51:00.000-07:002009-04-06T19:59:42.184-07:00LARubyConf 2009 - Danny Blitz - "Herding Tigers: Software Development and the Art of War"<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://blog.herdingtigers.com/wp-content/uploads/2009/03/tigerheadonly3.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 250px; height: 181px;" src="http://blog.herdingtigers.com/wp-content/uploads/2009/03/tigerheadonly3.jpg" border="0" alt="" /></a>I had no idea what I was about to experience at <a href="http://www.larubyconf.com/">Los Angeles Ruby Conference 2009 (LARubyConf)</a> when <a href="http://blog.herdingtigers.com/">Danny Blitz</a> took the podium as the next presenter. I had seen him hanging out with his distinctive pompadour, tattoos, and leather jacket. He is a big guy, and hard to miss. But he had been pretty quiet till then, which was about to change radically.<br /><br />Herding Cats is a term commonly used when describing the management of software teams. But when Danny Blitz says cats, he means big cats aka tigers. So who is this guy? He has done TONS of stuff, from DOD to Dell, to the DARPA autonomous vehicle challenge. Very cool stuff.<br /><br />Get Agility?<br /><br />"A good plan violently executed now is better than a perfect plan executed next week" - Patton<br /><br />Q. Why is software so difficult?<br />A. We don't want to face the truth<br /><br />Q. Why don't we want to face the truth?<br />A. We're afraid<br /><br />Q. What are we afraid of?<br />A. We're afraid we do not know anything about end result<br /><br />Q. How can we deal with this?<br />A. Admit the truth<br /><br />A tiger team is a small self improving team.<br /><br />What can you expect from a tiger team?<br />Their first project was scheduled to take 5 weeks - took 5 days<br /><br />TIGERS ARE A TEAM!<br /><br />QA is part of tiger team<br /><br />Tigers show leadership<br /><br />Tigers self-improve<br /><br />Almost no meetings on a tiger team<br /><br />QA and test automation are the tip of the spear<br /><br />QA should be there from very beginning<br /><br />Shared psychology and intelligence<br /><br />Winning, boldness, excellence<br /><br />Not afraid of the dark<br /><br />Who is on team?<br />- all staff needed to deliver product<br />- leader, 4 devs, 1 automation engineer, 1 Q, product staff m,ember<br />- in addition, architecture, system admins, any other support staff<br /><br />why warfare?<br />- business is battle<br /><br />There are two kinds of warfare: attrition and maneuver<br /><br />Attrition warefare<br />- traditional, tactical<br />- clashing head-on<br /><br />Maneuver warfare<br />- internet space<br />- rapid modern violent<br />- unexpected movements<br /><br />Speed<br />- it is a competitive weapon<br />- undeniable advantage in business<br /><br />Speed mitigates risk<br />- not a guarantee<br />- damage is contained by quickly compensating<br /><br />Speed improves the team<br /><br />Speed adds to job satisfaction<br /><br />Speed allows agile to function properly<br />- max iteration length (usually 30 days)<br /><br />Speed builds credibility<br />- shows a lot of work in short order<br /><br />Cows and tigers<br />- cow is bigger, but who wins?<br /><br />Disease: using agile terms to describe non-agile project<br /><br />Corporate animal kingdom<br />- Tiger<br /> cautious, calculating, looks to win<br /><br />- Cow<br /> herding<br /> not known to be original<br /> afraid of risk<br /><br />- Bear<br /> big, usually mellow<br /> awesome battle skills<br /> live and let live attitude<br /><br />- Leopard<br /> truly wild<br /> will attack at any time<br /><br />- Elephant<br /> huge and tough<br /> invincible<br /> best to avoid battle<br /><br />- Hyena<br /> scavenger<br /> steals food<br /> evil<br /><br />"Tiger teams are like Hell's Programmers" - Danny Blitz<br /> <br />Leadership<br /> this is what makes or breaks<br /> faith <br /> love<br /> hope<br /> success belongs to the team<br /> failure belongs to the leader<br /> buck stops here<br /> fearlessness<br /> listener and learner<br /> protector<br /> outside influences<br /> internally too<br /> team members themselves<br /> <br />US marine management techniques<br />- manage by end state and intent<br />- reward failure<br />- demand to be questoned<br />- glorify the lower levels of organization<br /> <br />Politeness and professionalism<br />- that or poison<br /> <br />Agile is not a methodology, it is a mindset, it is inevitable<br /><br />Danny says he is working on the book called "Herding Tigers". He has also started a blog at <a href="http://blog.herdingtigers.com">herdingtigers.com</a>. All I can say is, he is a very dynamic and exciting speaker. Everyone was captivated, myself included. I'm still not sure how I took these notes.<br /><br />Rock on, Danny!Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com1tag:blogger.com,1999:blog-35868762.post-17736677823291001442009-04-05T20:22:00.000-07:002009-04-05T20:42:25.225-07:00LARubyConf 2009 - Jeremy Evans - "Sequel"<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.freeclassicimages.com/images/ghostbusters_2_1989.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 269px; height: 384px;" src="http://www.freeclassicimages.com/images/ghostbusters_2_1989.jpg" border="0" alt="" /></a>The next session at the 2009 <a href="http://www.larubyconf.com">Los Angeles Ruby Conference (LARubyConf)</a> was <a href="http://code.jeremyevans.net/sequel">Jeremy Evans</a> presenting <a href="http://sequel.rubyforge.org/">Sequel</a>, which is a very powerful database toolkit for Ruby.<br /><br />Ruby originally had adapters for each database. The problem was that each was very database specific. This was a problem due to both SQL differences, as well as API differences.<br /> <br />no behavior<br /><br />1997 - ruby-postgres was first created. <br /><br />2000 - DBI<br /><br />2004 - Active Record<br />Although AR made things easier, it had strong opinions. These opinions did not always map perfectly to any particular database.<br /><br />2007 - Sequel<br /><br />Completely DB independent API.<br /><br />Example is concatanating strings, which requires a completely different syntax in each flavor of SQL database.<br /><br />Concise<br /><br />Optional Behavior<br /><br />Opinions?<br /><br />Ruby should be like clay in a child's hands - Matz<br /><br />Sequel advantages:<br />- Simple - as possible but no simpler <br />- Flexible - opinions, not dogma<br />- Powerful<br />- Lightweight - 1/2 memory usage as active record<br />- Well maintained<br />- Easy to Contribute<br />- Easy to Understand<br />- More Fun<br /><br />Show me the *** code!<br /><pre><br />require 'seq'<br />DB = Sequal.sqlite('larun')<br />DB[:attendees].count<br /># => 1<br /><br />DB[:attendees].first<br /># => {:name ='', :address =>}<br /></pre><br />Transactions<br /><pre><br />DB.trans do<br /> DB[:entry],insert(:account_id => 1)<br /><br /> ...<br /><br />end<br /></pre><br /><br />SQL Loggers<br /><pre><br />DB.loggers << Logger.new($stdout)<br /></pre><br /><br />Each DB has its own connection pool<br /><pre><br />DB[:table].all # or .each<br /><br />.update(:column => 'value)<br /><br />.delete<br /><br />DB[:table] # this is a dataset... like query cursor<br /></pre><br /><br />Sequel is a functional API, where object methods return copies of themselves.<br /><br />.select - while columns<br />.filter<br />.order<br /><br />This means you can easily chain function calls, like jQuery. Awesome!<br /><br />Sequel represents its internal objects using SQL's own internal representations<br /><br />Sequel has 'core' and 'model'<br /><pre><br />class Attendee < Sequel::Model<br /> many_to_one<br /> one_to_many<br /> <br /> <br />end<br /></pre><br /><br />Hooks & Validations - got 'em<br /><br />Sequel it built entirely out of plugins. That sounds interesting, but experience with DataMapper has shown me that too many plugins may not be a good thing. However, I do not have any direct experience with Sequel yet, so this may be a non-issue.<br /><br />13 - # of database adapters that Sequel supports today<br /><br />Database graphing<br /><br />Everything was going so well up to this point. However, Jeremy then tried to do his demo on Windows, just to show that if you are one of the poor souls using Windows, it can still work for you. He failed to account for the quirkiness of conference display adapters, and what that can do to a machine. Oh well, no demo.<br /><br />That said, I was really impressed by what I heard about Sequel. I think I will have to try it out on something, just to see how it does.Ron Evanshttp://www.blogger.com/profile/06754261780924273552noreply@blogger.com0