Arlington/DC Erlang September Meetup: Kevin Smith on webmachine

6 08 2009

On September, Kevin Smith of Hypothetical Labs will be speaking about webmachine: an erlang REST toolkit which makes it easy to develop HTTP interfaces using Erlang.

erlang

Kevin is the author of the Pragmatic Programmers ‘Erlang in Practice’ screencasts series (one of the best resource to learn Erlang) and doesn’t reside in Washington DC so don’t miss this chance to come see him talk.

If you plan on coming, please RSVP at meetup.com.





Screencast: Install Google Wave Server

29 07 2009

In this screencast, I show you how to install the reference server implementation of the Google Wave Protocol, which was released by Google recently. To learn more about Google Wave, visit wave.google.com.

Install Google Wave Server Video

The audio on the Vimeo version of the video is not as good as the original Video which you can download here:

Note: This is my first attempt at creating a screencast so excuse the mumbling and incomplete sentences. I’ll get better with practice :-)

Resources:

Wave Protocol Wiki

make-cert.sh script

OpenFire

Wave Protocol

Google Wave

I recorded the screencast on my Ubuntu laptop, using the same setup as Remi.

http://code.google.com/p/wave-protocol/w/list




Rubynation slides: Concurrent Programming with Ruby and Tuple Spaces

13 06 2009

Here are the slides from my talk at RubyNation today.

I enjoyed giving the talk and I appreciate all the great questions that followed.





Using cron to treat my strained muscle

4 06 2009

Last night, I strained my right thigh 5 minutes into a soccer game. It sucks because it was an important game and I really wanted to win. Had we won, we would have made the playoffs. But we lost and it is the end of the season for the Raiders FC.

What sucks even more is that I have another big game on Sunday with my other team: Reds United. We are playing the one team that we need to beat to finish on top of the league. That means I have 3 days to recover from my injury. That’s not a lot so I’m trying to be as disciplined as possible in treating it.

Based on what I could have found on the web (Wikipedia has been my doctor for years now), I should treat it with ice. However, applying ice for more than 15 minutes is bad and you need to let the leg warm up again for at least 45 minutes before icing it again.

It’s easy to get lost in work and forget to re-apply the ice, or to stop icing my legs, so I’m using a combination of gnome-schedule, a nice little GUI for cron and notify-send to remind me to start/stop icing at the right time.

The GUI is super-simple to use. To install it: sudo apt-get install gnome-schedule

Then just type gnome-schedule on the command line to get it started.

gnome-schedule

You see my little schedule there, I’m using libnotify-bin’s notify-send to show me ‘growl-like notifications’ when it’s time to start or stop icing:

start_icing

I use gnome-schedule together with notify-send all the time to quickly set up reminders for myself. The point of this whole post was to show you a nice way to set reminders for yourself on a Linux box.

All right, gotta go. It’s time to start icing again. I really want to play on Sunday!





Install monit from source on Ubuntu

5 05 2009

The Ubuntu package for monit is way out of date on Hardy (8.04 LTS): the package is at version 4.8.1 when the latest version of monit is 5.0.1. Even the Jaunty package is only at version 4.10. There are additional features such as remote mail servers that you cannot use on 4.8.1. Another issue with using the old monit package on Ubuntu is that it is out of sync with the monit documentation.

This post will show you how you can install monit from the latest source on Ubuntu Hardy.

First, we’ll use a dirty trick to obtain some Ubuntu init scripts for monit: we’ll install monit using apt-get and then remove it. In the process, the monit init scripts will not be deleted and we will be able to use them with our fresh install of monit from source.

sudo apt-get install monit

After installing, make sure that the following files are present: /etc/init.d/monit, /etc/default/monit and /etc/monit/monitrc (that’s the whole reason why we are installing monit from the package after all. Once we’ve got that file, we can simply remove the package:

sudo apt-get remove monit

Cool now we have an init script and our config files. We will modify them later to work with our new monit install

Before downloading the monit source, let’s install a few dependencies

sudo apt-get install libssl-dev bison flex

Now, get the latest monit package from their download page and untar it:

wget http://mmonit.com/monit/dist/monit-5.0.1.tar.gz
tar xzvf monit-5.0.1.tar.gz
cd monit-5.0.1

OK. You are not ready to build and install the source

./configure

Watch the output and if everything went smoothly, then:

make
sudo make install

At this point you should have the latest and greatest version of monit installed. Let’s verify that:

monit -V

It should print:

This is monit version 5.0.1
Copyright (C) 2000-2009 by Tildeslash Ltd. All Rights Reserved.

Almost there, we just need to make a couple of small changes to the init script. Find the following lines in /etc/init.d/monit (should be way on top):

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/monit

… and replace them with:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/local/bin/monit

Now open up /etc/default/monit and find startup=0. Replace that with startup=1 and save the file.

You can now modify your config file located at /etc/monit/monitrc as you see fit. Once you are done, verify that the config file is OK:

sudo monit -c /etc/monit/monitrc -t

If the syntax of your file is ok, you are ready to start monit:

sudo /etc/init.d/monit start

That’s It I hope this helped!





4 Interesting Events in the DC Area

10 04 2009

If you are software developer or entrepreneur based in the Washington DC area, there are a few interesting events coming up that I would like to share with you.

Bootstrap Maryland in College Park on May 2nd


Bootstrap Maryland

Jared Goralnick is putting together an interesting conference for entrepreneurs. “Bootstrap Maryland brings together young entrepreneurs and the necessary tools for running a lean and successful technology business.”

becamp in Charlottesville, VA on May 8-9

I attended last year’s becamp in Charlottesville and it was a great event. There is a small but very interesting tech community in Charlottesville and people drove from Richmond or Northern Virginia.

Charlottesville is also a great city. If you’ve never been there, becamp is your excuse to go visit. It’s the home of the best public school in the country and there is a lot to visit around Charlottesvile: wineries, Monticello, The Lawn, etc…

Developer Day in Falls Church, VA on May 30

I drove down to Durham, NC for the first developer day a few weeks ago and it was definitely worth the 4 hour drive. Now, our friends at Viget are bringing Developer Day to Falls Church. Highly recommended if you are a Ruby developer.

RubyNation in Reston, VA on June 12-13


RubyNation

The second edition of RubyNation is coming in June 12-13. They started announcing the speakers and it seems like a it will be another great conference.





My Review Of Developer-Day in Durham

23 03 2009

This Saturday, I attended Developer-Day in Durham, NC. Overall, the conference was outstanding. Priced at $50, it was definitely worth the 4-hour trip from Washington DC. Below you will find a quick review of each of the talks.

Refactoring Your Wetware by Andy Hunt

Andy Hunt of the Pragmatic Programmers gave us a brief overview of his latest book: Pragmatic Thinking And Learing. He described the way our brains are wired and offered advice to take advantage of what we know about our brain’s architecture.

Andy started by explaining the concepts of Systems Thinking, as described in The Fifth Discipline. Systems Thinking is when you get out of the habit of thinking of things as discrete objects, but as systems instead. Once you start looking at objects as belonging in a system, you began to see how they are interconnected. Having graduated from the UVA Engineering School where Systems Engineering is the most popular department and working with Ahson Wardak, a Systems Engineering PHD candidate, I’ve had some exposure to the discipline and concept.

Andy followed by describing neuroplasticity, the fact that your brain can grow new neurons if you exercise it. He then moved to a discussion on The Dreyfus Model of skills acquisition. In summary, the best way to become an expert is through deliberate practice: 10 years of practice! Imitate the experts, then assimilate, then innovate.

Andy explained that the brain has two sides: the left and right brain, which he would rather call the Linear Mode and Rich Mode, respectively. Think of the Linear Mode as the mode that is prevalent with geeks and the rich mode as the one that is non-verbal, non-rational, synthetic, non-linear, asynchronous like a search engine, analogical, spatial, intuitive, holistic… The Rich Mode of your brain sometimes has trouble putting into words what it is processing but this is where the innovation/ideas comes from. A lot of inventors report that they discovered things in their dreams. Therefore, Andy suggested to try out Free-Form Journaling: wake up every morning and write down 3 pages of stuff (by hand, no typing) before you do anything else. Don’t censor yourself. Write about anything.

Then, Andy explained how our memory is not very good or, I quote, ‘is a piece of shit’ so it is important to write down things. When you think of a new idea, write it down. If you don’t keep track of your ideas, then you stop having great ideas. Once you have an idea, the best way to explore it is with a mind map (on paper, no computers). Once you are done with the mind map, putting that information in a personal wiki can be helpful.

Finally, he challenged the audience to try meditation and warned us against multi-tasking. The benefits of meditation far outlasts the actual practice itself. Multi-tasking is really bad for your brain so avoid context switching.

I enjoyed Andy’s talk and I will definitely pick up his book in the near future.

Evolving Your Git Workflow by Jason Rudolph

In this talk, Jason Rudolph showed us a few special git commands and how we can take advantage of them to improve our workflow.

He started showing us the power of git bisect by walking us through a debug session using the command. He used git bisect to find out when a bug was introduced in his codebase using the following commands:

git bisect start head %%commitid%%
git bisect log
git bisect good
git bisect bad

He then showed how you can automate the whole process with:

git bisect run %%command%%

I thought that was one of the coolest things I’ve ever seen!

After having used git to do some ‘Biology’, he proceeded to show how git can help us with ‘Archaeology’. The latter is the ability to be able to clearly tell what happened in the past by looking at the history of a code base (through a version control system log). It is important for your projects to have a clear, well-defined archaeology, so that new programmers can look back and figure out why things were done in a certain way. Jason shows us how git makes that easier. For example, with git, you can amend commit messages or your can commit changes from one file in two different commits. Pretty slick!

In the third section of his talk, Jason showed that branching in git is easy, cheap (41 bytes), fast, and have low ceremony. Therefore, there is no excuse not to branch and we should Branch All The F***** Time (BATFT).

Optimizing Perceived Performance by David Eisinger

In this talk, David showed us how improving the perceived performance of a web page can greatly improve the user experience. David used a sample application called DBDB (DoucheBag DataBase) to illustrate his idea which got the crowd laughing a lot.

David showed us a few client side techniques that we can use to make our application appear like it is loading faster. He advocates the use of Unobstrusive Javascript with jQuery (with jRails).

Lightning Talks

After lunch, we had the lightning talks. Here is a set of links from the talks:

Getting Girls With Musical Magic and Ruby by Jess Martin and Chad Humphries

Jess and Chad showed us how they are using Ruby to make mashups. Check out Girl Talk for a good demonstration of this style of music.

Jess wrote some ruby code that wraps Sox to create mashups. He built a really slick frontend for it (CHOP40) which lets you select some tracks and automatically mashes them up for you. I’ve been a big fan of the style (especially diplo’s stuff) so it was cool to see the techniques behind this art form.

From Paralysis to Static Analysis by Aaron Breda

At every conference I go, I always have a moment where I kinda zone out (thinking about cool stuff I could do with the stuff I just learned about). It usually lasts only for one/two talks before I get my focus back. Unfortunately for Aaron, it happened during his talk this time :-/ ( I’m curious to know if it happens to every one so let me know in the comments. )

From what I picked up though, Aaron and Chad should be awarded some kind of heroes award for the work they are putting into upgrading rcov to Ruby 1.9. Thank you guys!

Scala: A Modern Programming Language by Clinton Nixon

Clinton gave us a great introduction to the Scala programming language. Scala was created in 2001 by Martin Odersky. It runs on the JVM, compiles beforehand or JIT. It is a functional language where everything is an object (like in Ruby) and it supports actor-based concurrency (so it is future-proof with the trend to have more cores on CPUs).

Pros: interoperability, scalability, beauty (of course that is subjective)

Cons: JVM (if you do not like that, though I think this is a pro rather than a con), hard to navigate libraries if you do not know Java, small user base, no killer frameworks/libraries.

Clinton posted his slides at http://crnixon.org/talks and they are the kinda of slides that you can read and learn from without seeing the presentation so go check them out.

I really enjoyed this talk since I’ve been meaning to learn more about Scala and this served as a great introduction.

Page Caching Resurrected: A Fairy Tale by Ben Scofield

Ben’s talk was great. He showed us a creative use of Rails Metal with page caching. The idea can be summarized as follow:

  • Cache your page with only the content that will be seen by all users.
  • Have your page make a javascript call to get user specific content in the background.
  • To make that javascript call be fast, use Rails metal in the back end to return the needed data fast.

I’ve been using this technique at ShareMeme and messagepub with the exception of the use of Rails Metal. For example, at messagepub, most pages are cached and we fetch the menu bar and navigation links with JavaScript after they are displayed. Therefore it turns out our Rails action with the most hit is the action that fetches the menu bar (since everything else ends up being served by the web server) therefore it would make sense to use Metal for that action to reduce the delay before the user sees the menu.

Summary

I can’t decide which was my favorite moment of the conference: whether it was seeing git bisect in action, learning about Scala, listening to a mashup that was created with Ruby, or seeing a cool use of Rails Metal.

This was a great conference with really good talks both in content and delivery. Thanks to Viget, Relevance, and Ben Scofield for putting it together. I look forward to the next one in Washington DC.

If you want to get other opinions on the talks from Developer Day, see how the rest of the audience rated the speakers at speakerrate.com





Using the MessagePub gem

13 03 2009

In my last post, I showed you how you can use ActiveResource to interact with MessagePub. I’ve also wrote a gem that makes interacting with MessagePub even easier.

To get started, install the gem:

sudo gem install messagepub

Code is worth a thousand words so I’ll leave you with this code sample:

require 'rubygems'
require 'messagepub'

client = MessagePub::Client.new('YOUR API KEY')

notification = MessagePub::Notification.new
notification.body = 'So and so has added you as a friend.'
notification.escalation = 20
notification.add_recipient(MessagePub::Recipient.new(:position => 1, :channel => 'twitter', :address => 'joetheplumber'))
notification.add_recipient(MessagePub::Recipient.new(:position => 2, :channel => 'email', :address => 'joe@example.com'))

client.create!(notification)

The gem is on RubyForge, the code on github and we have a Google Group where you can ask questions.





Easy Cross-Platform Messaging with MessagePub

13 03 2009

I have not been blogging very actively lately because I’ve been really busy with ShareMeme and a new product which I am proud to introduce to you: MessagePub

Message Pub

MessagePub is a easy-to-use REST API that lets you send messages to people on different communication platforms. We currently support: AIM, SMS, Google Chat, Twitter, Email, or Phone (text-to-speech). We will keep adding more platforms as we go.

The API lets you schedule messages to be sent in the future, set up an escalation schedule (e.g. if you don’t find this person on AIM, email them 20 minutes later, etc…), and it takes care of saving and sending you back any replies from your recipients.

Because it is a REST API, it can be used very easily with ActiveResource in Ruby. In this blog post, I will go through an example of using ActiveResource to interface with MessagePub. In later blog posts, I will cover the messagepub gem.

For more information on the API and how to use it with other languages besides Ruby, check out the documentation.

In order to use the MessagePub API, you have to sign up on messagepub.com to obtain an API Key. It is free to get started because we give away 100 free credits for your to try it out when you sign up.

Once you have an API Key, you can get started very quickly with ActiveResource. The main resource that you will be interacting with is a Notification. You can create a Notification, list all your Notifications, and get a particular Notification. A notification can have more than one recipient but when you send the messages it will not send the message to all the recipients at the same time. There is an escalation parameter that you can set to determine how long to wait before sending the message to the next recipient. The default value is 10 minutes if you do not explicitly set it. If you want to send the messages to all the recipients at the same time, simply set the escalation for the notification to zero.

Let’s look at some code:

require 'rubygems'
require 'activeresource'

class Notification < ActiveResource::Base
  # Remember to put in your API key.
  self.site = "http://YOURAPIKEY@messagepub.com/"
end

Make sure to replace your API key in the URL. That’s it! Now you are ready to start creating notifications.

# Create a new notification
notification = Notification.new(:body => 'You have a message waiting for you in your inbox',
  :escalation => 30,
  :recipients => {
      :recipient => [
        {:position => 1, :channel => 'email', :address => 'joe@example.com'},
        {:position => 2, :channel => 'twitter', :address => 'sharememeinc'},
        {:position => 3, :channel => 'phone', :address => '1234567890'}
      ]}
 )
notification.save

You’ve just created a notification. How easy was that? As soon as you run this code, an email will be sent to joe@example.com. After 30 minutes (since escalation = 30), if Joe never replied or acknowledged receipt of the email, a twitter message will be sent to ’sharememeinc’. 30 minutes after the twitter message was sent, if ’sharememeinc’ never replied, MessagePub will call the phone number (‘1234567890′) and read them the message.

Of course, if at any point, the recipient acknowledges receipt of the message, the chain is halted.

You don’t always have to take advantage of the escalation feature. If you only need to send the message to one person, just add one recipient and there is no need to specify the position of the recipient. For example, to send a text message to ‘12356789′, you can do the following:

notification = Notification.new(:body => 'This is the body of the SMS text message',
            :recipients => { :recipient => [{:channel => 'sms', :address => '1234567890'} ]})
notification.save

I hope you will find this helpful and I look forward to hear your feedback on MessagePub.





Ahson Speaking at TechStart 2009

30 01 2009

My co-founder at ShareMeme, Ahson Wardak, will be speaking at TechStart 2009 at the University of Virginia, next Thursday. Stop by if you are in the area. It should be a great event.

TechStart 2009