↓ Arquivos ↓

Arquivo → April, 2009

Why so few developers are using Firebird SQL?

Recently I started a new project in which I need to choose another database besides MySQL. Since then, I had been using MySQL for basically everything, but given the MySQL licensing scheme and a few restrictions of the project itself, this time I had to use something else. So I choose Firebird SQL.

But there’s something about Firebird that always bothered me: why so few developers actually know and use Firebird? Basically (at least here in Brazil) I only see it being used among Delphi developers. Why isn’t it as popular as MySQL or PostgreSQL? Given its features (listed below), can we say that the project lives an unfair situation?

Firebird have several features which makes it a great choice:

  • Really free:: contraty to MySQL, you can use Firebird in your commercial applications without any fee or legal problem. (BTW: I know that PostgreSQL have this advantage too)
  • All the basic features of large RDBMS:: stored procedures, triggers, A.C.I.D. compliance, online backup, generators, referential integrity, etc…
  • Small footprint: had you seen its embeddable version? Just amazing: in less then 1 Mb you have all the features of the default one without cutting anything!
  • Low hardware requirements: basically, if something computes, it can run Firebird.
  • Available in all the major OS platforms: Linux, Windows, Mac OS, Solaris and others
  • Reasonable performance: Firebird performance remains between MySQL and PostgreSQL.
  • Really active project: despite its low popularity, it’s a quite active project. In april/2009, for example, was announced the 2.5 beta version of the project.
  • Databases with unlimited size: the database size limit is determined by the filesystem in which the database is stored. But, if your database exceed its limit its always possible to split it in several files.
    (the largest database known have 960 Gb link)
  • 100% SQL 92 compability
  • Connectivity: basically you can access a Firebird SQL through any programming language

