[Infra] (en) Name convention of host and URL

Name Convention of Host and URL: Reserved characters and unsafe characters. Index Troubleshooting for Name Convention Name Convention Troubleshooting for Name Convention How I occurred the trouble Today, I had to be through very awful exception. There is an api server I have to send a request to update meta data. For performance issue, this server just cached meta data and uses it till updated. Usually it’s quite simple. Make request with RestTemplate in Spring boot. This situation got started two days age. The server which contains api server moved to new ec2 machine, and it had new ip. So I have to send my request to the new ip.

[Cheat Sheet] (en) Java regex cheat sheet

Cheat sheet for Java Regex: Changing plain text, extracting substring. Index Change plain text to Korean Phone Number format Extracting SubString Change plain text to Korean Phone Number format 1 2 3 4 5 6 7 8 public static void testNumber(String src) { Pattern SRC_PHONE_FORMAT = Pattern.compile("(\\d{3})(\\d{4})(\\d{4})"); Pattern DEST_PHONE_FORMAT = Pattern.compile("$1-$2-$3"); String dest = src.replaceFirst(SRC_PHONE_FORMAT.toString(), DEST_PHONE_FORMAT.toString()); System.out.println(dest); } 맨처음에는 패턴들에 통째로 replaceAll을 걸었는데 그럼 결과가 그냥 DEST_PHO

[Backend] (en) Load static/dynamic resource Spring Jar

Handles how to load static or dynamic resource in Spring jar: ClassPathResource, ResourceLoader. Index How to load static/dynamic resource in Spring jar Fun fact How to load static/dynamic resource in Spring jar First case: Static resource Roughly 4 months age, I was assigned to make function with excel. It was like this. I had made a template excel in advance and my colleagues downloaded it and filled it. After that, I read it and inserted data to database. Point of static resource I have to make and save file before deploying. (making jar file) Never got changed, because it’s a template!

[Infra] (en) Write Shell script to deploy server and rotate log

Write shell script to deploy server and rotate log. Index Shell script to deploy server Shell script to rotate log (plus) /dev/null UPDATE VERSION OF SHELL SCRIPT WITH PASSWORD One month ago, I make this shell script with hard coded user password and I knew that was a bad idea. It is well known fact that leaving password somewhere or some files can be a huge problem with security later. So I decided to fix it. How to request password in shell script 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #!

[Cheat Sheet] Linux command cheat sheet

Linux command를 위한 Cheat Sheet: zcat, grep, jar, apt-cache, pgrep, route, ip, watch, wc, ss etc. Index If operation 2021 Cheat Sheet 2020 Cheat Sheet If operation IF operation 2021 Cheat Sheet 압축을 풀지 않고 압축 파일 확인하는 방법 1 2 3 4 5 zcat test2.log.gz # pagination with zcat # cat 커맨드 처럼 less를 뒤에 써주면 된다. zcat test2.log.gz | less 가끔 압축되어있는

[Infra] (en) MySQL View and UNION/JOIN

Handles MySQL View and UNION/JOIN Index Intro View UNION/JOIN Intro Today, I faced my big mistake with new updated function which is made by me as well. The situation is something like this. We have a message service firing with multiple condition such as accomplish of today’s step count or tag reminder of today’s goal. Table Design When we designed tables, we separate to act_message and goal_message. (Obviously, it’s design error. I was supposed to create one table for these two). And there is mp3 file table music_list because the message will be playing designated mp3 file when it gets fired.

[Frontend] (en) How to divide Layout in Thymeleaf

Handles dividing layout in thymeleaf. Index Trouble with not dividend html layout Divide layout Outro Trouble with not dividend html layout How do I feel about not divide html layout. Suffocating with 2000 line! At first, I didn’t know the importance about splitting html and making layout. But when I saw 2000 line html files with so many duplicated code (mostly nav, header, side-bar) I felt like I should change my mind. In my opinion, the good things about such work are … Pros in dividend html layout I don’t have to rewrite every header, footer, side-bar (AKA general frame

[Frontend] (en) How to implement drag and drop?

Implement drag and drop to upload file. Index Intro Implement Drag and Drop Intro Upload file with more action! Few days ago, I had to make a function that is about taking excel file from client side and reading it to save to our database. I usually go as simple as possible in terms of HTML/CSS, but this time I did some research and work! Instead of using basic file chose button, dragging a file and dropping in to a box. I was very happy when finishing these process because I thought it’s quite user friendly interface. [Picture 1] Drag and Drop Implement Drag and Drop HTML <div class="file-upload"> <button class="file-upload-btn" type="button" onclick="$('.

[Cheat Sheet] (en) Java stream cheat sheet

Cheat sheet for Java stream: computIfPresent, computeIfAbsent, disjoint, joining. Index Map Stream Map computeIfPresent - update value 1 2 3 4 5 Map<String, Integer> test = new HashMap<>(){{ test.put("ME", 25); test.put("Mom", 67); }}; test.computeIfPresent("Me", (k, v) -> v + 1); computeIfAbsent - put k, v when the key is not there 1 test.computeIfAbsent("Sister", k -> 25); Once, I wanted to use computeIfPresent and computeIfAbsent at once. My intend was putting (key, value) in specific map when ther is no key. And later, when the map meet the same key again, then update value. But I missed the point. Thoese two method cannot be used at the same time.

[Cheat Sheet] (en) Git cheat sheet

Cheat sheet for Git: log, diff, branch, switch, checkout, restore, commit, reset etc. Index Git Cheat Sheet Git Cheat Sheet make annotated tag 1 git tag -a v1.0.0 -m "leave message here for tag" git log 1 2 3 4 5 6 7 8 # show log with one line git log --oneline # show log with graph tree git log --graph # show log with both git log --oneline --graph compare file between two branches 1 2 3 git diff branch1..branch2 -- "file_name" ex) diff 2021_0405_user..master -- build.gradle change branch name 1 git branch -m "branch_name" making branch with