Ruby

berks upload core dump

Ahmy Yulrizka

Berksfhel is cookbook dependency for chef. If you are familiar with ruby / python, think of it as a Bundler or virtual environment for chef

I faced this core dump error while doing berks upload. That command will actualy push some cookbook to a chef server.

 1$ berks upload
 2/home/user/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:47: [BUG] Segmentation fault
 3ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
 4
 5-- Control frame information -----------------------------------------------
 6c:0004 p:0112 s:0009 b:0007 l:002040 d:000006 BLOCK  /home/user/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:47
 7c:0003 p:0031 s:0005 b:0005 l:002108 d:000004 BLOCK  /home/user/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11
 8c:0002 p:---- s:0003 b:0003 l:000002 d:000002 FINISH
 9c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------
10
11-- Ruby level backtrace information ----------------------------------------
12/home/user/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in `block in create'
13/home/user/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:47:in `block in initialize'
14
15....

Jekyll error utf-8 caracter

Ahmy Yulrizka

If you having a problem in jekyll when it didn’t generate a post and there is no error in the log file. you might want to check the content if there is any UTF-8 character encoding such as this ±

The problem arise if you use ruby 1.9. It rejecting a file that contain non-ASCII character. it actually got invalid multibyte char (US-ASCII) error message

to solve this. I added this line to .bashrc or zshrc if you are using zsh

Testing ruby code with benchmark_suite

Ahmy Yulrizka

Just a couple days ago I found out therubygame.com which challenge us to solve a problem with ruby. The result were measured by the fastest, slowest, shortest, longest, cheaters (yup there are also some rule).

And also I was listening to an episode of ruby rouge on Benchmarking. And there is one tools called benchmark_suite.

So there is this challenge to capitalize first letter of every word. I want to compare my code to the fastest solution there. so i installed the gem, also the ruby-ffi gem that somewhat fix an error while I tried to run the benchmark.