Skip to main content

Posts

Showing posts from May, 2022

Measuring Correlation

If we want to know a correlation between a boxer winning a match and using red pants, we can mathematically determine it based on past records of those conditions. There are four possible combinations of the conditions. The boxer loses and he doesn’t use red pants (00) The boxer loses and he uses red pants (01) The boxer wins and he doesn’t use red pants (10) The boxer wins and he uses red pants (11) For example, we have the following past records. Condition “00” is 23 times Condition “01” is 10 times Condition “10” is 45 times Condition “11” is 9 times Then, we can use the phi coefficient formula. The result of this formula is between -1 and 1. If the result is close to 0, it means the conditions have no correlation. If it is close to 1, it means the conditions are strongly correlated. Meanwhile, if it is negative, the correlation is strong but in the opposite way. The formula is as follows. phi = (n11 x n00) – (n01 x n10) / sqrt(n1X x n0X x nX1 x nX0) n1X represents the condition wh

Elements of UI Design

There are some essential elements in designing a user interface. I found that the following items are necessary to bring up a certain feeling, thought, or perspective for the user of our product. Color Color can shape a mood for the user. Combining multiple colors should be carefully picked to create a comfortable look. One of the tools available online to pick colors is here . Positive and Negative Space Positive space is the element containing the main content or information. Meanwhile, negative space is the distance between main elements or empty space around them. Each main element should have distance or space from each other to nicely navigate the focus of the users from one information to another. Typography Typography includes selecting appropriate fonts with good looks and aligning text content on the page. Microcontent We need to provide some short texts or content on a page to make it easy for the user to skim the information on th

First Appearance of Titan Eren

 When Mikasa was trying to grasp herself, a titan appeared killing the other titans.

Downloading A Large File From Google Drive

I just found a helpful answer from Quora about downloading a large file from Google Drive. It utilizes Google Drive API for downloading the file. The steps are as follows. Get the file ID from the shareable link URL. For example, the URL has a format similar to this: https://drive.google.com/file/d/THE_FILE_ID/view?usp=sharing , then the file ID is THE_FILE_ID . Go to Google OAuth 2.0 Playground . On this page, we can get an access token for utilizing Google API to download our file. Select the Drive API v3 and authorize it. Then, keep the access token that is available on the "Exchange authorization code for tokens" tab. Last, we can utilize curl to download the file using a terminal. curl -H "Authorization: Bearer THE_ACCESS_TOKEN" https://www.googleapis.com/drive/v3/files/THE_FILE_ID?alt=media -o THE_OUTPUT_FILE.ext

Utilizing Docker Secret

It likely happens that we need to provide some secrets like passwords, keys, or private things into our Docker containers. If we use the docker-compose tool to generate our containers, we basically can put the secrets as environment variables in the docker-compose.yaml file. But, what if we want to share our configuration with the others, they will find those secrets too. So, for overcoming that issue, we can utilize a feature provided by Docker itself which is the Docker secret, or we can just call it secret . For instance, we want to build a container for the PostgreSQL database. The PostgreSQL image allows us to set a custom database password by providing a value for the POSTGRES_PASSWORD or POSTGRES_PASSWORD_FILE variable. services: postgres: image: postgres environment: - POSTGRES_PASSWORD=$3cureP4ssword Or, we can utilize the Docker bind-mounting to store a file and instruct the Docker to read the secret information from the mounted file. services:

Principles of UX Design

If we want to elaborate a user experience (UX) design for our product, we need to understand some principles of a good UX design. Our design should be based on specific reasons and have certain intentions for our users and ourselves as product owners or as a business. These are several principles that should become our consideration in generating the design. Usefulness We build a product with a desire for providing solutions for any specific needs of the users. So, it is important to make sure that any design elements are provided to make the users completely gain the benefit of using our product and solve their problems. Usability Visions and our good intentions are not enough to build a great product if we don't provide clear ways for the users to take the most benefit of the product. Usability is a focus to provide easiness for the users in utilizing our product. Desirability Why are some products or services instantly abandoned by their users

When Mikasa Got So Emotional But Had To Fight

 She just tried to suppress her feeling.

Generate API Documentation Using Swagger Module in NestJS

Swagger provides us a standard to generate API documentation based on the Open API specification. If we use NestJS for building our API providers, we can utilize a tool provided by NestJS in the  @nestjs/swagger  module to generate the documentation automatically in the built time. This module also requires the swagger-ui-express module if we use Express as the NestJS base HTTP handler. Set Swagger configuration First, we need to define Swagger options and instantiate the documentation provider on the main.ts file. import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; // sample application instance const app = await NestFactory.create(AppModule); // setup Swagger options const options = new DocumentBuilder() .setTitle('Coffee') .setVersion('1.0') .setDescription('Learn NestJS with coffee') .build(); // build the document const document = SwaggerModule.createDocument(app, options); // provide an endpoint