Welcome
 

Firefox to support OGG in

Sunday, August 3rd, 2008 Write a comment


Open source browser Firefox is going to support Ogg Theora video natively without installing plugins and will support the new HTML 5 tag

This is great news since there has been a long debate about the HTML 5

The latest version of Opera browser also supports Ogg Theora videos natively already.

Popularity: unranked [?]

 

How to install latest Git on Ubuntu

Monday, March 10th, 2008 3 Comments

Git Logo

Git is a distributed version control system. I won’t go into much details of what Git is or why use Git instead of other VC systems. There’s plenty other sites where to check that information.

I love Git, but there’s a slight problem with Ubuntu’s repositories (feisty, gutsy): its an old version.

Git’s version on the repositories is 1.5.2.5. Its an old version and it lacks many of the new cool features like git stash and git citool and many others. So to get the latest version with all the cool features, you have to compile from source.

To do that, you will need the following packages:

First install the all the basic tools for compiling source:

sudo aptitude build-essential


sudo aptitude install libc6 libcurl3-gnutls libexpat1 zlib1g perl-modules liberror-perl libdigest-sha1-perl cpio openssh patch
gettext curl tk8.4 tcl8.4

Download the tarball from http://git.or.cz and uncompress it.

$ tar xvzf git*.tar.gz

Then, run the compilation steps and install:

$ ./configure
$ make
$ sudo make install

And there it is! Run the following to check your version.

$ git --version

The only thing that I still don’t know how to get is git command autocomplete on bash. If you install from repositories, then install from source, you’ll have it all.

Popularity: 7% [?]

Animate your webpage fast and easy with Facebook Animation Library

Thursday, January 17th, 2008 Write a Comment

Today Facebook released an animation javascript library that modifies CSS properties on the fly. You can download it and use it on your webpages.

Its a very light (10.4 Kb compressed version) animation library and its very easy to use. You can chain events or animations to create the effects you want. You can download it on the facebook developer’s resources page.

A typical effect used in websites is the flash effect to alert or notify of some action.

Here’s all you need to accomplish that:


<a href="#" onclick="Animation(this).to('background', '#fff').from('background', '#ffff4b').go(); return false;">Flash</a>

The syntax is easy. All you need to do is call Animation(this) on your element and then specify what CSS property you want to change on the .to and .from methods. In this case: go from yellow background to white background. The last .go() method tells Animation to run the specified animation.

You can also mix animations or transitions instead of playing one animation after another. For this you have to use .checkpoint() function and .duration() to specify how long the transition will take (in milliseconds). The checkpoints indicate when the second animation will start playing, allowing you to tweak the default behavior of playing one animation after the other one stopped.

So you can basically change anything: colors, widths, lengths, margins, positions, etc. For complete documentation of the library, go to the Facebook Developers Wiki. Its worth checking out.

Its a very simple syntax, with familiar terms (CSS properties) and very lightweight compared to using Prototype and Scriptaculous. Maybe Scriptaulous syntax for doing some animations is simpler or shorter, but you must load Prototype in order to use it, so that makes it heavier. Plus, you need to know the Scriptaculous effects functions and sometimes they are not that tweakable.

Its also nice to see Facebook releasing some open source code (BSD licensed) and contributing back.

Popularity: 17% [?]

PHP 5 OOP implementation quirks

Wednesday, November 14th, 2007 8 Comments

PHP 5 is supposed to be fully object oriented. Yes, it has classes and inheritance and all those things an OOP language is supposed to have. But, is it implemented like most OOP languages?

First of all, I come from a C/C++ background, so there’s where I got all my OOP lessons. Then I started to learn Python and Ruby, and well, finally lots of little OOP details I couldn’t understand were clear. Ruby has a beautiful OOP implementation, sometimes it can get confusing having everything as an object and the object and class themselves are objects. But once you pass that, everything is cystal clear.

What bothers me about PHP 5’s OOP implementation is first of all, constructors. If I declare a Parent class, with a constructor, then a Child class that inherits from Parent, and this Child class has its constructor, when I instantiate an object of the Child class, only the Child class constructor is called.


class Parent
{
__construct()
{
echo "hello from parent ";
}
}

class Child extends Parent
{
__construct()
{
echo "hello from child ";
}
}

dummy = new Child();

This will display only

hello from child

Where in other languages, such as C++, Python or Ruby (don’t know about Java, but I expect the same) the output would be:

hello from parent hello from child

