object

Vue学习笔记(十三) 响应式原理

元气小坏坏 提交于 2020-02-04 00:38:49
1、外在表现 响应式系统是 Vue 的核心特性之一,它的实质其实就是 当数据模型发生变化时,视图将会自动更新 这样可以避免开发人员直接操作 DOM,大大降低开发难度,这也是 Vue 提倡 数据驱动 的原因,我们看一个例子 <!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://cdn.jsdelivr.net/npm/vue"></script> </head> <body> <div id="app"> <div>Counter: {{ counter }}</div><br/> <button v-on:click="increase">Increase</button> <button v-on:click="decrease">Decrease</button> </div> <script> new Vue({ el: '#app', data: { counter: 0 }, methods: { increase: function() { this.counter += 1 }, decrease: function() { this.counter -= 1 } } }) </script> </body> </html> 当我们点击按钮调用方法时,会使得数据 counter

static variable in subclass Java

点点圈 提交于 2020-02-03 21:44:32
问题 I need to have a static variable that is not related to an object, but to the class itself. However, the variable must also not be related to the parent class, or all other sub-classes that extends the same parent class. let's say: class Army{ static int attack = 0; } class Warrior extends Army{ public Warrior(){ attack = 50; // every Warrior object will have attack value of 50 } } class Archer extends Army{ public Archer(){ attack = 75; // every Archer object will have attack value of 75 } }

static variable in subclass Java

馋奶兔 提交于 2020-02-03 21:44:18
问题 I need to have a static variable that is not related to an object, but to the class itself. However, the variable must also not be related to the parent class, or all other sub-classes that extends the same parent class. let's say: class Army{ static int attack = 0; } class Warrior extends Army{ public Warrior(){ attack = 50; // every Warrior object will have attack value of 50 } } class Archer extends Army{ public Archer(){ attack = 75; // every Archer object will have attack value of 75 } }

static variable in subclass Java

删除回忆录丶 提交于 2020-02-03 21:42:20
问题 I need to have a static variable that is not related to an object, but to the class itself. However, the variable must also not be related to the parent class, or all other sub-classes that extends the same parent class. let's say: class Army{ static int attack = 0; } class Warrior extends Army{ public Warrior(){ attack = 50; // every Warrior object will have attack value of 50 } } class Archer extends Army{ public Archer(){ attack = 75; // every Archer object will have attack value of 75 } }

动态代理详解

耗尽温柔 提交于 2020-02-03 19:37:46
动态代理详解     动态代理 它可以直接给某一个 目标对象 生成一个 代理对象 ,而不需要代理类存在。     动态代理与代理模式原理是一样的,只是它 没有具体的代理类 ,直接通过 反射 生成了一个代理对象。     动态代理生成技术:         1. 基于jdk提供一个 Proxy类 ,可以直接给实现某接口的实现类直接生成代理对象。         2. 基于cglib (spring框架会学习)     java.lang.reflect.Proxy;   该类可以直接生成一个代理对象。     Proxy类的方法 :         public static Object newProxyInstance(ClassLoader loader, Class[] interfaces, InvocationHandler h) 返回一个指定接口的代理类实例。             仅能代理实现至少一个接口的类(即目标对象需要至少有一个接口)。             ClassLoader:类加载器。固定写法,和被代理类使用相同的类加载器即可。             Class[]:代理类要实现的接口。固定写法,和被代理类使用相同的接口即可。             InvocationHandler: 策略(方案)设计模式 的应用。 如何去具体实现代理

gtk PyGObject示例1

[亡魂溺海] 提交于 2020-02-03 15:55:13
PyGObject入门 使用Gtk.Builder引入glade的UI文件 < ? xml version="1.0" encoding="UTF - 8" ? > < !-- Generated with glade 3.22.1 - - > <interface > <requires lib="gtk+" version="3.20"/ > <object class="GtkAccelGroup" id="accelgroup1"/ > <object class="GtkTextBuffer" id="textbuffer1" > <property name="text" translatable="yes" > hello world !</property> </object > <object class="GtkWindow" id="window1" > <property name="can_focus" > False</property > <property name="title" translatable="yes" > Hello World</property > <property name="default_width" > 800</property > <property name="default_height" > 600<

java对象转化成String类型

