Subacme

Personal weblog. Nonpersonal topics.

标签 ‘生活’ 的存档

在 Google Buzz 中隐藏某个来源的消息

尚无评论

Google Buzz 允许用户添加多个来源, 如自定义 RSS 馈送, flickr, 和 Twitter 等。 不少用户同步了自己的 Twitter 序列, 但这造成了大量重复的条目, 以及一些非 Twitter 用户的反感。 隐藏一个特定来源而不 unfollow 一位联系人, 一直是一个被期待的功能。 现在这个功能终於被实现了。

示例

要隐藏一个特定来源, 在 Google Buzz 中单击 (直接单击) 一个联系人的名字, 以转到他/她的 Buzz 消息页面。 现在在每个来源後方都有一个 Mute/Unmute 按钮, 用於对一个来源静音或解除静音。

VN:F [1.9.13_1145]
Rating: 0.0/5 (0 votes cast)

本文的作者为 Jetcheng Chu

发表於 2010 年 9 月 14 日 16:06

分类: 未分类

标签: ,

用 Makefile 记录编译次数

尚无评论

这是上一篇文章 Counting Build Number with Makefile 的翻译。

如果您喜欢不用 IDE 写代码, Makefile 可能是您无法避免的东西。然而用朴素的 make 自动记录编译次数, 实现起来可能需要一些技巧。

我所见到的大多数解决方案都依赖於专门的脚本, 这种方法既不优雅也不便於移植。这裡我将给出我的方法, 这个方法只依赖 echogrep (当然, 还有 GNU make), 这些工具几乎在所有平台上都可以使用。

利用 make 计数的主要障碍在於它缺乏数值运算。尽管人们通常用数码表示数字, 但数字也可以利用反覆出现的同一个符号来编码——比如, 两个苹果携带了信息 ‘2’。

因此, 我们可以让 make 做它能做的最简单的事情——每次向一个文件中添加一个固定的符号——然後用 grep 来统计这个符号出现的次数, 也就是编译次数。

下面是一个完整的 Makefile, 供您尝试。它利用文件 .BuildCounter 来存储编译次数, 並向文件 BuildCount.inc 写入一行 BuildNumber = N;, 其中 N 为编译次数。

__COUNTER_FILE__ = .BuildCounter
__COUNTER_INC_FILE__ = BuildCount.inc
ifeq ($(wildcard $(__COUNTER_FILE__)),)
$(shell echo > $(__COUNTER_FILE__))
endif
$(shell echo $$ >> $(__COUNTER_FILE__))
$(shell echo BuildNumber = $(shell grep -c -F $$ $(__COUNTER_FILE__))\; > $(__COUNTER_INC_FILE__))

default:
        @more $(__COUNTER_INC_FILE__)

单击此处下载该文件。

VN:F [1.9.13_1145]
Rating: 5.0/5 (1 vote cast)

本文的作者为 Jetcheng Chu

发表於 2010 年 8 月 12 日 1:16

分类: 未分类

标签: ,

Counting Build Number with Makefile

尚无评论

If you prefer writing code without an IDE, Makefile is something you probably can’t avoid.  With plain make, however, automatic build number counting can be tricky to implement.

Most of the existing solutions (to my knowledge) rely on ad hoc scripts that are neither elegant nor portable.  Here I’ll give my solution that relies solely on echo and grep (and, of course, GNU make), virtually available on all platforms.

The major obstacle to counting numbers with make is the absence of numerical operations.  While a number is usually represented with a numeral, it can also be encoded with repeated usage of a constant symbol—for example, two apples carry the information ‘2-ness’.

Therefore, the idea is to make make do the simplest it can do—adding a symbol to a counter file each time—and use grep to count the number of appearance of that symbol, i.e. the build number.

Below is a complete Makefile for you to try out.  It uses the file .BuildCounter to store the build number, and writes the string BuildNumber = N; to the file BuildCount.inc, where N is the build count.

__COUNTER_FILE__ = .BuildCounter
__COUNTER_INC_FILE__ = BuildCount.inc
ifeq ($(wildcard $(__COUNTER_FILE__)),)
$(shell echo > $(__COUNTER_FILE__))
endif
$(shell echo $$ >> $(__COUNTER_FILE__))
$(shell echo BuildNumber = $(shell grep -c -F $$ $(__COUNTER_FILE__))\; > $(__COUNTER_INC_FILE__))

default:
        @more $(__COUNTER_INC_FILE__)

Click here to download this file.

VN:F [1.9.13_1145]
Rating: 4.0/5 (1 vote cast)

本文的作者为 Jetcheng Chu

发表於 2010 年 8 月 12 日 0:35

分类: 未分类

标签: ,

有点怀旧

有 2 条评论

在这个过敏的日子, 请原谅我因为平凡的怀旧单独发布一篇如此支离破碎的 “文章”。

Apple iMac G3

Samsung SDC 80

只是我由衷地想起, 1999 年前後的数字产品, 仿佛一度流行使用带颜色的透明外壳。

这潮流定是从 iMac G3 开始的。

忘了是哪年, 我跟两个同学跑了好远, 为了几张五颜六色的软盘, 把兜裡仅有的十几块钱花了个精光。

好像是 Sony 的罢。

虽然後来发现它们不能用, 我还是心满意足。

五六年级的样子, 短短几年的时间。可今天回想起来, 那却是一个时代。

VN:F [1.9.13_1145]
Rating: 0.0/5 (0 votes cast)

本文的作者为 Jetcheng Chu

发表於 2010 年 6 月 4 日 19:33

分类: 未分类

标签: ,