Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 RUBY


  World of Father of Ruby

"I am Yukihiro Matsumoto, I believe keyboard can change the world" is a video about Father of Ruby -- Yukihiro Matsumoto. This video introduces us a father, a husband rather than a programmer.Yukihiro Matsumoto shared his understanding about programming in this video. Computer is not quite smart, it cannot understand human languages, so if we want computers to complete jobs we assign to them, then we need something both human beings and computers can understand. That's why we have programming languages.Yukihiro Matsumoto loves programming, but he loves his family more. He works at home lo...

11,665 0       YUKIHIRO MATSUMOTO


  Resolve stylesheet_link_tag fails to work in Ruby on Rails

When developing Ruby On Rails application, developers sometimes will see an unexpected behavior where the application cannot be loaded due to "TypeError: Object doesn't support this property or method" when invoking stylesheet_link_tag. The symptom looks like And the Rails log will show something similar to belowThe error occurs because there is some problem finding the correct assets which are located in app/assets. To resolve the issue, you can following below steps.Add gem 'coffee-script-source', '1.8.0' into Gemfile and run bundle install thenRun bundle update coffee-script-sourceRest...

10,109 2       RUBY ON RAILS STYLESHEET_LINK_TAG JAVASCRIPT_INCLUDE_TAG TYPEERROR


  Stub Mixlib::ShellOut and shell_out in Ruby unit testing

Unit testing is part of software development to ensure the tiny component of a function can work as designed. Different frameworks and tools can be used to run unit testing for different programming languages. In Ruby, one popular unit testing framework is Rspec, or Chefspec if you are writing Chef recipes.While writing Chef recipes, some low level commands(DOS commands or shell commands) need to be executed on the managed resource to perform actions or gather information. For example, listing directory and files on an Unix system using ls command. Mixlib-Shellout can be used to execute o...

9,600 0       RUBY UNIT TESTING RSPEC CHEFSPEC SHELL_OUT


  Fix issue "cannot load such file -- bcrypt_ext (LoadError)"

bcrypt() is a sophisticated and secure hash algorithm designed by The OpenBSD project for hashing passwords. The bcrypt Ruby gem provides a simple wrapper for safely handling passwords.However, sometimes the rails application would fail to start after installing the bcrypt gem on Windows. The error would look similar to below.The issue is that it fails to load the bcrypt_ext which is the native built extension, the reason may be the library is wrongly built. To fix this issue, below steps can be followed. Open a command consolecd to the gem directory C:\RailsInstaller\Ruby2.2.0\...

8,804 1       RUBY SOLUTION RUBY ON RAILS BCRYPT LOAD ERROR


  I don’t like the Ruby 1.9 hash syntax

There, I said it, I don’t like it. And I don’t know why you do either.I assume you like it anyway, everyone else I talk to seems to. My heart sank over and over again whilst I was at the recent RailsConf and saw respected rubyist after respected rubyist using the new Ruby 1.9 hash syntax in their presentations.I just don’t get it.But I’m not one to just moan. I plan to justify my feelings. Then maybe you can tell me why you do like it?My friend the hash rocketI like the hash rocket (not least because it’s a rocket) and I know it’s not going away. Howev...

7,826 0       RUBY 1.9 HASH FEATURE


  How to write your own DSL in Ruby

DSL(Domain Specific Language) is a language defined to fulfill some domain specific requirements to ease people's work. It can be used to define attributes and actions of a domain easily and cleanly. And it is often created based on some common observations or micro patterns of some domain.In Ruby world, there are quite a few places people can find DSL. For example, Ruby itself, Chef recipes.To create a class in Ruby, the traditional OOP way would look like.class User @name = nil @email = nil def name @name end def name=(val) @name = val end def email @email end def email=(va...

7,540 0       TUTORIAL RUBY DSL


  Be careful when running knife vault command

While using Chef, one would frequently use knife commands which are used to manage resources on the Chef server. One can list all nodes, data bags, vault items and many other stuff on the Chef server. In this post, we would cover one command which may need your attention when using it -- knife vault.On Chef server, one can store data to data bags which can be accessed by registered clients. These data bags usually store the data in plain text format. In some cases, one would need to store data secretly on the Chef server, Chef provides the encrypted data bag which uses a shared symmetric secre...

7,476 0       CHEF KNIFE VAULT KNIFE DATA BAG CHEF-VAULT


  6 Reasons Why Devs Should Learn Ruby on Rails

Ruby on Rails has during the last ten years become an increasingly popular framework for web app development. The current shaky economy and rapidly changing tech environment requires the art of app building to be faster and more cost-effective. That's why becoming fluent in Rails might be a great way for developers to expand their knowledge, which can land them a number of great jobs or interesting projects, as well as grant access to a thriving community.Let's start with the basics – what exactly is Ruby on Rails? It's a web application framework written in Ruby programming language tha...

6,870 0       ADVANTAGE RUBY ON RAILS