[Tiago Motta] Dados abertos do Web Democracia

November 28th, 2015

Nas minhas conversas com os participantes do RecSys de 2015 em Viena foi possível notar o esgotamento deles em relação aos dados existentes para análise. Os acadêmicos longe de grandes empresas como Linkedin, Google, Facebook e Netflix, estavam sempre em busca de mais dados para tunar e implementar novos algoritmos. Em resumo, ninguém aguenta mais o MovieLens.

Por essa razão resolvi disponibilizar todos os dados de avaliações de políticos no Web Democracia publicamente.

Para garantir a privacidade dos usuários utilizei a total aleatorização dos IDs de forma a evitar qualquer engenharia reversa, deixando então as avaliações anônimas.

A descrição completa dos dados de avaliações de políticos do Web Democracia você encontra aqui.

Um exemplo simples de análise desses dados com pandas pode ser visto aqui.

Agora então os quase meio milhão de avaliações de políticos do Web Democracia é mais uma fonte de informação e de um domínio bem diferente que os tradicionais livros e filmes.

[Renan Oliveira] Big Data na Globo.com

November 23rd, 2015

[Renan Oliveira] Excelsior – Perfil usando Big Data e Web Semântica

November 11th, 2015

[Igor Sobreira] Decoding JSON numbers into strings in Go

April 11th, 2015

You have a JSON documents with numbers:

    "num_integer": 10,
    "num_float": 10.5

Go’s JSON decoder is smart enough to decode those into your struct with correct types, like the one bellow:

