How To Make Your iPhone’s Home Button More Responsive

RegexKitLite Error: Undefined symbols for architecture i386

RegexKitLite 编译错误:

Undefined symbols for architecture i386:
  "_uregex_start", referenced from:
      _rkl_performRegexOp in RegexKitLite.o
      _rkl_search in RegexKitLite.o
      _rkl_findRanges in RegexKitLite.o

ld: symbol(s) not found for architecture i386

解决办法:

In project Build Setting search “Other Linker Flags” and add “-licucore”.

编译设置搜索 “Other Linker Flags” 添加 “-licucore” 字段

How to Google it

DLog

DLog is almost a drop-in replacement for NSLog. via The Evolution of a Replacement for NSLog

// DLog is almost a drop-in replacement for NSLog
// DLog();
// DLog(@"here");
// DLog(@"value: %d", x);
// Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
#ifdef DEBUG
#	define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#	define DLog(...)
#endif

入手 Alfred

QuickSilver 真心不错,尤其是配上插件功能后就是神器。但是 QS 对中文支持的不给力,crash 增多,加上 Alfred 添加了插件功能后越来越强大,毅然转向 Alfred。

目前对自定义搜索功能最为喜欢,设置 so 到 Stack Overflow,git 搜 Github,方便不少。

留记一篇,用一段时间后再整理 Alfred 使用,希望这钱没有乱花。

Picky to Octopress

不敢保证转换过程万无一失,请注意备份

前提条件:之前大多数文章已经是用 Markdown 格式。

  1. 仿照 AtomFeedHandler 新增 RSSOutHandler
class RSSOutHandler(webapp.RequestHandler):
  def get(self):
    site_domain = Datum.get('site_domain')
    site_name = Datum.get('site_name')
    site_author = Datum.get('site_author')
    site_slogan = Datum.get('site_slogan')
    site_analytics = Datum.get('site_analytics')
    site_updated = Datum.get('site_updated')
    if site_updated is None:
      site_updated = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
    feed_url = Datum.get('feed_url')
    if feed_url is None:
      feed_url = '/index.xml'
    else:
      if len(feed_url) == 0:
        feed_url = '/index.xml'

    template_values = {
      'site_domain' : site_domain,
      'site_name' : site_name,
      'site_author' : site_author,
      'site_slogan' : site_slogan,
      'feed_url' : feed_url
    }

    articles = db.GqlQuery("SELECT * FROM Article WHERE is_page = FALSE ORDER BY created DESC")
    template_values['articles'] = articles
    template_values['articles_total'] = articles.count()
    template_values['site_updated'] = site_updated
    path = os.path.join(os.path.dirname(__file__), 'tpl', 'shared', 'out.xml')
    output = template.render(path, template_values)
    self.response.headers['Content-type'] = 'text/xml; charset=UTF-8'
    self.response.out.write(output)
  1. main.py - main() 添加
('/out.xml', RSSOutHandler),
  1. 仿照 index.xml 添加 out.xml 模版
  2. 参考 Import XML of Wordpress to Octopress 造一个 Picky2Octopress
# -*- coding: utf-8 -*-
require 'fileutils'
require 'date'
require 'yaml'
require 'uri'
require 'rexml/document'
include REXML

doc = Document.new File.new(ARGV[0])

FileUtils.mkdir_p "_posts"

doc.elements.each("feed/entry") do |e|
    post = e.elements
    slug = post['slug'].text
    date = DateTime.parse(post['published'].text)
    name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day, slug]

    content = post['content'].text
    puts content

    content = content.gsub(/<code>(.*?)<\/code>/, '`\1`')

    ## 追加
    content = content.gsub(/<pre lang="([^"]*)">(.*?)<\/pre>/m, '<div class="bogus-wrapper"><notextile><figure class="code"><figcaption><span>lang:\1 </span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span></pre></td><td class="code"><pre><code class=''><span class="line">\2</span></code></pre></td></tr></table></div></figure></notextile></div>')

    (1..3).each do |i|
    content = content.gsub(/<h#{i}>([^<]*)<\/h#{i}>/, ('#'*i) + ' \1')
    end

    File.open("_posts/#{name}", "w") do |f|
    f.puts "---"
    #f.puts data
    f.puts "layout: post"
    f.puts "comment: true"
    f.puts "title: \"#{post['title'].text}\""
    f.puts "---"
    f.puts content
    end
end

如果内容较少 (<100),可以直接手动修改 index.xml 格式然后进行转换。

最后,不敢保证转换过程万无一失,请注意备份

New Blog again

最近 Octopress 火热,比如 Why Octopress?。忍不住手痒也来一个,花了半天时间把两年前的 Wordpress 和去年到现在的 Picky 都转移到 Octopress,目前表现良好,情绪稳定。

新的开始会更关注移动应用,毕竟是做这方面的,技术方面希望能输出一些代码吧。当然,生活碎碎念也肯定少不了。

Thanks to Douban

注册豆瓣1435天

Heyward at Douban has dead on 2011-11-19.

感谢豆瓣,通过你我找到了我想要的工作。 https://fann.im/blog/2010/12/25/thanksgiving-2010/

不要做让自己讨厌自己的事

如果一件事,你在做的时候自己心里有抵触,那就赶紧放手,至少想清楚后再决定。

如果做了一件事,后来回想起来的时候是无比讨厌,记住下次一定不要再这么做。

不要做让自己讨厌自己的事。

R.I.P. Steve Jobs

Thank you, Jobs.