Is my kernel 32 bit or 64 bit
uname -a
or
uname -m
x86_64 ==> 64-bit kernel
i686 ==> 32-bit kernel
Related cards:
collect or map in ruby
map is an alias to collect . It basically returns an array by performing some operation on every item in the given collection. It expects a block containing the operation.
[1, 2, 3, 4].map {|number| number ** 2}
# [1, 4, 9, 16]
In the ab...
what is ./ and ../ in linux
In linux, we often see the use of ./ or ../ before a file name. Here is the explanation for the same
. Current Directory
.. Parent Directory
./filename # referring to file name in current directory
../filename # referring to file name in p...
Isues w/ caching in Incognito mode
I've noticed that Incognito mode retain cache from the previous session, it just don't collect any new cache while in incognito.
I usually clear the cache/cookies then go into incognito, or run a different browser profile, or a different browser ...
know which window manager is running
In ubuntu, you have a variety of window managers to choose from. Though Ubuntu 12.04 comes with Unity as the default you can switch back to Gnome, or choose other managers like Cinnamon.
If you want to know, which window manager you are running c...
Adobe flash player installation in Ubuntu
This is to install adobe flash player in Ubuntu 14.04 or higher. This works for Firefox browser.
If you have a 32-bit OS, run
sudo apt-get update
sudo apt-get install flashplugin-installer
Make sure each of the commands executed success...
Check if package is installed in linux
To check if a given package is installed in Debian / Ubuntu, type
dpkg -s <package-name>
To get a neater output use dpkg-query which accepts wildcards as well.
dpkg-query -l <package-name>
In Redhat / Fedora / CentOS use the foll...
Using send method in Ruby
In Ruby, send is often introduced as a way to show how everything is an object
1.send(:+, 1) ## -> 2
It can also be used to call private or protected methods from outside a given class as explained below.
class Myclass
def method...
Clearing out old Rails session records from a MySQL database
To delete sessions based on a hard coded cut-off date:
DELETE FROM sessions WHERE updated_at < STR_TO_DATE('23.05.2013',GET_FORMAT(DATE,'EUR'));
Replacing cut-off date with period of inactivity
DELETE FROM sessions WHERE updated_at ...
mysql formatted select results
To get formatted results for select statements use \G as a suffix for the query.
select * from table_name\G
/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.