林峰的小宇宙

🔥爆发了🔥


  • 首页

  • 标签

  • 分类

  • 归档

  • 链接

  • 关于

  • 搜索

CentOS配置Docker+NodeJS服务

发表于 2017-09-17

Mac端的本地环境请点击:Mac配置Docker+NodeJS服务

安装

安装 NodeJS
https://nodejs.org/en/download/
准备命令:

1
yum -y install gcc make gcc-c++ openssl-devel wget

下载源码及解压:

1
2
wget https://nodejs.org/dist/v6.11.3/node-v6.11.3.tar.gz
tar -zvxf node-v6.11.3.tar.gz

检查所需要配置

1
./configure

编译及安装:

1
make && make install

验证是否安装配置成功:

1
node -v


阅读全文 »

LoopBack学习之命令行

发表于 2017-09-17 | 分类于 学习笔记

创建新应用程序:

1
$ lb

然后,生成器将显示消息,因为它支架应用程序包括:

  1. 初始化 项目文件夹结构。
  2. 创建默认的JSON文件。
  3. 创建默认的JavaScript文件。
  4. 下载并安装依赖节点模块(就好像已经手动完成 npm install)。

创建模型:

1
$ lb model
  • 型号名称:review
  • 资料来源:mongoDs(mongodb)
  • 基类:使用向下箭头键选择 PersistedModel。
  • 通过REST API公开审查?按RETURN接受默认值。
  • 自定义复数形式(用于构建REST URL):按RETURN接受默认值,是。
  • 通用型号或服务器:按RETURN接受默认的常用型号。

模型生成器将在应用程序的common/models目录中创建两个定义模型的文件

阅读全文 »

LoopBack学习之词汇表

发表于 2017-09-17 | 分类于 学习笔记

准备工作:
安装LTS版本的Node.js.
安装LoopBack CLI工具

1
npm install -g loopback-cli

英文原地址:http://loopback.io/doc/en/lb3/LoopBack-core-concepts.html

LoopBack核心概念

模型是LoopBack的核心,代表后端数据源,如数据库或其他后端服务(REST,SOAP等)。LoopBack模型是具有Node和REST API的JavaScript对象。
LoopBack的一个关键功能是当您定义模型时,它将自动附带预定义的REST API,并具有完整的创建,读取,更新和删除操作。

模型继承

在 基本模型对象对添加方法 挂钩 和验证数据。其他模型对象都“继承”它。模型具有继承层次结构,如图所示:将模型附加到持久性数据源时,它将成为 具有创建,检索,更新和删除操作的连接模型。LoopBack的内置模型从它继承。

阅读全文 »

LoopBack学习之核心概念

发表于 2017-09-17 | 分类于 学习笔记

英文地址:
http://loopback.io/doc/en/lb3/Glossary.html

A

ACL

访问控制列表,与标识所有可访问对象的主题及其访问权限的对象关联的列表。请参阅身份验证,授权和权限。

API

应用程序接口。允许以高级语言编写的应用程序使用操作系统或其他程序的特定数据或功能的接口。

APIC

IBM API Connect命令行工具。它为脚本LoopBack应用程序提供命令。有关更多信息,请参阅命令行工具。

adapter 适配器

提供传输特定机制,使远程对象(及其集合)在其传输中可用。看强力远程。

阅读全文 »

身份证校验算法swift版本

发表于 2017-09-02 | 分类于 经验心得

参考的算法资料

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
func checkIsIdentityCard(_ identityCard: String) -> Bool {
//判断是否为空
if identityCard.characters.count <= 0 {
return false
}
//判断是否是18位,末尾是否是x
let regex2: String = "^(\\d{14}|\\d{17})(\\d|[xX])$"
let identityCardPredicate = NSPredicate(format: "SELF MATCHES %@", regex2)
if !identityCardPredicate.evaluate(with: identityCard) {
return false
}
//判断生日是否合法
let range = NSRange(location: 6, length: 8)
let datestr: String = (identityCard as NSString).substring(with: range)
let formatter = DateFormatter()
formatter.dateFormat = "yyyyMMdd"
if formatter.date(from: datestr) == nil {
return false
}
//判断校验位
if identityCard.characters.count == 18 {
let idCardWi: [String] = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"]
//将前17位加权因子保存在数组里
let idCardY: [String] = ["1", "0", "10", "9", "8", "7", "6", "5", "4", "3", "2"]
//这是除以11后,可能产生的11位余数、验证码,也保存成数组
var idCardWiSum: Int = 0
//用来保存前17位各自乖以加权因子后的总和
for i in 0..<17 {
idCardWiSum += Int((identityCard as NSString).substring(with: NSRange(location: i, length: 1)))! * Int(idCardWi[i])!
}
let idCardMod: Int = idCardWiSum % 11
//计算出校验码所在数组的位置
let idCardLast: String = identityCard.substring(from: identityCard.index(identityCard.endIndex, offsetBy: -1))
//得到最后一位身份证号码
//如果等于2,则说明校验码是10,身份证号码最后一位应该是X
if idCardMod == 2 {
if idCardLast == "X" || idCardLast == "x" {
return true
} else {
return false
}
} else {
//用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
if (idCardLast as NSString).integerValue == Int(idCardY[idCardMod]) {
return true
} else {
return false
}
}
}
return false
}

自勉,自律

LaunchImage载入界面标准大小

发表于 2016-01-15 | 分类于 学习笔记

载入界面标准大小

iPhone Portrait iOS 8,9 Retina HD 5.5 (1242×2208) @3x

iPhone Portrait iOS 8,9 Retina HD 4.7 (750×1334) @2x

iPhone Portrait iOS 7-9 2x (640×960) @2x

iPhone Portrait iOS 7-9 Retina 4 (640×1136) @2x

iPhone Portrait iOS 5,6 1x (320×480) @1x

iPhone Portrait iOS 5,6 2x (640×960) @2x

iPhone Portrait iOS 5,6 Retina4 (640×1136) @2x

CocoaPods安装命令行

发表于 2016-01-15
  1. 安装xcode工具

    1
    xcode-select --install
  2. 安装rvm

    1
    2
    3
    4
    5
    curl -L get.rvm.io | bash -s stable
    rvm list known (找到最新的rvm版本)
    rvm install 2.4

3.改数据源

1
2
3
gem sources -a https://gems.ruby-china.org
gem sources --remove https://rubygems.org/

  1. 安装rails

    1
    sudo gem install rails
  2. 安装cocoapods

    1
    sudo gem install cocoapods

在cocoapods 执行 sudo gem install cocoapods 的时候出现 While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /usr/bin directory.
改为 sudo gem install -n /usr/local/bin cocoapods 即可

Hello World

发表于 2015-05-20

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 Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

123
David Lin

David Lin

资深软件工程师,架构师,PMP。2001年毕业于浙江工业大学计算机系, Mac/iOS 应用开发十数年。在虹软科技,尼禄软件工作期间任苹果平台的核心工程师。2015年创办宗布科技,负责团队技术架构,技术指导,项目团队管理。2017年加入网易杭州研究院K12部门,组建团队,技术框架和项目管理

28 日志
4 分类
13 标签
© 2021 David Lin
由 Hexo 强力驱动
|
主题 — NexT.Pisces v5.1.3