Objective-C Class and Object

Objective-C是一门面向对象的编程语言,既然是面向对象,那我们就有必要对它的对象作进一步的理解,而且它的很多特性与这也大有关系。

1.Class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/// An opaque type that represents an Objective-C class.
typedef struct objc_class *Class;

struct objc_class {
Class isa  OBJC_ISA_AVAILABILITY;

#if !__OBJC2__
Class super_class                                          OBJC2_UNAVAILABLE;
const char *name                                             OBJC2_UNAVAILABLE;
long version                                               OBJC2_UNAVAILABLE;
long info                                                  OBJC2_UNAVAILABLE;
long instance_size                                         OBJC2_UNAVAILABLE;
struct objc_ivar_list *ivars                              OBJC2_UNAVAILABLE;
struct objc_method_list **methodLists                     OBJC2_UNAVAILABLE;
struct objc_cache *cache                                  OBJC2_UNAVAILABLE;
struct objc_protocol_list *protocols                      OBJC2_UNAVAILABLE;
#endif

} OBJC2_UNAVAILABLE;
继续阅读

Hello Octopress

Octopress:A blogging framework for hackers.

看到介绍就被吸引了,正好最近想写些东西,于是决定用Octopress来搭个自己的博客。Octopress既然是为黑客准备的,有点难度那也是很正常的。网上很多都是介绍搭建的博客的步骤,但对出现各种问题以及解决办法的总结不是很多。而自己和ruby不是好朋友,过程中出现很多的问题,这里把遇到的问题贴上来,一来做个总结;二来也可以给遇到同样的问题的朋友一些帮助。

1. An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.

1
2
An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that gem install RedCloth -v '4.2.9' succeeds before bundling.

Solution:

1
$ sudo gem install RedCloth -v '4.2.9' --verbose

2. You have already activated rake 10.1.0, but your Gemfile requires rake 10.0.4.

1
2
3
4
rake aborted!
You have already activated rake 10.1.0, but your Gemfile requires rake 10.0.4. Prepending `bundle exec` to your command may solve this.
/Users/dongmeiliang/Documents/octopress/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)

Solution:这个问题可以每次加上bundle exec,但是总有一种不舒坦的感觉,找了很久找到一点线索,最后用下面办法解决了:

1
2
3
4
5
6
7
brew update
brew doctor
cd root_path_octopress
git pull octopress master
rm Gemfile.lock
vim Gemfile
gem 'rake', '~> 10.1.0'//改成合适的版本
继续阅读