IOS device support

问题

当你升级了macos,xcode自带的iphone支持版本和你iphone不一致时(比如手动升级的beta版本等),这时候xcode是无法正常调试和下载ios app的。

解决办法

增加对应ios的DeviceSupport文件,手动添加到xcode的对应目录:

更多请见:
https://developer.apple.com/download/
https://developer.apple.com/download/more/

起点

一直在等待的那个开点,那是一个既许了无数幻想和冲动的起点,那个演绎了无数次,却始终无法清晰和开始的起点,此刻,伴随着熟悉而奇怪的音乐涌起的冲动,一个声音在告诉我,是的,就是现在,我感受到了起点,竟是是如此普通的时刻。

pads settings

  1. exec path

    \MentorGraphics\PADSVX.2.3\SDD_HOME\common\win32\bin\powerlogic.exe
    \MentorGraphics\PADSVX.2.3\SDD_HOME\common\win32\bin\powerpcb.exe
  2. how to set the "PADS Projects" path

    \MentorGraphics\PADSVX.2.3\SDD_HOME\Programs\powerlogic.ini
    \MentorGraphics\PADSVX.2.3\SDD_HOME\Programs\powerpcb.ini

clang-format 参考配置

贴一份在用的参考配置,欢迎大家讨论

BasedOnStyle: LLVM
BreakBeforeBraces: Linux
Language: Cpp
ColumnLimit: 200
ReflowComments: false
SortIncludes: false

#括号风格
BreakBeforeBraces: Custom
BraceWrapping:
  AfterEnum: false
  AfterStruct: false
  SplitEmptyFunction: false

# 连续声明时,对齐所有声明的变量名
AlignConsecutiveDeclarations:   true
# 针和引用的对齐: Left, Right, Middle
PointerAlignment:   Left
# 在C风格类型转换后添加空格
SpaceAfterCStyleCast:   false
# 在赋值运算符之前添加空格
SpaceBeforeAssignmentOperators: true
# 开圆括号之前添加一个空格: Never, ControlStatements, Always
SpaceBeforeParens:  ControlStatements
# 在空的圆括号中添加空格
SpaceInEmptyParentheses:    false
# 在尾随的评论前添加的空格数(只适用于//)
SpacesBeforeTrailingComments:   2
# 在尖括号的<后和>前添加空格
SpacesInAngles: true
# 宏赋值对齐
AlignConsecutiveMacros: true

xcode安装clang-format

clang-format是很好用的插件,所以我们也想在xcode中继续使用。

install

brew install clang-format

check version:

clang-format --version
clang-format version 9.0.0 (tags/google/stable/2019-05-14)

add automator service

创建automator action
automator
在左侧搜索“运行shell脚本”,并拖入右侧,在脚本本输入:

export PATH=/usr/local/bin:$PATH
clang-format

automator
将服务保存为clang-format(或者任意你喜欢的),后面还有用到这个名字。

setting clang-format

在当前用户的根目录 ~ 放置一个 .clang-format 文件。参考内容如下:

BasedOnStyle: LLVM
BreakBeforeBraces: Linux
Language: Cpp
ColumnLimit: 120
ReflowComments: false
SortIncludes: false

#括号风格
BreakBeforeBraces: Custom
BraceWrapping:
  AfterEnum: false
  AfterStruct: false
  SplitEmptyFunction: false

注意,这个只是参考,你需要按照你实际的风格进行设置。

add keyboard shortcuts

在系统设置页面找到“键盘”,选择“快捷键”的tab,在左侧选择 “app快捷键”,然后选择+号,创建用于xcode的快捷键,选择clang-format服务,然后选择一个你准备用户代码格式化的快捷键组合,比如 ctrl+i。
automator
在xcode中,选择我们的目标代码,然后ctrl+i,就触发clang-format格式化了。

done!

OCSP check failed for /xxx/cert1.pem (are we offline?)

现象

certbot renew时出现类似的错误:
OCSP check failed for /xxx/cert1.pem (are we offline?)

原因

经搜索原因:原因是 ocsp.int-x3.letsencrypt.org 的 cname 域名 a771.dscq.akamai.net 受到了干扰。
可以采用本地修改hosts的方案进行临时处理,在/etc/hosts中添加

23.32.3.72     ocsp.int-x3.letsencrypt.org

验证

# openssl ocsp -no_nonce -issuer /etc/letsencrypt/archive/xxx/chain1.pem -cert /etc/letsencrypt/archive/xxx/cert1.pem -url http://ocsp.int-x3.letsencrypt.org -CAfile /etc/letsencrypt/archive/xxx/chain1.pem -verify_other /etc/letsencrypt/archive/xxx/chain1.pem -trust_other -header Host ocsp.int-x3.letsencrypt.org
Response verify OK
/etc/letsencrypt/archive/www.itranscloud.com/cert1.pem: good
    This Update: May 14 10:00:00 2020 GMT
    Next Update: May 21 10:00:00 2020 GMT

添加后,在重试 certbot renew,ok,正常

ref:https://holmesian.org/letsencrypt-ocsp-fix

This branch has conflicts that must be resolved 解决示例

