Wednesday, March 18, 2015

The solutions for communicating on SSH Commend

@ If you faced the following error, the solution would help you

@ Error 1
>Pseudo-terminal will not be allocated because stdin is not a terminal.
@ the solution 1
@ [-oStrictHostKeyChecking=no] Option make a fingerprint to write in a known_hosts
@ (maybe -T -oStrictHostKeyChecking=no)
$ ssh -oStrictHostKeyChecking=no user@somehost sudo /home/tomcat/sh/sample.sh

@ Error 2
>sudo: sorry, you must have a tty to run sudo
@ the solution 1
$ ssh -t -oStrictHostKeyChecking=no user@somehost sudo /home/tomcat/sh/sample.sh
or
@ Comment the requiretty in /etc/sudoers like the following
#Defaults requiretty 

@ Extra explanation.
@ -T Disable pseudo-tty allocation.
@ -t Force pseudo-tty allocation.

http://aero.sarang.net/blog/2009/01/ssh-1.html

Mysql - useful Tips


@ Check the character set on mysql.
mysql> status
mysql> show variables like 'character%';

@ How to copy 1 column from one DB to another DB.
mysql> INSERT INTO `target_databases`.`target_table` (`column21`, `column22`, `column23`) 
SELECT `column11`, `column12`, 1 FROM `source_databases`.`source_table` WHERE column15='test';

@ When these are different DB, -- This is option (--skip-column-names, -N)
$ ./mysql -e "SELECT column1, column2, 1 FROM database_name.table_name WHERE column3 in ('test1', 'test2')" -u root -p xxxx database_name > ~/dumpFile.txt
mysql>LOAD DATA LOCAL INFILE '~/dumpFile.txt' INTO TABLE target_table_name;

@ Backup only the schema
$ mysqldump -u root -p --no-data database_name > ~/onlySchema.sql

@ Ignores foreign keys constraints (0 : ignore, 1:value)
mysql> SET FOREIGN_KEY_CHECKS=0

@ Backup databases
$ ./mysqldump -u root -p Database_Name > DB_backup.sql
$ ./mysql -u root -p Database_Name < DB_backup.sql

@ Create a databases
@ Check character set
mysql> show variables like 'character%';
mysql> CREATE DATABASE databases DEFAULT CHARACTER SET utf8 or utf8mb4;

@SELECT VARIABLES values
mysql>show VARIABLES where Variable_name like '%log%';
@ Start to print logs into a file in mysql
mysql>SET GLOBAL general_log='on';
@If you want to change a path of a log file, change FILE for a path you want
mysql>SET GLOBAL log_output = ‘FILE’;

@Modify a column property
mysql> ALTER TABLE apns_book MODIFY book_badge VARCHAR(2) NULL;

@Remove [on update CURRENT_TIMESTAMP]
# Set the same column name
mysql> ALTER TABLE table_name CHANGE column_name column_name TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;

@ How to load data into table from CSV in Mac
mysql> LOAD DATA LOCAL INFILE '~/test.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r';

@ How to control data encrypted.
# select
mysql>SELECT AES_DECRYPT(column_name, 'password') as name FROM table_name;
# update
mysql>UPDATE table_name SET name=AES_ENCRYPT('Update Data', 'password') WHERE id=1;

@ Select data encrypted
mysql>SELECT distinct AES_DECRYPT(column_name, 'password') as test FROM table_name WHERE AES_DECRYPT(column_name, 'password') LIKE '%test%';

@ Change character set
mysql> SET character_set_client = utf8;
mysql> SET character_set_results = utf8;
mysql> SET character_set_connection = utf8;
mysql> ALTER DATABASE DB명 DEFAULT CHARACTER SET utf8;

@ Just Memo
semi  synchronize replication, sync_binlog sync_relay_log 

http://bryan7.tistory.com/101

Thursday, March 12, 2015

MyStory - My experience in learning English.

Playing games in English for learning English.
 - It helped me nothing. but I enjoyed playing game.

Reading CNN news for learning English.
 - It has helped me to have some knowledge.
 - I can also have ability to read in English more.

Reading comic book for learning English.
 - It helped me a few. but if you read loudly, It will help you a lot.

Watching TV drama with subscript for learning English.
 - It also helped me nothing.  It was my mistake.
 - But I have watched movies without subscript, that has helped me listening.
 - I recommend you to use Youtube.

Meeting a native speaker for learning English.
 - This is the best way.
 - But if you don't study English usually, It is useless.

Studying with English books and reading loudly for learning English.
 - This is also the best way.
 - I have been doing this way when I have time.

Wednesday, March 4, 2015

Linux - How to change DHCP for STATIC - 3

@ This is a DHCP set automatically when it is installed.


@ This is a static IP address changed.

Tuesday, February 24, 2015

Eclipse - How to install the plugin which convert 2 byte words for Unicode automatically.

@Select Help > Install New Software.. in the menu
@ Check the PropertiesEditor above the picture.
@ Read and accept the license agreements, then click Finish.
     If you get a security warning saying that the authenticity or validity of the software can't be established, Just click OK.

@ Select Preferences in the menu.
@ Select General > Editers > File Associations in the side menu.
@ Select *.properties in the File Types Box.
@ Select PropertiesEditor in the Associated editors and Click the Default on the right button.

Friday, February 6, 2015

Git - The current branch is not configured for pull

Sometime you see the error like the following message.

Solve:
You tell Git the explicit branch you want to pull.
You need to add this to your .git/config
--------------------------------------------------
[branch "master"]
  remote = origin
  merge = refs/heads/master

-------------------------------------------------