« July 2008 | Main | September 2008 »

August 29, 2008

Priceless

The guy who won $275.000 on the Google Android contest (english translation):

Asked what he would do with the cash, his response was “I guess I could invest it in my software company, but first I want to port PicSay to the iPhone.”

Priceless...

(via daring fireball)

Update: the PicSay author clarifies the whole story.

August 27, 2008

Pretty print XML

In case you didn't know, you can pretty print XML with the xmllint command line tool that comes with libxml2, and its installed by default with Mac OS X.

Basic usage is

xmllint --format xml_file.xml

and the pretty version will be sent to standard output.

But working with XMPP and SAPO Broker, I'm always copy&pasting XML from one place to the other and it would be nice to format the XML snippet sitting in the clipboard.

This pipe does the trick quite nicely:

pbpaste | xmllint --format - | pbcopy

I wrapped this into a script, called x-xml-format-clipboard and now its just one command away from gratification.

Next step, create a version that I can place in the services menu. I need to find a way to access the selected text on the current Cocoa app. I hope thats not to hard. Making the final script a service is definitively easy, using the ThisService app.

Ubiquity

Mozilla Labs Ubiquity looks very nice indeed.

I wonder how hard it would be to port it to a Fluid plugin?

(via Ajaxian)

August 25, 2008

$1000

The bounty for the first verifiable security problem found in djbdns increased from $500 to $1000.

I offer $1000 to the first person to publicly report a verifiable security hole in the latest version of djbdns.

For us Europeans, it stays the same actually.

August 22, 2008

CPAN::Mini::Webserver++

The CPAN::Mini::Webserver module is getting a lot of love in the last few weeks.

The most recent 0.40 version includes a lot of goodies including:

  • act as a true CPAN mirror so that you can point you cpan client to it;
  • syntax highlight of Perl code;
  • Bonjour registration: easy to find on a local lan;
  • shows which modules are installed locally;
  • A lot more meta information shown about each module.

Getting everything right is easy.

Installing CPAN::Mini

First, you need a CPAN::Mini mirror of the full CPAN. Right now it takes 862Mb of my disk.

Create a .minicpanrc in your $HOME directory with the following:

local: /Users/melo/Documents/cpan
remote: http://cpan.perl.pt/
also_mirror: authors/00whois.xml

Adjust the local and remote settings to a local directory where the mirror will be placed and the CPAN mirror you wish to use.

Then run minicpan. You can stick this in your own crontab, also . I run mine each morning at 10:20.

The first time will take a bit of time, but updates are very fast. Recent versions of CPAN::Mini use HTTP keep-alive, so I recommend that you use a HTTP-based mirror.

You can take the opportunity and update your cpan configuration to use this module. To do that, run the cpan client, and use o conf init /urllist/. Keep you current mirror and add the new local directory at the end of the list. Don't forget o conf commit to make your changes persistent.

My configuration looks like this:

