AgileAndArt

The Art Improving Agile Software Development

Browsing Posts tagged rails

Sexta-feira dessa semana acontecerá o Oxente Rails, o maior evento de Rails do Nordeste do Brasil. O evento será em Natal e terá a presença de pessoas importantíssimas da comunidade Rails, não só do Brasil, mas do mundo todo. Veja a lista de palestrantes. Alguns deles são: David Hanson (criador do Rails), Fábio Akita (evangelista de Rails no Brasil), Vinicius Teles da ImproveIT, Fabio Kung. A abertura do evento será feita pelo Aldinho (irmão de Elomar). Com certeza esse será um dos grandes eventos do ano.

Eu vou para o Oxente Rails, onde apresentarei a palestra Pensamento e Aprendizado Ágil. Também estarei lá para bater papo com todo mundo, falar de Rails, Ruby, Agilidade e outras coisas nerds. E conforme prometido no vídeo abaixo, cantarei AO VIVO o forró do Elomar! Não perrrrrrrrrcam. A gente se vê lá, bixim danado, cabra da péxti!

This weekend I was working at the first Random Hack of Kindess mundial edition. There were 4 people in our team and we worked on a project called Urban Fact (Fato Urbano in Portuguese). The main idea of this project is to emphasize GOOD orBAD facts in your city. If you see someone throwing the garbage over the streets, just take a picture and post it on twitter using #urbanfact hashtag (or #fatourbano). This picture automatically  goes to the project website, where people can vote, comment and share with friends.

For the solution, we used Rails for the web interface, MySql as database and Python for the backend twitter collector. We also used Google Maps API to automatically generate the map with all entries. All code is available at my github account. We hosted the website in a Locaweb Cloud Server.

Our project earned the 2nd best project prize!

Visit my flickr account to see the pictures of this event.

Jango.com is one of the most incredible on-line radios I know and some time ago I decided to put Daniella Alcarpe songs on this site. Jango has many things that make artists life happier and easier: you pay Jango to play your songs to people who probably will like your song. For example, Daniella sings Brazilian Bossa Music, so in Jango I choosed to play her songs just for people who like this kind of music, people who listen to João Gilberto, Caetano Veloso, Chico Buarque and so on.

After songs starts playing, the artist starts to get fans. And they really come! With just 2 months of Jango, Daniella has almost 400 new fans, from all over the world.

Now comes the coolest part: we can interact with these fans. They can send us messages, comment on our profile, send us feedback and we can send them messages too. This is awesome and very useful for an artist who is becoming her artist life.

Jango website was made in RubyOnRails, so they provide an API for people who wants to use Jango information on their own website. And that’s what I did, in an extremely easy way. I wanted to show in Daniella’s website recent comments from fans on Jango. It took 18 minutes for me to integrate these two websites, using Rails ActiveResource. Here’s what I did:

1 – I’ve created two models (models/user.rb and models/comment.rb) on my project, one to deal with Jango Users and one to deal with Jango Comments:

class User < ActiveResource::Base
   self.site = "http://www.jango.com"
end

class Comment < ActiveResource::Base
  self.site = "http://www.jango.com/artists/48343/"

  def user
     @user ||= User.find(user_id)
  end
end

2 – Then on my SocialController I have this:

class SocialController < ApplicationController
  def index
    @comments = Comment.find(:all)
  end
end

3 – And in my views/social/index.html.erb I have

<% @comments.each do |c| %>
  <%= link_to "#{c.user.first_name} (#{c.user.country})", "http://www.jango.com/users/#{c.user.id}" %>
  <%= c.body %>
<% end %>

And that’s it: 9 model lines of code, 5 controller lines of code and 6 view lines of code. With 18 lines of code, I’ve integrated Daniella Alcarpe website with Jango. This is the power of Rails and RESTful. Now everybody who visits www.cantora.mus.br can see what fans are saying about the singer and her wonderful work. Check for yourself.

PS: of course there are some cache stuff to deal with on this integration, but for now I’m not worried. Premature optimization is the root of all evil (Donald Knuth)


O Akita nos convidou
Prum evento muito legal
Nóis fumo e foi muito mais que animal
Nóis twitêmo RailsSummit o dia inteiro
Da outra vêis, nóis vai vortá
Nóis não semo tatu

Outro dia encontremo com Akita
Que mostrou pra gente a morena Open Source
Isso não se faz Akita
Nóis sêmo geek
Era só ter ponhado o projeto no git

(música apresentada pela primeira vez na desconferência do Rails Summit 2009)

Switch to our mobile site