Category Archives: Software

VirtualBox rocks

I’ve just tried VirtualBox and it simply rocks. I was using VMWare Player and got sick the lack of features. Yes, there’s VMWare Server, but it lacks desktop friendliness. VirtualBox provides the best of both worlds.

(For those not familiar, VirtualBox is a virtualization software: it allows you to create virtual machines, so you can, for example, run Ubuntu inside Windows as a “normal” program, or run Windows inside Ubuntu, or whatever.)

Its “Seamless mode” is very nice: it allows you to treat windows in the guest OS like they were windows in your host OS. (VMWare Player has a “Unity mode” which should do the same thing, but I couldn’t get it to work).

Screenshot of VirtualBox running with the seamless mode with Windows XP as host and Ubuntu as guest

It’s incredibly easy to use, allows you to create your own virtual machines, easily install “Guest Addition” (the equivalent of VMWare Tools, which is a pain to install), mount iso images, use USB drives, etc.

The only downsides I could notice so far is that it’s very slow to suspend/resume and its seamless mode is not that seamless: for example, if you maximize a window after entering seamless mode, the growth area will be invisible; you have to maximize it prior to changing to seamless. Also, Alt+Tab is not “seamless”; it would be so nice if you could switch between host and guest applications with it! It would be probably hard to implement, though…

Sandbox Wordpress theme for 2.7 with threaded comments

The Sandbox Wordpress theme is a nice bare bones theme which can be easily used as a base to your own themes (preferably with a style.css file only, following the zen). The only problem is that its development is kinda frozen and it does not support new Wordpress 2.7 features like threaded and paged comments.

There are already some hacks to support them but I decided to take another approach. Since the comment loop was changed drastically, those hacks had to… well, hack away in order to keep backward compatibility with Sandbox-based themes. Instead, I decided to embrace the new comment loop in WP (which is simple and doesn’t allow much customization without resorting to the hackish callback, but it generates code very close to what Sandbox does).

If you like the idea, feel free to download my customization (just overwrite the comments.php and header.php in Sandbox). You’ll probably have to tweak your previous themes a little, though.

Tip: if you want do get rid of the “says:” in the comments (e.g. “Alice says:”), put this in your stylesheet:

.says { display: none; }

If you want to change the avatar size, change the following line in comments.php

<?php wp_list_comments(); ?>

to

<?php wp_list_comments('avatar_size=40'); ?>

(change 40 to whichever size you want)

…and I’ve not activated it in this blog for now, since it barely gets comments. Sorry, no live preview :)

Quivi for Linux released

I’ve just released the Linux version of Quivi:

Quivi is an image viewer (specialized for comic/manga reading) for Windows which supports many file formats and compressed (zip, rar) files. It is aimed for fast & easy file browsing with keyboard or mouse.

It was working on Linux for a while, but now it’s “official”. I’ve released a .deb package which was tested on Ubuntu and may work on Debian. There’s also, of course, the source code, which requires some dependencies to be installed. You can grab both at the download page.

Help on packaging is much welcome, since I don’t have any experience releasing stuff for Linux. And please tell me if there is anything wrong with the release.

Prevenindo vírus por pen drives USB no Windows

Inevitavelmente, todas as vezes em que vou imprimir alguma coisa em algum xerox da vida, o meu pen drive volta infectado com algum vírus. Normalmente dá para notar pelo surgimento de um arquivo autorun.inf e uma pasta chamada RECYCLED (que finge ser uma pasta da lixeira) com o vírus dentro (você só vai enxergá-los que você configurar o Windows para exibir arquivos ocultos).

Até aí não há tanto problema. Um vírus não faz nada a não ser que ele seja executado. É só apagar esses arquivos e seguir com a vida.

O problema está no grande “recurso” chamado AutoRun (executar automaticamente). Você já deve ter presenciado ele com CD/DVD-ROMs. Você coloca o CD no drive, e logo depois o programa contido nele começa a executar automaticamente. Prático. Mas perigoso!

Felizmente esse recurso é desativado por padrão para drives removíveis (entre eles pen drives) e eu achava que não precisava me preocupar com os vírus de pen drives. Mas se você for um pouco paranóico, pode desativar o AutoRun para tudo.

