object

前端面试题总结(一)

被刻印的时光 ゝ 提交于 2020-01-10 01:50:03
总结一些,感谢各位大神贴出来的面试题。我就是总结一下。前端的面试题,我那种小菜鸟,也是一次复习的机会吧。最近看了很多移动端开发的东西,过一段时间也要整理一下。还是要多敲代码呀。 1.JavaScript是一门什么样的语言,它有哪些特点?   w3c的答案还是不错的:   JavaScript 是属于网络的脚本语言!   JavaScript 被数百万计的网页用来改进设计、验证表单、检测浏览器、创建cookies,以及更多的应用。   JavaScript 是因特网上最流行的脚本语言。   JavaScript 很容易使用!你一定会喜欢它的 2.JavaScript的数据类型都有什么? 那是很基础:js六大数据类型:number、string、object、Boolean、null、undefined 3.如何判断JavaScript数据类型? 一使用typeof var a="string"; //string var a=1; //number var a=false; //boolean var a; console.log(typeof a); //undfined var a = null; console.log(typeof a); //object var a = document; console.log(typeof a); //object var a = []

TcxDBPivotGrid 初步使用

牧云@^-^@ 提交于 2020-01-10 00:30:04
运行 结果 设计步骤简单说明 把TcxDBPivotGriD拖到窗口,设置DataSource,在TcxDBPivotGriD右击选择Designer,出现如下图 有几个字段就按几次ADD 选择FieldS下的cxDBPivotGrid1FieldX ,在对象 窗口设置好属性,常见的属性有 Area; Caption,FieldName,DataVisibility ;设置好后 单击CLOSE。即可 代码如下 object cxDBPivotGrid1: TcxDBPivotGrid Left = 0 Top = 0 Width = 762 Height = 488 Align = alClient DataSource = DataSource1 Groups = <> TabOrder = 0 ExplicitWidth = 754 ExplicitHeight = 460 object cxDBPivotGrid1Field1: TcxDBPivotGridField Area = faRow AreaIndex = 0 IsCaptionAssigned = True Caption = #35838#31243 DataBinding.FieldName = 'Cname' Visible = True UniqueName = #35838#31243 end

Spring AOP

允我心安 提交于 2020-01-10 00:13:26
Spring整合单元测试 在前面的案例中我么需要自己创建ApplicationContext对象,然后在调用getBean来获取需要测试的Bean Spring提供了一种更加方便的方式来创建测试所需的ApplicationContext,并且可以帮助我们把需要测试的Bean直接注入到测试类中 添加依赖: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>5.2.2.RELEASE</version> </dependency> 测试代码: import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; @RunWith(SpringJUnit4ClassRunner.class)//固定写法 @ContextConfiguration("classpath

Experiment: Object Oriented C? [duplicate]

天大地大妈咪最大 提交于 2020-01-09 23:40:21
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Can you write object oriented code in C? Hi! Just for the fun of it, I've been experimenting these last two days with creating a very simple, very straightforward object environment in pure C. I've been toying around with macros, dynamic linking, type-description structures and the like, and I've arrived at the following: string_o str = new(String, "hello world"); list_o list = new(List); List.pushf(list, str);

JAVA基础-集合-10.HashMap介绍

我只是一个虾纸丫 提交于 2020-01-09 23:29:44
1、 HashMap介绍 HashMap简介 HashMap 是一个散列表,它存储的内容是键值对(key-value)映射。 HashMap 继承于AbstractMap,实现了Map、Cloneable、java.io.Serializable接口。 HashMap 的实现不是同步的,这意味着它不是线程安全的。它的key、value都可以为null。此外,HashMap中的映射不是有序的。 HashMap 的实例有两个参数影响其性能:“ 初始容量 ” 和 “ 加载因子 ”。容量 是哈希表中桶的数量,初始容量 只是哈希表在创建时的容量。加载因子 是哈希表在其容量自动增加之前可以达到多满的一种尺度。当哈希表中的条目数超出了加载因子与当前容量的乘积时,则要对该哈希表进行 rehash 操作(即重建内部数据结构),从而哈希表将具有大约两倍的桶数。 通常, 默认加载因子是 0.75 , 这是在时间和空间成本上寻求一种折衷。加载因子过高虽然减少了空间开销,但同时也增加了查询成本(在大多数 HashMap 类的操作中,包括 get 和 put 操作,都反映了这一点)。在设置初始容量时应该考虑到映射中所需的条目数及其加载因子,以便最大限度地减少 rehash 操作次数。如果初始容量大于最大条目数除以加载因子,则不会发生 rehash 操作。 HashMap的构造函数 HashMap共有

