トップ 追記

From a small town

2008|02|06|11|
2009|07|08|11|12|

2009-12-28

_ [ruby][event] Ruby Advent Calendar jp: 2009

From 1 Dec to 25 Dec, the following 25 tips were written by Japanese Rubyists.

Posts are written in Japanese (except Day 1 and 19), so maybe you should use Google Translate.

  • Day 1 : [Test] Writing code and its spec together (by ujihisa)
  • Day 2 : [Ruby1.9] The new hash literal syntax (by yhara)
  • Day 3 : [Env] Building Ruby on Windows with VS2008 Express (by mrkn)
  • Day 4 : Tips on finding memory destruction while hacking the Ruby GC (by nari3)
  • Day 5 : [Debug] Growl helps debugging (you know g!)
  • Day 6 : [Ruby1.9] How to contribute to Ruby 1.9
  • Day 7 : [Dev] some tips about irb
  • Day 8 : [Doc] Documentation with YARDoc
  • Day 9 : [Dev] Nice methods of String
  • Day 10 : [Rails][Test] be careful with models named Test*
  • Day 11 : [Lib] Process-level parallelism with dRuby
  • Day 12 : [Rails] tips with content_for
  • Day 13 : [Env] Switching Ruby 1.8.7, 1.9.1, 1.9.2preview1 on Ubuntu (update-alternatives)
  • Day 14 : [Dev] Structizing a hash with method_missing as singleton method
  • Day 15 : [App] Advent Calendar as Bilbo(his blog system)'s plugin
  • Day 16 : [Esoteric] Ruby Code Obfuscation 101
  • Day 17 : [Hack] SEGV on curses (fixed)
  • Day 18 : [App] the new Japanese Ruby reference manual
  • Day 19 : [Dev] Writing C extensions with rake-compiler
  • Day 20 : [App] Analyzing marathon score with Ruby
  • Day 21 : [Hack] Debugging CRuby with gdb-ruby
  • Day 22 : [App] A tool to ease invocations of ROMA
  • Day 23 : [Lib] 11 Tips about Haml
  • Day 24 : [Lib] Ruby Facets adds useful mehtods to the built-in classes
  • Day 25 : [Hack] Hacked Ruby with XML-literals

You can also check their tweets on: http://twitter.com/yhara_en/rubyadventjp2009


2009-11-12

_ [ruby] Thinking another API of RR(double ruby)

RR is a popular mocking library for Ruby.

RR provides very terse syntax.

  flexmock(User).should_receive(:find).with('42').and_return(jane) # Flexmock
  User.should_receive(:find).with('42').and_return(jane) # Rspec
  User.expects(:find).with('42').returns {jane} # Mocha
  User.should_receive(:find).with('42') {jane} # Rspec using return value blocks
  mock(User).find('42') {jane} # RR

But after writing some code with RR, I found it's not as readable as I expected. Why?

For example,

 mock(user).find('42'){ jane }

looks like a method call, but it isn't. This is just a declaraiton of mocking, not a method call.

If it is not a method call, it should not looks like a method call. So I think this is better:

 mock(user, :find, '42'){ jane }
 dont_allow(User, :find, '42')

What do you think?


2009-08-18

_ [haskell][esolang] Programming Language Unhaskell

Unhaskell is a programming language just like Haskell, but all the syntax sugars are removed.

Hello World

Hello World in Haskell:

 main = putStrLn "Hello world"

Hello World in Unhaskell:

 main = putStrLn ('H':'e':'l':'l':'o':' ':'w':'o':'r':'l':'d':[])

Though I don't have much exprerience on Haskell, I'm sure Unhaskell is kind of esoteric language.

Echo Program

Ujihisa gave me an echo program written in Unhaskell:

 main = getContents >>= putStrLn

Well, echo programs tend to be very short in esoteric languages (eg. in Brainf*ck).


2009-07-29

_ [ruby] Ruby libraries to run JavaScript tests

There are lots of libraries to run JavaScript tests from Ruby.

So which libraries is the best? Well, I need to try them all to answer the question; but The Ruby Toolbox: Browser Testing will help you to choose the one. (Note that Webrat, which is top rated, is not for JS testing)

*1 Which is the main website?

_ [ruby] Installing multiple Rubys with Rake

Recently, I wrote a Rakefile to install MRI 1.8.5/6/7, MRI 1.9.1, JRuby, and Rubinius.

/Users/yhara/research/rubys % rake -T
(in /Users/yhara/research/rubys)
rake jruby     # install jruby
rake rubinius  # install rubinius
rake ruby185   # install ruby-1.8.5 p231
rake ruby186   # install ruby-1.8.6 p369
rake ruby187   # install ruby-1.8.7 p174
rake ruby191   # install ruby-1.9.1 p129

Binaries are installed into ~/bin/rubys, symlinks (such as ruby-1.8.5-p231) are made in ~/bin.


2008-11-19

_ [ruby][scheme] Calling Ruby from Scheme with dRuby

aike-san wrote a dRuby protocol implementation in Scheme. It includes marshalling of some ruby types (String and Integer).

There are many tries to embed a language into another, but doing that via TCP is unique.


2008-11-14

_ [event][ruby] Back from RubyConf2008, Orlando

suffering horrible jet lag now

_ [prog] Community matters

  • In recent days, libraries are very important for programming languages to be popular
  • But most libraries are not implemented by author of the original language
  • So programming languages need good library developper, especially in its early stage

I have no idea to acquire good library developper though.


2008-06-04

_ [misc] New domain name: route477.net

This diary will be moved to new domain: route477.net.


2008-02-01

_ [misc] test

test entry.

_ [misc] test 2

This page will be my English weblog (or diary).

Today is 1st day of February, but this is not intended; it's just an accident.

  1. i'm writing master thesis now
  2. the time limit is 14:00 of *today*
  3. it's 4:39 now
  4. i have to write 6 more pages until the limit
  5. i am *sleepy*

トップ 追記