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

Welcome!

__block directive, a simple explanation

Nowadays, if you pass a variable inside a block and try to assign a new value to it, you will encounter the error Variable is not assignable (missing __block type specifier). This is a definitive improvement from the previous behavior where your variables simply remained unmodified. Now consider the...

Python : tree

用 Python 实现一个 tree 指令的模拟,后面有时间再做优化: import os def main(): while True: path = input('Input a path: ') + '' if os.path.exists(path): # 去掉末尾分隔符 if path.endswith(os.sep): path = path[:-1] fileCount = 0 d...

Python : Calculator

用 Python 实现一个 GUI 计算器的基本思路,后面有时间会添加更高级的计算功能: from __future__ import division import ui shows_result = False def button_tapped(sender): t = sender.title global shows_result label = sender.superview['label1'] label2 = sender.superview['label2'] if t in '01234567...

iOS: XCTest

XCode自带的单元测试工具已经从OCUnit演变到了XCTest,但其本质还是差不多的,其好处在于XCode集成,简单方便在XCode5中新建一个工程的时候,会默认带一个用于单元测试的target,其名字为工程名加Test后缀,并且文件名也以Test结尾。你会发现已经有了一个默认的测试用例,其中有三个方法:setUp,tearDown,testExample。其中testExample方法左侧有一个播放按钮,点击它就会对这个方法进行测试,而在整个文件的@implementation那行也有个同样的按钮,点击后会对当前测试用例的所有方法进行测试,也可通过Command+U快捷键来触发。这个测试...

iOS: 测试 View Controllers

我们不是迷信测试,但它应该帮助我们加快开发进度,并且让事情变得更有趣。 让事情保持简单 测试简单的事情很简单,同样,测试复杂的事会很复杂。就像我们在其他文章中指出的那样,让事情保持简单小巧总是好的。除此之外,它还有利于我们测试。这是件双赢的事。让我们来看看测试驱动开发 (简称 TDD) ,有些人喜欢它,有些人则不喜欢。我们在这里不深入讨论,只是如果用 TDD,你得在写代码之前先写好测试。如果你好奇的话,可以去找 Wikipedia 上的文章看看。同时,我们也认为重构和测试可以很好地结合在一起。 测试 UI 部分通常很麻烦,因为它们包含太多活动部件。通常,view controller 需要和大...

Git Workflow

1. 序 这篇指南以大家在 SVN 中已经广为熟悉使用的集中式工作流作为起点, 循序渐进地演进到其它高效的分布式工作流, 还介绍了如何配合使用便利的 Pull Request 功能, 系统地讲解了各种工作流的应用。 如果你 Git 用的还不多, 可以从前面的讲的工作流开始操练。在操作过程中去感受指南的讲解: 解决什么问题、如何解决问题, 这样理解就深了, 也方便活用。 行文中实践原则和操作示例并重, 对于 Git 的资深玩家可以梳理思考提升, 而新接触的同学, 也可以跟着 step-by-step 操练学习并在实际工作中上手使用。 工作流其实不是一个初级主题, 背后的本质问题是 有效的项目流程...

Optimizing NSPredicates

This week I'm gonna throw three strategies you can use to improve the performance of your NSPredicates — either in Core Data or while filtering a collection like NSArray. If things are really slow though, there are probably other places where you should be focusing, but let's assume you have already...

Game of Life Cellular Automata

For this week I want to share a concept and an example repository of something called Cellular Automata. To be honest, it's one of those simple things with a big name. Let me explain: Imagine a grid of cells. Each cell has a finite number of states (let's say 0 or 1 at its most basic case). The syst...

Easier debugging using breakpoints with actions

If you debug solely through NSLog you are missing the better insight the debugger can provide you. Also, it is easy to forget all those logging functions, ship them into production and, depending on the industry, even introduce security risks. On the other hand, if you are using only basic breakpoin...

Scheme 字符串操作总结

字符串操作是任何一门编程语言中最常用的操作之一,Scheme 也提供了一系列 procudure 来操作字符串。 1、字符串的比较,分别有string=?、string>?、string<?、string>=?、string<=?。 这与其他语言中对 string 的比较并无不同,比较字符和长度。 例子: (string=? "mom" "mom") <graphic> #t (string<? "mom" "mommy") <graphic> #t (stri...

SBCL with CodeRunner

Lisp 是继 FORTRAN 之后历史最悠久的高级语言,作为一名括号爱好者,我简单说明一下在 CodeRunner 中运行 Lisp 的方法,由于 Lisp 分支、实现、方言众多,我们选择其中一个 SBCL 来做说明 (不是 SB's CLisp 哟)。 首先我们知道 CodeRunner 执行代码是基于 Terminal 指令的,那么也就是说,我们要在 CodeRunner 中执行 .lisp 文件,首先需要有终端工具。 为了安装 SBCL,你可以访问器官方网站下载,或者通过 Macports 来安装,至于 Macports 的安装太过简单这里不做赘述。 如果你使用 Macports,只需...

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.

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

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

热爱苹果、钟情色彩。

随时恭候 垂询