0222 - 0229


# 0222 - 0229

# 0222 - DATA ์†์„ฑ

# html ํƒœ๊ทธ ๋‚ด์—์„œ data๋ฅผ ๋‹ค๋ฃธ

  • data-{name} ๋กœ์‹œ์ž‘
  • ํ•˜์ดํ”ˆ์œผ๋กœ ๊ตฌ๋ถ„, ์ ‘๊ทผ์‹œ ๋Œ€์‹œ๋“ค์€ camelCase๋กœ ๋ณ€ํ™˜
  1. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ์ ‘๊ทผ
    • document.getElementById('selector').dataset.{name}
    • ์“ฐ๋Š” ๊ฒฝ์šฐ๋Š” = ๋กœ ๊ฐ’ ๋Œ€์ž…
  2. ์ œ์ด์ฟผ๋ฆฌ์—์„œ ์ ‘๊ทผ
    • $('selector').data(key, value);
    • $('selector').data(key);
    • $('selector').removeData('key');
  3. css์—์„œ ์ ‘๊ทผ
    • 'selector'[data-{name=๊ฐ’}] {

      }



# 0223 - HTML ์ด๋ฉ”์ผ ํ…œํ”Œ๋ฆฟ ๋งŒ๋“ค๊ธฐ

1. ๊ธฐ๋ณธ htmlํ‹€ ์ƒ์„ฑ

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Demystifying Email Design</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
</html>

2. ๋Œ€๋ถ€๋ถ„์˜ ๋ฉ”์ผ์—์„œ body์™€ div๋ฅผ ์ง€์› ํ•˜์ง€ ์•Š๊ธฐ ๋–„๋ฌธ์— tableํƒœ๊ทธ๋ฅผ ์ƒ์„ฑ

<body style="margin: 0; padding: 0;">
 <table border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
   <td>
    Hello!
   </td>
  </tr>
 </table>
</body>

3. html ํƒœ๊ทธ์—์„œ ์ง€์›ํ•˜๋Š” ์†์„ฑ์„ ์šฐ์„  ์ ์œผ๋กœ ์‚ฌ์šฉ

<table align="center" border="1" cellpadding="0" cellspacing="0" width="600">
 <tr>
  <td bgcolor="#70bbd9">
   Row 1
  </td>
 </tr>
 <tr>
  <td bgcolor="#ffffff">
   Row 2
  </td>
 </tr>
 <tr>
  <td bgcolor="#ee4c50">
   Row 3
  </td>
 </tr>
</table>

4. ์ด๋ฏธ์ง€ ํƒœ๊ทธ ์‚ฌ์šฉ์‹œ

<td align="center" bgcolor="#70bbd9" style="padding: 40px 0 30px 0;">
 <img src="images/h1.gif" alt="Creating Email Magic" width="300" height="230" style="display: block;" />
</td>

5. ์˜์—ญ์„ ๋˜ ๋‚˜๋ˆŒ๋•Œ

<td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;">
 <table border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
   <td>
    Row 1
   </td>
  </tr>
  <tr>
   <td>
    Row 2
   </td>
  </tr>
  <tr>
   <td>
    Row 3
   </td>
  </tr>
 </table>
</td>

6. style์€ inline ์Šคํƒ€์ผ๋กœ

<table border="1" cellpadding="0" cellspacing="0" width="100%">
 <tr>
  <td width="260" valign="top">
   Column 1
  </td>
  <td style="font-size: 0; line-height: 0;" width="20">
   &nbsp;
  </td>
  <td width="260" valign="top">
   Column 2
  </td>
 </tr>
</table>


# 0224 - C๋™์  ํ• ๋‹น

# void *malloc(size t size)

  • ๋Ÿฐํƒ€์ž„ ํ™˜๊ฒฝ์—์„œ ๋™์ ์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹น
  • ๋™์ ์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ• ๋‹น ํ• ๋•Œ๋Š” Heap์˜์—ญ์— ํ• ๋‹น
  • ์„ฑ๊ณต ํ•˜๋ฉด ํ• ๋‹นํ•œ ๋ฉ”๋ชจ๋ฆฌ์˜ ์ฒซ๋ฒˆ์งธ ์ฃผ์†Œ ๋ฆฌํ„ด
  • ์‹คํŒจํ•˜๋ฉด NULL์„ ๋ฆฌํ„ด

# void free(ํ•ด์ œํ•  ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ๊ฐ’)

  • malloc์œผ๋กœ ์ƒ์„ฑ๋œ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ์„ ์ œ๊ฑฐํ•จ.


# 0225 - JavaScript - $.each / forEach / some / map

