12/20/2014

Setting up a New Mac

Some highlights about setting up a new mac without time machine (pretty sure I've written something like this years ago.

Edit sudo

sudo visudo

iTerm

Quake-like window: https://www.dropbox.com/s/ucw0hzzoy3vwt2k/Screenshot%202014-12-20%2014.46.01.png?dl=0

Add command-x as control-c: https://www.dropbox.com/s/0lfbdtwwvv1ghuk/Screenshot%202014-12-20%2014.44.52.png?dl=0

Hotkey: https://www.dropbox.com/s/x7deslelvh1z319/Screenshot%202014-12-20%2014.46.13.png?dl=0

Vim

Get vim with +clipboard: brew install vim | sudo mv /usr/bin/vim /usr/bin/oldvim

10/12/2014

Why do I Support Umbrella Movement as a Chinese

Why do I Support Umbrella Movement as a Chinese

No one is able to predict what will happen to Hong Kong after this so called Umbrella Revolution, and other than stating it is by far not an actual revolution, I would like to make four statements regarding this matter. 

1. Democracy can be bad sometimes. But dictatorship is not a good thing. 

It is probably better to replace good and bad with rich and poor, but sometimes moral plays a big role in our lives too so I have chosen a more generic wording as my conclusion. Anyway, I would not gave written the first sentence if I was writing in Chinese as that is a mostly accepted fact among the people of this fast growing country. Other than those uneducated Falungong members, it can be easily told that even with democracy, countries in South East Asia, South America, most of African countries, and Indian (yes Indian, one of the favourite examples of some Chinese government supporters  although most of them haven't really been there and studied how that giant country runs) are not really as "good" as their western mentors. People there are happy but it seems almost impossible to get rid of problems like corruption and the lack of living resource, ie they are poor. 

But in the other hand, it doesn't mean that dictatorship can be a good thing to have. It's funny that there are kind of two words to describe dictatorship in Chinese: one is "ruling alone" and is used as a negative word to refer to the old emperors and kings and modern dictators like Adolf Hitler (but not friends of the Party like the Kims, and the Party itself of course), and even the old enemy Guomin Party; and the other is "dedicated in governing", which is not surprisingly, to refer to the party itself. The latter is always used with the phrase "people's democracy" as it is stated in the Law that "China is a country that is lead by the PRC and it is dictated by people's democracy". It sounds pretty much bullshit but anyway, under the dictatorship of PRC, China has become what it is in 30 years, from a totally fucked up country that was destroyed by the same party that was under mostly Mao's control. 

Regardless the case of Singapore, the favourite example of anti-democracy of the Chinese government, China's case itself already proved that democracy is not the only way leads to being rich and civilised. Sure some Chinese people are suffering from smog and other shitty stuff, but education and medical expenses are affordable comparing with a lot of western countries, which may sound surprising to a lot of Chinese since in general it is believed that China is going really bad in these fields. It is going to be a long and possibly arguable topic about public expense in China, but anyway, denying the achievements China had doesn't make any sense. Most Chinese just live their daily life in a similar way that the people in New York and Sydney do, they are normal people like us and also getting richer. 

This sounds a bit weird. Didn't I try to state that we cannot really say dictatorship is a good thing? How come the Chinese people are still doing pretty good? The answer is simple: what is making China rich is not dictatorship. Here comes my 2nd statement: it's the culture. 

2. Culture determines how good or bad a country can be. 

When I say culture, I mean all the historical aspects of a country, or "everything that makes the people of the country as they are". It sounds like a meaningless loop but my point is that it is exactly how the world works. People give too much credit to things like democracy or the power of "being dedicated in governing" if you are from media of PRC. It doesn't really matter that much. A good theory should explain why things are like what they currently are. A better solution is able to predict future in some degree. Bad theories, in the other hand, always try to find excuse for exceptions, like how Falungong explains why there are so much corruption in Indian and how the Chinese government explain why North Korea is one of the worst countries in the world. 

Let's see this culture thing. Counties in North America and Western Europe are rich, because the people there believes equality, democracy, science, capitalism, freedom of trading, contract. They kept expanding and spread it and the whole world is under the influence of the western culture. They work not that hard but work smart. They enjoy their lives and keep a good balance between life and work. They have accumulated a huge number of fortune and intelligential properties, and set an example to all the world that how good a country can be. They made mistakes like slavery and invasion, but they corrected themselves and keep involving. Thus, democracy is the result, not the reason.

It applies to almost all the other places. In Asia there's no such thing as equality, people respect power of authority, and sometimes the force that disobey the authority. In the other hand, people also work very hard and instead of live a happy life themselves, they would do almost anything for their children, but in return the children must always respect their authority. This explains why China, Japan, and Korea have so many things in common: they are revived upon ashes and became developed (well for China, at least the big cities) in a relatively short time. It's not about democracy or dictatorship. As long as the dictator is not as bad as Mao and the Kims, these Asian countries will do a good job in economy. The real difference is that how the culture adapted. The Chinese believes their culture is still the best, so without the spirit of equality they may not be able to do a lot to the poor class, but they can gather the fortune people made together to make leap in fields like space ship or nuclear weapon, while the Japanese are more willing to accept the advantage of other culture (they accepted the Chinese culture thousand years ago anyway) and made Japan more like the western countries, while Korea is sort of sit in the middle. But they are all catching up, and made a difference with countries in South East Asia and South America.

I don't want to say too much about all the cultures but in general, democracy is always the result but not the reason of the "good" aspects of different cultures. Then why I'm still saying that I support the movement in Hong Kong, as I stated in the title?

3. Culture can be changed little by little. And the best time to change it, is now.

The brain washed Chinese may argue that it has to be at the "right time" to make a chance, like Indian changed their culture to sort of western but still has serious corruption problem. Actually, the reason of the corruption in Indian is exactly that they are not really adapted their culture. The people are still willing to live a poor and happy life, which comes from ignorance and misunderstand of how the world works, like the strong believe in some religions. The westerners have already realized that even God loves them, they still need to take care of themselves but the traditional Indians keep believing that the true meaning of live is afterlife.

The good thing about Hong Kong is that unlike the mainland, Hong Kong was colony of UK for a hundred years. It has its own problems but its culture evolved to the right direction. However, China is rising fast in the past 35 years and it keeps trying to say that dictatorship can be a good thing and even the solution of the problems caused by democracy. It's a dangerous assumption, because the reason of the rising of China, as I said, was not dictatorship. It's the hard working Chinese people. So I'm very glad to see the Hong Kong youths are standing against the dictatorship. Even they may hate the normal Chinese people like myself at this sensitive moment, it's still a good thing, because the culture they want to evolve to is able to guild them to the right path due to its nature of equality and reasoning.

4. Last but not least, it's not very hard to see this movement is not likely to lead to anywhere. But it's a good signal to the Chinese government, that they need to evolve as well. Everyone knows China cannot be growing as how it is so it needs to change at a certain time, maybe not now, but it will not be as late as 50 years later. It is politics. And it's why Umbrella Movement as a Chinese.

PS: About political correctness

I don't believe race is a matter, but I do believe cultures are quite different, which means an American born Chinese would be more similar with another American rather than a Chinese. You can't choose your race and it's totally fine since it's not important at all, and it's possible you adapt to a different culture. I don't think I'm 100% political correct, but I don't care anyway. Some people would say "you can't say cultures are good or bad, they are just different", well I'd quote something from Book of Mormon the musical:

If you don't believe what we say
Try live in here a couple of days
Watch your friends and family die
Hasa diga eebowai!

7/06/2014

当你遇到广东黑社会的时候怎么办?

技多不压身,当你遇到广东黑社会的时候怎么办?莫慌!

现在是粤语学习时间:

扑街,吹咩!(朋友,住手!)

郁我啊锁嗨!(自己人!) 

丢类劳味啊!(大哥别打我!)

调理劳务系!(交个朋友吧!)

来广东的朋友不要怕 这4句够你用一生

7/01/2014

Pros & Cons of Xamarin

Pros

- Cross-platform: the same code runs on both iOS and Android

- As a cross-platform solution, it's based on native UI compoentns so the performance is not as awful as PhoneGap etc.

- As an app oriented solution, an experienced Xamarin developer will be able to deliver an app faster than game based solutions like Cocos2d-js

- Best for a mockup apps since they don't require a lot of UI customisation, i.e. doing the most basic things

 

Cons

- As a cross-platform solution it doesn't support platforms as many as Cocos2d-js does

- Unlike Cocos2d-js which is free, Xamarin costs $999 a year for business plan

- Lastest support for each platform (iOS / Android) is always slow since Xamarin doesn't have a better channel to work with Apple & Google than any other native developers

- To become a good Xamarin developer, one needs to master C#, .NET, Xamarin SDK, Xamarin IDE / VS, so:

- An experienced Xamarin developer is hard to find and the eco system based on Xamarin is not as strong as native iOS / Android community, e.g. in stackoverflow tags

- android: 603,241

- objective-c: 211,677

- xamarin: 13703

- swift: 37441 (and it's only released less than half a year while xamarin is there for years)

- Smaller ecosystem means it's harder to find answers and will lead to longer time of problem solving

- Harder to integrate with open source iOS / Android libraries

- Harder to make an app with a well-designed UI

 

Diablo 3 PTR 2.1.2 Greater Rift Season 2 Leaderboard Trends Top 1

v2

12/13/2014 (after DH's nerf & reset)

ClassTop 10Top 1
DH4648
Barb4347
Monk4749
Sader4246
WD3844
Wiz3843

12/9/2014

ClassTop 10Top 1
DH4350
Barb3137
Monk3547
Sader139
WD137
Wiz1037

v1

12/3/2014

ClassTop 10Top 1
Barb5863
DH5455
Monk4851
Sader4753
WD4045
Wiz3843

11/26/2014

ClassTop 10Top 1
DH5054
Barb4658
Monk4348
Sader4149
WD3644
Wiz3638

11/25/2014

ClassTop 10Top 1
DH4952
Barb4356
Monk4248
Sader4047
WD3543
Wiz3538

11/24/2014

ClassTop 10Top 1
DH4750
Barb4154
Monk4046
Sader3745
WD3439
Wiz3338

 

剧本二·过火车的房子

很久之前做过一个有标题的梦“过火车的房子”,大概是我和另外几个人被困在一个房子里,无法出去,而且永远是白天。房子是跃层的,有一个窗户旁边是火车道,只能根据过火车的间隔大概推测时间。桌子上有一本不能移动但是可以翻阅的记事本。从第二天开始会死一个人,记事本的内容每天不断添加,活着的人努力找出真相。但是很可惜,推理过程完全记不清了。最后的真相是房子本身是虚构的,然后大家都死了,就跟lost差不多。不过做梦的时候我还不知道lost的结局,不过反正都是俗套而已。

配乐是弦乐。曲调刚醒的时候还能哼两段,现在实在记不起来了。

剧本一·极地迷踪(好土的名字)

(中国青年Leo身为天才飞行器设计师,却向来玩世不恭,终日和好友Dan、Mike四处作乐。有一天,他在一个国际性空军联谊活动上,结识了一位神秘的金发女郎Louise。得知他的身份后,Louise邀请他登上一艘豪华游轮,但在到达目的地之前,两人却一直呆在室内。Leo天性粗旷,既然佳丽常伴身边,也便不以为意,但日久也难免生疑。有一日,他设计溜出船舱,却发现气氛甚是怪异,不单难见人影,而且保安似疏实密,密布各种监控设施。Leo突破重重陷阱,到达甲板,却发现竟然身处一片冰天雪地之间。)

听到身后传来的脚步声,Leo转过身子,果然,飞奔而来的正是身着冬装的Louise。

"Heh. You really think I'm not able to get out and find the truth by myself? "Leo冷笑道,但心里却在飞速思考:“在这种天气下,大概十几秒之后,我的手指就会开始不灵便了吧……不出一分钟,四肢恐怕也会无法自由行动。必须尽快分出胜负……”

"Listen to me Leo, I swear I didn't..." Louise一边说着,Leo的脑中一边浮现出这样的场面:他猛地冲上前去,Louise抬手迎击,Leo虚晃一招,突然身形一矮,下潜抱膝,将Louise摔倒在地。然后,自己就势向前一滚,假装要使用十字固取其手臂,但却再向右一晃,用三角固完成锁颈。容情不下手,下手不容情;一定要在30秒之内让Louise失去意识,并把她带回船舱!(小唐福尔摩斯风格)

"... I swear I didn't mean to..." Louise话音未落,Leo猛地冲上前去。Louise抬手迎击,Leo虚晃一招,突然身形一矮,下潜抱膝。不料Louise右肘下沉,迎面正中Leo面门,同时右膝向前一顶,Leo痛苦地捂住胯下,在地上滚来滚去。Louise摇了摇头,扛起Leo,向船舱走去。

(追赶而来的Louise强行把Leo拖回船舱。面对Leo的质问,Louise告知他自己乃是英国皇家空军王牌飞行员,此行目的地为南极,其他一切只能等到达目的地再说。)

"Be patient sweetheart, I'll tell you all the rest things you want to know when we arrive."
"Damn it, how am I supposed to wait any longer? When the fuck will we arrive?! "
"Actually, now."

(长镜头。再次走出甲板的Leo惊奇地发现,一个隧道由南极大陆伸展开来,连接到已经下锚的游轮上。一众人等从游轮缓缓走向大陆,一头雾水的Leo只好跟着人流,默默向前走去。)

“要不要大闹一场……”看着Leo跃跃欲试的表情,Louise默默地摇了摇头,做了个绞杀的手势。
"OK... Maybe not. " Leo喃喃道。

(Leo跟着Louise来到一个大厅,两人在一角的沙发默默坐下。另一批人从相反的方向走来,由大陆走向游轮。)

Leo百无聊赖地看着他们。突然,他眼睛发直,死死地盯住一个人。

“怎……怎么可能!”

“?”不懂中文的Louise奇怪地看着他。同时,Leo盯着的那个人也转过头来。只见他身材魁梧,一身浅蓝色的中山装;但惊人的是,他身边竟然撒发出阵阵蓝色火焰,而且……他那特殊的秃顶!难道!(注:这个镜头里,Leo是面向摄像机,而此人是背对摄像机的。)

“小鬼,你是…… I mean who's this brat? "

“毛·泽·东!”

对方微微一笑。"I was wondering how's one of my Chinese fellows is here. So you must be that Leo, right? "

(原来,在毛泽东时期,中国一直在秘密研发一种可以将人类的意识移植道某种特殊的超导材料之中的技术。令人惊讶的是,该技术完全基于模拟技术,和现代的数字技术属于完全不同的分支。在毛去世之前,这项技术终于完成,但要维持超导,制造低温环境是必不可少的。因此,装载着毛的意识的超导线圈就被运到了南极进行保存。)

“难道你保留遗体就是这个目的?”Leo谨慎地用中文问道。

毛微微一笑。“正好相反,”他含蓄地说。

“而且南极这零下几十度对于维持超导来说,根本是杯水车薪……难度其实……?”

“没错。”毛点点头,压低了声音,“估计你也猜到了,这只是个借口。保存遗体完全是政敌出于自己的目的,当时我本人是反对的。跟我估计的一样,他们最终还是这么做了,所以将超导线圈在政治风暴爆发之前转移到南极,也算是一个明智之举。而且你看,”他指了指自己仔细看有点半透明的身体,“只要意识存在,实体的身体真的有必要吗?”

Leo点点头。“而且你的全息技术也完成了。那么这蓝色火焰效果有什么玄机呢?”

毛笑道:“Don't you think it's pretty cool? ”

(全息技术并不是重点,不过这也彰显了毛派在数字技术方面的建树。在这40年间,毛的南极基地完成了另外两项最关键的技术:常温超导,以及意识线圈扩散。后者指的是利用数字技术将意识线圈内的部分内容扩散并形成一个意识场。)

"You mean mind control or that sort of things? " Leo问道。

"Of course not. I don't even think it's technically possible since human mind is still beyond comprehension. "毛泽东解释说,"The so-called mind field is used to 'plant' some most basic 'facts' into human mind. In my case, it would be 'Mao is, and will always be the leader of China'. All I want is going to be like this..."

"Yea... and this simple. But since when you've started speaking English anyway?"

"None of your business, brat. And what makes you think you're that special? "毛哈哈大笑。

(随后,毛解释了要将Leo带到南极基地的原因。返回大陆的计划即将紧锣密鼓地展开,但传闻中国正在秘密开发一种可用于长距离飞行的机器,其目的很可能是南极基地。而该项目的负责人正是Leo。)

“但是……这项计划已经……完成了。”Leo汗流浃背。

“……在你们的旅途中,我们已经知道了。所以我才会耐心地把来龙去脉告诉你,因为我觉得让你白来一趟,有点不好意思。不然你以为我为什么会这么好心?跟年轻小伙子谈谈说说是蛮有意思的,但我可没那么大功夫。所以,”毛挥了挥手,"Louise let's go. And you Leo, sorry there's no spot for you this time. Don't worry we'll arrange another flight for you shortly. Auf Weidersein. "

"Seriously? Was Adolf involved in this project as well? "

"Of course not. But there IS another one: Elizabeth II. "

(原来,Louise在此的原因,正是因为伊丽莎白对此计划也甚感兴趣,因此英国皇家空军也介入其中。然后我就醒了。当然我知道女王跟皇家空军没啥关系……结尾如何我没梦见,其中有段毛论民主的对话太无聊了,而且毛是用英文说的,所以就不写了。我也不知道梦里毛为什么用英文。里面所有镜头我都以第三人称视角梦到过,所以拍出来不成问题。)

6/25/2014

Automate iOS Version Number

UPDATE 20141013: added build hash so it looks like "1.0.2 (E3B8)"; added swift version

IMPORTANT: I'm still trying to figure out the best practice of this topic, thus the approach I described in this article may not be final.

Long story short:

1. Add a Run Script in Build Phases (Editor -> Add Build Phase), and put it before "Copy Bundle Resources" so that we can increase version number in info.plist, and then copy plist into app bundle.

2. Add script as below. The magic here is "git rev-list HEAD | wc -l | tr -d ' '" which gives you the subversion-style revision number, which means if you're not in master branch this doesn't make any sense (that's why I said I'm still figuring it out). Basically I don't mind change version number in debug mode but you may want to uncomment the 2nd line if you stay in develop branch most of the time.

#Update build number with number of git commits if in release mode
# if [ ${CONFIGURATION} == "Release" ]; then
versionNumber=$(/usr/libexec/plistbuddy -c Print:CFBundleShortVersionString: "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
buildHash=$(git rev-parse HEAD | cut -c1-4)

 

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $versionNumber.$buildNumber ($buildHash)""${PROJECT_DIR}/${INFOPLIST_FILE}"
# fi;
 
3. Display version number somewhere in your UI.
 
label_version.text = [NSString stringWithFormat:@"%@ %@", 
[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleName"],
[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"]];

-- swift version --

label_version.text = NSBundle.mainBundle().infoDictionary?["CFBundleVersion"] as? String

 
The thing I'm not sure is that although 1.0.82 seems to be nice to non-tech person, it is not as good as git hash if you want to debug something. So maybe something like 1.0.82 (5cb5ec) would be better; anyway it's very easy to modify the script in step 2 to make whatever version string you want.

6/15/2014

无题

前几天做了一个梦,今天有空,整理一下。

(中国青年Leo身为天才飞行器设计师,却向来玩世不恭,终日和好友Dan、Mike四处作乐。有一天,他在一个国际性空军联谊活动上,结识了一位神秘的金发女郎Louise。得知他的身份后,Louise邀请他登上一艘豪华游轮,但在到达目的地之前,两人却一直呆在室内。Leo天性粗旷,既然佳丽常伴身边,也便不以为意,但日久也难免生疑。有一日,他设计溜出船舱,却发现气氛甚是怪异,不单难见人影,而且保安似疏实密,密布各种监控设施。Leo突破重重陷阱,到达甲板,却发现竟然身处一片冰天雪地之间。)

听到身后传来的脚步声,Leo转过身子,果然,飞奔而来的正是身着冬装的Louise。

"Heh. You really think I'm not able to get out and find the truth by myself? "Leo冷笑道,但心里却在飞速思考:“在这种天气下,大概十几秒之后,我的手指就会开始不灵便了吧……不出一分钟,四肢恐怕也会无法自由行动。必须尽快分出胜负……”

"Listen to me Leo, I swear I didn't..." Louise一边说着,Leo的脑中一遍浮现出这样的场面:他猛地冲上前去,Louise抬手迎击,Leo虚晃一招,突然身形一矮,下潜抱膝,将Louise摔倒在地。然后,自己就势向前一滚,假装要使用十字固取其手臂,但却再向右一晃,用三角固完成锁颈。容情不下手,下手不容情;一定要在30秒之内让Louise失去意识,并把她带回船舱!

"... I swear I didn't mean to..." Louise话音未落,Leo猛地冲上前去。Louise抬手迎击,Leo虚晃一招,突然身形一矮,下潜抱膝。不料Louise右肘下沉,迎面正中Leo面门,同时右膝向前一顶,Leo痛苦地捂住胯下,在地上滚来滚去。Louise摇了摇头,扛起Leo,向船舱走去。

(追赶而来的Louise强行把Leo拖回船舱。面对Leo的质问,Louise告知他自己乃是英国皇家空军王牌飞行员,此行目的地为南极,其他一切只能等到达目的地再说。)

"Be patient sweetheart, I'll tell you all the rest things you want to know when we arrive."
"Damn it, how am I supposed to wait any longer? When the fuck will we arrive?! "
"Actually, now."

(再次走出甲板的Leo惊奇地发现,一个隧道由南极大陆伸展开来,连接到已经下锚的游轮上。一众人等从游轮缓缓走向大陆,一头雾水的Leo只好跟着人流,默默向前走去。)

“要不要大闹一场……”看着Leo跃跃欲试的表情,Louise默默地摇了摇头,做了个绞杀的手势。
"OK... Maybe not. " Leo喃喃道。

(Leo跟着Louise来到一个大厅,两人在一角的沙发默默坐下。另一批人从相反的方向走来,由大陆走向游轮。)

Leo百无聊赖地看着他们。突然,他眼睛发直,死死地盯住一个人。

“怎……怎么可能!”

“?”不懂中文的Louise奇怪地看着他。同时,Leo盯着的那个人也转过头来。只见他身材魁梧,一身浅蓝色的中山装;但惊人的是,他身边竟然撒发出阵阵蓝色火焰,而且……他那特殊的秃顶!难道!(注:这个镜头里,Leo是面向摄像机,而此人是背对摄像机的。)

“小鬼,你是…… I mean who's this brat? "

“毛·泽·东!”

对方微微一笑。"I was wondering how's one of my Chinese fellows is here. So you must be that Leo, right? "

(原来,在毛泽东时期,中国一直在秘密研发一种可以将人类的意识移植道某种特殊的超导材料之中的技术。令人惊讶的是,该技术完全基于模拟技术,和现代的数字技术属于完全不同的分支。在毛去世之前,这项技术终于完成,但要维持超导,制造低温环境是必不可少的。因此,装载着毛的意识的超导线圈就被运到了南极进行保存。)

“难道你保留遗体就是这个目的?”Leo谨慎地用中文问道。

毛微微一笑。“正好相反,”他含蓄地说。

“而且南极这零下几十度对于维持超导来说,根本是杯水车薪……难度其实……?”

“没错。”毛点点头,压低了声音,“估计你也猜到了,这只是个借口。保存遗体完全是政敌出于自己的目的,当时我本人是反对的。跟我估计的一样,他们最终还是这么做了,所以将超导线圈在政治风暴爆发之前转移到南极,也算是一个明智之举。而且你看,”他指了指自己仔细看有点半透明的身体,“只要意识存在,实体的身体真的有必要吗?”

Leo点点头。“而且你的全息技术也完成了。那么这蓝色火焰效果有什么玄机呢?”

毛笑道:“Don't you think it's pretty cool? ”

(全息技术并不是重点,不过这也彰显了毛派在数字技术方面的建树。在这40年间,毛的南极基地完成了另外两项最关键的技术:常温超导,以及意识线圈扩散。后者指的是利用数字技术将意识线圈内的部分内容扩散并形成一个意识场。)

"You mean mind control or that sort of things? " Leo问道。

"Of course not. I don't even think it's technically possible since human mind is still beyond comprehension. "毛泽东解释说,"The so-called mind field is used to 'plant' some most basic 'facts' into human mind. In my case, it would be 'Mao is, and will always be the leader of China'. All I want is going to be like this..."

"Yea... and this simple. But since when you've started speaking English anyway?"

"None of your business, brat. And what makes you think you're that special? "毛哈哈大笑。

(随后,毛解释了要将Leo带到南极基地的原因。返回大陆的计划即将紧锣密鼓地展开,但传闻中国正在秘密开发一种可用于长距离飞行的机器,其目的很可能是南极基地。而该项目的负责人正是Leo。)

“但是……这项计划已经……完成了。”Leo汗流浃背。

“……在你们的旅途中,我们已经知道了。所以我才会耐心地把来龙去脉告诉你,因为我觉得让你白来一趟,有点不好意思。不然你以为我为什么会这么好心?跟年轻小伙子谈谈说说是蛮有意思的,但我可没那么大功夫。所以,”毛挥了挥手,"Louise let's go. And you Leo, sorry there's no spot for you this time. Don't worry we'll arrange another flight for you shortly. Auf Weidersein. "

"Seriously? Was Adolf involved in this project as well? "

"Of course not. But there IS another one: Elizabeth II. "

(原来,Louise在此的原因,正是因为伊丽莎白对此计划也甚感兴趣,因此英国皇家空军也介入其中。然后我就醒了。当然我知道女王跟皇家空军没啥关系……结尾如何我没梦见,其中有段毛论民主的对话太无聊了,而且毛是用英文说的,所以就不写了。我也不知道梦里毛为什么用英文。)

6/06/2014

UIView with Mask

Can be used for rounded button or circle image, etc. It looks like:
https://www.dropbox.com/s/jj82zassj964vqq/Screenshot%202014-06-06%2014.57.06.png

Sample code:

[button_view_mask1 enable_mask_circle];
[button_view_mask2 enable_mask_circle];
[button_view_mask3 enable_mask_circle_width:1 color:[UIColor redColor]];
[label_view_mask enable_border_width:1 color:[UIColor blueColor] radius:5];

Part of LCategory: https://github.com/superarts/LCategory

String Related Category

There are string related functions that may be extended in future. I'll update pod really quick: https://github.com/superarts/LCategory

s = [s stringByAppendingFormat:@"[NSString string_from_int:42] - '%@'\n", [NSString string_from_int:42]];
s = [s stringByAppendingFormat:@"['1' is:'1'] - %i\n", [@"1" is:@"1"]];
s = [s stringByAppendingFormat:@"['1' is:'2'] - %i\n", [@"1" is:@"2"]];
s = [s stringByAppendingFormat:@"['12' contains:'1'] - %i\n", [@"12" contains:@"1"]];
s = [s stringByAppendingFormat:@"['12' contains:'3'] - %i\n", [@"12" contains:@"3"]];
s = [s stringByAppendingFormat:@"['    te st  ' string_without_leading_space] - '%@'\n", [@"    te st  " string_without_leading_space]];
s = [s stringByAppendingFormat:@"['test' string_without_leading_space] - '%@'\n", [@"test" string_without_leading_space]];
s = [s stringByAppendingFormat:@"['12345678 l23455678' string_without:'3' to:'67'] - '%@'\n", [@"12345678 l23455678" string_without:@"3" to:@"67"]];
s = [s stringByAppendingFormat:@"['12345678 l23455678' string_without:'3' to:'67' except:['45']] - '%@'\n", [@"12345678 l23455678" string_without:@"3" to:@"67" except:@[@"34567"]]];
s = [s stringByAppendingFormat:@"['12345678 l23455678' string_between:'3' and:'67'] - '%@'\n", [@"12345678 l23455678" string_between:@"3" and:@"67"]];
s = [s stringByAppendingFormat:@"['12345678 l23455678' string_between:'3' and:'67' from:9] - '%@'\n", [@"12345678 l23455678" string_between:@"3" and:@"67" from:9]];
s = [s stringByAppendingFormat:@"['12345678 l23455678' array_between:'3' and:'67'] - '%@'\n", [@"12345678 l23455678" array_between:@"3" and:@"67"]];
s = [s stringByAppendingFormat:@"['#hash' is_hashtag] - '%i'\n", [@"#hashtag" is_hashtag]];
s = [s stringByAppendingFormat:@"['c#' is_hashtag] - '%i'\n", [@"c#" is_hashtag]];
s = [s stringByAppendingFormat:@"['test #t1 t2 #t3 t4' array_hashtag] - '%@'\n", [@"test #t1 t2 #t3 t4" array_hashtag]];
s = [s stringByAppendingFormat:@"['line1' append_line:'line2] - '%@'\n", [@"line1" append_line:@"line2"]];
s = [s stringByAppendingFormat:@"['line1' append_line2:'line2] - '%@'\n", [@"line1" append_line2:@"line2"]];
s = [s stringByAppendingFormat:@"['word1' append:'word2' divider:'|'] - '%@'\n", [@"line1" append:@"line2" divider:@"|"]];

Results:

[NSString string_from_int:42] - '42'
['1' is:'1'] - 1
['1' is:'2'] - 0
['12' contains:'1'] - 1
['12' contains:'3'] - 0
['    te st  ' string_without_leading_space] - 'te st  '
['test' string_without_leading_space] - 'test'
['12345678 l23455678' string_without:'3' to:'67'] - '128 l28'
['12345678 l23455678' string_without:'3' to:'67' except:['45']] - '12345678 l28'
['12345678 l23455678' string_between:'3' and:'67'] - '45'
['12345678 l23455678' string_between:'3' and:'67' from:9] - '455'
['12345678 l23455678' array_between:'3' and:'67'] - '(
    45,
    455
)'
['#hash' is_hashtag] - '1'
['c#' is_hashtag] - '0'
['test #t1 t2 #t3 t4' array_hashtag] - '(
    t1,
    t3
)'
['line1' append_line:'line2] - 'line1
line2'
['line1' append_line2:'line2] - 'line1

line2'
['word1' append:'word2' divider:'|'] - 'line1|line2'

5/29/2014

How to Manage VIM Plugins for Objective C

It doesn't seems that a lot of iOS developers are using VIM, so there aren't many resource there. I've been using cocoa.vim for ages and it hasn't been updated for 4 years, while a lot of new features are introduced like ARC, block, etc. In this way you can make things well organized:

~/.vim$ ls autoload/
pathogen.vim
~/.vim$ ls bundle/
cocoa.vim vim-objc

Search keywords for the repos on github. Also don't forget to add this to your .vimrc:

execute pathogen#infect()

PS: cocoa.vim - https://github.com/msanders/cocoa.vim