使用git日常免不了遇到conflicts,那么如何消除conflicts呢,以下的内容以一个具体的过程来讲解整个过程和原理。

以下我们手动创造一个conflicts:
git conflicts

Step 1: From your project repository, check out a new branch and test the changes.

git checkout -b apache-master master
git pull https://github.com/apache/incubator-apisix.git master

Step 2: Merge the changes and update on GitHub.

git checkout master
git merge --no-ff apache-master
git push origin master

以上的的例子, 我们从A合入到B:B <== A。
A: https://github.com/apache/incubator-apisix.git
B: xxxx/incubator-apisix.git

例子中有一个README.md的冲突,并且给出了解决的命令行参考。
我们将逐条命令来解释如何按照提示解决冲突。

  1. 假设我们已经在B的git 根目录下。
  2. git checkout -b apache-master master #建立B的 apache-master分支,并切换到apache-master
  3. git pull https://github.com/apache/incubator-apisix.git master # 将A最新的内容合入apache-master
  4. 因为有冲突,所以上条执行时,会提示冲突:
From https://github.com/apache/incubator-apisix
 * branch            master     -> FETCH_HEAD
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
  1. 解决冲突[ ... resolve any conflicts ... ]:
    手动打开冲突文件,根据提示修改,删除冲突的内容,留下想要的结果内容。
  2. git add [files that were conflicted]
  3. git commit,将冲突修改提交敖本地仓库:
$ git commit -m "resolve the conflict"
[apache-master 6ad2d5e] resolve the conflict
  1. git checkout master # 将B切换为master
  2. git merge --no-ff apache-master #将B仓库的apache-master 合入 master
  3. git push origin master #将B仓库的最终的本地库推到云端master

最终解决了冲突,完成了对B master的更新。

希望以上就解释清楚,谢谢!

how to upgrade certbot from acmev1 to acmev2

original

certbot version:0.9.3
centos version:CentOS Linux release 7.0.1406 (Core)

upgrade the certbot version

#sudo yum update certbot

# certbot --version
certbot 1.3.0

upgrade the acme account

#certbot update_account
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
Starting new HTTPS connection (1): supporters.eff.org

IMPORTANT NOTES:
 - Your e-mail address was updated to [email protected]

check upagrade result

ls /etc/letsencrypt/accounts
acme-staging.api.letsencrypt.org  acme-v01.api.letsencrypt.org  acme-v02.api.letsencrypt.org

you can see the acme-v02 information, it indicate that the upgrade is successful.

done, have fun!

iphone 屏幕尺寸相关

屏幕物理尺寸

4.0寸的iPhone5/5s
4.7寸的iPhone678
5.5寸的iPhone6P7P8P
5.8寸的iPhoneX/XS iPhone11Pro
6.1寸的iPhoneXr iPhone11
6.5寸的iPhone XS Max/iPhone 11 Pro Max

屏幕像素分辨率

ref:https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/#device-screen-sizes-and-orientations

Device Portrait dimensions Landscape dimensions
12.9" iPad Pro 2048px × 2732px 2732px × 2048px
11" iPad Pro 1668px × 2388px 2388px × 1668px
10.5" iPad Pro 1668px × 2224px 2224px × 1668px
9.7" iPad 1536px × 2048px 2048px × 1536px
7.9" iPad mini 4 1536px × 2048px 2048px × 1536px
iPhone XS Max 1242px × 2688px 2688px × 1242px
iPhone XS 1125px × 2436px 2436px × 1125px
iPhone XR 828px × 1792px 1792px × 828px
iPhone X 1125px × 2436px 2436px × 1125px
iPhone 8 Plus 1242px × 2208px 2208px × 1242px
iPhone 8 750px × 1334px 1334px × 750px
iPhone 7 Plus 1242px × 2208px 2208px × 1242px
iPhone 7 750px × 1334px 1334px × 750px
iPhone 6s Plus 1242px × 2208px 2208px × 1242px
iPhone 6s 750px × 1334px 1334px × 750px
iPhone SE 640px × 1136px 1136px × 640px

图片分辨率

ref:https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/

Device Scale Factor
12.9" iPad Pro @2x
11" iPad Pro @2x
10.5" iPad Pro @2x
9.7" iPad @2x
7.9" iPad mini 4 @2x
iPhone XS Max @3x
iPhone XS @3x
iPhone XR @2x
iPhone X @3x
iPhone 8 Plus @3x
iPhone 8 @2x
iPhone 7 Plus @3x
iPhone 7 @2x
iPhone 6s Plus @3x
iPhone 6s @2x
iPhone SE @2x

三者关系图

ref:https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

iad10.2

ref:https://medium.com/@hacknicity/how-ipad-apps-adapt-to-the-new-10-2-ipad-5d050b565fca
On 10th September 2019, Apple announced a 7th generation iPad with a 10.2" screen. There are now five different iPad resolutions (in landscape):
9.7": 1024×768 points (2048×1536 pixels)
10.2": 1080×810 points (2160×1620 pixels)
10.5": 1112×834 points (2224×1668 pixels)
11.0": 1194×834 points (2388×1668 pixels)
12.9": 1366×1024 points (2732×2048 pixels)