easy_install for Python 2.6 on Windows XP

Sometimes I am forced to use windows, and for some reason (although I can’t blame anyone not giving a crap) there is no easy_install for Python 2.6 on Windows.  So I followed these instructions from monkut on the Stack Overflow forum:

For installing setuptools for 2.6 download “ez_setup.py” from:

http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06

And run it [In the terminal, navigate to the folder where the ez_setup.py file downloaded to and type python ez_setup.py]. setuptools should be installed. This will place easy_install in your python26/Scripts directory, make sure this is in your PATH, and then you should be able to use easy_install.

This worked great. In order to add python26/Scripts to your Windows path:

  1. Right click on the ‘My Computer’ icon on your desktop and select ‘Properties’
  2. Select the ‘Advanced’ tab, and then select ‘Environment Variables’
  3. Under ‘System Variables’  select the variable ‘Path’ and click ‘Edit’
  4. At the end of the line in ‘Variable value:’ add a semicolon [;] and write ‘C:\python26\Scripts’
  5. Select ‘OK’  a couple times, restart terminal, and you should be able to type in ‘easy_install –help’ and receive a big ‘ol mess of help
Posted in Python | 1 Comment

Use touch to create empty files

I find myself needing this all the time, especially when I’m doing a tutorial on something nerdy.

Create an empty file in the current directory from the command line:

$ touch filename

Posted in Linux | Leave a comment

Portrait finishing in Gimp

I took some portraits of my co-workers in my DIY photography studio recently. I don’t have some essential equipment (like an external flash) so the shots were not as awesome as I knew they should be. Gimp to the rescue!

I found a brilliant tutorial on just this subject. Its written for Photoshop, but it translates to Gimp no prob. Here are the results:

rachel_original_cropped_600x400

rachel_913_cropped_600x400

angela_original_cropped_600x400

angela_858_cropped_600x400

heather_original_cropped_600x400

heather_846_cropped_600x400

Posted in Gimp | Leave a comment

Animated GIFs are the future

Its hard to be flashy on craigslist. Sure you can make your add one big image, but users need to cut and paste! So in the interest of usability and in the name of awesome, I give you the world’s sweetest animated GIF:

mm_32colors_600x300

That’s right, it just don’t stop. Ever. Not even if you want it to.

Process

This is the first animation I’ve ever done, so I really had no idea what I was getting myself into.  I mean, I don’t even draw things, really.  First I drew a story board of sorts in pencil on sketch paper and scanned it.  It was probably 15 frames at that point.  Then I imported the storyboard frames into Inkscape and drew over them using the bezier tool.

I decided early on that I would use a 2:1 aspect ratio, so the original frames were drawn in Inkscape at 800×600 pixels.  I also decided on a standard stroke width: 3.5px for thin lines (like outlines) and 10px for thick lines.

For color I used the “Tango icons” palette that comes default in Inkscape.  Its beautiful and it degraded well when I optimised the image down to 32 colors.

Screw it, I’m using Gimp

There were several options when it came to putting the animation together.  I tried the Gimp Animation Package but I just couldn’t figure it out.  Its really clunky and I lost patience.  Synfig looks promising, but I would have had to redraw all my storyboard frames, so no go.

In the end I went with good old Gimp.  I drew each frame in Inkscape and exported them as PNGs.  Because you can export just a selected area in Inkscape, I would have the whole scene laid out in one image, with all the frames right next to each other so I could easily reference where I was in the scene.

I imported the Inkscape-created PNGs as layers in Gimp (ctrl + alt + o).  I could check my work in Gimp with the the Playback filter (Filters -> Animation -> Playback…).

Gimp animates by displaying a layer for a set amount of time and then stacking the next layer on top of that layer for a set time, and so on.  The default framerate is 100ms per frame, which works pretty well.  If you want a frame to display for a longer time you can adjust the name of the layer like this:

Layername (1000ms)

That layer will be displayed for one second of your animation.

Finishing Work

