自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(49)
  • 资源 (3)
  • 收藏
  • 关注

原创 python类方法

#-*- coding:utf8 -*-from types import MethodTypeclass MyClaxx(object): def __init__(self,name,age): self.name=name self.age=age def getInfo(self): ret

2015-10-29 16:18:54 424

原创 python类

#-*- coding:utf8 -*-from types import MethodType# python类可以多继承# 类中每一个实例方法都有一个self参数,调用时不需要传递该参数# 类中实例变量不需要提前声明,直接使用self就可以调用# 也可以随时为实例变量添加属性,此时添加的只属于该实例,其他实例不会有该属性# 类中的私有方法和属性已双下划线开头,class MyCl

2015-10-29 10:26:10 440

原创 python装饰器

python装饰器语法有点麻烦,参考http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386819879946007bbf6ad052463ab18034f0254bf355000# -*- coding:UTF-8 -*-import functoolsdef l

2015-10-28 15:35:00 395

原创 python匿名函数lambda

# -*- coding:UTF-8 -*-# 匿名函数# 匿名函数是一个lambda表达式,格式: lambda 参数,参数,参数... : 要返回的值print map(lambda x: x * x, [1, 2, 3, 4, 5, 6, 7, 8, 9])# [1, 4, 9, 16, 25, 36, 49, 64, 81]print reduce(lambda x,y:

2015-10-28 09:48:36 2381

原创 python返回函数

# -*- coding:UTF-8 -*-def lazyFun(x): def fun(): return x*x return funff=lazyFun(3)print ff # 下面函数不需要参数print ff()print lazyFun(3)==lazyFun(3)# 打印如下# # 9# Falsed

2015-10-28 09:39:07 528

原创 python批量执行 map reduce

# -*- coding:UTF-8 -*-def f(x): return x*x # map是python提供的函数,可以把列表中的每个元素执行指定操作,并把结果放在列表中返回# map接收的函数只能接收一个参数print map(f, [1,2,3,4,])# [1, 4, 9, 16]def char2num(s): return {'0': 0, '1

2015-10-28 09:07:51 837

原创 python迭代器

# # 迭代器# 使用 [x * x for x in range(size)] 方式创建列表时,内存中一# 下生成了指定大小的空间,若size很大,则会非常耗费内存空间,但如果使用# 迭代器,每次需要时便获取一个,会节省空间,而且会延迟计算 x*xgenerator=( x*x for x in range(5) )print generatorprint generato

2015-10-27 16:28:27 539

原创 python列表生成

# -*- coding:UTF-8 -*-l=[]for ele in range(1,11): l.append(ele*ele)print l# [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]list=[x*x for x in range(1, 11)]print list# [1, 4, 9, 16, 25, 36, 49

2015-10-27 15:36:49 573

原创 python迭代

# -*- coding:UTF-8 -*-from _abcoll import Iterableprint'迭代'dic={ 'a':'apple', 'b':'blue', 'c':'color', 'd':'dog' }print dic #{'a': 'apple', 'c': 'color', 'b':

2015-10-27 15:24:09 414

原创 python函数

# -*- coding:UTF-8 -*-# 函数要先定义后使用def compare(a,b,defaultValue):# 类型检查,第二个参数为类型元组 if not isinstance(a, (int , float)): raise TypeError('type error') if a>b: return

2015-10-27 14:22:20 419

原创 python set

# -*- coding:UTF-8 -*-'''Created on 2015年10月27日@author: young'''myset=set([1,1,2,3,1,2,3])print mysetmyset.add('a')print mysetmyset2=set([1,1,5,6,5,1])print myset2print myset&myset2

2015-10-27 10:03:34 412

原创 python字符串

# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''from __builtin__ import strs='abc123abc'print s.capitalize() #首字母大写print s.count('ab') #统计字符串出现次数print s.isalpha() #是否仅包含0-9

2015-10-27 09:02:40 405

原创 python文件读写

# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''file=open('1.txt','w')file.write('abc') #写入字符串a=[]for i in range(10): s=str(i)+'\n' a.append(s)file.writelines(a)

2015-10-27 09:01:42 450

原创 python数学计算

# -*— coding:utf-8 -*-'''Created on 2015年10月25日@author: young'''from numpy import mathprint math.pi#eclipse不需要手动导包,打出math后直接选择所在包即可print math.sqrt(9)print math.pow(2, 3)print 2**3 #n的 m

2015-10-27 09:00:29 717

原创 python输入

python3.0前后输入有区别# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''year=input("input year")print 1+yeary=raw_input('raw_input year')print int(y)+1print y+1打印input

2015-10-27 08:59:24 517

原创 python列表

# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''list=[1,'abc']list.append(1)list.append(['lmn','xyz'] )list.extend([9,10])print listprint list.count('abc')list.reverse()

2015-10-27 08:57:53 335

原创 python类型转换

# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''print chr(65)print ord('A')print 'num to str '+str(123)print int('1')+1print 'hex 1024='+hex(1024)print 'num to str '+ oct

2015-10-27 08:56:17 498

原创 python字典

# -*- coding:UTF-8 -*-'''Created on 2015年10月25日@author: young'''dic={'a':123,'b':456}dic[789]='c'print dicprint dic.items()for ele in dic: #for循环得到的是键 print ele,'=', dic[ele] p

2015-10-27 08:54:58 436

原创 python基础

python中字符串使用单引号或双引号包裹,当要打印单引号或双引号时需要使用转义字符,即在前面添加/ 例print ' he said: " I \' m tom " . 'print " he said: \" I'm tom \" . "print ' he said :\'I \' m tom \' 'print "he said

2015-10-23 15:18:39 408

原创 python if-else

python采用代码缩进来控制语句块,ide很难像java一样对代码进行格式化。在eclipse中,只能相对于if -else缩进一个tab # -*- coding: utf-8 -*- a= -99# if语句后面有冒号 : if a>0: print 'a>0','a的绝对值是' #字符串拼接,逗号会被替换成一个空格,if语句块只能相对于if缩进一

2015-10-23 14:43:35 1078

原创 python中文字符

只需在开头声明 # -*- coding: utf-8 -*-代码如下 # -*- coding: utf-8 -*-print "hello world"print '100+200=',100+200s1=raw_input('请输入字符\n')s2=raw_input()print s1+s2 输出hello world100+2

2015-10-23 14:26:28 562

原创 mac python eclipse

测试一下

2015-10-23 10:13:58 467

原创 ios下拉刷新

ios下拉刷新//// ViewController.m// tabview//// Created by Young on 15/10/21.// Copyright © 2015年 Young. All rights reserved.//#import "ViewController.h"@interface ViewController ()@prope

2015-10-22 15:10:27 566

原创 UITableView删除添加,移动,分区,索引,自定义UITableViewCell

UITableView //// ViewController.m// tabview//// Created by Young on 15/10/21.// Copyright © 2015年 Young. All rights reserved.//#import "ViewController.h"@interface ViewController ()@pro

2015-10-22 10:33:41 1067

原创 UITableViewCell定制

首先把UITableView拖入storyboard中,并关联ViewController点击新添加的UITableView,修改右侧Prototype Cells, 该值为单元格种类数,左侧 UITableView中会出现对应数量UITableViewCell。然后就可以修改Cell的界面了。为UITableViewCell添加Identifier , 例如分

2015-10-21 16:38:18 454

原创 AFHTTPRequestOperationManager简单使用

初学ios,用到了AFHTTPRequestOperationManager,遇到了好多坑。 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; // manager.securityPolicy = [AFSecurityPolicy policyWi

2015-10-16 17:23:01 3795

原创 ios 安卓 javaweb RSA加密解密

ios版 ,公钥私钥一键加密解密@interface RSA : NSObject// return base64 encoded string+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;// return raw data+ (NSData *)encryptData:(NSD