My experience with Flamerobin is being really pleasant, but it’s really sad to see that since I wrote my Microsoft Access to Firebird database converter (MDB2FDB http://www.firebase.com.br/fb/downloads.php?categ=8) in 2006 that the Firebird popularity hadn’t changed at all!

Since I really like this software, and I think that its current popularity situation is unfair, maybe it could be interesting to list some actions that may help this project. So, here is my list:

Of course, I couldn’t finish this post without guessing (just guesses) the reasons why Firebird SQL is so unpopular if compared to MySQL or PostgreSQL:

  • There’s no big player like Sun/Oracle or IBM supporting it right now.
  • The official website is terrible (http://www.firebirdsql.org). Seems futile, but the first impression of the project is horrible. Makes you think it’s stalled.
    Firebird’s biggest sponsor today is IBPhoenix , which main business IS Firebird. But even it’s website falls in the same problem.
  • The fact of being Delphi related since it’s begning. With Delphi’s decadence, its popularity just floundered with it.
  • Poor documentation

Maybe things may change to Firebird SQL after Oracle bought Sun (many MySQL users are getting scared (I see no reason for this by the way)) and may play with Firebird, but it’s something improbable to happen. :)

Of course, these are just my opinions about it. I really whould like to know yours. Why do you think so few developers are using Firebird today?

Firebird SQL: por que tão impopular? (e como melhorar a situação)

Recentemente iniciei um novo projeto no qual  precisei responder a questão: qual SGBD usar? Até então, vinha usando o MySQL para basicamente tudo (fou fanático pelo MySQL), porém, devido ao seu esquema de licenciamento e algumas restrições do próprio projeto, tive de ignorá-lo desta vez.

Foi quando me lembrei de um velho conhecido: o Firebird! Devo confessar: depois do MySQL, o Firebird se encontra em segundo lugar (talvez empate com o PostgreSQL) para mim.

Porém algo no Firebird sempre me incomodou: basicamente ele só é popular entre programadores Delphi. Mais interessante ainda: provávelmente o Firebird é mais popular aqui no Brasil que no resto do mundo (temos uma comunidade excelente por sinal: http://www.firebase.com.br/fb/).  Isto é natural, visto ser derivado do Interbase da Borland, cujo Delphi dominou o mercado de desenvolvimento no Brasil por vários anos. Porém, ao observar as vantagens do Firebird, o mistério referente à sua baixa popularidade fora deste grupo só aumenta:

  • Licença realmente livre: ao contrário do MySQL que te prende no GPL se você o quiser utilizar gratuitamente, o Firebird é de fato 100% livre para uso em aplicações comerciais.
  • O básico dos SGBDs “grandes”: stored procedures, triggers, conformidade com A.C.I.D., backups online, generators, integridade referencial,  suporte a diversos tipos de caracteres… todas as buzzwords estão presentes no Firebird.
  • Footprint mínimo: o Firebird possui uma versão embutida (uma única DLL) que ocupa menos de 1 Mb e não corta básicamente NENHUM recurso da versão completa!
  • Baixos requisitos de hardware: o bichinho pode ser executado em práticamente qualquer computador!
  • Multi plataforma: Linux, Windows, Mac OS, Solaris e outras
  • Suporte a
  • Performance razoável: não é lá estas maravilhas, mas fica entre o PostgreSQL e o MySQL
  • O projeto é ativo (e muito): apesar de sua baixa popularidade, o projeto é bem ativo. Em abril deste ano, por exemplo, saiu o beta da versão 2.5 do projeto.
  • Banco de dados fácil de transportar: este ponto é polêmico, mas o fato do banco de dados estar contido em um único arquivo torna suas bases de dados muito fáceis de serem transportadas (é possível ter um banco de dados com mais de um arquivo).
  • BDs com tamanho ilimitado: a limitação do tamanho do BD é definida pelo sistema de arquivos utilizado pelo sistema operacional. Se o seu arquivo superar este limite, basta dividir o seu banco de dados em mais de um arquivo.
    (o maior banco de dados conhecido possui 960 Gb de tamanho link)
  • 100% compatível com o padrão SQL 92
  • Inúmeras formas de ser acessado: basicamente é possível acessar o Firebird a partir de qualquer linguagem de programação. Existem diversos drivers ODBC, JDBC, ADO, PHP, .net, etc.

Tenho utilizado o Flamerobin para administrar o banco de dados do projeto e está sendo uma experiência muito agradável. Mas é muito triste constatar que desde que escrevi o meu conversor de banco de dados no formato Microsoft Access para Firebird em 2006 (MDB2FDB http://www.firebase.com.br/fb/downloads.php?categ=8) a situação não mudou em nada: Firebird continua sendo popular apenas por desenvolvedores Delphi.

Dado que gosto do produto, e acho um absurdo o seu problema de popularidade, penso que seria interessante listar algumas formas de ajudar o projeto. Segue minha lista de sugestões:

  • Usar o Firebird. Sério: experimente o bichinho. Caso não o conheça, você ficará surpreso com o fato de uma imensidão de recursos caberem em um software tão pequeno.
  • Caso já use o Firebird, você pode também fazer doações ao projeto.
    Eis o link: http://www.firebirdsql.org/index.php?op=ffoundation&id=contributions
  • É também possível ser um patrocinador do mesmo.
    Eis o link: http://www.firebirdsql.org/index.php?op=ffoundation&id=sponsor_howto
  • Caso sinta falta de alguma ferramenta para trabalhar com o Firebird, você pode criar a sua e distribuir gratuitamente, como eu fiz com o MDB2FDB.
    Se não for para distribuir gratuitamente, o simples fato de produzir algo para o Firebird já ajuda a aumentar a sua popularidade.
  • Escrever a respeito, e participar de grupos de usuários.

Claro, eu não poderia deixar de imaginar quais as razões pelas quais o projeto não é tão popular quanto o MySQL ou PostgreSQL:

  • Não há uma empresa de peso como Sun/Oracle ou IBM apoiando o projeto. Ele é mantido basicamente por voluntários e alguns patrocinadores.
  • O site oficial (http://www.firebirdsql.org). Parece futilidade, porém a primeira impressão que o projeto passa é péssima!
    O maior patrocinador do projeto é a IBPhoenix: uma empresa cujo negócio é o Firebird. Porém, mesmo esta ainda possui um site com péssima aparência.
  • O fato de ter sido desde o início associado ao Delphi. Com a decadência da ferraemnta, a popularidade do banco também foi junto.
  • Documentação pobre: ao acessar a documentação pelo site, você encontra diversos links voltados para as versões anteriores à 2.0 do Firebird. Além de que, é bem desorganizada.

Porém, estas razões são apenas um chute. Gostaria de saber agora de vocês as suas opiniões a respeito deste SGBD.

Oracle/Sun explained in two pictures

No site da Sun

www.sun.com

No site da Oracle

www.oracle.com

Brasil quer macs!

Olá a todos. Se você é brasileiro e, como eu, também gosta dos produtos da Apple (especificamente os computadores), deve de também estar ultrajado com os novos preços adotados aqui no Brasil. Convenhamos: R$ 6700,00 pelo modelo básico do iMac é no mínimo um insulto. Será que a Apple pensa que nós brasileiros somos milionários?

Pensando nisto, acabo de lançar o movimento “Brasil quer macs!”. O objetivo consiste em coletar argumentos em prol de uma redução justa dos preços dos produtos Apple no mercado nacional. Se você quer consumir os produtos da Apple e também não consegue aceitar os preços atualmente impostos, junte-se a mim nesta empreitada!

Basta acessar o endereço http://www.itexto.net/brasilquermacs e nos fornecer sua presença e argumentos para convencer a empresa a reduzir seus preços aqui em território nacional.

How to restore corrupted MyISAM/InnoDB tables on MySQL 5.0

I know that it’s not our job to manage database servers. But if you don’t have a competent crew for that, you have to face the problem yourself.

Well, here is what happened to me this week. Waiting for the end of the day, in which the number of connections to our MySQL server is quite low, I started the creation of a new index on a huge MyISAM table (14 Gb), which is used to store the logs of our systems. While the index was being created, our “network administrator” received some complaints from our users that the systems were to slow. What was his solution? Shut down the server! In this process, logically our huge table was lost and, even worse, the MySQL server couldn’t be restarted at all!

Many of our InnoDB and MyISAM tables were corrupted because of this “little” mistake. So, after some hours of research I discovered a simple procedure that can restore all your data (or at least most of it). This procedure is composed of three steps:

1. Execute the myisamchk software inside your MySQL data directory. If you don’t know where this directory is, check the parameter datadir on your MySQL configuration file (my.ini on Windows, my.cfg on Linux/Unix).

You must use two parameters: –force and –verbose (which is optional) like bellow:

myisamchk --force --verbose */*.MYI

The –force parameter will instruct myisamchk to repair automatically every problem it may encounter on your MyISAM tables, while the –verbose (which is optional) will only show the status of execution of the myisamchk program on your screen.

2. Start the MySQL server with the parameter –innodb_force_recovery
Try to start your MySQL server with this parameter. The value must be a number between 1 and 6. As higher it’s value, worst are the problems on your MySQL tablespace.

Example:

mysqld --innodb_force_recovery=4

If you only got to start your MySQL server with a value bigger than four, your databases will be in read only mode. If not, your users may use the server normally.

If you wish, you may also add the command innodb_force_recovery to your MySQL configuration file as in the example bellow:


[mysqld]
innodb_force_recovery=4

3. After your MySQL server starts, backup your data and then restore them on a new MySQL installation.

Como recuperar uma base de dados InnoDB e MyISAM (MySQL) corrompida

Eu sei: não é nosso trabalho cuidar da manutenção de servidores de bancos de dados. Mas quando você não possui uma equipe competente para tal, esta “responsabilidade” acaba caindo sobre você.

Pois bem: vejam o que aconteceu comigo na semana passada. Esperando o final do dia, no qual o número de conexões ao MySQL é normalmente quase zero, resolvi criar um índice para uma tabela gigantesca de logs (14 Gb). Enquanto o índice era criado, alguns usuários reclamaram ao administrador de rede que o acesso às aplicações estava lento. Solução encontrada pelo administrador? Desligar o servidor do MySQL físicamente! (detalhe: quando ele desligou o servidor, a criação do índice ainda estava em execução!)

Obviamente, a tabela em questão foi perdida e, pior ainda: o servidor do MySQL simplesmente não pode mais ser iniciado. Por que? Por que as tabelas presentes no banco de dados, assim como os logs de transação e diversas outras informações fundamentais para a execução do banco de dados foram corrompidos. Acabei adotando o problema (sei que é loucura, mas era a solução) e, após algumas horas de pesquisa (e a empresa de 600 funcionários parada), encontrei uma solução tosca, mas que pode salvar uma base de dados MySQL corrompida.

No caso, a tabela na qual eu estava criando o índice era do tipo MyISAM, porém, como houve um desligamento incorreto do servidor, diversos outros arquivos foram corrompidos para o processo, incluindo as tabelas no formato InnoDB.

A solução adotada neste procedimento resolve o problema para arquivos no formato MyISAM e InnoDB apenas. Convém mencionar também que a versão usada do MySQL foi a 5.0. O procedimento de recuperação é composto por três passos:

1. Execute o programa myisamchk dentro do diretório que contém a estrutura de bancos de dados do MySQL. Se não souber aonde este diretório se encontra, abra o seu arquivo my.ini (Windows) oy my.cnf (Linux e Unix em geral) e localize a instrução datadir.

Dentro deste diretório, execute o comando

myisamchk --force --verbose */*.MYI

O atributo –force obriga o aplicativo a reparar qualquer tipo de erros encontrados na estrutura da tabela, enquanto o –verbose simplesmente irá expor na tela o status da execução do aplicativo.

Só para lembrar, este aplicativo serve para reparar as suas tabelas do tipo MyISAM.

2. Inicie o servidor do mysql com o atributo –innodb_force_recovery=[algum valor]

Você deverá iniciar o seu servidor MySQL com o atributo –innodb_force_recovery com um valor de 1 a 6, sendo que quanto maior o valor, maior o nível de corrupção da sua base de dados. Se o valor estiver entre 1 e 4, o MySQL irá reparar todos os erros das suas tabelas e em seguida você poderá trabalhar na base de dados normalmente. Caso contrário, todas as bases de dados estarão disponíveis apenas para leitura. Execute o servidor passando este parâmetro até que este volte a ser inicializado.

(aviso aos orelhas: se o seu servidor voltou a executar com o valor 2 ou 3, não é preciso executar o servidor com valores maiores)

Exemplo de execução:

mysqld --innodb_force_recovery=4

Se quiser, pode também incluir este atributo no arquivo de configuração do MySQL (my.ini no Windows, my.cnf no Linux/Unix/etc). Para tal, basta incluir a instrução innodb_force_recovery=valor logo após a seção mysqld deste arquivo, tal como no exemplo abaixo:


[mysqld]
innodb_force_recovery=4

3. Faça backup da sua base de dados e, em seguida, faça o restore da mesma em uma nova instalação do MySQL.

Este terceiro passo pode parecer exagerado se você executou o comando innodb_force_recovery com valores menores ou iguais a 4, porém, como seguro morreu de velho, esta alternativa garante que na nova base de dados não haja informações corrompidas.

Another trap for developers: linguistic determinism

Ludwig Wittgenstein

RAD environments can suppress the symptoms of impotence through the illusion of power

The immortal argument “my programming language is better than yours”, which is actually a reminiscence of childhood “my toy is better than yours” always caught my attention. I can spend hours amusing myself with these talks. That’s when I ask myself: can a programming language mutilate your mind? Can a single programming language produce a stupid? I think it can. A lot!

At the philosophy course, I was really impressed by the concept of linguistic determinism, which is the idea that the language shapes thought. Some philosophers go beyond that: Wittgenstein for example used to say (and I fully agree) that the limits of the world are actually the limits of the language. It’s a valid point of view: you only know something when you actually can describe it.

And where does our language comes from? Well, it’s actually the result of our environment (or is it something intrinsic?). The environment shapes our language. Here is a banal example: someone which lives in the arctic can identify several kinds of white, which will be reflected in it’s own vocabulary. I can only perceive one kind of white (I’m from Brazil), because white is not a common color in our environment. But I can perceive several types of bananas that a foreigner can’t perceive at first sight.

Edsger W. Dijkstra

This reminds me a Dijkstra quote: “the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery.“. In this case, this quote comes from the lecture “The threats to Computer Science”, which subject was the way how computer science courses were being taught at the time. Curiously, some people use to say the same about Java.

So the question is: can a programming language “mutilate the mind beyond recovery”? In my opinion, yes it can. Actually, I saw many cases of developers which can create amazing things in Delphi or Visual Basic (6) but every time they try to learn a new programming language fails miserably. They actually try to learn some other languages, but they usually think that it’s more safe to keep with what they already know then to try something new.

Something very similar I can see in Java too. Given the success of this language in several environments, many times the developer get used to it and never more ought to learn any other thing. The justification is always the same: “if I already know Java so well, why would I learn other languages or environment?”. In the case of Visual Basic (I’m always referring here to Visual Basic 6), this deficit is clearer: after wall, it’s considered by Microsoft as a deprecated language. In this sense, those who use to develop using VB6 have a huge advantage compared to those which are used to Java. The levels of arrogance are considerably lower, so the need to learn something new soars in this case. The problem is that in both cases they are only taking into consideration the fear to became technologically obsolete. The real problem is not obsolesce: it’s the linguistic determinism.

Which makes me think of the real role of the developer: reproduce computationally the solution of a given problem. Well, given that the perception of our world may be influenced by our language, and programming languages are actually shaping our view of the development process, our perception of it will be reduced if we only know one (or two) programming language.

Ignoring other programming languages imply in ignoring the main cause why programming languages are created: solve problems that can’t be easily solved by the languages present at the time of it’s inception. Are those general purpose languages? Yes, absolutely. So, shouldn’t these languages provide a wide view of the development process? Sure, but the world changes all the time. New problems arise while others are overpassed. If not, so we would have only a few programming languages today. This is why the argument “all the languages are basically the same, the only difference is the syntax” is so stupid.

Personally, I don’t know if it’s a good thing to know only languages based on managed code like Java or C#. That’s because they don’t show to the developer the inner workings of how a computer works. I don’t think also that you may be an expert in assembler too. But at least the basics of it you should know. Maybe at least C.

By the way, the formula “knowing only one x is not a good thing” where x equals programming language, programming paradigm, development environment or operating system is always true, because, as I mentioned earlier, you are actually limiting your perception of the world. As many things you know, as many dots you have to connect. And as many dots you have to connect, better will be your solutions.

And this is why I don’t like RAD environments at all. I think they are great for our productivity, but if someone starts it’s professional life through one of these tools, it will be really hard to get out of it when needed. As I mentioned I saw many cases of VB6 developers which had really bad times trying to learn other languages like Java or C#. In this case, not because VB6 or Delphi sucks, but because those environments usually create the illusion that software development is easy.

PS:
By the way, if you only know one language/environment, it’ll always be hard to learn anything which is different from it. (so it’s not a Delphi or VB6 exclusivity)

Developer types: Mr. Sucker


This week for the first time I blocked someone on msn. Actually, I blocked this person because he were what I use to call the “developer sucker”. Here is how our conversations get started.

It’s usual for me to help other developers (and be helped) by IM. Actually, I just love to help and get in touch with other developers, because it’s a really rich experience (at least for me). So here is how this sad experience get started.

I use to screencast some developer courses for DevMedia, so this person (let us call him Mr. Sucker) appeared on my Msn with the following question:

Mr Sucker: Could you please send me all your videos that you post at DevMedia?

So, after I explained him that these courses were actually DevMedia’s property, here is what I heard:

Mr. Sucker: But you made those videos. So they’re yours! And they are too expensive too: US$ 0.75 each!

Well, here I started to get pissed. So I just thought that the best thing to do was to just ignore this part. Well, some days later, Mr Sucker appeared again with this message:

Mr. Sucker: How can I install Grails on Linux?

Not even a “good day”, “how are you?”, nothing. Just a question. So I explained to him, and in this week, this guy just asked me several times the same question. And I always sent to him the same links over and over again.

So, suddenly he just changed his question and told me that he was going to talk about Grails on Fisl 10, which was a shock for me. After all, how could he do that if he doesn’t even know how to install it??? So I asked him how could he do that without knowing anything about the subject. Here is his answer:

Mr. Sucker: I believe that in one week I can do that.

My answer, of course was: you WHAT???

Well, again I just ignored him (after all, since I don’t know him in person, maybe he could be a genius or something like that), and few hours later, another question appeared:

Mr. Sucker: Kico, could you please explain to me how Git works in detail? I want to use GitHub.

As a answer, I sent to him the GitHub guide link(which is excelent). And here is what I heard:

Mr Sucker: Explain to me how Git works in detail! I want to use GitHub.

I always sent the same answer. Actually, this cycle only stopped when I asked him why he was asking me the same question over and over again. Here is his answer:

Mr Sucker: I don’t wanna read. I don’t know english very well.

So I sent to him some links in portuguese, and to my shock, here is what he said:

Mr Sucker: Actually, I don’t like to read. I like to watch videos or by msn only. Please, could you help me or not?

And my answer was: you’re blocked. What really amazed me was the fact that Mr Sucker actually personified several of the traps I mentioned some posts ago in a single week. This kind of situation horrified me when I thought about the fact that there are thousands of these “programmers” around the world, actually employed and producing “something”. I mean: how someone so illiterate can get a job?

PS:
Mr Sucker is not going to read this post. It’s not a video and it’s not in portuguese.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes