原创 使用備忘錄模式實現Undo和Redo

備忘錄模式有三個角色。1.發起人(Originator)角色:負責創建一個備忘錄,用以記錄當前時刻自身的內部狀態,並可使用備忘錄恢復內部狀態。實現其他業務功能。2.備忘錄(Memento)角色:負責存儲發起人的內部狀態。3.管理者(Care

原创 js實現一款俄羅斯方塊

代碼下載地址:https://gitee.com/luckiness/jsGame/blob/master/tetris.html 可在移動端和PC端運行,效果如下圖。 玩法:拖動下方的形狀到方框內,填滿一行或一列可消除,消除一行或一列得一

原创 Audio在移動端只播放一次

如下代碼在移動端只會播放一次聲音。 <audio id="s"> <source src="music.mp3" type="audio/mpeg"> </audio> <button onclick="s.play();">pla

原创 js實現蜘蛛紙牌

未實現: 撤退功能、提示功能、發牌動畫 代碼下載地址:https://gitee.com/luckiness/SpiderSolitaire/blob/master/spider.html 可在移動端和PC端運行,如果在移動端請橫屏。效果如

原创 binary-tree-maximum-path-sum

問題鏈接:https://www.nowcoder.com/questionTerminal/da785ea0f64b442488c125b441a4ba4a 問題 Given a binary tree, find the maximum

原创 使用@ResponseStatus註解的注意事項

當@ResponseStatus用在方法上,如 @RequestMapping("/test") @ResponseStatus(reason="ok",code=HttpStatus.OK) public String test() {

原创 mybatis的Mapper類不能重載方法

Mapper類重載方法,方法名一樣,會拋出異常。 1.xml文件方式xml文件中存在id相同的兩個元素,拋出異常: Caused by: java.lang.IllegalArgumentException: Mapped Statemen

原创 binary-tree-maximum-path-sum

問題鏈接:https://www.nowcoder.com/questionTerminal/da785ea0f64b442488c125b441a4ba4a 問題 Given a binary tree, find the maximum

原创 設置shiroFilterFactoryBean.setSuccessUrl()無效

前提登錄處理URL:/login攔截器配置:filterChainDefinitionMap.put("/login", "anon");無效原因/login被anon攔截器攔截,根本不會執行登錄並跳轉到successUrl頁解決方法換個攔

原创 使用bootstrap-wysiwyg富文本編輯器

bootstrap-wysiwyg的介紹:http://www.bootcss.com/p/bootstrap-wysiwyg/ 。bootstrap-wysiwyg的GitHub地址: https://github.com/mindmup

原创 springboot + mybatis自定義枚舉類型轉換

本文參考了網上文章,同時結合了自己的使用。參考的文章: https://blog.csdn.net/u014527058/article/details/62883573需要枚舉類型轉換的過程1. 前臺提交的數據(如從form表單提交的數據

原创 java前後端RSA加密傳輸數據

    前端使用jsencrypt.js。    後端需要一個RSA工具類,包含生成密鑰對、加解密等功能。流程:    1.後端生成密鑰對,並把公鑰傳遞給前端,後端保存私鑰    2.前端用公鑰加密數據後,傳遞給後端    3.後端用私鑰解