<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>chae-heechan.log</title>
        <link>https://velog.io/</link>
        <description></description>
        <lastBuildDate>Tue, 24 Jan 2023 08:11:42 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>chae-heechan.log</title>
            <url>https://images.velog.io/images/chae-heechan/profile/c800b3ac-a342-4e7b-953b-3b78882821ea/social.jpeg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. chae-heechan.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/chae-heechan" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[[Java] 형 변환 정리]]></title>
            <link>https://velog.io/@chae-heechan/Java-%ED%98%95-%EB%B3%80%ED%99%98-%EC%A0%95%EB%A6%AC</link>
            <guid>https://velog.io/@chae-heechan/Java-%ED%98%95-%EB%B3%80%ED%99%98-%EC%A0%95%EB%A6%AC</guid>
            <pubDate>Tue, 24 Jan 2023 08:11:42 GMT</pubDate>
            <description><![CDATA[<p>Primitive 자료형들과 String형 간의 형 변환에 대해 알아보자.</p>
<h1 id="int---string">int &lt;-&gt; String</h1>
<h2 id="int-to-string">int to String</h2>
<p><strong>Integer.toString()</strong></p>
<pre><code>int i = 100;
String S = Integer.toString(1);</code></pre><p><strong>String.valueOf()</strong></p>
<pre><code>int i = 100;
String S = String.valueOf(i);</code></pre><h2 id="string-to-int">String to int</h2>
<p><strong>Integer.parseInt()</strong></p>
<pre><code>String S = &quot;100&quot;;
int i = Integer.parseInt(S);</code></pre><p><strong>Integer.valueOf()</strong></p>
<pre><code>String S = &quot;100&quot;;
int i = Integer.valueOf(S);</code></pre><p>Integer, Double, Float, Long, Short 자료형들 또한 valueOf 함수로 변환이 가능하다.
(Casting하려는 자료형).valueOf(Castring할 값)</p>
<pre><code>Double.valueOf(100);    // 100.0
Integer.valueOf(100.0); // 100</code></pre><hr>
<h1 id="char---int">Char &lt;-&gt; int</h1>
<h2 id="char-to-int">char to int</h2>
<p><strong>(int)</strong></p>
<pre><code>char c = &#39;5&#39;;
int i = (int)(ch - &#39;0&#39;);</code></pre><h2 id="int-to-char">int to char</h2>
<p><strong>(char)</strong></p>
<pre><code>int i = 5;
char c = (char)(i + &#39;0&#39;);</code></pre><p>char 형을 바로 int로 casting하게 되면 해당 숫자의 아스키 코드값으로 변환이 되기 때문에 아스키 코드의 0을 빼줘 해당 숫자로 변환 되게 한다.</p>
<hr>
<h1 id="string---char">String &lt;-&gt; char</h1>
<h2 id="string-to-char">String to char</h2>
<p><strong>charAt()</strong>
<strong>toCharArray()</strong></p>
<pre><code>String s1 = &quot;a&quot;;
String s2 = &quot;abcd&quot;;

char c1 = s1.charAt(0);        // &#39;1&#39;
char c2 = s2.toCharArray();    // 1234</code></pre><h2 id="char-to-string">char to String</h2>
<p><strong>String.valueOf()</strong></p>
<pre><code>char c1 = &#39;a&#39;;
char[] c2 = {&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;};

String s1 = String.valueOf(c1);        // &quot;a&quot;
String s2 = String.valueOf(c2);        // &quot;abcd&quot;</code></pre><p>String은 기본적으로 char의 배열로 이루어져 있기 때문에 toCharArray와 valueOf와 같은 함수로 간단하게 변환이 가능하다.</p>
<hr>
<h1 id="int---float-double">int &lt;-&gt; float, double</h1>
<h2 id="int-to-float-double">int to float, double</h2>
<p><strong>(float, double)</strong></p>
<pre><code>int i = 1234;

double d = (double)i;
float f = (float)i;</code></pre><h2 id="float-double-to-int">float, double to int</h2>
<p><strong>(int)</strong></p>
<pre><code>double d = 100.0;
float f  = 100.0f;

int i;
i = (int)d;
i = (int)f;</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Python] reverse, reversed 차이]]></title>
            <link>https://velog.io/@chae-heechan/Python-reverse-reversed-%EC%B0%A8%EC%9D%B4</link>
            <guid>https://velog.io/@chae-heechan/Python-reverse-reversed-%EC%B0%A8%EC%9D%B4</guid>
            <pubDate>Thu, 03 Jun 2021 15:19:00 GMT</pubDate>
            <description><![CDATA[<h3 id="리스트-뒤집기">리스트 뒤집기</h3>
<p>reverse와 reversed는 둘다 리스트안의 요소를 뒤집는 기능을 가지고 있는 내장 함수이다.
먼저 reverse와 reversed의 사용법에 대해 알아보겠다.</p>
<h3 id="reverse">reverse</h3>
<p>reverse는 쉽게 말해 리스트 안에 있는 요소들을 뒤집어서 다시 저장시켜 놓는 역할을 한다.</p>
<pre><code>my_list = [1, 2, 3, 4, 5]

my_list.reverse()

print(my_list)</code></pre><p>이런 코드가 있다고 할 때, 결과는 무엇일까.</p>
<pre><code>[5, 4, 3, 2, 1]</code></pre><p>결과는 예상대로 뒤집어 져서 나오게 된다.
따라서 my_list의 값은 현재 <strong>[1, 2, 3, 4, 5]</strong>가 아닌 <strong>[5, 4, 3, 2, 1]</strong>이다.</p>
<h3 id="reversed">reversed</h3>
<p>reversed도 reverse 함수와 같이 리스트를 뒤집는 기능을 하는 함수이다.
그럼 다음과 같은 코드의 결과는 어떻게 나올까.</p>
<pre><code>my_list = [1, 2, 3, 4, 5]

your_list = reversed(my_list)

print(your_list)</code></pre><p>예상대로라면 아마 이전 reverse와 같이 나와야 겠지만 결과는 다음과 같다.</p>
<pre><code>&lt;list_reverseiterator object at 0x0000014E1C76EFD0&gt;</code></pre><p>your_list의 type이 예상한대로 list type이 아닌 list_reversiterator type인것이다.
그래서 원하는 값을 출력하기 위해서는 다음과 같은 코드를 사용해야 한다.</p>
<pre><code>my_list = [1, 2, 3, 4, 5]

your_list = reversed(my_list)

print(list(your_list))</code></pre><p>이렇게 되면 원하는 결과인</p>
<pre><code>[5, 4, 3, 2, 1]</code></pre><p>이 출력되게 된다.</p>
<p>이렇게 불편하게 만든 이유가 궁금했다. 그래서 찾아보니 reversed의 쓰임은 따로 있던 것 같다.</p>
<pre><code>my_list = [1, 2, 3, 4, 5]

for count in my_list.reverse():
    print(count)</code></pre><p>뒤집어진 리스트를 사용해 for문을 사용하기 위해 위와같이 사용한다면 이런 에러가 뜬다.</p>
<pre><code>TypeError: &#39;NoneType&#39; object is not iterable</code></pre><p>reverse 함수는 리스트를 뒤집어 주기만 할 뿐, 리턴 값이 없기 때문에 이런 일이 발생하게 된다. 따라서 기존 리스트의 값 변경 없이 리턴 값 만을 필요로 할 때는 reversed 함수를 사용해야겠다.</p>
<h3 id="요약">요약</h3>
<ol>
<li>reverse는 리스트를 뒤집는다. return 값 없음</li>
<li>reversed는 뒤집어진 리스트의 값을 return해준다.</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[2021년 여름방학 로드맵]]></title>
            <link>https://velog.io/@chae-heechan/2021%EB%85%84-%EC%97%AC%EB%A6%84%EB%B0%A9%ED%95%99-%EB%A1%9C%EB%93%9C%EB%A7%B5</link>
            <guid>https://velog.io/@chae-heechan/2021%EB%85%84-%EC%97%AC%EB%A6%84%EB%B0%A9%ED%95%99-%EB%A1%9C%EB%93%9C%EB%A7%B5</guid>
            <pubDate>Tue, 25 May 2021 09:25:33 GMT</pubDate>
            <description><![CDATA[<h2 id="6월">6월</h2>
<h3 id="🐣프론트엔드-기초">🐣프론트엔드 기초</h3>
<ul>
<li>Javascript관련 inflearn강의 수강(웹브라우저 Javascript)</li>
<li>클론코딩 찾아보기</li>
</ul>
<h3 id="🐓학과-공부">🐓학과 공부</h3>
<h2 id="7월">7월</h2>
<h3 id="🐣백엔드-기초">🐣백엔드 기초</h3>
<ul>
<li>Java 이전에 진행했던 예제 + 새로운 예제 작성</li>
<li>Spring관련 inflearn강의 수강(스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술)</li>
<li>Python 예제(깃허브에서 찾아보기)</li>
</ul>
<h2 id="8월">8월</h2>
<h3 id="🐤백엔드-중급">🐤백엔드 중급</h3>
<ul>
<li>Spring관련 inflearn강의 수강(스프링 핵심 원리 - 기본편)</li>
<li><a href="https://github.com/woowacourse">Spring 예제</a> 풀기</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[API 개념 정리]]></title>
            <link>https://velog.io/@chae-heechan/API-%EA%B0%9C%EB%85%90-%EC%A0%95%EB%A6%AC</link>
            <guid>https://velog.io/@chae-heechan/API-%EA%B0%9C%EB%85%90-%EC%A0%95%EB%A6%AC</guid>
            <pubDate>Tue, 25 May 2021 05:37:29 GMT</pubDate>
            <description><![CDATA[<p>여러 공부를 하다보면 대략적인 의미는 알지만 한마디로 설명할 수 없는 용어가 있다. 최근에는 여러 스터디를 하며 API라는 단어를 많이 듣게 되는데 의미는 알고 있지만 정확한 뜻과 개념을 알지못해 정리해보려고 한다.</p>
<p>구글에 API를 검색해본결과, 위키백과에서는 API를 다음과 같이 설명한다.</p>
<blockquote>
<p>API는 응용 프로그램에서 사용할 수 있도록, 운영 체제나 프로그래밍 언어가 제공하는 기능을 제어할 수 있게 만든 인터페이스를 뜻한다.</p>
</blockquote>
<p>설명을 봐도 이해하기 쉽지않다. 그럼 먼저 API의 뜻부터 이해해 봐야겠다.</p>
<h2 id="api란">API란?</h2>
<p>먼저 API는 <strong>Application Programming Interface</strong>로 응용 프로그램 프로그래밍 인터페이스이다. 풀어서 봐도 무슨 말인지 잘 모르겠다. 그럼 한가지씩 뜯어서 보도록 하자.</p>
<h4 id="interface"><em>Interface</em></h4>
<p>Interface는 물건을 조작하기 위한 디자인이라고 한다. 여기서 디자인이란 키보드, 마우스 리모컨과 같은 물리적인 물건 뿐만아니라, 터치스크린을 손가락 두개로 터치하고 벌리면 확대, 모으면 축소와 같은 기기를 작동하는 방식도 포함된다. </p>
<h4 id="programming-interface"><em>Programming Interface</em></h4>
<p>위의 Interface에서의 설명은 사람의 편의를 위한 인터페이스, Human Interface이다. 그럼 Programming Interface는 반대로 프로그래밍을 위한 인터페이스라고 할 수 있다. </p>
<h4 id="application-programming-interface"><em>Application Programming Interface</em></h4>
<p>그렇다면 Application Programming Interface은 쉽다. 응용 프로그램의 프로그래밍을 쉽게 할수 있게 도와주는 디자인이다. 정리하자면 다른 응용 프로그램의 기능을 사용할때 API를 이용하면 쉽게 정보를 얻을 수 있게 되는 것이다. 리모컨으로 채널을 돌릴때 사용자는 TV내부에서 어떻게 작동하는지 알 필요없이 버튼 하나만 누르면 되는 것으로 예를 들 수 있다.</p>
<h2 id="api-예시">API 예시</h2>
<p>이해를 돕기위해 예시를 통해 보도록 하자. 사실 우리는 API를 이미 사용하고 있다. Python으로 다음과 같은 코드를 작성했다고 하자.</p>
<pre><code>print(&quot;Hello World!&quot;)</code></pre><p>우리가 당연히 출력을 위해 사용하던 print메서드도 API다. 이 API가 없다면 우리는 터미널에 &quot;Hello World!&quot;를 띄우기 위해 컴퓨터 메모리를 직접 건드려야 할 것이다. 하지만 우리는 내부에서 어떤 작동을 하는지 알 필요없이 이미 정의된 API인&quot;print&quot;라는 명령어만 사용해서 출력할 수 있다. &quot;print&quot;외에 우리가 사용하는 대부분의 메서드들은 전부 API라고 해도 과언이 아니다.</p>
<p>다음은 조금더 실용적인 예시이다. 내가 어떤 웹페이지를 만들었다. 이 페이지를 많은 사람들이 공유 해줬으면 하는 마음에서 네이버 공유하기 버튼을 만들고 싶다하면 어떻게 할것인가? 만약 API가 없다면 그 버튼을 만들 수 있을지 조차 단언할 수 없을 것이다. 하지만 네이버에서는 그런 API를 제공하고 있다.</p>
<p><a href="https://developers.naver.com/docs/share/navershare/">네이버 공유하기 개발 가이드</a>
<img src="https://images.velog.io/images/chae-heechan/post/d35d3535-5332-477d-bf15-973fde2f63f1/image.png" alt=""></p>
<p>이런 식으로 친절하게 어떤 방식으로 사용해야 하는지 까지 설명해주고 있다. 쉽게말해 사용자는 복붙만 해도 네이버 공유하기를 사용할 수 있는것이다.</p>
<h2 id="오픈-api">오픈 API</h2>
<p>위 네이버 공유와 같은 API를 오픈 API라 하는데 이와 비슷한 무료 API 사이트를 소개하겠다.</p>
<p><a href="https://www.data.go.kr/">공공 데이터 포털</a>
<a href="https://developers.kakao.com/">Kakao Developers</a>
<a href="https://developers.naver.com/">Naver Developers</a></p>
]]></description>
        </item>
    </channel>
</rss>