# $.each()

  • $.each(Array, callback function(index, value){ });
    • ๋ฐ˜ํ™˜๊ฐ’ ํ•ด๋‹น ๋ฐฐ์—ด

# forEach

  • Array.forEach(callback function (value, index, array) { });
    • ๋ฐ˜ํ™˜๊ฐ’ ์—†์Œ

# some

  • Array.some(callback function (value, index, array) { });
    • ์ฐพ๋Š” ๊ฐ’๊ณผ ๋น„๊ตํ•˜์—ฌ return true ์‹œ ๋ฐ˜๋ณต๋ฌธ ์ข…๋ฃŒ

# map

  • Array.map(callback(currentValue[, index[, array]])[, thisArg]);
    • return์‹œ ๋ฐฐ์—ด์˜ ๊ฐ ์š”์†Œ์— ๋Œ€ํ•ด callback์„ ์‹คํ–‰ํ•˜๊ณ  ์‹คํ–‰๊ฒฐ๊ณผ๋ฅผ ๋ชจ์€ ์ƒˆ ๋ฐฐ์—ด์„ ๋ฆฌํ„ดํ•จ


# 0226 - Spring AOP

๊ด€์  ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์œผ๋กœ "๊ธฐ๋Šฅ์„ ํ•ต์‹ฌ ๋น„์ง€๋‹ˆ์Šค ๊ธฐ๋Šฅ๊ณผ ๊ณตํ†ต ๊ธฐ๋Šฅ์œผ๋กœ ๊ตฌ๋ถ„ํ•˜๊ณ , ๊ณตํ†ต๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœ์ž์˜ ์ฝ”๋“œ ๋ฐ–์—์„œ ํ•„์š”ํ•œ ์‹œ์ ์— ์ ์šฉํ•˜๋Š” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฉ๋ฒ•"์ด๋‹ค.

# advice / pointcut / joinpoint

# aspect ๊ตฌ์„ฑ

  1. @Aspect์„ ๋“ฑ๋ก
  2. advice ๋ฉ”์†Œ๋“œ๋ฅผ ์ƒ์„ฑ
  3. advice์— joinpoint๋ฅผ ๋“ฑ๋ก
  4. joinpoint์— pointcut์„ ์ง€์ •


# 0227 - lombok

# ์ฃผ์˜์‚ฌํ•ญ

  • @Data ์ง€์–‘ํ•˜๊ธฐ
  • ๋ฌด๋ถ„๋ณ„ํ•œ @Setter ์ง€์–‘ํ•˜๊ธฐ
  • @ToString ์–‘๋ฐฉํ–ฅ ์ˆœํ™˜ ์ฐธ์กฐ ๋ฌธ์ œ ํ”ผํ•˜๊ธฐ
  • @EqualsAndHashCode ๋‚จ๋ฐœ ์ง€์–‘ํ•˜๊ธฐ
    • ์„ฑ๋Šฅ ์ด์Šˆ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ (Set ์ž๋ฃŒ๊ตฌ์กฐ)
  • ํด๋ž˜์Šค ์ƒ๋‹จ์˜ @Builder๋Š” ์ง€์–‘ํ•˜๊ธฐ
    • ํด๋ž˜์Šค ์œ„์— @Builder ์‚ฌ์šฉ ์‹œ @AllArgsConstructor ํšจ๊ณผ ๋ฐœ์ƒ
    • ์ƒ์„ฑ์ž ์œ„ @Builder์— ์ ์ ˆํ•œ ๊ถŒํ•œ ๋ถ€์—ฌ
  • ์ƒ์„ฑ์ž์˜ ์ ‘๊ทผ ์ง€์‹œ์ž๋Š” ์ตœ์†Œํ•œ
    • @NoArgsConstructor(access = AccessLevel.PRIVATE)


# 0228 - ์˜์กด์„ฑ ์ฃผ์ž… ๋ฐฉ๋ฒ•

# ์ƒ์„ฑ์ž ์ฃผ์ž…(Constructor Injection)

์ƒ์„ฑ์ž๋ฅผ ํ†ตํ•ด ์˜์กด ๊ด€๊ณ„๋ฅผ ์ฃผ์ž…

  1. ์ƒ์„ฑ์ž์˜ ํ˜ธ์ถœ ์‹œ์ ์— 1ํšŒ ํ˜ธ์ถœ ๋˜๋Š”๊ฒƒ์ด ๋ณด์žฅ
  2. ์ฃผ์ž…๋ฐ›์€ ๊ฐ์ฒด๊ฐ€ ๋ณ€ํ•˜์ง€ ์•Š๊ฑฐ๋‚˜, ๋ฐ˜๋“œ์‹œ ๊ฐ์ฒด์˜ ์ฃผ์ž…์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ์— ๊ฐ•์ œํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
  3. ์ƒ์„ฑ์ž๊ฐ€ 1๊ฐœ๋งŒ ์žˆ์„๊ฒฝ์šฐ @Autowired๋ฅผ ์ƒ๋žตํ•ด๋„ ์ฃผ์ž…๊ฐ€๋Šฅ