type Message struct {
    NumInt   int     json:"num_integer"
    NumFloat float64 json:"num_float"

If the JSON value doesn’t match your struct type encoding/json will return an error. Trying to decode the JSON document above with the following struct:

type Message struct {
    NumInt   string  json:"num_integer"
    NumFloat float64 json:"num_float"

will return an error:

json: cannot unmarshal number into Go value of type string

Yesterday I had this specific scenario where I needed just this: having JSON document with numbers and decode them into my struct with string fields. I found the solution in stackoverflow (of course). encoding/json has a Number type which stores the value as a string and has methods to convert to integer or floats. Here is how I used it:

type Message struct {
    NumInt   json.Number json:"num_integer"
    NumFloat json.Number json:"num_float"

just decode it as usual. Note how the underlying type is still a string, but you also have convenient methods to convert to both int64 or float64

var message = {
    "num_integer": 10,
    "num_float": 10.5
var msg Message
if err := json.Unmarshal([]byte(message), &msg); err != nil {
fmt.Printf("%#v\n", msg)

numInt, err := msg.NumInt.Int64()
if err != nil {
numFloat, err := msg.NumFloat.Float64()
if err != nil {
fmt.Printf("Integer: %v. Float: %v\n", numInt, numFloat)

Here is the full example at play.golang.org

I still had to change my struct field from string to json.Number, but that’s ok because I can still assign string literals to it. By the way that’s an important distinction. string and json.Number are different types with the same underlying type. From the spec:

Each type T has an underlying type: If T is one of the predeclared boolean, numeric, or string types, or a type literal, the corresponding underlying type is T itself. Otherwise, T’s underlying type is the underlying type of the type to which T refers in its type declaration.

This works:

type Message struct {
    Num json.Number
var msg Message
msg.Num = "ten"    // string literal

but this doesn’t:

type Message struct {
    Num json.Number
var msg Message
var num = "ten"    // variable of type string
msg.Num = num

cannot use num (type string) as type json.Number in assignment

oh, and just for completeness, this also works:

type Message struct {
    Num json.Number
var msg Message
const num = "ten"  // now an untyped constant
msg.Num = num

[Emerson Macedo] Minha palestra na QCON SP 2015

April 1st, 2015

Na semana passada, mais precisamente no dia 25/03/2015, palestrei na QCON SP pela segunda vez. A última vez que palestrei no evento foi em 2011.

Minha palestra foi sobre o case do GloboTV e Globosat Play. O objetivo era seguir pelos passos que fizemos até chegar no estagio atual, desde lidar com o nosso monolito, até quebra-lo em diversas apps, cada uma com suas responsabilidades. Vou tentar expor mais tecnicamente os detalhes aqui no blog.

Os slides seguem abaixo e o InfoQ Brasil deve publicar o vídeo em breve.

Microservices Case: GloboTV e Globosat Play from Emerson Macedo

[Flávio Ribeiro] It's time to move on

March 26th, 2015

After almost 4 years immersed in a lot of exciting challenges, it’s time to move on.

Sunset by instagram.com/fanydantas

Sunset from my balcony by Fany

When I started working at Globo.com, I realized that every if that I wrote would run in hundreds of thousands of computers around the country. Until then, I’ve only worked on small startups in the Northeast of Brazil where the impact of their products have smaller proportions. Describing this feeling is hard. I would argue that, for a software developer like me, knowing that your code is being used is as rewarding as receiving real money.

During the time at Globo, I faced huge projects. As we’ve worked developing software for the video delivery stack, almost every big transmission - like elections or FIFA World Cup - had their special issues and corner cases. Following the trend, we developed a live video streaming stack from scratch and seeing this new infrastructure beating the concurrent users peak twice was priceless.

United Colors of WebMedia

Part of WebMedia Team during the World Cup. We were still believing we would be Champions.

I could also work with the most awesome engineers I’ve ever met. Sometimes I felt that the lunch time was kind of a graduate class (actually, I should had taken a pencil and paper to it). The discussions ranged from writing tests to how telecommunications works.

Since the beginning of last year I’ve worked full time on an open source project which was the real reason for me to get up out of bed to go to work and sometimes even rise up early to answer one issue or fix a bug that someone dropped on github. I’ve already said this here but…Damn, how awesome is working with FOSS!

About 6 months ago I was catching myself visiting LinkedIn, hypothetically looking for a new job, and this made me think that it was time to move on. I’ve read somewhere that when you’re feeling attracted by other opportunities, it’s a big red signal that you’re not happy anymore and need a change. I’ve applied to some companies and met a lot of great guys during the interviews but the last one was mind changing.

If you get the chance to work overseas, take it. There is never a right time. And we always regret the things we don’t do far more than the things we do. (Shane Rodgers)

I’m joining the Video Team at The New York Times. Next week I’m heading to New York to visit the office and meet my coworkers. I must say that I’m totally anxious and excited about it, but a lot of things need to happen before I move definitively to America. Until there, I’ll work remotely (which will be a challenge apart).

I hope that everything that I lived these years were only the beginning and I’m sure I have a lot of things to learn. I’ll try hard to publish more posts regarding the obstacles I’ll face and I hope you’ll be cheering for me.

Related Links:
Hey Feio, how is working at The Times?
What I whish I knew when starting out as a Software Developer
The career advice I wish I had at 25

[Alexandre Magno] Por: Keeptalent Recrutamento Especializado

February 3rd, 2015

Olá, bom dia!

Trabalho em uma consultoria de recrutamento e seleção e estamos com algumas oportunidades para a área de TI em Blumenau/SC. Dentre elas, destacamos:

- Analista da Qualidade (Testes)
- Programador C#
- Programador JAVA
- Programador Delphi
- Arquiteto de Informação/UX Designer

Interessados encaminhar cv para atendimento@keeptalent.com.br ou candidatar-se através do site http://www.keeptalent.com.br

[Lucas Galego] JavaScript Object Oriented Programming

January 13th, 2015

When I started to work as a developer, I remember that my fellow programmers used to hate JavaScript.
I myself was not a real fan of this incredible language.
That’s why I decided to study it more deeply.
During my studies, one thing came clear to me:

JavaScript is one of the most powerfull languages I ever seen.

But… There is always a but.

Its API is terrible.

But since JavaScript is a language ready to be extended, we solve this problem using some great tools like jQuery or Undescore.js, that make the JavaScript API be really beautiful.

JavaScript is a really powerfull language, so, we can program in JavaScript using a lot of paradigms.

Let’s talk about how to implement your JavaScript code using Object Oriented Programming.

JavaScript and OOP

To understand how to make OOP code using JavaScript, we first need to understand how the variable this works.


If you run this code, the console will log to you an instance of the DOM Window object representing the window of your browser (this will change if you are running this on a Node.js server).

That means that in the global scope this is the Window object.

Okay, so what if we run this code:

function some(){




If you run, you will see that again Window is logged.

That means that the this of a function is the same this from the scope where the function is defined.

So, how can I create an object and make its this referencing it?

Creating a JavaScript Object

var myObj = {

some: function(){console.log(this);}



Now we are getting somewhere, When you run this code, it’s an Object that is logged, not a Window Object, just an Object.

If you inspect the logged object, you will se that it has a property called some. This property is a function, the function that we called.

Once we have an object, we can add properties to it:

myObj.coolProperty = “JavaScript rocks”;

And also retrieve these properties:



Note that the properties are like keys of a map. You can retrieve them using the [] syntax, so, you can pass the properties as parameters.

var myObj = {

func1: function(){console.log(“Called 1″)},

func2: function(){console.log(“Called 2″)}



This will prompt “Called 2″.

Creating constructors

There is another way to create an object:

function MyObject(){

this.some = function(){console.log(this);};


myObj = new MyObject();


We just created a constructor. If you run this code, you will se now MyObject at the console.

Since we created this object using the function new, this was redefined from Window to MyObject.

Thats why when we make this.some = function(){console.log(this);}; inside the function MyObject the function is defined inside our MyObject instance.

So what happens if we run this code:

function MyObject(){

this.some = function(){console.log(this);};


myObj = MyObject();



Now, we don’t used new when we invoked MyObject function. That means that inside the function this remains to be Window.

Wich means


log undefined. We don’t return anything from MyObject function, so myObj is undefined.

And that’s why we can invoke some at the global scope and it log Window.

So its very important to remember that you have to use new when you are creating an Object  from a Constructor.

Creating Public Methods

All right, now we know how to create objects and even how to create this objects from constructors.

But how can we add methods to a Object definition.

Let’s see two ways.

  • Using properties:

function MyObject(){

this.method = function(){console.log(“I’m a public method”);};

new MyObject().method();


var myObject = {

method: function(){console.log(“I’m a public method”);}



In both examples we defined a property in an object that is a function. So we can use this function like a method.

  • Using prototype

function MyObject(){};

MyObject.prototype.method = function(){console.log(“I’m a public method”);};

new MyObject().method();

We just created a construtor for MyObject, after that, we defined in the prototype of our constructor an attribute that is a function.

Every attribute defined in the prototype of an object, is automatically, accessible by the instances of that object.

Using Inheritance

We can use prototype to define Inheritance.

function Animal(){};

Animal.prototype.eat = function(){console.log(“eating…”);};

function Dog(){};

Dog.prototype = Animal.prototype;

new Dog().eat();

Setting the prototype of the Constructor of a Dog as the prototype of Animal makes that our Dogs to have the method eat.

Defining private members

Well, you may also want to create properties and methods that are not public. This is really easy.

Every variable in JavaScript has function scope

function a(){

var b = 1;





This code will log 1 and then will log undefined. That’s why when we use the word var we are saying that the variable b exists only inside the function a.

Since our objects are functions, we can use the same idea:

function MyObject(){

var privateMethod = function(){console.log(“I’m private”);};

this.publicMethod = function(){console.log(privateMethod());};


new MyObject().publicMethod();

console.log(new MyObject().privateMethod).

This code will log I’m private and them undefined. And thats was what we expect.

First we call the public method. It has access to our private method inside the Object instance so it con log our message.

But, outside the constructor function, the variable privateMethod dos not exists, so our code log undefined.


You can have a lot of fun with JavaScript. So enjoy and play a lot :)

I just introduced the concept of OOP here, there is a lot to talk about this.

You can see some great JavaScript samples here.

That’s all. See you!

[Lucas Galego] Hello world!

January 13th, 2015

Hello guys.

This is a new and refreshing blog.

I’m going to try to post here my thoughts about one of my greatest passions. That is programming.

Lets see what you will think about it.

See ya!

[Lucas Galego] Ruboto, this android works?

January 13th, 2015

I was wondering about play a little with a project called Ruboto by some time.

For who doesn’t heard anything about this project, Ruboto is a intended to make possible to write android applications with Ruby.

Since I love my old but gold Motorola Milestone and I also love Ruby this sounds really fun.

Here is what I have done:

My intention was to make a really simple application just to see the maturity of the project.

What can be more simple than a planning poker app? Well I don’t know. So I decided to make that one.

Begining from scratch:

  • You can find more about the Ruboto project at its web page.
  • You can write fully funcional apps only writing code in Ruby and using generators to make the Java wrappers.
  • You can make hybrid projects using Java and Ruby.
  • It cover almost all android API.

But… There is always a but:

  • To run Ruboto apps  you have to install the ruboto-core app to your android device.
  • If you want that your app support JIT (and who doesn’t want that?) your apk file will get bigger.

Let’s Play

To start to play you have to setup your enviroment.

You gonna need the JDK installed in your system.

Once you it installed, install the JRuby.

I recommend you to use the JRuby 1.6.4. It will also be smart, install it using rvm and create a gemset to full around.

Another dependency is the Android SDK. You can get it here.

Read the REAME file since you have downloaded it. ;)

Don’t forget to install the android sdk and the development tools.

Okay. That’s all. Now we can start the party.  :)

First we need to create an emulated device to use during our development.

To create this run the command:

android -s create avd -f -n Android_2.3 -t android-10 –sdcard 64M

To startup the emulator you created:

emulator -avd Android_2.3

Generating the Ruboto project

ruboto gen app –package better.code.planning.poker –target android-10

Just this. The Ruboto project contains code generators like Ruby on Rails.

You have now:

  • All the project structure of an Android project,
  • All the Java wrappers to your Ruby script,
  • A Hello World Ruby Script,
  • Some usefull rake tasks.

The rake tasks are:

  • rake -> Build the apk.
  • rake install start -> Build the apk, install and start it on your emulator.
  • rake install:clean start -> Also clean the previous build from your emulator.
  • rake update_scripts:restart -> Updates only the ruby script on your device, it can save you some compilation time.

You can also make the deploy to the device by yourself using the comand:

adb install ruboto-core.apk

Let’s start to code

First lets define a better title to our activity:

Edit the application name into the file: res/values/strings.xml

<string name="app_name">Planning Poker!</string>

Now we can finally see one of the good points of using Ruboto.

When developing Android apps, you have to deal with a lot of xml files that handle how the templates will be defined.

With Ruboto, we can define our template using its much more delicious DSL.

Edit the file: src/poker_activity.rb

require 'ruboto'

java_import 'android.content.Intent'

ruboto_import_widgets :Button, :LinearLayout, :TableLayout, :TableRow

$activity.handle_create do |bundle|
  setTitle 'Lets make this Sprint!'

  setup_content do
    table_layout do
        table_row do
          button :text => ' 1 ', :text_size => 57
          button :text => ' 2 ', :text_size => 57
          button :text => ' 3 ', :text_size => 57
        table_row do
          button :text => ' 5 ', :text_size => 57
          button :text => ' 8 ', :text_size => 57
          button :text => ' 13', :text_size => 57
        table_row do
          button :text => ' 20', :text_size => 57
          button :text => ' 40', :text_size => 57
          button :text => '100', :text_size => 57
        table_row do
          button :text => 'Zzz', :text_size => 57
          button :text => ' 0 ', :text_size => 57
          button :text => ' ? ', :text_size => 57

We defined our layout using the Ruboto DSL with the methods setup_content, table_layout and table_row.

We set the content of each row with the method button.

Events and new Activities

Now let’s make the magic. When the user press the number he wants to vote, we will popup a new Activity with the value.

For this we need to create a new Activity.

ruboto gen class Activity –name Card

And edit the code in src/card.rb like this:

require 'ruboto'

ruboto_import_widgets :Button, :LinearLayout, :TextView

$activity.handle_create do |bundle|
  setTitle 'My vote is'

  setup_content do
    linear_layout :orientation => LinearLayout::VERTICAL do
      @text_view = text_view :text => $activity.getIntent.getExtras
                   :text_size => 150


Now, what we need is register the event, so we can dispatch the new Activity.

First we need to register the new activity in the AndroidManifest.xml file

<activity android:name='Card' android:label='Card'>
            <action android:name='android.intent.action.CARD'/>
            <category android:name='android.intent.category.DEFAULT'/>

Now, we add the handler of the action into the src/poker_activity.rb file. Just after the setup_content method:

handle_click do |view|
    i = Intent.new("android.intent.action.CARD")
    i.putExtra("better.code.ruboto.planning.poker.vote", view.text)

Using the Intent instance, we can call the putExtra method. That’s the way we can pass args to our new Activity.

In the Card Activity, the args are rescued using the getExtras method.

That’s it. I hope you enjoy it just like me :)

See ya!