Monday, October 25, 2010

Inappropriate ad in Youtube sends aubergine to my ceiling

Yesterday night my 19 months old daughter was watching Pocoyo in YouTube while having dinner. Pocoyo is a cartoon for very young kids; If you have a toddler at home try it! She will love it.

Anyway, she was watching it and eating her vegetables when, all of a sudden, it got interrupted by an ad with a few soldiers firing a machine gun from a helicopter. She screamed, cried and showed her dissatisfaction waving her hands and feet sending vegetables flying all over my living room. And yes, you guessed it right, some aubergine got stuck in my ceiling.

So please, Google:

1. Categorize all content in youtube: You can ask viewers to categorize it, you can categorize it according to keywords in descriptions and comments, you can employ a mechanical turk or a super advanced artificial intelligence. You are Google, you are supposed to know how to do it.

2. Categorize all ads: This should be easier than #1.

3. Make sure that ads are appropriate.

Monday, November 27, 2006

Java metaprogramming: the masses are ready.

defmacro smallHibernate(tableName, arrayFields) {
  class <%=tableName%> {
   <%for(int i=0;i<arrayFields.size();i++) { %>
    public <%=arrayFields.type%> <%=arrayFields.name%>;
   <%}%>
  }
}

smallHibernate {"Employee", new Field("String","Name"),new Field("int","Age")};

Generates:

class Employee{
  public String Name;
  public int Age;
}

Metaprogramming is the ability to write programs that, in turn write another programs. Metaprogramming is at the core of Lisp, that highly academic, largely ignored language. However, Lisp programmers feel somehow "superior" to others programmers. Writing Lisp is a really different experience than writing software in any other language. The Nature of Lisp is to leverage the language towards your problem; to write a Domain Specific Language on top of Lisp and then solve the problem. This has been known for a long time by some highly skilled programmers, and it has remained this way until now. Metaprogramming is no longer the realm of academics, hackers and gurus. Metaprogramming is for everyone today; you know what? You have been metaprogramming for quite a long time, and you have been using DSL's for a while too.

Have you used JSP, ASP or PHP? Then you know what metaprogramming is. Take a look at this code:

<html>
  <body>
   <?php echo "Hello World"; ?>
  </body>
</html>

You understood it? It's quite simple! Actually this is a piece of code that outputs a different piece of code. PHP code gets executed on the server, a piece of HTML code is generated and then sent to the client. Let's see another example, this time in ASP just to prove that even Microsofties can metaprogram :P

<html>
  <body>
   <% response.write("Hello World!") %>
  </body>
</html>

I'm sure you understood this one too; it's really easy. What I am trying to demonstrate here is that the idea of metaprogramming is simple and well known for all developers in the world. We all have written programs that generate code as an output before so, no mystery here, anyone can metaprogram.

Now I am going to demystify DSL's. You have used a number of DSL's before. Take a look at this:

SELECT * FROM employees WHERE age > 50;

It is really easy, isn't it? SQL is a Domain Specific Language, is a language that can only be used to query databases. You cannot write a 3D engine in SQL. You cannot write yet another ERP using SQL. SQL is good for querying databases and nothing else. However, SQL is so good at it, and querying databases is so common that we all know have learned it.

But this not the only DSL you know about,; in fact you are surrounded by DSL's. Have you used (N)Ant? Ant is a DSL for compiling projects. Again, you cannot use Ant to write any kind of program, but as build scripts are a common problem, we all learned Ant. Because it is really good to solve the problem it has been designed for; that's why we use it.

O.K. then, I have stated two main ideas so far:

* Every programmer in the world is now used to metaprogramming because of HTML generating languages as PHP or ASP.
* Every programmer in the world is now used to DSL's like SQL or (N)Ant.

Then, why is it so difficult? Why aren't you metaprogramming in your project right now? Well the answer is that most likely your favorite programming language does not support it. Even if it does, it forces you to use some kind of weird, difficult sublanguage like C++ Templates.

Historically, only difficult, academic languages usually oriented to functional programming like Lisp or Haskell have had good support for metaprogramming. This languages not only support metaprogramming, they support a whole range of other "difficult" things like first order functions and the like. Metaprogramming is entangled with a lot of others advanced characteristics and is not well understood by regular programmers.
And the syntax, too. Lisp syntaxs is horrible, with all those parenthesis.

But now Java is open source so everyone can fork. And the masses are ready. Ready for metaprogramming in a "real" (as in "non academic") language: Java. Did you understood the code at the beginning of the article? Did you find it useful? If both answers are positive, then I´m right: the masses are ready.

Tuesday, November 21, 2006

Is Java really Open Source?

Take at look at what Sun did with Java. They opened everything. Compiler, JDK, development environment... sounds good, doesn't it?

Well... I think they are just lying. They opened compiler v7. They opened JDK v6 and v7. But v5 is the current version and v4 is the most widespread incarnation. So they didn't risk anything, they got free propaganda but only opened future versions, not current versions.

Microsoft is engaged in .NET and Java could be at the beginning of its end. So they open their platform and try to add momentum and propaganda from the Open Source Community.
It's not fair. It's a trap.

Thursday, November 02, 2006

Should you omit a PhD in your resume?

Joel Spolsky wrote an interesting paragraph in his guerrilla guide to interviewing:

People who are Smart but don’t Get Things Done often have PhDs and work in big companies where nobody listens to them because they are completely impractical. They would rather mull over something academic about a problem rather than ship on time. These kind of people can be identified because they love to point out the theoretical similarity between two widely divergent concepts. For example, they will say, “Spreadsheets are really just a special case of programming language,” and then go off for a week and write a thrilling, brilliant whitepaper about the theoretical computational linguistic attributes of a spreadsheet as a programming language. Smart, but not useful. The other way to identify these people is that they have a tendency to show up at your office, coffee mug in hand, and try to start a long conversation about the relative merits of Java introspection vs. COM type libraries, on the day you are trying to ship a beta.

As a Ph.D. student, I find it a bit offensive. To be fair, he does not focus on PhD's but in attitudes, which is good, but the fact that a Ph.D. is a warning of "Being Smart but Don't Getting Things Done" makes me wonder if I should omit my academic side in my resume.
A couple of professors somehow involved with corporations outside Academia have told me to hide it. Specially while dealing with Spanish companies which are not interested in smart and ambitious people.

So this is my (sad) question: Should you omit a PhD in your resume and go to job interviews disguised as a rower?

Tuesday, October 31, 2006

Hello, World!

Hello, everyone. I am McPolu. I have been blogging for a year and a half in Barrapunto.com (the Spanish version of Slashdot) in Spanish, but now I feel like blogging in English so here I am, blogging in English.

My interests are: programming, concurrent and parallel computing, non conventional computing, biotechnology, molecular biology, politics, economy, discrete maths, Opera (the real, musical Opera, not the web browser) and who knows what else.

Will this blog last more than half a dozen posts? We'll see... life is the adventure of living.