Friday, September 13, 2013

Mysql - One sequence table can manage

It show you that the sequence table can manage all tables.

// These are Schema Desgins
CREATE TABLE zz_app
(
    id BIGINT UNSIGNED NOT NULL DEFAULT '0',
    app_id VARCHAR(45) NOT NULL,
    app_aaa VARCHAR(45) NULL,
    app_bbb VARCHAR(45) NULL,
    app_status_flag CHAR(1) NULL,
    insert_time TIMESTAMP NOT NULL,
    update_time TIMESTAMP NOT NULL,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE INDEX zz_app_idx1 ON zz_app(app_id);
CREATE INDEX zz_app_idx2 ON zz_app(insert_time);

CREATE TABLE zz_sequence
(
    seq_name VARCHAR(30) NOT NULL,
    id BIGINT UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (seq_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

// Update sequence number into the Mysql
    <insert id="updateSequece" parameterType="map">
        UPDATE
            zz_sequence
        SET
            id=LAST_INSERT_ID(id+1)
        WHERE
            seq_name = #{seqName}
        <selectKey resultType="Long" order="AFTER">
            SELECT
                LAST_INSERT_ID()
        </selectKey>
    </insert>

// Insert a data into the Mysql
    <insert id="insertApp" parameterType="map">
        <selectKey keyProperty="id" resultType="Long" order="BEFORE">
            SELECT
                id
            FROM
                zz_sequence
            WHERE
                seq_name = #{seqName};
        </selectKey>
        INSERT INTO zz_app (
            id,
            app_id,
            app_aaa,
            app_bbb,
            app_status_flag,
            insert_time,
            update_time
        ) VALUES (
            #{id},
            #{appId},
            #{appAaa},
            #{appBbb},
            #{appStatusFlag},
            now(),
            now()
        )
    </insert>

Thursday, September 12, 2013

Mysql - How to remove mysql on the mac

  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /var/db/receipts/com.mysql.*

Objective-C - How to remove Xcode

@Remove the old Xcode
>sudo /Developer/Library/uninstall-devtools --mode=all

Java - Jetty to run in eclipse

・・Main
・Location
/usr/share/maven/bin/mvn

・Working Directory
1.Browser Workspace
2.Select the project name

・Arguments
-P staging
jetty:run

・Execute
$ CD /.../workspace
$ mvn jetty:run -P staging

・・Environment
@ For Debugging
MAVEN_OPTS = -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y

・・Run/Debug Configure....
Then, pull up the "Run/Debug Configure...." menu item and select "Remote Java Application" and click the "New" button. Fill in the dialog by selecting your webapp project for the "Project:" field, and ensure you are using the same port number as you specified in the address= property above.
Now all you need to do is to Run/External Tools and select the name of the maven tool setup you created in step 1 to start the plugin and then Run/Debug and select the name of the debug setup you setup in step2.

@pom.xml - Sample
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.xxxx.ns</groupId>
<artifactId>html5</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>html5 Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>public</id>
<name>Internal Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/groups/public/</url>
</repository>
<repository>
<id>stg-common-mvn01</id>
<name>stg-common-mvn01-releases</name>
<url>http://xxx.xxx.xxx.xx2:x0x1/artifactory/libs-releases-local</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Release Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://xxx.xxx.xxx.xx1:x0x1/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.jetty.version>6.1.26</project.jetty.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
<vervose>true</vervose>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${project.jetty.version}</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<testResources>
<testResource>
<directory>${basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
</testResource>
</testResources>
<finalName>ROOT</finalName>
</build>
<profiles>
<profile>
<id>staging</id>
<build>
<resources>
<resource>
<directory>config/staging/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
<profile>
<id>product</id>
<build>
<resources>
<resource>
<directory>config/product/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>6.0.33</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
</project>
view raw pom.xml hosted with ❤ by GitHub

Link - Good Information

@ Service for Serverside
https://baas.io/

@Install Visual Studio Express 2012
http://ariy.kr/71

@Manager tool
https://trello.com/

@Prediction system
http://www.iaeng.org/publication/WCECS2008/WCECS2008_pp804-809.pdf

Monday, September 9, 2013

Link - Html5 and JavaScript

@Sample Game
http://www.gamedevacademy.org/create-a-html5-mario-style-platformer-game/

@Open Wysiwyg editor
http://www.openwebware.com

@Plug-in for javascript in Eclipse
http://www.aptana.com/products/studio3/download

@Can test the JavaScript on WEB
http://jsfiddle.net/b9ndZ/1/

@Pick up color as HTML CODE
http://html-color-codes.info/Korean/

@Tutorial
http://www.cadvance.org/?leftmenu=doc/include/total_menu.asp&mainpage=doc/java/tutorial/js_function.asp