Dalla Rosa

Posts tagged programming

0 notes &

Tokyo Golang Developers

Missing some real world community around the Go language in Tokyo, I’ve decided to create the Tokyo Golang Developers meetup. It is a meetup for anyone with interest in the go programming language, be it a super hacker or complete beginner. We’re having (hopefully) our first meetup on the 28th in Shibuya and welcome all of you Tokyo gophers!

Filed under golang go programming tech

0 notes &

Dynamically adding attribute accessors in Ruby

A simple way for adding attribute accessors to a class dynamically:

class MyClass
  def add_attr(name, value)
    self.class.send(:attr_accessor, name)
    instance_variable_set("@#{name}", value)
  end
end
just call the add_attr method passing the name of the accessor (as a string) and a value that will be assigned to the variable.
You can also turn this in to a module so that you can easily add the functionality to all your classes.
I’m actually using this in a script I made to easily change data in long csv files.
I wanted to be able to convert CSV files into Ruby objects before changing the data, even if the fields change from file to change.
I know some people are gonna say “just use an existing gem or so”, but this is being fun.

Filed under tech ruby programming accessors

0 notes &

CommandT and Ctrl+S on Mac OS X

One of the best plugins I’ve found for vim is CommandT.  It lets you open files in a very speedy and intuitive way, making it very simple to search files and open them in tabs, splits or vertical splits. Or so it should be. On OS X, opening a file on a new split doesn’t really work. You should be able to do it using the Ctrl-S shorcut but it just doesn’t work.

Today I decided to go after this problem. Looking around the net, I found an article explaining the reason:

 I found a related tip indicating that by default, Terminal.app reserves Ctrl-S for old-fashioned XON/XOFF flow control.

Ok, so the Terminal app doesn’t allow us to use Ctrl-S because it’s a reserved shortcut. What to do?

Simple, just add the lines below in your ~/.bashrc

stty -ixon -ixoff

It will disable the above behavior and free Ctrl-S and Ctrl-Q for use in terminal apps!

Reminder: Just adding that to your bashrc won’t change the settings in the currently open terminal windows. Type the command above on the terminal so you can have the benefits right now, or reopen all your sessions.

Filed under vim macosx commandt terminal tech programming

4 notes &

Ruby is accepted as an International Standard

Ruby, the language created by Yuhikiro “Matz” Matsumoto in 1993 has been accepted as and International by the International Standards Organization (ISO) as the ISO/IEC 30170 standard.

The Information technology Promotion Agency (IPA) has developed the draft standard specification document of Ruby and it was registered as the  JIS (Japanese Industrial Standard) X 3017 on 2011.

Since 2008 a working group lead by Ikuo Nakata, professor emeritus of University of Tsukuba, has been working on an international standard for Ruby.

Ruby’s acceptance marks also the first time a language developed in Japan is accepted as an international standard.

Ruby was created in 1993 by Yuhikiro “Matz” Matsumoto with the goal of making programming fun[1]:

"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."

My first contact with Ruby was almost 3 years ago, during my Master’s, where many of the students would prefer programming in Ruby, rather than the more well-known perl or python. The reason most fo them gave me is the abundance of documentation in Japanese, as it’s a made in Japan language. (I live in Japan) Under their influence I played a bit with it but nothing really deep. It’ wasn’t until 2010 when I decided to try Rails that I first started to study Ruby more properly. It’s expressiveness and ease of use really stand out. The flexibility given by the fact that everything is an object and the meta-programming features make Ruby a great language for fast prototyping.

This announcement comes together with Matz receiving the FSF’s 2011 Free Software Award.

Congratulations Ruby, congratulations Matz!

Here’s the original announcement, from the IPA (in Japanese):

http://www.ipa.go.jp/about/press/20120402_2.html

Filed under tech ruby programming language