顯示具有 設定 標籤的文章。 顯示所有文章
顯示具有 設定 標籤的文章。 顯示所有文章

2026-01-08

ERR_UNSAFE_PORT

先前我在開發軟體時,我設定讓他以 localhost:6000 開啟,結果出現 ERR_UNSAFE_PORT 錯誤,然而用 cURL 卻又一切正常。

經查詢,這是因為 6000 在瀏覽器中被列為 unsafe port。

這個 port 是 linux X11 桌面系統所用的,所以瀏覽器將之限制了。

2024-09-11

做 Hibernate envers 設定時遇到的坑

這篇算是延續先前《SpringBoot 使用多個資料庫連線》的狀況

我今天想要使用Hibernate envers來處理資料的版控。

原先我是這樣處理的:

  1. pom.xml 加上library

    <dependency>
    	<groupId>org.hibernate</groupId>
    	<artifactId>hibernate-envers</artifactId>
    </dependency>
  2. application.properties 加上設定

    spring.jpa.properties.hibernate.envers.audit_table_suffix=_rev
    spring.jpa.properties.hibernate.envers.revision_field_name=rev
    spring.jpa.properties.hibernate.envers.revision_type_field_name=revtype
    
  3. Hibernate Entity 加上 @Audit
    import javax.persistence.Entity;
    import javax.persistence.Table;
    
    import org.hibernate.envers.Audited;
    
    @Entity
    @Audit
    @Table(name = "my_entity")
    class MyEntity{
    	// 中略
    }

然而,實際執行時,Hibernate 處理版控資料時,都想要存入 my_entity_AUD,即

insert into `my_entity_AUD` 
# 下略

2024-05-29

Microsoft Email SMTP 設定

不知為何還蠻難找到 MS 365 的 SMTP 設定,在此紀錄

host outlook-apaccentral.office365.com
port 587
protocol smtp
username 你的 Outlook mail,例如 john.smith@live.com
password Outlook 密碼
from username


另外,我是使用 Java + spring, spring 有兩個參數不確定是在其他程式語言對應的數值,所以在這邊先列一下:

spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.auth=true

2023-06-29

如何用 npx 來使用不同版本的 npm

以下是一個簡單的 package.json

{
	"name": "Lorem ipsum dolor sit amet",
	"version": "1.0.0",
	"description": "Ac odio tempor orci dapibus.",
	"main": "index.js",
	"scripts": {
		"start": "webpack",
		"dev": "webpack-dev-server --open"
	},
	"engines": {
		"node": "v8.6.0"
	}
}

如果我的 Node.js 是最新版,那就無法執行該專案了。

2022-06-15

如何讓 tomcat 執行 php

因為某些緣故,需要有個 wordpress 環境,為了方便,所以想說本來電腦就有 tomcat 就看看能不能用 tomcat 直接執行 php。

結果上網查了查,還真的有辦法,在此紀錄一下: