对象定义-原型对象-回调函数
JavaScript类定义类和对象
创建一个对象,给这个对象一个color属性
var obj=new Object();
obj.color="red";
原型对象prototype
function User(){}
User.prototype.nation='usa';
var u1=new User();
var u2=new User();
alert(u1.n...
python的安装,输入输出语法,变量类型的转换
python的环境搭建
python的安装
python的地址官网
在下载列表中选择格式为python-XYZ.msi 的文件
设置环境变量
右击“’我的电脑”,打开属性
打开“高级系统设置”
打开“系统变量”,双击path
然后在path行输入python的安装路径
打开cmd命令行,输入python会有相关显示
pycharm的使用
如何让pycharm支持中文
方法一:...
变量的类型转换—if-while循环语句
类型转换
eval的使用
res='print('hello')'
#eval可以把字符串里的语句执行
eval(res)
float和round保留小数的区别
n=3.1415
#float保留两位小数
f=float('%.2f'%n)
#round保留两位小数,四舍五入法
f_f=round(2,n)
运算符
字符串的赋值方法
a,b,c,d='spam'
#...
python中字符串和数组,字节码的转换
切片工具
切片格式[起始位置:终止位置:切片步数(默认为1)]
s='python'
s1=s[1:2] #切出来的是'y'
s2=s[-2:-1] #负数是从右向左数,第一个数一定要比第二个大
s3=[::2] #切出来是pto,2表示隔一个切
s3=[::-1] #切出来是nohtyp,反向切
格式输出 format
print('i am {0:8s},and i am {1:.2f...
数组去重、模糊查询,二维数组
导入队列
from collections import deque#导入队列
quqe=deque()#转化为队列
quqe.append()#增加元素
quqe.pop()#删除元素
#append()+popleft()形成队列,先进先出
#apppend()+pop()形成栈,先进后出
数组
插入元素
.insert(插入位置,插入元素)
删除元素
.remove()删除...
python中的冒泡选择排序
选择排序(从小往大排)
arr=[5,15,6,9,11,1,12]
i=0
L=len(arr)
while i<L-1:
j=i+1
w=i #w用来输出最小值的位置
while j<L:
if arr[w]>arr[j]:
w=j
j+=1
t=arr[i]
arr[i]=ar...
集合set和字典dict
set:无序不重复的集合,不能用索引查询
set01={1,2,3,4,5}
for i in set01:#遍历集合
print(i)
print(2 in set01)#判断元素在集合内,返回值True
print(max(set01))#集合的最大值
print(min(set01))#集合的最小值
print(len(set01))#集合的长度
列表去重方法:先转化为set
...
浅析Spring中IOC与DI
1. Spring框架的核心Spring框架的核心是IOC(Inverse of Control),即控制反转,这是一种设计思想。在Java开发过程中,将自己设计好的对象交给IOC容器控制,而不是传统的在对象的内部进行控制。 那么控制反转这个词怎么来解释它呢?首先是控制:在传统的JavaSE的程序开发时,都是在对象内部直接通过new关键字来创建实例化对象,因此是程序主动的对对象依赖;而在Spr...
Mysql避免重复插入记录的方法
原文:http://www.cnblogs.com/prayer21/p/6018864.html
mysql在存在主键冲突或者唯一键冲突的情况下,根据插入策略不同,一般有以下三种避免方法。
1、insert ignore
2、replace into
3、insert on duplicate k...
解决spring mvc No mapping found for HTTP request with URI错误的三种方法
控制层没有被spring扫描到,控制层没有实例化,检查自己的控制层是否被spring扫描到,检查以下配置:
<context:component-scan base-package=""/>
web.xml配置文件的<url-pattern>标签配置成<url-pattern>/*</url-pattern>,正确的配置应该是<url-pa...
projecteuler---->problem=28----Number spiral diagonals
Problem 28
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16
projecteuler---->problem=29----Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
22=4, 23=8, 24=16, 25=32
32=9, 33=27, 34=81, 35=243
42=16, 43=64, 44=256, 45=1024
52=25, 53=125, 54=625, 55=312
projecteuler---->problem=30----Digit fifth powers
Problem 30
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
projecteuler---->problem=31----Coin sums 无限背包计算可能存在的次数
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to
周排行