马云的新诡计

25 Dec 2007 In: IT

马云对手下高管做调整,心腹全部下课。
外界所谓的分析师说马云正在”杯酒释兵权”。
但是
1.马云不是傻子
2.心腹做事,马云放心
3.已经成型的业务,交由职业经理人去做就好
4.马云又要做新东西了

如何识别真实的搜索引擎蜘蛛

21 Dec 2007 In: IT
<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
if (stristr($ua, 'msnbot') || stristr($ua, 'googlebot')) {
	//it's pretending to be MSN's bot or Google's bot
	$ip = $_SERVER['REMOTE_ADDR'];
	$hostname = gethostbyaddr($ip);
	if(!preg_match("/\.googlebot\.com$/", $hostname) && !preg_match("/search\.live\.com$/", $hostname)){
		//the hostname does not belong to either live.com or googlebot.com.
		//Remember the UA already said it is either MSNBot or Googlebot.
		//So it's a spammer.
		echo "Please leave";
	} else {
		//Now we have a hit that half-passes the check. One last go:
		$real_ip = gethostbyname($hostname);
		if ($ip != $real_ip) {
			//spammer!
			echo "Please leave";
		} else {
			//real bot
			echo "Welcome!";
		}
	}
}
?>

51挂挂

19 Dec 2007 In: IT

51挂挂
51挂挂
51挂挂

  • Comments Off
  • Tags:

丢包了

13 Dec 2007 In: 生活

先统计下损失:
两张会员卡,一张门禁卡,一张公交卡,三张信用卡,两张银行卡,一张身份证,现金若干

现金和卡倒没什么大问题,关键身份证丢失了,麻烦。。。

长这么大还是第一次丢钱包。。。

2007年终盘点

15 Nov 2007 In: 生活

虽然离2007年结束还有一个多月,但个人认为现在已经可以开始总结了。剩下的时间,变化不会很大。

1.DNSPod能继续做大,产品线能丰富到整个DNS相关领域
DNSPod目前已经是国内最大了。但产品线并没有任何变化,没有跟上需求。目标只能说是达成了一半。

2.Firefox Plus能做大
基本上没增长,任务没有完成。

3.学好一门外语,比如日语
有一次甚至去EF做了咨询,差点就掏钱。最后忍住了,给自己的理由是:花销太大,而且目前没精力。目前还在挣扎中。任务未完成。

4.拿到驾照
在最热的几个月份去学了车,还算比较顺利的拿到了,一次通过。任务完成。

5.买辆QQ(很幼稚吧?)
弄到一辆比QQ好的车,算是超额完成任务了。

6.月入过万
嗯。。大体上是达到了这个目标。

7.如果可能的话,我想坚持减肥
中途跑过一个星期。前三天轻了10斤,后三天又回来了。最后放弃。任务未完成。

8.把家人接来北京玩一段时间
本来计划是自己亲自回去接过来的,怕老人家不会坐飞机。最后在周围朋友的劝阻下,还是让他们自己坐飞机飞了过来,玩了几天后又自己坐飞机飞了回去。忘不了老爸老妈看到天安门那一刹的表情。

9.有余钱的话,还想炒炒股票,玩玩基金。(周围的人都在玩,受不了)
玩了,完了。亏多赚少。

总结:
9个目标,完成5个,完成一半1个,未完成3个,总体上很满意。

明年大体展望:
给自己一个安顿的理由,再给自己大点的压力。
1.还清家里的房贷
2.如果各方面的条件合适,购买第二套房。

统计项目的代码行数

12 Nov 2007 In: IT
wc -l `find trunk|grep .php|grep -v .svn`
  • Comments Off
  • Tags:

Day 1.成都-西安

3 Nov 2007 In: 生活

实际距离:705公里
过路费:18+125+5+190=338
油费:150

