notes

2023. 5. 22.
Changing Learning Environment IS Beneficial

Q: How important is routine when it comes to learning? For example, is it important to have a dedicated study area?

A: Not at all. Most people do better over time by varying their study or practice locations. The more environments in which you rehearse, the sharper and more lasting the memory of that material becomes—and less strongly linked to one “comfort zone.” That is, knowledge becomes increasingly independent of surroundings the more changes you make—taking your laptop onto the porch, out to a café, on the plane. The goal, after all, is to be able to perform well in any conditions. Changing locations is not the only way to take advantage of the so-called context effect on learning, however. Altering the time of day you study also helps, as does changing how you engage the material, by reading or discussing, typing into a computer or writing by hand, reciting in front of a mirror or studying while listening to music: Each counts as a different learning “environment” in which you store the material in a different way.

Benedict Carey, How We Learn. Random House Trade Paperbacks; Reprint edition (June 9, 2015) p. 201

2023. 5. 20.
Why does Windows use `\` while everyone else uses `/`?

Me: "Why does Windows use \ while everyone else uses /?"

GPT-4: "The reason for the difference lies in the history of the two operating systems and the choices made by their developers.

Microsoft's Windows OS uses backslashes (\) as a path separator due to its legacy of MS-DOS. MS-DOS was heavily influenced by an older operating system named CP/M, which did not have a hierarchical file system, meaning it did not have directories/folders and therefore did not need a directory separator character. When Microsoft introduced directories in MS-DOS 2.0, they needed a character to act as a directory separator, but the forward slash (/) was already being used as the switch character (a kind of option flag) for command-line arguments. Therefore, Microsoft chose the backslash (\) to avoid breaking compatibility with existing software.

On the other side, Unix and Unix-like systems (including Linux and MacOS), use the forward slash (/) as a path separator. The forward slash was chosen as a directory separator in Unix due to its simplicity and ease of use in a command line interface. The forward slash was available because Unix uses the hyphen - for command-line options, not the forward slash.

It's worth noting that although Windows primarily uses backslashes for paths, it does understand forward slashes in most contexts. However, because the backslash is the standard, Windows software often expects paths to be written with backslashes and can behave unexpectedly if they're not."

2023. 5. 18.
Split string into array

words="hello hello how low?"

array=($words);

for word in "${array[@]}"; do
  echo $word
done
words="hello hello how low?"

array=($words);

for word in "${array[@]}"; do
  echo $word
done
hello
hello
how
low?
hello
hello
how
low?

2022. 1. 21.
nextjs `.env` on Amplify (👎👎👎👎👎)

  1. next-auth로 auth 를 이케저케한 프로젝트를 앰플리파이에 배포해봤음
  2. signIn시 서버에러 발생
  3. error message was like this:
    https://next-auth.js.org/errors#client_fetch_error Unexpected token < in JSON at position 0 {error: {…}, path: 'providers', message: 
    'Unexpected token < in JSON at position 0'}
    https://next-auth.js.org/errors#client_fetch_error Unexpected token < in JSON at position 0 {error: {…}, path: 'providers', message: 
    'Unexpected token < in JSON at position 0'}
  4. 알아보니 amplify web ui에서 입력한 env var가 안먹는 것이었음
  5. amplify.yml에 아래와 같은 짓을 하는 수 밖에 없었음
    - echo "NEXTAUTH_SECRET=$NEXTAUTH_SECRET" >> .env
    - echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env
    

2021. 7. 28.
() vs. '()

(+ 1 2 3 4)     ;; <1>

'(+ 1 2 3 4)    ;; <2>
(+ 1 2 3 4)     ;; <1>

'(+ 1 2 3 4)    ;; <2>
  1. A list that is interpreted as an expression and evaluated
  2. Prevent evaluation of a list by starting it with a single quote