text 8 Sep Class instance variable vs Class variable vs Object variable in Ruby
class Foo 
   @a = 123	   # Class instance variable (1)
   @@a = 456   # Class variable (2)
   def foo 
         p @a     # => nil not 123 or 456  - Ordinary instance/object variable  (3)
   end 
end
  • (3) is an ordinary instance variable (which, not having been initialized, has a value of nil), it belongs to an instance of class Foo.
  • (2) is a ordinary class variable unique and accessible to all object instances of class Foo
  • (1) belongs to the class object Foo, which is an instance of Class class.

The last one (1) is quite strange for someone coming from languages like Java. A good rule of thumb to know to which object a variable is attached to is:

The first mention of an @-prefixed variable creates the instance variable in the current object, self.

Therefore, since everything is an object in Ruby, if you declare a @-variable when self is the class, the variable will be attached to it.




video 5 Sep

Your Lucky Day (by Dan)

Nice short film with a Tarantino feel. Watch it in HD.




link 5 Sep The Wilderness Downtown»

I got shivers whatching this. Be sure to use an able computer.

For me it only worked with Safari 5. Pure HTML5, no Flash.




link 3 Sep He Took a Polaroid Every Day, Until the Day He Died»

Fascinating.

The story: http://www.mentalfloss.com/blogs/archives/15131




link 25 Aug Dynamic Select Lists with Ruby on Rails and AJAX |»

Best Rails tutorial showing dynamic form modification with AJAX I’ve come across.




photo 20 Aug

rocketboom:

World Population by Latitude/Longitude [via Bill Ranklin]

via Rocketboom.



quote 19 Aug
Le documentaire existe-t-il vraiment? Dès qu’il y a manipulation du réel en salle de montage, il y a fiction. ‘Carcasses’ est une fiction fabriquée avec des éclats de réel.
— Denis Côté (CDC no 645)



link 17 Aug Redmine - Project management»

Excellent light, powerful & flexible project management web app. It came a long way since I last checked it out. You may use it for any kind of project where you have a lot of tasks to track.




link 17 Aug Redmine - Flexible project management»

Excellent light, powerful & flexible project management web app. It came a long way since I last checked it out. You may use it for any kind of project where you have a lot of tasks to track.




link 17 Aug Redmine - Flexible project management»

Excellent light, powerful & flexible project management web app. It came a long way since I last checked it out. You may use it for any kind of project where you have a lot of tasks to track.




Design crafted by Prashanth Kamalakanthan. Content powered by Tumblr.