1.成绵高速快到绵阳有将近30公里的破旧水泥路面
2.绵广高速过嘉陵江后将会沿着江边走,为双向车道,注意山体落石,注意对面逆行过来的大货车
3.过了嘉陵江边后会上山、下山,注意对面货车和落石,还有注意控制车速,穿山洞的时候里面没有灯,注意光线的明暗变化
4.过了四川界结帐走人的时候会走一段国道,国道走完结帐的时候,顺着路右边走,在岔路口记得走右边道,前行一公里后就会上到西汉高速宁勉段了。
5.西汉高速上可以随意飙车,因为路上开几公里都难得见到一辆车。
6.西汉高速过了洋县就该开始小心了,因为这里开始进秦岭了,一路都是山洞和桥。进山洞记得开车灯。
7.西汉高速快跑完的时候,会穿过秦岭三号、二号、一号隧道。别小看这三个隧道,这三个隧道都是下坡的,在里面开你会觉得路面是水平的,但车速越来越快,所以,记得控制好车速,别开快,别老用刹车,避免刹车过热失灵。
8.过了秦岭三号隧道,就是著名的死亡路段,因为你将面临的是连续35公里的下坡+急弯路。没错,35公里,并且还是很多S形的急弯。如果你的车超载、超速、刹车不灵,那么你很有可能就会在这里挂掉。

关于秦岭路段:
1.设计很科学,隧道口的灯会非常亮,然后里面的灯会逐步暗下去,这样可以让人的肉眼很快能适应明暗的变化,减少事故的发生。
2.三号隧道后会有两个专门的坡道给刹车有问题的车用的,并且提前2公里就会有明显的提示。刹车有问题的车可以直接往坡上冲,坡上会有泥沙,顶部会有沙袋和一些防撞的设备。
3.施工单位说过不会污染环境的,但我发现一路上有不少隧道口旁边就扔了很大量的建筑废料,比如泥土、混凝土。
4.秦岭隧道真的很伟大。

漫长旅途

2 Nov 2007 In: 生活

day 1,成都-西安:800公里
day 2,西安-石家庄:830公里(西安-太原:611公里)
day 3,石家庄-天津:311公里(太原-天津:527公里)
day 4,天津-北京:100公里

新家

5 Oct 2007 In: 影像, 生活

搬了新家。
品一口Glenfiddich,俯瞰CBD,美景尽收眼中,何等快意!

DSCF6852

DSCF6853

iPhone数据库结构

1 Oct 2007 In: mac

/*
* iphone database structure
* @author zye
* @contact zye@tudou.com
* @update 20070924
* @version 0.1
* @url http://yegq.yeax.com/?p=162
* @copyleft 此文档可随意分发。如果你发布的iphone应用得益于此文档,建议注明,或给我email,共贺之。
*/
一、AddressBook.sqlitedb 通讯录数据库

location: /private/var/root/Library/AddressBook/AddressBook.sqlitedb

1.ABGroup 联系人分组信息
ROWID:组ID,自增PK
Name:组名

2.ABGroupChanges 分组信息更新
record:
type:

3.ABGroupMembers 组联系人
UID: PK
group_id:组ID,对应ABGroup.ROWID
member_type: 组员类别
member_id: 组员(联系人)ID,对应ABPerson.ROWID
注意:UNIQUE(group_id, member_type, member_id)

4.ABMultiValue 存储联系人的各种联系方式
UID: PK
record_id: 联系人ID,对应ABPerson.ROWID
property: 属性值. 3.电话; 4.email; 待补充…
identifier: 标识符.0,1,2,3,4,目前所知用于排序
label: 标志值. 1.mobile;2.home;3.work;4.other;5.homepage(URL) 对应ABMultiValueLabel.value
value: 值. 例如一个手机号码13800138000,或一个email地址foo@bar.com

5.ABMultiValueEntry (未知)
parent_id: (未知)
key: (未知)
value: (未知)
注意:UNIQUE(parent_id, key)

6.ABMultiValueEntryKey (未知)
value: (未知)
注意:UNIQUE(value)

