基于应用场景的数据特征,Facebook 抽象出了几个对存储系统的需求。由于描述起来有些复杂,例如 Efficient and low-latency strong consistency semantics within a data center,这些需求就不一一列举了。相比需求,更让人感兴趣的是它的那些“非需求”,总共有三条:
# 转换 Unix 时间到本地时间字符串
function ctime()
{
date -d "UTC 1970-01-01 $1 secs"
}
使用方法很简单:
$ ctime 1234567890
Sat Feb 14 07:31:30 CST 2009
对 date 命令熟悉的同学会说,date 不是已经有直接转 Unix 时间的参数了吗?
$ date -d @1234567890
Sat Feb 14 07:31:30 2009
但是不好意思的是,小弟有时候用的 date 程序好老,不支持 @ 符号。
$ date --version
date (coreutils) 5.2.1
Written by David MacKenzie.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PS: 写完这篇博文,我又想到了一个有趣的事情,既然很多 Linux 64 位版本的 time_t 已经是 long long 格式了,那么 date 命令有没有 year 2038 问题呢?
下面是 date (coreutils) 5.2.1 在 64 位服务器上的尝试结果:
$ date +%s -d "Tue Jan 19 11:14:07 CST 2038"
2147483647
$ date +%s -d "Tue Jan 19 11:14:08 CST 2038"
2147483648
$ date +%s -d "Tue Jan 19 11:14:09 CST 2999"
32473710849
$ ctime 2147483647
Tue Jan 19 11:14:07 CST 2038
$ ctime 2147483648
Sat Dec 14 04:51:44 LMT 1901
$ ctime 32473710849
Mon Mar 28 07:33:53 LMT 1910
5.7.x has more new features, but their source code has not been disclosed.
4.3.x are developed on the Poderosa project and you can get their source code.
Some features from 5.7.x were added to 4.3.x.
...
I believe that the terminal emulation of 4.3.x would be better than 5.7.x's.
$ grep class /usr/include/c++/4.5/stdexcept
// Standard exception classes -*- C++ -*-
// ISO C++ 19.1 Exception classes
* program runs (e.g., violations of class invariants).
* @brief One of two subclasses of exception.
class logic_error : public exception
class domain_error : public logic_error
class invalid_argument : public logic_error
class length_error : public logic_error
class out_of_range : public logic_error
* @brief One of two subclasses of exception.
class runtime_error : public exception
class range_error : public runtime_error
class overflow_error : public runtime_error
class underflow_error : public runtime_error
于是我想到了在坛子里的第二印象,提权之后删掉自带的应用就干净了。于是我就 recovery,提权啥的,总算把垃圾应用删完了,这下该能用了吧。然后我发现,咦,Gtalk 呢?电子市场呢?同步 Gmail 联系人的地方呢?都去哪儿了?然后就开始搜啊搜,有人说得装 Google 服务包,结果下了N个装上都不管用。最后我搞明白了一个道理:行货手机自带系统是不能用 Google 服务的,除非有人专门弄出来一个针对它的 Google 服务包。坑爹啊!你们坛子里讨论这个 ROM、那个 ROM,肿么没人说联通定制 ROM 不能用 Google 服务呢?如果这样我还费劲提个屁权啊!
于是只好刷机了。其实华为家有一点比较好的地方,就是如果某款手机也在国外或者香港销售的话,找一个标准干净的官方 ROM 比较容易(垃圾的东西只敢用来欺负自己人),而且使用的是官方的比较安全的固件升级方法。比如 U8800 就有海外版 ROM,从华为的官网上能下到,下来之后直接看帮助文件就可以,不用从论坛上找什么安装方法。
我真的无法理解这些国内厂商,用别人开源的手机操作系统,却要把别人的服务全抹了去,这是怎样一种忘恩负义!还有一个关键是,你又无法提供更好的服务!拿我来说,为什么一定需要 Google 服务?因为我的联系人全在 Gmail 里,我的日程安排是通过 Google Calendar 双向同步到电脑和手机。光这两点,我就必需连接到 Google 服务。我敢把联系人全部存到开心网吗?我敢用手机直连我公司的 Exchange 服务器吗?