1. Unicode dominating the Web?

    May 5th, 2008

    I wish, but more likely this is a measure of the reported encoding of Web pages based on their HTTP headers.  And that would not be surprising.  Let’s be real, it’s just a header that we all copy over and over just because it seems like the right thing to do.  And most modern frameworks put it there for you, even when you’re serving ASCII text from a latin1 encoded database table. Still, A for effort.

     

  2. Distributed Twitter Client in 20 lines of code

    May 5th, 2008

    There you go.

    require 'rubygems'
    require 'xmpp4r'
    require 'xmpp4r/roster'
    
    puts 'Connecting ...'
    client = Jabber::Client.new(ARGV[0]).connect(’talk.google.com’)
    client.auth(ARGV[1])
    puts ‘Receiving’
    roster = Jabber::Roster::Helper.new(client)
    roster.add_presence_callback do |roster_item, old_presence, new_presence|
      if new_presence
        from = roster_item.iname || “#{new_presence.from.node}@#{new_presence.from.domain}”
        if new_presence.status
          puts “#{from}: #{new_presence.status}”
        end
      end
    end
    client.send(Jabber::Presence.new)
    Thread.stop
    client.close

    Run from the command line:

    $ ruby distwit.rb <jabber_id> <password>
    Connecting …
    Receiving
    Andre Lewis: Away
    Matthieu Riou: Enjoying a JavaOne couch
    Matthieu Riou: Entertaining Assaf
    Alexis Midon: hacking in a couch @community-one 

    Now just wait for your friends to status away using their IM client.

    And don’t forget, please yo-yo the rrm.