# ์ˆ˜์ •์ž ์ฃผ์ž…(Setter ์ฃผ์ž…, Setter Injection)

์ฃผ์ž…๋ฐ›๋Š” ๊ฐ์ฒด๊ฐ€ ๋ณ€๊ฒฝ๋  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ

# ํ•„๋“œ ์ฃผ์ž…(Field Injection)

ํ•„๋“œ์— ๋ฐ”๋กœ ์˜์กด ๊ด€๊ณ„ ์ฃผ์ž…

  1. ์™ธ๋ถ€์—์„œ ๋ณ€๊ฒฝ์ด ๋ถˆ๊ฐ€๋Šฅ
  2. ํ•„๋“œ ์ฃผ์ž…์€ ๋ฐ˜๋“œ์‹œ DI ํ”„๋ ˆ์ž„์›Œํฌ๊ฐ€ ์กด์žฌํ•ด์•ผํ•จ ๋”ฐ๋ผ์„œ ์ง€์–‘ํ•ด์•ผํ•จ

# ์ผ๋ฐ˜ ๋ฉ”์†Œ๋“œ ์ฃผ์ž…

# ์ƒ์„ฑ์ž ์ฃผ์ž…์„ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ 

Spring์„ ํฌํ•จํ•œ DI ํ”„๋ ˆ์ž„์›Œํฌ์˜ ๋Œ€๋ถ€๋ถ„์ด ์ƒ์„ฑ์ž ์ฃผ์ž…์„ ๊ถŒ์žฅ

  1. ๊ฐ์ฒด์˜ ๋ถˆ๋ณ€์„ฑ ํ™•๋ณด
  • ์˜์กด๊ด€๊ณ„ ์ฃผ์ž…์˜ ๋ณ€๊ฒฝ์ด ํ•„์š”ํ•œ ์ƒํ™ฉ์€ ๊ฑฐ์˜ ์—†๋‹ค. ์ƒ์„ฑ์ž ์ฃผ์ž…์„ ํ†ตํ•ด ๋ณ€๊ฒฝ์˜ ๊ฐ€๋Šฅ์„ฑ์„ ๋ฐฐ์ œํ•˜๊ณ  ๋ถˆ๋ณ€์„ฑ์„ ๋ณด์žฅ
  1. ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์˜ ์ž‘์„ฑ
  • ํ•„๋“œ ์ฃผ์ž…์œผ๋กœ ์ž‘์„ฑ๋œ ๊ฒฝ์šฐ์—๋Š” ์ˆœ์ˆ˜ํ•œ ์ž๋ฐ” ์ฝ”๋“œ๋กœ ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅ
  1. final ํ‚ค์›Œ๋“œ ์ž‘์„ฑ ๋ฐ Lombok๊ณผ์˜ ๊ฒฐํ•ฉ
  • ์ปดํŒŒ์ผ ์‹œ์ ์— ๋ˆ„๋ฝ๋œ ์˜์กด์„ฑ์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Œ
  • ์ƒ์„ฑ์ž ์ฃผ์ž…์„ ์ œ์™ธํ•œ ๋‹ค๋ฅธ ์ฃผ์ž… ๋ฐฉ๋ฒ•๋“ค์€ ๊ฐ์ฒด์˜ ์ƒ์„ฑ ์ดํ›„์— ํ˜ธ์ถœ ๋˜๋ฏ€๋กœ final ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์—†๋‹ค.
  • finalํ‚ค์›Œ๋“œ๋ฅผ ๋ถ™์ผ ์ˆ˜ ์žˆ์Œ์œผ๋กœ Lombok๊ณผ ๊ฒฐํ•ฉ, ์ฝ”๋“œ๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž‘์„ฑ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  1. ์ˆœํ™˜ ์ฐธ์กฐ ์—๋Ÿฌ ๋ฐฉ์ง€
  • ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ตฌ๋™ ์‹œ์ (๊ฐ์ฒด์˜ ์ƒ์„ฑ ์‹œ์ )์— ์ˆœํ™˜ ์ฐธ์กฐ ์—๋Ÿฌ๋ฅผ ๋ฐฉ์ง€
Last update: September 13, 2022 21:44
Contributors: ahnjs , jaesungahn91