Monday, August 23, 2010

Ubuntu no VirtualBox sob Windows


Se você quer rodar o Ubuntu numa Virtual Machine (aqui, VirtualBox) instalada no Windows, e compilar o kernel, esta é a fórmula perfeita.
Isso é bom pra você se acostumar com um SO novo, fazer suas experiências malucas de compilação de kernel - sem medo de danificar logicamente, pois é só um SO virtual (que redundante, não?).
Infelizmente estou sem espaço no meu disco a ponto de criar uma partição, então essa foi a melhor saída que encontrei, além disso, me possibilita rodar os dois SOs ao mesmo tempo e ficar me divertindo, até que eu migre para o Linux.

Passos para compilar o kernel linux-2.6.35.3.tar.bz2 dentro do Ubuntu (ubuntu-10.04.1-desktop-i386.iso) com VirtualBox 3.2.8 rodando no Windows como host (VM).
  1. Baixe o VirtualBox e instale (http://www.virtualbox.org/wiki/Downloads);
  2. Baixe a imagem do Ubuntu (ISO) (http://www.ubuntu.com/desktop/get-ubuntu/download);
  3. Baixe o kernel do Linux e salve em uma pasta qualquer (http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.3.tar.bz2);
  4. Instale o VirtualBox;
  5. No VirtualBox, crie um novo sistema operacional, escolhendo tamanho de partição, entre outras opções. Neste exemplo usou-se o Ubuntu como target e o Windows como host. Isto é, o Windows emulará o Ubuntu, o qual compilará o kernel;
  6. Carregue a ISO do Ubuntu na tela que se abrirá no VirtualBox, após este ter sido instalado corretamente;
  7. O Ubuntu será automaticamente carregado. Instale-o na partição criada pelo VirtualBox - não se preocupe com a formatação, já que a partição criada pelo VirtualBox é virtual e não afetará seu sistema;
  8. Terminada a instalação e iniciado o Ubuntu, no VirtualBox, compartilhe a pasta na qual o kernel do Linux se encontra (Dispositivos > Pastas Compartilhadas);
  9. Clique em Dispositivos > Instalar Adicionais para Convidado. Isto criará uma pasta no Ubuntu, que estará rodando (após a instalação ter sido concluída);
  10. Como root, execute o arquivo .run correspondente ao tipo de arquitetura da máquina (e.g. sudo ./VBoxLinuxAdditions-x86.run);
  11. Ainda como root, crie uma pasta onde você deseja que a pasta compartilhada apareça (e.g. sudo mkdir /media/windows), já que estou rodando o VirtualBox no Windows (host) e desejo compartilhá-la com o Ubuntu;
  12. Faça o mount passando o nome do link que foi feito pelo VirtualBox (e.g. sudo mount -t vboxsf WindowsDesktop /media/windows). No meu caso, no passo 7 chamei de WindowsDesktop o caminho da pasta que desejo compartilhar;
  13. Após isso, você poderá ver o conteúdo da pasta do Windows, pelo Ubuntu. Isso porque o kernel está nesta pasta. Portanto, copie o kernel (linux-2.6.35.3.tar.bz) desta pasta para o local desejado no Ubuntu;
  14. Descompacte o kernel em /usr/src (e.g. tar xjvf linux-2.6.35.3.tar.bz2 -C/usr/src);
  15. Copie o arquivo config (e.g. config-2.6.32-24-generic) da pasta /boot para a pasta onde o conteúdo do pacote foi extraído (cp /boot/config-2.6.32-24-generic /usr/src/linux-2.6.35.3/);
  16. Baixe e instale a biblioteca ncurses com o comando: sudo apt-get install libncurses5-dev - ela é necessária para o próximo comando;
  17. Digite 'make menuconfig' para abrir o menu de escolha do que será agregado ao kernel a ser compilado;
  18. Configure o kernel do seu gosto;
  19. Digite 'make' para gerar o novo kernel;
  20. Digite 'make modules' para compilar os módulos do kernel.

Wednesday, July 14, 2010

Previous Demo Enhanced

This is an enhanced version of the previous example.

You can still use the arrows to control the plane and also use the left mouse to zoom in, and change between cameras using keys 1, 2, 3 and 4.

Again, AS3 and Papervision3D is surprising me.

Thursday, July 8, 2010

Papervision3D + AS3

Hi!

These days I started reading a book called Papervision3D Essentials - which I highly recommend.

In this book there are several examples on Papervision3D usage. Basically, Papervision3D is a set of libraries (API) which can be used to performing 3D manipulations in Flash, an extension of its 2D ordinary capabilities.

After reading some chapters, I, who hasn't any previous knowledge in ActionScript programming, was able to create a nice simple demo, which I posted here you check it out by yourself and take the appropriate conclusions of some of the capabilities of Papervision3D and ActionScript 3.

To control the paper plane use the keyboard arrows (Up, Down, Left, Right).

Have fun!

Friday, June 18, 2010

Back to basics

This is neither a computer science post nor a science post in my point of view, but rather a call of attention on a very important topic: When will we revise the basic principles of behavior based on how nature works? That may sound strange at first glance but I'll try to explain what I mean with that on the next lines dropped right below.

Undoubtedly we have grown and we have been growing for more than a million years, our brain has developed, we started to create things according to our needs, and here we are, on the Internet and with other many technologies, believing that we are on a ascending chart (and maybe we are). Certainly you have already questioned yourself about it, hadn't you?

The thing is: the more we talk about technology, money or whatever creations we did, we seem to forget more about how we care about the other, before you get into the wrong conclusion, let me exemplify that: Do you know when someone calls in you the middle of a task and then you say: "Wait, I'm almost there, I'll talk to you just after I finish"? This is a famous phrase, everybody uses that, but that become an horrible habit humans got. Why? Because our "task" is taking centuries, thousand years - the planet has called us, kindness has called us, unconditional love has called us, poverty has called us, violence has called us, but we seem to ignore them completely, not once, but on a daily basis, we just continue walking on our own pace. People are getting children, growing them as they did in the past, same concept base, same focus, to keep this habit of us alive. This may sound strange, but before you place a crucifying comment, I ask you to stop and think about that inertia we, as humans, have.

What worries me is that we have tremendous knowledge on many areas, but we neither revert back these knowledge, at first, to the areas which has called up our attention, nor consider them as top priority to create a consistent base for the future. We just go back to them in case they got something we need to continue our task, then we simple leave them alone again. Here you may argue saying that there are groups which are working exclusively to these areas, but they are few and their force is occluded by the biggest one, which is the one promoted by us. Besides that, these groups shouldn't be groups, these groups should exist in every single person, inside their mind.

I'm not saying that we should stop everything, as it may sound, but we should give equal importance to other questions rather than just focusing on the "BIRTH-WORK-DEATH" cycle. Remember, our coffins do not have a place to store all accumulated money we got, we neither can use it on afterlife.

If we go back to nature, we see it keeps its behavior for a long time - a dog will always swing its tail, even for a foreigner, and probably it did that for more than a thousand years. But we humans change a lot, and here it starts all questions: Do we follow this nature path? What has happened to us to become so selfish? Is this our nature?.
In one decade the trend is to be peaceful, while in another things are different. Why this happens?

My conclusion is that we create things to find our essence, in another words, our point of balance. We born unbalanced.

Tuesday, April 13, 2010

Histogram Mastering Tool

Today I created a tool to help me out training histogram recognition which has high chances of being a question among others on the exam for Vision and Image Processing discipline held by Prof. Roberto Hirata Jr. from IME-USP.

Screenshot:


Short description:

This tool randomizes histograms from various images and then let the user pick one which can be either a wrong or the right one - a score is used and will depend on the right number of answers versus the wrong ones for each different image loaded.

The software can be started in two different modes:

1. Using a default set (preset) of images which comes along with this application
2. Using a group of images chosen (browsed).

When the program starts it generates the histogram of all images and for each image displayed on the screen it associates a set of random histograms, but in this set only one is the right one, in another words, the one which corresponds to the image displayed.

If the wrong histogram is clicked, the histogram background color becomes red to indicate error and a point is subtracted from the score. Otherwise, the background becomes green and a new point is earned.

The number of false histograms can be defined by dragging the track bar below the last histogram of the set - this can be understood as the difficult level or something like that.

The software was developed with C# and AForge .NET, a great computer vision library developed by Andrew Kirillov.

Download steps:
  1. Download the .NET Framework 3.5 or higher if you do not have it;
  2. Download the Histogram Mastering Tool (HMT) application here;
  3. Unpack the content on a folder of your preference and start the executable inside.
Please post bugs under this section or send me an e-mail (profissional at gmail dot com)

Best regards,

Thursday, April 8, 2010

Proton spin simulation

These days I started the development of a 3D proton spin system which is influenced by external magnetic fields and radio-frequency pulses - this is useful for understanding the basics of NMR (Nuclear Magnetic Resonance).

I'm using C# with XNA - the models were created on 3dsMax 2010 but since they are very simple, any other program would do, including old versions of Max. Besides that a shader is used
and, of course, linear algebra to do the rotation and precession movements.

Here is one screen-shot (I expect to post others in future):


*I'm currently looking for tips on how to calculate the gyromagnetic ratio for all unpaired protons of all elements in the periodic table, so if you know how to do that send me an e-mail, you'll be welcome.