The following command will find all svn folders from within your current working directory and delete them all. In short this will make working directory as exported project.
find . -name .svn -exec rm -rf {} \;
Explanation:
The find command will start searching from '.'(Current directory)
Will find the file/folder whose name is '.svn'
The -exec will execute 'rm -rf' command on the result of find command. i.e. the {} will return all files/folders returned by find command.
And the last '\' is important it is escape character.
So you are done....
Be aware you are using rm -rf command..
(I have tested it on Ubuntu 6.06)
You will get information about PHP, Drupal, HTML, JavaScript, CSS, Linux, Shell Script. Lets discuss and share ideas.
Tuesday, November 25, 2008
Saturday, September 6, 2008
copy content of one table to another table- MySQL
To copy all content of one table to another table use following query.
consider you have two tables table_source & table_destination.
To copy content of table_source to table_destination.
INSERT INTO table_destination SELECT * FROM table_source;
see the bellow example
mysql> create table zdevendra(id integer(10) auto_increment primary key, name varchar(50), salery int(10));
Query OK, 0 rows affected (0.01 sec)
mysql> desc zdevendra;
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | YES | | NULL | |
| salery | int(10) | YES | | NULL | |
+--------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql> insert into zdevendra (name, salery) values('first name','1000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('second name','2000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('third name','3000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('forth name','4000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('fifth name','5000');
Query OK, 1 row affected (0.00 sec)
mysql> select * from zdevendra;
+----+-------------+--------+
| id | name | salery |
+----+-------------+--------+
| 1 | first name | 1000 |
| 2 | second name | 2000 |
| 3 | third name | 3000 |
| 4 | forth name | 4000 |
| 5 | fifth name | 5000 |
+----+-------------+--------+
5 rows in set (0.00 sec)
mysql> create table zzdevendra(id integer(10) auto_increment primary key, name varchar(50), salery int(10));
Query OK, 0 rows affected (0.01 sec)
mysql> select * from zzdevendra;
Empty set (0.00 sec)
mysql> insert into zzdevendra select * from zdevendra;
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from zzdevendra;
+----+-------------+--------+
| id | name | salery |
+----+-------------+--------+
| 1 | first name | 1000 |
| 2 | second name | 2000 |
| 3 | third name | 3000 |
| 4 | forth name | 4000 |
| 5 | fifth name | 5000 |
+----+-------------+--------+
5 rows in set (0.00 sec)
mysql>
You are done!
:Devendra
consider you have two tables table_source & table_destination.
To copy content of table_source to table_destination.
INSERT INTO table_destination SELECT * FROM table_source;
see the bellow example
mysql> create table zdevendra(id integer(10) auto_increment primary key, name varchar(50), salery int(10));
Query OK, 0 rows affected (0.01 sec)
mysql> desc zdevendra;
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | YES | | NULL | |
| salery | int(10) | YES | | NULL | |
+--------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql> insert into zdevendra (name, salery) values('first name','1000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('second name','2000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('third name','3000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('forth name','4000');
Query OK, 1 row affected (0.00 sec)
mysql> insert into zdevendra (name, salery) values('fifth name','5000');
Query OK, 1 row affected (0.00 sec)
mysql> select * from zdevendra;
+----+-------------+--------+
| id | name | salery |
+----+-------------+--------+
| 1 | first name | 1000 |
| 2 | second name | 2000 |
| 3 | third name | 3000 |
| 4 | forth name | 4000 |
| 5 | fifth name | 5000 |
+----+-------------+--------+
5 rows in set (0.00 sec)
mysql> create table zzdevendra(id integer(10) auto_increment primary key, name varchar(50), salery int(10));
Query OK, 0 rows affected (0.01 sec)
mysql> select * from zzdevendra;
Empty set (0.00 sec)
mysql> insert into zzdevendra select * from zdevendra;
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from zzdevendra;
+----+-------------+--------+
| id | name | salery |
+----+-------------+--------+
| 1 | first name | 1000 |
| 2 | second name | 2000 |
| 3 | third name | 3000 |
| 4 | forth name | 4000 |
| 5 | fifth name | 5000 |
+----+-------------+--------+
5 rows in set (0.00 sec)
mysql>
You are done!
:Devendra
Thursday, July 24, 2008
Get Version of Internet Explorer using Java Script
This is the code to get the version of Internet Explorer used by the user. If you use navigator.appVersion you will get value 4 for both ie6 & ie7.
<script type="text/javascript" language="javascript">
//Arguments:
//This function is same as explode function in php.
//It takes input string as a string to be exploded.
//separators as a string separator.
//includeEmpties count of array you want as a return (Not required in our case)
//Return:
//It returns the array of strings(Separated by 'separators')
function explode(inputstring, separators, includeEmpties) {
inputstring = new String(inputstring);
separators = new String(separators);
if(separators == "undefined") {
separators = " :;";
}
fixedExplode = new Array(1);
currentElement = "";
count = 0;
for(x=0; x < inputstring.length; x++) {
char = inputstring.charAt(x);
if(separators.indexOf(char) != -1) {
if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { }
else {
fixedExplode[count] = currentElement;
count++;
currentElement = ""; } }
else { currentElement += char; }
}
if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) {
fixedExplode[count] = currentElement; }
return fixedExplode;
}
// explode function ends here
//Actual logic starts here ..
full_string = navigator.userAgent;
string_array = explode(full_string,";",10);
version_number = explode(string_array[1]," ",2);
main_version = explode(version_number[2],".",3);
if(main_version[0] == 6){
alert("this is ie6");
}else{
if(main_version[0] == 7){
alert("this is ie7");
}else{
alert("this is other browser");
}
}
</script>
<script type="text/javascript" language="javascript">
//Arguments:
//This function is same as explode function in php.
//It takes input string as a string to be exploded.
//separators as a string separator.
//includeEmpties count of array you want as a return (Not required in our case)
//Return:
//It returns the array of strings(Separated by 'separators')
function explode(inputstring, separators, includeEmpties) {
inputstring = new String(inputstring);
separators = new String(separators);
if(separators == "undefined") {
separators = " :;";
}
fixedExplode = new Array(1);
currentElement = "";
count = 0;
for(x=0; x < inputstring.length; x++) {
char = inputstring.charAt(x);
if(separators.indexOf(char) != -1) {
if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { }
else {
fixedExplode[count] = currentElement;
count++;
currentElement = ""; } }
else { currentElement += char; }
}
if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) {
fixedExplode[count] = currentElement; }
return fixedExplode;
}
// explode function ends here
//Actual logic starts here ..
full_string = navigator.userAgent;
string_array = explode(full_string,";",10);
version_number = explode(string_array[1]," ",2);
main_version = explode(version_number[2],".",3);
if(main_version[0] == 6){
alert("this is ie6");
}else{
if(main_version[0] == 7){
alert("this is ie7");
}else{
alert("this is other browser");
}
}
</script>
Subscribe to:
Posts (Atom)