Before saving your .xcf file as a .gif file, its important to optimize it for animation (Filters -> Animation -> Optimise (for GIF)). This ensures that new layers in the animation stack on top of the old layers (as opposed to replacing them), which makes the file much smaller (for some reason).

To turn a Gimp .xcf file into an animated .gif, you just have to save the image as, say “MyAnimation.gif” and choose the “Save as animation” and “Convert to inded using default settings” in the dialog that pops up.  I choose against interlacing because I liked my clean lines.

Setbacks

If I had to do it again, I would like some tweening.  Tweening fills in the gaps in your animation, so if you have a bird that flies across the screen, you only set the original place of the bird and the destination.  The computer generates all the frames in the middle so you don’t have to.  Would have saved me some time.

Unfortunately, tweening doesn’t help with articulation.  The most difficult part of the whole project was the 2 seconds at the very begining where the guys are walking down the stairs.  That took forever!  I completely understand now why 2D cartoons are often drawn in 3D programs (I think The Simpsons is done like that).  3D drawing programs like Blender allow you to place joints and muscles inside a character, so if you move a limb the skin conforms in a natural way.  Maybe next time.

Posted in Animation, Gimp, Inkscape | Leave a comment

My Current Local Developement Environment

Here’s my setup:

  • 13″ Macbook 2-1 with 4GB Ram and 2.16mhz Dual Core processor
  • 24″ Samsung HD flatscreen external monitor
  • Ubuntu Jaunty Jackalope 9.04
  • Firefox 3.x with Firebug, YSLow, and CodeBurner
  • XAMPP for PHP, MySQL, and Apache
  • VirtualBox with 4 virtual machines: Windows XP with IE 6, 7,  and 8, plus OSX running Safari
  • Gimp and Inkscape for graphics
  • Gedit with snippets enabled for code

I have to tell ya, I’m pretty happy with things right now.  Let today be known as the day I declared independence from OSX.

Posted in Developement Platform, Web Design | Leave a comment

VirtualBox on Ubuntu Jaunty for Testing Internet Explorer in Windows

I really loved using VMWare Fusion in OSX to test my webpages in Windows.  The power to just drag a whole Windows installation into the trash when it gets jacked up is intoxicating. Unfortunatly, Jaunty is still not supported by VMWare, and the bugs were just to much. Plus, I really didn’t like the web interface. Fortunately, I found VirtualBox which is at least as sleek as Fusion, but free!

To install VirtualBox, I got a lot of help from hopla on the Ubuntu Forum. I quote:

You need: virtualbox, qemu, wine

Code:

apt-get install virtualbox qemu wine

Download the free(!) Microsoft Internet Explorer Application Compatibility Check VPC Images here.

(Note: you don’t have to download the full pack, you can cherry pick specific combinations of XP/Vista and IE6-8)

Extract the VPC image(s) with wine (double-click).
(Note: it might take a while before the first window shows up)

Turn the VPC image(s) into (a) VMWare image(s) (which is/are readable by VirtualBox):

qemu-img convert -f vpc image.vhd -O vmdk image.vmdk

Setup a new VM in VirtualBox, using the vmdk image as an existing disk. Boot it, you will see the Windows boot progress bar and … it will BSOD shortly after.

Fixing the BSOD:

The BSOD is caused because the virtual Windows tries to load processor drivers for the wrong processor (it is not running on VirtualPC proc, but on VirtualBox proc). Or something like that…
We need to force Windows not to attempt to load drivers for the processor (it doesn’t need any proc drivers, because it’s all virtual anyway).
Start safe mode by (frantically) hitting F8 at Windows boot and choosing safe mode.

Ignore all the ‘New hardware’ detected warnings (we will deal with those later). Start a command box and run the following command to disable the loading of processor drivers:

Code:

sc config processor start= disabled

(note the space between ‘=’ and ‘disabled’!)

Restart the virtual Windows, it should now boot all the way to the Windows Desktop.

Once your virtual Windows has rebooted, go to Devices -> Install Guest Additions in the VirtualBox window.  This will mount a (virtual) CD with the Guest Additions software.  The autorun feature didn’t work every time, so if a new window doesn’t open up, find the Guest Additions CD in Windows Explorer and run the .exe.  This adds a lot of functionality to your virtual machine.

