使用git hooks 自动更新spring项目中 js 和css 文件版本号

spring项目中,修改了js文件后,重新部署后, 客户端经常会因为缓存了旧的js文件,导致功能异常。

一般的解决方案,是spring中引入资源处理插件,然后把相关资源文件的连接处理成类似test_xxxxxx.js的文件

本方案,再jsp中引用js时采用  test.js?v222222 ,即js文件名+?+版本号,版本号一般就是文件的修改日期。

源代码使用git管理,添加git的pre-commit hooks,在提交包含js或者css的文件修改时,扫描src目录下的相关文件,有带有文件连接的,

使用新的修改后的版本号替换。

git commit 后,会自动把相关的jsp修改后的文件,也一起提交。

https://gist.github.com/minyoad/b27fb53af3930d0093b94b823f0c2292

PS:

使用的是bash脚本,windows 只在wsl中测试过。

- 阅读全文 -

BT面板安装php5.6失败

环境:Ubuntu 16.04 

安装PHP5.6 几次都失败

搜索一通,都是直接安装PHP5.6,而不是编译安装

参考:

https://stackoverflow.com/questions/11741976/getting-error-char16-t-and-char32-t-undeclared

看 src 目录下,一直有相关的Makefile,直接make,就会报错

把 --std=c++11 添加到CXXFLAGS,没有起作用

仔细看一下,原来没有使用,只是使用在COMMONFLAGS,没有包含CXXFLAGS

添加到

CPPFLAGS = --std=c++11

重新

make

make install

make install-fpm

 

目前看来,php.ini, fpm.conf 都没有,从现有的php 72目录下拷贝过来。

- 阅读全文 -

bat设置不显示隐藏的文件文件夹或驱动器

参考: https://www.howtogeek.com/283251/how-do-you-show-or-hide-windows-hidden-files-with-a-command-line-toggle/

正常设置方法

Image

隐藏:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t REG_DWORD /d 0 /f

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 2 /f

显示

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t REG_DWORD /d 1 /f

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t REG_DWORD /d 1 /f

内容保存成bat, 执行即可。

- 阅读全文 -

wordpress 离线升级

aabite.com 不知道是被谁盯上了,被黑了。服务器懒得折腾,换到了virmach,结果,昨天收到邮件说,IO 超了,vps被shutdown。

今天去看了一下,重启vps,就又可以访问了,可是,刚起来Apache,就一大堆的访问,觉得是不是被当成中间代理了。

把aabite.com 下线,充Apache disable

然后下载了最新的wordpress 包,原wordpress里面,删除wp-admin和wp-includes,然后,从新的wordpress里面拷贝过来,

wordpress根目录下的文件,全部替换成最新的。

查看一下wp-config-sample.php,确认没什么更新的

重新启用aabite.com

访问时,发现wp-admin页面进不去

log 发现

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 3958207 bytes) in /var/www/aabite.com/wp-includes/wp-db.php on line 2066

解决办法:

参考 https://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/

即 

define( 'WP_MEMORY_LIMIT', '256M' );

重新访问即可。

- 阅读全文 -

hostodo ip 被墙

一场倒墙风波过后,我不怎么使用的vps ip也都被ban了,包括hostodo和vultr。

简单的检测方法:ping.chinaz.com

如果国内都不通,国外的通,很明显了。

解决办法:

hostodo 发了个service ticket,说vps cannot access via ssh

当天晚上就发mail,给了个新ip。

服务还是不错的。

vultr 需要新创建实例,然后把旧实例数据restore过去就好。

- 阅读全文 -

Ubuntu 设置sudo 没有密码

设置当前登陆用户sudo免密

假设当前用户名为user1
使用visudo打开sudoers并编辑
sudo visudo
在刚才编辑的内容中加上NOPASSWD:
user1  ALL=(ALL:ALL) NOPASSWD: ALL
保存即可。

 

 

- 阅读全文 -

wordpress 数据库链接失败

今天访问网站,才发现直接提示数据库链接失败

查看mysql的

2019-01-21T03:23:15.998898Z 15638 [ERROR] /usr/sbin/mysqld: Table './mybacc_wordpress/wp_options' is marked as crashed and last (automatic?) repair failed
2019-01-21T03:23:15.999066Z 15638 [ERROR] /usr/sbin/mysqld: Table './mybacc_wordpress/wp_options' is marked as crashed and last (automatic?) repair failed
2019-01-21T03:23:22.791382Z 15639 [ERROR] /usr/sbin/mysqld: Table './mybacc_wordpress/wp_options' is marked as crashed and last (automatic?) repair failed
2019-01-21T03:23:22.791579Z 15639 [ERROR] /usr/sbin/mysqld: Table './mybacc_wordpress/wp_options' is marked as crashed and last (automatic?) repair failed
2019-01-21T03:23:22.791753Z 15639 [ERROR] /usr/sbin/mysqld: Table './mybacc_wordpress/wp_options' is marked as crashed and last (automatic?) repair failed

参考:https://stackoverflow.com/questions/8843776/mysql-table-is-marked-as-crashed-and-last-automatic-repair-failed

 

server上用mysql 连接server

repair table wp_options' <table_name>;


image

刷新网站,搞定。

- 阅读全文 -

babun 访问gitlab 每次弹出用户名密码

问题:

使用babun自带的git,因为工作项目是放在gitlab上,但是每次git pull,都会弹出询问用户名密码,设置了ssh key也是如此。

解决方案:

http://stackoverflow.com/a/36721316/4377192

Get the GCMW's latest release, download the zip file (not the installer), extract it's contents (only .dll and .exe files are needed) to C:\cygwin\usr\libexec\git-core\ for 32-bit Cygwin, or C:\cygwin64\usr\libexec\git-core\ for 64-bit Cygwin. Reference

To tell git to use GCMW, execute: git config --global credential.helper manager

To get GUI prompts for credentials, execute: git config --global credential.modalprompt true

If you want this to be a per-repository setting, remove the --global option.

来源: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/146

下载gcmw的zip包,把里面的EXE,DLL文件都拷贝到babun的git-core 目录下

%Profile%\.babun\cygwin\usr\libexec\git-core\

然后设置

git config --global credential.helper manager

如果只是单项目的,移除--global即可

整合的babun下载:

http://www.odrive.tk/?/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/babun-1.2.0-dist.zip

- 阅读全文 -

热门文章

最新文章

最近回复

  • wfzlxvvgte: 你的文章让我感受到了不一样的风景,谢谢分享。 http://ww...
  • sfiutfecff: 你的文章内容非常用心,让人感动。 http://www.55ba...
  • dyqoaaqpdc: 你的文章内容非常卖力,让人点赞。 http://www.55ba...
  • vrfedcneqp: 你的文章内容非常卖力,让人点赞。 http://www.55ba...
  • wmhoubuazg: 你的文章内容非常用心,让人感动。 http://www.55ba...
  • khhhttrppu: 你的文章内容非常卖力,让人点赞。 http://www.55ba...
  • atjzyxiutr: 你的文章内容非常用心,让人感动。 http://www.55ba...
  • dlamzmkwwi: 你的文章内容非常卖力,让人点赞。 http://www.55ba...
  • predcxvhsz: 《蛋黄人》国产剧高清在线免费观看:https://www.jgz...
  • qmffcradmz: 《逃狱者》剧情片高清在线免费观看:https://www.jgz...

分类

标签

其它