Not exactly… There are some visible changes. I rewrote the theme of this blog using HTML 5 and CSS 3. Everything seems fine. But can someone please tell me why the following video does not work? (At least not in my Firefox 3.5.)
I tested this theme on Chrome under Windoze, and the video was normal. I don’t know what is wrong with my Firefox because it can play many other videos without problem.
经常看 IBM developerWorks 里关于 Linux 和 UNIX 的文章,不过大部分都看不懂。我一直以为是因为我太搓了,对 Linux 还不够了解。但是今天看到这篇文章以后,我觉得作者们应该承担一部分责任。
对于 Screen 这个东西,我是比较了解的,也经常在 SSH 的远程 shell 里用,所以我完全没期望看这篇文章的时候会遇到任何困难。但是,我看到文章里的第二个图的时候就愣住了。当然后来我反应过来了,然后对这个图极端的无语。首先,一般的地球人在看这种图的时候大多会从上至下的看。于是先看到一个很诡异的 Window A。WTF is “Window A”?? 如果读者很乖的看了图上面的文字介绍的话,会知道 window A 是一个 shell,再往下看,这个 shell 和一个叫做 Screen session 的云“连着”。很好,再往下,Screen session 和 Remote login “连着”,然后 Remote login 通过 SSH 和 Local login “连着”(原来老子在最底下!)。所以这个图很简单,就是四个连成一条链的东西。鉴于地球人都知道 Remote login 和 Local login 是通过网络连接的,一般的逻辑会自然的推出 Screen session 是一片网络云,window A 在云的另一边的某台主机上,于是恍然大悟:screen 的作用就是通过 Remote login 来管理在更 remote 的主机上的 window(很乖的人前来补充:也就是 shell)。
看懂这个以后,下面的事就顺理成章了。图 3 这个垃圾图和上面的图一模一样,不知道什么意思。图 4 说明 Screen 还可以透过网络云连接多台主机!太强大了!图 5 说明连接多台主机以后可以把 remote login 断掉,而 screen session 和他的 window 们还连着!太和谐了!
…
如何改进?很简单,把图都删了!用文字说明。如果一个地方不需要图,就别随便画个小猫小狗来充数。如果硬要画小猫小狗的话,起码也应该把 screen session 画在 remote login 的里面吧??然后把 windows 画在 screen session 的里面。这才像话。
我的 blog 发布程序 Charisma 更新了。
- 可以在配置里设置多个 blog,在程序中选择使用
- Tag 支持
我平时的需求基本都满足了,下一步可能是加上删除 post 功能。
在试用 Charm 未遂的情况下,我决定写自己的 blog 发布程序。看了一下 XML-RPC 的资料,发现 Python 对 XML-RPC 的包装极好,深得我心,于是简单的把 WP 的 API 包装了一下,开始想界面怎么写。Charm 使用了风格比较古老的菜单界面,我不是很喜欢。写起来比较简单的非交互式命令行参数界面好像也不是很合适,想来想去决定写一个类似 Mutt 的界面。
我以前从来没有用过 ncurse。看了一点 Python 的 curse 模块文档以后我发现我丫就是一个 curse/terminal 白痴,但我发扬了我党“一不怕苦,二不怕死”的大无畏精神,找到了一个从文档上看很强大的库 Urwid,开始写界面,结果写的痛不欲生,生不如死,flag 和全局变量满天飞… 总算把发布功能写完了。
以下是我写之前对程序的预期:
- 实现 WP XML-RPC 的全部功能
- 类似 Mutt 的界面
- 从配置文件里读取全部键绑定
- 配置文件里实现多 blog 配置
以下是已经实现的功能:
- 实现列出 post 和发布新 post 功能
- 类似 Mutt 0.0.1 的界面(估计值)
- 硬编码全部键绑定
- 硬编码 API URI, 用户名和密码
… 最后套用 Mutt 作者的话:All blog publishing programs suck. This one just sucks the most!
Edit: 这是在 Charisma 里编辑的。
With effort, I finally put one of my Django applications online. The situation is that HostMonster does provide the Python intepreter, but seems we are not suppose to use Python as a web app language because the Python is version 2.3, and no framework module is pre-installed. So I first installed the Dejango package to ~/.python, and did some searching to find this. According to this document, I copied my Django app to /my-web-root/latrine in which “latrine” was the name of my app, and wrote /my-web-root/latrine/.htaccess as
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ latrine.fcgi/$1 [QSA,L]
And wrote a latrine.fcgi script:
#!/usr/bin/env python
# -*- mode: python; -*-
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/my-web-root")
sys.path.insert(0, "/my-home/.python")
# Switch to the directory of your project. (Optional.)
# os.chdir("/my-web-root/latrine")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "latrine.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
And happily entered http://darksair.org/latrine/ in my browser, which displayed a very friendly 500 internal error. I was glad that I myself finally made a famous 500 error. After the excitement, I tried to locate the fault. I manually ran the fcgi script in a remote shell, and it was all right (Ok, except tons of Python trackbacks. But that was another thing.). So I decided that the problem was in .htaccess, which I sadly know nothing about… After some painful research I notied that the fastcgi module in HostMonster was actually fcgid-script instead of fastcgi-script. After fixing that in .htaccess, and did some simple Python debug, Latrine Live was online.
昨天做 blog 的文章首字突出显示,使劲看了一下 CSS 的 selector。Selector 分为 9 类
- Type selector, 就是地球人都会用的那种,
h1, p 什么的都是。CSS3 里引入了 namespace,也算在 type selector 里。
- Universal selector, 就是传说中的通配符
*。
- Attribute selector, 我昨天才知道 CSS 里有这么强悍的东西。比如
p[attr=blah] 会选择 <p attr="blah">. 还有很多其他的用法。
- Descendant selector, 一个空格,地球人都用的,比如
h1 em 表示包含在 h1 中的 em. 个人认为 CSS3 中的叫法 descendant combinator 更为准确。
- Child selector, 一个大于号。貌似很少用。这个也是表示从属关系,和 descendant selector 的区别是 child 只选择直接的下级。比如
<div><p><span>aaa</span></p></div> 中的 span 可以被 div span 选择,但是不能被 div > span 选择。个人认为 CSS3 中的叫法 child combinator 更为准确。
- Class selector & ID selector
- Adjacent sibling selector, 一个加号。
div + p, 选择紧跟在 div 后面的 p,并且这两个要有相同的父标签。个人认为 CSS3 中的叫法 adjacent sibling combinator 更为准确。在 CSS3 里还有一个和这个差不多的 general sibling combinator, 暂时还没搞明白怎么用。
- Pseudo-class. 很常用,我们用的最多的就是
a:visited, a:hover. 除了这个 a 系列以外,还有 :first-child 和 :lang. CSS3 中的 pseudo-class 就多得让人发指了,随便说几个::nth-child(), :nth-of-type(), :only-child …
- Pseudo-element, 经常和 pseudo-class 混,包括
:first-line, :first-letter, :before 和 :after. 在 CSS3 里,为了和 pseudo-class 区分,pseudo-element 的符号变成了两个冒号。
Pseudo-class 和 Pseudo-element 的区别
其实很简单。Pseudo-class 的冒号可以想象成 which is. Pseudo-element 的冒号(或两个冒号)可以想象成 ’s. 也就是说前者选择的是符合条件的冒号前面的东西,而后者选择的是冒号前面的东西的一部分。 感觉有点像面向对象的类包容和类继承~~
回到首字突出
在网上看到很多实现文章首字突出的方法,居然有很多是用 javascript 搞的… 其实完全用不着。我的方法是
.entry-content > p:first-child::first-letter
{
background-color: #2e3735;
float: left;
margin: -0.2em 0 -0.2em -1.15em;
padding: 0.2em 0 0.2em 0.15em;
font-family: Arno, Palatino, Georgia, Times, serif;
font-size: 3em;
border-radius: 0.2em;
-moz-border-radius: 0.2em;
-webkit-border-radius: 0.2em;
}
Reference
- http://www.w3.org/TR/CSS21/selector.html
- http://www.w3.org/TR/css3-selectors/
- http://www.w3.org/TR/CSS21/conform.html
Google 已经发布了用于 Pipboy 3000 的搜索界面。用户可以在 Fallout 3 按 TAB 调出 pipboy,然后按下波浪键 (~) 调出控制台,输入 google 回车,便可以在 Fallout 3 中使用 Google 搜索。Google 的产品经理 Doug Garland 同学说 pipboy 的搜索界面极大的方便了同学们的游戏过程,Google 以后还将发布类似的产品(比如 The Sims 3 中的搜索界面)。

