Monday, August 10, 2015

Gradle - [Fatal Error] jsp-* Already seen doctype.


■ When Refresh Dependencies was executed, the following error occurred.
BUILD SUCCESSFUL

Total time: 0.337 secs
[Fatal Error] jsp-api-2.1-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] jsp-2.1-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] servlet-api-2.5-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] jaxb-api-2.1.pom:2:10: Already seen doctype.
[Fatal Error] jasper-compiler-5.5.23.pom:2:10: Already seen doctype.
[Fatal Error] jasper-runtime-5.5.23.pom:2:10: Already seen doctype.
[Fatal Error] jsp-api-2.1-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] jsp-2.1-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] servlet-api-2.5-6.1.14.pom:2:10: Already seen doctype.
[Fatal Error] jasper-compiler-5.5.23.pom:2:10: Already seen doctype.
[Fatal Error] jasper-runtime-5.5.23.pom:2:10: Already seen doctype.

■ Before change
repositories {
    mavenLocal()
    mavenCentral()
}

■ After change
repositories {
    mavenCentral()
    mavenLocal()
}

■ Try to execute it again.
BUILD SUCCESSFUL

Total time: 0.653 secs

Wednesday, August 5, 2015

Git - How to resolve conflicts in Git

■ Check a status of conflicts in Git.
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 7 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

You have unmerged paths.
  (fix conflicts and run "git commit")

Unmerged paths:
  (use "git add <file>..." to mark resolution)

 both added:      .project

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

 modified:   .gitignore
 modified:   build.gradle

■ Edit a conflict file
 ○Before (conflicted code in a file)
<<<<<<< HEAD
sample_head
=======
sample_master
>>>>>>> master

 ○After (resolved code in a file)
<<<<<<< HEAD
sample_master
>>>>>>> master

■ Commit (You can resolve this by adding the file fixed)
$ git add .project
$ git commit

■ Check if it was fixed
$ git show | head
commit 2690c5f94cc2e9aaac6b3f17439a098ed537a311
Merge: b1bfeed 1c0394e
Author: kim_joon <kim_joon sample.io="">
Date:   Thu Jul 23 15:21:36 2015 +0900

    Merge branch 'master' of https://github.com/minziappa/neo4j_sample.git

    Conflicts:
     .project

Wednesday, July 22, 2015

Install - How to install ossec-hids-2.8

■ OSSEC is an Open Source Host-based Intrusion Detection System that performs log analysis, file integrity checking, policy monitoring, rootkit detection, real-time alerting and active response.
$ cd /usr/local/src/ossec-hids-2.8
$ ./install.sh

which: no host in (/sbin:/bin:/usr/sbin:/usr/bin)

  ** Para instalação em português, escolha [br].
  ** 要使用中文进行安装, 请选择 [cn].
  ** Fur eine deutsche Installation wohlen Sie [de].
  ** Για εγκατάσταση στα Ελληνικά, επιλέξτε [el].
  ** For installation in English, choose [en].
  ** Para instalar en Español , eliga [es].
  ** Pour une installation en français, choisissez [fr]
  ** A Magyar nyelvű telepítéshez válassza [hu].
  ** Per l'installazione in Italiano, scegli [it].
  ** 日本語でインストールします.選択して下さい.[jp].
  ** Voor installatie in het Nederlands, kies [nl].
  ** Aby instalować w języku Polskim, wybierz [pl].
  ** Для инструкций по установке на русском ,введите [ru].
  ** Za instalaciju na srpskom, izaberi [sr].
  ** Türkçe kurulum için seçin [tr].
  (en/br/cn/de/el/es/fr/hu/it/jp/nl/pl/ru/sr/tr) [en]:
-> enter

 You are about to start the installation process of the OSSEC HIDS.
 You must have a C compiler pre-installed in your system.
 If you have any questions or comments, please send an e-mail
 to dcid@ossec.net (or daniel.cid@gmail.com).

  - System: Linux hostname 2.6.32-431.23.3.el6.x86_64
  - User: root
  - Host: hostname


  -- Press ENTER to continue or Ctrl-C to abort. --
-> enter

What kind of installation do you want (server, agent, local, hybrid or help)
-> local

$ cd /var/ossec/bin
$ ./ossec-control start

Setting up ossec ui...

Username:
-> Input your id and password


Friday, July 3, 2015

Cordova - A error is ANDROID_HOME is not set

■ To deploy the application to the emulator from the command line:
■ There is a error like the following.
$ cordova emulate android
Running command: /Users/kim_woongjoon/git/hello/platforms/android/cordova/run --emulator
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /Users/njoonk/git/hello/platforms/android/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)


--------------------------SOLUTION----------------------------
■ Install Android Studio on your computer.
■ Add the following phrase to .profile on your mac.
$ vim ./.profile
## Android SDK
export ANDROID_HOME=/Users/njoonk/android-sdks
export PATH=$ANDROID_HOME/bin:$PATH


-----------------------------OUT---------------------------------
Built the following apk(s):
    /Users/njoonk/git/hello/platforms/android/build/outputs/apk/android-debug.apk
Installing app on emulator...
Using apk: /Users/njoonk/git/hello/platforms/android/build/outputs/apk/android-debug.apk
Launching application...
LAUNCH SUCCESS

Tuesday, June 23, 2015

ShellScript - Kill process in mysql automatically


■ This is a shell script to kill process lacked.
#!/bin/bash

array_name=(`/usr/local/mysql/bin/mysql -N -e "SHOW FULL PROCESSLIST" -u root -p databasesName | grep userId | gawk -F"\t" '{print $1}' | tr '\n' ' '`);

for (( i = 0 ; i < ${#array_name[@]} ; i++ )) ; do
    echo "`/usr/local/mysql/bin/mysql -N -e "kill ${array_name[$i]}" -u root -p databasesName`";
    #echo "value[$i] = ${array_name[$i]}"
done

■ This is just memo - command
mysql>SHOW ENGINE INNODB STATUS;

Friday, June 19, 2015

Mysql - test the transaction step by step

■ Showing you which threads are running. ①
mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+------+---------+------+-------+-----------------------+
| Id  | User | Host      | db   | Command | Time | State | Info                  |
+-----+------+-----------+------+---------+------+-------+-----------------------+
|  32 | root | localhost | test | Sleep   |   20 |       | NULL                  |
| 161 | root | localhost | test | Sleep   |  961 |       | NULL                  |
| 246 | root | localhost | NULL | Query   |    0 | init  | SHOW FULL PROCESSLIST |
+-----+------+-----------+------+---------+------+-------+-----------------------+
3 rows in set (0.00 sec)

■ Check the process list⑥
mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+------+---------+------+-------+-----------------------+
| Id  | User | Host      | db   | Command | Time | State | Info                  |
+-----+------+-----------+------+---------+------+-------+-----------------------+
|  32 | root | localhost | test | Sleep   |   15 |       | NULL                  |
| 161 | root | localhost | test | Sleep   |    5 |       | NULL                  |
| 246 | root | localhost | NULL | Query   |    0 | init  | SHOW FULL PROCESSLIST |
+-----+------+-----------+------+---------+------+-------+-----------------------+
3 rows in set (0.00 sec)

■ Check the process list⑪
mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+------+---------+------+----------+-----------------------------------------+
| Id  | User | Host      | db   | Command | Time | State    | Info                                    |
+-----+------+-----------+------+---------+------+----------+-----------------------------------------+
|  32 | root | localhost | test | Sleep   |  531 |          | NULL                                    |
| 161 | root | localhost | test | Query   |    8 | updating | UPDATE table_one SET key_one='key_one3' |
| 246 | root | localhost | NULL | Query   |    0 | init     | SHOW FULL PROCESSLIST                   |
+-----+------+-----------+------+---------+------+----------+-----------------------------------------+
3 rows in set (0.00 sec)

■ Check the process list⑫
mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+------+---------+------+-------+-----------------------+
| Id  | User | Host      | db   | Command | Time | State | Info                  |
+-----+------+-----------+------+---------+------+-------+-----------------------+
|  32 | root | localhost | test | Sleep   |  616 |       | NULL                  |
| 161 | root | localhost | test | Sleep   |   93 |       | NULL                  |
| 246 | root | localhost | NULL | Query   |    0 | init  | SHOW FULL PROCESSLIST |
+-----+------+-----------+------+---------+------+-------+-----------------------+
3 rows in set (0.00 sec)


===============================This is A connection================================
■ Selected the data②
mysql> SELECT * FROM table_one;
+----+-------+----------+------------+
| id | name  | key_one  | value_one  |
+----+-------+----------+------------+
|  1 | name1 | key_one1 | value_one1 |
+----+-------+----------+------------+
1 row in set (0.00 sec)

■ Started TRANSACTION③
mysql> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

■ Selected the data④
mysql> SELECT * FROM table_one;
+----+-------+----------+------------+
| id | name  | key_one  | value_one  |
+----+-------+----------+------------+
|  1 | name1 | key_one1 | value_one1 |
+----+-------+----------+------------+
1 row in set (0.00 sec)

■ Updated the data⑤
mysql> UPDATE table_one SET key_one='key_one2';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

■ Selected the data for checking it⑦
mysql> SELECT * FROM table_one;
+----+-------+----------+------------+
| id | name  | key_one  | value_one  |
+----+-------+----------+------------+
|  1 | name1 | key_one2 | value_one1 |
+----+-------+----------+------------+
1 row in set (0.00 sec)


================================This is B connection===============================
■ Selected the data⑧
mysql> SELECT * FROM table_one;
+----+-------+----------+------------+
| id | name  | key_one  | value_one  |
+----+-------+----------+------------+
|  1 | name1 | key_one1 | value_one1 |
+----+-------+----------+------------+
1 row in set (0.00 sec)
■ Started TRANSACTION⑨
mysql> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)
■ Selected the data for checking it⑩
mysql> SELECT * FROM table_one;
+----+-------+----------+------------+
| id | name  | key_one  | value_one  |
+----+-------+----------+------------+
|  1 | name1 | key_one1 | value_one1 |
+----+-------+----------+------------+
1 row in set (0.00 sec)
■ Showing the error message and rollback automatically after past the default 50 second.⑪
mysql> UPDATE table_one SET key_one='key_one3';
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

Sunday, June 14, 2015

Eclipse - Execute the eclipse after I updated the mac OS.


■ After you updated mac OS, If your mac show the following error message when execute the Eclipse. 


■■■ This is the solution ■■■

■ Move the java home
$ cd /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/
■ Edit the following file.
$ sudo vim ./Info.plist
# Before
<key>JVMCapabilities</key>
 <array>
  <string>CommandLine</string>
 </array>
# After
<key>JVMCapabilities</key>
 <array>
  <string>JNI</string>
  <string>BundledApp</string>
  <string>CommandLine</string>
 </array>
■ If it doesn't changed anything, make the directory
$ sudo mkdir -p /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
$ sudo mkdir -p /System/Library/Java/Support/Deploy.bundle