Java多线程8:wait()和notify()/notifyAll()

匆匆过客 提交于 2020-01-09 20:27:20
轮询 线程本身是操作系统中独立的个体,但是线程与线程之间不是独立的个体,因为它们彼此之间要相互通信和协作。 想像一个场景,A线程做int型变量i的累加操作,B线程等待i到了10000就打印出i,怎么处理?一个办法就是,B线程while(i == 10000),这样两个线程之间就有了通信,B线程不断通过轮训来检测i == 10000这个条件。 这样可以实现我们的需求,但是也带来了问题:CPU把资源浪费了B线程的轮询操作上,因为while操作并不释放CPU资源,导致了CPU会一直在这个线程中做判断操作。如果可以把这些轮询的时间释放出来,给别的线程用,就好了。 wait/notify 在Object对象中有三个方法wait()、notify()、notifyAll(),既然是Object中的方法,那每个对象自然都是有的。如果不接触多线程的话,这两个方法是不太常见的。下面看一下前两个方法: 1、wait() wait()的作用是使当前执行代码的线程进行等待,将当前线程置入"预执行队列"中,并且wait()所在的代码处停止执行,直到接到通知或被中断。 在调用wait()之前,线程必须获得该对象的锁,因此只能在同步方法/同步代码块中调用wait()方法 。 2、notify() notify()的作用是,如果有多个线程等待,那么线程规划器随机挑选出一个 wait的线程,对其发出通知notify

[java] java 代理对象

核能气质少年 提交于 2020-01-09 20:23:52
代理模式的作用是:为其他对象提供一种代理以控制对这个对象的访问。在某些情况下,一个客户不想或者不能直接引用另一个对象,而代理对象可以在客户端和目标对象之间起到中介的作用。 代理模式一般涉及到的角色有:   抽象角色:声明真实对象和代理对象的共同接口;   代理角色:代理对象角色内部含有对真实对象的引用,从而可以操作真实对象,同时代理对象提供与真实对象相同的接口以便在任何时刻都能代替真实对象。同时,代理对象可以在执行真实对象操作时,附加其他的操作,相当于对真实对象进行封装。   真实角色:代理角色所代表的真实对象,是我们最终要引用的对象。 //接口 package com.wa.java.book.kernel.proxy; /** * Created by Administrator on 2015/2/11. */ public interface HelloProxy { void say(); String sendStr(String str); } 实现类: package com.wa.java.book.kernel.proxy; /** * Created by Administrator on 2015/2/11. */ public class HelloProxyImpl implements HelloProxy { @Override public

How to convert a Kotlin data class object to map?

耗尽温柔 提交于 2020-01-09 16:53:52
问题 Is there any easy way or any standard library method to convert a Kotlin data class object to a map/dictionary of it's properties by property names? Can reflection be avoided? 回答1: I was using the jackson method, but turns out the performance of this is terrible on Android for first serialization (github issue here). And its dramatically worse for older android versions, (see benchmarks here) But you can do this much faster with Gson. Conversion in both directions shown here: val gson = Gson(

How to convert a Kotlin data class object to map?

為{幸葍}努か 提交于 2020-01-09 16:53:19
问题 Is there any easy way or any standard library method to convert a Kotlin data class object to a map/dictionary of it's properties by property names? Can reflection be avoided? 回答1: I was using the jackson method, but turns out the performance of this is terrible on Android for first serialization (github issue here). And its dramatically worse for older android versions, (see benchmarks here) But you can do this much faster with Gson. Conversion in both directions shown here: val gson = Gson(

Python中__new__与__init__方法的区别详解

夙愿已清 提交于 2020-01-09 14:37:50
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在python2.x中,从object继承得来的类称为新式类(如class A(object))不从object继承得来的类称为经典类(如class A()) 新式类跟经典类的差别主要是以下几点:   1. 新式类对象可以直接通过__class__属性获取自身类型:type   2. 继承搜索的顺序发生了改变,经典类多继承时属性搜索顺序: 先深入继承树左侧,再返回,开始找右侧(即深度优先搜索);新式类多继承属性搜索顺序: 先水平搜索,然后再向上移动 例子: 经典类: 搜索顺序是(D,B,A,C) >>> class A: attr = 1 ... >>> class B(A): pass ... >>> class C(A): attr = 2 ... >>> class D(B,C): pass ... >>> x = D() >>> x.attr 1 新式类继承搜索程序是宽度优先 新式类:搜索顺序是(D,B,C,A) >>> class A(object): attr = 1 ... >>> class B(A): pass ... >>> class C(A): attr = 2 ... >>> class D(B,C): pass ... >>> x = D() >>> x.attr 2   3.