Skip to content

Instantly share code, notes, and snippets.

View namkyu's full-sized avatar

Namkyu Lee namkyu

View GitHub Profile
@namkyu
namkyu / thymeleafTest.md
Last active August 17, 2018 07:22
basic #thymeleaf

ํŽ˜์ด์ง€ ๋ ˆ์ด์•„์›ƒ

<div class="col-md-3 left_col" th:replace="fragments/left :: left">
    left ๋ฉ”๋‰ด
</div>

fragments ๋””๋ ‰ํ† ๋ฆฌ์— left.html ํŒŒ์ผ ์ƒ์„ฑ ํ›„ ๋‹ค์Œ์˜ ์ฝ”๋“œ ์ถ”๊ฐ€
<div class="col-md-3 left_col" th:fragment="left">...</div>
public class DeadLockTest {
public void method1() {
String name = new Thread().getName();
synchronized (String.class) {
System.out.println("[" + new Thread().getName() + "] Aquired lock on String.class object in the method1");
try { Thread.sleep(100); } catch (InterruptedException e) {}
synchronized (Integer.class) {
@namkyu
namkyu / lambda.md
Last active February 17, 2025 04:09
lambda #java8

๋žŒ๋‹ค์‹

(int n, String str) -> { return str + n; }
(int n, String str) -> str + n
(n, str) -> str + n
str -> str + 1
() -> "Hello, World!"
() -> {}
@namkyu
namkyu / File.java
Created June 1, 2018 04:56
ํŒŒ์ผ read #java
// webApp ์Šคํƒ€์ผ
String templatePath = "excel/template_delivery.xls";
System.out.println("ํด๋ž˜์Šค ๋กœ๋” : " + getClass().getClassLoader().getResource(templatePath).toString());
// spring boot ์Šคํƒ€์ผ
ClassPathResource classPathResource = new ClassPathResource(templatePath);
System.out.println("ํด๋ž˜์Šค ํŒจ์Šค ๋ฆฌ์†Œ์Šค getPath : " + classPathResource.getPath());
System.out.println("ํด๋ž˜์Šค ํŒจ์Šค ๋ฆฌ์†Œ์Šค getURL : " + classPathResource.getURL());
System.out.println("ํด๋ž˜์Šค ํŒจ์Šค ๋ฆฌ์†Œ์Šค toString : " + classPathResource.toString());
@namkyu
namkyu / excel.md
Last active May 30, 2018 00:47
excel #excel

์—ด๊ณ ์ •

๋ณด๊ธฐ > ๊ณ ์ • > ํ˜„์žฌ ์—ด๊นŒ์ง€ ๊ณ ์ •

ํŠน์ •์…€ ๊ณ ์ •๊ฐ’

$ ๋ฅผ ์ถ”๊ฐ€ํ•ด ์ค€๋‹ค. ($N$3)
=(E6 * F6) * ($N$3 / 100)
@namkyu
namkyu / Android.md
Last active August 3, 2021 08:14
android #android

์ฝ”ํ‹€๋ฆฐ ์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •

> ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ์„ค์น˜ (version : 3.1.2)
> ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ์‹œ์ž‘ ํ•˜๋ฉด Setup Wizard์—์„œ SDK ์„ค์น˜ ๊ฐ€๋Šฅ ํ•˜๋‹ค.
> Start a new Android Studio project
  - Include Kotlin support ์ฒดํฌ
> kotlin ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜ (์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค 3๋ฒ„์ „ ์ดํ›„๋ถ€ํ„ฐ๋Š” kotlin ๊ธฐ๋ณธ ํƒ‘์žฌ)
> ์ƒˆ ํ”„๋กœ์ ํŠธ
> Include Kotlin support ์ฒดํฌ
> IDE ์ƒ๋‹จ์˜ Run ์‹คํ–‰
@namkyu
namkyu / annotaion.kt
Last active May 23, 2018 08:28
kotlin test #kotlin
@AnnoClass("nklee")
class AnnoClassImple {
}
@namkyu
namkyu / JsoupTest.java
Created May 16, 2018 00:50
Jsoup #jsoup
package com.kyu.app;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.safety.Cleaner;
import org.jsoup.safety.Whitelist;
import org.jsoup.select.Elements;
import org.junit.Test;
@namkyu
namkyu / algorithm.md
Last active May 8, 2018 01:27
algorithm #algorithm

selection sort

@Test
public void selectionSort() {
    int[] array = {10, 8, 99, 7, 1, 5, 88, 9};
    selection_sort(array);
    System.out.println(Arrays.toString(array));
}

private static void selection_sort(int[] input) {
@namkyu
namkyu / springboot2.0.md
Last active May 8, 2018 01:06
spring boot 2.0 ์ •๋ฆฌ #spring_boot

์‹œ์ž‘ํ•˜๊ธฐ

maven์€ pom ํŒŒ์ผ์„ ์ƒ์†๋ฐ›๋Š”๋‹ค.
<parent> ์•ˆ์— ๋ถ€๋ชจ๋ฅผ ์„ ์–ธํ•œ๋‹ค.
<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.0.0.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>