Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

How to backup MySQL database? - using mysqldump in command line

Wednesday

How to take complete backup of mysql database using mysqldump:
                                                        MySQL provide a great command line utility to take backup of your MySQL database and restore it. mysqldump command line utility is available with MySQL installation

Code:
mysqldump –u[user name] –p[password] [database name] > [dump file name]

Example:
mysqldump –uroot –p db_codingcluster > codingcluster.sql

Backup multiple databases in MySQL.
mysqldump –u[user name] –p[password] [database name 1] [database name 2] .. > [dump file name]

Example:
mysqldump –-user root –-p db_first db_second db_third > db_codingcluster.sql

Backup all databases in MySQL.
mysqldump –u[user name] –p[password] –all-databases > [dump file]

Example:
mysqldump –-user root –-p –all-databases > db_codingcluster.sql

How to restoring MySQL database?
 To restore the database from the dump file that you can use the following mysql command.
 mysql -u [username] -password=[password] [database name] < [dump file name]

Example:
mysqldump –uroot –p db_codingcluster < codingcluster.sql


Please share this post if it's useful to you. Thanks!.

Adding Line Breaks into Text Area using JavaScript

Monday

Textarea - output not showing linebreaks:
        Whitespace in HTML output, including many white-space characters in a row,is displayed in HTML pages as a single  ordinary space. And a line break also considered as whitespace.
If you want to display text that includes linebreaks in HTML so that the linebreaks show, you can do the following ways
  •  Put the text in between <pre> and </pre> tags.
  • (Use your server/client side language to convert the line breaks into <br /> tags.

For example,
Adding Line Breaks into Text Area using JavaScript:

var strAddress= document.forms[0].txt.value;
text = strAddress.replace(/\n\r?/g, '<br />');

Adding Line Breaks into Text Area using PHP:

$strAddress = str_replace("<br>", "\n", $strAddress);


Please share this post if it's useful to you. Thanks!.

How to auto focus (auto tab) to next uitextfield in iPhone?

TabIndex changed automatically  on UITextField - iPhone:
                                                                                            That means if you  finished typing first character, the focus should move to the next text field without pressing other key or pressing tab key. For example your password field may need focus on next UITextfield automatically. In my password page each textfield contains one letter, when I type one letter and after that the focus moved to next textfield automatically by using this code snippets .
This is a sample code for AutoFocus to nextUITextField on iphone.
 
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{       
    NSString *strPassword = [textField.text stringByReplacingCharactersInRange:range withString:string];
    if( [strPassword length] > 0 ){
        textField.text = string;       
        UIResponder* nextResponder = [textField.superview viewWithTag:(textField.tag + 1)];
        if (nextResponder) {
            [nextResponder becomeFirstResponder];
        }       
        return NO;
    }   
    return YES;
}

Note: Don't forget to add Tag for your UITextFiels, before run this code.

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets