« September 2008 | Main | November 2008 »

October 31, 2008

Crazy QRCode tool

Crazy... A QR Code generator that outputs HTML.

To use:

cpan HTML::QRCode
perl -MHTML::QRCode -e 'print HTML::QRCode->new->plot($ARGV[0])' TEXT

Replace TEXT with the string you want to encode. For example, a QR Code for http://www.simplicidade.org/notes/ looks like this in HTML:

Who said tables where dead?

Next step: search for a barcode-in-HTML generator.

FriendFeed

Some days ago I found out about the real-time FriendFeed API and yesterday I decided to try it.

I've setup all my feeds into my FriendFeed account and subscribed the usual suspects. Also, I used Fluid to create a SSB just for FriendFeed so it doesn't interfere with my main browser.

The rate of updates is still too large for my comfort zone, specially because of twitter updates. I need to look for a way to hide them for all my contacts. After that, it should be back under control.

My relation with the new social web is still undecided. There is a lot of very cool stuff out there, but mostly is a big black hole on my productivity, so I tend to be mostly offline.

Technically, it is an interesting topic. For example, the messaging core behind the the micro-blogging sites (at least the ones properly designed) is the kind of stuff that I really like to build.

Update: via comments, Marcos Marado saves the day. To hide Twitter updates, go to your FriendFeed homepage, hide one of your Twitter updates, and then a link "hide others like this" will show up and allow you to hide all Twitter updates. To show them again, scroll down to the end of the page, and a "Shown N hidden entries", and click "Un-hide".

git-gui screencast

Yesterday, I uploaded to Vimeo a screencast showing some of the features of git-gui.

With a UNIX background, and with only a brief detour to Windows NT 3.51 (the last Windows version with decent internals), I'm mostly keyboard oriented and never before I used a GUI to solve my SCM needs.

This changed with git-gui. With the Stage chunk and Stage line features, I'm much more productive with git-gui, and my commit history is cleaner and more logical to follow.

These features make it easy for me to commit an hours work into several discrete logical steps, and even do a quick commit to fix a small bug without a full cycle of git-stash/fix/commit/git-stash pop.

Anyway, enough courtship. Enjoy.


git-gui screencast from Pedro Melo on Vimeo.

October 30, 2008

A nod's as good as a wink to a blind bat

A nod's as good as a wink to a blind bat

October 29, 2008

Bitflu

My favorite BitTorrent client is Bitflu.

It is a head-less client that runs on a server somewhere, and you can manage it using a HTTP or telnet interface. It also supports a auto-start directory where all the torrent files you drop in it will be picked up automatically.

What it doesn't have is a way to upload a torrent file programatically.

At least, not until today. Check out my torrent-upload branch of Bitflu. It provides a new HTTP-based API to upload a single torrent file.

To use it, do this:

lwp-request -c 'application/x-bittorrent' -m POST \
  http://your.bitflu.site:4081/new_torrent  < my.torrent

The lwp-request command does not support authentication. I need to hack a Net::Bitflu module to make this easier.

The patch was sent to the author, but I don't know if it is something that he is interested on or not.

My current git setup

I've been using git for more than an year now, and I've settled on a repository organization that I like.

The foundations of this setup are:

  • a GitHub account: the public face of my repositories. A free account is enough, and although I don't have private repositories at GitHub, I'm using the Micro plan, a mixture of kudos to the GitHub owners, and my preference for HTTPS-based access;
  • gitosis: manages all my git repositories, both public and private;
  • my x-git-update-to-latest-version: I re-compile git every day with the master branch, to help catch regressions.

For each project I have, I keep the repository on all my computers in the ~/work/ directory. Those repositories are synced between work computers (desktop at the office, and laptop everywhere else) using a Unison profile.

The use of Unison gives me the possibility of leaving work half done in the desktop, and finish up at home if I feel like it, without having to commit and push from one to the other.

On each repository, I have two main remotes configured.

The origin remote points to my gitosis setup. You can use my gitosis install how-to for a painless setup. In addition, I add a Host entry to my ~/.ssh/config like this:

Host git
  HostName hostname.of.server.with.gitosis
  User git

This allows me to use a simple git:melo/repo.git as a remote URL. Short and to the point.

The second remote, named github, is only created on public repositories, and points to my GitHub account.

Manually I add a third remote named all. I copy the other two remotes urls to it. This allows me to git push all and have my changes pushed to both remotes with a single command. For example, for the AnyEvent::Mojo project, I have this .git/config file:

[remote "origin"]
    url = git:perl/anyevent-mojo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "github"]
    url = git@github.com:melo/anyevent--mojo.git
    fetch = +refs/heads/*:refs/remotes/github/*
[remote "all"]
    url = git:perl/anyevent-mojo.git
    url = git@github.com:melo/anyevent--mojo.git

This setup gives me peace of mind (all my code ends up on 4 different systems), and provides a pretty face (Github) for other to use.

Next step: create a script to make all this a one-step process.

You go boy!

By Christopher Hitchens

Those who despise science and learning are not anti-elitist. They are morally and intellectually slothful people who are secretly envious of the educated and the cultured

Nothing much to add, really. I don't get to vote on this one.

October 25, 2008

Tip: a Macbook Pro without the battery will always hybernate

My laptop battery started expanding to new territories (the outside, really), and given that it is no longer under warranty, I ordered a new one online.

But for the last week or two, I've been working on my laptop without the battery, and in the process I learned something useful.

If I close the laptop lid, and wait for the light to start glowing, I can then unplug the power cord, move to a new location and plug back it again.

The Macbook will use the hibernation feature so I can keep all my state even without any power.

Much better than the shutdown/startup process I was using until I accidently noticed this.

AnyEvent::Mojo uploaded

Update: uploaded version 0.04, fixes two small things: I was using pre-release 0.8 of Mojo, and apparently I don't know how to use requires in Makefile.PL, causing a stream of CPAN tester failures.

Sebastian Riedel released version 0.7 of his new HTTP stack Mojo (also includes a tiny web-framework called Mojolicious).

The code is very very nice and clean, and in the future you might be able to run Catalyst apps on top of it.

Given that I was looking for a small web framework to run inside my long-lived AnyEvent daemons, I wrote a small glue module to run Mojo-apps using the AnyEvent::Socket/AnyEvent::Handle goodness.

The module is AnyEvent::Mojo, and I've just uploaded release 0.2, that includes keep-alive support.

There are three features that I want to do before a 1.0 release:

  • Support for 100 Continue handling: I don't use it but the other Mojo::Server classes have it;
  • Asynchronous processing of requests: you start processing a request, but decide that you need something from a network service somewhere. You can start that request, pause the Mojo transaction, and when you receive the response from the network service, you complete the Mojo transaction;
  • build a AnyEvent HTTP client using Mojo::Client.

Fun stuff, specially the second one.

Performance-wyse, I'm happy with the result so far. The most simple Mojo::HelloWorld application is capable of this numbers:

# Start a server
perl -MEV -MAnyEvent::Mojo -e 'AnyEvent::Mojo->new->run' &

# Benchmark
ab -k -c 10 -n 5000 http://127.0.0.1:3000/

# Executive summary
Concurrency Level:      10
Time taken for tests:   6.935770 seconds
Complete requests:      5000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      795000 bytes
HTML transferred:       190000 bytes
Requests per second:    720.90 [#/sec] (mean)
Time per request:       13.872 [ms] (mean)
Time per request:       1.387 [ms] (mean, across all concurrent requests)
Transfer rate:          111.88 [Kbytes/sec] received

# (Quad-core 2.6Ghz, Mac OS X 10.5.4, stock perl 5.8.8)

At 700 requests per second with a 1.3 ms delay, the overhead seems to be pretty low, for a pure Perl based HTTP 1.1 compliant server.

ADSL woes

Cool week around here. The final countdown for the opening of a new bridge made everybody work twice as fast, and twice as bad.

The fiber that connected the north side of Figueira da Foz to the south was cut by the construction team, and they had to lay a new one for some bizarre reason.

Result: 4 days with zero or unstable ADSL service. We used 3G connectivity but only on a single PC to do support.

Things are staring to settle but the quality of the new path our ADSL connection takes to the central office is a bit weak.

Something to bitch about next week I guess.

October 19, 2008

Financial crisis explained

A video to explain the current financial crisis, by Marketplace Senior Editor Paddy Hirsch.

The best one I found so far.

October 18, 2008

Stitcho

There is this new network notification service called Stitcho. Think Growl (which they support) but with a HTTP-based API.

Its still in beta, but works pretty well. I've found some problems with UTF8 encoded strings and I have an open ticket on that.

I've released a Perl client library to CPAN, Net::Stitcho. It allows you to use it from your Perl programs easily. Its not feature complete yet, only the send message API is supported, but it should have the signup API today.

Its not clear to me the business model behind Stitcho, and getting this deployed widely enough to make a difference is also a challenge, but I like the concept so lets see how it goes.

Update: the Net::Stitcho module is, as of version 0.03, feature complete.

October 15, 2008

The new Corleone family

Remember the Godfather, when Michael goes to Las Vegas, meets with Moe Greene and offers to buy him out? He says no, and in the final moments of the movie, he ends up with a bullet in his head.

Well, the nine largest banks in America seem to have learned something from the movie, because in a recent meeting with Treasury Secretary Paulson, they get a single sheet of paper in front of them, giving the government permission to buy significant stakes in their companies. More: they where told that they have to sign it before they leave the room.

Which they did. Talk about "I'll make them an offer they can't refuse"-moment.

I guess they though that the Federal Government can find even more painful methods than death to use on them.

(via Peter).

Fruit news

The new laptops released yesterday made most of my unread news items this morning.

Overall, they look good, and if you have a fetish for industrial design, then you probably had a picture of Jonathan Ive in the shower today.

I admit that I'm curious to see one live, not that I'm shopping for a new laptop (my 17" should be good for another 2 to 3 years), but the full size glass screen and the new touchpad are intriguing.

The switch from the DVI output to a DisplayPort connector is a usual move for Apple: they want to move to a new display connection, so they look around and pick the one they think will be the future, not the current standard for others.

The lack of FireWire is unfortunate. All my external drives and DVD burners are firewire, which I find much more smooth than USB.

But out of all the news yesterday, my interested focused on two small details.

The first is the 24" LED Cinema Display. The quality is of course amazing, but that was expected of a LED display. The detail that really makes the difference for me is the cable that connects the display to the laptop.

It has three connectors: an obvious DisplayPort, a useful USB2 connector (to access the three port hub on the display itself), and a MagSafe connector.

So you get to your desk, connect the three plugs into your Macbook or Macbook Pro and you don't need extra cables. There, a reasonable docking station. And without a costly dedicated connector on the laptop.

The second detail I found interesting is the NVidia chipset. For me it's not about the games, but about the performance that this GPUs can provide: the GeForce 9400N that powers the entry level MacBooks provides you with 26 Gflops over 8 cores, and on the MacBookPro you get a 9600M GT that bumps that to 122 Gflops over 32 cores.

Some may think that these are just numbers, but lets put that in perspective: if we are to believe the listing of the Top500 Supercomputer sites in June 2005, the top slot was the BlueGene/L, a 64k core system with a peak rate of 183.50 Gflops.

So a $2000 laptop has 65% of the performance of a 2005 Top SuperComputer, in the graphics card alone. Add the Core 2 Duo processor for fun.

But still, the Gflops numbers are pretty meaningless for people who don't use the CPU a lot (like me). But for photo and video editing, there is a lot of potential in there, and for Apple, this raises the expectations bar on Snow Leopard.

The next-year OS is expected to unleash all of this Gflops to an unsuspecting world. I wonder what applications will we see if this power is really readily available.

October 14, 2008

SIP is up and running

My new ADSL provider, Telepac, gives me a free SIP number, with free fixed-line calls, so I downloaded a soft-phone, X-Lite, and set to work.

The configuration is pretty simple. See the screenshot below:

Configuration for X-Lite using Telepac SIP

You can use whatever you want as a display name. The user name is the string +351 followed by the number you got. The password field should pretty obvious.

The two fields that wasted most of my time where Domain (must be voip.telepac.pt) and the Send outbound via: must be set to proxy with the string proxy.voip.telepac.pt:5070.

This configuration is enough for me to receive and place calls. There are still some things I would like to know, like if it is possible to call my number via another SIP provider.

Although I'm using Telepac VoIP service, the SAPO VoIP service is similar (if not the exact same one), so replace telepac.pt with sapo.pt and you should have a working setup too (untested).

So now I have a hard phone connected to the VoIP router at the office, and a soft phone running on my Macs. With this, I now have two VoIP accounts, Skype and SIP. Next step: get a XMPP client with Jingle.

If you want to say hi, +351 302 029 050. Use a fixed line for now, it seems to be mis-configured if you use a mobile network.

October 03, 2008

SMTP is alive and kicking

The new RFCs for SMTP (RFC 5321) and Internet Message Format (RFC 5322) where released yesterday.

You can find a list of changes in the MailChannels blog.

The most user-visible change is that port 587 is finally recommended for end-users, reserving 25 for MTA-to-MTA traffic. Also, use of SMTP for end-user clients is discouraged, pointing them to the Message Submission for Mail (RFC 4409) protocol.

For server operators, a lot of blessings to current behaviors:

  • you can now legally reject an email after the DATA is complete: yes, most anti-virus/anti-spam appliances already did that, but it was not legal;
  • timeouts are legal too.

It seems a pretty decent upgrade.

October 02, 2008

Helping my friends...

... get a good laugh at my expense. The next PerlMongers meeting I attend will be a lot of fun.

if you search for my name in the 2001 Google index, the first hit is a patch for the PHP build system.

Talk about the past coming back to haunt you.