2018/07/13

useful links


Visual Studio Code - python
https://code.visualstudio.com/docs/python/python-tutorial


운영체제 - 경성대학교 양희재 교수

컴퓨터 구조 - 숭실대학교 김병기 교수

소프트웨어 공학 - 동국대학교 최은만 교수

알고리즘 - 명지대학교 이충기 교수

데이터베이스 - 이화여자대학교 용환승 교수

수리 통계학 - 국민대학교 강주성 교수

선형 대수 - 국민대학교 이옥연 교수

선형 대수 한양대학교 이상화 교수

확률 및 통계 - 한양대학교 이상화 교수

Deep Learning 정리 Blog

DataScience School

Python 연습 Site

Python Data Science Handbook

수학 관련 정리

Thinker with a Neutal Network

2018/07/08

docker Oracle 12c

Oracle Standard Edition 12c Release 1


Oracle Standard Edition 12c Release 1 on Ubuntu
This Dockerfile is a trusted build of Docker Registry.

Installation

docker pull sath89/oracle-12c
Run with 8080 and 1521 ports opened:
docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c
Run with data on host and reuse it:
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
Run with Custom DBCA_TOTAL_MEMORY (in Mb):
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -e DBCA_TOTAL_MEMORY=1024 sath89/oracle-12c
Connect database with following setting:
hostname: localhost
port: 1521
sid: xe
service name: xe
username: system
password: oracle
To connect using sqlplus:
sqlplus system/oracle@//localhost:1521/xe

Password for SYS & SYSTEM:
oracle
Connect to Oracle Application Express web management console with following settings:
http://localhost:8080/apex
workspace: INTERNAL
user: ADMIN
password: 0Racle$
Apex upgrade up to v 5.*
docker run -it --rm --volumes-from ${DB_CONTAINER_NAME} --link ${DB_CONTAINER_NAME}:oracle-database -e PASS=YourSYSPASS sath89/apex install
Details could be found here: https://github.com/MaksymBilenko/docker-oracle-apex
Connect to Oracle Enterprise Management console with following settings:
http://localhost:8080/em
user: sys
password: oracle
connect as sysdba: true
By Default web management console is enabled. To disable add env variable:
docker run -d -e WEB_CONSOLE=false -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
#You can Enable/Disable it on any time
Start with additional init scripts or dumps:
docker run -d -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -v /my/oracle/init/SCRIPTSorSQL:/docker-entrypoint-initdb.d sath89/oracle-12c
By default Import from docker-entrypoint-initdb.d is enabled only if you are initializing database (1st run).
To customize dump import use IMPDP_OPTIONS env variable like -e IMPDP_OPTION="REMAP_TABLESPACE=FOO:BAR"
To run import at any case add -e IMPORT_FROM_VOLUME=true
In case of using DMP imports dump file should be named like ${IMPORT_SCHEME_NAME}.dmp
User credentials for imports are ${IMPORT_SCHEME_NAME}/${IMPORT_SCHEME_NAME}
If you have an issue with database init like DBCA operation failed, please reffer to this issue
TODO LIST
  • Web management console HTTPS port
  • Add functionality to run custom scripts on startup, for example User creation
  • Add Parameter that would setup processes amount for database (Currently by default processes=300)
  • Spike with clustering support
  • Spike with DB migration from 11g
In case of any issues please post it here.

[c] Fibonacci

#include 

int main(){
    unsigned long a,b,cnt,i,n1,n2,n;

    scanf("%ld %ld",&a, &b);

    n2=1;
    n1=2;
    cnt=0;

    for(i=3;i=a && n<=b)
        {   
            cnt++;
            printf("cnt %ld : %ld\n", cnt, n );
        }   
        n2 = n1; 
        n1 = n;
    }   

    printf("%ld\n", cnt);
}

[c] Mine Sweep

#include 
#include 
#include 
#include 

#define debug_

char mine[100][100];
int nmax = 0, mmax = 0;

int getMin(int a, int b){ 
    if(a>b)   
        return b;
    else    
        return a;
}

int getMax(int a, int b){ 
    if(a>b)
        return a;
    else
        return b;
}

int getCnt(int x, int y){ 
    int i = 0, j = 0, cnt = 0;

    for(i=getMax(x-1, 0);i<=getMin(x+1, nmax);i++){
        for(j=getMax(y-1, 0);j<=getMin(y+1, mmax);j++){
            if(mine[i][j] == '*'){
                cnt ++; 
            }   
#ifdef debug
            printf("---- getCnt : i:%d, j:%d, cnt:%d\n", i, j, cnt); 
#endif
        }   
    }   
    return cnt;
}

int main(){
    char buf[101];
    int s, i, j, n, m;

    s = 1; /* Set counter */
    n = 0; /* Row counter in set */
    m = 0; /* Column counter in row */
    while(gets(buf)){

        if(strlen(buf) < 1)
            break;

        if(n == 0){ 
            nmax = buf[0] - '0';
            mmax = buf[2] - '0';
#ifdef debug
            printf("---- nmax : %d, mmax : %d\n", nmax, mmax);
#endif
            if(nmax == 0 && mmax == 0)
                break;
        }
        else{
            for(j=0;j < mmax;j++){
                mine[n-1][j] = buf[j];
#ifdef debug
                printf("---- n : %d, m : %d, char : %c\n", n, j, mine[n-1][j]);
#endif
            }
        }

        if(n == nmax){
            printf("Field #%d\n", s);
            for(i=0;i < nmax;i++){
                for(j=0;j< mmax;j++){
                    if(mine[i][j] == '*')
                        printf("%c",'*');
                    else
                        printf("%d",getCnt(i, j));

                    if(j == (mmax - 1))
                        printf("\n");
                }
            }
            s++;
            n = 0;
            memset(mine,'\0',sizeof(mine));
        }
        else{
            n++;
        }
    }

    return 0;
}

[c] Stack


#include 
#include 
#define MAXSIZE 100 

typedef struct stack{
    int stk[MAXSIZE];
    int top;
} STACK;


void Push(int x, STACK *s){
    int num;
    s->top ++; 
    printf("Push %d\n", s->top);
    s->stk[s->top] = x;
    return;
}

int Pop(STACK *s){
    int num;
    printf("Pop %d\n", s->top);
    num = s->stk[s->top];
    s->top --; 
    return num;
}

void Init(STACK *s){
    s->top = -1; 
    printf("Init %d\n", s->top);
    return;
}

int main(){

    STACK *s = (STACK *)malloc(sizeof(STACK));

    Init(s);

    Push(1, s); 
    Push(2, s); 
    Push(3, s); 

    printf("%d\n", Pop(s));
    printf("%d\n", Pop(s));
    printf("%d\n", Pop(s));

}