This document discusses Yarn and its advantages over npm. It notes that Yarn uses yarn.lock files instead of npm-shrinkwrap.json files to lock down dependency versions. Yarn is also described as being faster, able to work offline by caching dependencies, and potentially more secure than npm with features like flat mode and module folders. The document suggests Yarn may handle dependencies and devDependencies differently than npm, and questions whether the yarn.lock file should be committed to source control.
This document discusses Yarn and its advantages over npm. It notes that Yarn uses yarn.lock files instead of npm-shrinkwrap.json files to lock down dependency versions. Yarn is also described as being faster, able to work offline by caching dependencies, and potentially more secure than npm with features like flat mode and module folders. The document suggests Yarn may handle dependencies and devDependencies differently than npm, and questions whether the yarn.lock file should be committed to source control.
This document discusses WebSocket technology and some example applications. It introduces WebSocket as a web technology that provides bidirectional communication between a client and server. It then describes projects that use WebSocket with Spring Boot, for real-time web applications, and WebRTC to share video streams between browsers using HTML5 APIs and canvas elements. Finally, it mentions deploying WebSocket applications to Heroku and the possibility of using Raspberry Pi devices with Node.js, Python, or Java for embedded applications that communicate over WebSocket.
This document provides an overview of Lombok, a Java library that automatically plugs into editors and builds to provide automatic generation of boilerplate code like getters, setters, equals, hashCode and toString methods. It summarizes the main Lombok annotations like @Getter, @Setter, @ToString, @EqualsAndHashCode, @Builder and how they generate standard Java code. It also covers other annotations like @Value, @Data, @Slf4j, @NonNull, @Cleanup and how they simplify code. In the end it provides links to learn more about Lombok features and the delombok tool.
Spring Boot is a framework for building Java applications. It is built on top of Spring and includes features such as embedded Tomcat, Jetty, or Undertow servers and automatic configuration to simplify development. Spring Initializr can be used to set up Spring Boot projects with common dependencies using Maven or Gradle. It allows generating a basic "Hello World" application quickly. Spring Boot applications can also use Spring Data JPA to easily interact with databases and auto-configuration to simplify app configuration.
IoT Devices Compliant with JC-STAR Using Linux as a Container OSTomohiro Saneyoshi
?
Security requirements for IoT devices are becoming more defined, as seen with the EU Cyber Resilience Act and Japan’s JC-STAR.
It's common for IoT devices to run Linux as their operating system. However, adopting general-purpose Linux distributions like Ubuntu or Debian, or Yocto-based Linux, presents certain difficulties. This article outlines those difficulties.
It also, it highlights the security benefits of using a Linux-based container OS and explains how to adopt it with JC-STAR, using the "Armadillo Base OS" as an example.
Feb.25.2025@JAWS-UG IoT
4. DBマイグレーションの仕組み
? マイグレーションのためのSQLやコードをバージョン毎に管理
? それらを順次実行していくことでマイグレーションを実現
? 積み重ねた後のものが、現在の状態を表すものになる
CREATE TABLE products
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
description text,
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL
);
class CreateProducts < ActiveRecord::Migration[5.0]
def change
create_table :products do |t|
t.string :name
t.text :description
t.timestamps
end
end
end
11. 3. マイグレーションで実行するSQLファイルを作成
sql/ 配下にSQLファイルを作成。
~/flyway-8.0.2$ vi sql/V1__create_initial_tables.sql
CREATE TABLE customers (
customer_id serial PRIMARY KEY,
name text NOT NULL,
mail_address text NOT NULL
);
sql/V1__create_initial_tables.sql
V1__create_initial_tables.sql
Prefix
Version
Separator Suffix
Description
12. 4. マイグレーション実行
flyway migrate でマイグレーション実行。
~/flyway-8.0.2$ ./flyway migrate
Flyway Teams Edition 8.0.2 by Redgate
Database: jdbc:postgresql://192.168.33.10:5432/testdb (PostgreSQL 13.4)
Successfully validated 1 migration (execution time 00:00.025s)
Creating Schema History table "public"."flyway_schema_history" ...
Current version of schema "public": << Empty Schema >>
Migrating schema "public" to version "1 - create initial tables"
Successfully applied 1 migration to schema "public", now at version v1 (execution time 00:00.061s)
13. 4. マイグレーション実行
テーブルが作成されていることを確認。
~/flyway-8.0.2$ psql -U user1 testdb
psql (13.4)
Type "help" for help.
testdb=> ?d customers
Table "public.customers"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+------------------------------------------------
customer_id | integer | | not null | nextval('customers_customer_id_seq'::regclass)
name | text | | not null |
mail_address | text | | not null |
Indexes:
"customers_pkey" PRIMARY KEY, btree (customer_id)
testdb=>
15. マイグレーションを追加
flyway migrate で再度マイグレーション実行。
~/flyway-8.0.2$ ./flyway migrate
Flyway Teams Edition 8.0.2 by Redgate
Database: jdbc:postgresql://192.168.33.10:5432/testdb (PostgreSQL 13.4)
Successfully validated 2 migrations (execution time 00:00.054s)
Current version of schema "public": 1
Migrating schema "public" to version "2 - add phone number“
Successfully applied 1 migration to schema "public", now at version v2 (execution time 00:00.083s)
16. マイグレーションを追加
カラム(phone_number)が追加されていることを確認。
~/flyway-8.0.2$ psql -U user1 testdb
psql (13.4)
Type "help" for help.
testdb=> ?d customers
Table "public.customers"
Column | Type | Collation | Nullable | Default
--------------+-----------------------+-----------+----------+------------------------------------------------
customer_id | integer | | not null | nextval('customers_customer_id_seq'::regclass)
name | text | | not null |
mail_address | text | | not null |
phone_number | character varying(20) | | |
Indexes:
"customers_pkey" PRIMARY KEY, btree (customer_id)
testdb=>
17. マイグレーション実行状況の確認
マイグレーションの実行状況は flyway info で確認できる。
※ flyway_schema_historyというテーブルがFlywayにより作成され、そこで情報が管理されている
~/flyway-8.0.2$ ./flyway info
Flyway Teams Edition 8.0.2 by Redgate
Database: jdbc:postgresql://192.168.33.10:5432/testdb (PostgreSQL 13.4)
Schema version: 2
+-----------+---------+-----------------------+------+---------------------+---------+----------+
| Category | Version | Description | Type | Installed On | State | Undoable |
+-----------+---------+-----------------------+------+---------------------+---------+----------+
| Versioned | 1 | create initial tables | SQL | 2021-10-30 01:26:12 | Success | No |
| Versioned | 2 | add phone number | SQL | 2021-10-30 05:20:02 | Success | No |
+-----------+---------+-----------------------+------+---------------------+---------+----------+
28. SchemaSpy – 設定
設定ファイルを作成。
# type of database. Run with -dbhelp for details
schemaspy.t=pgsql11
# optional path to alternative jdbc drivers.
schemaspy.dp=drivers
# database properties: host, port number, name user, password
schemaspy.host=192.168.33.10
schemaspy.port=5432
schemaspy.db=testdb
schemaspy.u=user1
schemaspy.p=password1
# output dir to save generated files
schemaspy.o=output
# db scheme for which generate diagrams
schemaspy.s=public
schemaspy.properties