After rebooting the virtual machine, I followed the instructions from Primeval Soup:

In Windows, go to:

Start > Run > “cmd”

In the terminal, type:

D:\VBoxWindowsAdditions-x86.exe /extract /D=C:\Drivers

Start > Administrative Tools > Computer Management

Select Device Manager.

Select Batteries, Unknown Device -> Disable

Select Sound, video and game controllers, Multimedia Audio Controller -> Disable

Select Universal Serial Bus controllers, Universal Serial Bus (USB) Controller -> Disable

Select Network Adapters, Ethernet Controller -> Update Driver

Select Yes, now and every time, click Next

Select Install from a list or specific location, click Next

Enter location “C:\Drivers\x86\Network\AMD”

Click Finish

Open a browser, test connection

You’re done!

And that is a good feeling.

Posted in Linux, Software I use, Solutions, Tutorial, Ubuntu, VirtualBox | Leave a comment

lftp is awesome

I’ve been looking for a command line ftp utility that does tab completion and supports sftp. lftp is it! It comes pre-installed on Ubuntu 9.04 Jaunty.

change directory: cd

change local directory: lcd

list directory contents: ls

list local directory contents: !ls

print local working directory: lpwd

Put a file: put filename

Put multiple files: mput filename1 filename2

Get a file: get filename

Get multiple files: mget filename1 filename2

To login to a host with sftp:

lftp -u username sftp://username.server.com

To get a folder including all subfolders:

mirror filename

To put a whole folder and all its contents, without mirroring file permissions:

mirror -R -p filename

Posted in Linux, Solutions, Ubuntu | Leave a comment

External Monitor Resolution Fix for Ubuntu Jaunty

There is a lot of false information floating around the interweb about this one, but here’s how to get the right resolution on your external monitor when running Ubuntu Jaunty on a Macbook 2-1:

  1. Edit the xorg.conf file by typing the following into the terminal: sudo gedit /etc/X11/xorg.conf
  2. Edit that file to look like this:
    Section "Monitor"
        Identifier    "Configured Monitor"
    EndSection
    
    Section "Screen"
        Identifier    "Default Screen"
        Monitor        "Configured Monitor"
        Device        "Configured Video Device"
        SubSection "Display"
            Virtual    2048 2048
        EndSubSection
    EndSection
    
    Section "Device"
        Identifier    "Configured Video Device"
            Driver          "intel"
    EndSection
  3. Log out and log back in again.
  4. Open display preferences (System -> Preferences -> Display) and click on the rectangle that represents your external monitor. The Resolution pull down menu should now list the correct resolution.

And while you’re at it, you might as well turn off the screen on your laptop, since you’re not using it anyway.

Posted in Solutions, Ubuntu | 2 Comments

Ubuntu Jaunty headphone sound fix

I was getting no sound on my headphones or external speakers on my MacBook 2-1 until I found this post:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/201957

Follow these steps by Polera:

1. Right click on volume control.
2. Click ‘Open Volume Control’
3. Go to Edit –> Preferences
4. Check off ‘Surround Sound’
5. Close Preferences
6. Un-mute ‘Surround Sound’
7. Plug in headphones

Posted in Musings | Leave a comment

Dark PNGs in Safari

For whatever reason, sometimes the transparent parts of PNGs appear darker in Safari than in other browsers.  You can fix it by removing all the color correction metadata from the images with pngcrush:

pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB InputFile.png OutputFile.png

pngcrush is a command line tool that optimizes (read: makes smaller) PNG images. You can find out more about it on Wikipedia. I use it on OSX via MacPorts.

For normal PNG optimization, I actually prefer to use OptiPNG because it can optimize a whole directory of images with a simple command:

optipng ./*.png

OptiPNG overwrites the existing files with the new smaller files without any loss in quality. Good deal! Fast, easy, awesome. To bad it can’t remove that stupid color correction data though.

Posted in Solutions, Web Design | Leave a comment