Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我
所有文章 外链

Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我

摘抄-把时间当朋友

2017-06-13
把时间当作朋友:运用心智获得解放 (李笑来) - 来自 Kindle 伴侣

把时间当作朋友:运用心智获得解放 (李笑来) 125

越是勤奋的人越输不起,越是输不起的人越勤奋

标注 #103-103 2017年1月24日 星期二 上午7:44:41

我自己也是在写作的过程中才清楚地意识到“管理时间”的说法有多么荒谬。人是没办法管理时间的,时间也不听从任何人的管理,它只会自顾自一如既往地流逝。“

标注 #158-159 2017年1月24日 星期二 上午7:53:57
more >>
  • essay
  • read

展开全文 >>

JavaScriptCore使用

2017-06-01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

//直接执行js代码
- (void)evaluateScript {
//定义一个js并执行函数
JSValue *exeFunction1 = [self.jsContext evaluateScript:@"function hi(){ return 'hi' }; hi()"];
//执行一个闭包js
JSValue *exeFunction2 = [self.jsContext evaluateScript:@"(function(){ return 'hi' })()"];

//更多的应用场景使用网络或者本地文件加载一段js代码,充分利用其灵活性
NSString * path = [[NSBundle mainBundle] pathForResource:@"core" ofType:@"js"];
NSString * html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
JSValue *constructor = [self.jsContext evaluateScript:html];
}

//Native注册方法给js调用
- (void)regiestJSFunction {
//注册一个函数
[self.jsContext evaluateScript:@"var hello = function(){ return 'hello' }"];
//调用
JSValue *value1 = [self.jsContext evaluateScript:@"hello()"];

//注册一个匿名函数
JSValue *jsFunction = [self.jsContext evaluateScript:@" (function(){ return 'hello objc' })"];
//调用
JSValue *value2 = [jsFunction callWithArguments:nil];
}

//注册js方法给Native调用
- (void)regiestNativeFunction {
//注册一个objc方法给js调用
self.jsContext[@"log"] = ^(NSString *msg){
NSLog(@"js:msg:%@",msg);
};
//另一种方式,利用currentArguments获取参数
self.jsContext[@"log"] = ^() {
NSArray *args = [JSContext currentArguments];
for (id obj in args) { NSLog(@"%@",obj); }
};
//使用js调用objc
[self.jsContext evaluateScript:@"native_log('hello,i am js side')"];
}

//注册js错误处理
- (void)jsExceptionHandler {
self.jsContext.exceptionHandler = ^(JSContext *con, JSValue *exception) {
NSLog(@"%@", exception);
con.exception = exception;
};
}

//JSExprot协议使用
- (void)useJSExprot {
Person *p = [[Person alloc]init];
self.jsContext[@"person"] = p;

JSValue *value = [self.jsContext evaluateScript:@"person.whatYouName()"];

}

more >>
  • JavaScriptCore
  • iOS

展开全文 >>

iOS中bundle的使用

2017-06-01

将图片文件夹的后缀改名为:xxx.bundle

VC获得bundle中的资源

1
2
3
NSString * bundlePath = [[ NSBundle mainBundle] pathForResource: @ "MyBundle" ofType :@ "bundle"];
NSBundle *resourceBundle = [NSBundle bundleWithPath:bundlePath];
UIViewController *vc = [[UIViewController alloc] initWithNibName:@"vc_name" bundle:resourceBundle];

UIImageView获得bundle中的资源

1
2
3
UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(50, 50, 50, 50)];
UIImage *image = [UIImage imageNamed:@"MyBundle.bundle/img_collect_success"];
[imgView setImage:image];
  • bundle
  • iOS

展开全文 >>

iOS开发的系统兼容性问题解决

2017-06-01

1:系统方法过时的注解

1
2
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo NS_DEPRECATED_IOS(2_0, 3_0);
# 说明方法在2.0时代引入,3.0时代过时
more >>
  • 兼容性
  • iOS

展开全文 >>

iOS绘图

2017-06-01

Path:路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//指定当前点为 current point,Quartz会跟踪current point一般执行完一个相关函数后,current point都会相应的改变。
CGContextMoveToPoint (
CGContextRef c,
CGFloat x,
CGFloat y
);

Lines:线
//从当前点 画到点,current point 会变化
void CGContextAddLineToPoint (
CGContextRef c,
CGFloat x,
CGFloat y
);
<!-- more -->

//添加多个路径
void CGContextAddLines (
CGContextRef c,
const CGPoint points[],
size_t count
);

Arcs:弧线

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
void CGContextAddArc (
CGContextRef c,
CGFloat x, //圆心的x坐标
CGFloat y, //圆心的y坐标
CGFloat radius, //圆的半径
CGFloat startAngle, //开始弧度
CGFloat endAngle, //结束弧度
int clockwise //0表示顺时针,1表示逆时针
);

