Programming

Nuntium: exponential backoff and new xmpp library

This week we've updated nuntium to version 2.8, yay! Aside from some minor bug fixes, nuntium now implements an exponential backoff strategy when a message delivery fails. Previously, it worked like this: A message failed to be delivered. If the cause was the message itself (for example it contains invalid data), it was discarded. If [...]

Introducing cukecooker: writing cucumber scenarios with aid

In our development team we want our testers to start writing cucumber features. I know, BDD, the features should be written before the code, but a tester could later add scenarios which we haven’t previously thought or regression features for bugs. For writing the scenarios she could learn the steps from other features or just [...]

Rails Rumble is over: welcome GithubDamper!

This past weekend, together with Emmanuel Oga, we’ve been coding a Ruby on Rails application for this year’s Rails Rumble. The idea: in github you can watch some repositories, but later you can’t make a search over those watches. The only search github provides is one over all repositories. When your watches reaches a big [...]

Even more powerful Goolge Visualizations for Ruby on Rails

Ok, now you can easily implement a Google Visualization API data source on rails. But… are you still using javascript to render them? Well, you don’t need to do that anymore. Now rgviz-rails supports a pretty simple and powerful way to do it. In your views templates you now have an rgviz function. You use [...]

Powerful Google Visualizations for Ruby on Rails

So we have this project in Ruby on Rails where we keep track of the amount of infected and death cases of several diseases in cross-border locations. Now we need to do some visualizations with all those reports, like showing the amount of infected cases in each location for a given disease. We analyzed several [...]

Building an application to track expenses in one hour using GeoChat

Whenever one of our team member travels to another country we tell her to track expenses like food, transportation and accomodation so that later that money can be refunded. Each of us does it in a different way: we write it in a notes application in a cellphone, or in a text file in our [...]

Quick way to test many values in ruby

Many times we end up having similar tests: same logic but different inputs and expected outputs. For example, suppose we need to test our brand new sqrt function:

test "sqrt 1" do
assert_equals 1, sqrt(1)
end

test "sqrt 4" do
assert_equals 2, sqrt(4)
end

test "sqrt 9" do
assert_equals 3, sqrt(9)
end

Here we are dupplicating code, since “assert_equals [...]

String concatenation in ruby

I just found out the difference between += and << when used for a string.
irb(main):001:0> str = 'chan'
=> "chan"
irb(main):002:0> str.object_id
=> 69952758899780
irb(main):003:0> str += 'ged'
=> "changed"
irb(main):004:0> str.object_id
=> 69952758848800
irb(main):005:0> str << ', now not'
=> "changed, now not"
irb(main):006:0> str.object_id
=> 69952758848800
So I think that basically you should never use += for strings, unless you really want to hurt the [...]

Ruby-Jump plugin for gedit

I searched the internet for a gedit plugin that would allow me to press a key and jump (navigate) to the file where a ruby class is defined. I couldn’t find one so I wrote one (I know about Geany but I couldn’t find that functionality there either).
Usage
You need to have the FileBrowser plugin installed [...]

Indentation also means something else…

Some days ago I read this in the Digital Mars D programming language newsgroup.
bearophile says:
From:
http://jeremymanson.blogspot.com/2009/02/small-language-changes-for-jdk7...
Automated Resource Blocks, to be able to say things like:

try (BufferedReader br = new BufferedReader(new FileReader(path)) {
return br.readLine();
}

instead of:

BufferedReader br = new BufferedReader(new FileReader(path));
try {
return br.readLine();
} finally {
br.close();
}

and Andrei [...]

Syndicate content