« May 2008 | Main | July 2008 »

June 30, 2008

Behind the scenes of Tarpipe XMPP

Alex and Adam asked me to elaborate on the tools I used to implement the Tarpipe XMPP gateway.

I used the Net::XMPP2 Perl module, in particular the Net::XMPP2::Component class. It uses the AnyEvent async framework, which in turn support the EV library , giving you all the love of kernel polling.

Until the Net::XMPP2 author releases a new version, you should use my own copy if you plan on doing external component work (check the component-reply-with-from branch). Net::XMPP2 is widely used for bots, but not that many components, and some methods need some love to work properly in a component environment.

The HTTP part was done using the excellent AnyEvent::HTTP class. I'm using my own version, which includes a bug fix to the http_post function (on its way to release 1.03 of AnyEvent::HTTP) and adds support for HTTP::Request to http_request. I hope to see this included in the main AnyEvent::HTTP distribution but I still need to update the documentation.

The rest is just glue code.

Using Tarpipe via XMPP

Tarpipe is a wonderful service to execute a workflow of web services. You create your workflow visually, and then you send an email or POST to a API end-point to run it.

For example, this is the workflow I use to post to Twitter, Jaiku, and Pownce:

Tarpipe Microblog Workflow

Usually I would send an email and my subject would be posted, but I also have an IM client always available.

So I wrote this XMPP-to-Tarpipe gateway. Its simple to use:

  • use Tarpipe to create an workflow: you must use the REST Decoder;
  • When you save the workflow, you'll be given a API token, a 32 char hex-string;
  • subscribe <the API token>@tarpipe.simplicidade.org. You can subscribe from multiple JIDs.

That's it: you now have a new buddy on your roster. Any message sent to him (apart from help) will trigger the Tarpipe workflow.

Have fun.

June 28, 2008

OAuth and Google

Excellent news!

Google now supports OAuth on all Goggle Data APIs.

*jour

On the topic of Bonjour goodies, take a moment to read about, and install, some of the *jour tools.

Very cool stuff.

Bounjour, CPAN!

For a Perl programmer, a local (on your laptop) CPAN mirror is a worthy investment. The problem is that a full mirror is 5.8Gb of disk space. Fortunately we have CPAN::Mini that creates a mirror of the most important stuff using only 830Mb.

So now you have your local mirror, and after you add the path to your cpan urllist configuration, all your module installations will use this faster mirror.

But you shouldn't stop there. If you are using a Mac with 10.4.x or above, you can share you CPAN mirror with the others on your local lan, and announce it proudly using Bonjour.

To do that, just follow these steps. First create a Apache configuration file at /etc/httpd/users/. I called mine cpan.conf and it looks like this:

#
# My local mini CPAN mirror
#

Alias /cpan/ /Users/melo/Documents/cpan/
<Directory "/Users/melo/Documents/cpan/">
    Options none
    AllowOverride none
    Order allow,deny
    Allow from all
</Directory>

RegisterResource "Local CPAN Mirror" /cpan/ 80

This will share your CPAN mirror (change /Users/melo/Documents/cpan/ to the path of your local mirror) and announce it via Bounjour with the name "Local CPAN Mirror".

Make sure that you start Web Sharing, at System Preferences, Sharing. If yes, stop and then start to load the new configuration file.

To use this CPAN mirror from other computers, you just start cpan, and then type o conf urllist URL where URL is the URL advertised.

Reconnoiter

Something to pay attention to, Reconnoiter.

Its still work in progress but in the last status report, Theo Schlossnagle mentions that he is already using this software to monitor about 2.9k services with less than 0.10 load, peek.

That's impressive.

June 27, 2008

A simple file upload?

Yesterday, I tried to upload my usual avatar to my Google Account. If looks like a simple file upload, right? Guess not:

Foto-Upload-Only-Ie-Ff

WTF? Couldn't they just fallback to a simple file upload? Is this rocket science?

MySQL master/master how-to

New location: the How-to is now live at http://www.simplicidade.org/how-to/mysql-master-master/.

