1) NetWork Application(for example, APM)
Linux Server Program - C Language
Windows Client Program - C# Language(Visual Studio)

2) Web
Linux Server - tomcat(by java beans & jsp)
Client - Web Browser(IE,Chrome)

3) StandAlone Window Application
- C# Language(Visual Studio)

4) Batch Application IN MySQL 
- C Language

5) Console Apllication In Windows
- C Language
- C# Language
- JAVA Language

6) Javascript Program In WebBrowser
- Javascript Language, Java Server Page, Java Beans
- HTML/CSS

 

TRIS MECHANISM,,,,,,,,

>>>>MAPY=10
>>>>MAPX=10
>>>>ARR=4
>>>>DESIGN[ARR,ARR]={{1,1,1,1},{1,0,0,0},{1,0,0,0},{1,0,0,0}};
>>>>TRIS[MAPY,MAPX]
>>>>xpos=1
>>>>ypos=0
>>>>score=0

 

1 1 1 1 1 0 0 0 0 1
1 1 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 1 1


1. TIME EVENT (?) - c# ElapsedEventHandler()
2. KEY EVENT (?) - c# ConsoleKeyInfo Structure
3. CHECK LOGIC (?) - Common Logic


000001) 


1.  swap(2,048)  -> 10,000
2.  /boot(100)   ->  2,000(첫번째 파티션으로 만듦, 체크)
3.  /(3,072)     -> 12,000
4.  /usr(8,192)  -> 70,000
5.  /usr2(90,000)-> 90,000                               -> 120,000
6.  /var(4,096)  -> 12,000
7.  /tmp(4,096)  -> 12,000
8.  /data(70,000)-> 70,000
9.  /home(2,000) ->  2,000
10. /web(나머지 부분을 할당, 체크)

000001) Telnet
sudo apt-get install telnetd xinetd -y

service telnet
{
    disable         = no
    flags           = REUSE
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/sbin/in.telnetd
    log_on_failure  += USERID
}

sudo /etc/init.d/xinetd restart

00004)
by root
mkdir /usr2/sinfo

00005)
groupadd other
useradd -d /usr2/sinfo -g other -s /bin/bash sinfo
passwd sinfo

00006)
cd /usr2
chown -R sinfo:other sinfo

00007)
apt update -y
apt-get install vsftpd

>>vsftpd.conf 파일 수정
vi /etc/vsftpd.conf
# Uncomment this to enable any form of FTP write command.
write enable=YES

>>vsftpd 서비스 재시작
/etc/init.d/vsftpd restart

00008)

apt-get update

apt-get install make
apt-get install gcc
apt-get install g++ 
apt-get install net-tools
apt-get install curl
apt install pkg-config

apt-get install cmake
apt-get install libssl-dev
apt-get install libexpat1-dev
apt-get install libboost-all-dev
apt-get install libncurses5-dev libncursesw5-dev

1. MySQL 다운로드 (경로: /usr/local)
$ cd /usr/local
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25.tar.gz
$ tar xvfz mysql-8.0.25.tar.gz

$ cd /usr/local/src/
$ wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz
$ tar xvfz boost_1_73_0.tar.gz

2.설치
$ cd /usr/local/mysql-8.0.25
$ rm -f CMakeCache.txt
$ mkdir tmp_mysql(USER ADD DIRECTORY)
$ cd tmp_mysql(USER ADD DIRECTORY)
$ cmake \
.. \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DSYSCONFDIR=/etc \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/src/boost_1_73_0
$ make
$ make install

3.MySQL DB 초기화
(1)그룹 지정

$ groupadd mysql
$ useradd -r -g mysql -s /bin/false mysql
그룹과 유저를 만들어야 한다.

-r : system account
-g : 그룹 지정
-s : user의 로그인 shell

(2) 디렉토리 생성

$ cd /usr/local/mysql
$ mkdir mysql-files
편한 이름의 디렉토리를 만들어 준다.

(3)권한주기

$ chown -R mysql:mysql /usr/local/mysql
$ chown mysql:mysql mysql-files
$ chmod 750 mysql-files
chown: 파일의 소유자를 변경

-R : 하위 디렉토리까지 소유권 할당

chmod : 사용권한을 변경

(4)기본 DB 생성

$ bin/mysqld --initialize --user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data

임시비밀번호가 나온다.
이 비밀번호는 나중에 써야하니 잘 기억해두자!
root@localhost : hYyR#f#D1ZCb

아래 명령어로 mysql로 전환한다.

$ bin/mysql -u root -p
명령어를 치면 비밀번호를 입력하게 되는데 아까 받은 초기 비밀번호를 입력하면 된다.

(2) 비밀번호 할당하기

mysql>alter user 'root'@'localhost' identified by '원하는 비밀번호';
mysql>flush privileges;
mysql>commit;

(3) 서버 종료


이때 비밀번호가 잘 변경됬는지 확인하면 된다.

5.MySQL 서비스 등록
서비스를 등록하면 서버가 실행되었을 때, mysql 이 자동으로 실행된다.

mysqld 파일을 복사한다.

$ sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
mysqld 파일을 열어서 basedir 와 datadir 를 설정한다.

$ sudo vi /etc/init.d/mysqld


basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
mysqld 서비스를 등록한다.