7.ABMultiValueLabel 联系方式标志值列表
value: 见ABMultiValue.label

8.ABPerson
ROWID 自增PK,也是联系人的唯一标识
First 名字
Last 姓
Middle (未定)
FirstPhonetic (未定,貌似留作语音拨号用的)
MiddlePhonetic (未定,貌似留作语音拨号用的)
LastPhonetic (未定,貌似留作语音拨号用的)
Organization 所在公司,组织
Department 所在部门
Note 注释
Kind 未定
Birthday 生日
JobTitle 头衔
Nickname 昵称
Prefix 前缀
Suffix 后缀
FirstSort 排序用(具体未知)
LastSort 排序用(具体未知)
CreationDate 创建时间
ModificationDate 最后修改时间
CompositeNameFallback (未知)

9.ABPersonChanges (未知)
record
type

10.ABPersonMultiValueDeletes (未知)
record_id
property_id
identifier

11.ABPhoneLastFour 电话号码后四位匹配表
multivalue_id 对应ABMultiValue.UID
value 电话号码后四位

12.ABRecent (未知)
date
name
property
value

13.sorting_first_section_list (未知)
character
number

14.sorting_last_section_list (未知)
character
number

15.sqlite_sequence (用于记录序列)
name:表命,如ABPerson
seq: 最新序列号

— ==========下面是建表语句==========

CREATE TABLE ABGroup (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT);
CREATE TABLE ABGroupChanges (record INTEGER, type INTEGER);
CREATE TABLE ABGroupMembers (UID INTEGER PRIMARY KEY, group_id INTEGER, member_type INTEGER, member_id INTEGER, UNIQUE(group_id, member_type, member_id));
CREATE TABLE ABMultiValue (UID INTEGER PRIMARY KEY, record_id INTEGER, property INTEGER, identifier INTEGER, label INTEGER, value TEXT);
CREATE TABLE ABMultiValueEntry (parent_id INTEGER, KEY INTEGER, value TEXT, UNIQUE(parent_id, KEY));
CREATE TABLE ABMultiValueEntryKey (value TEXT, UNIQUE(value));
CREATE TABLE ABMultiValueLabel (value TEXT, UNIQUE(value));
CREATE TABLE ABPerson (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, First TEXT, Last TEXT, Middle TEXT, FirstPhonetic TEXT, MiddlePhonetic TEXT, LastPhonetic TEXT, Organization TEXT, Department TEXT, Note TEXT, Kind INTEGER, Birthday TEXT, JobTitle TEXT, Nickname TEXT, Prefix TEXT, Suffix TEXT, FirstSort TEXT, LastSort TEXT, CreationDate INTEGER, ModificationDate INTEGER, CompositeNameFallback TEXT);
CREATE TABLE ABPersonChanges (record INTEGER, type INTEGER);
CREATE TABLE ABPersonMultiValueDeletes (record_id INTEGER, property_id INTEGER, identifier INTEGER);
CREATE TABLE ABPhoneLastFour (multivalue_id INTEGER PRIMARY KEY, value TEXT);
CREATE TABLE ABRecent(date INTEGER, name, property INTEGER, value);
CREATE TABLE sorting_first_section_list(character, number, UNIQUE(character));
CREATE TABLE sorting_last_section_list(character, number, UNIQUE(character));
CREATE TABLE sqlite_sequence(name TEXT, seq INTEGER);

— ==========下面是创建索引==========

CREATE INDEX ABMultiValueRecordIDIndex ON ABMultiValue(record_id);
CREATE INDEX ABMultiValueLabelIndex ON ABMultiValue(label);
CREATE INDEX ABMultiValueEntryKeyIndex ON ABMultiValueEntry(KEY);
CREATE INDEX ABFirstSortIndex ON ABPerson(FirstSort);
CREATE INDEX ABLastSortIndex ON ABPerson(LastSort);
CREATE INDEX ABPhoneLastFourIndex ON ABPhoneLastFour(value);
CREATE INDEX ABRecent_value_index ON ABRecent(property, value);
CREATE INDEX ABRecent_date_index ON ABRecent(property, date);