cpan[1]> o conf urllist                                                                                                                                                                                      
    urllist           
       0 [http://cpan.perl.pt/]
       1 [file:///Users/melo/Documents/cpan/]

Having a HTTP mirror and your local mirror this way triggers an optimization in the cpan client. He will always keep the module indexes up-to-date using the external mirror, but for each module that he needs to install, the local mirror is tried first.

Installing CPAN::Mini::Webserver

Install tht CPAN::Mini::Webserver. You will also need to install the plugin HTTP::Server::Simple::Bonjour and a proper Net::Rendezvous::Publish::Backend module for your operating system (I use Net::Rendezvous::Publish::Backend::Apple).

Running CPAN::Mini::Webserver

You can now run minicpan_webserver and open http://localhost:2963/. You can change the port number with minicpan_webserver -p PORT.

You can also keep it running by sticking this on the inittab or if you use a Mac, use Lingon and create a "My Agents" entry to keep it running. I use the second option.

Bonjour workaround

On a last note, the Bonjour stuff doesn't work since 0.39. CPAN::Mini::Webserver is overriding the print_banner method that the Bonjour plugin uses. I've reported this as a bug.

There is no easy way out. Probably the best way is to add a new init_plugins hook to HTTP::Server::Simple that gets called before the print_banner and then change the Bonjour plugin to use that.

On my copy I patched CPAN::Mini::Webserver directly and commented the print_banner function. I prefer to have Bonjour than a prettier banner I never get to see anyway.

HTML5 and event loops

Interesting stuff: HTML5 gained a event loop this week.

I like event loops. I'm still reading the draft spec, but it seems very nice.

XMPP for carbon lovers

If you happen to be a dead-tree-addict, and interested in XMPP like me, then I'm happy to tell you that you will have a present next year.

Kevin, Peter and Remko are hard at work for O'Reilly to brings us the XMPP missing book.

Entitled "XMPP: The Definitive Guide", it should hit the shelfs in 2009.

Shameless offer: if you need technical reviewers, you know my JID :).

August 20, 2008

Framing protocols

I've been playing with framing protocols.

I need a protocol with:

  • low overhead: it will be used for mobile communications and some of us pay for each byte;
  • multiplex streams: you should be able to open channels inside the same TCP connection;
  • restartable: each session has an ID and I need to restart all of the channels inside it very quickly if my TCP connection dies.

I've looked at AMQP wire protocol, BLIP, BEEP and some others. I plan to look over SSH too.

I'm looking for further suggestions of protocols to reuse. Anyone?

Parallax

I've talked a bit about Freebase over the last few months. I understand that a rich, semantic, structured database of knowledge is not something other people get excited about, but that happens to be my thing.

In the hope to excite others with Freebase, I recommend that you spend 8 minutes watching the Parallax browser in action. That kind of research tool is only possible with something like Freebase on the bottom.

Update: the code for the Parallax browser is open source now.

August 11, 2008

Updated Search In Project with Ack

I've updated my own Search In Project with ack TextMate command.

Changes:

  • search in selected files is optional now: start your query with a : to search only in the selected files;
  • fixed search for words with a initial dash in them.

You can find the current version at GitHub or download the tmCommand file directly.

This is a very simple ack interface. For a more complex and feature-full, see the ack TextMate bundle by Trevor Squires.

August 08, 2008

This cannot be natural

Really, see this...

In her own words, this cannot be natural.

August 05, 2008

XML::LibXML braindead, or is it just me?

I spent the last 30 minutes chasing down this bug. The following tests should all pass but the last one doesn't:

use strict;
use warnings;
use Test::More 'no_plan';

use XML::LibXML;
use XML::LibXML::XPathContext;

my $parser = XML::LibXML->new;
ok($parser, 'XML::LibXML parser created');

my $xml = '<x:me xmlns:x="some_namespace" />';
my $xdoc = $parser->parse_string($xml);
ok($xdoc, 'Valid XML parsed');

$xdoc = XML::LibXML::XPathContext->new($xdoc);
ok($xdoc, 'Converted to XPathContext');

my ($node) = $xdoc->findnodes('/me');
ok(!$node, 'Not found because no prefix means NULL namespace');

($node) = $xdoc->findnodes('/x:me');
ok($node, 'Found because using document prefix');

$xdoc->registerNs( new => 'some_namespace' );
($node) = $xdoc->findnodes('/new:me');
ok($node, 'Found because using new specific prefix');

# Notice the change of namespace
my $uri = $xdoc->lookupNs('x');
is($uri, 'some_namespace', 'x prefix is some_namespace');
$xdoc->registerNs( x => 'other_namespace' );
$uri = $xdoc->lookupNs('x');
is($uri, 'some_namespace', 'x prefix is still some_namespace');

($node) = $xdoc->findnodes('/x:me');
ok(!$node, 'Not found because using document prefix was changed to diff namespace');

The basic problem is this: you get a XML document in which a namespace N is tied to a prefix P. I was expecting that if I set in my own parser prefix P to something else, that my local prefix P would take precedence over the document P. Apparently it does not.

Right now, what I did was this: before using XPath to match anything, I always used registerNs method of XML::LibXML::XPathContext to make sure I was getting the right elements. Now, I use this new function instead:

sub _safe_ns_register {
  my ($xpc, $prefix, $ns) = @_;

  while ($xpc->lookupNs($prefix)) {
    $prefix++;
  }
  $xpc->registerNs($prefix => $ns);

  return $prefix;
}

This function makes sure that the prefix I choose does not clash with any prefixes on the document. It returns the prefix I must use on my XPath expressions.

It solved my problem, but I still think that my local prefix should take precedence over the document one.

August 04, 2008

The DNS wars

The recent DNS bugs sent me reading the cr.yp.to site for old stories, long forgotten. djbdns is one of the DNS server softwares that was immune to this problem from the start.

Some pearls:

I still receive a diff of changes to the cr.yp.to site, almost 5 years running now, I wonder if anybody has an archive of them. It would be interesting to assemble all of those diffs into a repository to track back the changes.

August 01, 2008

STFU

So you have a friend who is going to spend some time traveling and that journey includes the United States. Usually you would buying him a travel guide.

But our times require something different. I recommend that you send your fiend the link to Professor James Duane talk entitled "Don't talk to the Police".

In a country where habeas corpus is no longer controlled by the court system, those 26 minutes could save your friend a lot of trouble (as confirmed in the follow up presentation by a police officer).

(via Schneier)

Back...

The latest weeks where a bit crazy but normality is returning.

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