void CGContextAddArcToPoint(
CGContextRef c,
CGFloat x1, //端点1的x坐标
CGFloat y1, //端点1的y坐标
CGFloat x2, //端点2的x坐标
CGFloat y2, //端点2的y坐标
CGFloat radius //半径
);

Curves
三次曲线函数
void CGContextAddCurveToPoint (
CGContextRef c,
CGFloat cp1x, //控制点1 x坐标
CGFloat cp1y, //控制点1 y坐标
CGFloat cp2x, //控制点2 x坐标
CGFloat cp2y, //控制点2 y坐标
CGFloat x, //直线的终点 x坐标
CGFloat y //直线的终点 y坐标
);

二次曲线函数
void CGContextAddQuadCurveToPoint (
CGContextRef c,
CGFloat cpx, //控制点 x坐标
CGFloat cpy, //控制点 y坐标
CGFloat x, //直线的终点 x坐标
CGFloat y //直线的终点 y坐标
);

画椭圆,矩形

1
2
3
4
5
6
7
8
9
10
void CGContextAddEllipseInRect (
CGContextRef context,
CGRect rect //一矩形
);

void CGContextAddRect (
CGContextRef c,
CGRect rect
);

Path:路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
CGContextMoveToPoint设置起点
CGContextClosePath 连接起点和当前点
CGPathCreateMutable 类似于 CGContextBeginPath
CGPathMoveToPoint 类似于 CGContextMoveToPoint
CGPathAddLineToPoint 类似于 CGContextAddLineToPoint
CGPathAddCurveToPoint 类似于 CGContextAddCurveToPoint
CGPathAddEllipseInRect 类似于 CGContextAddEllipseInRect
CGPathAddArc 类似于 CGContextAddArc
CGPathAddRect 类似于 CGContextAddRect
CGPathCloseSubpath 类似于 CGContextClosePath
CGContextAddPath函数把一个路径添加到graphics

路径填充和描边:
Stroking :画出路径
Filling :填充路径的封闭区域

路径和填充的效果

//配置样式
//笔触颜色
CGContextSetStrokeColorWithColor(context, [UIColor greenColor].CGColor);
//笔触宽度
CGContextSetLineWidth(context, 20);
//join 拐点样式
// enum CGLineJoin {
// kCGLineJoinMiter, //尖的,斜接
// kCGLineJoinRound, //圆
// kCGLineJoinBevel //斜面
// };
CGContextSetLineJoin(context, kCGLineJoinRound);

//Line cap 线的两端的样式
// enum CGLineCap {
// kCGLineCapButt,
// kCGLineCapRound,
// kCGLineCapSquare
// };
CGContextSetLineCap(context, kCGLineCapSquare);

//虚线线条样式
CGFloat lengths[] = {10,10};
CGContextSetLineDash(context, 0, lengths, 2);



//路径填充

CGContextStrokePath(ctx); //描出路径
CGContextFillPath(ctx) 使用非零绕数规则填充当前路径
CGContextDrawPath 两个参数决定填充规则,kCGPathFill表示用非零绕数规则,kCGPathEOFill表示用奇偶规则,kCGPathFillStroke表示填充,kCGPathEOFillStroke表示描线,不是填充
CGContextEOFillPath 使用奇偶规则填充当前路径
CGContextFillRect 填充指定的矩形
CGContextFillRects 填充指定的一些矩形
CGContextFillEllipseInRect 填充指定矩形中的椭圆

参考

ios绘图基础
http://liuyanwei.jumppo.com/2015/07/25/ios-draw-base.html

ios绘图demo,做一个涂鸦板(上)
http://liuyanwei.jumppo.com/2015/07/26/ios-draw-Graffiti.html

ios绘图demo,做一个涂鸦板(下)
http://liuyanwei.jumppo.com/2015/09/02/ios-draw-Graffiti-2.html

IOS绘制圆,直线,弧线,矩形,扇形,三角形,贝塞尔等图形:
http://blog.csdn.net/chocolateloveme/article/details/17246887

IOS开发UI篇—Quartz2D使用(绘图路径)
http://www.cnblogs.com/wendingding/p/3782679.html

Paths
http://donbe.blog.163.com/blog/static/138048021201052093633776/

IOS 使用Quartz 2D画虚线
http://blog.csdn.net/zhangao0086/article/details/7234859

  • 绘图
  • iOS

展开全文 >>

iOS多线程技术

2017-05-23

1:performSelector 多线程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
*使用performSelector 的多线程
*优点:简单
*缺点:没有串行并线队列,不能实现高级线程调度
*/

-(void)performSelectorFunction{

NSLog(@"performSelectorFunction start");

//同步方式执行
//[self performSelector:@selector(function1)];

//延迟两秒执行,主线程阻塞
//[self performSelector:@selector(function1) withObject:nil afterDelay:2];

//主线程上执行,主线程阻塞,waitUntilDone:YES:等待执行完成顺序执行,waitUntilDone:NO 先执行后面语句
//[self performSelectorOnMainThread:@selector(function1) withObject:nil waitUntilDone:NO];

//子线程上执行
[self performSelectorInBackground:@selector(function1) withObject:nil];

NSLog(@"performSelectorFunction end");
}
more >>
  • 多线程
  • iOS