— ==========下面是创建触发器==========

CREATE TRIGGER delete_phone_last_four AFTER DELETE ON ABMultiValue
BEGIN
DELETE FROM ABPhoneLastFour WHERE multivalue_id = OLD.UID;
END;
 
CREATE TRIGGER sorting_first_prefix_trigger AFTER INSERT ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number FROM sorting_first_section_list WHERE character = substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1)), 0));
END;
 
CREATE TRIGGER update_first_prefix_trigger AFTER UPDATE ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1), (SELECT number FROM sorting_first_section_list WHERE character = substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1)) - 1);
INSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number FROM sorting_first_section_list WHERE character = substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1)), 0));
END;
 
CREATE TRIGGER delete_first_prefix_trigger AFTER DELETE ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1), (SELECT number FROM sorting_first_section_list WHERE character = substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1)) - 1);
END;
 
CREATE TRIGGER sorting_last_prefix_trigger AFTER INSERT ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(NEW.LastSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number FROM sorting_last_section_list WHERE character = substr(IFNULL(NEW.LastSort, ‘~’), 1, 1)), 0));
END;
 
CREATE TRIGGER update_last_prefix_trigger AFTER UPDATE ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(OLD.LastSort, ‘~’), 1, 1), (SELECT number FROM sorting_last_section_list WHERE character = substr(IFNULL(OLD.LastSort, ‘~’), 1, 1)) - 1);
INSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(NEW.LastSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number FROM sorting_last_section_list WHERE character = substr(IFNULL(NEW.LastSort, ‘~’), 1, 1)), 0));
END;
 
CREATE TRIGGER delete_last_prefix_trigger AFTER DELETE ON ABPerson
BEGIN
INSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(Old.LastSort, ‘~’), 1, 1), (SELECT number FROM sorting_last_section_list WHERE character = substr(IFNULL(Old.LastSort, ‘~’), 1, 1)) - 1);
END;

二、notes.db 记事本数据库

location: /private/var/root/Library/Notes/notes.db

1.Note 摘要信息记录表
creation_date: 创建时间
title: 标题
summary: 摘要

2.note_bodies 详细信息
note_id: note ID
data: 记事内容,包含标题

– ==========下面是建表语句==========

CREATE TABLE Note (creation_date INTEGER, title TEXT, summary TEXT);
CREATE TABLE note_bodies (note_id INTEGER, DATA, UNIQUE(note_id));

– ==========下面是创建触发器==========

CREATE TRIGGER delete_note_bodies AFTER DELETE ON Note
BEGIN
DELETE FROM note_bodies WHERE note_id = OLD.ROWID;
END;

三、sms.db 短信数据库

location: /private/var/root/Library/SMS/sms.db

1.message 短信表
ROWID: 自增PK
address: 对方手机号码(+86)
date: 时间
text: 内容
flags: 标记. 2.收到的;3.自己发送的
replace: (未知)
svc_center: (未知)

– ==========下面是建表语句==========

CREATE TABLE message (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, address TEXT, date INTEGER, text TEXT, flags INTEGER, REPLACE INTEGER, svc_center TEXT);

CallData DB
/System/Library/Frameworks/AppSupport.framework/calldata.db

