29 de junio de 2011

How to share files with VirtualBox between Mac and Windows

Today I needed to setup a Windows XP virtual machine with Virtual Box at work. Doing that, I happened to need files from my computer to be accessible from the virtual machine with Windows XP.


How did I get that done? Well, I used the guide of this excellent post(which I borrow here :P ): link.


Here it goes:

I recently felt the need of changing my VMWare Fusion 2.0 Beta, because it kept on locking my Mac. I found VirtualBox, which is recently acquired by Sun, offered for free and has a recent release 1.6. I read some nice reviews, and although it lacks some features, looks like it’s quite fast and reliable (will review it when I get to use it more).
First thing I needed to do with VirtualBox, after setting up a Windows was to share files between my Mac (Leopard) and Windows (XP). VirtualBox does not offer drag and drop for now, but hopefully will do soon. To share files between 2 computers:

1. Install Guest Additions

Go to “Devices->Install Guest Additions”. After selecting this, open “My Computer”, and you will see there is Guest Additions installer mounted. Just double click and install. After installing, do not forget to reboot (that’s important).

2. Create a shared folder

Go to “Devices & Shared Folders”. Press “Add” (+ sign on right side). Browse for your shared folder on your mac. Pick up a good name and note it down (we will use the name later on). I suppose you selected a folder to share and named it “shared”.

3. Create a batch file

On Windows XP, shared folders are browsable. Easiest way to mount shared folders is to create a batch file, instead of writing a command each time you login. To do that, right click on Desktop, select “New->Text file”. Rename your text file to “Mount.bat” (or something else you wish). After renaming, right click on it and select “Edit” and paste the code below (with necessary modification, depending on your shared folder name. I assume it’s “shared” in our case)
net use x: \\vboxsvr\shared
Beware of the space in between “x:” and “\\” otherwise you will get;
System error 67 has occured
Which in my opinion a common mistake. Save the file and you are done. Just double click on “Mount.bat” on your desktop and you will see X: drive will appear with your shared folder on My Computer.
Enjoy :)

27 de junio de 2011

Muy buena película de Woody Allen: "Si la Cosa Funciona"(Whatever works) (2009)

Ayer vi esta película, como despedida de domingo, antes de irme a dormir.

"Whatever works", dirigida y escrita por Woody Allen. Me gustó mucho, así que la recomiendo vía blog post :)

Cuevana | Si la Cosa Funciona (2009)

Para arrancar la semana con un poco de Bécquer

Yo sueño que estoy aquídestas prisiones cargado, y soñé que en otro estado más lisonjero me vi. ¿Qué es la vida? Un frenesí. ¿Qué es la vida? Una ilusión, una sombra, una ficción, y el mayor bien es pequeño; que toda la vida es sueño, y los sueños, sueños son.

14 de junio de 2011

Installing psycopg2 inside a virtualenv in Mac OS X

If you tried to install psycopg2 inside a virtualenv in Mac OS X and got something like this:

(Env)MacBookPro:proj matias$ ARCHFLAGS="-arch i386 -arch x86_64" pip install --upgrade psycopg2
Downloading/unpacking psycopg2
  Downloading psycopg2-2.4.2.tar.gz (666Kb): 666Kb downloaded
  Running setup.py egg_info for package psycopg2
    Error: pg_config executable not found.
 
    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:
 
        python setup.py build_ext --pg-config /path/to/pg_config build ...
 
    or with the pg_config option in 'setup.cfg'.
    Complete output from command python setup.py egg_info:
    running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.


Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:


    python setup.py build_ext --pg-config /path/to/pg_config build ...


or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/matias/.pip/pip.log

The issue is that psycopg depends on pg_config command, and if you don't have it, you can't install psycopg.


That got it fixed for me:
export PATH=/Library/PostgreSQL/8.4/bin/:"$PATH"
Now, let's go again:



(Env)MacBookPro:proj matias$ ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2
Downloading/unpacking psycopg2
  Running setup.py egg_info for package psycopg2
    no previously-included directories found matching 'doc/src/_build'
Installing collected packages: psycopg2
 (....lot's of lines of output here....)
Successfully installed psycopg2
Cleaning up...
Done!

8 de junio de 2011

Estreno version mobile de mi blog!

Desde ahora, mi blog tiene activada la opción y los templates para poder ser visualizado en dispositivos móviles. Cuando me olvide de algún comando o algún truquito acerca del cual hice un post, voy a poder buscarlo desde el iPod :)


Buen miércoles, gente!

How to determine if you are running a 32 or 64 bit version of Python?

Just run the this in a Python shell:

import ctypes
print ctypes.sizeof(ctypes.c_voidp)*8

In my case, it goes this way:

MacBookPro:~ matias$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> print ctypes.sizeof(ctypes.c_voidp)*8
64
>>>

7 de junio de 2011

Super geek TCP/IP jokes

Overheard at the IRC channel, at work:

- A TCP packet walks into a bar and says "bartender, I want a beer!" "You want a beer?" "yes, a beer"
- The good thing with TCP jokes is that the other one always gets them
- The bad thing about UDP jokes is that you can't be sure that the other one got them
- A bunch of TCP packets go into a bar, until it’s overcrowded. The next day, half as many go in.
- The problem with TCP jokes is that people keep retelling them slower until you get them.