筅森魡賤 提交于 2020-02-03 08:26:01
在java项目的实际开发和应用中,常常需要用到将对象转为String这一基本功能。本文将对常用的转换方法进行一个总结。常用的方法有Object#toString(),(String)要转换的对象,String.valueOf(Object)等。下面对这些方法一一进行分析。       方法1:采用 Object#toString()方法   请看下面的例子:        Object object = getObject();      System.out.println(object.toString());      在这种使用方法中,因为java.lang.Object类里已有public方法.toString(),所以对任何严格意义上的java对象都可以调用此方法。但在使用时要注意,必须保证object不是null值,否则将抛出NullPointerException异常。采用这种方法时,通常派生类会覆盖Object里的toString()方法。       方法2:采用类型转换(String)object方法   这是标准的类型转换,将object转成String类型的值。使用这种方法时,需要注意的是类型必须能转成String类型。因此最好用instanceof做个类型检查,以判断是否可以转换。否则容易抛出CalssCastException异常。此外

python数据分析库pandas使用之一

泪湿孤枕 提交于 2020-02-03 02:46:27
Day1 Pandas基本操作 titanic数据集: 密码:pje4 数据读取 import pandas as pd df = pd . read_csv ( 'data/titanic.csv' ) #read_excel/read_json等 #.head()可以读取前几条数据 df . head ( 6 ) #.info()返回当前的信息 df . info ( ) ''' <class 'pandas.core.frame.DataFrame'> RangeIndex: 891 entries, 0 to 890 Data columns (total 12 columns): PassengerId 891 non-null int64 Survived 891 non-null int64 Pclass 891 non-null int64 Name 891 non-null object Sex 891 non-null object Age 714 non-null float64 SibSp 891 non-null int64 Parch 891 non-null int64 Ticket 891 non-null object Fare 891 non-null float64 Cabin 204 non-null object Embarked 889

Git内部原理探索

人走茶凉 提交于 2020-02-03 02:14:21
目录 前言 Git分区 .git版本库里的文件/目录是干什么的 Git是如何存储文件信息的 当我们执行git add、git commit时,Git背后做了什么 Git分支的本质是什么 HEAD引用 参考 @ 前言 洞悉技术的本质,可以让我们在层出不穷的框架面前仍能泰然处之。用了那么久的 Git,不懂点内部原理,那可不行!懂点原理可以让我们遇到问题的时候能够更好更快的理清解决问题的思路。 博客原文 要真正读懂本文可能需要以下基础: 有 Git 使用经验 对 Git 的三个分区有所了解 熟悉常用的 Linux 命令 对经典哈希算法有一定的了解,比如 SHA-1 、SHA-256、MD5等 在开始之前,让我们先抛出几个问题,然后一一解决、回答它们 .git版本库里的文件/目录是干什么的? Git是如何存储文件信息的? 当我们执行git add、git commit时,Git背后做了什么? Git分支的本质是什么? Git分区 在真正开始之前,让我们先回顾下Git的三个分区(Workspace、Index / Stage、git repository) 工作区(Workspace):此处进行代码文件的编辑 索引或称暂存区(Index / Stage):存储文件状态信息,进行commit前会对此时的文件状态作快照(Snapshot) Git版本库(git repository):由Git

PHP 数据类型

对着背影说爱祢 提交于 2020-02-03 00:35:20
PHP 数据类型 四种标题类型 boolean(布尔型) integer(整型) float(浮点型,也称作 double) string(字符串) 三种复合类型 array(数组) object(对象) callable(可调用) 两种特殊类型 resource(资源) NULL(无类型) 伪类型 mixed(混合类型) number(数字类型) callback(回调类型,又称为 callable) array|object(数组 | 对象类型) void (无类型) 获取变量的类型 gettype — 获取变量的类型 string gettype ( mixed $var ) 检测变量的类型 is_array — 检测变量是否是数组 is_bool — 检测变量是否是布尔型 is_callable — 检测参数是否为合法的可调用结构 is_double — is_float 的别名 is_float — 检测变量是否是浮点型 is_int — 检测变量是否是整数 is_integer — is_int 的别名 is_iterable — Verify that the contents of a variable is an iterable value is_long — is_int 的别名 is_null — 检测变量是否为 NULL is_numeric —