/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
Use following command and answer YES to enable dynamic updates:
sudo dpkg-reconfigure resolvconf
Do a system restart after that.
Related cards:
difference between attr_accessor and initialize
attr_accessor is used to create setter and getter methods for instance variables so that they can be accessed outside the class. initialize is the special method in ruby that gets called when an object is instantiated.
class Birthday
attr_ac...
add sublime text option to the contextual menu
After installing sublime text, we must be able to open text files with it. Right click on a text file and you must see the option "open with sublime text". In case you don't , click Open with other applications and you should see Sublime text opti...
Abstract classes in rails
class AbstractModel < ActiveRecord::Base
self.abstract_class = true
end
class Foo < AbstractModel
end
class Bar < AbstractModel
end
Foo and Bar both inherit properties and methods of the Abstract Model while being in separate tables...
Passing objects using redirect_to
Scenario : You have some manipulation done in your controller action and redirect the user to another action after that. Now you want the output of the manipulation available in the page user is redirected to.
You can pass the object with redirec...
Adobe flash player installation in ubuntu chromium browser
For Chromium browser versions greater than 34, to use flash one must install Pepper flash.
For Ubuntu 14.04 or newer, run
sudo apt-get install pepperflashplugin-nonfree
sudo update-pepperflashplugin-nonfree --status
# to see what version of...
detect and select method in ruby
detect method in ruby returns the first item in the collection for which the block returns TRUE and returns nil if it doesn't find any. It has an optional argument containing a proc that calculates a “default” value — that is, the value to return ...
Fixing "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)"
If you have to work with older versions of Rails, there might be discrepancy between the versions of Rails and Rubygems. Theats when you likely see the below message when you try to boot your rails app.
/home/lt-pc-528/.rvm/gems/ruby-1.8.7-p...
gmail hack
The below hack might come in handy for testing when a unique account is required.
You can throw '.'s into gmail email addresses and they all end up at the same address on gmail.
All the below email addresses end up as same.
abc@gmail.com
ab....
Class_eval and Instance_eval
class_eval is called on a class object and is used to create instance methods for the class at runtime.
%w(administrator developer teamlead tester).each do |user|
class_eval <<-EOR
def is_#{user}?
site == "MYACCOUNT_#{org.upcase}" ...
listing methods of class and object (instance)
class Myclass
def one
puts "one is called"
end
end
ss = Myclass.new
puts Myclass.methods
# returns array of methods for the class. Includes both class and instance methods and methods inherited from parents.
puts Myclass.instanc...