CSS中的z-index和iOS中的非常不一样:iOS非常简单,所有的z-index设置只在parent视图(view)中起作用。但是,CSS的z-index的作用范围却可以超出parent的限制。

Read on →

字里行间,能够感受到雷蕾对音乐的真爱,以及音乐带给雷蕾的宁静。尤其是其中反复出现的,那种弹奏音乐时的状态,或者说是境界,刻画的让人心潮澎湃:哪一天我也能体会一下这种状态,该多好!

下面是摘抄的一些片段。

Read on →

Robert C. Martin (Bob大叔)在《敏捷软件开发》中提出了编程过程中的五个原则,以适应敏捷开发(Agile)的特点:以微小增量的方式构建软件。

Read on →

  1. 卷积神经网络用于图像识别的现状。
  2. 卷积与图像处理基础知识。
  3. 卷积神经网络每一层的可视化,了解神经网络内部的物理意义。
  4. 图像卷积滤波器与神经元和权重的关系。
Read on →

  1. 可以为同一个view添加两个相同类型的手势吗?比如添加两个UITapGestureRecognizer到同一个view。
  2. 如果一个view中有多个手势(UIGestureRecognizer),应该怎么处理它们之间的关系?
  3. 如果子view和父view中都有手势,这些手势之间的关系又是怎么样的呢?
Read on →
ios

当我们使用iOS的多线程并发执行一些任务的时候,有时候需要考虑任务之间的同步问题,比如任务1和任务2执行完之后,才可以执行任务3,原因可能是任务3需要任务1和任务2执行得到的结果。

Read on →

利用这一周的课余时间,读了《苏菲的世界》。这是一本非常好的西方哲学发展史的入门书,对于每个哲学家的观点阐述的简明扼要。由于主人翁是一个15岁的小女孩,所以,为了讲清楚,书中给了很多例子,生动形象易于理解。另外,采用对话的形式,而且知识点不是非常密集,读起来不会很累。

下面总结一下书中的观点,并加入一些自己的思考,如果有的话。

Read on →

ios通过NSURLSession进行网络请求,参考另一篇博客ios进行网络请求

在开发阶段,server端我们会用self-signed证书(省钱啊!)。正因为不是第三方机构认证的证书,所以客户端都会报警告。我们需要对此进行处理(参考NSURLSession in Apple Tech NoteHow do I accept a self-signed SSL certificate using iOS 7’s NSURLSession and its family of delegate methods for development purposes?):

Read on →
web

摘录在此,备忘。

HTTPS其实是有两部分组成:HTTP + SSL / TLS,也就是在HTTP上又加了一层处理加密信息的模块。服务端和客户端的信息传输都会通过TLS进行加密,所以传输的数据都是加密后的数据。

具体的加密过程看下图:

Read on →

这一段时间,在对自己不是很了解的代码进行重构,重新了解了一下Property、Instance Variable和@synthesize,总结一下。

首先需要明白一点:Property和@synthesize是让编译器帮助我们做一些规律性的工作。

如果没有Property

如果没有Property,我们可以这样实现Instance Variable的accessor(getter和setter),示例代码如下:

Read on →

在iOS中有三类事件:

  • 触控事件(单点、多点触控以及各种手势操作)
  • 传感器事件(重力、加速度传感器等)
  • 远程控制事件(远程遥控iOS设备多媒体播放等)

这里要讨论的是触控事件的机制。

iOS中主要有两种触控事件:

  • 手势识别类定义的触控事件
  • UIResponder中定义的触控事件
Read on →

For basic configuration of octopress blog, go to official site for references.

Issue with OS EI Caption (10.11)

After updating OS to EI Caption (10.11), there is some bugs when we run rake preview. You need to update your ruby version, and reinstall dependencies of octopress.

Refer to Errno::ENOENT: No Such File or Directory - Jekyll ~ Octopress and El Capitan post for more details.

If you can still not update your ruby version using the way in the above post, try the following commands (Refer to Using Rbenv to Manage Multiple Versions of Ruby for more details.) before install new ruby version:

  • Add rbenv init to your shell to enable shims and autocompletion:
1
2
$ echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
$ source ~/.bash_profile
  • Restart shell as a login shell so that the PATH changes take effect:
1
$ exec $SHELL -l

Themes

Go to here to choose the theme you like. Personally, I like the boldandblue theme. It is simple and elegant.

Read on →

Google Maps Android API utility library (the github repo and the documentation) supplies multiple cool features, including

  • Marker clustering — handles the display of a large number of points
  • Heat maps — display a large number of points as a heat map
  • IconGenerator — display text on your Markers
  • Poly decoding and encoding — compact encoding for paths, interoperability with Maps API web services
  • Spherical geometry — for example: computeDistance, computeHeading, computeArea
  • KML — displays KML data (Caution: Beta!)
  • GeoJSON — displays and styles GeoJSON data
Read on →

Description

A .dSYM file is a debug symbols file. It is generated when in xcode:

  • Generate Debug Symbols setting is enabled
  • Debug Infomation Format is set to DWARF with dSYM File in the build settings of your project.
Read on →

Contents:

Description

In Cocoa, the Model-View-Controller pattern, a controller’s responsibility is to keep the view and the model synchronized. There are two parts to this: when the model object changes, the views have to be updated to reflect this change, and when the user interacts with controls, the model has to be updated accordingly.

Key-Value Observing helps us update the views to reflect changes to model objects. The controller can observe changes to those property values that the views depend on.

For more details, refer Key-Value Coding and Observing from objc.io;

Read on →

All the attributes of a property defines how the compiler generate the getter and setter accessors.

  • atomic / nonatomic
  • strong / weak: used for ARC.
  • assign / retain / copy: go to here for reference. These properties define how the compiler generate the setter accessor.
  • readonly / readwrite: if a property is declared as readonly, the compiler will only declare the getter accessor, so that you can not call setter accessor.
Read on →
ios

Location Service Authorization

1. Set info.plist

For iOS SDK 8.0 and later, we need to set NSLocationWhenInUseUsageDescription and ‘NSLocationAlwaysUsageDescription’ in info.plist file. A sample case is:

1
2
3
4
<key>NSLocationWhenInUseUsageDescription</key>
<string>Do you allow the app to use your location?</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Are you willing to allow the app to use your location?</string>

The string will appear in the popup dialog. You can leave it as empty, and only the system message will appear in the popup.

Read on →
ios

MKOverlay

Write your own overlay class (for example, MapOverlay) confirm to MKOverlay, synthesize coordinate and boundingMapRect, so that we can assign value to them while initializing it.

Note that the type of coordinate is CLLocationCoordinate2D with latitude and longitude, while boundingMapRect is MKMapRect. And we need to use MKMapPointForCoordinate method to convert a CLLocationCoordinate2D type data to MKMapPoint type data. If we assign the CLLocationCoordinate2D data directly to boundingMapRect, the overlay will be too small to draw, and the mapView:rendererForOverlay: method will not be called at all. It is very hard for debugging.

Read on →

[updated 2015.09.13] This adding method is only for my project pages (gh-pages) GitBlogs, and for octopress, the way is builded in.

[updated 2015.06.07] For adding category or tag automatically through python script, go to here.

Introduction

The index page includes cat_tag_for_index.html for showing all the categories and tags, and the number of the corresponding posts.

The _layouts/default.html describes the content of a post, because post includes it. In the _layout/default.html file, it includes the cat_tag.html template as the category and tag info in the beginning of the post. And cat_tag.html also includes the date behind.

_data/categories.yml and _data/tags.yml describe all the categories and tags.

Read on →

[updated 2015.10.30] The followings ways for deploying posts is deprecated. Refer to deploying octopress for details. But if you knows things this post descripbes, you will have better understanding of octopress.

[updated 2015.09.13] Github has two kind of pages: user/orgnization pages and project pages (gh-pages).

Currently, I am using the user/orgnization pages deployed by octopress. This is recommended, due to the easy deployment.

If you are using the project pages (gh-pages), the following references may be help.

How to get started

Refer to “一步步在GitHub上创建博客主页”.

Categories and tags

I tried the this one. It works well.

Jekyll debugging

I didn’t try the debugger yet.

[updated 2015.10.30] The following way is deprecated, and octopress way is prefered. But the To make the post searchable by Google part is still in use.

Contents:

The first two sections are only for my project pages (gh-pages) GitBlogs, and currently in cotopress blog, we have other new simpler ways to do these things. See Migrate Blog to Octopress.

Description

This post is not for how to deploy the environment of writing posts in github pages, but how to use the environment you deployed before.

Read on →

1
2
3
4
5
6
7
8
Function.prototype.clone = function() {
    var that = this;
    var temp = function temporary() { return that.apply(this, arguments); };
    for( key in this ) {
        temp[key] = this[key];
    }
    return temp;
};