카테고리 보관물: Chat-GPT

npm 빌드 오류(new Hash / error:0308010)

집에서 쇼룸을 실행해보려고 했더니 다음과같은 오류가 발생했다.

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/user/Programming Documents/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
  throw err;

검색해보니 Node.js 내부에서 openssl (암호화) 관련 소스에서 발생하는 에러 같았다.
환경설정 옵션을 변경해주면 해결이 되는 듯 하다.

https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

Continuous Collision Detection

CCD 에 대한 블로그 글 : https://justdoitproject.tistory.com/30

Subject about Collision Detection Copilot Answers

충돌 검사(Collision Detection)는 그래픽스, 게임, 로봇공학 등 다양한 분야에서 사용되는 기술입니다. 충돌 검사는 물체들이 서로 충돌하는지 여부를 판단하는 기술로, 물체의 모양, 크기, 위치, 속도 등을 고려하여 충돌 여부를 검사합니다. 충돌 검사 기법에는 다음과 같은 것들이 있습니다.

  • Bounding Volume Hierarchy(BVH): 물체를 계층적으로 구성하여 충돌 검사를 수행하는 기법입니다. BVH는 물체들을 AABB(Axis-Aligned Bounding Box)와 같은 기하학적 도형으로 둘러싸고, 이를 계층적으로 구성하여 충돌 검사를 수행합니다. BVH는 빠른 검사 속도와 높은 정확도를 가지고 있습니다.
  • Sweep and Prune(SAP): 충돌 가능성이 있는 물체들을 축 방향으로 정렬하여 충돌 검사를 수행하는 기법입니다. SAP는 축 방향으로 정렬된 충돌 가능성 리스트를 유지하며, 이를 이용하여 충돌 검사를 수행합니다. SAP는 충돌 검사 속도가 빠르지만, 정확도가 낮습니다.
  • GJK 알고리즘: 두 볼록 다각형(Convex Polygon)의 교차 여부를 검사하는 알고리즘입니다. GJK 알고리즘은 두 볼록 다각형의 Minkowski 차(Minkowski Difference)를 구한 후, 이를 이용하여 교차 여부를 검사합니다. GJK 알고리즘은 정확도가 높지만, 계산 비용이 높습니다.
  • SAT 알고리즘: 두 다각형의 축 정렬 경계 상자(AABB)가 겹치는지 여부를 검사하는 알고리즘입니다. SAT 알고리즘은 두 다각형의 모든 축에 대해 충돌 여부를 검사하며, 충돌이 발생한 축을 찾아내어 충돌 여부를 판단합니다. SAT 알고리즘은 정확도가 높고, 계산 비용이 낮습니다.

이상으로, 충돌 검사 기법에 대해 간단히 소개해드렸습니다. 더 궁금하신 점이 있으시면 언제든지 물어보세요. 😊

움직이는 물체 A의 속도가 너무 빠른 나머지 deltaTime 이전과 후의 위치가 물체 B를 충돌하지 않고 통과하는 현상을 검사하는 방법은 다양합니다. 이러한 현상이 발생하는 이유는 물체 A가 이동하는 동안 충돌 검사를 수행하는 시간 간격이 너무 크기 때문입니다. 이를 해결하기 위해서는 다음과 같은 방법들이 있습니다.

  • Continuous Collision Detection(CCD): 물체 A가 이동하는 동안 충돌 검사를 여러 번 수행하여, 물체 B와 충돌할 가능성이 있는 시간 구간을 찾아내는 기법입니다. CCD는 물체 A의 이동 경로를 여러 개의 작은 구간으로 나누어, 각 구간에서 충돌 검사를 수행합니다. 이를 통해 물체 A가 물체 B와 충돌할 가능성이 있는 시간 구간을 찾아내고, 이를 이용하여 충돌 검사를 수행합니다. CCD는 물체 A의 속도가 빠른 경우에도 충돌 검사를 정확하게 수행할 수 있습니다.
  • Swept Sphere: 물체 A를 구 형태의 더미 물체로 대체하여 충돌 검사를 수행하는 기법입니다. 물체 A가 이동하는 동안 더미 물체도 함께 이동하며, 물체 B와 충돌할 가능성이 있는 시간 구간을 찾아냅니다. 이를 이용하여 충돌 검사를 수행합니다. Swept Sphere는 CCD보다 계산 비용이 적지만, 정확도가 낮을 수 있습니다.
  • Conservative Advancement: 물체 A가 이동하는 동안 충돌 검사를 수행하여, 물체 B와 충돌할 가능성이 있는 시간 구간을 찾아내는 기법입니다. Conservative Advancement는 물체 A의 이동 경로를 여러 개의 작은 구간으로 나누어, 각 구간에서 충돌 검사를 수행합니다. 이를 통해 물체 A가 물체 B와 충돌할 가능성이 있는 시간 구간을 찾아내고, 이를 이용하여 충돌 검사를 수행합니다. Conservative Advancement는 CCD와 비슷한 원리로 동작하지만, 계산 비용이 적습니다.

