Clone an existing project using Mercurial
Answer:
To clone an existing Mercurial project, use the following simple command:
# hg clone https://bitbucket.org/ellislab/codeigniter
That's all.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Clone an existing project using Mercurial
Answer:
To clone an existing Mercurial project, use the following simple command:
# hg clone https://bitbucket.org/ellislab/codeigniter
That's all.
How to repair a broken MySQL replication?
Answer:
Sometimes you might discovered the slave MySQL server is having problem to replicate data from the master, when running the "SHOW SLAVE STATUS" command, it show:
mysql> SHOW SLAVE STATUS \G
..
Slave_IO_Running: Yes
Slave_SQL_Running: No
..
Last_Errno: 1146
Last_Error: Error 'Table 'db2.table3' doesn't exist' on query. Default database: 'db1'.
..
The above error message said the table "db2.table3" does not exist in the slave DB. In order to fix this error, we just simply ignore this error and resume the replication. To do so:
1. Stop the slave from replication
mysql> STOP SLAVE;
2. Skip the error
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
3. Resume the replication
mysql> STARTSLAVE;
You will now check again the status using "SHOW SLAVE STATUS", and you will discover "Slave_SQL_Running: Yes" this time. Repeat the above steps if needed.
Install Git in Mac using MacPort
Answer:
To install Git in Mac using MacPort, following the method below:
1. Search if Git is available
# port search git
2. You will found the package named "git-core", go ahead to install it
# sudo port install git-core
That's all.
Check if an array is associative or sequential in PHP?
Answer:
In PHP, if you want to check if a given array variable is associative or sequential, you can use the following method:
<?php
$list = array(1, 2, 3, 4, 5);
$is_sequential = array_values($list) === $list;
Simple date calculation using date command
Answer:
Date command is useful to calculate date, e.g. Assume today is 2011-01-15
1. Find a date in the past, e.g. 60 days ago
# date --date='60 days ago' "+%Y-%m-%d"
2010-11-16
2. Find a date in the future, e.g. 60 days in the future
# date --date='60 days' "+%Y-%m-%d"
2011-03-16