2017 年文章归档
共 119 篇文章
Docker远程访问
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354935 Prerequisite 两台Client API和Server API版本一致的Docker服务器 修改Docker守护进程启动选项,区别服务器 docker-0000 docker-0001 远程访问 —— 修改docker-0000服务端配置 再次修改/etc/default/docker DOCKER_OPTS="--label name=docker_server_0 -H tcp://0.0.0.0:2375" 保存退出,重启service sudo service docke…
2017-01-29 23:29 · Docker
Docker中部署静态网站
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354929 设置容器的端口映射 run [-P] [-p] Note: -P, --publish-all=true | false 默认为false( 使用大P将为容器的暴露的所有端口进行映射 ) sudo docker run -P -it ubuntu /bin/bash -p, --publish=[] ( 使用小P将为容器的指定端口进行映射 ) containerPort sudo docker run -p 80 -it ubuntu /bin/bash hostPort:containe…
2017-01-29 12:41 · Docker
Docker Container常用命令
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354873 docker run —— 交互式容器 docker run是最常用也是最复杂的命令,通过 docker help run 可以看到该命令有很多选项。 其中最常用的的选项包括: -i -t 这两个选项经常一起使用,可以缩写为-it,用于创建交互式容器 -d 让容器运行在后台,用于创建守护式容器 --name 为容器指定一个名称 容器运行成功后,会返回一个64字符的容器ID,作为容器的唯一标识。 通过如下命令运行一个 交互式容器 : sudo docker run -it centos:6 …
2017-01-26 22:34 · Docker
Ubuntu下Docker的安装和守护进程的配置
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354852 Prerequisite OS requirements To install Docker, you need the 64-bit version of one of these Ubuntu versions: Yakkety 16.10 Xenial 16.04 (LTS) Trusty 14.04 (LTS) 安装步骤 安装Ubuntu维护的Docker版本 sudo apt-get install -y docker.io Note: 这个安装的是Ubuntu维护的Docker…
2017-01-26 14:02 · Docker
Docker Overview
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354828 Docker的目标 提供简单轻量的建模方式 职责的逻辑分离 快速高效的开发生命周期 鼓励使用面向服务的架构 Docker的使用场景 使用Docker容器开发、测试、部署服务 创建隔离的运行环境 搭建测试环境 构建多用户的平台即服务(PaaS)基础设施 提供软件即服务(SaaS)应用程序 高性能、超大规模的宿主机部署 Docker基本组成 Docker Client客户端 The Docker client, in the form of the docker binary, is the …
2017-01-25 21:54 · Docker
Express Get和Post获取参数
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354503 Project Directory npm install express npm install body-parser Note:post提交需要这个body-parser来获取参数 index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>express get & post</title> </head> <body> <form action="/testget" method…
2017-01-22 20:55 · Node.js
NodeJS call Spring Rest
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354390 Spring Project Directory Maven Dependency <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://…
2017-01-21 19:57 · Node.js
NodeJS Marko custom tags Quick Reference
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354225 Prerequisite http://agilestyle.iteye.com/blog/2354215 Project Directory SRC marko-taglib.json { "tag-dir": "./components" } src/components/app-hello/template.marko <div> Hello ${data.name}! You have ${data.messageCount} message(s). </div> src/comp…
2017-01-20 14:35 · Node.js
NodeJS Marko Quick Reference
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354215 Prerequisite npm init npm install express --save --registry=https://registry.npm.taobao.org npm install marko --save --registry=https://registry.npm.taobao.org Project Directory SRC package.json { "name": "hello-marko", "version": "1.0.0", "descri…
2017-01-20 13:44 · Node.js
NodeJS Module Quick Reference
原创转载请注明出处: http://agilestyle.iteye.com/blog/2354063 Project Directory exports.xxx = function() {} hello.js exports.world = function() { console.log("Hello World"); }; module.exports = xxx world.js function Person(name) { this.name = name; } Person.prototype = { constructor: Person, sayName: functio…
2017-01-19 15:58 · Node.js
Ubuntu Google Chrome Proxy设置
原创转载请注明出处: http://agilestyle.iteye.com/blog/2353664 Ubuntu下Google Chrome的Settings下的Proxy默认是不能进行配置的,在中国大陆通常就会导致无法访问Google,以及安装一些对程序开发有用的extension,这对我们从事程序开发的人员颇为不便,解决办法如下: 一般公司都会提供访问外网的代理,打开Ubuntu的System Settings 点击Network,选择Network proxy,输入自己公司的代理,Apply system wide即可 接下来就可以打开Chrome,访问Google官网,获取Goo…
2017-01-18 10:10 · Linux
SOA与微服务
原创转载请注明出处: http://agilestyle.iteye.com/blog/2353430 SOA与微服务的区别 SOA实现 微服务架构实现 企业级,自顶向下开展实施 团队级,自底向下开展实施 服务由多个子系统组成,粒度大 一个系统被拆分成多个服务,粒度细 企业服务总线,集中式的服务架构 无集中式总线,松散的服务架构 集成方式复杂(ESB/WS/SOAP) 集成方式简单(HTTP/REST/JSON) 单块架构系统,相互依赖,部署复杂 服务能独立部署 Note: 相比传统SOA的服务实现方式,微服务更具灵活性、可实施性以及可扩展性,其强调的是一种独立测试、独立部署、独立运行的软件…
2017-01-17 10:53 · Web Service
No 'Access-Control-Allow-Origin' header is present on the requested resource.
原创转载请注明出处: http://agilestyle.iteye.com/blog/2353274 通常项目开发中我们通常会遇到跨域调用,然后当请求调用的时候会遇到这个错 No 'Access-Control-Allow-Origin' header is present on the requested resource. 通常解决这个错误有两种解决方法 1. JSONP 2. CORS Note: CORS与JSONP相比,更为先进、方便和可靠。 JSONP只能实现GET请求,而CORS支持所有类型的HTTP请求。 使用CORS,开发者可以使用普通的XMLHttpRequest发起请…
2017-01-16 13:05 · Node.js
NodeJS Callback
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352487 为什么NodeJS约定回调函数的第一个参数必须是错误对象err(如果没有错误,该参数就是null)? 因为执行分成两段,在这两段之间抛出的错误程序无法捕捉,只能当做参数传入第二段。 维基百科上的解释: In computer programming, a callback is a reference to a piece of executable code that is passed as an argument to other code. jQuery文档的解释: A callb…
2017-01-11 16:50 · Node.js
NodeJS Sublime环境配置
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352335 Prerequisite https://github.com/tanepiper/SublimeText-Nodejs 下载zip包 解压后,重命名为nodejs,拷贝到 C:\Users\Administrator\AppData\Roaming\Sublime Text 2\Packages 设定build环境为nodejs Tools > Build System > Nodejs 配置环境 Preferences > Package Settings > Nodejs > Set…
2017-01-10 22:29 · Node.js
Express Request & Response
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352272 Request对象 https://expressjs.com/en/4x/api.html#req Response对象 https://expressjs.com/en/4x/api.html#res
2017-01-10 16:54 · Node.js
Express Route
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352268 Express Route var express = require("express"); var app = express(); app.get('/', function (req, res) { console.log("get request"); res.send('Hello GET'); }); app.post('/', function (req, res) { console.log("post request"); res.send('Hello POST');…
2017-01-10 16:28 · Node.js
Express Hello World
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352259 npm init Install Express npm install express --save --registry=https://registry.npm.taobao.org Hello World var express = require("express"); var app = express(); app.get("/", function (req, res) { res.send("Hello World"); }); var server = app.list…
2017-01-10 16:09 · Node.js
JSON.parse() & JSON.stringify()
原创转载请注明出处: http://agilestyle.iteye.com/blog/2352232 JSON.parse() Demo var str = '{"username":"nodejs", "password":"23"}'; console.log(JSON.parse(str)); Console Output JSON.stringify() Demo var str = {a: 1, b: 2, c: "test"}; console.log(JSON.stringify(str)); Console Output
2017-01-10 14:16 · JavaScript