golove
python3

变量的三个特性

  1. id就是变量值的内存空间地址,每一个值都有一个唯一的I’d,内存地址不同,id就不同。可以使用id()来查看变量的内存地址,id(object)函数是返回对象object在其生命周期内位于内存中的地址。
  2. type 不同类型的值记录事物的状态有所不同。这就是python的数据类型。可以使用type()来查看。
  3. 变量值就是储存值本身

逻辑运算符

与 X and Y; 或 X or Y; 非 not X

not 优先级最高其次是and ,or的优先级最低

testblog

A conversation with Ray Garcia, Jonathan Gold, Evan Kleiman, Bricia Lopez, and Carlos Salgado about the evolving role of Mexican cuisine in LA as culture, art, and craft

Source: Food Icons on the Evolving Role of Mexican Cuisine in LA

Together, critic Jonathan Gold, food scholar Evan Kleiman, and chefs Ray Garcia, Bricia Lopez, and Carlos Salgado have spent more than a lifetime preparing, eating, and writing about Latin American cuisine. Before their recent panel discussion at the Getty, offered in conjunction with Pacific Standard Time, they sat down with us to reflect on the role of Mexican cuisine in the life of Los Angeles and how we might expand our taste buds to go deeper.

SS: As a chef (or critic), do you consider yourself an artist?

EK: Art to me often has an intellectual component. I think of food preparation as a craft–I don’t think of it as art.

莫听穿林打叶声

莫听穿林打叶声,何妨吟啸且徐行。

竹杖芒鞋轻胜马,谁怕?一蓑烟雨任平生。

料峭春风吹酒醒,微冷,山头斜照却相迎。

回首向来萧瑟处,归去,也无风雨也无晴。

javaScript常用方法

使用给定的参数对句子执行一次查找和替换,然后返回新句子

function myReplace(str, before, after) {
    if (before.charAt(0) >= 'A' && before.charAt(0) <= 'Z') {
        //将after的首字母变为大写
        after = after.replace(after.charAt(0), after.charAt(0).toUpperCase());
        str = str.replace(before, after);
    } else {
//将after的首字母变为小写
        after = after.replace(after.charAt(0), after.charAt(0).toLowerCase());
        str = str.replace(before, after);
    }
    return str;
}
console.log(myReplace("Let us get back to more Coding", "Coding", "algorithms"))
javaScript继承多态闭包

构造函数继承

构造函数继承的关键:在child构造函数中执行Parent.call(this)

function Parent(name){
    this.name=name;
    this.hobby=[];
    this.speak=function(){
        console.log("Parent spea");
    }// 缺点1:new多个child时Parent构造函数中的方法会在每个child中拷贝一份,浪费内存
}
Parent.prototype.say = function(){
    console.log("Parent say")
} // 缺点2:Parent原型对象上的方法不会被Child继承

function Child(name,type){
    Parent.call(this,name);
    this.type = type;
}
javascript基础

ECMAScript(ES): 规定了JS的一些基础核心的支持(变量,数据类型,语法规范,操作语句等,)

DOM: document object mode 文档对象模型,里面提供了一些属性和方法,可以让我们操作页面中的元素.

BOM: browser object model 浏览器对象模型,里面提供了也许属性和方法,可以让我们操作浏览器.

DockerDockerfile

Dockerfile 是一个用来构建镜像的文本文件,文本内容包含了一条条构建镜像所需的指令和说明。

使用 Dockerfile 定制镜像

这里仅讲解如何运行 Dockerfile 文件来定制一个镜像,具体 Dockerfile 文件内指令详解,将在下一节中介绍,这里你只要知道构建的流程即可。

1、下面以定制一个 nginx 镜像(构建好的镜像内会有一个 /usr/share/nginx/html/index.html 文件)

在一个空目录下,新建一个名为 Dockerfile 文件,并在文件内添加以下内容:

FROM nginx
RUN echo '这是一个本地构建的nginx镜像' > /usr/share/nginx/html/index.html
Docker容器连接

容器中可以运行一些网络应用,要让外部也可以访问这些应用,可以通过 -P 或 -p 参数来指定端口映射。

两种方式的区别是:

  • **P :**是容器内部端口**随机**映射到主机的高端口。
  • p : 是容器内部端口绑定到指定的主机端口。

另外,我们可以指定容器绑定的网络地址,比如绑定 127.0.0.1。

容器默认都是绑定 tcp 端口,如果要绑定 UDP 端口,可以在端口后面加上 /udp。

-p 127.0.0.1:5000:5000/udp

docker port 命令可以让我们快捷地查看端口的绑定情况。