이상으로, 움직이는 물체 A의 속도가 너무 빠른 나머지 deltaTime 이전과 후의 위치가 물체 B를 충돌하지 않고 통과하는 현상을 검사하는 방법에 대해 간단히 소개해드렸습니다. 더 궁금하신 점이 있으시면 언제든지 물어보세요. 😊

[Github] Restore deleted branch

회사 여러 프로젝트 중 내가 전담하고 있는 webgl프로젝트를 submodule로 물려서 사용하는 프로젝트에서 branch를 변경/삭제 하고 나서 jenkins 빌드를 걸었는데 해당 브랜치를 찾을수 없다는 에러 메세지가 나오면서 빌드가 되지 않는 상황이 발생했다.

원래 이런 상황에서는 jenkins 환경 셋팅을 변경하여 submodule 의 타겟 브랜치를 변경하여 진행하면 되지만 담당자가 휴가중인 관계로 부득이하게 리모트 서버에 브랜치를 되돌려야하는 상황이 발생하여 삭제한 것을 되돌리는 방법을 찾아보았다.

아래는 브랜치를 되살리는 방법을 적어둔 블로그 링크이다.

https://shanepark.tistory.com/317

Module not found: Error: Can’t resolve ‘fs’

three.js 모듈중 ttf 로더를 사용 했을 경우 nuxt build error 가 발생하였다.

opentype.module.js 내부에서 nodejs 의 ‘fs’ 라는 모듈을 사용하는데 nuxt 에서 이 키워드가 충돌 되나 보다. nuxt config 에서 해당 키워드를 지워주면 에러가 사라진다.

https://alithedeveloper.tistory.com/entry/node-gyp-build-%EC%97%90%EB%9F%AC-Module-not-found-Error-Cant-resolve-fs-in-path

if I want to make generative AI platform, what knowledges need to me? book, youtube, lecture anything recommends.

Creating a generative AI platform requires a combination of knowledge in machine learning, software development, and domain-specific expertise depending on the type of content you want to generate (e.g., images, text, music, etc.). Here’s a general roadmap of the knowledge areas and some resources to get you started:

  1. Foundational Knowledge:
    • Linear Algebra, Probability, and Statistics: Crucial for understanding the underlying math of most algorithms.
      • Book: “Linear Algebra and Its Applications” by Gilbert Strang
      • Book: “Pattern Recognition and Machine Learning” by Christopher Bishop
    • Programming: Proficiency in a language like Python is essential.
      • Online: Codecademy’s Python Course, LeetCode for practice
  2. Machine Learning Basics:
    • Book: “Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow” by Aurélien Géron
    • Online Course: Coursera’s “Machine Learning” by Andrew Ng
  3. Deep Learning and Generative Models:
    • Book: “Deep Learning” by Goodfellow, Bengio, and Courville
    • Online Course: Coursera’s “Deep Learning Specialization” by Andrew Ng
    • Topics to focus on:
      • Convolutional Neural Networks (CNNs) for image data.
      • Recurrent Neural Networks (RNNs), especially Long Short-Term Memory (LSTM) networks for sequences like text or time series.
      • Generative Adversarial Networks (GANs) for generating new data samples.
      • Variational Autoencoders (VAEs) for generative tasks.
  4. Generative AI Specializations:
    • For text:
      • Dive into models like GPT-2, GPT-3, or BERT. OpenAI and HuggingFace have great resources and APIs for these.
    • For images:
      • Explore DCGANs, StyleGAN, and Pix2Pix.
    • For music:
      • Look into WaveGAN or OpenAI’s MuseNet.
  5. Software Development & Platform Creation:
    • Frameworks: TensorFlow, PyTorch, Keras are the popular choices for deep learning.
    • Deployment: Learn about tools like Docker, Flask/Django for web-based platforms, and cloud platforms like AWS, GCP, or Azure for scalability.
    • Book: “Flask Web Development” by Miguel Grinberg for web-based applications.
  6. Continuous Learning:
    • Follow AI researchers and organizations on platforms like Twitter or LinkedIn.
    • Read arXiv for the latest research papers.
    • Attend conferences, either in-person or virtually, such as NeurIPS, ICML, ICLR.
  7. YouTube Channels:
    • Two Minute Papers: Great for keeping up with the latest research.
    • Sentdex: Provides tutorials on a wide range of programming and machine learning topics.
    • Yannic Kilcher: Deep dives into AI research papers.
  8. Practice:
    • Work on projects and put your knowledge to the test.
    • Participate in Kaggle competitions to apply what you’ve learned and learn from kernels shared by others.

