- 博客(24)
- 资源 (1)
- 收藏
- 关注
原创 Redis 的 String 操作
Redis 的 String 操作set(key, value): 给数据库中名称为 key 的 string 赋值 valueget(key): 返回数据库中名称为 key 的 string 的 value 值getset(key, value): 给名称为 key 的 string 赋值上一次的 valuemget(key1, key2,…, keyN): 返回库中多个 string...
2019-12-30 19:33:09
231
原创 Golang redis 学习指南
安装使用的是 https://github.com/go-redis/r… 这个 golang 客户端, 因此安装方式如下:go get gopkg.in/redis.v4在代码中导入此包即可:import "gopkg.in/redis.v4"基本操作创建客户端通过 redis.NewClient 函数即可创建一个 redis 客户端,方法接收一个 redis.Options...
2019-12-30 19:15:48
184
1
原创 swift排序算法和数据结构
var arrayNumber: [Int] = [2,4, 6, 7, 3, 8, 1]//冒泡排序func maopao(var array: [Int]) -> [Int] { for var i = 0;i count;i++ { for var j = i;j count;j++ { if
2015-07-02 09:03:13
821
原创 绘制图形-移动,旋转,阴影,渐变
// Only override drawRect: if you perform custom drawing.// An empty implementation adversely affects performance during animation.- (void)drawRect:(CGRect)rect { UIBezierPath *path = [UI
2015-07-01 20:21:14
726
原创 自定义委托实现各种算法
func algorithm(num1:Double, num2: Double, sign: Character ) ->Double { var number:Double switch sign { case "+": number = num1 + num2 case "-": numb
2015-07-01 19:49:50
896
原创 一个方法实现加减乘除
func numberArray(num1:Double, num2: Double) -> (Double,Double, Double, Double) { var add = 0.0, subtract = 0.0, multiply =0.0, divide = 0.0 add = num1 + num2
2015-07-01 19:07:31
1023
原创 Swift继承
//声明一个基类class vehicle { var maxPassenger :Int = 0 var manufacturer :String! func description() ->String { return"max passenger is \(maxPassenger) and m
2015-07-01 15:40:29
520
原创 Option可选值可选值(二)
//: Playground - noun: a place where people can playimport Cocoavar str1 ="供选链接和强制拆包的不同。"class Person { var residence: Residence?//供选连接}class Residence { var ro
2015-07-01 15:38:38
903
原创 Option可选值(一)
//: Playground - noun: a place where people can playimport Cocoaclass Person { var residence: Residence?//供选连接}class Residence { var rooms = [Room]() var number
2015-07-01 15:37:21
550
原创 swfit各种Function表现形式
//: Playground - noun: a place where people can playimport UIKit//多返回值函数func countss(string:String) -> (vowels:Int,consonants: Int,others: Int) { var vowels = 0, consonants
2015-07-01 15:34:19
579
原创 dictionary字典
//: Playground - noun: a place where people can playimport UIKitvar str ="字典"//声明一个字典var dic:DictionaryString,String> = ["1001":"1","1002":"2","1003":"3"]var num =dic
2015-07-01 15:31:21
458
原创 枚举和结构
//: Playground - noun: a place where people can playimport UIKit//使用 enum 来创建枚举。如同类和其他命名类型,枚举也可以有方法enum Rank:Int { case Ace = 1 case Two, Three, Four, Five, Six,
2015-07-01 15:27:02
578
原创 swift流程控制
//: Playground - noun: a place where people can playimport UIKit//使用 if 和 switch 作为条件控制。使用 for-in、 for 、 while 、 do-while 作为循环。小括号不是必须的,但主 体的大括号是必需的。let individualS
2015-07-01 15:21:40
384
原创 swift简单的赋值
//: Playground - noun: a place where people can playimport UIKitvar str ="Hello, playground"var myVar =45myVar = 90let myCon =90let implictInteger =70
2015-07-01 15:18:13
799
原创 函数和闭包
//: Playground - noun: a place where people can playimport UIKit//使用 func 声明一个函数。调用函数使用他的名字加上小括号中的参数列表。使用 -> 分隔参数的名字和返回值类型。func greet(name:String, day: String) ->String {
2015-07-01 15:15:28
438
原创 函数类型
//: Playground - noun: a place where people can playimport UIKit//每一个函数都有特定的函数类型,可以充当参数类型和函数的返回类型。func addTwoInts(a:Int, b: Int) -> Int { return a + b}func multiplyTw
2015-07-01 15:08:20
402
原创 反初始化函数
//: Playground - noun: a place where people can playimport UIKit//这里是一个反初始化函数操作的例子。struct Bank { static var coinsInBank = 10_000 static func vendCoins(var numberOfCoinsToVend
2015-07-01 14:33:44
975
原创 对数组进行各种操作
//: Playground - noun: a place where people can playimport UIKit//声明、定义数组var numbers = [1,1, 2, 3, 5, 8]var strings = ["ios","android", "java"]//数组长度numbers.cou
2015-07-01 14:25:55
569
原创 闭包
//: Playground - noun: a place where people can playimport UIKit//Closures/*在 函数 章节中介绍的全局和嵌套函数实际上也是特殊的闭包,闭包采取如下三种形式之一: .全局函数是一个有名字但不会捕获任何值的闭包 .嵌套函数是一个有名字并可以捕获其封闭函数域内值的闭包
2015-07-01 14:23:21
413
原创 接口和扩展
//: Playground - noun: a place where people can playimport UIKit//使用 protocol 来声明一个接口。protocol ExampleProtocol { var simpleDescription:String { get } mutating f
2015-07-01 14:18:11
430
原创 位运算
1.按位与 &(9 & 5)= 1 只有对应的两个二进位均为1时,结果才为1,否则为0.10010101—————00012.按位或 |(9 & 5)= 13 只要对应的两个二进位有一个为1时,结果位就为1,否则为0.10010101—————11013.按位异或 ^(9 ^ 5)=12 当对应的二进位相异(不相同)时,结果为1,否则为0.1
2015-07-01 14:12:30
452
原创 iOS绘图
一、UIKit.使用 UIKit 和 Core Graphics 绘图1.CoreGraps 中得基础类型是 CGContext。2.上下文是所有绘图调用的绘制目的地。.使用 UIKit 的 UIGraphicsGetCurrentContext 函数可以获得一个图形上下文引用。然后,使用上下文进行绘制二、Core Graphics.Core Graphics 提供了大
2015-07-01 14:06:30
364
原创 进制转换
二进制:二进制以(0b)开头,如(0b10为2)八进制:八进制以(0)开头,如(010为8)十六进制:十六进制(0x或0X),如(0xA为11)————————————————————————————1.二进制转十进制0b1100 = 0 * 2的0次方 + 0 * 2的1次方 + 1 * 2的2次方 + 1 * 2的3次方 = 0 + 0
2015-07-01 13:55:27
810
原创 类和对象
//使用 class可以创建一个类。一个属性的声明则是在类里作为常量或变量声明的,除了是在类的上下文中。方法和函数也是这么写的。class Shape { var numberOfSides =0 let area = 40 func simpleDescription() ->String { re
2015-06-30 15:22:17
306
UnitySocketProtobuf3Demo-master.zip
2019-12-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人