In the past, I needed to use a MySQL master/master setup for a client. At the time, I got it to work, but forgot to take notes about the process.

In the last days, a friend asked my for help to do a setup like that again, to use with a Tigase XMPP server.

So I wrote this how-to, complete with configuration files, sample data and schemas, that walks you step-by-step through the process of setting up a pair MySQL servers in a master/master configuration.

You can fetch the entire how-to with git:

git clone git://github.com/melo/mysql-master-master-how-to.git

The how-to is written in MultiMarkDown, but a simple Markdown should also format it correctly.

A tarball with everything is also available.

Please let me know if you find any mistakes. Pull requests are the preferred form of collaboration :).

Update: included some tweaks from dbr, and added a HTML version with proper CSS. Download again, and look at how-to.html.

June 25, 2008

Git starters

In the last two or three weeks, I had about five or six people IM'ing me "What's the best way to start with git?". Last time I wrote about this was almost 7 months ago, so I think its time for an update.

First, I personally compile git from source. I do not trust package maintainers yet. Some parts of git use ssh (for example), so they mark ssh as a dependency, and this brings their own version of ssh. Most often that not, I ended up with a broken ssh on my system. So, compile from source is my personal recommendation for now, until package managers understand system-ssh.

Second, git is still being developed at a fast pace. I recompile it once a month at least, and I follow the master branch. That is, after I compiled the latest stable release from a tarball, I clone the git repo and I install the master branch version. Usually a make distclean && autoconf && make && sudo make install does it for me.

You will be happy with the official releases. There was a time that you had to wait a lot between releases, but now, they are coming out at a fairly decent pace. So sticking with the stable tarballs is a good enough option.

Regarding actually using git, I have three recommendations:

If you like dead-tree-stuff like me, watch out for the Pragmatic Version Control Using Git book (now in beta, PDF available), by Travis Swicegood.

For hosting your git repos, you can't go wrong with either Github or Gitorious. I'm using the fist one because I like all the user interface niceties, but the second is also available as GPL project that you can use on your own site.

The Pre-Air Season

Every year, around this time, we start seeing pre-air or pilot episodes of shows that might or might not be produced for next season.

This year is no exception and the first round of shows is out there. I've seen some of them and I organized them into categories.

First, I think these are sure winners:

This ones I liked a lot:

  • Leverage (TNT/Electric Entertainment): a 5-person Oceans Eleven. Its not a great show, but I had a lot of fun watching. If they manage to keep the pace, it could become great;
  • Fringe: excellent FBI-drama, reminds a bit of The X-Files.

Might be worth something category:

  • Raising the Bar: written by Steven Bochco. Its a laywers-show, so nothing new but I'm giving it the benefit of the doubt because of Bochco.

Not recommended at all:

  • Do Not Disturb (Fox): comedy, soap, in a hotel somewhere. Lots of girls floating around though;
  • The Middleman (ABC): I admit, I turned off the TV 4 minutes into it after a big cheesy monster appeared on the scene. It seems to bad to watch. Thread carefully, and if you do find the courage to see it to the end, let me know if its worth it;
  • Life on Mars (Fox): not my type, you might like it - american remake of an old BBC series, detective goes back in time after a car accident.

In parallel you also get some summer shows:

  • In Plain Sight: casual US Marshals story, about the witness protection program. Its fun, its summer, good value; with Mary McCormack;
  • Fear Itself: I'm not a fan of horror or suspense, but I would recommend you watch the first episode at least. Its very very well done, and you might like it.

Thats all for now, have a great Pre-air Season.

June 23, 2008

bash completion for chit

cheat is a very nice command line cheat sheet system.

chit is a git-powered version, that even supports private cheats or project level cheats distributed using the git system.

I've added a bash completion script to chit. It's very simple but it works for me. I've also sent a pull request to robin, so you might see it in the main chit repo in the future.

Update: you can find the bash completion script in the master chit repo now.

June 16, 2008

Christmas

