styles
option.imagebacked {
padding: 0px 60px 65px; /* 60px and 65px are the images width and heigh values */
background-repeat: no-repeat;
/* background-position: 0px 60px 65px; */
vertical-align: middle;
}
<select name="issuetype" id="issuetype" style="height: 20px;">
<option value="1" class="imagebacked" style="background-image: url(http://ecx.images-amazon.com/images/I/51xW5d95RjL._SL75_.jpg);"> Bug </option>
<option value="2" class="imagebacked" style="background-image: url(http://ecx.images-amazon.com/images/I/51joflCZefL._SL75_.jpg);"> New Feature </option>
</select>
Reference
http://technology.amis.nl/blog/994/html-select-item-with-icons-in-addition-to-just-text-labels-applying-the-css-background-style-to-the-html-option-element
Friday, April 30, 2010
List of heroku commands
Hi,
Below are the list of available list of heroku commands
help # show this usage
version # show the gem version
list # list your apps
create [] # create a new app
keys # show your user's public keys
keys:add [] # add a public key
keys:remove # remove a key by name (user@host)
keys:clear # remove all keys
info # show app info, like web url and
open # open the app in a web browser
rename # rename the app
dynos # scale to qty web processes
workers # scale to qty background processe
sharing:add # add a collaborator
sharing:remove # remove a collaborator
sharing:transfer # transfers the app ownership
domains:add # add a custom domain name
domains:remove # remove a custom domain name
domains:clear # remove all custom domains
ssl:add # add SSL cert to the app
ssl:remove # removes SSL cert from the app do
rake # remotely execute a rake command
console # remotely execute a single consol
console # start an interactive console to
restart # restart app servers
logs # fetch recent log output for debu
logs:cron # fetch cron log output
maintenance:on # put the app into maintenance mod
maintenance:off # take the app out of maintenance
config # display the app's config vars (e
config:add key=val [...] # add one or more config vars
config:remove key [...] # remove one or more config vars
config:clear # clear user-set vars and reset to
stack # show current stack and list of a
stack:migrate # prepare migration of this app to
db:pull [] # pull the app's database into a l
db:push [] # push a local database into the a
ase
db:reset # reset the database for the app
bundles # list bundles for the app
bundles:capture [] # capture a bundle of the app's co
bundles:download # download most recent app bundle
bundles:download # download the named bundle
bundles:animate # animate a bundle into a new app
bundles:destroy # destroy the named bundle
addons # list installed addons
addons:info # list all available addons
addons:add name [key=value] # install addon (with zero or more
addons:remove name # uninstall an addons
addons:clear # uninstall all addons
destroy # destroy the app permanently
=== Plugins
plugins # list installed plugins
plugins:install # install the plugin from the spec
plugins:uninstall # remove the specified plugin
=== Example:
rails myapp
cd myapp
git init
git add .
git commit -m "my new app"
heroku create
git push heroku master
Below are the list of available list of heroku commands
help # show this usage
version # show the gem version
list # list your apps
create [
keys # show your user's public keys
keys:add [
keys:remove
keys:clear # remove all keys
info # show app info, like web url and
open # open the app in a web browser
rename
dynos
workers
sharing:add
sharing:remove
sharing:transfer
domains:add
domains:remove
domains:clear # remove all custom domains
ssl:add
ssl:remove
rake
console
console # start an interactive console to
restart # restart app servers
logs # fetch recent log output for debu
logs:cron # fetch cron log output
maintenance:on # put the app into maintenance mod
maintenance:off # take the app out of maintenance
config # display the app's config vars (e
config:add key=val [...] # add one or more config vars
config:remove key [...] # remove one or more config vars
config:clear # clear user-set vars and reset to
stack # show current stack and list of a
stack:migrate # prepare migration of this app to
db:pull [
db:push [
ase
db:reset # reset the database for the app
bundles # list bundles for the app
bundles:capture [
bundles:download # download most recent app bundle
bundles:download
bundles:animate
bundles:destroy
addons # list installed addons
addons:info # list all available addons
addons:add name [key=value] # install addon (with zero or more
addons:remove name # uninstall an addons
addons:clear # uninstall all addons
destroy # destroy the app permanently
=== Plugins
plugins # list installed plugins
plugins:install
plugins:uninstall
=== Example:
rails myapp
cd myapp
git init
git add .
git commit -m "my new app"
heroku create
git push heroku master
Thursday, April 29, 2010
Rails application deployment with heroku
Install git
Generate RSA public and Private keys in your system
Required Gems
Heroko
Taps - By default heroku uses postgreSQL as the database, so use this gem to convert your database from mysql to postgresql.
First create an account in heroku.com website.
Open terminal and CD to the application you want to deploy
#git init
#git add .
#git commit -m 'First submit'
Till now one empty git repository (.git) created in your local application folder and save the changes in the local repository.
#heroku create appname
It will ask you the email and password which you have already signup in heroku.com and create the appname in heroku as subdomain. i.e appname.heroku.com
#git push heroku master
This command will transfer all your files from local repo to the heroku application.
Process for Database Push and Pull
#heroku rake db:migrate
This will migrate all your local db to heroku, Make sure to maintain migrations clearly
#heroku rake db:push
Sometimes you may face many problems in db migrations, so take care of db migrations. If you face problems, just us heroku db:push without heroku rake db:migrate.
#Other commands
#heroku db:pull
to pull the db from heroku
#heroku db:open
to c all heroku commands
Repeate the above process when you change any modification to the files.
Generate RSA public and Private keys in your system
Required Gems
Heroko
Taps - By default heroku uses postgreSQL as the database, so use this gem to convert your database from mysql to postgresql.
First create an account in heroku.com website.
Open terminal and CD to the application you want to deploy
#git init
#git add .
#git commit -m 'First submit'
Till now one empty git repository (.git) created in your local application folder and save the changes in the local repository.
#heroku create appname
It will ask you the email and password which you have already signup in heroku.com and create the appname in heroku as subdomain. i.e appname.heroku.com
#git push heroku master
This command will transfer all your files from local repo to the heroku application.
Process for Database Push and Pull
#heroku rake db:migrate
This will migrate all your local db to heroku, Make sure to maintain migrations clearly
#heroku rake db:push
Sometimes you may face many problems in db migrations, so take care of db migrations. If you face problems, just us heroku db:push without heroku rake db:migrate.
#Other commands
#heroku db:pull
to pull the db from heroku
#heroku db:open
to c all heroku commands
Repeate the above process when you change any modification to the files.
MYD files in mysql/data/database folder are not shown in database
Hi,
When you copy the database from c:/appserv/mysql/data/ folder instead export from phpmyadmin, and paste the copied database in some other system in c:/appserv/mysql/data/ folder, some times it might not work properly, it creates the database in the phpmyamdin but tables are not shown in that db. Solution for this problem is make sure the folder in c:/appserv/mysql/data/ is writeble and executable, Provide full permissions to this folder to the user who uses the phpmyadmin.
When you copy the database from c:/appserv/mysql/data/ folder instead export from phpmyadmin, and paste the copied database in some other system in c:/appserv/mysql/data/ folder, some times it might not work properly, it creates the database in the phpmyamdin but tables are not shown in that db. Solution for this problem is make sure the folder in c:/appserv/mysql/data/ is writeble and executable, Provide full permissions to this folder to the user who uses the phpmyadmin.
Linux SSH Error - Remote host identification changed
Hi all,
when I try to connect to my remote host through ssh, it throws an error called Remote host identification is changed, below is the process for how can we get rid of this message.
The possible reasons for getting this error are:
If os and openssh in your system is reinstalled, or os or openssh is reinstalled in remote system.
You have assigned the IP address of one system to another system and trying to ssh.
You system is dual boot with different ssh keys in both flavors of linux.
You are using an IP for load balancing and trying to ssh to the same IP.
You generated new ssh keys for your system.
When you tries to login to a remote system through ssh, then the destination hosts provides it’s keys and asked whether these keys are trusted and then those keys are added to your trusted database(known_hosts file). Whenever you tries to login again to the same system, the received keys are checked against the keys available in your file and if both matches then the next step occurs, which is authentication. But if due to any of the above given reason, the keys doesn’t match, then you will get this error and won’t be able to login.
The solution for this problem is
Just remove the old key for remote host from your system's known_hosts file, So when you try to connect through ssh it will again ask you to store the key in the known_hosts file.
OR
Completely Remove keys from known_hosts file
To remove the old keys from the known_hosts file, we can use -R option. This option will remove all the obsolete/old keys from your file. This can be used like this:
# ssh-keygen -R
# ssh-keygen -R
The path for known_hosts file is
In linux
home/venkat(username)/.ssh folder
In windows
c:/documentes and settings/venkat
when I try to connect to my remote host through ssh, it throws an error called Remote host identification is changed, below is the process for how can we get rid of this message.
The possible reasons for getting this error are:
If os and openssh in your system is reinstalled, or os or openssh is reinstalled in remote system.
You have assigned the IP address of one system to another system and trying to ssh.
You system is dual boot with different ssh keys in both flavors of linux.
You are using an IP for load balancing and trying to ssh to the same IP.
You generated new ssh keys for your system.
When you tries to login to a remote system through ssh, then the destination hosts provides it’s keys and asked whether these keys are trusted and then those keys are added to your trusted database(known_hosts file). Whenever you tries to login again to the same system, the received keys are checked against the keys available in your file and if both matches then the next step occurs, which is authentication. But if due to any of the above given reason, the keys doesn’t match, then you will get this error and won’t be able to login.
The solution for this problem is
Just remove the old key for remote host from your system's known_hosts file, So when you try to connect through ssh it will again ask you to store the key in the known_hosts file.
OR
Completely Remove keys from known_hosts file
To remove the old keys from the known_hosts file, we can use -R option. This option will remove all the obsolete/old keys from your file. This can be used like this:
# ssh-keygen -R
# ssh-keygen -R
The path for known_hosts file is
In linux
home/venkat(username)/.ssh folder
In windows
c:/documentes and settings/venkat
Tuesday, April 27, 2010
Install and Remove RPM packages in linux
Install local rpm package
# rpm -ivh foo-2.0-4.i386.rpm
Install from remote host
# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm
# rpm -i http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Remove package
# rpm -e foo
To uninstall a RPM package. Note that we used the package name foo, not the name of the original package file foo-2.0-4.i386.rpm above
To upgrade
# rpm -Uvh foo-1.0-2.i386.rpm
# rpm -Uvh ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm
# rpm -Uvh http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
# rpm -ivh foo-2.0-4.i386.rpm
Install from remote host
# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm
# rpm -i http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Remove package
# rpm -e foo
To uninstall a RPM package. Note that we used the package name foo, not the name of the original package file foo-2.0-4.i386.rpm above
To upgrade
# rpm -Uvh foo-1.0-2.i386.rpm
# rpm -Uvh ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm
# rpm -Uvh http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm
Wordpress usefull URLs
Function reference
http://codex.wordpress.org/Function_Reference/wpdb_Class#INSERT_rows
Beginner guide
http://www.wpbeginner.com/wp-tutorials/useful-wordpress-configuration-tricks-that-you-may-not-know/
Custom fileds
http://millionclues.com/problogging/wordpress-tips/wordpress-custom-fields-tutorial-for-total-newbie/
Featured Gallery
http://www.featuredcontentgallery.com/
http://millionclues.com/problogging/wordpress-tips/custom-image-and-link-for-each-post-using-custom-fields/
Custom fileds
http://codex.wordpress.org/Using_Custom_Fields
Custom fileds
http://perishablepress.com/press/2008/12/17/wordpress-custom-fields-tutorial/
Top 10 galleries
http://techpp.com/2009/06/18/top-10-wordpress-gallery-plugins/
Galleries
http://codex.wordpress.org/Photoblogs_and_Galleries
http://smartboydesigns.com/2009/05/08/7-superb-wordpress-photo-gallery-plugins/
http://en.support.wordpress.com/images/gallery/
Themes
http://themeforest.net/
Resources
http://erkcm.wordpress.com/2010/03/29/300-resources-to-help-you-master-wordpress/
http://codex.wordpress.org/Function_Reference/wpdb_Class#INSERT_rows
Beginner guide
http://www.wpbeginner.com/wp-tutorials/useful-wordpress-configuration-tricks-that-you-may-not-know/
Custom fileds
http://millionclues.com/problogging/wordpress-tips/wordpress-custom-fields-tutorial-for-total-newbie/
Featured Gallery
http://www.featuredcontentgallery.com/
http://millionclues.com/problogging/wordpress-tips/custom-image-and-link-for-each-post-using-custom-fields/
Custom fileds
http://codex.wordpress.org/Using_Custom_Fields
Custom fileds
http://perishablepress.com/press/2008/12/17/wordpress-custom-fields-tutorial/
Top 10 galleries
http://techpp.com/2009/06/18/top-10-wordpress-gallery-plugins/
Galleries
http://codex.wordpress.org/Photoblogs_and_Galleries
http://smartboydesigns.com/2009/05/08/7-superb-wordpress-photo-gallery-plugins/
http://en.support.wordpress.com/images/gallery/
Themes
http://themeforest.net/
Resources
http://erkcm.wordpress.com/2010/03/29/300-resources-to-help-you-master-wordpress/
Friday, April 23, 2010
Clear history in linux
Hi,
When you connect to remote host using shell, then make sure to clear the history before you logout.
#command to clear the history is
history -c && rm -f ~/.bash_history
#Shell commands ref:
http://www.blogger.com/publish-confirmation.g?blogID=6810438578552048741&postID=843161968983163768×tamp=1272031182981&javascriptEnabled=true
When you connect to remote host using shell, then make sure to clear the history before you logout.
#command to clear the history is
history -c && rm -f ~/.bash_history
#Shell commands ref:
http://www.blogger.com/publish-confirmation.g?blogID=6810438578552048741&postID=843161968983163768×tamp=1272031182981&javascriptEnabled=true
Tuesday, April 20, 2010
Get full url with http or https protocol
/**
*
* @get the full url of page
*
* @return string
*
*/
function getAddress()
{
/*** check for https ***/
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
/*** return the full address ***/
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}
/*** example usage ***/
echo getAddress();
?>
Monday, April 19, 2010
Drupal Front Page with multiple views content
I have posted one topic regarding how to load the multiple views in to single page ie:page-front.tpl.php .
In this example you have to create view name Mobile_applications and with in this view you have to create two page views those ids page_1 and page_2.
Now you can call those views using the fallowing code in page.tpl.php
//This is used to display the view in a page
$viewName = 'Mobile_applications';
$output = views_embed_view($viewName,'page_1');
echo "
print $output;
$output1 = views_embed_view($viewName,'page_2');
echo "
print $output1;
?>
In this example you have to create view name Mobile_applications and with in this view you have to create two page views those ids page_1 and page_2.
Now you can call those views using the fallowing code in page.tpl.php
//This is used to display the view in a page
$viewName = 'Mobile_applications';
$output = views_embed_view($viewName,'page_1');
echo "
Applications for your phone
";print $output;
$output1 = views_embed_view($viewName,'page_2');
echo "
Top rated
";print $output1;
?>
Sunday, April 18, 2010
Center your block vertically using css
http://blog.themeforest.net/tutorials/vertical-centering-with-css/
Drupal display taxonomy terms for particular vocabulary
$vid = 3; /* <---- put correct vocabulary ID here */
$terms = taxonomy_get_tree($vid); /* need code from below to handle nesting */
print "
- ";
- ".l($term->name .' ('. $count .')', "taxonomy/term/$term->tid") ." ";//this creates a link to the term
foreach ( $terms as $term ) {
$count = db_result(db_query("SELECT DISTINCT COUNT(nid) FROM {term_node} WHERE tid = %d ", $term->tid));
if ($count) { /* don't show terms with 0 count */
print "
}
} /* end foreach */
print "
?>
Friday, April 16, 2010
Change date format in excel sheet
Hi,
I always prepare my documents in excel and i like it. I faced the problem when entering dates in the column, those are always formated to mm/dd/yy format even i entered in whatever format.
The solution i got is : Select formtat cells -> numbers -> date -> select custom format
I always prepare my documents in excel and i like it. I faced the problem when entering dates in the column, those are always formated to mm/dd/yy format even i entered in whatever format.
The solution i got is : Select formtat cells -> numbers -> date -> select custom format
Drupal load block content in any page
To Load block content in any page use below code in drupal
$blockView = module_invoke(, 'block', 'view', );
print($blockView['content']);
Where modulename is the type of the block, i.e you can create blocks in different ways like using views module, using taxonomyblock module etc. and delta is the numeric id of the block.
Example: below is the code to call a block which was generated using taxonomymenu block module.
$blockView = module_invoke('taxonomyblocks', 'block', 'view', 2);
print($blockView['content']);
?>
Display blocks based on some content types
$match = FALSE;
// block is visible on the content types entered here
$types = array('story' => 1, 'page' => 1);
$url = request_uri();
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));
$match = isset($types[$node->type]);
}
// block is invisible on URLs entered here
if (strpos($url, "edit")) {
$match = FALSE;
}
// copy paste these for additional URLs
if (strpos($url, "admin")) {
$match = FALSE;
}
return $match;
?>
Reference
http://drupal.org/node/26502
http://drupal.org/node/345361
$blockView = module_invoke(
print($blockView['content']);
Where modulename is the type of the block, i.e you can create blocks in different ways like using views module, using taxonomyblock module etc. and delta is the numeric id of the block.
Example: below is the code to call a block which was generated using taxonomymenu block module.
$blockView = module_invoke('taxonomyblocks', 'block', 'view', 2);
print($blockView['content']);
?>
Display blocks based on some content types
$match = FALSE;
// block is visible on the content types entered here
$types = array('story' => 1, 'page' => 1);
$url = request_uri();
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));
$match = isset($types[$node->type]);
}
// block is invisible on URLs entered here
if (strpos($url, "edit")) {
$match = FALSE;
}
// copy paste these for additional URLs
if (strpos($url, "admin")) {
$match = FALSE;
}
return $match;
?>
Reference
http://drupal.org/node/26502
http://drupal.org/node/345361
Thursday, April 15, 2010
Secure files transfer through SSH
http://www.unixwiz.net/techtips/putty-openssh.html
http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/ed0d3f0199e49f57ca25734000023a77?OpenDocument
Some times you need to login two hosts.
First login:
ssh pete2@stickerguy.net
password:
su
root password:
Next server
ssh stickerguy@web2.greatbasin.net -p 2222
password:
Now you connected two hosting servers and you are in second server. To come out of second server press exit.
The below command will copy the first server files to second server.
scp -r pete2@stickerguy.net:/usr/local/lib/php/Services/ ./Services/
http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/ed0d3f0199e49f57ca25734000023a77?OpenDocument
Some times you need to login two hosts.
First login:
ssh pete2@stickerguy.net
password:
su
root password:
Next server
ssh stickerguy@web2.greatbasin.net -p 2222
password:
Now you connected two hosting servers and you are in second server. To come out of second server press exit.
The below command will copy the first server files to second server.
scp -r pete2@stickerguy.net:/usr/local/lib/php/Services/ ./Services/
Wednesday, April 14, 2010
Drupal get term details for particular node you are viewing
$terms = taxonomy_node_get_terms($node);
print_r($terms);
print_r($terms);
Monday, April 12, 2010
Make will_paginate as ajax pagination
Add below code in your public/javascripts/application.js
document.observe("dom:loaded", function() {
// the element in which we will observe all clicks and capture
// ones originating from pagination links
var container = $(document.body)
if (container) {
var img = new Image
img.src = '/images/spinner.gif'
function createSpinner() {
return new Element('img', { src: img.src, 'class': 'spinner' })
}
container.observe('click', function(e) {
if (e.element().match('img'))
var el = e.element().ancestors()[0]
else
var el = e.element()
if (el.match('.pagination a')) {
el.up('.pagination').insert(createSpinner())
new Ajax.Request(el.href, { method: 'get' })
e.stop()
}
})
}
})
In app/controllers/controller.rb file add below
def product
@similar_products = Product.paginate(:per_page => 4,:page=>params[:similar_products_page],:conditions => ["shopping_category_id = ? and id != ?", @product.shopping_category_id, @product.id])
@featureproduct = Product.paginate(:per_page =>1, :page=>params[:featureproduct_page], :conditions => ["featured = ? and id != ?", 1, @product.id], :order=>'rand()', :limit => 3)
if params[:similar_products_page]
respond_to do |format|
#format.html
format.js {
render :update do |page|
# 'page.replace' will replace full "results" block...works for this example
# 'page.replace_html' will replace "results" inner html...useful elsewhere
page.replace_html 'related', :partial => 'related_products'
end
}
end
end
if params[:featureproduct_page]
respond_to do |format|
#format.html
format.js {
render :update do |page|
# 'page.replace' will replace full "results" block...works for this example
# 'page.replace_html' will replace "results" inner html...useful elsewhere
page.replace_html 'featured', :partial => 'product_featured'
end
}
end
end
In app/views/products/_product_featured.rb
<%= will_paginate @featureproduct, :param_name => 'featureproduct_page', :prev_label => image_tag('shopping/left_arrow.jpg'), :next_label => image_tag('shopping/right_arrow.jpg'), :page_links=>false%>
In app/views/products/_related_products.rb
<%= will_paginate @similar_products,:param_name => 'similar_products_page' %>
Now your pagination become ajax.
document.observe("dom:loaded", function() {
// the element in which we will observe all clicks and capture
// ones originating from pagination links
var container = $(document.body)
if (container) {
var img = new Image
img.src = '/images/spinner.gif'
function createSpinner() {
return new Element('img', { src: img.src, 'class': 'spinner' })
}
container.observe('click', function(e) {
if (e.element().match('img'))
var el = e.element().ancestors()[0]
else
var el = e.element()
if (el.match('.pagination a')) {
el.up('.pagination').insert(createSpinner())
new Ajax.Request(el.href, { method: 'get' })
e.stop()
}
})
}
})
In app/controllers/controller.rb file add below
def product
@similar_products = Product.paginate(:per_page => 4,:page=>params[:similar_products_page],:conditions => ["shopping_category_id = ? and id != ?", @product.shopping_category_id, @product.id])
@featureproduct = Product.paginate(:per_page =>1, :page=>params[:featureproduct_page], :conditions => ["featured = ? and id != ?", 1, @product.id], :order=>'rand()', :limit => 3)
if params[:similar_products_page]
respond_to do |format|
#format.html
format.js {
render :update do |page|
# 'page.replace' will replace full "results" block...works for this example
# 'page.replace_html' will replace "results" inner html...useful elsewhere
page.replace_html 'related', :partial => 'related_products'
end
}
end
end
if params[:featureproduct_page]
respond_to do |format|
#format.html
format.js {
render :update do |page|
# 'page.replace' will replace full "results" block...works for this example
# 'page.replace_html' will replace "results" inner html...useful elsewhere
page.replace_html 'featured', :partial => 'product_featured'
end
}
end
end
In app/views/products/_product_featured.rb
<%= will_paginate @featureproduct, :param_name => 'featureproduct_page', :prev_label => image_tag('shopping/left_arrow.jpg'), :next_label => image_tag('shopping/right_arrow.jpg'), :page_links=>false%>
In app/views/products/_related_products.rb
<%= will_paginate @similar_products,:param_name => 'similar_products_page' %>
Now your pagination become ajax.
Multiple paginations in single page using will paginate
If you want to display multiple paginations in a single page then you have to change the detault page parameter. to change the default :page => params[:page] use below process
In controller add below
@featured = Product.paginate(:page => params[:featured_page])
@related = Product.paginate(:page => params[:related_page])
In view add below
<%= will_paginate @featured, :param_name => 'featured_page' %>
<%= will_paginate @related, :param_name => 'related_page' %>
In controller add below
@featured = Product.paginate(:page => params[:featured_page])
@related = Product.paginate(:page => params[:related_page])
In view add below
<%= will_paginate @featured, :param_name => 'featured_page' %>
<%= will_paginate @related, :param_name => 'related_page' %>
Saturday, April 3, 2010
Linux ssh Tips
Connect to ssh
You can connect to ssh using root@hostname.com If you have root access
If you dont have root access then do as below
1. First login ssh user@host1.com
2. su
3. Password: root password
After you login to host1's root.
then ssh user@host2.com -p 2222
host2password :
Now you logged into host2 from host1's root.
To come out to host1. use exit.
stickerguy@web2.greatbasin.net
locate is the command to search any folder or files.
You can connect to ssh using root@hostname.com If you have root access
If you dont have root access then do as below
1. First login ssh user@host1.com
2. su
3. Password: root password
After you login to host1's root.
then ssh user@host2.com -p 2222
host2password :
Now you logged into host2 from host1's root.
To come out to host1. use exit.
stickerguy@web2.greatbasin.net
locate is the command to search any folder or files.
Drupal usefull reference URLs
Usefull modules
Handbooks
http://drupal.org/handbooks
http://www.nicklewis.org/40-essential-drupal-6-modules
http://www.eadhoc.com/2010/03/drupal-terminology.html
Node auto term.It will create categories automatically when node contetn added.
http://www.facebook.com/note.php?note_id=196164430516
Node autotem
http://blog.adyax.com/2009/03/english-drupal-tutorial-node-auto-term-taxonomy-tips-and-jquery-menu-api-in-use/
Drupal 6
http://drupal.org/node/733182
Module functions
http://drupalcontrib.org/api/drupal/contributions--nat--nat.module/6
Taxonomy
http://drupal.org/node/2498
Reasons for why you use drupal
http://www.tajahdev.com/Resource/drupal.htm
15 Usefull views modules
http://ntt.cc/2009/01/28/15-userful-views-module-for-drupal.html
Views theming
http://www.packtpub.com/article/drupal-6-attachment-views-page-views-theming
http://realtech.burningbird.net/content-management/planet-drupal-entries/drupal-views-and-taxonomy-pages
http://zugec.com/drupal/theme-wizard-in-views-with-drupal-5
Advanced taxonomy term blocks
http://www.pixelclever.com/documentation-advanced-taxonomy-blocks-module-drupal-6
Views Help
http://views-help.doc.logrus.com/
http://drupal.org/node/59157
http://drupal.org/files/issues/nat-views-support-term-node-count_1.patch
Handbooks
http://drupal.org/handbooks
http://www.nicklewis.org/40-essential-drupal-6-modules
http://www.eadhoc.com/2010/03/drupal-terminology.html
Node auto term.It will create categories automatically when node contetn added.
http://www.facebook.com/note.php?note_id=196164430516
Node autotem
http://blog.adyax.com/2009/03/english-drupal-tutorial-node-auto-term-taxonomy-tips-and-jquery-menu-api-in-use/
Drupal 6
http://drupal.org/node/733182
Module functions
http://drupalcontrib.org/api/drupal/contributions--nat--nat.module/6
Taxonomy
http://drupal.org/node/2498
Reasons for why you use drupal
http://www.tajahdev.com/Resource/drupal.htm
15 Usefull views modules
http://ntt.cc/2009/01/28/15-userful-views-module-for-drupal.html
Views theming
http://www.packtpub.com/article/drupal-6-attachment-views-page-views-theming
http://realtech.burningbird.net/content-management/planet-drupal-entries/drupal-views-and-taxonomy-pages
http://zugec.com/drupal/theme-wizard-in-views-with-drupal-5
Advanced taxonomy term blocks
http://www.pixelclever.com/documentation-advanced-taxonomy-blocks-module-drupal-6
Views Help
http://views-help.doc.logrus.com/
http://drupal.org/node/59157
http://drupal.org/files/issues/nat-views-support-term-node-count_1.patch
Copying files from one host to another with scp command
Best Reference
http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/04eaff076bce249dca256fb6007f53e5?OpenDocument
Copy entire folder with all files and subfolders
user@user:~$ scp -r /var/www/localdir/ user@192.168.10.150:/var/www/
In windows
Putty and pscp are excellent tools for ssh and scp operations in windows os.
Download putty and pscp softwares from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
They are self executable files so no need to install those just place in some folder ex: c:\programfiles\putty folder and set the path in command prompt.
open command prompt (DOS Prompt)from start -> run -> cmd
set PATH=C:\path\to\putty\directory;%PATH%
So to copy the file /etc/hosts from the server example.com as user fred to the file c:\temp\example-hosts.txt, you would type:
pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt
To send (a) file(s) to a remote server:
pscp [options] source [source...] [user@]host:target
So to copy the local file c:\documents\foo.txt to the server example.com as user fred to the file /tmp/foo you would type:
pscp c:\documents\foo.txt fred@example.com:/tmp/foo
You can use wildcards to transfer multiple files in either direction, like this:
pscp c:\documents\*.doc fred@example.com:docfiles
pscp fred@example.com:source/*.c c:\source
Copy entire folder from remote server to local computer along with files and subfolders
pscp -r user@example.com:source/* c:\source
Ref : http://www.jfitz.com/tips/ssh_for_windows.html
http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/04eaff076bce249dca256fb6007f53e5?OpenDocument
Copy entire folder with all files and subfolders
user@user:~$ scp -r /var/www/localdir/ user@192.168.10.150:/var/www/
In windows
Putty and pscp are excellent tools for ssh and scp operations in windows os.
Download putty and pscp softwares from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
They are self executable files so no need to install those just place in some folder ex: c:\programfiles\putty folder and set the path in command prompt.
open command prompt (DOS Prompt)from start -> run -> cmd
set PATH=C:\path\to\putty\directory;%PATH%
So to copy the file /etc/hosts from the server example.com as user fred to the file c:\temp\example-hosts.txt, you would type:
pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt
To send (a) file(s) to a remote server:
pscp [options] source [source...] [user@]host:target
So to copy the local file c:\documents\foo.txt to the server example.com as user fred to the file /tmp/foo you would type:
pscp c:\documents\foo.txt fred@example.com:/tmp/foo
You can use wildcards to transfer multiple files in either direction, like this:
pscp c:\documents\*.doc fred@example.com:docfiles
pscp fred@example.com:source/*.c c:\source
Copy entire folder from remote server to local computer along with files and subfolders
pscp -r user@example.com:source/* c:\source
Ref : http://www.jfitz.com/tips/ssh_for_windows.html
Subscribe to:
Posts (Atom)