2015-10-16 17:10:17 2811

原创 NSThread简单实用

#import "ViewController.h"@interface ViewController ()@property (weak, nonatomic) IBOutlet UIImageView *imgView;@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]

2015-10-13 09:29:22 391

原创 ios数据库CoreData

ios中可以使用c语言来操作sqlite数据库,但不是面向对象的,函数命名也很别扭,ios提供了CoreData来操作数据库,CoreData与Hibernate类似,可以通过创建相应的对象来实现数据的增删改查1、为以后工程添加CoreData支持。            首先添加CoreData.framework2、添加实体模型文件   File--New-

2015-10-12 19:51:57 460

原创 ios动画

//////////竖直旋转一圈////////////// [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationDuration:5.0f]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromL

2015-10-12 16:50:06 1084

原创 ios归档

//// main.m// bundle//// Created by Young on 15/10/12.// Copyright (c) 2015年 Young. All rights reserved.//#import @interface MyData : NSObject@property NSString* color;@property doub

2015-10-12 12:46:19 551

原创 NSBundle

ios中去访问应用自身的资源文件可以使用NSBundle。1.把需要访问的资源文件拖到工程中,选择复制2、调用方式 NSBundle* bundle=[NSBundle mainBundle]; NSLog(@"%@",[bundle resourcePath]); NSString* path= [bundle pathForResource

2015-10-12 10:56:48 426

原创 ios数据存储NSString,NSArray,NSDictionary

//获取文件路径,路径名不可随意取,不可以光使用文件名作为路径 NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); NSString*directory=[paths objectAtIndex:0]; NSString

2015-10-10 21:00:12 495

原创 UserDefaults

UserDefaults支持的基本数据类型包含:NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary对于自定义的类,如果直接存储会出现如下错误:Property list invalid for format (property lists cannot contain objects of type

2015-10-10 20:26:09 726

原创 ios 9宫格图片

9宫格图片可以指定缩放区域,任意png图片都可以,通常用来做聊天消息等的背景安卓中可以使用google提供的工具制作 9.png图片,直接把 9.png图片作为背景就可以。ios要通过代码实现关键代码 UIButton* but=[UIButton buttonWithType:UIButtonTypeCustom]; but

2015-10-10 15:04:02 1491

原创 ios字体

UILabel* label=[[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 100)]; [self.view addSubview:label]; label.text=@"hello"; label.font=[UIFont fontWithName:@"Zapfino" size:24];

2015-10-10 14:58:50 403

原创 UITabBarController

1、新建ios工程,并添加几个自定义UIViewController,分别取名为MyViewController1,MyViewController2,MyViewController3,2、AppDelegate中如下初始化#import "AppDelegate.h"#import "MyViewController1.h"#import "MyViewController

2015-10-10 09:11:10 389

原创 UINavigationBar美化

#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; self.title=@"第一个界面"; //统一设置背景 [self.navi

2015-10-09 22:00:50 425

原创 UINavigationController+storyboard

新建ios工程,然后打开Main.storyboard,点击Editor--Embed in--Navigation Controller 2、指定storyboard中ViewController 对应ViewController ,并为其添加按钮,以及点击事件为按钮添加点击事件后的ViewController实现类#import "ViewContr

2015-10-09 20:58:19 651

原创 UINavigationController

UINavigationController可以实现栈的方式管理ViewContoroller1、把SupportingFiles 中 info.plist中的Main storyboard file base name置为空,并新建几个Cocos Touch 文件,继承自ViewContoroller,名字分别为 ViewContoroller2, ViewContoroller3 ,详见下

2015-10-09 19:49:52 486

仿qq表情输入控件

详见博客 http://blog.csdn.net/qingchunweiliang

2014-08-19

AS_SSD_Benchmark

AS_SSD_Benchmark 硬盘测试工具

2013-05-17

终级网络搜索器

终级网络搜索器 所搜资源,迅雷下载

2013-01-31

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除