$ update-rc.d mysqld defaults
reboot로 다시 시작한 뒤 보면 서버시작 안 해도 서버 시작이 되어있음을 확인할 수 있다.

$ reboot 
$ ps -ef | grep mysqld

/*----------------------------------------------------------*/



create database stockDB;
flush privileges;


백업)
/usr/local/mysql/bin/mysqldump -u root -p mysql > mysql_db.sql
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)

원복)
/usr/local/mysql/bin/mysql -u root -p mysql < mysql_db.sql
(mysql>root계정까지 백업되므로, root패스워드가 원복시에 바뀌어버린다. 주의해야 한다.)
/usr/local/mysql/bin/mysql -u root -p stockDB < stockDB_db.sql

Install gcc downgrade)
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ trusty main'
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ trusty universe'
apt install gcc-4.7 g++-4.7 -y

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 10

비고)
update-alternatives --config gcc
update-alternatives --config g++

Compile)

root@stock:~# gcc --version
gcc (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@stock:~#

PATH설정)

sinfo@stock:~/exe$ ./Batch
./Batch: error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory
sinfo@stock:~/exe$
sinfo@stock:~/exe$


root@stock:/usr/local# find ./ -name libmysqlclient.so.21
./mysql/lib/libmysqlclient.so.21
root@stock:/usr/local#

즉 /usr/local/mysql/lib 디렉토리를 /etc/profile에 추가시켜주면 됩니다. 혹은 개인계정 profile에 추가해도 무방

# vi /etc/profile
export LD_LIBRARY_PATH=/usr/local/mysql/lib/:LD_LIBRARY_PATH

100_partition_user_add_info.txt
0.00MB
110_install_make_succ.txt
0.00MB

 

this.Text = "베트남어: Ti?ng Thai"; 를 이용한 

SendMessage[WM_COPYDATA] 는 실패!!

만국공통어인 영어를 사용해서 FindWindow를 실행해야 할것 같음.


using System;
using System.Windows.Forms;
using System.Text;
using System.Runtime.InteropServices;


namespace RecvPackage
{
public class Program : Form
{
public const int WM_COPYDATA=0x004A;

public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
public IntPtr lpData;
}

public Program()
{
//From FindWindow(), This Application is Detected!!
//From FindWindow(), This Application is Detected!! //The KeyWord is Below String,,,,,
this.Text = "RecvSendDataMonitoring";
}

protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
try
{
switch(m.Msg)
{
case WM_COPYDATA :
COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
byte[] recvData = new byte[cds.cbData];
Marshal.Copy(cds.lpData, recvData, 0, cds.cbData);
Console.WriteLine(Encoding.Default.GetString(recvData));

break;
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}

public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Program());
}
}//end of class
}//end of namespace

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WinTrisEx01
{
public partial class Form1 : Form
{
public const int WM_COPYDATA = 0x004A;

int xpos=0;

[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

IntPtr tailHandle = IntPtr.Zero;

public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
public IntPtr lpData;
}

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
SendToTail(1, ">>>>SendData:[" + xpos.ToString("00000") + "]");
xpos++;
}

private void SendToTail(int index, string data)
{
tailHandle = FindWindow(null, "RecvSendDataMonitoring");
try
{
byte[] dataByte = Encoding.UTF8.GetBytes(data);

COPYDATASTRUCT copyData = new COPYDATASTRUCT();
copyData.dwData = (IntPtr)0;
copyData.cbData = data.Length;
copyData.lpData = Marshal.AllocHGlobal(dataByte.Length);
Marshal.Copy(dataByte, 0, copyData.lpData, dataByte.Length);

IntPtr sendData = Marshal.AllocHGlobal(Marshal.SizeOf(copyData));
Marshal.StructureToPtr(copyData, sendData, true);

IntPtr _result = SendMessage(tailHandle, WM_COPYDATA, (IntPtr)index, sendData);

Marshal.FreeHGlobal(copyData.lpData);
Marshal.FreeHGlobal(sendData);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
}
}
}

/*
 * From BackgroundWorker 매카니즘
 */

1. 서버로 data 송신시 -> SendWorker
2. 서버에서 data 수신시 -> RecvWorker
3. Queue에 데이타 입력시 -> SendQueue
4. Queue에 데이타 출력시 -> RecvQueue
5. 출력되어진 데이타를 Grid에 Display시 -> RecvQueue

From BackgroundWorker, 업무를 처리하는 동안, 어떤 방해도 받지 않는다.

/*
* From Process To Process, Message Send,Recv
*/

namespace RecvPackage
{
    public class Program : Form
    {
        public const int WM_COPYDATA=0x004A;

        public struct COPYDATASTRUCT
        {
            public IntPtr dwData;
            public int dbData;
            public IntPtr lpData;
        }

        public Program()
        {
            //From FindWindow(), This Application is Detected!!
            //From FindWindow(), This Application is Detected!! //The KeyWord is Below String,,,,,
            this.Text = "RecvSendDataMonitoring";
        }

        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            try
            {
                switch(m.Msg)
                {
                    case WM_COPYDATA :
                    COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
                    byte[] recvData = new byte[cds.cbData];
                    Marshal.Copy(cds.lpData, recvData, 0, cds.cbData);
                    Console.WriteLine(Encoding.Default.GetString(recvData));

                    break;
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Program());
        }
    }//end of class
}//end of namespace

            

+ Recent posts