You know, its not too soon to start thinking about christmas presents. And to make it easier on all of you who are dyeing to know what to get me, I'll save you some time: FPV RC Racer.

The clock is ticking...

Progress bars

Yes, progress bars. Those little graphical strips of color or animated graphics that you get to look at while you wait for something to happen in a computer.

Apparently the subject is worth a four page paper by four authors.

Two sad facts:

  • I actually find the subject mildly interesting (maybe I should ask her on a date);
  • Expect implementations of the Fast Power version in a jQuery/Scriptaculous/insert-fav-JS-UI-lib plugin soon.

How projects use git: Buildr

The best articles about distributed version control systems for me, are not those who explain the internals and the user interface, but how specific projects use those tools to get things done.

I've come across posts about several projects and how they use git and mercurial, and I'm going to start publish them here.

The first one is a couple of months old but still good: Buildr developers and how they where using a git-svn mirror.

Have fun.

The stars huddled together...

... and decided to align just for me.

Last week I had a discussion with a friend. We have a small pet-project growing between us, and I suggested using free accounts at GitHub to collaborate. A couple of days, I got a call asking "But how can I hide the project?". It was mostly a WTF-moment for me. The concept of developing this in a closed environment wouldn't even register with my conscious thought. Eventually I talked about GitHub private repositories and the fact they are a paid-for-feature.

It was a wake up call, I guess. I've started mirroring my personal projects to GitHub some time ago, and I haven't completed any of them. I've recently upgraded my account at GitHub, not because I'll use the private repository feature, but because hosting my free stuff also costs them money (and I like the HTTPS protection everywhere).

At the same time, a online thread developed about programmer insecurity that fits like a glove to this situation. It started with Ben Collins-Sussman and a couple of replies I found interesting:

The personal experience above, reading through these articles and their comments, and my own "push everything" current frame of mind, all three are having a big discussion inside my head right now.

I don't believe hg is more prone to sharing than git as Ben suggests because its not the tool that makes it happen. Tools are not trend setters, they just make them easier to set. There where a lot of projects very successful and with a lot of developers and collaborators working only with CVS, so git and hg (to name just two) are not magic wands that make your project a success in that department. I believe they will make them easier to collaborate on but that's it.

I've also don't agree with Ben statement that DVCS make going dark easier. Again, its not the tool, its the mentality of the programmer. Sure, the argument that creating a branch and working alone in the dark with git/hg is much easier than Subversion, but this is the first time I see someone sell this as a positive thing. Putting artificial barriers to collaboration is just duct-tape over bad social skills.

But programmer insecurity is a fact, not fiction, and it must be dealt with properly, or we risk antagonizing a lot of them. Funny that Ben says that hg is more share-friendly be default. We could argue that git is more protective of each collaborator insecurity because they get to choose which branchs are sharable-quality, they don't automatically share every branch, and so, the programmer is free to fail in his topic branches and push only is trunk/master branch with the cleaned up work.

I've also read over those articles that the rebase feature of git is destructive and allows one to hide our bad code. Well, I want my code reviewers to have a good understanding of the feature I'm sending them, and sometimes, my reasoning is best explained by a sequence of three patches and not the nine it took me to get there. Having said that, I would like very much the ability to duplicate a branch and rebase in a single operation, to keep my personal path to the final set of patches intact, as a parallel branch. Knowing how you got to your three commits is very helpful sometimes.

And speaking of git missing features, I like to have lots of branches, and I would prefer not to delete them when I don't need them anymore. I would love to have a branch annotate feature, to write a small text associated with which branch: why it was created, what was it trying to achieve. I should be able to hide those branches, not delete them. This could be done at hosting sites like GitHub though, with a motto: GutHub, where your old branches go to sleep.

Bottom line is: tools don't make decisions for a programmer. They don't turn a project in a community success or failure. They only make the process harder or easier. Code sharing, open-source collaboration, it will always be a people-problem, requiring social skills.

Update: fixed links, thanks Nuno.

June 13, 2008

A docking station

When I get to the office every morning, I need to plug all my external cables stuff.

My laptop ends up looking like this:

Apple Docking Station

I wonder if Apple could make a Laptop with a connector for a docking station. I think their version of the concept is called "Second Mac at the Office".

June 10, 2008

Mobile Me

I haven't seen the Keynote yet (holiday in Portugal, spending the time with the kids out in the sun), but I did a quick drive-by-browsing across the Mobile Me Guided tour.

I found the shorter video, about the Web version of the applications (at the bottom of the Mobile Me features page), much more interesting.

The following details got my attention:

  • the video demos are done not only with Safari on the Mac but also Firefox and IE7 on Windows;
  • the URLs shown jump from http to https and back: it seems that secure access will be available, at least to the application, no mention of secure iDisk access;
  • no support for IE6: the web applications will not support IE6. Is this the start of a trend? I know that a lot of web developers would love to drop IE6;
  • support for Apple TV: you should see an Apple TV upgrade with support for Mobile Me soon. Its mentioned in the video.

I've dropped my .Mac membership some time ago, but I will sign up for a year of Mobile Me just to see how it works.

iPhone 3G

I've completed the reservation process for my iPhone 3G this morning. I've asked for a 16Gb model. They don't have a box to select the white or black version, so I'll have to double check on that soon. My current mobile phone, a Sony Ericsson 608i will be two years old at the time I upgrade so my "upgrade phone every two years"-rule seems to hold up.

Reading over the material online, it has most of what I wanted: 3G, and built-in GPS. The only thing I did not get was a upgrade to 32Gb.

With the €199 price point (for the 8Gb model), the biggest complaint that people I've talked to had, also goes away. The price is very competitive when compared with other phones I see around here. I don't see the iPod Touch keeping the current price though, so I expect that to drop real soon now.

Regarding the "background apps" stuff, the solution Apple came out with should be enough for the XMPP crowd. Sending a badge with the number of pending messages covers most of the XMPP clients needs. It remains to be seen if we can convert those pushed messages to a sound so that the user knows that it has something that requires attention. Another thing: how well will this work? Does it keep the radio on all the time? or does it uses a SMS message to send its notifications? More questions than answers actually.

There are a lot of pending questions also about the 3G capability: can I use the iPhone as a Modem for my Mac? Via bluetooth? Will it provide a bluetooth PAN? That would be the best case scenario, given that Mac OS X supports Bluetooth PAN's since 10.4.9.

And the GPS, will I have a Bluetooth serial port to access the NMEA stream? If we get that, and a decent dock for cars, a lot of Tom Tom's could go Bye Bye, with just a decent software upgrade.

The last thing that caught my eye was that you can download applications to your iPhone without going through the App store. Enterprises will be able to push applications to devices directly, and there is an "ad-hoc" mode to send applications directly to the device. I could not find details on these two options, though. Something to keep an eye out for.

All in all, with the iTunes App Store also opening up and having access to applications outside Apple control, I think it will be a good phone for me in the next two years.

Update: one last thing - the fact that we still got the same shitty camera doesn't bother me as much as the lack of video capture. All my phones so far had under two mega-pixels and they worked just fine for me needs. I can only hope that this is not a hardware but a software limitation.

Update: and the bad news keep on coming - from the iPhone 3G spec page, the Audible formats supported no longer include version 4. Sucks really bad, because that was the recommended for iPods so all my books are in format 4.

Sl^Hnow Leopard

It's now 10.5.3 time and I'm still running 10.4.11. That alone should tell you something about how I feel about Leopard.

The Snow Leopard approach, a OS-cycle dedicated to "just" stabilization and performance, is a welcome investment on the part of Apple.

It's interesting though. It seems that Apple is saying: we can invest an year just to digest and make what we have better, because there is no competition for the next 2 years at least. And they are probably right - Microsoft operating system department is so messed up right now (XP doesn't want to die, so now you can buy Vista and upgrade legally to XP).

