How to Install Mysql on Linux

Hi..to all today i’m going to tell the installation and basics of Mysql..

first we will see the installation steps..

For Linux user you have 3 choices to install..

1) Ubuntu software center

go to Applications and choose Ubuntu software center

Search Mysql in the searchbox and then click install to install the Mysql in our system.

2)By Terminal

open terminal

type this command  $ sudo apt-get install mysql

it will ask for your system password .type your password and it will install mysql in our system..

3)Synaptic Packet Manager

Go to system->Administration-> synaptic Packet manager

Search the mysql and click the box in the left side

Click the Apply in the above panel

while unpacking the mysql it will ask the password for mysql ..Give new password for the mysql(password to use  mysql).

Thats it …now we successfully installed mysql in our system…

To check whether the mysql is installed in our system..

open terminal and type

$ mysql -u root -p

Give your mysql password..it will go to mysql like this

Thats it…now start working on your queries ….thanks…

Display Time ,date ,Year in web page in rails

Hi ..to all ..today i’m going to tell how to display  time ,date,year in a web page in rails..

Its very simple..here are the steps…

Refer my previous post to create listing posts application in rails

I created application with name as myblog .

change to  $ cd /myblog

go to  myblog/app/views/home/index.erb

add this line <p> Its time now  <%= Time.now %></p>

now run the server by   $ rails server

open your browser and type http://localhost:3000

now you can see time and date and year in you web page like this..

Thanks …

Creating a sample application for creating,listing posts

Hi ..to all today i learned a how create listing, posting,deleting posts for a simple blog application..

$ rails new myblog

$ cd myblog

then we have change the normal welcome page of the ruby..to do this generate controller by

$ rails generate controller home index

now go to the file myblog/app/views/home/index.erb type this

<h1>Hello, Rails!</h1>

<%= link_to “My Blog” , posts_path %>

now go to /config/routes.db and do the following change in line

# You can have the root of your site routed with “root”

# just remember to delete public/index.html.

root :to => ‘home#index’

now delete default application page using command

$ rm public/index.html

now create scaffolding using the command

$ rails generate scaffold Post name:string title:string content:text

now run the create db and migrate command

$ rake db: create

$ rake db: migrate

now our application is ready with posts.

Start the server using

$ rails server

open your web browser and type in the address bar http://localhost:3000 now you can see the page like this after clicking the My blog link

Posts Index screenshot

Thanks to all…now you can create new posts and list the posts,edit,delete your posts..

Hello world in rails

hi..to all today we will see how to do hello world in rails

Create new application by open terminal and type the command as

$ rails new hello

$ cd hello

$ rails server

now all we need do is,change the welcome page to hello world , here are the following steps

create controller for our application using the command

$  rails generate controller home index

now go to app/views/home/index.html open with text editor and type

<h1>hello rails<h1>

save the file.

Setting the Application Home Page

Now we have to change the normal welcome board page to our hello world page

Open the config/routes.rb with text editor do the following change in root_to

  Hello::Application.routes.draw do
  # You can have the root of your site routed with “root”
  # just remember to delete public/index.html.
  root :to => ‘home#index’

finally open terminal and type the command as

$ rm public/index.html

now run the rails server page localhost:3000

Image

It shows hello rails.

Thats it.. thanks to all..

Java script error while running rails server

Hi..to all today i got javascript error while starting the rails server after creating a simple application.

This error is runtime error due to javascript

The solution to this problem is to install node.js in our system.

To install node.js in ubuntu do the following

Download the latest node.js file from node.js

after downloading extract that file using

tar xzvf node-v0.8.6.tar.gz

./configure

make install

now we successfully installed node.js in our system..now you can run the rails server using

rails server

it shows the starting of the server like this

/usr/local/lib/ruby/1.8/webrick/httpservlet/cgihandler.rb:20: Use RbConfig instead of obsolete and deprecated Config.
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-16 13:13:19] INFO WEBrick 1.3.1
[2012-08-16 13:13:19] INFO ruby 1.8.8 (2012-07-27) [i686-linux]
[2012-08-16 13:13:24] INFO WEBrick::HTTPServer#start: pid=2621 port=3000

now you can run the server in browser by run server

Thanks to all..

Getting started with ruby on rails

Hi ..to all today i learned how to create a simple ruby application ..

here are the steps

Open terminal and type

rails new my_app[application name] 

we can’t give any name as application name..since ruby has some inbuilt app name such as test,script..etc

after bundle is created in your system it shows bundle is successfully installed in our system .Then

change the directory to created application by

cd my_app

now we have to start the rails server ,to start rails server type the following command

rails server

 

now open your web browser and type the  following

http://localhost:3000

it will display the welcome page about your application environment like this in our system

 

Image

Thanks to all..

Install- Ruby- on -Rails in ubuntu 10.04

Hi..to all yesterday i had  learnt to install ruby on rails in ubuntu..

here are the following steps.

Before installing rails make sure ruby is installed in your system.To check whether ruby installed in your system Open terminal and type

$ ruby -v

ruby 1.8.8dev (2012-07-27) [i686-linux]

It shows the version of the installed ruby in your system.If shows error or command not found you have to install ruby by the following command

sudo apt-get install ruby

after installing ruby we have to install gems to install rails

download the latest version of rubygems from rubyforge

after downloading rubygems in .tar or .zip

we have extract that file by the following

tar xzvf rubygems-1.3.2.tgz

cd rubygems-1.3.2

sudo ruby setup.rb

now we successfully installed gems in our system.Now we are going to install rails in our system

To install rails type the following command

 sudo gem install rails 

By default, ruby on rails support sqlite3 under development environment. However, in order to use that, you need to install sqlite and sqlite-ruby gem first.

sudo apt-get install sqlite3 

Now we successfully installed rails in our system to check this,Open terminal and type

rails -v

Rails 3.2.8

it shows the version of installed rails in our system.

Thanks to all …