4/07/2016

maschine.systems

블로그는 운영하지 않습니다. 저희 홈페이지를 방문해 주세요.
Please refer to my website http://maschine.systems,
This blog is not under maintenance.

1/22/2016

Mein Herz brennt

Nun liebe Kinder gebt fein Acht
사랑하는 아이들아 이제 주의를 기울여라

ich bin die Stimme aus dem Kissen
나는 베개에서 나오는 목소리

ich hab euch etwas mitgebracht
나는 너희들에게 무언가를 가져왔다

hab es aus meiner Brust gerissen
나는 그것을 내 가슴에서 찢어내었다

mit diesem Herz hab ich die Macht
이 심장으로 인해 나는 힘을 가졌다

die Augenlider zu erpressen
눈꺼풀을 탈취할 그 힘을

ich singe bis der Tag erwacht
나는 낮이 올때까지 깨어서 노래부른다

ein heller Schein am Firmament
창공의 밝은 빛이

Mein Herz brennt
내 심장을 불태운다

Sie kommen zu euch in der Nacht
그들은 밤중에 너희에게로 온다

Dämonen Geister schwarze Feen
악마와 귀신과 검은 요정들

sie kriechen aus dem Kellerschacht
그들은 지하실 배관으로부터 기어나와

und werden unter euer Bettzeug sehen
너희들의 침대보 밑에서 모습을 보인다

Nun liebe Kinder gebt fein Acht
사랑하는 아이들아 이제 주의를 기울여라

ich bin die Stimme aus dem Kissen
나는 베개에서 나오는 목소리

ich hab euch etwas mitgebracht
나는 너희에게 무언가를 가져왔다

ein heller Schein am Firmament
창공의 밝은 빛이

Mein Herz brennt
내 심장을 불태운다

Sie kommen zu euch in der Nacht
그들은 밤중에 너희들에게 와서

und stehlen eure kleinen heissen Tränen
너희들의 작고 뜨거운 눈물을 훔친다

sie warten bis der Mond erwacht
그들은 달이 뜰 때까지 깨어서 기다리다가

und drücken sie in meine kalten Venen
내 차가운 혈관을 쥐어짠다

Nun liebe Kinder gebt fein Acht
사랑하는 아이들아 이제 주의를 기울여라

ich bin die Stimme aus dem Kissen
나는 베개에서 나오는 목소리

ich singe bis der Tag erwacht
나는 낮이 될 때까지 깨어서 노래부른다

ein heller Schein am Firmament
창공의 밝은 빛이

Mein Herz brennt
내 심장을 불태운다

12/14/2015

Cathode and Anode Notation in Devices

Abstract

 (+/-) signs of electronic devices, and anode/cathode notations seem to be ever-embarrassing. This post is intended to offer a solid understanding to quench further annoyance on this matter.


1. The directions are in opposite

 1.1 Current flows from (+) to (-)
      : This is just convention, and it is virtual.
        It is different from the truth but is accepted and dominant.

 1.2 Electrons flow from (-) to (+)
      : This tells the truth as the movement of electrons brings the current flow.

 1.3 Conclusion
      : (+/-) signs are easy to apply in our life;
        as we learn that the current flows from (+) to (-) anyway.
        And this concept is also accepted in Electronics, and Electric Eng.


2. In Material science

 2.1 Cathode/Anode notation is more accurate

 2.2 Cathode
      *Circuit is noted as the metallic connection between 2 electrodes.
      : Cathode is the electrode which pushes holes(+) to the circuit.
        Spontaneously, pulls electrons(-) from the circuit.
      : The exact definition of cathode is, where the reduction occurs
        as electrons are pulled via circuit.

 2.3 Anode
      : Anode is the electrode which pushes electrons(-) to the circuit.
        Spontaneously, pulls holes(+) from the circuit.
      : The exact definition of anode is, where the oxidization(== oxidation) occurs
        as electrons are pushed toward circuit.

 2.4 Conclusion
      : Cathode pushes holes to the circuit (+ sign)
        Anode pushes electrons to the circuit (- sign)
      : As there should be ionic exchange inside the battery cell,
        electrons collected to Cathode, again released as anion
        through salt bridge (Galvanic cells).