From the desktop Snow Leopard page, the only thing that I'm interested on is OpenCL. I don't know how "open" it will be but the idea of giving an API to the GPU is a welcome addition to the set of APIs. Other operating systems already have them, so its nice to see it reach our OS.

Personally, I think that OpenCL is the only API I will really use to its full potential on my desktops or laptops. This of course, if someone ports the H.264 encoder that Handbrake uses to OpenCL. Using the GPU to speed up my DVD-to-Apple TV sessions would be a most welcome improvement.

On the server side of the equation, Slow Leopard brings an interesting feature: read/write support for ZFS volumes. Nothing is mentioned about booting Mac OS X from a ZFS volume, so I don't think you'll get that, but your big disks should be able to use a modern file system next year.

One thing I find strange: you'll have to wait for 10.6 to experience a Safari with SquirrelFish? Thats bizarre. I understand why Apple would like to upgrade the Safari browser with major releases only (back-porting to the previous release like it happen with Safari 3.1 and 10.4.11), but the Webkit development is (or seems to be) very very fast, so I would like to see a more aggressive schedule for Safari releases.

So, next year, Apple will digest the 10.4 and 10.5 new features, to prepare a massive 10.7 upgrade in 2010/11. Just in time for Windows 7.

June 05, 2008

LazyWeb: mode lines and encoding

Hi all,

does anybody knows if I can modify the encoding that should be used with a specific file using mode lines?

I have a project with a mix of utf8 and iso-8859-1 files, and I would like to "mode-line"-them to the proper encoding so that I don't have to remind me to do it.

Thanks

June 04, 2008

Simple Boujour-enabled command line copy/paste service

Sometimes I need to send someone a bit of code in the local LAN, or even to myself on the second Mac.

It would be nice to:

pbpaste | publish_local_lan

And on the other side:

receive_local_lan from_melo | pbcopy

There are a lot of tools like that the run under Mac OS X, but today I found one that can be run from the command-line: pastejour.

Installation is trivial:

sudo gem install dnssd
sudo gem install jbarnette-pastejour --source=http://gems.github.com

And after that, just use it. It will use your short name as the broadcast key. A sample session:

melo@MrTray:melo $ date | pastejour 
Pasting melo...

# in another computer

melo@Screen:melo $ pastejour melo
(melo from MrTray.local.:42424)
Wed Jun  4 10:40:54 WEST 2008

Simple and effective.

June 03, 2008

RailsConf 2008 Git Tech Talk

Scott Chancon did a huge presentation (523 slides...), Getting Git, at RailConf 2008. Don't be scared by the number of slides, the presentation is excellent and you'll end up with a huge knowledge of git.

Extremely recommended.

June 02, 2008

Easy Git collaboration in local LANs

Doing quick hack sessions in a local LAN with friends using git just got a lot easier.

Evan announced gitjour, a Bonjour-enabled Git server. You can start a server for any repository on your laptop/workstation and others can browse the available repositories and easily clone them.

There is already a lot of work going around gitjour by a couple of developers, so it has a nice future ahead.

Nice...

TextMate - Search in Project With ack

I've moved the Search in Project With ack TextMate command to GitHub.

In the process I've included a change by Corey Jewett to respect the selected files in the project drawer, and I've also added support for the TM_ACK_COMMAND_PATH variable, in case your ack copy is somewhere strange.

There is an open TODO (catch popen errors if the ack command is not found), but I need to freshen up my ruby skill. It should be trivial, push requests welcome.

This is a very simple command. If you are looking for something more complete check out the ack TextMate bundle by Trevor Squires.

June 01, 2008

Me

I must say, if Apple snatches the me.com domain for its new .Mac service, I would be impressed. Its a very cool domain name, simple, very Jobs'like.

Contacts

melo@simplicidade.org (XMPP/email)
+351 302 029 050 (voice)
melopt (Skype)

IronMan challenge

Iron Man badge Are you ready to be an Iron Man? Join the challenge and find out! (what is the meaning of this little man?)

Moosaico

Junta-te!

Recent Comments

Powered by Disqus
Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.2