…mas isso não resolve todo o problema. O que poucos sabem é que existem dois “tipos” de AutoRun. O primeiro é este, que roda o programa quando a mídia é inserida, e que por padrão é desativado em pen drives. Mas o outro tipo é o que roda o programa quando se dá duplo-clique no drive. E esse é jeito como 99% das pessoas fazem para ver seus arquivos!

Para desativar esse segundo tipo (na verdade, desativar o AutoRun completamente) você pode usar a gambiarra descrita neste post (em inglês). Mas alguém já tornou o procedimento mais prático: e só baixar o AutoRunGuard, descompactá-lo, e dar duplo clique no arquivo DisableAutorunINF.reg.

Agora sim, você estará 100% protegido dos vírus de pen drive (a não ser que você vá lá e dê duplo-clique no vírus, aí você merece ser infectado…)

Vale lembrar que com o AutoRun desativado, os seus CD/DVD-ROMs obviamente não executarão automaticamente. É só abri-los e procurar o executável (geralmente setup.exe, se for algum CD de instalação) e abri-lo.

Agora fica a reflexão: evidentemente o AutoRun é algo extremamente perigoso e realmente não devia existir. Mas é uma escolha entre segurança e facilidade de uso, e a Microsoft geralmente prefere o segundo, o que basicamente resume todo o amor/ódio com o Windows. É fácil achar que a Microsoft é estúpida e deveria tirar o AutoRun do Windows, mas o que fazer com os milhões de usuários leigos que repentinamente verão que seus CD-ROMs pararem de funcionar?

Quivi 1.0 released

I’ve just released the new version of my image viewer and manga / comic reader, Quivi (only for Windows right now, but it will be ported to Linux and maybe to Mac). I’ve rewritten it from scratch, check my last post for more info.

The new features added were:

  • Prefetching of the next image
  • Wallpaper dialog
  • Start directory option

But that is only the beginning; now it will be much more easy for me to work on Quivi.

There are many comic readers around; like CDisplay (outdated, but very popular), Comical and Comix. They have much more features than Quivi, and I must admit that I often thought on giving up on Quivi. But I just couldn’t.

I wrote it mainly for myself; when I started there was only CDisplay. The first version was written with Visual Basic (go on, laugh). Then I changed to C++. And now I changed to Python, and I hope this is the last language change :) It’s a hobby project that I grew to love. It suits my needs, but I’d really like to suit the needs of other people too!

It is scary when you realize that people are using your software. I feel responsible; wherever I find someone criticizing it, I feel guilty for not attending those people needs. Yes, that’s stupid, but it’s how I am. At the same time, though, it’s awesome to know that there are people who like it and find it useful.

If you have any suggestion, comment, complain about Quivi, please send it to me!

Porque eu reescrevi o Quivi do zero

Joel Spolsky, programador conhecido, disse em seu blog:

(…) Eles [da Netscape] fizeram isso tomando a pior decisão estratégica que uma compania de software pode fazer:

Eles decidiram reescrever o código do zero.

Em concordo, a princípio. Muitos projetos anunciam que foram “reescritos do zero” como se isso fosse algo maravilhoso, e na maioria das vezes, é só um sinal que a nova versão provavelmente tem mais bugs que a anterior.

Mas peraí, eu acabei de reescrever o Quivi (um visualizador de imagens e leitor de HQ’s / mangás) do zero! Por quê, então?

Bom, pensei que seria necessário me justificar. Essas são as razões:

  • É um projeto pequeno. Reescrevê-lo com certeza não é tão difícil quanto reescrever um navegador!
  • Eu não aguentava mais C++ (a linguagem de programação que eu utilizava). Claro, isso não é exatamente culpa do C++. Ele tem seus usos — a ferramente certa para o trabalho certo, e tudo o mais. Mas para escrever um programa de desktop? É canhão para matar formiga. Se você consegue (e gosta!) de fazer isso, eu admiro você. Mas eu não tinha mais motivação para trabalhar no Quivi.
  • Eu adoro Python (a linguagem de programação que eu uso agora), e claro,
    não sou o único. Programar é divertido em Python, tanto que eu tive a motivação de reescrever tudo, para começo de conversa! E claro, agora vai ser muito mais fácil para eu continuar trabalhando no Quivi.
  • Eu podia mudar de bibilioteca de interface. O SmartWin é uma boa bibilioteca, e use templates de formas interessantes; enquanto eu programava o Quivi eu acabei participando do desenvolvimento do SmartWin também. Mas ele tem os seus bugs, e justamente porque ele usa templates extensivamente, compilar um programa que o utilize é lento demais. Eu mudei para o wxPython, que é uma biblioteca de interface muito madura — e multi plataforma ainda por cima.

