CaveOps: Night-City
#Hello Edgerunners, welcome to the Night-City.

Welcome!

iOS: Socket 编程

最近总被问到 Socket 问题, 好久没写了, 干脆总结一下吧。 一、HTTP 、TCP/IP 与 Socket 网络七层分别为: 物理层 数据链路层 网络层 传输层 会话层 表示层 应用层 其中, 物理层、数据链路层和网络层通常被称作媒体层, 是网络工程师所研究的对象; 传输层、会话层、表示层和应用层则被称作主机层, 是用户所面向和关心的内容。 HTTP 协议对应于应用层, TCP 协议对应于传输层, IP 协议对应于网络层, 三者本质上没有可比性。TCP/IP 主要解决数据如何在网络中传输的问题, 而 HTTP 主要解决如何包装数据的问题。 我们在传输数据时, 可以只使用传输层 ( ...

Xcode: Code Sense

聊天的时候有人问了一个平常大家不太注意的问题, 如图, 左侧小图标: 以前无聊的时候研究过, 趁这个机会总结一下吧, 其实这些小图标苹果称为 Code Sense, 貌似在很早的 Xcode 版本中就已经出现了, 它们位于 /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/Assets.car 中, 解包这个 .car 文件就可以看到相关的图片, 根据名称也可以判断出它们的代表的意义, 下面列举一部分常见的: 红色的图标表示 Macro 也就是宏 # ...

版本控制系统: 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 ...

What's this?

The Night-City version of CaveOps 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.

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

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

热爱苹果、钟情色彩。

随时恭候 垂询