Simple process to get work.
Wordpress application run in another host or another url.
Wordpress will configure all the paths in database only, ex: when you upload any image, its absolute path stored in database. And all content will reside in wp-content folder.
New host
1. First install new wordpress in new host
Old host
2. Take mysql backup from old site. or goto Tools -> Import in wp-admin.
This should be used later for running old application
Old host
3.
Login admin panel of old site, Goto settings -> General
change WordPress address (URL) and Blog address (URL) against new host and click "Save Changes"
Now the database will updated with new host urls.
4. Old host
Goto phpmyadmin and export the database or goto Tools -> Export in wp-admin.
5. Old host
Revert back the database with old one, i.e we took backup on step-2.
New host
6. Import the old application's database which we get from step 4.
New host
7. Copy the wp-content folder from old host and pasted it into new host.
Now, upon completion of these steps we can sucessfully run the same application in both the hosts.
( OR )
You can copy all the files from old server and pasted it in new server and follow below process.
wp-config.php is the main configuration file for database connections and others.
Edit wp-config.php file to suit with your database
//DB_USER etc.,
Open database goto wp_options table and change the below two rows
option_value='your-new-url' where option_name='site url' and
option_value='your-new-url' where option_name='home'.
If you didn't change this siteurl value in this table your site will connect to old site when you try to access admin panel.
After done, goto /wp-admin section through browser and enter admin details.
Then goto Settings -> General -> change urls.
Now site configured and worked properly in new server or localhost.
In database replace every occurance of http://oldserver/wp-content links with http://newserver/wp-content. So that image links are worked currectly.
Some settings are fixed in wp-settings.php file.
Complete Reference
http://www.dollarshower.com/move-wordpress-blog-to-another-host-server/
http://support.hostgator.com/articles/pre-sales-questions/how-to-transfer-your-wordpress-blog-from-one-host-to-another-host
http://www.makeuseof.com/tag/move-wordpress-blog-host/
Custom fields in wordpress
http://codex.wordpress.org/Using_Custom_Fields
Friday, June 18, 2010
Move Wordpress to another host
http://www.dollarshower.com/move-wordpress-blog-to-another-host-server/
http://support.hostgator.com/articles/pre-sales-questions/how-to-transfer-your-wordpress-blog-from-one-host-to-another-host
http://www.makeuseof.com/tag/move-wordpress-blog-host/
Bigdump used to import large databases
http://www.ozerov.de/bigdump.php
http://support.hostgator.com/articles/pre-sales-questions/how-to-transfer-your-wordpress-blog-from-one-host-to-another-host
http://www.makeuseof.com/tag/move-wordpress-blog-host/
Bigdump used to import large databases
http://www.ozerov.de/bigdump.php
Monday, May 24, 2010
About Rails Framework
Rails is a web-application and persistence framework that includes everything
needed to create database-backed web-applications according to the
Model-View-Control pattern of separation. This pattern splits the view (also
called the presentation) into "dumb" templates that are primarily responsible
for inserting pre-built data in between HTML tags. The model contains the
"smart" domain objects (such as Account, Product, Person, Post) that holds all
the business logic and knows how to persist themselves to a database. The
controller handles the incoming requests (such as Save New Account, Update
Product, Show Post) by manipulating the model and directing data to the view.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in
link:files/vendor/rails/activerecord/README.html.
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
Rails. You can read more about Action Pack in
link:files/vendor/rails/actionpack/README.html.
== Getting Started
1. At the command prompt, start a new Rails application using the rails command
and your application name. Ex: rails myapp
(If you've downloaded Rails in a complete tgz or zip, this step is already done)
2. Change directory into myapp and start the web server: script/server (run with --help for options)
3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
4. Follow the guidelines to start developing your application
== Web Servers
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
that you can always get up and running quickly.
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
getting up and running with mongrel is as easy as: gem install mongrel.
More info at: http://mongrel.rubyforge.org
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
Mongrel and WEBrick and also suited for production use, but requires additional
installation and currently only works well on OS X/Unix (Windows users are encouraged
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
http://www.lighttpd.net.
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
for production.
But of course its also possible to run Rails on any platform that supports FCGI.
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
== Debugging Rails
Sometimes your application goes wrong. Fortunately there are a lot of tools that
will help you debug it and get it back on the rails.
First area to check is the application log files. Have "tail -f" commands running
on the server.log and development.log. Rails will automatically display debugging
and runtime information to these files. Debugging info will also be shown in the
browser on requests from 127.0.0.1.
You can also log your own messages directly into the log file from your code using
the Ruby logger class from inside your controllers. Example:
class WeblogController < ActionController::Base
def destroy
@weblog = Weblog.find(params[:id])
@weblog.destroy
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
end
end
The result will be a message in your log file along the lines of:
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
More information on how to use the logger is at http://www.ruby-doc.org/core/
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
These two online (and free) books will bring you up to speed on the Ruby language
and also on programming in general.
== Debugger
Debugger support is available through the debugger command when you start your Mongrel or
Webrick server with --debugger. This means that you can break out of execution at any point
in the code, investigate and change the model, AND then resume execution! Example:
class WeblogController < ActionController::Base
def index
@posts = Post.find(:all)
debugger
end
end
So the controller will accept the action, run the first line, then present you
with a IRB prompt in the server window. Here you can do things like:
>> @posts.inspect
=> "[#nil, \"body\"=>nil, \"id\"=>\"1\"}>,
#\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
>> @posts.first.title = "hello from a debugger"
=> "hello from a debugger"
...and even better is that you can examine how your runtime objects actually work:
>> f = @posts.first
=> #nil, "body"=>nil, "id"=>"1"}>
>> f.
Display all 152 possibilities? (y or n)
Finally, when you're ready to resume execution, you enter "cont"
== Console
You can interact with the domain model by starting the console through script/console.
Here you'll have all parts of the application configured, just like it is when the
application is running. You can inspect domain models, change values, and save to the
database. Starting the script without arguments will launch it in the development environment.
Passing an argument will specify a different environment, like script/console production.
To reload your controllers and models after launching the console run reload!
== Description of Contents
app
Holds all the code that's specific to this particular application.
app/controllers
Holds controllers that should be named like weblogs_controller.rb for
automated URL mapping. All controllers should descend from ApplicationController
which itself descends from ActionController::Base.
app/models
Holds models that should be named like post.rb.
Most models will descend from ActiveRecord::Base.
app/views
Holds the template files for the view that should be named like
weblogs/index.erb for the WeblogsController#index action. All views use eRuby
syntax.
app/views/layouts
Holds the template files for layouts to be used with views. This models the common
header/footer method of wrapping views. In your views, define a layout using the
layout :default and create a file named default.erb. Inside default.erb,
call <% yield %> to render the view using this layout.
app/helpers
Holds view helpers that should be named like weblogs_helper.rb. These are generated
for you automatically when using script/generate for controllers. Helpers can be used to
wrap functionality for your views into methods.
config
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
db
Contains the database schema in schema.rb. db/migrate contains all
the sequence of Migrations for your schema.
doc
This directory is where your application documentation will be stored when generated
using rake doc:app
lib
Application specific libraries. Basically, any kind of custom code that doesn't
belong under controllers, models, or helpers. This directory is in the load path.
public
The directory available for the web server. Contains subdirectories for images, stylesheets,
and javascripts. Also contains the dispatchers and the default HTML files. This should be
set as the DOCUMENT_ROOT of your web server.
script
Helper scripts for automation and generation.
test
Unit and functional tests along with fixtures. When using the script/generate scripts, template
test files will be generated for you and placed in this directory.
vendor
External libraries that the application depends on. Also includes the plugins subdirectory.
This directory is in the load path.
needed to create database-backed web-applications according to the
Model-View-Control pattern of separation. This pattern splits the view (also
called the presentation) into "dumb" templates that are primarily responsible
for inserting pre-built data in between HTML tags. The model contains the
"smart" domain objects (such as Account, Product, Person, Post) that holds all
the business logic and knows how to persist themselves to a database. The
controller handles the incoming requests (such as Save New Account, Update
Product, Show Post) by manipulating the model and directing data to the view.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in
link:files/vendor/rails/activerecord/README.html.
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
Rails. You can read more about Action Pack in
link:files/vendor/rails/actionpack/README.html.
== Getting Started
1. At the command prompt, start a new Rails application using the rails command
and your application name. Ex: rails myapp
(If you've downloaded Rails in a complete tgz or zip, this step is already done)
2. Change directory into myapp and start the web server: script/server (run with --help for options)
3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
4. Follow the guidelines to start developing your application
== Web Servers
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
that you can always get up and running quickly.
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
getting up and running with mongrel is as easy as: gem install mongrel.
More info at: http://mongrel.rubyforge.org
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
Mongrel and WEBrick and also suited for production use, but requires additional
installation and currently only works well on OS X/Unix (Windows users are encouraged
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
http://www.lighttpd.net.
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
for production.
But of course its also possible to run Rails on any platform that supports FCGI.
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
== Debugging Rails
Sometimes your application goes wrong. Fortunately there are a lot of tools that
will help you debug it and get it back on the rails.
First area to check is the application log files. Have "tail -f" commands running
on the server.log and development.log. Rails will automatically display debugging
and runtime information to these files. Debugging info will also be shown in the
browser on requests from 127.0.0.1.
You can also log your own messages directly into the log file from your code using
the Ruby logger class from inside your controllers. Example:
class WeblogController < ActionController::Base
def destroy
@weblog = Weblog.find(params[:id])
@weblog.destroy
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
end
end
The result will be a message in your log file along the lines of:
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
More information on how to use the logger is at http://www.ruby-doc.org/core/
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
These two online (and free) books will bring you up to speed on the Ruby language
and also on programming in general.
== Debugger
Debugger support is available through the debugger command when you start your Mongrel or
Webrick server with --debugger. This means that you can break out of execution at any point
in the code, investigate and change the model, AND then resume execution! Example:
class WeblogController < ActionController::Base
def index
@posts = Post.find(:all)
debugger
end
end
So the controller will accept the action, run the first line, then present you
with a IRB prompt in the server window. Here you can do things like:
>> @posts.inspect
=> "[#
#
>> @posts.first.title = "hello from a debugger"
=> "hello from a debugger"
...and even better is that you can examine how your runtime objects actually work:
>> f = @posts.first
=> #
>> f.
Display all 152 possibilities? (y or n)
Finally, when you're ready to resume execution, you enter "cont"
== Console
You can interact with the domain model by starting the console through script/console.
Here you'll have all parts of the application configured, just like it is when the
application is running. You can inspect domain models, change values, and save to the
database. Starting the script without arguments will launch it in the development environment.
Passing an argument will specify a different environment, like script/console production.
To reload your controllers and models after launching the console run reload!
== Description of Contents
app
Holds all the code that's specific to this particular application.
app/controllers
Holds controllers that should be named like weblogs_controller.rb for
automated URL mapping. All controllers should descend from ApplicationController
which itself descends from ActionController::Base.
app/models
Holds models that should be named like post.rb.
Most models will descend from ActiveRecord::Base.
app/views
Holds the template files for the view that should be named like
weblogs/index.erb for the WeblogsController#index action. All views use eRuby
syntax.
app/views/layouts
Holds the template files for layouts to be used with views. This models the common
header/footer method of wrapping views. In your views, define a layout using the
layout :default and create a file named default.erb. Inside default.erb,
call <% yield %> to render the view using this layout.
app/helpers
Holds view helpers that should be named like weblogs_helper.rb. These are generated
for you automatically when using script/generate for controllers. Helpers can be used to
wrap functionality for your views into methods.
config
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
db
Contains the database schema in schema.rb. db/migrate contains all
the sequence of Migrations for your schema.
doc
This directory is where your application documentation will be stored when generated
using rake doc:app
lib
Application specific libraries. Basically, any kind of custom code that doesn't
belong under controllers, models, or helpers. This directory is in the load path.
public
The directory available for the web server. Contains subdirectories for images, stylesheets,
and javascripts. Also contains the dispatchers and the default HTML files. This should be
set as the DOCUMENT_ROOT of your web server.
script
Helper scripts for automation and generation.
test
Unit and functional tests along with fixtures. When using the script/generate scripts, template
test files will be generated for you and placed in this directory.
vendor
External libraries that the application depends on. Also includes the plugins subdirectory.
This directory is in the load path.
Monday, May 17, 2010
Free hosting for php mysql applications
Free hosting for php,mysql applications with no ads, no hidden charges. Provides control panel. cpanel and FTP etc.,
http://www.000webhost.com/307968.html
http://www.000webhost.com/307968.html
Thursday, May 13, 2010
Different styles for each post in wordpress
Use below process to set different styles for different posts
$postid=$post->ID;
if($postid == 88)
{
$newclass = 'some-css-class-name';
}
h3 class="<= $newclass;?>" > $the_title /h3
$postid=$post->ID;
if($postid == 88)
{
$newclass = 'some-css-class-name';
}
h3 class="<= $newclass;?>" > $the_title /h3
Monday, May 10, 2010
Usefull URLs
Pro drupal book
http://rapidshare.com/files/195879972/pro-drupal-development.pdf
Git on windows
http://kylecordes.com/2008/04/30/git-windows-go/
30+ Applications for doing business on facebook
http://mashable.com/2009/01/22/business-facebook-apps/
Rails automatically detect users geolocation
http://github.com/parolkar/geo_mere_laal
Wordpress Plugin Development
http://www.problogdesign.com/wordpress/a-novice-guide-to-wordpress-plugin-development/
*** Strengths of PHP
http://www.slideshare.net/ijansch/enterprise-php-288851
Search companies
http://www.naukri2000.com/careers/searchemp.php3
http://rapidshare.com/files/195879972/pro-drupal-development.pdf
Git on windows
http://kylecordes.com/2008/04/30/git-windows-go/
30+ Applications for doing business on facebook
http://mashable.com/2009/01/22/business-facebook-apps/
Rails automatically detect users geolocation
http://github.com/parolkar/geo_mere_laal
Wordpress Plugin Development
http://www.problogdesign.com/wordpress/a-novice-guide-to-wordpress-plugin-development/
*** Strengths of PHP
http://www.slideshare.net/ijansch/enterprise-php-288851
Search companies
http://www.naukri2000.com/careers/searchemp.php3
Friday, May 7, 2010
Images websites and blogs
http://wallpapers99.com
http://wallpapers123.blogspot.com
http://www.imagesbazaar.com
http://www.corbis.com
http://wallpapers123.blogspot.com
http://www.imagesbazaar.com
http://www.corbis.com
Tuesday, May 4, 2010
Get results by taking user defined starting id
Below query fetched the results as firt row with id 36
SELECT * from users where uid=36 union SELECT * from users where uid!=36
SELECT * from users where uid=36 union SELECT * from users where uid!=36
Custom page background for each post in Wordpress
Hi,
You can have custom background for each post in word press by using a plugin. Find the plugin info at below url.
ttp://www.blogtap.net/the-custom-post-background-wordpress-plugin/
You can have custom background for each post in word press by using a plugin. Find the plugin info at below url.
ttp://www.blogtap.net/the-custom-post-background-wordpress-plugin/
Friday, April 30, 2010
Display images as options in select box
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
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
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/
Subscribe to:
Posts (Atom)