You might make use of the .ppt that I have made for this posting.











12/12/2015

Collecting nice tags for your own Blog

 The suggestion feasibility of searching engines now days are even evolving, and would give better intuition for your research and understanding, or just simply so helpful for your instantaneous searching on site.

 But as you might fully understand, the result of those searching engines will vary, so we would imagine how we collect those search results effectively, or how we could arrange the powerful keywords in a formal form.

 This technique starts from a term, "crawling". The searching engines are already the best options to mine our idea and thus, this crawling means, "the collecting of information based on your keyword whether from a single webpage or many". This action is treated sensitively from those portals for its autonomous, iterative, and cheating-like characteristic and the term is applied in various actions of collecting data which are already accessible online.

 For your personal purpose, anyhow, you still wants to find better-large-set of keywords related to a certain topic. I started to employee this technique recently for academic purpose in Korean and English, and I wanted to share how it works. Let's assume that we are going to arrange the tags for google blogger. The materials are given in following links.

Link2 : 연관검색어 추출 프로그램 (Download windows executable, Search in Korean)
Link3 : your Arrange-Assist Program (Download C++ implementation, or Build your own)





[Step1] Collect suggestions from websites like Link1 or with similar programs. They usually secondarily-collect them from searching engines.




[Step2] They might offer the functionality to copy it to your clipboard. Please save them as a text file; here as "input.txt".




[Step3] As the google blogger limits the length of the tags into 200 characters, and to just copy-and-paste it to your blog, try to build your own program or just use the program from Link3; "input.txt" should be inside the same folder with the program "Collect the Tag till N.exe" from Link3. When you run it, "output.txt" will be generated.




[Result] I guess you have already found the concept of this trick. There will be so many other applications with similar methodologies, try out to build your own!




And last, the source code of the Link3 is as the below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>    // cin, cout
#include <fstream>    // ifstream, ofstream
 
#include <string>    
// getline(cin, string)            from console
// getline(ifstream, string)    from file
 
using namespace std;
int main(void)
{
#define Length_Limit_Google 200
 
    ifstream iSTREAM("input.txt");
    if (iSTREAM.is_open() != true)
    {
        cout << "[SYS] Unable to open \"input.txt\"." << endl;
        return -1;
    }
 
    ofstream oSTREAM("output.txt");
    if (oSTREAM.is_open() != true)
    {
        cout << "[SYS] Unable to open \"output.txt\"." << endl;
        return -1;
    }
 
    string newline, label;
    register unsigned int Label_Length = 0;
    while (getline(iSTREAM, newline))
    {
        newline += ", ";
        Label_Length += newline.size();
        if (Label_Length > Length_Limit_Google)
        {
            label.erase(label.size() - 2, label.size() - 1);
            break;
        }
        else
        {
            label += newline;
        }
    }
    oSTREAM << label;
    cout << "\n\t[SYS] " << label.size() << " characters ready." << endl << endl;
 
    iSTREAM.close();
    oSTREAM.close();
    return 0;
}
cs





Temporary

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
 
double drag_co(const double& drag, const double& air_density, const double& velocity, const double& area);
double drag(const double& drag_co, const double& air_density, const double& velocity, const double& area);
 