Lastly, remember that the field of AI and machine learning is vast and constantly evolving. It’s essential to stay curious and continue learning.

플라스틱 재활용에 대한 Chat GPT 답변

tell me the reason plastic can not re-usable on chemistry. why can not re assemble them?

ChatGPT

Plastics are typically challenging to reassemble or reuse through chemical processes for several reasons:

  1. Polymer Complexity: Plastics are composed of long chains of polymers, which are large molecules made up of repeating units. These polymers can be very complex and vary significantly depending on the type of plastic (e.g., polyethylene, polypropylene, PVC). Breaking down these complex polymers and reassembling them is a complex and energy-intensive process.
  2. Irreversible Cross-Linking: Some plastics, such as thermosetting plastics like epoxy and phenolic resins, contain cross-linking chemical bonds that form a three-dimensional network. These cross-links are irreversible, making it difficult to break them down and reassemble the material into its original form.
  3. Contaminants: Used plastics often contain contaminants like dirt, oils, and other materials that can interfere with chemical processes. These impurities can make it challenging to obtain high-purity plastic materials through chemical recycling.
  4. Degradation: Plastics can undergo degradation when exposed to heat, light, and oxygen over time. This degradation can result in changes to the chemical structure of the plastic, making it difficult to return it to its original properties.
  5. Energy Intensive: Recycling plastics chemically can be energy-intensive and expensive. The high temperatures and pressures required to break down the polymers and reassemble them into new materials can make the process economically impractical in many cases.
  6. Limited Reusability: Even when chemical recycling is possible, it often results in the production of lower-quality plastics with properties inferior to virgin materials. This limits the number of times plastics can be recycled chemically before they become unsuitable for most applications.

While chemical recycling techniques are continually improving, they still face significant challenges in terms of efficiency, cost-effectiveness, and scalability. Mechanical recycling, such as melting and reshaping plastics, remains a more common and economically viable method for reusing plastics. Innovations in recycling technologies are ongoing, and researchers are exploring ways to make plastics more recyclable and environmentally friendly.

is plastic extracted from oil?

ChatGPT

Yes, plastic is typically derived from petroleum, which is a fossil fuel. The process of making plastic from petroleum involves several chemical steps, and it is called petrochemical production. Here’s a simplified overview of how plastic is produced from oil:

  1. Crude Oil Extraction: Crude oil is extracted from underground reservoirs through drilling and pumping. Crude oil is a mixture of hydrocarbons and other compounds.
  2. Refining: Crude oil is transported to refineries, where it undergoes a refining process to separate various components, including gasoline, diesel fuel, jet fuel, and petrochemical feedstocks.
  3. Petrochemical Production: The petrochemical feedstocks obtained from the refining process are then used as raw materials for the production of plastics. The primary petrochemicals used in plastic production are ethylene, propylene, and other monomers.
  4. Polymerization: In polymerization, these monomers are chemically bonded together in a controlled process to form long chains of polymers, which are the building blocks of plastics.
  5. Additives and Processing: Various additives, such as stabilizers, plasticizers, and colorants, are mixed with the polymer to give the plastic its desired properties. The resulting mixture is then processed into various forms, such as pellets, sheets, or molded products.
  6. Manufacturing: The processed plastic is used to manufacture a wide range of products, from packaging materials and automotive parts to toys and consumer goods.

It’s important to note that not all plastics are made from petroleum. Some plastics can be produced from alternative feedstocks, such as natural gas or renewable resources like biomass. These alternative feedstocks can help reduce the environmental impact of plastic production and lessen dependence on fossil fuels. However, petroleum-based plastics are still the most common and widely used types of plastics.

what kind of studies or researches are process about plastic reuse or reassemble nowadays? and were they got result? tell me anything about it.

ChatGPT