TABLE _SqliteDatabaseProperties
TABLE citycode
code (INTEGER)
Not sure what the significance of these entries are, I’m wondering if they have something to do with the geocoding of calls not made from your phonebook?
(3888)
city (TEXT)
Not sure what the significance of these entries are, I’m wondering if they have something to do with the geocoding of calls not made from your phonebook?
(RED CLOUD)
INDEX citycode_codeIndex
citycode (code)
TABLE npa
npa (TEXT)
Numbering Plan Area, aka Area Code
(415)
location (TEXT)
State/Province Assigned to the NPA
(CA)
country (TEXT)
Country Assigned to the NPA, may be null if “location” is specific enough
(USA)
TABLE npalocation
npa (TEXT)
Numbering Plan Area, aka Area Code
(415)
location (TEXT)
Descriptive location info
(San Francisco/North Bay Area)
TABLE npanxx
npa (INTEGER)
Numbering Plan Area, aka Area Code
(907)
nxx (INTEGER)
Unknown
(200)
rate_center (INTEGER)
Unknown
(1)
INDEX npanxx_npanxxIndex
npanxx (npa,nxx)
CallHistory DB
/private/var/root/Library/CallHistory/call_history.db

TABLE _SqliteDatabaseProperties
your values will certainly be different here…when you “restore” your iPhone from iTunes the counters all reset
key (TEXT) value (TEXT)
call_history_limit 100
timer_last 60
timer_outgoing 900
timer_incoming 540
timer_all 1440
timer_lifetime 1440
timer_last_reset
data_up_last 2.5439454125
data_down_last 20.86328125
data_up_all 719.9228515625
data_down_all 8677.8427734375
data_up_lifetime 719.9228515625
data_down_lifetime 8677.8427734375
data_last_reset
_ClientVersion 3
_UniqueIdentifier GUID
TABLE call
ROWID (INTEGER PRIMARY KEY AUTOINCREMENT)
Auto-incrementing field/counter
address (TEXT)
International-formatted foreign address
(18005551212)
date (INTEGER)
OSX-epoch based datetime, convertable via date -r
(1187200801)
duration (INTEGER)
Length of call in seconds rounded to next minute, 0 = missed call
(60)
flags (INTEGER)
Flags controlling the type of record
5 - Outgoing call
4 - Incoming call
id (INTEGER)
AddressBook ID for outgoing calls selected from AddressBook, otherwise -1
(67)
INDEX date_index
call (date)
KeyChain DB
/private/var/root/Library/Keychains/keychain-2.db
Encrypted, I don’t know how to parse this yet

Voicemail DB
/private/var/root/Library/Voicemail/voicemail.db

TABLE _SqliteDatabaseProperties
key (TEXT) value (TEXT)
VMVersion 4
_UniqueIdentifier GUID
token string containing various values, including your phone number
uid_validity 1183172695
mailboxusage 57
TABLE voicemail
ROWID (INTEGER PRIMARY KEY AUTOINCREMENT)
Auto-incrementing field/counter
remote_uid (INTEGER)
International-formatted foreign address
(18005551212)
date (INTEGER)
OSX-epoch based datetime, convertable via date -r
(1187200801)
token (TEXT)
Always reads “Complete” from what I can tell
sender (TEXT)
CallerID from the calling party leaving the voicemail message
(8885551212)
callback_num (TEXT)
Callback number left by calling party, usually caller ID
(8885551212)
duration (INTEGER)
Duration in seconds
(5)
expiration (INTEGER)
OSX-epoch based datetime, convertable via date -r
(1189431482)
trashed_date (INTEGER)
definitely based in seconds, haven’t figured out the epoch yet or why it isn’t the same as the other dates based on OSX’s epoch
flags (INTEGER)
Voicemail flags
0 - Not downloaded yet
1 - Partially downloaded
2 - New, unlistened or only partially listened to
3 - Listened completely
11 - Pending delete, in “Deleted Items”
15 - Deleted from iPhone, pending delete from voicemail hq
INDEX date_index
voicemail (date)
INDEX remote_uid_index
voicemail (remote_uid)
Other, more complicated DBs, involved in syncing
AddressBook DB
/private/var/root/Library/AddressBook/AddressBook.sqlitedb
AddressBook Images DB
/private/var/root/Library/AddressBook/AddressBookImages.sqlitedb
Maptiles DB
/private/var/root/Library/Caches/MapTiles/MapTiles.sqlitedb
Calendar DB
/private/var/root/Library/Calendar/Calendar.sqlitedb