int main(void)
{
#define ROWS 3
#define COLS 4
    
    double data[ROWS][COLS];    // data[row][col]
 
    register int row, col;        // generic index for 2D-array
    register int rows = sizeof(data) / sizeof(data[0]);
    register int cols = sizeof(data[0]) / sizeof(data[0][0]);
    
    // file opened
    FILE* fin = fopen("[0] data.txt""r");
    if(!fin) return -1;
    cout << endl << endl;
 
    // 차수 [1:3]에 대한 항력계수 계산 및 출력
    double DRAG_co[3];
    for (row = 0; row < rows; ++row)
    {
        for (col = 0; col < cols; ++col)
        {
            fscanf(fin, "%lf"&data[row][col]);
            register int offset = col % cols;
            if (offset == cols - 1)                                            // 기준면적
            {
                DRAG_co[row] =    drag_co(                                    // 항력계수
                    data[row][col - 3], data[row][col - 2],
                    data[row][col - 1], data[row][col]);
 
                printf("%.0lf ", data[row][col]);
                cout << "\tdrag_co : ";
                printf("%le", DRAG_co[row]);
                cout << endl;
            }
            else if (offset == cols - 2printf("%.0lf ", data[row][col]);    // 속도
            else if (offset == cols - 3printf("%.0le ", data[row][col]);    // 밀도
            else if (offset == 0printf("%.0lf ", data[row][col]);            // 항력
        }        
    }
    cout << endl << endl;
    fclose(fin);
    
 
    // 기준면적[4:14]        ++2
    // 속도[90:400]            ++10
    // 속도 [1:200] / [201:300] / [301:400]
    // 공기밀도 고정
 
    register int area, velocity, label = 1;
    double density = 0.000001, DRAG_CO, DRAG, DRAG_CO_2nd;
 
    FILE* fout = fopen("[0] data_out.txt""w");
    if (!fout) return -1;
 
    for (area = 4; area <= 14; area += 2)
    {
        for (velocity = 90; velocity <= 400; velocity += 10)
        {
            if (velocity >= && velocity <= 200) DRAG_CO = DRAG_co[0];
            else if (velocity >= 201 && velocity <= 300) DRAG_CO = DRAG_co[1];
            else if (velocity >= 301 && velocity <= 400) DRAG_CO = DRAG_co[2];
 
            DRAG = drag(DRAG_CO, density, velocity, area);
            DRAG_CO_2nd = drag_co(DRAG, density, velocity, area);
 
            cout << setw(5<< setfill(' '<< label++
                << setw(10<< setfill(' '<< area
                << setw(10<< setfill(' '<< velocity;
            printf("\t%.0le\t%.4le\n", density, DRAG_CO_2nd);
 
            fprintf(fout, "%5d%10d%10d\t%.0le\t%.4le\n",
                label-1, area, velocity, density, DRAG_CO_2nd);
        }
    }
    
    fclose(fout);
    return 0;
}
 
double drag_co(const double& drag, const double& air_density, const double& velocity, const double& area)
{
    // Cd = drag / (PV^2 * A /2)
    double drag_co = drag / ((air_density * pow(velocity, 2* area) / 2);
    return drag_co;
}
 
double drag(const double& drag_co, const double& air_density, const double& velocity, const double& area)
{
    // drag = Cd * (PV^2 * A /2)
    double drag = drag_co * ((air_density * pow(velocity, 2* area) / 2);
    return drag;
}
cs

[swift] 2D-array is continuos




[Abstract]

 In c/c++ programming, 2D-array is massively used to deal with the large and practical data as like images, video frames, or any kind of scientific ones. When accessing this array, it is too well-introduced to use double-for-statement, but my goal here is to refresh that the array itself in the physical memory space is just continuous.

 Thus in certain cases, it reduces the processing time to make use of this feature. In brief, eliminate one of the for-statement from the double-shell, and make it to calculate the address inside the for-statement to reduce the overhead of iterative assembly-branch-instructions.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <iostream>
#include <atlstr.h>
#include <math.h>
using namespace std;
 
int main(void)
{
#define ROWS 10
#define COLS 10
    
    double data[ROWS][COLS];    // data[row][col]
    double *pData = data[0];    // data[row] is pointer!!
 
    register int row, col;        // generic index for 2D-array
    register int rows = sizeof(data) / sizeof(data[0]);
    register int cols = sizeof(data[0]) / sizeof(data[0][0]);
    
    // file opened
    FILE* fin = fopen("[0] data.txt""r");
    if(!fin) return -1;
    cout << endl << endl;
 
    //------------------------------------------------------------------------
    // case[1] : generic method : double for statement
    //------------------------------------------------------------------------
    for (row = 0; row < rows; ++row)
    {
        for (col = 0; col < cols; ++col)
        {
            fscanf(fin, "%lf"&data[row][col]); // data[row][col] is value !!
            printf("%10.2lf ", data[row][col]);
        }
        cout << endl;
    }
    //------------------------------------------------------------------------
 
    cout << endl << endl;
    fclose(fin);
 
    fin = fopen("[0] data.txt""r");
    if (!fin) return -1;
 
    //------------------------------------------------------------------------
    // case[2] : continuos in memory space
    //------------------------------------------------------------------------    
    register int i;
    for (i = 0; i < rows * cols; ++i)
    {
        fscanf(fin, "%lf", pData + i);
        printf("%10.2lf "*(pData + i));
        if (i % cols == cols - 1cout << endl;
    }
    //------------------------------------------------------------------------
 
    cout << endl << endl;
    fclose(fin);
    
    return 0;
}
cs

[swift] c++, SearchNearestArray




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <Windows.h>    // rand
#include <iostream>        // cout
#include <iomanip>        // setw, setfill
using namespace std;
 
void RandomSeed(void);
void RandomizeArray(int *ary, const int& size, const int& range);
 
struct valLoc
{
    int val;
    int loc;
};
valLoc SearchNearestArray(int *arry, const int& stroke, const int& size);
 
int main(void)
{
#define ArraySize 20
 
    RandomSeed();
    register int i = 0;
    int ary[ArraySize] = { };
    register int arySize = sizeof(ary) / sizeof(ary[0]);
    {
        cout << setw(20<< setfill(' '<< "Initial Array : ";
        for (i = 0; i < arySize; ++i)
            cout << ary[i] << " ";
        cout << endl;
    }
 
    RandomizeArray(ary, arySize, 10);
    {
        cout << setw(20<< setfill(' '<< "Randomized Array : ";
        for (i = 0; i < arySize; ++i)
            cout << ary[i] << " ";
        cout << endl;
    }
 
    valLoc found = SearchNearestArray(ary, 10, arySize);
    {
        cout << endl << endl;
    }
 
    return 0;
}
 
 
valLoc SearchNearestArray(int *ary, const int& stroke, const int& size)
{
    register int dist, minDist = abs(stroke - ary[0]), loc;
    valLoc found;
 
    register int isMatched = false;
    for (register int i = 0; i < size; ++i)
    {
        if (stroke == ary[i])
        {
            isMatched = true;
            loc = i;
            break;
        }
 
        dist = abs(stroke - ary[i]);
        if (dist < minDist)
        {
            minDist = dist;
            loc = i;
        }
    }
    found.loc = loc;
 
    if(isMatched)
    {
        found.val = stroke;
        cout << ">> Matched number "
            << found.val << " at ["
            << found.loc << "]" << endl << endl;
    }
    else
    {
        found.val = ary[loc];
        cout << endl << ">> Failed to locate " << stroke
            << ". Nearest number is " << found.val << ", at ["
            << found.loc << "]"<< endl << endl;
    }
 
    return found;
}
 
void RandomizeArray(int *ary, const int& size, const int& range)
{
    for (register int i = 0; i < size; ++i)
        ary[i] = rand() % range;
}
 
void RandomSeed(void)
{
    LARGE_INTEGER SEED;
    ::QueryPerformanceCounter(&SEED);
    srand(static_cast<UINT>(SEED.QuadPart));
}
cs