So in order to have this constructor cascading effect, in PHP 5 I have to explicitly call the parent constructor on my child’s constructor like this:


class Child extends Parent
{
__construct()
{
echo "hello from child ";
parent::__construct();
}
}

Which is not very nice.

Another aspect that I dislike is the class attribute accessor methods. I call them accessors like in Ruby, but they are commonly called setter and getter methods. So in order to control and filter my input/output for my object, I usually do so with this methods.

If I declare a User class with some methods, I expect the setter and getter methods to filter my I/O everytime I want to access the class’ attributes.


class User
{
public $name;
public $email;
public $password;
//set and get functions
public function __get($variable)
{
return $this->$variable;
}
public function __set($var, $value)
{
trim($value);
if($var != "password")
{
$this->$var = $value;
}
else
{
$this->password = hash('md5',$value);
}
}
}

This is supposed to encrypt the password everytime I set something on my password object attribute. What is wrong with this? That it doesn’t work! The get and set functions only work when you have NO attributes or undefined attributes in the class. So in order for this getter and setter methods to really filter I/O to the instantiated objects is to not declare the attributes, and this methods will generate them, like the PHP people say, “magically”. Maybe its a nice flexibility feature to have attributes generated on-the-fly, but it doesn’t help on object consistency.

PHP 5 is a nice tool, but as a language I think there’s still work to do on the OOP implementation.

Popularity: 8% [?]

Como arreglar valores NULL en Ruby on Rails con Sqlite3

Wednesday, September 5th, 2007 2 Comments

Para quienes desarrollan en Ruby on Rails con Sqlite3 como base de
datos local, no se si les haya pasado pero un dia Sqlite3 comenzaba a
poner valores NULL por default a fuerzas, inclusive me toco que en una
ocasion mi schema.rb tuviera un

:default =>''''''''''''NULL'''''''''''''''

que claro no tiene ningun sentido. Las
migraciones estan bien, sin valores por default, entonces, que pasa?

Pues despues de buscar y buscar, por fin encontre la respuesta:
Sqlite3 despues de la version 3.3.7 cambio su formato interno y hacia
algun tipo de conflicto con la metadata.

Como lo arreglo? Facil! Primero, desinstala libsqlite3-ruby1.8 de tu
sistema (estoy suponiendo que como yo, usas (K)Ubuntu e instalaste el
paquete desde repositorios).

sudo aptitude purge libsqlite3-ruby1.8

Ahora solo instala la version actual de la gem para sqlite3

sudo gem install sqlite3-ruby

Listo, ahora elimina el archivo de base de datos que estabas
usando, y vuelvelo a crear con rake

rake db:migrate

Revisa tu schema.rb, debe estar limpio de valores default NULL que no
le indicaste en las migraciones.

Espero les sirva, para mi esto fue un grandisimo dolor de cabeza
muchos, muchos dias.

Popularity: 5% [?]

Nuevas adquisiciones para leer

Friday, July 13th, 2007 Write a Comment

Hoy tuve la oportunidad de ir a Barnes & Noble para ampliar mi biblioteca personal.

Me compre este libro

CSS Mastery
CSS Mastery, Advanced Web Standards Solutions.

Un libro de CSS bastante completo con browser bugs, browser hacks y varios casos de estudio.

Tambien queria actualizar y ampliar mas mis muy basicos conocimientos de javascript y encontre Learning Javascript.
Learning Javascript

Los estare leyendo y escribiendo aqui algunas cosas que me parezcan interesantes y al final vere si los recomiendo o no.

Hasta ahorita el primer libro me ha parecido bastante bueno.

Popularity: 2% [?]

Optimiza la concatenacion de strings en Ruby

Saturday, May 5th, 2007 Write a Comment

En este post realizan un test de rendimiento en las diferentes operaciones de concatenacion de strings en Ruby.

Conluye con que para concatenar dos variables tipo string, la mejor (y optima) manera de hacerlo es asi:
string1 = "Hola "
string2 = "Mundo"

string1 < < string2

Y el resultado es:

"Hola Mundo"

Y si necesitamos un valor dentro de un string, lo hagamos asi:

variable = "palabra en variable"
string_largo = "este es una #{variable} dentro de un string largo"

y el resultado es:

"este es una palabra en variable dentro de un string largo"

Se me hizo buena idea tenerlo como referencia aqui, porque luego se me olvidan los tips…

Popularity: 4% [?]

Next Page »