百无聊赖时收到爸爸的短信:今天去医院的路上路过喜园,看见求的对联已经挂上了。你认为如何?告之以博一笑。
喜园是贵阳的一家酒店,就在我家附近,群众基础颇高,啥时候去人都挺多,我初中三年上下学都会路经此地,只是那时候还不叫喜园罢了。这里和我们也颇为有缘,05年我和小宝结婚时父母的认亲酒就在这里办的,所以每次回去但凡路过这里,就觉很亲切。上次回家时,喜园已经改为店名为“鱼咬羊”了。鱼咬羊是安徽名菜,由于淮北地区民俗喜食羊肉,原为羊肉汤中煨鲫鱼成奶汤菜。后改良用了桂鱼,桂鱼膛较大,由口中绞出内脏,灌入羊肉,小火红烧,菜做好后鱼体完整,腹中有羊肉,鱼不腥,羊不膻,鲜美无比。
新店一开,鱼咬羊就在店内外招贴告示:出一上联,向各方征集下联,对出者奖励500元。爸爸说这段时间照顾你妈太忙,等闲下来再好好给他们对一个。爸爸没闲下来,人家下联已经挂出来了:
上联为:桌桌有鱼鱼羊为鲜;下联为:人人尽兴兴言成誉;
横批:鱼咬羊
我给爸回短信:对得不错。席席有羊羊大为美,如何?取其鲜美之意。会议还在继续,激烈依旧。随着爸爸的短信神游回来不由感叹,生活在中小城市,才更能真正体会生活之美。
大部分web引用统计系统都实现了基于站内的点击行为分析,但是对于点出到其他网站的链接,由于点出链接地址不一定都部署了相通的统计。那么这些点击行为就要在链接所在的页面在点击的时候触发统计了。传统的是中间转向页面,但这样的链接机制非常不利于SEO,给蜘蛛带来了大量的麻烦用于识别真正的目标地址;之前介绍过一些基于鼠标触发机制的页面点出统计方法: 一般是通过在点击的时候触发在当前页面插入一个 img bean,然后统计相应的img 请求实现,现在连这样的点击触发器在Google Analytics统计中也可以自定义实现了: 以下例子在页面点击的时候,会触发Google Analytics生成一个对clickto/TAGET_URL 一个自定义的地址(clickto实际上不存在的)请求访问;
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-69476-1");
pageTracker._addOrganic("baidu","word");
pageTracker._addOrganic("soso","q");
pageTracker._addOrganic("vnet","kw");
pageTracker._addOrganic("yodao","q");
pageTracker._initData();
pageTracker._trackPageview();document.onclick = function(e) {
e = e || event;
var el = e.target || e.srcElement;
if ( el.tagName=='A' ) {
pageTracker._trackPageview("\/clickto/" + window.location.href.replace("http:\/\/www.chedong.com/", "") +
el.href.replace("http:\/\/", "\/"));
}
}
</script>
感谢XD同学,这个点出统计例子从very.cd上学到的;
一个好的例子胜过长篇大论,可以看到very.cd通过对onclick的触发机制,结合站内的cookie等还实现了客户回访率统计等;
When optimizing queries for customers, the first thing I do with a slow query is figure out what it's trying to do. You can't fully optimize a query unless you know how to consider alternative ways to write it, and you can't do that unless you know what the query "means." I frequently run into a situation where I'm forced to stop and ask the developers what they were trying to do with COUNT(). This is database-agnostic, not related to MySQL.
The problem is when the COUNT() contains a column name, like this:
If you know your SQL well, you know COUNT() has two meanings. 1) count the number of rows 2) count the number of values. Sometimes, but not always, these are the same thing. COUNT(*) always counts the number of rows in the result. If you write COUNT(col1) it counts the number of times col1 is not null. If it's never null, the result is the same as the number of rows.
The problem with that is that you don't know by looking at the query whether the developer wanted to count rows or values -- or, quite possibly, the number of distinct values in that column. You see, there's another form for COUNT():
So when I see a query that just does COUNT(col1) I am left with these guesses:
It is impossible to read the developer's mind in these cases, so I always end up getting stalled waiting for them to reply and tell me what the query means so I can optimize it.
A good coding standard can help here -- you can quickly write a tool to grep your source code and search for instances of such constructs, and flag them as errors unless some magic comment is embedded in the code next to them:
Alas, there is a lot of misinformation on the web about COUNT(), so it is not a good place to learn about what it does. 90% of what you can find online is just wrong. So I would advise a good book on the topic, except I can't think of one -- maybe Joe Celko's books address this topic clearly? What's your recommendation?
Entry posted by Baron Schwartz | 7 comments
九月 2008 | ||||||
一 | 二 | 三 | 四 | 五 | 六 | 日 |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |