Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment
Docker部署简单Nginx
1. 使用Dockerfile部署首先来看下目录结构及配置文件:
mydefault.conf1234567891011121314151617181920212223server { #这里就是把默认config的80端口改为8080端口 listen 8080; listen [::]:8080; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server err ...
备份和还原MongoDB
记录MongoDB备份和还原的简单使用
备份1mongodump -h dbhost -d dbname -o dbdirectory
参数
说明
-h
MongoDB 所在服务器地址,例如:127.0.0.1,也可以指定端口号:127.0.0.1:27017
-d
需要备份的数据库实例,例如:testDB
-o
备份的数据存放位置,例如:c:\data\dump,当然该目录需要提前建立,在备份完成后,系统自动在dump目录下建立一个testDB目录,这个目录里面存放该数据库实例的备份数据
例如:
1mongodump -h 127.0.0.1 -d demoDB -o C:\data\dump\demoDB
还原1mongorestore -h dbhost -d dbname <path>
参数
说明
-h
MongoDB 所在服务器地址,例如:127.0.0.1,也可以指定端口号:127.0.0.1:27017。默认为: localhost:27017
-d
需要备份的数据库实例,例如:testDB
<path> ...
Navigator.sendBeacon-关闭页面提交数据
navigator.sendBeacon() 方法可用于通过HTTP将少量数据异步传输到Web服务器
适用于当用户关闭页面、刷新页面或者跳转到其他页面时,需要向服务器发送一些记录数据,并且不关心服务器返回值的场景
描述使用sendBeacon()方法会使用户代理在有机会时异步地向服务器发送数据,同时不会延迟页面的卸载或影响下一导航的载入性能。这就解决了提交分析数据时的所有的问题:数据可靠,传输异步并且不会影响下一页面的加载。
语法1navigator.sendBeacon(url, data);
参数
说明
url
表明 data 将要被发送到的网络地址
data
将要发送的ArrayBufferView、Blob、DOMString或FormData类型的数据
参考代码一般常用 DOMString , Blob 和 Formdata 这三种对象作为数据发送到后端,下面以这三种方式为例进行说明:
123456789101112131415161718192021222324252627282930313233// 1. DOMString ...
配置MongoDB + 安装为Windows服务
为了方便在同一台服务器上配置多个版本的MongoDB服务,我选择了去Mongodb官网下载zip文件,手动配置服务,以下以实例说明。文件解压至路径“D:\Program Files\mongodb\Server\4.0.6\” 。
创建配置文件新建文件D:\Program Files\mongodb\Server\4.0.6\bin\mongod.cfg :
1234567891011121314151617181920# Where and how to store data.storage: dbPath: D:\Program Files\mongodb\Data\4.0.6 journal: enabled: true# engine:# mmapv1:# wiredTiger:# where to write logging data.systemLog: destination: file logAppend: true path: D:\Program Files\mongodb\Log\4.0.6\mongod.log# network in ...
SQL Server 笔记
分组排序1ROW_NUMBER() OVER(PARTITION BY COL1 ORDER BY COL2)
比如,把每个班的学生按年龄从小到大的排序:
123456SELECT [CLASS] ,[NAME] ,[AGE] ,ROW_NUMBER() OVER (PARTITION BY [CLASS] ORDER BY [AGE] ASC)FROM TEST_T
Merge简单使用:如果学生信息存在,则更新学生年龄。如果不存在,则插入学生信息。
12345678910MERGE INTO D_StudentT AS targetUSING Temp_StudentT AS source ON target.CLASS = source.CLASS AND target.NAME=source.NAMEWHEN MATCHED THEN UPDATE SET target.AGE=source.AGE, target.UpdatedTime=GETDATE()WHEN NO ...
Git 同时 push 到多个远程仓库
使用以下命令添加第二个远程地址:
1git remote set-url --add origin https://gitee.com/notop/blog.git
查看远程分支:
1234$ git remote -vorigin https://github.com/IfCome/blog.git (fetch)origin https://github.com/IfCome/blog.git (push)origin https://gitee.com/notop/blog.git (push)
这样就能同时 push 到多个远程地址
123$ git push origin masterEverything up-to-dateEverything up-to-date
写作
你可以执行下列命令来创建一篇新文章或者新的页面。
1$ hexo new [layout] <title>
您可以在命令中指定文章的布局(layout),默认为 post,可以通过修改 _config.yml 中的 default_layout 参数来指定默认布局。
布局(Layout)Hexo 有三种默认布局:post、page 和 draft。在创建这三种不同类型的文件时,它们将会被保存到不同的路径;而您自定义的其他布局和 post 相同,都将储存到 source/_posts 文件夹。
布局
路径
post
source/_posts
page
source
draft
source/_drafts
Disabling layoutIf you don’t want an article (post/page) to be processed with a theme, set layout: false in its front-matter. Refer to this section for more details.
文件名称H ...
Front-matter
Front-matter 是文件最上方以 — 分隔的区域,用于指定个别文件的变量,举例来说:
1234---title: Hello Worlddate: 2013/7/13 20:46:25---
以下是预先定义的参数,您可在模板中使用这些参数值并加以利用。
参数
描述
默认值
layout
布局
config.default_layout
title
标题
文章的文件名
date
建立日期
文件建立日期
updated
更新日期
文件更新日期
comments
开启文章的评论功能
true
tags
标签(不适用于分页)
categories
分类(不适用于分页)
permalink
覆盖文章网址
excerpt
Page excerpt in plain text. Use this plugin to format the text
disableNunjucks
Disable rendering of Nunjucks tag {{ }}/{% ...