Category: programming

Map-Reduce, or why I hate software patents.

In the recent times you should be hearing a lot on map-reduce. I first heard of the term in last year Codebits. Although I wasn’t there, there was a talk with that title. I confess that knowing that map and reduce are common functional operators on different programming languages, I did not look to the talk abstract. During this year Yet Another Perl Workshop Europe, in Pisa, I saw a book on Hadoop, asked what it was about to a friend that wanted to buy it, and he said: a framework to implement Map-Reduce.
 
That made me think.. wait.. this should be the name of something different from what I though it was. Looking deeper I understood the concept. Googling, I found Google filled the patent request in 2004, and patented it in 2010. Found also that I used that construct in 2007, and documented it on my PhD thesis in 2008. Of course I did not call it Map-Reduce. In fact I did not call it anything fancy. It was just a way to get to results. Named it as my “divide and conquer approach”. And I did not heard of Google approach as well. I just got to it because I needed some results.
 
So, this is yet another reason why I hate software patents.

Text::BibTeX 0.40 Released

Normally I do not post on every perl module I release. And that is good, or you will be feeling spammed.

Why this module is different?

Because I adopted Text::BibTeX a long time ago, and had a lot of complaints about its installation mechanism. This was mainly due to the fact that Text::BibTeX depended on a C library that needed to be installed prior to the perl module. The C library installation was easy on generic Unix platforms but was a pain to compile under Windows.

After lot of work I managed to include the library C code in the Perl module (now Text::BibTeX has no dependencies on the library), and managed to include code to compile the library in Windows, using the Strawberry Perl distribution (that includes a mingw C compiler).

The package is needing heavy tests, but it seems usable for most users. Probably I will post on the details about its build system in a later post.

Pascal: parameters by reference

I posted some time ago about Pascal, and the nice (and worst) things that Pascal has in its language. I discovered yet another cool thing. Unlike C, where you can pass parameters to functions by value, or using a pointer (and therefore, as reference), in Pascal you can use a value, you can use a pointer, or declare a parameter as a variable. This is similar to passing by pointer, but with a cleaner syntax.

Note the difference between

  1. procedure foo(bar: integer);
  2.    begin
  3.        bar := 10;
  4.    end;

and

  1. procedure foo(var bar: integer);
  2.   begin
  3.      bar := 10;
  4.   end;

The first procedure does not change anything in the outside world, while the second changes the value of the variable passed as argument.

As expected, the compiler raises an error if you call this second procedure with a constant integer.

Pascal: The Good, the Bad and the Ugly

As I posted before, I am teaching Pascal. I could discuss the relevance on teaching this language in this decade, but that is not my concern. I would like just to point The Good, the Bad and the Ugly I find in Pascal.

The Good: Pascal evolved and is a high level language. You have auto-growing strings (ok, with a size limit), you have arrays indexed by characters, integers or enumerated data types. That is good!

The Bad: Pascal syntax continues to be a mess. Begin and End keywords make the code big, the attribution with ‘:=’ makes it easy to type errors, and the low precedence of logic operators make me angry.

The Ugly: I can’t find a clean way to try opening a file without crashing the application. The only method I found (check the bottom of http://www.learn-programming.za.net/programming_pascal_learn10.html needs you to turn on and off compiler flags. That is annoying, stupid and decidedly too low level…

Pascal is not dead

Probably you know that I was a teacher at the Computer Science Department at Universidade do Minho. There I was a C and Perl teacher, as well as other classes that are not relevant for this post. Now, I am working at Instituto Politécnico do Porto, in the Escola Superior de Estudos Industriais e de Gestão. I am not responsible for the class, so I teach what the responsible teacher says. I was quite surprised they still used Pascal.

But this was a stupid question. Now, after getting back to the Pascal world, I noticed Pascal is not dead, and it getting better, and quite far from C when regarding the abstraction layer. I will not discuss efficiency. It I would do that, I would not program Perl anymore.

Pascal is, like C, a compiled language. But it supports growing strings. Strings can be edited as if they were Perl strings. You can add substrings to the string, remove substrings by nothing or other smaller or bigger strings. But you can also use it as an array of characters and access to each character individually. I really miss this feature in Perl.

Pascal is now supporting units as classes. This means it can be programmed as if it were an Object Oriented language. I did not get to that point yet. But it is nice to know Pascal evolved.

Oh, there is a free compiler (free pascal compiler) and there is an IDE (lazarus) that enables GUI application development just like the old Delphi.

Quiki 0.01 released

quikiQuiki 0.01 was released last night. It can’t be considered a stable release. While it is usable (in fact Quiki homepage is hosted in Quiki) we know that a lot of details are missing to make it a real wiki system. The truth is that the Request Tracker queue created automatically for CPAN modules is only created for indexed modules, and beta versions (the versions we released before) are not indexed (or indexed in some different index) and therefore a RT queue is not created automatically. In fact at the moment the Quiki RT queue was not created yet, but we expect that to be done very soon.

I will not detail here what is the current development state as you can read it in the Quiki homepage. Positive comments, ideas of new features and requests for cooperation can be added here in comment while we do not have that RT queue.

Tags: , , ,

categories Perl, web

Dicionário-Aberto Restful API

In the last days I have been developing a Restful API for Dicionário Aberto. While Dicionário Aberto is a dictionary for the Portuguese language and therefore most users are Portuguese I prefer to describe the API here in English.

You can use a JSON or XML approach. URLs are the same. You can just change your ACCEPTS HTTP header to request xml or json documents, or you can add a .json and .xml in the URL as shown in the examples bellow.

To search for a specific entry, say cavalo, use http://dicionario-aberto.net/search/cavalo.xml or http://dicionario-aberto.net/search/cavalo.json

I know the json is not very readable, but it is being generated automatically from the XML. The XML is a subset of the TEI standard for dictionaries. Unfortunately this is not yet the final annotated version, but the main structure will not change.

If you would like to have a suggestions box, you can get ten words starting with a specific sequence of words. The next examples search for words starting with cav: http://dicionario-aberto.net/search/cav.xml?list=1 and http://dicionario-aberto.net/search/cav.json?list=1

If you use this API please give me some feedback on how I can make it better, or on what applications you develop so I can advertise them on Dicionário-Aberto main page.

Organizing books with Book Hunter

Jonas Nielsen twitted about Book Hunter, a Mac OS X application to organize your library. It is cool because you add the ISBN or title, ask it to autocomplete, and it fetches all the missing information from the Web. I did this to some of my technical books (not all, yet), and I discovered I have too much technical books…

Book Hunter

Quiki, yet another Perl wiki

quiki

At the present moment in my free time (that is going to be all day if I do not find a job in the next days) I am developing, together with Smash, another wiki in Perl,named Quiki.

Quiki is being developed with DokuWiki in mind. The main idea is to have a small base of dependencies, easy to install, and full of interesting features.

It is still in the first steps of development (as you can see in Git log, it is not yet two weeks old), but we expect to publish a beta version to CPAN in the next week.

Why we decided to implement a new system instead of using or contributing to one of the existing wiki projects can be a tricky question. I was involved in Kwiki development but the Ingy dot net crazyness does not help on stability. It is great to learn Perl, it is great to test different implementation approaches, it is not good to be used in production. Things change too often. twiki is a great wiki but we found it to be too complex for most wiki needs. MojoMojo might be a good wiki but we got tired installing dependencies. Moose, Catalyst and KinoSearch are just three examples of its dependencies. Unfortunately not all these modules (or dependencies) install cleanly. There is also socialtext. It is not properly open. Probably there are other wikis in Perl that we are not considering. But looking to the time involved writing current version and its achievements I am too happy.

If you want to be a test user, please download it from Git (check Quiki homepage) or wait for the CPAN release, install and submit bug reports. If you do not agree about my comments about wikis, you can leave a comment, but do not expect to raise a war. I will not answer you :)

Tags: , ,

categories Perl

YAPC::EU::2009

YAPC::EU::2009Next week will be held in Lisbon, Portugal, the tenth Yet Another Perl Conference Europe, also known as YAPC::EU::2009. This event was proposed by José Castro and myself, and is being organized by us with Magda Joana Silva.

Things are almost ready. T-Shirts were bought, proceedings are printed, badges are ready (not for late registered people, sorry), the place is rented, there is food ordered. I think everything is ready, missing some small details.

We have about 320 committed attendees. The problem is that we have just 320 tshirts, and just 300 proceedings books. If you are registering now, be advised that you might not have one tshirt or proceedings.

If you can not come and watch the talks by yourself wait for the videos. We will try to record most talks. They will be made available in the web some time later.

Tags:

categories Perl