Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

How to import database using Mysql query browser in ubuntu?

Many times we want to shift our database from one machine to another. I faced similar situation when I want to shift my database from external server to my own. While shifting , I was using ubuntu operating system and mysql query browser as a tool. Though, it is pretty easy but I think it would be useful information for you.

Step 1 . Open Mysql Query Browser

Step2. Right click in Schemeta Option and select create Schema

Step3. Put your database name

Step4. Now Click on File(Alt + F)  and select open script

Step5. Select script which you want to import and click on execute.


Its done!

I Hope that helped

How to precompile assets in production server of rails?


If you are hosting your sites with apache and passenger on ubuntu and things are not working as expected in production environment then you should try these three steps, which often works for me :

1. Precompile your assets : It would take time so be patient and let rails do it works.

cg@ubuntu:~/your_app$RAILS_ENV=production rake assets:precompile

2. Run Migration on production Server : Sometime we forget to migrate our data in production server. We know that rails have three different databases for development, production and testing, therefore running migration on production server is important.

cg@ubuntu:~/your_app$rake db:migrate RAILS_ENV="production"

3.Restart Apache : With passenger and apache, if you do slightest of change you need to restart apache again. There are other solutions to automate this but for now just do it.

cg@ubuntu:~/your_app$sudo service  apache2 reload

Heroku Users:

Asset Pre compilation in heroku is somewhat different than local computer because we need to do it in production environment.

cg@ubuntu:~/your_app$RAILS_ENV=production bundle exec rake assets:precompile

After running above command use git and the upload that git to heroku.

cg@ubuntu:~/your_app$git add .
cg@ubuntu:~/your_app$git commit -m "assets precompile on heroku"
cg@ubuntu:~/your_app$git push heroku master

I hope that helped!

How to setup mysql database.yml in Ubuntu ?

Steps which I am sharing with you has worked for me and I hope that would help you in connecting your mysql database to your ruby on rails application.

Step 1. Open terminal and execute this command : sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby

Step2. Change Directory to your application folder ,like cd /rails_projects/cg

Step3. Now ,install mysql gem : sudo gem install mysql

Step4. Configure your database.yml :  sudo gedit configure/database.yml

Step5.Paste this code:
development:
  adapter: mysql
  encoding: utf8
  database: yourdatabase_development
  pool: 5
  username: root
  password: yourpassword


test:
  adapter: mysql
  encoding: utf8
  database: yourdatabase_test
  pool: 5
  username: root
  password: yourpassword



production:
  adapter: mysql
  encoding: utf8
  database: yourdatabase_production
  pool: 5
  username: root
  password: yourpasswod


Done! Now create database using rake:db create  and enjoy!

How to open gedit as root?

In Ubuntu, beginners often face this problem of saving or editing document having permission of read and write only to root.

This problem can be solved in two ways :

1.  Open Terminal ( Ctrl + Alt + t) , then open the file using "sudo" , for example if I want to open file "xyz", I can open it using sudo gedit xyz .

2. Or you can change permission of this file using chmod command.After changing permission for all users to 777 . You can able to edit that file without any problem.


I hope it helps!

How to play dat(video) files in ubuntu?

It is a two step process :

1. Download VLC player from software centre using Application-->Ubuntu Software Centre-- Type VLC

2. Open terminal and type this command : vlc vcd:///dev/sr0

It start your vlc player with your cd running.


I hope it helps