hw-1

How do you use posix_spawn to replace the deprecated ‘system’ to launch opendiff in Objective-C?

How do you use posix_spawn to replace the deprecated ‘system’ to launch opendiff in Objective-C?

Using posix_spawn(), to answer your question:

1
2
3
4
5
6
7
8
9
10
11
12
#include <spawn.h>
extern char **environ;
pid_t pid;
char *argv[] = {
"/Applications/Xcode.app/Contents/Developer/usr/bin/opendiff",
"/Users/LukeSkywalker/Documents/doc1.rtf",
"/Users/LukeSkywalker/Documents/doc2.rtf",
NULL
};

posix_spawn(&pid, argv[0], NULL, NULL, argv, environ);
waitpid(pid, NULL, 0);

Or, you could use NSTask:

1
2
3
4
5
6
7
8
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/Applications/Xcode.app/Contents/Developer/usr/bin/opendiff";
task.arguments = [NSArray arrayWithObjects:
@"/Users/LukeSkywalker/Documents/doc1.rtf",
@"/Users/LukeSkywalker/Documents/doc2.rtf",
nil];
[task launch];
[task waitUntilExit];

Code Signing Error: XXX does not support provisioning profiles. XXX does not support provisioning profiles, but provisioning profile NO_SIGNING/ has been manually specified. Set the provisioning profile value to “Automatic” in the build settings editor.

Code Signing Error: XXX does not support provisioning profiles. XXX does not support provisioning profiles, but provisioning profile NO_SIGNING/ has been manually specified. Set the provisioning profile value to “Automatic” in the build settings editor.

add this code bottom of Podfile to solve this issuse

1
2
3
4
5
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = ''
end
end

Xcode快捷键

Mac键盘图标与对应快捷按键

⌘——Command ()

⌃ ——Control

⌥——Option (alt)

⇧——Shift

⇪——Caps Lock

Xcode快捷键

1.运行:command + R

2.编译:command + B

3.停止:command + .

4.工程导航如图从左到右分别对应 command +1~8.

5.快速打开/隐藏实用面板 a.command + 0 (注意是“0”不是“o”)

6,right bar b.command+option+0(zero)

7,bottom bar c.command + shift + Y

8.当前类文件查找 command + F

9.快速跳转到类的特定行command + L

10.快速定位当前类在项目文件中的位置:command + shift + J (本人非常喜欢这个快捷操作)

11.类文件”.h”与“.m”之间切换:control+command+↑/control+command+↓

12.清除工程: Command + Shift + K

13,清除控制台打印信息:command+K

14.当前类 方法/变量查找:Control+6(键入方法/变量名+Enter跳转)

15.光标操作:

control+F: 向右一个字符(forward)

control+B: 向左一个字符(backward)

control+P: 前一行(previous)

control+N: 后一行(next)

control+A: 去行首

control+E: 到行尾(end)

control+T: 调换光标两边的字符(transpose)

control+D: 删除光标右侧字符(delete)

control+K: 删除本行剩余的字符(kill)

16.整体位移代码:

选中的代码 + command+[ :向左位移

选中的代码 + command+]: 向右位移

选中的代码 + command+option+[ :向上位移

选中的代码 + command+option+]:向下位移

Printing colorful text in terminal for osx

Printing colorful text in terminal for osx

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
console.log('\x1b[36m%s\x1b[0m', info);  //cyan
console.log('\x1b[33m%s\x1b[0m: ', path); //yellow

//color table1
Reset = "\x1b[0m"
Bright = "\x1b[1m"
Dim = "\x1b[2m"
Underscore = "\x1b[4m"
Blink = "\x1b[5m"
Reverse = "\x1b[7m"
Hidden = "\x1b[8m"

//fgcolor
FgBlack = "\x1b[30m"
FgRed = "\x1b[31m"
FgGreen = "\x1b[32m"
FgYellow = "\x1b[33m"
FgBlue = "\x1b[34m"
FgMagenta = "\x1b[35m"
FgCyan = "\x1b[36m"
FgWhite = "\x1b[37m"

//bfcolor
BgBlack = "\x1b[40m"
BgRed = "\x1b[41m"
BgGreen = "\x1b[42m"
BgYellow = "\x1b[43m"
BgBlue = "\x1b[44m"
BgMagenta = "\x1b[45m"
BgCyan = "\x1b[46m"
BgWhite = "\x1b[47m"

what is the differences between “BEGIN RSA PRIVATE KEY” and “BEGIN PRIVATE KEY”

See https://polarssl.org/kb/cryptography/asn1-key-structures-in-der-and-pem (search the page for “BEGIN RSA PRIVATE KEY”) (archive link for posterity, just in case).

BEGIN RSA PRIVATE KEY is PKCS#1 and is just an RSA key. It is essentially just the key object from PKCS#8, but without the version or algorithm identifier in front. BEGIN PRIVATE KEY is PKCS#8 and indicates that the key type is included in the key data itself. From the link:

收邮件NO Select Unsafe Login. Please contact kefu解决办法

问题描述:
第三方邮件客户端如心蓝邮件批量管理助手使用IMAP收网易邮件提示:NO Select Unsafe Login. Please contact kefu@188.com for help,同时网页登录邮箱查看会收到一封标题为“网易邮箱提醒:一次被阻止的收信行为”的邮件,大致意思就是告诉你第三方邮件客户端不安全,推荐使用网页出品的客户端。而其它邮件如新浪搜狐QQ邮箱则不会有该问题。

解决办法:
网民的力量是强大的,据说从2014.12.20开始,网易提供了偷偷提供了一个入口设置解决这个问题,链接地址:http://config.mail.163.com/settings/imap/index.jsp?uid=xxxxxx@163.com

首先需要先登录网页邮箱,如果是126则自己替换链接中的163。按页面提示,通过手机短信验证之后,出现如下提示: 您可以继续使用当前客户端收发邮件了,请特别注意个人的电子信息安全哦。感谢您对网易邮箱的支持!就可以正常使用第三方邮件客户端的IMAP功能来收件了