Research and studies related to plastic reuse and reassembly are ongoing in various fields, including materials science, chemistry, and engineering. These efforts aim to develop more sustainable methods for recycling and reusing plastics, reduce environmental impacts, and minimize plastic waste. Here are some areas of research and recent developments in the field of plastic reuse and reassembly:

  1. Chemical Recycling: Scientists are working on improving chemical recycling techniques, such as depolymerization and pyrolysis, which break down plastics into their constituent monomers or smaller chemical compounds. These processes can potentially yield higher-quality recycled plastics and reduce the need for virgin plastic production. Research has made progress in optimizing these processes and scaling them up for industrial use.
  2. Biodegradable Plastics: Researchers are developing biodegradable plastics made from renewable resources like plant starch, cornstarch, or algae. These plastics can break down naturally in the environment, reducing the persistence of plastic waste. However, challenges remain in terms of their cost-effectiveness, performance, and widespread adoption.
  3. Mechanical Recycling: Innovations in mechanical recycling technologies are aimed at improving the efficiency of sorting, cleaning, and reprocessing used plastics. Advanced sorting and separation techniques, along with better recycling equipment, are being explored to increase the quality and yield of recycled materials.
  4. Plastic Upcycling: Some researchers are exploring methods to “upcycle” plastics into higher-value products, such as textiles, building materials, and chemical feedstocks. For example, recycled PET bottles can be used to make polyester fabrics, reducing the need for virgin polyester production.
  5. Biotechnological Solutions: Biotechnology is being applied to develop microorganisms that can break down and digest plastics, potentially offering a more environmentally friendly approach to plastic degradation. Enzymes that can degrade specific types of plastics have also been studied.
  6. Eco-Friendly Additives: Scientists are researching and developing additives that can enhance the recyclability and biodegradability of plastics. These additives can help mitigate the environmental impact of plastic waste.
  7. Circular Economy Initiatives: Governments, businesses, and organizations are promoting the concept of a circular economy for plastics. This involves designing products and packaging for reuse and recycling, as well as implementing extended producer responsibility (EPR) programs to incentivize responsible plastic management.
  8. Policy and Regulation: Policymakers and regulators are implementing laws and regulations aimed at reducing single-use plastics, increasing recycling rates, and promoting sustainable plastic use. These policies are designed to drive industry innovation and consumer behavior change.

It’s important to note that while significant progress has been made in plastic reuse and recycling, challenges remain, including economic viability, scalability, and consumer behavior. The development and adoption of more sustainable practices and technologies are ongoing efforts, and the effectiveness of these solutions will continue to evolve over time.

안드로이드 웹 뷰에 HTML 로드하기

안드로이드 앱에 내가 만든 THREE.JS 뷰어를 로드 해야할 일이 생겼다.

threejs 캔버스가 들어간 HTML파일을 준비하고 다음과 같이 로드 해주면 된다. 단, 안드로이드 웹 앱에서 자바스크립트를 실행하려면 다음과 같은 설정이 필요하다.

webView.addJavascriptInterface(this, "android");
webView.loadUrl("javascript:android.onData(functionThatReturnsSomething)");


참고

https://blog.naver.com/urbanbaseinc/221672052557

https://stackoverflow.com/questions/3298597/how-to-get-return-value-from-javascript-in-webview-of-android

Differences retain context between arrow function and regular function

class Test {
  constructor() {
    this.func1 = () => {
      // use keyword 'this' on the event handler
    }
  }
  
  func2() {
    // doesn't use keyword 'this' on the event handler
  }
}

The differences between `func1` and `func2` in the provided JavaScript code relate to how they handle the context of the `this` keyword. Let’s break down the differences step by step.

1. **Arrow Function vs Regular Function:** `func1` is defined using an arrow function (`() => { … }`), whereas `func2` is defined using a regular function (`function() { … }`). Arrow functions capture the surrounding context, including the value of `this`, while regular functions have their own `this` binding that is determined by how the function is called.

2. **Binding of `this`:** In `func1`, since an arrow function is used, the value of `this` inside `func1` will refer to the instance of the `Test` class where `func1` is defined. This means that no matter where `func1` is called, the `this` context remains the same as the instance of the class. Arrow functions don’t have their own `this` context; they inherit it from their enclosing function (or in this case, the constructor). In `func2`, since a regular function is used, the value of `this` will depend on how `func2` is called. If `func2` is called as a method of the `Test` instance (`testInstance.func2()`), then `this` will refer to the instance. However, if `func2` is extracted and called in a different context (e.g., as a standalone function), the value of `this` can change, possibly leading to errors or unintended behavior.

3. **Usage in Event Handlers:** If you intend to use these functions as event handlers, `func1` might be more convenient. Since it’s an arrow function, it retains the instance context, ensuring that you can use the `this` keyword inside the event handler to refer to the instance of the class. On the other hand, if you use `func2` as an event handler, the value of `this` might change based on how the event is triggered, potentially leading to unexpected results or errors.

In summary, the key difference between `func1` and `func2` lies in how they handle the `this` keyword, with `func1` using an arrow function to maintain the instance context and `func2` relying on the standard function’s `this` binding, which can be influenced by how it’s called.