看来有必要装一个反垃圾插件了。现在每天会收到 100+ 个垃圾 comments,我原来是把这些 comments 里的链接的域名部分加到 spam 列表里,后来发现每过几个小时这些 spam 就会换里面的链接… 又发现这些 spam 里都包含 comment[0-9],于是把 “comment” 加到 moderation list 里,很管用,但是每天又有那么多需要手动从 moderation list 移到垃圾箱里了…
Google 了一下,找到几个比较有意思的反垃圾插件:
- Challenge: 给写评论的人出一道题,打对才显示评论
- WPBayes: 这个比较强悍,使用了贝页斯过滤器…
- Referrer Bouncer: Er… 不知道这个是什么原理。
后面两个貌似都许久不更新了。还有一个 wp-spam-hitman,可以搞正则表达式匹配,应该很有用。暂时决定先试试 Challenge。
更新:装了一个 Antispam Bee,效果不错。又装了一个 is-human(),可以在评论页放一个随机问题,正在想问题中…
严格来讲不能叫第一天,不过是第一次开车。那个教练很强悍,为了鼓励我帮他推荐学生,态度极好,教的也很好。把两天的课程都学了,起步、停车、转弯、穿桩、直角弯、坡起、8 字弯、100 米加减挡,在路上以四档横冲直撞… 不过很简单,坡起我第一次就起来了。直角弯和 8 字弯一次也没上路沿,哈哈哈哈哈^^
BTW, WP 升级到 2.7.1 以后 K2 主题乱掉了,这是一个在 K2 用户中普遍发生的问题。我一度试图找到一个可以达到我这个主题的 PP 程度 10% 的 WP 暗色主题,未遂。后来重新 svn 了一个 K2,解决了。
总算把空间搞起来了。HostMonster 自带 Python 2.3 和 2.6,但是 2.6 的库不全,起码没有 select 库,2.3 是全的,很诡异。过几天装个 Django 试试。自己编译 Python 2.6 未遂,编译了一个 Emacs23 和 Htop。另外还搞了个相册,Gallery 的,很好很强大,在 community 的插件库里有个可以在 Google Maps 上标明照相地点的插件,以后可能会有用,但是这个相册缺乏对照片进行批量操作的能力。
下面还有很多事要做:
- 装 Django,把我的 Django 程序都放上来
- 把我的 wiki 搬过来。
今天去考交规了,89 分,太郁闷了… :-( 过了春节继续…
/* It's a GeShi test */
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}