miércoles 18 de noviembre de 2009

Computer graphics in Star Wars (1977)

This is a video documentary about how one scene in Episode IV was prepared, the scene in particular is when the rebel pilots were planning how to attack the Death Star. The Commander showed them an animation of the Death Star and where to fire.



Of course, this is 1976, no high end computer graphics cards exists yet, so Larry Cuba describe the steps in the 3D modeling based on photographs of the real miniature models. Check how he's controlling the rotation in real time (awesome) with big controls (no mouse neither exists).

The final touch was to render each scene, shot by shot, in the computer screen with and automatic camera capturing in film.

Via Topless Robot.

lunes 16 de noviembre de 2009

Updating nightmare

Before I must say, I have a laptop with dual boot, Mandriva in Dr. Jekyll and MS-Vista was Mr. Hyde. Yes, it was because two days ago I decided to update to the well recommended Win7. Few days ago I received a legal and nice DVD with the OS, the 64 bits version to upgrade Vista Home Premium. Then, I backup all my personal data.

My laptop is an Acer Aspire 5520, AMD Athlon 64 x2, 2 GB RAM, 160 GB HD, Nvidia 7000M, since I have it, I never touch the disc partitions, because the disc was already divided into 3, one part for the Acer recovery tools (3 GB), 70 GB for Vista, and the rest I used for Mandriva (from 2007 to now 2010 versions).

Everything works, well, of course Vista was slow and frustrating, I keep it because I share this computer and when I had time, I played games unsupported in Linux. After the bunnies convinced me to upgrade, I put the disc and upgrade to W7. Easy, after few clicks and 1 hr, W7 was installed. I rebooted the laptop, and waited for the final installation. I you are familiar with this installations you must knew that it takes time, so I was doing other stuff and just checking when it needs some clicks, that was my error, when the SO reboot, the Acer recovery mode entered and tried to restore Vista, blowing the whole hard disk!

Sadly, I tried to recover with a Mandriva One liveCD, everything was lost, but I was a backup for my data, no problem. So I modified the hard disk to remove the recovery partition and create a fresh installation for both SO. I tried to install W7, but my first mistake was not formatted the partition in NTFS mode, W7 said it cannot be installed in a FAT32 partition (wtf, just format it!), again, I use the liveCD, formatted this and installed W7. When it finished (another lost hour), it asked for the Product Key and cannot validate! I take a rest, watch a movie (Nicholas Cage's "Knowing") and came back with the solution, my disk was for a Vista UPGRADE, so I reinstalled Vista from my laptop original DVDs (another hour), then I use the W7 DVD and voila, it worked!

Finally I installed Mandriva 2009, upgraded to 2010, it was more simple than MS migration, and now both SO live together in my computer. I cannot believe people said that private SO are better than GNU SOs. BTW now I'm using KDE 4.3, let's see if it can convince me to leave Gnome.

What is my opinion with this new SOs?
  • W7 is better than Vista, of course if you only have worked with Vista you feel the difference, I'm not impressed because I know other SOs (Linux/Mac OS X). W7 is cute, little fast, and after one day using it, it works fine.
  • KDE/Mandriva 2010 is also pretty, faster and really usable.
Should I migrate Mac OS X Leopard to Snow Leopard now?

lunes 9 de noviembre de 2009

The history of computing (video)

The next is nice and educational video about computer history and the future, I like the analogies with biological systems.

Trillions from MAYAnMAYA on Vimeo.

martes 27 de octubre de 2009

Random lines in a text file

Sometimes I need to sample large data sets, so I randomly select some lines in the file. My files are generally text-records, one record by line, then I wrote this small script to do the task:

#!/usr/bin/perl -w
use strict;

=head1 NAME

selectRandomLines.pl

=head1 DESCRIPTION

Select random lines in a file.

=cut

$ARGV[2] or die "Usage: selectRandomLines.pl TOTAL_LINES_IN_FILE NUM_LINES_WANTED FILE_NAME\n";

my $total = shift @ARGV; # Total lines in the file
my $want = shift @ARGV; # Total lines to select
my $file = shift @ARGV; # The file
my $line = 0; # Line counter
my %select = randomSelect($total, $want); # Hash with selected lines

open FILE, "$file" or die "cannot open $file\n";
while (<FILE>) { print "$_" if (defined $select{$line++}); }
close FILE;

=head1 SUBROUTINES
randomSelect()
CALL: randomSelect(TOTAL_ELEMENTS, TOTAL_WANTED) [NUM, NUM]
RETURN: %s [HASH]
=cut
sub randomSelect {
my $t = shift @_;
my $n = shift @_;
my %s = ();
for (my $i = 0; $i < $n; $i++) {
my $v = int(rand $t);
(defined $s{$v}) ? $i-- : $s{$v}++;
}
return %s;
}

=head1 AUTHOR

JC @ 2009

=head1 LICENSE

This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with code. If not, see .

=cut

lunes 12 de octubre de 2009

Error in DBI::SQLite

I was coding to query a SQLite database using Perl::DBI, I have a small code like this:
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect("dbi:SQLite:dbname=db_file", "", "") or die "error in connection\n";
my $sth = $dbh->prepare($sql) or die "cannot prepare SQL\n";
$sth->execute();
while (my @data = $sth->fetchrow_array()) {
#process data
}
$sth->finish;
$dbh->disconnect;
But, every time I execute this script I obtain this warning:
closing dbh with active statement handles .... blah, blah, blah
I double checked the code, the documentation and ran some debug examples, I obtained the expected result, so why this message? Finally, I found the solution in the PerlMonks website, the problem is a bad status return in the module when you use close() method, so the simple solution is to "undef $sth" at the end:
$sth->finish;
undef $sth;
$dbh->disconnect;

jueves 8 de octubre de 2009

Reading the DNA

Current DNA sequencing technologies are based on sequencing-by-synthesis or similar technics, where enzymatic reactions add one or more nucleic bases marked. But IBM is working in another way to know the composition of a DNA sequence, using nanotechnology and electronics to "read" base by base. No enzymes means faster and cheaper process. We're closer to the $1,000 genome ...



Source: http://www.engadget.com/2009/10/08/ibms-ultra-cheap-dna-transistor-dream-could-lead-to-personalize/

viernes 25 de septiembre de 2009

R.O.B.O.T. Comics


From the author of Ph.D. Comics via WillowGarage.com