快轉到主要內容

Posts

2016

MYSQL外鍵導致無法清空表

MYSQL外鍵導致無法清空表

·132 字·1 分鐘
最近設計的數據庫表含有外鍵,結果在開發時truncate table的時候報錯了, 1SQL错误(1701):Cannot truncate a table referenced in a foreign key constraint (`rollcall2`.`oncall`, CONSTRAINT `FK__calls` FOREIGN KEY (`calls_id`) REFERENCES `rollcall2`.`calls` (`id`)) 解決辦法如下: 1SET FOREIGN_KEY_CHECKS = 0; 2TRUNCATE table; 3SET FOREIGN_KEY_CHECKS = 1; 當然也可以通過移除外鍵之類的辦法,但是感覺還是用上面幾行命令來解決比較方便。
使用 extundelete 恢复rm误操作

使用 extundelete 恢复rm误操作

·438 字·1 分鐘
系统:CentOS 7 文件系统:EXT4 今天 YCHEUNG 不小心用 rm 命令误删了一个名字奇奇怪怪的文件,因为名字太奇怪想不起来它是啥,怕是重要文件,所以急急忙忙去找办法恢复。
Brew&Blend 2016+x: Building a Future City-DAY 3

Brew&Blend 2016+x: Building a Future City-DAY 3

·387 字·1 分鐘
先說結論, 你腦海裡的未來城市會是什麼樣子的? 吃吃吃! 雖然已經是活動的最後一日了,來的年輕人依然不少,也有不少是帶著小孩來玩的,大多數著裝都是上白下黑,YCHEUNG還以為這是大家都約好的….
Centos 7 使用 certbot 安裝Let’s Encrypt SSL 證書

Centos 7 使用 certbot 安裝Let’s Encrypt SSL 證書

·707 字·2 分鐘
安裝環境 # CentOS7 主機 Nginx 操作步驟 # 安裝certbot # 1#如果你已經安裝了EPEL,這個步驟可以省略 2sudo yum install epel-release 3#安裝certbot客戶端 4sudo yum install certbot 使用嚮導自動安裝證書 # 使用certbot嚮導安裝,有界面,根據指示一步步操作就行,但是YCHEUNG進行到設置webroot的時候就error了,只好放棄
FEDORA安装electron-builder报错make:g++:命令未找到之解决

FEDORA安装electron-builder报错make:g++:命令未找到之解决

·354 字·1 分鐘
系统环境: Fedora 24 Node v4.5.0 NPM v2.15.9 NPM安装electron-builder报错 # 1$npm install electron-builder --save=dev 2npm WARN package.json [email protected] No repository field. 3npm WARN package.json [email protected] No README data 4 5> [email protected] install /var/www/html/test/node_modules/dev/node_modules/inotify 6> node-gyp rebuild 7 8make: Entering directory '/var/www/html/test/node_modules/dev/node_modules/inotify/build' 9 CXX(target) Release/obj.target/inotify/src/bindings.o 10make: g++:命令未找到 11inotify.target.mk:97: recipe for target 'Release/obj.target/inotify/src/bindings.o' failed 12make: *** [Release/obj.target/inotify/src/bindings.o] Error 127 13make: Leaving directory '/var/www/html/test/node_modules/dev/node_modules/inotify/build' 14gyp ERR! build error 15gyp ERR! stack Error: `make` failed with exit code: 2 16gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:276:23) 17gyp ERR! stack at emitTwo (events.js:87:13) 18gyp ERR! stack at ChildProcess.emit (events.js:172:7) 19gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) 20gyp ERR! System Linux 4.7.4-200.fc24.x86_64 21gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 22gyp ERR! cwd /var/www/html/test/node_modules/dev/node_modules/inotify 23gyp ERR! node -v v4.5.0 24gyp ERR! node-gyp -v v3.4.0 25gyp ERR! not ok 26npm WARN optional dep failed, continuing [email protected] 27npm WARN deprecated [email protected]: This package is deprecated. Use Object.assign. 28npm WARN optional dep failed, continuing [email protected] 29npm WARN optional dep failed, continuing [email protected] 30npm ERR! Linux 4.7.4-200.fc24.x86_64 31npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "electron-builder" "--save=dev" 32npm ERR! node v4.5.0 33npm ERR! npm v2.15.9 34npm ERR! code ELIFECYCLE 35 36npm ERR! [email protected] install: `node-gyp rebuild` 37npm ERR! Exit status 1 38npm ERR! 39npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 40npm ERR! This is most likely a problem with the inotify package, 41npm ERR! not with npm itself. 42npm ERR! Tell the author that this fails on your system: 43npm ERR! node-gyp rebuild 44npm ERR! You can get information on how to open an issue for this project with: 45npm ERR! npm bugs inotify 46npm ERR! Or if that isn't available, you can get their info via: 47npm ERR! 48npm ERR! npm owner ls inotify 49npm ERR! There is likely additional logging output above. 50 51npm ERR! Please include the following file with any support request: 52npm ERR! /var/www/html/test/npm-debug.log 解决方法: # 安装G++ $sudo dnf install gcc-c++
Drupal7中自定义表格输入

Drupal7中自定义表格输入

·1240 字·3 分鐘
Drupal默认的节点表单(entity form)输入有时候并不能满足我们的需求,比如我想做一个类似excel表格输入形式的表单呢? = DEMO点这里 (PS. 用Pantheon的sandbox做了一个随意折腾的drupal站点,真的是折腾死我了= =) 首先,新建一个自定义模块,在你的*.module文件中hook_menu() 指定一个页面路径,设置页面调用表单,比如这样: