본문 바로가기

Web development131

Python Basic Syntax arithmatic operators 1 + 3 >> 4 1 - 3 >> -2 1 / 3 >> 0.3333333 5 // 2 # quotator >> 2 5 % 2 # remainder >> 1 divmod(5, 2) # quotator and remainder at once >> (2, 1) division by 0 occurs ZeroDivisionError if if a % 2 === 0 or a > 10: print("") elif a > b and a // b > 1: # // is for get the quotient print() else: print() # tenary operator '짝수' if a % 2 == 0 else '홀수' for문 for x in family: print(x,.. 2023. 8. 22.
[JSDoc] Practical commenting out with JSDoc If we write code with proper naming and good readability, we might argue that comments are unnecessary because the code itself explains everything. However, there are times when we need to explain aspects of the code that are external to the project. Additionally, there may be similar functions that have slightly different functionalities (although it's better to avoid such situations). For exam.. 2023. 5. 24.
[Javascript] How to Iterate through Lists in JavaScript Here is a basic way to iterate through a list in JavaScript: const list = [1, 2, 3]; for (var i = 0 ; i < list.length ; i++){ console.log(list[i]); } Alternatively, you can use the of keyword instead of using an index: const list = [1,2,3] for(const item of list){ console.log(item); } for (const a of arr) console.log(a); // You can also use inline syntax You can create arrays using square bracke.. 2023. 5. 24.
Troubleshooting AWS CodeDeploy in a Node.js Project 1. If you receive an error indicating a lack of healthy instances when using the HalfAtATime configuration: This error occurs when there are insufficient healthy instances. Verify if the health check of the target group you are deploying to is successful. Ensure that the required number of instances are healthy. 2. Check if all the necessary libraries are installed: Verify if Node.js, NVM, and o.. 2023. 5. 24.
[Jenkins] No space in device error You can use docker prune command. Deleting Docker Images Older than 3 Days $ docker system prune -af --filter "until=$((3*24))h” 2023. 5. 24.
How to Register Git Credential Key in Sourcetree Since some time ago, RSA SSH keys are no longer supported by GitHub. Therefore, if you encounter errors while using Git, follow the steps below: 1. Open Sourcetree and go to Tools > Generate or Import SSH Key. 2. Select ECDSA at the bottom. 3. Click Generate and save the public/private key. 4. In Sourcetree, go to Tools > Options > General and change the SSH key to the private key you generated... 2023. 5. 24.
[JSDoc] 유용한 주석 달기 올바른 네이밍과 가독성 좋게 코드를 작성한다면, 코드 그 자체로 모든 것이 설명되므로 주석은 불필요하다고 할 수도 있겠다. 그러나 가끔 해당 프로젝트 코드 외적인 이유를 설명해야 할 때도 있고, (이런 일이 없는 것이 더 좋긴 하겠지만) 비슷하지만 약간 다른 기능을 하는 함수가 존재하는 경우도 있을수 있다. 예를들어... 아래와 같은 경우가 있을 수 있다. 피시방에서 쓰는 프로그램을 만드는데, 내가 프론트 작업을 해야 한다. 근데 백엔드에서 데이터를 아래와 같이 보내주고 있었다. [ { id: 1, name: '10시간 이용권', count: 10, price: 10000, }, { id: 2, name: '20시간 이용권', count: 20, price: 15000, }, ]; 그런데... 피시방에서.. 2022. 9. 6.
ES Module Export (Default, Named) 모듈 시스템을 사용하는 이유는, 쪼개져있는 코드들을 효율적으로 불러다 쓰기 위해서다. module을 잘 활용하면 깔끔하고 효율적인 코드를 작성할 수 있다. Named Export - 지정된 이름을 사용하는 export - 한 파일에서 여러 객체를 export할때 사용 // exp.js export const num = 100; export const foo = (a) => a + 1; export class bar {}; // imp.js import { num, foo, bar } from './exp.js'; import시 정의된 것과 이름을 사용해야 하며, 변경을 원하는 경우 import { foo as f } 로 사용할 수 있다. 한번에 전체 export를 가져오고 싶은 경우 // imp.js i.. 2021. 9. 28.
[Javascript] Bubble Sort, Selection Sort, Insertion Sort (버블/선택/삽입 정렬) 버블 정렬과 선택 정렬, 삽입 정렬은 은 가장 간단한 정렬방법들이다. 모두 O(N^2)의 시간복잡도를 갖는다. 버블 정렬 배열 처음부터 두 요소씩 선택하여 뒷 요소가 더 작으면 자리를 바꿔나가는 방식이다. function bubble(arr){ // 배열을 처음부터 두 요소씩 선택하여 뒷 요소가 더 작으면 자리를 바꿔나간다. // 다시 처음부터... n^2번 실행 const len = arr.length-1; let temp, i, j; for(i=0; i [1, 4, 2, 3] 2. 남은 요소들을 탐색하여 가장 작은 수를 찾아 두번째 요소와 자리를 바꾼다. [1, 4, 2, 3] => [1, 2, 4, 3] 3. 반복 function selection(arr) { // 배열을 처음부터 탐색하여 가장 작.. 2021. 9. 11.