Welcome to new things

[Technical] [Electronic work] [Gadget] [Game] memo writing

JavaScript

How to use Microsoft SQL Server with JavaScript

This is a memo on how to use Microsoft SQL Server (MSSQL) with JavaScript. The library is tedious, which is also recommended by Microsoft. tedios is a callback style library, but it is written in async, await, and TypeScript in a modern st…

Memo on how to use the Markdown parser remark

I have read Markdown, edited it in various ways as I wanted, and wanted to output it to Markdown again. I used a JavaScript Markdown parser called remark. However, it is difficult to understand how to use it, and I am sure I will forget ho…

I want to handle JavaScript arrays in SQL.

I usually use SQL, but when I am working with array data in JavaScript, I sometimes wish I could write queries in SQL for JavaScript arrays. On the other hand, C# has a language called LINQ that can process arrays with SQL-like queries. Th…

Notes on how to use Playwright

Since I have been experimenting with Playwright recently, I thought I would make a note of how to use Playwright so that I can remember how to use it again if I forget how to use it. install npm install --save playwright When Playwright is…

I was wrong about JavaScript Promise being an asynchronous function.

I learned from the following article that Promise in JavaScript is called synchronously. https://zenn.dev/yuhua_shi/articles/331569ef2fe886 I assumed that functions passed to Promise were asynchronous functions. Below is a summary of the P…

Thoughts on using both Selenium and Playwright

I use Puppeteer for web crawling. I had hoped to someday put together a guide on how to use Puppeteer, but in the meantime, I have been hearing a lot about Playwright as a browser manipulation tool similar to Puppeteer. Then I started thin…

Create a site loosely with Chakra UI

When creating a sample site using React, you may want to create it quickly and easily by combining existing settings without thinking too much about the site design. We usually use UI Fabric (now Fluent UI), which is used by Microsoft Offi…

Memo on how to create a minimal authentication site with AWS Amplify + React

I wanted to create a React site with an authentication function easily, but I gave up because it was too much trouble to build a backend each time. However, we tried AWS Amplify to see if we could easily build a backend. Since I have tried…

How to write AWS Amplify Lambda Function in TypeScript

When you add a Lambda Function in AWS Amplify, a template is generated in JavaScript, so this is a memo on how to turn it into TypeScript. The following document was used as a reference https://docs.amplify.aws/cli/function/build-options p…

Change the TypeScript version of VSCode

When I create a TypeScript React app with create-react-app app-name --template typescript and try to edit it in VSCode, I get the following error message Cannot use JSX unless the '--jsx' flag is provided. ts(17004) error. I found out that…

I'm starting to think that using CloudFormation from AWS CDK is the right way to go.

I previously tried to handwrite an AWS CloudFormation template and failed.... www.ekwbtblog.com What I learned at that time was that CloudFormation templates are not the kind that can be written by hand, but rather generated using some kin…

Facebook's official React state management library Recoil could replace Redux

Redux is well-known for state management in React, and as a mass panderer, I am using Redux as usual. However, there are a few areas where I find it hard to use Redux. One is that there are many boiler plates anyway. Just adding or modifyi…

How to use Concurrent Mode of React with TypeScript

This is a note on how to try React's Concurrent Mode in TypeScript, which is not yet officially released at this time. Since type-related errors often occur, we have included a note on how to deal with them. install Create a TypeScript tem…

Memo on how to use SQLite with JavaScript

This is a memo on how to use SQLite with JavaScript. We did not elaborate too much, but focused on the minimum necessary functions. I will not go into the usage of SQLite itself, but please refer to this way (direction close to the speaker…

Thoughts on switching from JavaScript to the Go language

Programs written in JavaScript (TypeScript) were rewritten in the Go language. I will write about the motivation and the results of the rewrite. Also, since this was my first time using the Go language, I will also write about what the Go …

How to execute JavaScript concurrently while specifying the number of concurrent executions

There are times when you have many tasks that you want to process in parallel, but executing all of them in parallel would be too heavy, so you want to specify the number of tasks to be executed concurrently. I am ashamed to admit that I d…

Docker's puppeteer suddenly stopped working.

I usually use puppeteer for web crawling and I use Docker to run puppeteer. I had to add a crawl item and when I modified the program and built and ran it on Docker, it did not work with the following error. /node_modules/puppeteer/.local-…

Memo on how to use stream in Node.js

When processing data, we tend to be lazy and read all the data into memory before processing it. This is not a problem when the data size is small, but when dealing with huge data, it consumes a lot of memory and takes a long time because …

How to distinguish between files and directories in Google Cloud Storage

In Google Cloud Storage, I tried to get a list of files in a subdirectory and process those files. However, when I looked at the error message that the file was wrong, I found that the list of files retrieved included a subdirectory. Reaso…

How to get a subdirectory listing of Google Cloud Storage with Node.js

We previously used the GCP Pyhton library to get a list of Google Cloud Storage subdirectories, and this is the Node.js version of that. Python version is here www.ekwbtblog.com procedure The GCP Node.js SDK documentation is kind enough to…

How to read CSV files with newlines and commas output by Excel in JavaScript

CSV files have been loaded using SheetJS. However, there was a CSV file that I just couldn't get to read properly because of garbled characters, so I decided to try another library. There was a library called "csv" that came up at the top …

Collecting data with Twitter API

I tried to get data from Twitter using the Twitter API to see if I could use it to learn about trends in the world. As it turns out, I had heard rumors that the Twitter API was too restrictive, but it was really too tight to be useful... S…

How to get and update your Microsoft Graph (Office365) API token

One way to manipulate the Web version of Office365 is through the Microsoft Graph (Office365) API. For example, with the Microsoft Graph (Office365) API, you can use the Send email from OutLook Excel Online file editing SharePoint file ret…

Memo on how to use Moment.js, a JavaScript date calculation library

When performing date operations in JavaScript, the built-in Date function is difficult to handle, so some kind of library is generally used. The library uses the commonly seen "Moment.js". I forget how to use it no matter how many times I …

Memo on how to read Excel files in JavaScript using SheetJS (xlsx)

I use SheetJS (xlsx) to load Excel files in JavaScript (TypeScript). The usage is a bit peculiar and I forget how to use it easily, so this is a memo for my own use. manual https://www.npmjs.com/package/xlsx install npm install xlsx File r…

How to decrypt data encrypted with PHP's mcrypt using Node.js

I got into trouble when I tried to decrypt data encrypted with PHP's mcrypt using Node.js, so here is a note on the cause and solution. situation I received data that I was told was encrypted with AES256-CBC in PHP, but when I tried to dec…

AES encryption and decryption in Node.js

I had a chance to do AES encryption/decryption in Node.js, so here are my notes. The encryption algorithm "AES-256-CBC" was used. About AES CBC encryption in a nutshell AES CBC is an encryption algorithm that encrypts binary data of arbitr…

How to output data from a Table tag table in Puppeteer crawling to CSV

We use Puppeteer as a crawler. Sometimes you are crawling and want to retrieve data from a table created by a Table tag on your site. With Python, this can be done elegantly by extracting only the tags below the Table tag from the html and…

Passport.js Usage Notes

I had a chance to use Passport.js, so here is my personal memo on how to use Passport.js in case I need it again. What is Passport.js? Passport.js is a library that allows users to log in to websites created with Node.js+Express, and to ad…

Building a Node.js environment in WSL with nvm

As with Building a Python environment, this is a note from when I re-installed the Node.js environment on a new version of WSL's Ubuntu. Since the version of Node.js used varies depending on when the JavaScript application was created, Nod…