Leave a comment

MySQL Different command for Backup and Restore Databases

Backup Database

Making backup all databases:

mysqldump -u usuario -p –all-databases > dump.sql

Making backup only one database:

mysqldump -u usuario -p –databases db1 > dump.sql

Making backup many databases:

mysqldump -u usuario -p –databases db1 db2 db… > dump.sql

Making backup using gzip compresson

mysqldump -u usuario -p –all-databases | gzip > dump.sql.gz

Making backup using bzip2 compresson

mysqldump -u usuario -p –all-databases | bzip2 > dump.sql.bz2

Restore Database

Normal

mysql -u usuario -p < dump.sql

gzip:

gunzip < dump.sql.gz | mysql -u usuario -p

bzip2

bunzip2 < dump.sql.bz2 | mysql -u usuario -p

While dumping mysql database use –single-transaction option so that database table not get locked while dumping process

and command for dumping mysql file using gzip compression

mysqldump -uroot -p'password' databasename | gzip new_db_name.sql.gz

Advertisements
Leave a comment

PostgreSQL create a user account and grant permission for database

Here I mentioning the steps require to Create a Postgres User and give them access to particular Database

Firstly run command  “sudo su” to make a user as a super user

create a new User in unix or you can use the existing one as well,

You can create a new user by command

# adduser bob

# passwd bob

once the unix user get create you can open the Postgres by command

su postgres

then you can open postgres command prompt by typing “psql” in command prompt.

after that on PSQL Prompt you can create a User by following command

CREATE USER bob WITH PASSWORD ‘yourPassword’;

and if user already exist and if you not know his password then you can alter the password by command

ALTER USER bob WITH PASSWORD ‘yournewpassword’;

Once user get created and you know the password as well you can then create a database by using command

CREATE DATABASE db;

after database get created you can grant all the privilages of database to above created user

GRANT ALL PRIVILEGES ON DATABASE db to bob;

and then by \q you can get exit from the PSQL command prompt and not you can login to new PSQL created user using command

psql  -U bob -d db;

and now have access to database db and login to psql as a User bob 🙂

 

 

Leave a comment

Ubuntu Boot hangs on “checking battery state”

Today Morning,  I was trying to upgrade Ubuntu 13.04 to 13.10 and suddenly power get fails and my system shutdown.

and after that  my when I try to own the system . it  hangs at “Checking battery state” while booting.

So after that following steps was done to solve the problem

press ALT + F5 to login through terminal (Command Prompt).

and then rune the command “sudo apt-get install -f”

and then run “sudo dpkg –configure -a “

and then  “sudo reboot”

and after reboot it works perfect 🙂

Leave a comment

ExecJS::RuntimeError on Windows on Rails 3.1 and above

On the system having issues, find ExecJS’s runtimes.rb file which will present in execjs gem. Make a copy of the found file for backup. Open the original runtimes.rb for editing. Find the section that starts with the line

JScript = ExternalRuntime.new(
// other Options
)

and replaced it with

JScript = ExternalRuntime.new(
    :name        => "JScript",
    :command     => "cscript //E:jscript //Nologo",
    :runner_path => ExecJS.root + "/support/jscript_runner.js",
    :encoding    => 'UTF-8' # CScript with //U returns UTF-16LE
)

and the problem will resolved
Leave a comment

Simple Metaprogram to Dynamically inject Class Methods and Instance Methods from module

module DummyModule

module ClassMethods
def find_by_ranks()
puts “Class Method Executed Successfully !!!”
end
end

module InstanceMethods
def ranks()
puts “instance method Executed Successfully !!!”
end
end

def self.included(base)
base.send :include, InstanceMethods
base.send :extend, ClassMethods
end

end

class Test
include DummyModule
end

t = Test.new
t.ranks #output : instance method Executed Successfully !!!
Test.find_by_ranks #output : Class Method Executed Successfully !!!

Leave a comment

Create a new Rails App Using Specific Version

As we now Rails Community is a very active commnity and Number of rails version are get released so here is a  short command I found to create a rails application by using Specific version

$ rails _3.2.13_ new appname

Leave a comment

How scrum team Rolls

In Many Places People ask me what are the work and Processes Followed in your company. and while describing them about Agile Methodologies we follow, they Always come with a series of Questions?
What is Scrum?
What is Sprint?… and all
So here are is a short description on it How Scrum Team Works.
In software development life cycle to accomplish any task needs team work. Product owner alone cannot able to achieve any goal he has set for development progress. Scrum team consists of different stakeholders like software developer, tester, even scrum master is also get selected from scrum team. There is no difference between developer and software tester both are treated as scrum team members. Each team member shares their roles and responsibilities. Scrum team has predefined set of responsibilities and scope. Product owner has clear understanding of scrum team members and their roles. He also knows team’s weakness and strength.
Scrum team consists of several team members; number varies depending upon organizational structure. Standard team size ranges from 3 to 9, adding lots of scrum team members gives overhead in development process. Scrum team can be mixture of newly joined team members along with old ones.
Scrum team members participate in software development process during sprint planning meeting. At sprint planning meeting everyone gets equal opportunity to ask doubts, raise concerns. Team members are involved in estimating story points against things discussed during sprint planning meeting.
At daily scrum meeting, scrum team members get informed about each team member’s activities, challenges they are facing and any blockers if present. Each team member knew about each day’s development progress also they could get clear understanding about whether they are progressing in right direction or not.
When scrum team consists of more no of newly joined team members then it’s very difficult to track performance of team during initial iterations. After each sprint releases team get to know about their achievements and failures if anywhere they have to work around. This will help team members to improve their performance after every release.

Performance of team varies depending upon how much understanding and gaining team is achieving with the help of each other during development life cycle. Consistent and clear communication among team members and with product owner achieves overall team performance with great extent.
Sprint review meeting gets carried out before every sprint release where entire team sits together and gives demonstration of each sprint items they have achieved so far.Product owner makes sure that all the expected things are completed or not. If any blocker or incomplete work he came across he makes note of those points.
During sprint retrospective meeting entire scrum team discusses about their success and failure ratio. Also product owner addresses entire team about his observation concern with current sprint release. These are key points for a team to face next sprint and overcome earlier failures.
Product owner and scrum master always makes sure that scrum team is not getting diverted from their goals and timeline. They always make sure that each team member is getting open environment to grow and explore their ideas. These things always impacts on overall team’s’ performance during each sprint.