版本控制系统: SVN 与 Git 的一些误区

最近都在找工作,所以博客更新停滞了下来。之前几个 Primer 系列也没有写完。不过暂时先写一些和面试有关的内容吧,因为这几次面试,总被问到 SVN 和 Git 的相关问题,但在其中却也发现一些理解误区,因此也就有了这篇博客。 脱库问题 似乎很多人认为只有 Git 可以脱库,但事实上 SVN 也是可以的,其本身就提供了 svnsync 工具,主要用于镜像 SVN 版本库。 安全问题 对于脱库问题,有人说 SVN 可以通过目录授权阻止对脱库,也有面试官告诉我 Git 不安全,问我对这件事情怎么看待。 事实上,对于这个问题我却更倾向使用 Git,因为实践证明 SVN 的目录授权就是一场灾难,随着版...

Python: 构建包的那些事

一般来说构建一个包是很简单的事情,许多人只把一堆模块都放进一个有 __init__.py 文件的目录里面,但是,随着对包的修改越来越多,糟糕的设计就会变得臃肿、脆弱,甚至带来循环依赖问题。 __init__.py 该做什么 格式良好的 __init__.py 有一个重要作用: 导入子模块。 它应该像这样: # 导入顺序很重要 —— 有些模块依赖于其他模块 from exceptions import MXError, MXEnvError, MXEncodeError,\ MXTimeFmtError, MXMalformedEntryError...

sudo rm -rf /

今天做了一件非常糟糕的事情, 由于一个玩笑导致朋友用 rm 误删了很多重要的文件。 起初是因为印象里 Mint 中 sudo rm -rf / 这个指令不会被执行, 以为 macOS 中也是这样, 但很快就被现实打脸了。 为了防止类似的悲剧再次发生, 我也开始思考怎样避免这种危险的操作 (除了管好我的嘴之外)。 safe-rm 第一种最简单的方法, 安装 safe-rm, 你可以在它的官方网站中下载安装并查看相关的说明文档。 它的使用十分简单, 下载并解包后, 复制 safe-rm 文件到 /usr/bin 路径, 并配置到 $PATH 靠前的位置。 $ cp safe-rm /usr/bin...

StaSh: Shell Like an Expert in Pythonista

StaSh is a serious attempt to implement a Bash-like shell for Pythonista, inspired by shellista and its variants Since its initial release, valuable contributions and advices have been received constantly from the Pythonista community. The two most popular utilities are pip (authored by @briarfox) a...

iOS : 模拟微信红包照片

上一篇博客用 HTML5 + CSS3 实现了一个简单的微信红包照片的效果,那当然少不了街机 iPhone 中的实现。 iOS 实现这个效果常用的有三种方式: CoreImage 绘图 CALayer UIVisualEffectView 其实都比较简单,这里介绍一下第一种。首先创建一个 UIImageView 供展示图片。 UIImageView *imgView = [[UIImageView alloc] initWithFrame:self.view.bounds]; [imgView setContentMode:UIViewContentModeScaleAspec...

HTML5/CSS3: 模拟微信红包照片

前几天微信红包照片着实火了一把,很多人也已经发现可以通过抓包获取到原始图片,而其背后的实现方式也引起了一些朋友的兴趣。 所以今天我们一起实现一个简单的微信红包照片效果。 首先,根据标题你已经知道我们要使用 HTML5 和 CSS3 来实现。那么新建一个 HTML5 文件吧。 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="description" content="Blu...

Using the View Hierarchy and Console for easier debugging

At some point in life, you are gonna work with a codebase that you didn't write from the very beginning. Specially if you are maintaing it, one of the biggest questions often is 'where to start looking in order to fix bug Y?'. Most of the times, there will be a strong relationship with what you see ...
Papers

Objective-C: weakSelf

The correct way to define a weak object is: __typeof__(obj) __weak wobj = obj; Note that having __weak before the type is technically incorrect. However, you can find this in AFNetworking's AFURLConnectionOperation.m codes: __weak __typeof(&*self)weakSelf = self; But the __typeof__((__typeof...

What is System Integrity Protection (aka Rootless) and how to disable it

All Macs with OS X El Capitan installed on them have a new layer of security known as System Integrity Protection, which has been given the nickname Rootless because it closes off a lot of system files to user access to prevent malicious programs and code from causing harmful changes to the core of ...

AppleDoc: Docset Generator

Appledoc 是一个命令行工具,用来生成 .docset 文件。 文档风格默认与苹果保持一致的。 开源 生成 docset 并自动集成到 Xcode 中 没有特殊的注释要求,可以用 /** */ 的格式,也兼容 /*! */ 格式 Installnation 直接使用 brew 即可: brew install appledoc Usage 常用的指令是这样的: appledoc 项目路径 -o 输出路径 -p 项目名 -c 公司名 命令执行完毕后会在给定的输出目录生成 docset-installed.txt 文件,其中标明了文档所在位置,默认集成到 ~/Librar...

CoreData 与 SQLite 线程安全

数据库读取操作一般都是多线程访问的。在对数据进行读取时,我们要保证其当前状态不能被修改,即读取时加锁,否则就会出现数据错误混乱。 iOS中常用的两种数据持久化存储方式: CoreData SQLite 两者都需要设置线程安全,在这里以FMDB来解释对SQLite的线程安全访问。 FMDB 没有线程安全的执行方式 FMDatabase *database = [FMDatabase databaseWithPath:[self getDatabasePath]]; //打开数据库 [database open]; NSString *sql = @"create table ...

What's this?

The Night-City version of Hotodogo inspired by Cyberpunk 2077. Not finished yet.

Pinned Message

The Founder and CEO of Infeca Technology.

Developer, Designer, Blogger.

Big fan of Apple, Love of colour.

Feel free to contact me.

反曲点科技创始人和首席执行官。

开发、设计与写作皆为所长。

热爱苹果、钟情色彩。

随时恭候 垂询

Outer Square Inner Square