展开全文 >>

iOS9支持http请求

2017-05-23

##ios9 回退不安全网络模式(支持http协议)

在项目中找到info.plist 源文件形式打开(右击info.plist文件-open as-source code),添加下面内容

1
2
3
4
5
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

linkingge 注:arbitrary 意思是任意的,AllowsArbitraryLoads 意思是允许所有的下载模式;在自己的项目中找到了此项,项目用到的测试API必须支持http协议。

  • HTTP
  • iOS

展开全文 >>

https请求处理方式1:信任一切证书

2017-05-16

处理方法

1:使用异步请求方式

2:证书信任的委托这样处理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
-(BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection{
return true;
}
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{
NSLog(@"didReceiveAuthenticationChallenge %@ %zd", [[challenge protectionSpace] authenticationMethod], (ssize_t) [challenge previousFailureCount]);
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
[[challenge sender] useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge: challenge];
}
}

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace{
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
more >>
  • iOS
  • https
  • cs

展开全文 >>

我换主题了

2017-05-15

为什么换

之前我用的是next主题,也是很火的一款theme,不能说丑,也是一款极简的,使用方便的主题。一般人都有审美疲劳,而我又是一个俗人,故换之。当然,next theme 占网页屏幕的比例,太过剧中,旁边很大地方空白,导致代码片段稍微写长一点都看不全,浪费了,这是一个很实在的原因。

换成啥了

对,就是 yilia, 这是由 litten 设计制作的,感谢作者。

GitHub上简介:
一个简洁优雅的hexo主题 A simple and elegant theme for hexo.

more >>
  • essay
  • cs

展开全文 >>

cookie操作

2017-05-12

获取服务端cookie

1
2
3
4
5
6
7
8
9
10
11
//获取cookie
NSDictionary *headers = [((NSHTTPURLResponse *)resp) allHeaderFields];
NSLog(@"headers:%@",headers);
NSDictionary *cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:[NSURL URLWithString:@"http://localhost/"]];

for (NSHTTPCookie *cookie in cookies) {
NSLog(@"cookie:%@",cookie);
if ([[cookie name] isEqualToString:@"JSESSIONID"]) {
NSLog(@"session id is %@",[cookie value]);
}
}
more >>
  • cookie
  • iOS

展开全文 >>

« Prev1…7891011…13Next »
© 2015-2026 Linking
GitHub:hexo-theme-yilia-plus by Litten
本站总访问量次 | 本站访客数人
  • 所有文章
  • 外链

tag:

  • weather
  • 需求
  • essay
  • basketball
  • olympic
  • nginx
  • APPScan
  • SQl盲注
  • xss
  • Ajax
  • ajax
  • ai
  • agent
  • openclaw
  • ccf
  • Nginx
  • HTML5
  • html5
  • hmtl5
  • sse
  • JavaScriptCore
  • Oracle
  • operation
  • Linux
  • deploy
  • Mac Office
  • markdown
  • ListView
  • GridView
  • MySQL
  • 慢查询
  • mongodb
  • 转置
  • thought
  • network
  • ubuntu
  • NetworkManager
  • RFKill
  • Netplan
  • avatar
  • cocoa
  • blog
  • Gitalk
  • container
  • macvlan
  • docker
  • oracle
  • cookie
  • patch
  • gitea
  • git
  • iOS
  • https
  • 多线程
  • bundle
  • 兼容性
  • HTTP
  • 绘图
  • cs
  • java
  • 效率
  • 快捷键
  • route
  • nodejs
  • pip
  • arcgis
  • arcgis 建模
  • 标识
  • redis
  • read
  • bookList
  • running
  • showdoc
  • disk
  • unit-test
  • D.Wade
  • thoughts
  • duoduo
  • Python
  • python
  • tomcat
  • 读书节
  • session
  • jdk
  • war
  • 加班
  • Android onclick事件监听
  • 正则
  • 手机品牌匹配
  • ntp
  • OpenLayers
  • Geoserver
  • wechat
  • 微信公众号
  • 爬虫
  • WeChat
  • 张靓颖
  • 动漫
  • vpn
  • PPT
  • MarkDown
  • plan
  • 朱赟
  • 极客时间专栏
  • 极客邦
  • 模块化
  • MVC
  • excel
  • NBA
  • kobe
  • team
  • crawler
  • 进度条
  • ssl
  • book
  • anti-stealing-link
  • Agentic Engineering
  • Vibe Coding
  • Software 3.0
  • Andrej Karpathy
  • LLM
  • Programming
  • complain

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • GitHub Trending
  • OpenAI ChatGPT
  • Gitee码云
  • 简书
  • CSDN