FFmpeg-iOS环境下编译

FFmpeg-iOS环境下编译

1
2
3
4
tar xzvf yasm-1.3.0.tar.gz   解压
cd yasm-1.3.0 进入目录
./autogen.sh 自动生成
make && make install 编译安装
1
2
3
unzip gas-preprocessor-master.zip                         解压
cd gas-preprocessor-master 进入目录
sudo cp gas-preprocessor.pl /usr/bin/gas-preprocessor.pl 复制
1
2
3
unzip FFmpeg-iOS-build-script-master.zip    解压
cd FFmpeg-iOS-build-script-master 进入目录
./build-ffmpeg.sh 自动下载FFmpeg编译

当前一顿操作后,我发现,其实直接下载进行第三步,然后执行./build-ffmpeg.sh,脚本会执行安装

  • Homebrew
  • yasm
  • gas-preprocessor.pl

NSUrlSession-Study

学习NSUrlSession的使用

我的服务器是搭建在本地的,所以可以看到我访问的都是localhost,数据也是写死的

  • 基本使用
1
2
3
4
5
6
7
8
9
//  下面的代码,放进一个按钮点击事件中执行

NSURLSession *session = [NSURLSession sharedSession];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://localhost/studing/1.php"]];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", string);
}];
[task resume];

打印的内容,就是http请求所返回的所有内容

  • next,感受异步
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//按钮点击
- (void)buttonRequestAction:(UIButton *)sender
{
NSURLSession *session = [NSURLSession sharedSession];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://localhost/studing/1.php"]];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
sleep(3); // 延迟
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", string);
}];
[task resume];

}
// 按钮点击
- (void)otherAction:(UIButton *)sender
{
NSLog(@"并没有阻塞主线程");
}

点击request请求服务器,再点击另一个按钮的时候,并没有阻塞主线程
这就是NSUrlSession的强大之处,next,后面继续

Java Socket中的ObjectOutputStream和ObjectInputStream

Java Socket中的ObjectOutputStream和ObjectInputStream

在写Socket通讯程序时出现的bug
获取socket对象的InputStream和OutputStream封装为
ObjectInputStream和ObjectOutputStream,启动Server和Client发送序列化的对象
会发现Client和Server连上了,但是一直没有传输数据
后来发现问题
如果Server端首先建立的是
ObjectInputStream = new ObjectInputStream(socket.getInputStream());
那么Client绝对不能先建立 ObjectInputStream 后建立ObjectOutputStream
否则程序会一直阻塞…
列出所有情况,只限封装为Object流的情况
其他的三种情况都是可以的
(Server : 1st Output 2nd Input Client :1st Output 2nd Input) <<—-允许
(Server : 1st Output 2nd Input Client :1st Input 2nd Output) <<—-允许
(Server : 1st Input 2nd Output Client :1st Output 2nd Input) <<—-允许
(Server : 1st Input 2nd Output Client :1st Input 2nd Output) <<—-只有这种情况不允许

备注:
使用不带缓冲区的流,直接写就好了,带缓冲区的,先刷一刷flush

view和layer缠绵

view 的 frame bounds center

要先讲解frame,还是得讲解bounds;

当一个view添加到viewcontroller.view时,其实是基于viewcontroller.view的坐标系;

就像viewcontrolelr.view添加到uiwindow,其实是基于uiwindow的坐标系;

view的bounds属性就是添加子view的时候,给子视图参照的坐标系;

该坐标系是由bounds和center计算,frame只是方便描述这两个值而已

Nodejs第十三课

持续集成平台:travis

知识点

课程内容

首先来瞅瞅这个项目: https://github.com/Ricardo-Li/node-practice-3(项目已失效,自己随便写一个叭)
我们是学习噢,不是抄袭别人的噢,好记性不如烂笔头嘛

Swift和OC混编

Swift和OC混编

Swift语言,抱歉,博主会的不多,今天来简单的讲解一下OC与Swift的混编
做得不多,我们只要做到能相互调用就好了
就做世界上最伟大的程序Hello World

Nodejs第十五课

mongdb和mongoose使用简介

安装

mac:

brew update 需要先安装Homebrew.更新
brew install mongdb 安装
sudo mongod -—config /usr/local/etc/mongod.conf 启动

maven的安装及使用

maven的安装及使用

目标

  • 安装
  • 使用maven搞定HelloWorld
  • 一些构建命令

安装

下载地址: http://maven.apache.org/download.cgi

iOS7新特性UIDynamic

iOS-UIDynamic

初试

UIDynamic是iOS7引入的UIKit动力学,目的是将2D物理引擎引入UIKit.
最明显的就是短信界面,拖动的时候有物理效果.
通常的时候我们仅使用CA和UIView的动画即可,除非我们需要引入非常逼真的交互设计的时候才使用
来看看新的基本概念:

  • UIDynamicItem:用来描述一个力学物体的状态,其实就是实现了UIDynamicItem委托的对象,或者抽象为有面积有旋转的质点.
  • UIDynamicBehavior:动力行为的描述,用来指定UIDynamicItem应该如何运动,定义适用的物理规则.一般使用该类的子类对象来对一组UIDynamicItem对象应该遵守的行为规则进行描述.
  • UIDynamicAnimator:动画的播放者,动力行为(UIDynamicBehavior)的容器,添加到容器的行为将发挥作用
  • ReferenceView:等同于力学参考系,当添加力学的UIView是ReferenceView的子view或就是它本身的时候,动力就会发生作用.但如果是它本身,虽然能发挥作用,但这个力学仿真就不逼真了

喵神原文: http://onevcat.com/2013/06/uikit-dynamics-started/ onevcat

无法编译AngulayJS源码

无法编译AngulayJS源码

找到./lib/versions/versions-info.js文件并找到getBuild()函数并修改

1
2
3
4
5
6
7
function getBuild() {
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
if (hash.code === 0) { // just check code answer as in other places
return 'sha.'+hash;
}
return '';
}

安装npm install -g grunt-cli

运行grunt自动编译

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×