2021年5月18日 星期二

[Spring Boot]Thymleaf使用fragment及遇到中文亂碼問題

 如果每個畫面都有固定片段的話

可以將該片段提取出來當作一個fragment

fragment設以下標籤

 <head th:fragment="head(title)">

...裡面為重複的程式片段

 </head>

然後在引用的部分, 用replace來帶掉

  <meta charset="UTF-8"/>

  <head th:replace="_fragments :: head(~{::title})">

    <title>AIoT智能腎臟病照護加值服務平台login</title>

  </head>

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

如果引用之後, 本來的頁面的中文變成亂碼呈現

可以在內容加入<meta charset="UTF-8"/>

如下圖



[Spring Boot] Thymeleaf 引用靜態資源

 拿到新的前端包,

要進到spring boot使用Thymleaf引入, 遇到了問題

還有爆

Refused to apply style from 'OOXXX' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

查了一下得知, 原來是資源沒有引入的問題,

後來查了一下才知道

放在static下面的靜態資源要這樣引入





引入程式碼如下



<script th:src="@{plugin/jquery.i18n-1.0.7/jquery.i18n.emitter.min.js}"></script>

 <script th:src="@{plugin/jquery.i18n-1.0.7/jquery.i18n.language.min.js}"></script>

<link rel="stylesheet" th:href="@{plugin/flatpickr-4.6.6/flatpickr.min.css}">

<link rel="stylesheet" th:href="@{plugin/flatpickr-4.6.6/themes/wistron.css}">


另外解決一直跳轉到login問題

import org.springframework.context.annotation.Configuration;

import org.springframework.security.config.annotation.web.builders.HttpSecurity;

import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

 

@Configuration

@EnableWebSecurity

public class SecurityConfigSEVEN extends WebSecurityConfigurerAdapter {

 

    @Override

    protected void configure(HttpSecurity http) throws Exception {

        //super.configure(http);

        //配置不需要登陆验证

        http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();

    }

 

}

參考網址:

https://blog.csdn.net/SEVENY_/article/details/104660418


參考網址: 

https://blog.csdn.net/chenbetter1996/article/details/84994801

https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type

2021年5月6日 星期四

工程師三年, 年薪百萬-2 轉折

有的人在很年輕的時候, 就找到自己的志向

也有的人找了一輩子, 也沒有找到, 最後只好嘆一口氣說"這就是人生!"

XXXXX

那年我29歲,  領的薪水32000, 處理著各家外商公司的薪資報表

我內心無法平靜

憑什麼聰明如我, 在各方面的項目都能取得傑出成就的我

要在薪水上輸給別人?

我相信, 會有其他行業, 能夠讓我發揮得更出色, 我絕對不只如此


其後, 在104, 1111人力銀行的分析之下, 我發現我的確適合動腦相關的工作

研究員, 工程師, 設計師

因為學歷上和資歷上, 我並沒法成為財金研究員

而工程師? 還記得研究所的時候班上一半的人都放棄程式

我是那沒放棄的另外一半, 研究論文也是寫了一部份程式才做出來

我覺得, 自己比一般人聰明, 認真, 英文也不錯, 做這行業比不上高手至少也可以持平

顯然持平的話, 薪資水準已經很不一樣

剩下錢的部份我也可以靠理財


因此當年7月就辭職離開工作, 9月就進 北科大"Java&Android程式設計人才班"

這年我將股票玉山金賺的錢和之前的存款拿來, 還記得是20多萬

預計能繳學費, 並維持6+3個月生活花費


[leetcode] [KMP] KMP

ABCDABD... ABCDABF... 簡單的說, 傳統解兩字串匹配部分 可能會來個雙迴圈, 哀個比對, 當不匹配的時候, 會將下方列再後移1位 然後不匹配再後移 然而 如果像上放已經有4個屬於匹配的字串, 她就應該直接往後移四位來匹配, 而不是只移動1位 隱藏的思維是, 當...