May 21

ls – Display the contents of the current directory.
pwd – Display Present working directory.
cd .. – Change directories.
cd - Enter into that directory.
mv – Change the name of a directory.
cp – Copy files and directories.
startx – Start the GUI.
halt – To shut down the system.
kill/killall – Stop a process from running. The difference between the two commands is that kill requires the PID (process ID number) and killall requires only the executable name.
logout – To quit using the system.
mkdir – Make directories Create the Directory(ies), if they do not already exist.
top – Displays the taks that are currently running.
who – Show who is logged on.
man – To help you understand how to use a command.
mount/umount -Mount a file system.
cal – Displays a calendar.
clear – Clears the terminal screen.
su/su- – Allows one user to temporarily become another user/ – Switching to root path.
vi and nano – These are some most widely used editors in linux.
ps – Used to find process status.
ifconfig – Configure a network interface and also to find the ip of machine.
cat – Concatenate one or more files.
find – Used to search files in a directory .
free – Display statistics about memory usage.
df-h – To find the amount of hard disk space and what’s free .

written by admin \\ tags: ,

May 21

will_paginate‘ is one of the most widely used plugins in most of the ruby on rails projects.will_paginate is an alternative to the classic_pagination plugin, which is the pagination plugin that basically took the pre Rails 2.0 pagination implementation and packaged it in plugin form
1.How to Install will_paginate
the simple method
gem install mislav-will_paginate

There are some other method you can find it here.

2.Example

In controller
@gallery=Gallery.find(:all,:order=>”position asc”).paginate :page => page,:per_page=>10

where :per_page passes the number of gallery you want to display.You can change it according to your need 1-100
will_paginate defines it to be 30 by default

In View

you can simply use

<%= will_paginate @gallery %>
some advanced …

<% if @gallery.previous_page %>
<%= will_paginate @gallery,:page_links=>false, :next_label => “”, :prev_label => image_tag(“/images/icon/arrow.png”, :border => “0″) %>
<% end %>

<% if @gallery.next_page %>
<%= will_paginate @gallery,:page_links=>false, :next_label => image_tag(“/images/icon/arrow.png”,, :border => “0″), :prev_label => “” %>
<% end %>

If we put page_links=>false then it won’t display 1,2,3… and next_label and prev_label => “” as null it won’t display Next and Prev

Ryan Bates made an awesome screencast check it out here

written by admin