Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

This Week I Learned - 2016 Week 21

Write-up for last week or you might want to read the whole series.

My time with Rails is up. This sure brings back the memory of Zed Shaw's infamous rant post, Rails is a Ghetto. I think the author major issue is Ruby on Rails tight coupling architecture. I can understand why he prefers building web application from a bunch of independent libraries (more like Unix's philosophy of 'Do One Thing and Do It Well' approach). This is Gartner's Hype Cycle at work here and this excellent reply provides another point of view and suggestions. What's next in Ruby land if you want to build a web application but not using Rails? Traiblazer, Hanami, ROM, and dry-rb. One good thing the came out from all the Rails hype was that more developers were made aware of PostgreSQL instead of the default MySQL.

How I Vim. Interviews of Vim's user on how they customized and use Vim. Due to the recent changes in life, I've been evaluating Sublime Text and have a different perspective and understanding on why this editor was popular among non-Unix users. There is nothing unique about Sublime Text that both Vim or Emacs can't reproduce. The only things missing in both these legacy editors is good sensible default. For examples, searching multiple files or jumping through definitions without resorting to external plugins and customization.

Remember that you always search for "asdfasdksfdasdf" just to clear the highlighted search results, even after restarting the Vim? There is a way, although still manual, to toggle off the highlighted search. This is coming from :best of Vim.
nnoremap  / :nohlsearch

Again, another unsolved Vim's customization cleared today! Auto-reload your '.vimrc' file upon saving.
augroup reload_vimrc
    autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END

The machine is acting up again and I can't get anything much done today. Most probably it has reaches its end of life. Maybe is time to get a new machine instead.

This Week I Learned - 2016 Week 17

Write-up for last week or you might want to read the whole series.

Busy week, didn't follow up with anything else. Nothing but reading and writing papers.

Being a developer after 40? (HN thread) Are you too old for development? Nope. While general consensus is that if you over 35, you should either be in the management, start your own company, or be a consultant. But why you want to move on to something else? There is still so much to learn. Have fun, rest well, and keep yourself healthy. The first post of the discussion may shed some lights on the actual reason why organization are reluctant to hire more experience (often correlate with age) developer.

Learn a new technology each week in 2016. Awesome weekly project! Unfortunately, most of the project are written in Scala. Not that I've something against the programming language, but I've painful and dreadful slow experience setting up both Scala and Play framework. The main culprit is sbt, the interactive build tool. The number of dependencies to be downloaded in order to get sbt to work is so painful huge is like you're downloading the whole Internet. Furthermore, you really need a powerful development machine to do any development work in Java-based platform.

Pandoc (the universal document converter) with Markdown is awesome. But no one still can solve the annoying problem of making it easy to create a simple table. 

Why isn't Perl more popular? Reasons? Perl is a glorified AWK. The TMTOWTDI motto. Osborne effect of Perl 6PHP, the simplified version of Perl took over the web and dethroned Perl. No killer apps (like Rails for Ruby or WordPress for PHP).

The Weirdness of Ruby Version in Debian Wheezy

Due to certain application dependency on Ruby, I need to install Ruby on the machine. As you can see from below, the versioning and packing in Debian puzzled me.

Install the latest Ruby version and the ruby-switch program which will can set the default Ruby version to any installed version.
$ sudo apt-get install ruby1.9.3 ruby-switch

Check our just installed version.
$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Show the list of available version. Note that listing shows ruby1.9. I thought we've just installed version 1.9.3?
$ sudo ruby-switch --list

Set version 1.9.3 as our default Ruby version.
$ sudo ruby-switch --set ruby1.9.1

Check the binary of ruby. Apparently it is a soft link.
$ file `which ruby`
/usr/bin/ruby: symbolic link to `/etc/alternatives/ruby'

Again, another soft link but pointed to ruby1.9.1.
$ file /etc/alternatives/ruby
/etc/alternatives/ruby: symbolic link to `/usr/bin/ruby1.9.1'

Check whether /usr/bin/ruby1.9.1 is a binary or soft link. As result shown, it's a binary program.
$ file /usr/bin/ruby1.9.1
/usr/bin/ruby1.9.1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xf5d1e1e2959315b9d4907b6a40fb2c44f1c27c87, stripped

Check the ruby1.9.1 version again. What?! Why it's showing version 1.9.3?
$ /usr/bin/ruby1.9.1 --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Check which package contains this /usr/bin/ruby1.9.1 binary. Weird, it belongs to ruby1.9.1 package, which is reasonable but I didn't install that.
$ apt-file search /usr/bin/ruby1.9.1
ruby1.9.1: /usr/bin/ruby1.9.1

Show the reverse dependancies. Why ruby1.9.1 needs ruby1.9.3?
$ apt-cache rdepends ruby1.9.1 | grep ruby

Okay. Let's check with Ruby Gem. Similar steps.
$ file `which gem`
/usr/bin/gem: symbolic link to `/etc/alternatives/gem'

$ file /etc/alternatives/gem
/etc/alternatives/gem: symbolic link to `/usr/bin/gem1.9.1'

Interesting. gem1.9.1 is a ruby script.
$ file /usr/bin/gem1.9.1
/usr/bin/gem1.9.1: Ruby script, ASCII text executable

However, when checking the version of /usr/bin/gem1.9.1.
$ /usr/bin/gem1.9.1 --version

What the heck?!