Skip to content

Commit 4c6d796

Browse files
committed
move posts
1 parent 6244da6 commit 4c6d796

File tree

59 files changed

+5126
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5126
-0
lines changed
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
---
2+
date: 2020-10-09
3+
layout: post
4+
title: "C# Abstract/Interface"
5+
description: "Abstract/Interface"
6+
image: /assets/img/posts/image/csharp.png
7+
optimized_image: /assets/img/posts/image/csharp.png
8+
category: C Sharp
9+
tags:
10+
- C#
11+
- .NET
12+
author: chanos
13+
---
14+
>[Git Source](https://github.com/chanos-dev/blogcode/tree/master/20-1009)
15+
16+
---
17+
18+
### - Abstract -
19+
- 미완성된 클래스이다. (추상 메서드를 포함)
20+
- 목적은 여러 개의 자식 클래스에 공통적인 정의를 제공하는 것이다.
21+
- 생성자를 가질 수 있다.
22+
- 인스턴스화할 수 없다.
23+
- 멤버 변수 선언이 가능하다.
24+
- 접근 제한자를 사용할 수 있다. <b>(private, protected, internal)</b>
25+
- 다중 상속이 불가능하다.
26+
27+
```c#
28+
class Program
29+
{
30+
static void Main(string[] args)
31+
{
32+
Animal[] animals = new Animal[3];
33+
animals[0] = new Dog("바둑이", "진돗개");
34+
animals[1] = new Cat("초롱이", "페르시안");
35+
animals[2] = new Pigeon("구구", "바위");
36+
37+
foreach (Animal animal in animals)
38+
{
39+
animal.GetInfo();
40+
animal.Sound();
41+
animal.Run();
42+
animal.Fly();
43+
}
44+
45+
}
46+
}
47+
48+
abstract class Animal
49+
{
50+
protected string Name;
51+
protected string Type;
52+
53+
public abstract void Run();
54+
public abstract void Fly();
55+
public abstract void Sound();
56+
57+
public void GetInfo()
58+
{
59+
Console.WriteLine($"너의 이름은 {Name}, 종류는 {Type}!!");
60+
}
61+
}
62+
63+
class Dog : Animal
64+
{
65+
public Dog(string name, string type)
66+
{
67+
Name = name;
68+
Type = type;
69+
}
70+
71+
public override void Fly()
72+
{
73+
Console.WriteLine("멍멍~! 못날아요~!");
74+
}
75+
76+
public override void Run()
77+
{
78+
Console.WriteLine("주인님 한테 달려가아~!");
79+
}
80+
81+
public override void Sound()
82+
{
83+
Console.WriteLine("멍멍!");
84+
}
85+
86+
87+
}
88+
89+
class Cat : Animal
90+
{
91+
public Cat(string name, string type)
92+
{
93+
Name = name;
94+
Type = type;
95+
}
96+
97+
public override void Fly()
98+
{
99+
Console.WriteLine("냐옹~! 못날아요~!");
100+
}
101+
102+
public override void Run()
103+
{
104+
Console.WriteLine("상자 속으로 달려가아~!");
105+
}
106+
107+
public override void Sound()
108+
{
109+
Console.WriteLine("냐옹!");
110+
}
111+
}
112+
113+
class Pigeon : Animal
114+
{
115+
public Pigeon(string name, string type)
116+
{
117+
Name = name;
118+
Type = type;
119+
}
120+
121+
public override void Fly()
122+
{
123+
Console.WriteLine("하늘 위로..!!");
124+
}
125+
126+
public override void Run()
127+
{
128+
Console.WriteLine("구구~! 못달려요~!");
129+
}
130+
131+
public override void Sound()
132+
{
133+
Console.WriteLine("구구!");
134+
}
135+
}
136+
```
137+
```
138+
결과:
139+
너의 이름은 바둑이, 종류는 진돗개!!
140+
멍멍!
141+
주인님 한테 달려가아~!
142+
멍멍~! 못날아요~!
143+
너의 이름은 초롱이, 종류는 페르시안!!
144+
냐옹!
145+
상자 속으로 달려가아~!
146+
냐옹~! 못날아요~!
147+
너의 이름은 구구, 종류는 바위!!
148+
구구!
149+
구구~! 못달려요~!
150+
하늘 위로..!!
151+
```
152+
---
153+
154+
### - Interface -
155+
- 멤버 변수를 선언이 불가능하다. (그 외 가능)
156+
- 메서드의 구현이 없다. (선언만 가능)
157+
- 모든 접근 제한자가 <b>public</b>이다.
158+
- 여러 클래스의 공통적인 기능을 약속하기 위함이다.
159+
- 다중 상속이 가능하다.
160+
161+
```c#
162+
class Program
163+
{
164+
static void Main(string[] args)
165+
{
166+
Dragon dragon = new Dragon("용용이", "아이스드래곤");
167+
dragon.Breath();
168+
dragon.MoveFly();
169+
}
170+
}
171+
172+
interface IAttack
173+
{
174+
void Breath();
175+
}
176+
177+
interface IMove
178+
{
179+
void MoveGround();
180+
void MoveFly();
181+
}
182+
183+
class Dragon : IAttack, IMove
184+
{
185+
private string name;
186+
private string type;
187+
188+
public Dragon(string name, string type)
189+
{
190+
this.name = name;
191+
this.type = type;
192+
}
193+
194+
public void Breath()
195+
{
196+
Console.WriteLine($"{this.name}의 공격!");
197+
}
198+
199+
public void MoveFly()
200+
{
201+
Console.WriteLine($"{this.name}가 땅에서 이동");
202+
}
203+
204+
public void MoveGround()
205+
{
206+
Console.WriteLine($"{this.name}가 하늘에서 이동");
207+
}
208+
}
209+
```
210+
```
211+
결과:
212+
용용이의 공격!
213+
용용이가 땅에서 이동
214+
```
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
date: 2020-10-14
3+
layout: post
4+
title: "ES 윈도우 Elasticsearch 설치"
5+
description: "윈도우 ES 설치"
6+
image: /assets/img/posts/image/elasticsearch.png
7+
optimized_image: /assets/img/posts/image/elasticsearch.png
8+
category: ElasticSearch
9+
tags:
10+
- Elasticsearch
11+
- ES
12+
author: chanos
13+
---
14+
- 목차
15+
- ES 윈도우 ElasticSearch 설치 👈
16+
- [ES ElasticSearch (1)]({{ site.url }}/ElasticSearch(1)/)
17+
- [ES ElasticSearch (2)]({{ site.url }}/ElasticSearch(2)/)
18+
- [ES ElasticSearch (3)]({{ site.url }}/ElasticSearch(3)/)
19+
20+
---
21+
오늘은 검색엔진 서비스 중 하나인 ElasticSearch를 윈도우에서 설치 해보도록 하겠다. 👍
22+
23+
#### 앞으로 실습 환경은 다음과 같다. ✔
24+
`OS : Windows 10 Pro`
25+
`ES : 7.9.2`
26+
27+
>ElasticSearch [다운로드](https://www.elastic.co/kr/downloads/elasticsearch)
28+
29+
![ElasticSearch_DownloadPage](/assets/img/posts/2020-10-14/download.png)
30+
31+
#### - 설치 순서 -
32+
33+
1. `elasticsearch-7.9.2-windows-x86_64.zip` 파일 압축 풀기
34+
![ElasticSearch_install_1](/assets/img/posts/2020-10-14/install_1.png)
35+
36+
2. `cmd -> cd 'elasticsearch folder'/bin` cmd 실행 후 directory 이동
37+
38+
3. `elasticsearch.bat` bin폴더 안에 있는 elasticsearch.bat파일 실행
39+
![ElasticSearch_install_2](/assets/img/posts/2020-10-14/install_2.png)
40+
41+
4. 다음과 같이 `started` 문구가 뜨면 ElasticSearch 서비스가 정상적으로 구동이 된것이다.
42+
![ElasticSearch_install_3](/assets/img/posts/2020-10-14/install_3.png)
43+
44+
5. 웹 브라우저 실행 후 `localhost:9200` 접속 시 다음과 같이 뜨면 성공! 😆
45+
![ElasticSearch_install_4](/assets/img/posts/2020-10-14/install_4.png)
46+
47+
> 다음은 ElasticSearch에 대하여 알아보도록 하자.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
date: 2020-10-15
3+
layout: post
4+
title: "ES ElasticSearch (1)"
5+
description: "ElasticSearch란"
6+
image: /assets/img/posts/image/elasticsearch.png
7+
optimized_image: /assets/img/posts/image/elasticsearch.png
8+
category: ElasticSearch
9+
tags:
10+
- Elasticsearch
11+
- ES
12+
author: chanos
13+
---
14+
- 목차
15+
- [ES 윈도우 ElasticSearch 설치]({{ site.url }}/ElasticSearchInstall-Windows/)
16+
- ES ElasticSearch (1) 👈
17+
- [ES ElasticSearch (2)]({{ site.url }}/ElasticSearch(2)/)
18+
- [ES ElasticSearch (3)]({{ site.url }}/ElasticSearch(3)/)
19+
20+
---
21+
> <b>ElasticSearch</b> 👀
22+
23+
- Apache Lucene으로 구현한 Restful API 기반의 검색엔진이다.
24+
- Lucene - 풀텍스트 검색 엔진을 만들 수 있는 자바 라이브러리.
25+
- 방대한 양의 데이터를 신속하게 처리 가능하다.
26+
- 거의 실시간(NRT, Near Real Time)으로 저장, 검색, 분석이 가능하다.
27+
- 고가용성 보장, 쉬운 스케일 아웃
28+
29+
> <b>ES</b>는 역색인 구조 📑
30+
31+
| Document | Value |
32+
| :------ | :----------- |
33+
| Document1 | 악어는 무섭다 |
34+
| Document2 | 악어의 눈물 |
35+
| Document3 | 악어와 악어새 |
36+
37+
- 다음과 같이 데이터가 있을 경우 ES는 데이터를 역색인 구조로 데이터를 관리한다.
38+
39+
| Value | Document |
40+
| :------| :----------- |
41+
| 악어 | Document1, Document2, Document3 |
42+
| 무섭다 | Document1 |
43+
| 눈물 | Document2 |
44+
| 악어새 | Document3 |
45+
46+
- Hashtable의 구조를 갖고 있기 때문에 O(1)의 시간복잡도를 가져 빠른 속도로 검색을 할 수 있다.
47+
48+
> <b>ES</b> <-> <b>RDBMS</b> ❓
49+
50+
- ES를 RDBMS의 다음과 같이 비교하여 생각하면 조금 쉽게 접근할 수 있을것같다.
51+
52+
| ES | RDBMS |
53+
| :------ | :------ |
54+
| Index | Database |
55+
| Type | Table |
56+
| Document | Row |
57+
| Field | Column |
58+
| Mapping | Schema |
59+
60+
- ES
61+
- Document간의 Join이 불가능하다.
62+
- 트랜잭션이 제공되지 않는다.
63+
- Elastic Search 6.x 버전 이후 부터는 type이 없어졌다.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
date: 2020-10-21
3+
layout: post
4+
title: "C# 응용프로그램 실행하기"
5+
description: "Process.Start"
6+
image: /assets/img/posts/image/csharp.png
7+
optimized_image: /assets/img/posts/image/csharp.png
8+
category: C Sharp
9+
tags:
10+
- C#
11+
- .NET
12+
author: chanos
13+
---
14+
>[Git Source](https://github.com/chanos-dev/blogcode/tree/master/20-1021)
15+
16+
---
17+
18+
![program](/assets/img/posts/2020-10-21/program.png)
19+
20+
```c#
21+
private void button_Process_Click(object sender, EventArgs e)
22+
{
23+
if (string.IsNullOrEmpty(textBox_Process.Text))
24+
return;
25+
26+
Process.Start(textBox_Process.Text);
27+
}
28+
29+
private void button_args_Click(object sender, EventArgs e)
30+
{
31+
if ((string.IsNullOrEmpty(textBox_args.Text)) || (string.IsNullOrEmpty(textBox_args1.Text)))
32+
return;
33+
34+
Process.Start(textBox_args.Text, textBox_args1.Text);
35+
}
36+
```
37+
38+
### - Process.Start -
39+
40+
41+
```c#
42+
using System.Diagnostics; //추가
43+
...
44+
//응용프로그램 실행
45+
Process.Start("http://www.google.co.kr"); //인터넷 실행
46+
47+
Process.Start("C:\Windows\System32"); //폴더 실행
48+
49+
Process.Start("cmd.exe"); //cmd 실행
50+
51+
//arguments 전달
52+
Process.Start("cmd.exe", "\c ping 8.8.8.8); //cmd - ping 8.8.8.8 커맨드 실
53+
```

0 commit comments

Comments
 (0)