iOS开发——笔记篇&关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结
关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结
一:Plist读取
/******************************************************************************/
一:简单plist读取
:定义一个数组用来保存读取出来的plist数据
@property (nonatomic, strong) NSArray *shops;
:使用懒加载的方式加载plist文件,并且放到数组中
// 懒加载
// 1.第一次用到时再去加载
// 2.只会加载一次
- (NSArray *)shops
{
if (_shops == nil) {
// 获得plist文件的全路径
NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];
// 从plist文件中加载一个数组对象
_shops = [NSArray arrayWithContentsOfFile:file];
}
return _shops;
}
:使用数组中的数据
// 设置数据
NSDictionary *shop = self.shops[index];
iconView.image = [UIImage imageNamed:shop[@"icon"]];
nameLabel.text = shop[@"name"];
/******************************************************************************/
二:字典转模型
二:字典转模型
:创建一个model类并且在里面创建对应的模型属性
/** 名字 */
@property (nonatomic, strong) NSString *name;
/** 图标 */
@property (nonatomic, strong) NSString *icon;
:定义一个数组用来保存读取出来的plist数据
@property (nonatomic, strong) NSMutableArray *shops;
:使用懒加载的方式加载plist文件,并且放到模型中
// 懒加载
// 1.第一次用到时再去加载
// 2.只会加载一次
- (NSMutableArray *)shops
{
if (_shops == nil) {
// 创建"模型数组"
_shops = [NSMutableArray array];
// 获得plist文件的全路径
NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];
// 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];
// 将 “字典数组” 转换为 “模型数据”
for (NSDictionary *dict in dictArray) { // 遍历每一个字典
// 将 “字典” 转换为 “模型”
Shop *shop = [[Shop alloc] init];
shop.name = dict[@"name"];
shop.icon = dict[@"icon"];
// 将 “模型” 添加到 “模型数组中”
[_shops addObject:shop];
}
}
return _shops;
}
:使用模型中的数据
// 设置数据
Shop *shop = self.shops[index];
iconView.image = [UIImage imageNamed:shop.icon];
nameLabel.text = shop.name;
/******************************************************************************/
三:字典转模型疯转
二:字典转模型封装
:创建一个model类并且在里面创建对应的模型属性,定义两个模型方法
/** 名字 */
@property (nonatomic, copy) NSString *name;
/** 图标 */
@property (nonatomic, copy) NSString *icon;
/** 通过一个字典来初始化模型对象 */
- (instancetype)initWithDict:(NSDictionary *)dict;
/** 通过一个字典来创建模型对象 */
+ (instancetype)shopWithDict:(NSDictionary *)dict;
:模型方法的实现
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
self.name = dict[@"name"];
self.icon = dict[@"icon"];
}
return self;
}
+ (instancetype)shopWithDict:(NSDictionary *)dict
{
// 这里要用self
return [[self alloc] initWithDict:dict];
}
:定义一个数组用来保存读取出来的plist数据
@property (nonatomic, strong) NSMutableArray *shops;
:使用懒加载的方式加载plist文件,并且放到模型中
// 懒加载
// 1.第一次用到时再去加载
// 2.只会加载一次
- (NSMutableArray *)shops
{
if (_shops == nil) {
// 创建"模型数组"
_shops = [NSMutableArray array];
// 获得plist文件的全路径
NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];
// 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];
// 将 “字典数组” 转换为 “模型数据”
for (NSDictionary *dict in dictArray) { // 遍历每一个字典
// 将 “字典” 转换为 “模型”
XMGShop *shop = [XMGShop shopWithDict:dict];
// 将 “模型” 添加到 “模型数组中”
[_shops addObject:shop];
}
}
return _shops;
}
:使用模型中的数据
// 设置数据
XMGShop *shop = self.shops[index];
iconView.image = [UIImage imageNamed:shop.icon];
nameLabel.text = shop.name;
/******************************************************************************/
四:自定义View
四:自定义View
:创建一个model类并且在里面创建对应的模型属性,定义两个模型方法
/** 名字 */
@property (nonatomic, copy) NSString *name;
/** 图标 */
@property (nonatomic, copy) NSString *icon;
/** 通过一个字典来初始化模型对象 */
- (instancetype)initWithDict:(NSDictionary *)dict;
/** 通过一个字典来创建模型对象 */
+ (instancetype)shopWithDict:(NSDictionary *)dict;
:模型方法的实现
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
self.name = dict[@"name"];
self.icon = dict[@"icon"];
}
return self;
}
+ (instancetype)shopWithDict:(NSDictionary *)dict
{
// 这里要用self
return [[self alloc] initWithDict:dict];
}
:自定义一个View,引入模型类,并且创建模型类的属性
@class XMGShop;
/** 商品模型 */
@property (nonatomic, strong) XMGShop *shop;
:实现文件中,定义相应的控件属性
/** 图片 */
@property (nonatomic, weak) UIImageView *iconView;
/** 名字 */
@property (nonatomic, weak) UILabel *nameLabel;
:实现自定义View的相应方法
- (instancetype)init
{
if (self = [super init]) {
// 添加一个图片
UIImageView *iconView = [[UIImageView alloc] init];
[self addSubview:iconView];
self.iconView = iconView;
// 添加一个文字
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:nameLabel];
self.nameLabel = nameLabel;
}
return self;
}
/**
* 这个方法专门用来布局子控件,设置子控件的frame
*/
- (void)layoutSubviews
{
// 一定要调用super方法
[super layoutSubviews];
CGFloat shopW = self.frame.size.width;
CGFloat shopH = self.frame.size.height;
self.iconView.frame = CGRectMake(, , shopW, shopW);
self.nameLabel.frame = CGRectMake(, shopW, shopW, shopH - shopW);
}
-(void)setShop:(XMGShop *)shop
{
_shop = shop;
self.iconView.image = [UIImage imageNamed:shop.icon];
self.nameLabel.text = shop.name;
}
:定义一个数组用来保存读取出来的plist数据
@property (nonatomic, strong) NSMutableArray *shops;
:使用懒加载的方式加载plist文件,并且放到模型中
// 懒加载
// 1.第一次用到时再去加载
// 2.只会加载一次
- (NSMutableArray *)shops
{
if (_shops == nil) {
// 创建"模型数组"
_shops = [NSMutableArray array];
// 获得plist文件的全路径
NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];
// 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];
// 将 “字典数组” 转换为 “模型数据”
for (NSDictionary *dict in dictArray) { // 遍历每一个字典
// 将 “字典” 转换为 “模型”
XMGShop *shop = [XMGShop shopWithDict:dict];
// 将 “模型” 添加到 “模型数组中”
[_shops addObject:shop];
}
}
return _shops;
}
:使用View
// 创建一个商品父控件
XMGShopView *shopView = [[XMGShopView alloc] init];
shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
// 将商品父控件添加到shopsView中
[self.shopsView addSubview:shopView];
/**
NSDictionary *dict = nil; // 从其他地方加载的字典
XMGShop *shop = [XMGShop shopWithDict:dict];
XMGShopView *shopView = [[XMGShopView alloc] init];
shopView.shop = shop;
shopView.frame = CGRectMake(0, 0, 70, 100);
[self.view addSubview:shopView];
// 扩展性差
// 扩展好的体现:即使改变了需求。我们也不需要动大刀子
*/
/******************************************************************************/
五:initWithFrame
五:initWithFrame
:在上一步的基础上只要修改init方法为
/** init方法内部会自动调用initWithFrame:方法 */
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
// 添加一个图片
UIImageView *iconView = [[UIImageView alloc] init];
[self addSubview:iconView];
self.iconView = iconView;
// 添加一个文字
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:nameLabel];
self.nameLabel = nameLabel;
}
return self;
}
:最后设置数据的时候也可以使用下面的方法实现View的创建
XMGShopView *shopView = [[XMGShopView alloc] initWithFrame:CGRectMake(shopX, shopY, shopW, shopH)];
/******************************************************************************/
六:MVC
六:MVC
:model
@interface XMGShop : NSObject
/** 名字 */
@property (nonatomic, copy) NSString *name;
/** 图标 */
@property (nonatomic, copy) NSString *icon;
/** 通过一个字典来初始化模型对象 */
- (instancetype)initWithDict:(NSDictionary *)dict;
/** 通过一个字典来创建模型对象 */
+ (instancetype)shopWithDict:(NSDictionary *)dict;
@end
@implementation XMGShop
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
self.name = dict[@"name"];
self.icon = dict[@"icon"];
}
return self;
}
+ (instancetype)shopWithDict:(NSDictionary *)dict
{
// 这里要用self
return [[self alloc] initWithDict:dict];
}
@end
:view
@class XMGShop;
@interface XMGShopView : UIView
/** 商品模型 */
@property (nonatomic, strong) XMGShop *shop;
- (instancetype)initWithShop:(XMGShop *)shop;
+ (instancetype)shopViewWithShop:(XMGShop *)shop;
+ (instancetype)shopView;
@end
@interface XMGShopView()
/** 图片 */
@property (nonatomic, weak) UIImageView *iconView;
/** 名字 */
@property (nonatomic, weak) UILabel *nameLabel;
@end
@implementation XMGShopView
- (instancetype)initWithShop:(XMGShop *)shop
{
if (self = [super init]) {
self.shop = shop;
}
return self;
}
+ (instancetype)shopViewWithShop:(XMGShop *)shop
{
return [[self alloc] initWithShop:shop];
}
+ (instancetype)shopView
{
return [[self alloc] init];
}
/** init方法内部会自动调用initWithFrame:方法 */
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
// 添加一个图片
UIImageView *iconView = [[UIImageView alloc] init];
[self addSubview:iconView];
self.iconView = iconView;
// 添加一个文字
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:nameLabel];
self.nameLabel = nameLabel;
}
return self;
}
/**
* 当前控件的frame发生改变的时候就会调用
* 这个方法专门用来布局子控件,设置子控件的frame
*/
- (void)layoutSubviews
{
// 一定要调用super方法
[super layoutSubviews];
CGFloat shopW = self.frame.size.width;
CGFloat shopH = self.frame.size.height;
self.iconView.frame = CGRectMake(, , shopW, shopW);
self.nameLabel.frame = CGRectMake(, shopW, shopW, shopH - shopW);
}
- (void)setShop:(XMGShop *)shop
{
_shop = shop;
self.iconView.image = [UIImage imageNamed:shop.icon];
self.nameLabel.text = shop.name;
}
@end
controller
@property (nonatomic, strong) NSMutableArray *shops;
// 懒加载
// 1.第一次用到时再去加载
// 2.只会加载一次
- (NSMutableArray *)shops
{
if (_shops == nil) {
// 创建"模型数组"
_shops = [NSMutableArray array];
// 获得plist文件的全路径
NSString *file = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil];
// 从plist文件中加载一个数组对象(这个数组中存放的都是NSDictionary对象)
NSArray *dictArray = [NSArray arrayWithContentsOfFile:file];
// 将 “字典数组” 转换为 “模型数据”
for (NSDictionary *dict in dictArray) { // 遍历每一个字典
// 将 “字典” 转换为 “模型”
XMGShop *shop = [XMGShop shopWithDict:dict];
// 将 “模型” 添加到 “模型数组中”
[_shops addObject:shop];
}
}
return _shops;
}
// 创建一个商品父控件
XMGShopView *shopView = [XMGShopView shopViewWithShop:self.shops[index]];
// 设置frame
shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
// 将商品父控件添加到shopsView中
[self.shopsView addSubview:shopView];
/******************************************************************************/
七:Xib的使用
七:XIB
:xibView中
/** 商品模型 */
@property (nonatomic, strong) XMGShop *shop;
+ (instancetype)shopViewWithShop:(XMGShop *)shop;
+ (instancetype)shopViewWithShop:(XMGShop *)shop
{
// self == XMGShopView
// NSStringFromClass(self) == @"XMGShopView"
XMGShopView *shopView = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
shopView.shop = shop;
return shopView;
}
- (void)setShop:(XMGShop *)shop
{
_shop = shop;
UIImageView *iconView = (UIImageView *)[self viewWithTag:];
iconView.image = [UIImage imageNamed:shop.icon];
UILabel *nameLabel = (UILabel *)[self viewWithTag:];
nameLabel.text = shop.name;
}
:控制器中设置数据
// 从xib中加载一个商品控件
XMGShopView *shopView = [XMGShopView shopViewWithShop:self.shops[index]];
// 设置frame
shopView.frame = CGRectMake(shopX, shopY, shopW, shopH);
// 添加商品控件
[self.shopsView addSubview:shopView];
八:牛逼框架MJExtension使用
/******************************************************************************/
八:MJExtension
:是一套“字典和模型之间互相转换”的轻量级框架,模型属性
/**
* 微博文本内容
*/
@property (copy, nonatomic) NSString *text;
/**
* 微博作者
*/
@property (strong, nonatomic) User *user;
/**
* 转发的微博
*/
@property (strong, nonatomic) Status *retweetedStatus;
/**
* 存放着某一页微博数据(里面都是Status模型)
*/
@property (strong, nonatomic) NSMutableArray *statuses;
/**
* 总数
*/
@property (assign, nonatomic) NSNumber *totalNumber;
/**
* 上一页的游标
*/
@property (assign, nonatomic) long long previousCursor;
/**
* 下一页的游标
*/
@property (assign, nonatomic) long long nextCursor;
/**
* 名称
*/
@property (copy, nonatomic) NSString *name;
/**
* 头像
*/
@property (copy, nonatomic) NSString *icon;
:对应方法的实现
/**
MJ友情提醒:
1.MJExtension是一套“字典和模型之间互相转换”的轻量级框架
2.MJExtension能完成的功能
* 字典 --> 模型
* 模型 --> 字典
* 字典数组 --> 模型数组
* 模型数组 --> 字典数组
3.具体用法主要参考 main.m中各个函数 以及 "NSObject+MJKeyValue.h"
4.希望各位大神能用得爽
*/
#import <Foundation/Foundation.h>
#import "MJExtension.h"
#import "User.h"
#import "Status.h"
#import "StatusResult.h"
/**
* 简单的字典 -> 模型
*/
void keyValues2object()
{
// 1.定义一个字典
NSDictionary *dict = @{
@"name" : @"Jack",
@"icon" : @"lufy.png",
};
// 2.将字典转为User模型
User *user = [User objectWithKeyValues:dict];
// 3.打印User模型的属性
NSLog(@"name=%@, icon=%@", user.name, user.icon);
}
/**
* 复杂的字典 -> 模型 (模型里面包含了模型)
*/
void keyValues2object2()
{
// 1.定义一个字典
NSDictionary *dict = @{
@"text" : @"是啊,今天天气确实不错!",
@"user" : @{
@"name" : @"Jack",
@"icon" : @"lufy.png"
},
@"retweetedStatus" : @{
@"text" : @"今天天气真不错!",
@"user" : @{
@"name" : @"Rose",
@"icon" : @"nami.png"
}
}
};
// 2.将字典转为Status模型
Status *status = [Status objectWithKeyValues:dict];
// 3.打印status的属性
NSString *text = status.text;
NSString *name = status.user.name;
NSString *icon = status.user.icon;
NSLog(@"text=%@, name=%@, icon=%@", text, name, icon);
// 4.打印status.retweetedStatus的属性
NSString *text2 = status.retweetedStatus.text;
NSString *name2 = status.retweetedStatus.user.name;
NSString *icon2 = status.retweetedStatus.user.icon;
NSLog(@"text2=%@, name2=%@, icon2=%@", text2, name2, icon2);
}
/**
* 复杂的字典 -> 模型 (模型的数组属性里面又装着模型)
*/
void keyValues2object3()
{
// 1.定义一个字典
NSDictionary *dict = @{
@"statuses" : @[
@{
@"text" : @"今天天气真不错!",
@"user" : @{
@"name" : @"Rose",
@"icon" : @"nami.png"
}
},
@{
@"text" : @"明天去旅游了",
@"user" : @{
@"name" : @"Jack",
@"icon" : @"lufy.png"
}
},
@{
@"text" : @"嘿嘿,这东西不错哦!",
@"user" : @{
@"name" : @"Jim",
@"icon" : @"zero.png"
}
}
],
",
",
"
};
// 2.将字典转为StatusResult模型
StatusResult *result = [StatusResult objectWithKeyValues:dict];
// 3.打印StatusResult模型的简单属性
NSLog(@"totalNumber=%d, previousCursor=%lld, nextCursor=%lld", result.totalNumber, result.previousCursor, result.nextCursor);
// 4.打印statuses数组中的模型属性
for (Status *status in result.statuses) {
NSString *text = status.text;
NSString *name = status.user.name;
NSString *icon = status.user.icon;
NSLog(@"text=%@, name=%@, icon=%@", text, name, icon);
}
}
/**
* 字典数组 -> 模型数组
*/
void keyValuesArray2objectArray()
{
// 1.定义一个字典数组
NSArray *dictArray = @[
@{
@"name" : @"Jack",
@"icon" : @"lufy.png",
},
@{
@"name" : @"Rose",
@"icon" : @"nami.png",
},
@{
@"name" : @"Jim",
@"icon" : @"zero.png",
}
];
// 2.将字典数组转为User模型数组
NSArray *userArray = [User objectArrayWithKeyValuesArray:dictArray];
// 3.打印userArray数组中的User模型属性
for (User *user in userArray) {
NSLog(@"name=%@, icon=%@", user.name, user.icon);
}
}
/**
* 模型 -> 字典
*/
void object2keyValues()
{
// 1.新建模型
User *user = [[User alloc] init];
user.name = @"Jack";
user.icon = @"lufy.png";
Status *status = [[Status alloc] init];
status.user = user;
status.text = @"今天的心情不错!";
// 2.将模型转为字典
// NSDictionary *dict = [status keyValues];
NSDictionary *dict = status.keyValues;
NSLog(@"%@", dict);
}
/**
* 模型数组 -> 字典数组
*/
void objectArray2keyValuesArray()
{
// 1.新建模型数组
User *user1 = [[User alloc] init];
user1.name = @"Jack";
user1.icon = @"lufy.png";
User *user2 = [[User alloc] init];
user2.name = @"Rose";
user2.icon = @"nami.png";
User *user3 = [[User alloc] init];
user3.name = @"Jim";
user3.icon = @"zero.png";
NSArray *userArray = @[user1, user2, user3];
// 2.将模型数组转为字典数组
NSArray *dictArray = [User keyValuesArrayWithObjectArray:userArray];
NSLog(@"%@", dictArray);
}
int main(int argc, const char * argv[])
{
@autoreleasepool {
// 简单的字典 -> 模型
keyValues2object();
// 复杂的字典 -> 模型 (模型里面包含了模型)
keyValues2object2();
// 复杂的字典 -> 模型 (模型的数组属性里面又装着模型)
keyValues2object3();
// 字典数组 -> 模型数组
keyValuesArray2objectArray();
// 模型转字典
object2keyValues();
// 模型数组 -> 字典数组
objectArray2keyValuesArray();
}
;
}
iOS开发——笔记篇&关于字典plist读取/字典转模型/自定义View/MVC/Xib的使用/MJExtension使用总结的更多相关文章
- ios开发——笔记篇
:开关 BOOL isopen = !isopen; //View @property (nonatomic, assign) BOOL open;//模型属性 self.group.open = ! ...
- iOS开发UI篇—字典转模型
iOS开发UI篇—字典转模型 一.能完成功能的“问题代码” 1.从plist中加载的数据 2.实现的代码 // // LFViewController.m // 03-应用管理 // // Creat ...
- iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist)
iOS开发UI篇—ios应用数据存储方式(XML属性列表-plist) 一.ios应用常用的数据存储方式 1.plist(XML属性列表归档) 2.偏好设置 3.NSKeydeArchiver归档(存 ...
- IOS开发笔记(4)数据离线缓存与读取
IOS开发笔记(4)数据离线缓存与读取 分类: IOS学习2012-12-06 16:30 7082人阅读 评论(0) 收藏 举报 iosiOSIOS 方法一:一般将服务器第一次返回的数据保存在沙盒里 ...
- iOS开发UI篇—简单的浏览器查看程序
iOS开发UI篇—简单的浏览器查看程序 一.程序实现要求 1.要求 2. 界面分析 (1) 需要读取或修改属性的控件需要设置属性 序号标签 图片 图片描述 左边按钮 右边按钮 (2) 需要监听响应事件 ...
- iOS开发UI篇—从代码的逐步优化看MVC
iOS开发UI篇—从代码的逐步优化看MVC 一.要求 要求完成下面一个小的应用程序. 二.一步步对代码进行优化 注意:在开发过程中,优化的过程是一步一步进行的.(如果一个人要吃五个包子才能吃饱,那么他 ...
- iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序
iOS开发UI篇—使用嵌套模型完成的一个简单汽车图标展示程序 一.plist文件和项目结构图 说明:这是一个嵌套模型的示例 二.代码示例: YYcarsgroup.h文件代码: // // YYcar ...
- iOS开发数据库篇—SQLite简单介绍
iOS开发数据库篇—SQLite简单介绍 一.离线缓存 在项目开发中,通常都需要对数据进行离线缓存的处理,如新闻数据的离线缓存等. 说明:离线缓存一般都是把数据保存到项目的沙盒中.有以下几种方式 (1 ...
- iOS开发UI篇—xib的简单使用
iOS开发UI篇—xib的简单使用 一.简单介绍 xib和storyboard的比较,一个轻量级一个重量级. 共同点: 都用来描述软件界面 都用Interface Builder工具来编辑 不同点: ...
随机推荐
- hdu 4057(ac自动机+状态压缩dp)
题意:容易理解... 分析:题目中给的模式串的个数最多为10个,于是想到用状态压缩dp来做,它的状态范围为1-2^9,所以最大为2^10-1,那我们可以用:dp[i][j][k]表示长度为i,在tri ...
- 《Python 学习手册4th》 第十八章 参数
''' 时间: 9月5日 - 9月30日 要求: 1. 书本内容总结归纳,整理在博客园笔记上传 2. 完成所有课后习题 注:“#” 后加的是备注内容 (每天看42页内容,可以保证月底看完此书) “重点 ...
- linux常用命令之--用户与用户组管理命令
linux的用户与用户组管理命令 1.用户和群组 groupadd:用于添加新的组群 其命令格式如下: groupadd [-option] 群组名 常用参数: -g GID:指定创建群组的GID(G ...
- oracleasm方式创建ASM
1.准备oracleasm包 [root@localhost oracle]# uname -r 2.6.18-164.el5 [oracle@localhost ~]$ ls -l total 26 ...
- reverse the string word by word
题目:Given an input string, reverse the string word by word. For example,Given s = "the sky is bl ...
- 读《编写高质量代码-Web前端开发修炼之道》笔记
第一章 1.Web标准由一系列标准组合而成,核心理念是将网页的结构,样式和行为分离,所以分为三大部分:结构标准,样式标准和行为标准.结构标准包括XML标准,XHTML标准,HTML标准:样式标准指CS ...
- vim对erlang语法支持
发现vim写erlang代码语法缩进都不对,后来发现vim是7.0的,vim7.3开始才对erlang这块进行了支持,所以升级vim git上下载源码包,然后一系列配置安装 http://www.2c ...
- MLE MAP EM
1.最大似然估计 (MLE): 什么是最大似然估计? 问题:给定一组观察数据还有一个参数待定的模型,如何来估计这个未知参数呢? 观察数据(x1,y1)......(xn,yn) 待定模型 ...
- linux vim用法总结
1.跳转到指定行 编辑模式下:输入 ngg或nG(n代表行数) 命令模式下:输入 :n(n代表行数) 2.查找命令 命令模式下输入 / 后面加上查找的内容 例如 :/name (查找 ...
- 自动化运维工具ansible-如何设置客户端多python版本问题
问题:在使用ansible进行管理客户主机时,发现客户主机安装了多个版本的python,并且默认版本为3.0 shell>>cat list 192.168.2.9 shell>&g ...