Claro, existem algumas desvantagens com a mudança. O pacote inteiro é muito maior devido às dependências (o instalador foi de 900K para 5MB!). E o programa é um pouco mais lento, principalmente na inicialização, e usa mais memória (9MB para 30MB com nenhum imagem aberta). Mas eu acredito que foi um bom compromisso.

Reescrever do zero deve ser estudado com cuidado, e neste caso, acredito que foi uma boa idéia. O Quivi é um hobby, e acho que o ponto principal é me divertir escrevendo ele, e atender às necessidades dos usuários. Espero que eu consiga fazer os dois com esta nova versão (que será lançada em breve).

Why I rewrote Quivi from scratch

Joel Spolsky, popular software engineering, said in this blog:

(…) They [Netscape] did it by making the single worst strategic mistake that any software company can make:

They decided to rewrite the code from scratch.

I agree, mostly. Many projects market that they’ve been “rewritten from scratch” as if it was something marvelous, and most of time, it’s just a sign that the new version probably has more bugs than the previous. But, wait, I just rewrote Quivi (a image viewer and comic / manga reader) from scratch! Well, why?

Well, I thought I really had to justify this. So here are the reasons:

  • It is a small project. Rewriting it certainly isn’t as hard as rewriting a browser!
  • I couldn’t stand C++ anymore (the programming language I used before). Of course, this isn’t C++ fault per se. It has its uses — the right tool for the right job, and so on. But to write an desktop application? It’s overkill. If you manage to pull it of, hey, kudos to you. But I had no motivation to work on it anymore.
  • I love Python (the programming language I use now), and of course, I’m not the only one. Programming is fun in Python, so much that had the motivation to rewrite Quivi from scratch in the first place! And of course, it will be much more easier for me to keep working on Quivi.
  • I could change GUI libraries. SmartWin is a nice library, and uses templates in very interesting ways; when programming Quivi I ended up involved with its development too. But it has its bugs, and because it uses templates extensively, it’s awful slow to compile an application that uses it. I’ve changed to wxPython, which is a very mature GUI library – and cross platform to boot.

Of course, there are some downsides with the change. The whole software package is much bigger due to the dependencies (the installer jumped from 900K to 5MB!). And the program is a little bit slower, mainly when starting up, and uses more memory (9MB to 30MB with no images loaded). But I think it was a good enough trade-off.

Rewriting from scratch must be considered carefully, and in this case, I think it was a good idea. Quivi is a hobby project, and I guess the main point of it is to have fun writing it, and to make users happy. I hope I can do both with this new version (which will be released soon).

“Access is denied” on “My Pictures” in Windows Vista

Just for the record, in case anyone gets stuck with this issue.

The “C:/Users/username/Documents” folder in Vista has three hidden junctions named “My Pictures”, “My Music” and “My Videos” which point to the folders “Pictures”, “Music” and “Video” inside the “C:/Users/username” folder. But they have the “List folder / read data” permission denied for all users as default. So any attempt to open them will result in a “Access denied” error.

It’s possible to “fix” this, but I don’t recommend it. Just open the pointed folders.

The question is, of course, why the permission is set, and why there are those hidden junctions in the first place?

I’m only guessing here, but it makes sense. The junctions are there for compatibility. If a program was written with a reference to a file inside the “(My Documents Folder)/My Pictures” path (assuming the “My Pictures” folder would always be inside the My Documents folder), it would break on Vista. With the junction, you can write to or read any files inside this (now non existent) folder.

(That is why there is also a junction “C:\Documents and Settings” pointing to “C:\Users”)

And why is the list folder permission denied? At first I thought it was there to prevent an infinite loop on programs who list the directory tree recursively, but those junctions don’t point to parent directories…

And the last question is, of course, why they changed those folders locations in the first place? Well, I must admit it’s much better this way (spaces inside paths are a pain).