I have installed the editor named Drivel for blogspot, but how to use this editor is a problem for me, so, this just is a test log
11/27/2008
11/23/2008
解决Ubuntu8.04中mysql中文乱码
昨天刚在笔记本上安装Ubuntu 8.04,按照步骤安装了apt的mysql数据库,然后将现有的开发数据库导入(基于UTF-8),发现浏览的时候出现乱码现象,所以解决办法:
1 确认Mysql的编码
通过客户端进入mysql,执行
mysql>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
确认是编码问题
2 找到mysql的配置文件,修改/etc/mysql/my.cnf
sudo gedit /etc/mysql/my.cnf
在my.cnf文件中的[client]段和 [mysqld]段加上以下两行内容:
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
3 需要重启mysql服务
sudo /etc/init.d/mysql restart
4 查看一下现在mysql的编码
sudo mysql -u root -p
mysql>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8|
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
5 编码正确,由于刚才导库的时候是基于错误编码的基础上作的,所以,会有编码的问题,因此,删除刚才导入的数据库,重新导入,打开页面,OK!
11/20/2008
macchanger
macchanger 和 ifconfig [interface] hw ether [MAC] 的功能一樣, 可以變更網路卡卡號,
但並不是實體地修改卡號, 重開機後仍會回復, 嚴格說起來是可以設定網路卡卡號.
另外一個好用功能是可以查詢 vendor
查詢本機 eth0
# macchanger -s eth0
Current MAC: 00:02:b3:9b:b9:ba (Intel Corporation)
查詢 00:e0:4c 開頭是那一家做的
# macchanger -l | grep 00:e0:4c
7079 - 00:e0:4c - Realtek Semiconductor Corp.
列出 D-Link 的 MAC list
# macchanger --list=D-Link
Misc MACs:
Num MAC Vendor
--- --- ------
Wireless MACs:
Num MAC Vendor
--- --- ------
0012 - 00:05:5d - D-Link DWL-650, DWL-650H
0013 - 00:06:25 - Linksys WPC11 v2.5, D-Link DCF-650W, Linksys WPC11 v3
# macchanger --list=D-link
Misc MACs:
Num MAC Vendor
--- --- ------
1374 - 00:05:5d - D-link Systems, Inc.
3426 - 00:0d:88 - D-link Corporation
3863 - 00:0f:3d - D-link Corporation
5340 - 00:50:ba - D-link
5862 - 00:80:c8 - D-link Systems, Inc.
Wireless MACs:
Num MAC Vendor
--- --- ------
指定 keyword 大小寫有差, 資料檔 /usr/local/share/macchanger/OUI.list 的內容, 大小寫並沒有統一,
還是用 macchanger -l | grep -i keyword 比較實用
11/16/2008
使用svnsync镜像版本库
术语
* 主(Master): 将要通过svnsync被同步的活动读/写版本库。
* 镜像(Mirror): 将要与master通过svnsync同步的只读版本库。
注意,svn的版本要大于1.4
实现
实现svnsync的唯一的前提条件是创建一个希望镜像的版本库,一旦创建,你就可以按照下面步骤继续:
Step 1: 创建镜像Repository
svnadmin create MIRROR_REPO_PATH
Step 2: 设置镜像版本库只对同步用户可写
为了让镜像版本库只被同步用户写,我们的例子里用户名是”svnsync”,我们有一些选项,一个就是使用Subversion的授权功能设置缺省的访问规则(在auth文件里设置):
[/]
* = r
svnsync = rw #MIRROR_REPO_USER
Step 3: 让镜像版本库使用同步用户修改修订版本属性
为此,我们需要创建一个pre-revprop-change钩子,类似于下面的例子,也是shell脚本,在hook文件夹里,有一个建立一个per-revprop-change的文件(不用管他的模版文件),将下面的内容复制:
#!/bin/sh
USER="$3"
if [ "$USER" = "MIRROR_REPO_USER" ]; then exit 0; fi
echo “Only the syncuser user may change revision properties as this is a read-only, mirror repository.” >&2
exit 1
然后修改这个文件的属性为777
Step 4: 注册同步的镜像版本库
在任何平台使用下面的svnsync命令:
svnsync initialize URL_TO_MIRROR_REPO URL_TO_MASTER_REPO --username=MASTER_REPO_USER --password=MASTER_REPO_PASSWD
如果所有的配置正确,你一定会看到下面的输出:
Copied properties for revision 0.
如果有错误,一般就是上步钩子的问题,仔细阅读错误信息,可以纠正。现在你已经注册了镜像版本库与主版本库的同步,我们必须继续执行初始的同步,这样镜像版本库才和主版本库是一样的了。
Step 5: 执行初始同步
为了确定所有事情已经准备好了,并且执行初始同步,在任何系统只需要执行:
svnsync synchronize URL_TO_MIRROR_REPO --username=MASTER_REPO_USER --password=MASTER_REPO_PASSWD
如果所有的同步正确,你会看到类似的输出:
Committed revision 1.
Copied properties for revision 1.
Committed revision 2.
Copied properties for revision 2.
Committed revision 3.
Copied properties for revision 3.
不过在这里可能会出现 “svnsync: Couldn't get lock on destination repos after 10 attempts”类似的报错,你需要手动清除lock
svn pdel --revprop -r 0 svn:sync-lock --username=MIRROR_REPO_USER URL_TO_MIRROR_REPO
Step 6: 使用post-commit钩子自动同步
根据初始同步的输出,我们现在要做的就是写一个定时执行或post-commit钩子来同步镜像版本库,我建议post-commit,因为它让你的镜像版本库尽可能的最新,下面是可以用在主版本库上同步镜像版本库的post-commit钩子,一个shell脚本:
# Example for synchronizing one repository from the post-commit hook
#!/bin/sh
SVNSYNC=/usr/local/bin/svnsync
$SVNSYNC synchronize URL_TO_MIRROR_REPO –username=svnsync –password=svnsyncpassword &
exit 0
就这样了,一旦你执行了上面列出的步骤,你一定可以得到一个随着主版本库提交自动更新的镜像版本库,我们对于svnsync的介绍和如何去实现它。
if 和 switch 语句效率比较
在 switch 语句中条件只求值一次并用来和每个 case 语句比较。在 elseif 语句中条件会再次求值。如果条件比一个简单的比较要复杂得多或者在一个很多次的循环中,那么用 switch 语句可能会快一些。
以上为 php 手册在叙述 switch 中的一句,该怎么理解呢?
从整体效率上看,是相当的。但区别存在于呢?举个例子
if ($noizy==1) {
echo "noizy1";
} elseif ($noizy==2) {
echo "noizy2";
} elseif ($noizy==3) {
echo "noizy3";
}
以上是 if 代码的一个片段,在最差的状况下,也就是当 $noizy = 3 时,共运行了3次比较,而且,每次比较都必须取出 $noizy 的值一次。如果换成 switch
switch ($noizy) {
case 1:
echo "1";
break;
case 2:
echo "2";
break;
case 3:
echo "3";
break;
}
只在开头 switch 的括号中取出 $noizy 的值,然后把值与case值逐一进行比较
效率的差别就在这儿,因此我总结几点:
1.当只进行一次比较时,推荐使用 if,原因很简单,此时 if 与 switch 没有本质区别,而用 if 代码较为简洁,省去多余字节,可乐而不为?
2.当多次纯粹的比较数字或字符时,推荐使用 switch,当进行N次比较,switch 只取值一次,而 if …… elseif 则取值 1 <= x <= N (x 为实际次数)。
3.当遇到复合条件时,应该视情况而灵活运用 if 与 switch。
11/15/2008
Ubuntu下图像工具
Scrot
是一个命令行下使用的截图工具,支持全屏、窗口、选取、多设备、缩略图、延时,甚至可以截图完毕之后指定某程序打开截好的图片。
安装:
可以打开新立得搜索 scrot 并安装,也可以在终端:
sudo apt-get install scrot
Scrot 使用:
scrot [options] [file]
描述
scrot 是一个使用 imlib2 库截取屏幕和保存图像的的工具。
选项 [file] 指定截图保存的文件名。 如果 [file] 没有指定,
截图就会以当前的日期和时间为文件名保存在当前目录中。
选项
-h, --help
显示帮助并且退出
-v, --version
显示版本信息并且退出
-b, --border
当选择一个窗口时,同时包含窗口边框。
-c, --count
延时时的显示倒计时
-d, --delay NUM
延时 NUM 秒
-e, --exec APP
对保存的图像执行程序 APP
-q, --quality NUM
图像质量 (1-100) 值大意味着文件大, 压缩率低。
-m, --multidisp
对多个显示设备分别截图并且连接在一起。
-s, --select
用鼠标交互式的选择一个窗口或者区域。
-t, --thumb NUM
同时生成缩略图。 NUM 是缩略图的百分比。
说明符
--exec 和 文件名可以使用可以被 scrot 扩充的格式说明符。有两种类型的
说明符。 '%' 前导的说明符由 strfile(2) 来解释。例程可以查看 strftile
手册。这些选项用来引用当前的日期。第二种说明符由 scort 内部解释并且
使用前缀 '$'. 可以识别的说明符如下:
$f 图像的路径/文件名 (如果在文件名中就会忽略)
$n 图像文件名 (如果在文件名中会被忽略)
$s 图像大小(字节数) (如果在文件名会被忽略)
$p 图像像素大小
$w 图像宽度
$h 图像高度
$t 图像格式
$ 打印字符 'n 打印新行 (如果在文件名中会被忽略)
例子(~ 用户主目录):
1、对全屏截图并保存文件名:
scrot ~/abc.png
2、抓取窗口,b 参数表示带边框窗体,s 用户可以指定窗口:
scrot -bs ~/abc.png
3、抓取鼠标选定区域:
scrot -s ~/abc.png
4、延时抓取,d 表示延时,c 倒计时,10 是秒,抓菜单等其他东西时很好用:
scrot -cd 10 ~/abc.png
5、生成缩略图,t 表示要生成缩略图, 20% 表示缩略图的比例, s 表示截取用户划定区域:
scrot -t 20% -s ~/abc.png
6、启用某项操作 s 划定截图,-e 采用某项行为,这里用 gimp 打开截图图片,
scrot -s ~/abc.png -e 'gimp $f'
agave (龙舌兰)
非常不错,除了取色,配色,还可以将常用的颜色保存起来以备以后使用,apt-get之后就可以使用了
sudo apt-get install agave
Network tools in ubuntu
Wireshark
世界上使用Wireshark的人相当多。它具有一个协议分析程序的全部基本特性,而且还有其它产品所没有的其它特性。其开放源代码文本专利允许专业人员对其进行功能增强的工作。它可以运行在各种计算平台上,其中包括Unix,Linux,Windows等等。
(1)安装
sudo apt-get install Wireshark
(2)运行
如果你想打开Wireshark,可以打开Applications(应用程序)―>Internet(互联网)―> Wireshark
Etherape
EtherApe是Unix系统中的一个图形界面的网络监视器,能够以图形方式显示网络活动。主机和链接通信量的大小可以动态显示。它支持Ethernet、 FDDI、 Token Ring、ISDN、 PPP 、 SLIP等网络类型的设备。它可以过滤显示的通信,并能够从一个文件中读取通信数据,也可以从网络中读取动态数据。
(1)安装
sudo apt-get install etherape
(2)运行:
要运行etherape只需单击Applications―>Internet―>EtherApe:
在打开之后,你就可以看到所有网络协议的所有网络活动。
Ethstatus
Ethstatus是一个基于控制台的监视程序,用以显示以太网接口的统计数据。它与intraf类似,不过它以一个永久性控制台任务的形式运行,并可监视网络负载。
(1)安装
sudo apt-get install ethstatus
如果只是想在命令行上查看网卡的状态,可以直接输入如下的命令:
ethstatus
Install Flex builder in Ubuntu 8.0.4
The blog that follow use a ubuntu 8.04 computer
1 install jre
#sudo apt-get install sun-java6-jre
#sudo update-alternatives --config java
There are 2 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-6-sun/jre/bin/java
Press enter to keep the default[*], or type selection number:
choice 2
Then,
#sudo gedit /etc/environment
add the following 2 lines:
CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME=/usr/lib/jvm/java-6-sun
then,
#sudo gedit /etc/jvm
put the following to the top of this document
/usr/lib/jvm/java-6-sun
2 download flexbuilder_linux_install_a4_081408.bin and pdt-all-in-one-linux-gtk-1.0.3.tar.gz
Note:The version of eclipase must great than 3.2, so do not install it use
#sudo apt-get install eclipse
3 install flex builder
# ./flexbuilder_linux_install_a4_081408.bin
The solution without libgtk when install uplink in ubuntu
When I installed the linux game Uplink, There was an error:
edwin@edwin-desktop:~/Desktop$ sh ./uplink-demo-1.54.sh
Verifying archive integrity... All good.
Uncompressing Uplink demo 1.54DEMO...........................................................................................
/home/edwin/.setup10083: error while loading shared libraries: libgtk-1.2.so.0: cannot open shared object file: No such file or directory
So, I install the following:
sudo apt-get install libgtk1.2
sudo apt-get install libgpm1
在ubuntu安装其他主题
Ubuntu Studio
酷炫的Ubuntu Studio主题套件
代码:
sudo apt-get install ubuntustudio-themeubuntustudio-icon-theme ubuntustudio-gdm-theme ubuntustudio-wallpapers usplash-theme-ubuntustudio
Mac4Lin
进入Mac4Lin的工程主页:http://sourceforge.net/projects/mac4lin
点击 Download,然后把需要的软件包下载下来吧!
11/08/2008
Software versioning
一、版本号
1、V(Version):即版本,通常用数字表示版本号。(如:EVEREST Ultimate v4.20.1188 Beta)
2、Build:用数字或日期标示版本号的一种方式。(如:VeryCD eMule v0.48a Build 071112)
3、SP:Service Pack,升级包。(如:Windows XP SP 2/Vista SP 1)
二、授权和功能划分
1、Trial:试用版,通常都有时间限制,有些试用版软件还在功能上做了一定的限制。可注册或购买成为正式版。
2、Unregistered:未注册版,通常没有时间限制,在功能上相对于正式版做了一定的限制。可注册或购买成为正式版。
3、Demo:演示版,仅仅集成了正式版中的几个功能,不能升级成正式版。
4、Lite:精简版。
5、Full:完整版。
三、开发阶段划分
1、Alpha 版:内测版,内部交流或者专业测试人员测试用。Bug较多,普通用户最好不要安装。
2、Beta 版:公测版,专业爱好者大规模测试用,存在一些缺陷,该版本也不适合一般用户安装。
3、Gamma 版:相当成熟的测试版,与即将发行的正式版相差无几。
4、RC版:Release Candidate 候选版本,处于Gamma阶段。从Alpha到Beta再到Gamma是改进的先后关系,但RC1、RC2往往是取舍关系。
四、语言划分
1、SC:Simplified Chinese 简体中文版。
2、GBK:简体中文汉字内码扩展规范版。
3、TC:Traditional Chinese 繁体中文版。
4、BIG5:繁体中文大五码版。
5、UTF8:Unicode Transformation Format 8 bit,对现有的中文系统不是好的解决方案。
Developing Product based on the SVN
Repository Layout
We create a trunk directory to hold the “main line” of development, a branches directory to contain branch copies, and a tags directory to contain tag copies.These top-level directories is :
/trunk
/branches
/tags
1. trunk
The porpose of trunk is for branching, tagging, and merging the source code.
2. branches
Branch , a line of development that exists independently of another line, it always begins life as a copy of trunk's at sometime, and moves on from there, generating its own history.
Type A: maintainable branches for released version
Type B: feature-developing branches for new requirement
3. tags
A tag is just a “snapshot” of a project in time.The aim of tags to save the stable release version of product, there is an new maintainable branch should be build at the same time, just for the patch and issue solution
11/06/2008
Singleton pattern in PHP 5
1类别: 创建型设计模式
2意图: 确保一个类只有一个实例,而且自行向整个系统提供这一个实例(类本身提供一个实例的全局访问点)
3代码:
class Singleton {
// 用静态变量来存储signleton的实例
private static $_instance;
// 私有的构造器阻止New
private function __construct() {
...
}
// 避免除了New外,用户可以通过clone和序列化来获得多个singleton的实例
public function __clone() {
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
public function __wakeup() {
trigger_error('Deserializing is not allowed.', E_USER_ERROR);
}
//用layz load 的方法,获得唯一实例
public static function getInstance() {
if (!self::$instance instanceof self) {
self::$instance = new self;
}
return self::$instance;
}
//singleton的实际作用
public function doAction() {
...
}
}
//usage
Singleton::getInstance()->doAction();
?>
更多: http://www.tonymarston.net/php-mysql/singleton.html
http://en.wikipedia.org/wiki/Singleton_pattern
How to publish source code in Blogger.com
Wordpress有许多代码语法高亮插件可以便捷地展示源代码,但是Blogspot我还发现此类的应用。不过我们可以让google prettify code为Blogspot着色代码。
google prettify code是一个轻量级的Javascript模块通过CSS文件对代码进行上色处理,支持C、Java、PHP、Python、HTMLl和Javascript等十几种语言。让我们动手吧。
1.进入Blogspot控制台 –>布局 –>修改HTML
在head区调用google prettify code的Javascript和CSS文件:
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" rel="stylesheet" type="text/css"/>
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js" type="text/javascript"/>
2.将“”改成“”
3.修改pre标签的CSS以适合您的使用。
pre {
margin: 5px 20px;
border: 1px dashed #666;
padding: 5px;
background: #f8f8f8;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
现在可以写一篇博客试一下了,将您的代码放在pre标签内,给pre加上class为“prettyprint”,即:
<pre class="”prettyprint”">your code
</pre>
11/03/2008
Gnome Keyboard Shortcuts
Tired of using your mouse so much? Did you know that Gnome has keyboard shortcuts for just about everything you can do with a mouse? Here's a list of the various shortcuts on both platforms.
General Shortcut Keys
Alt + F1 | Opens the Applicantions Menu . |
Alt + F2 | Displays the Run Application dialog. |
Print Screen | Takes a screenshot. |
Alt + Print Screen | Takes a screenshot of the window that has focus. |
Ctrl + Alt + right arrow | Switches to the workspace to the right of the current workspace. |
Ctrl + Alt + left arrow | Switches to the workspace to the left of the current workspace. |
Ctrl + Alt + up arrow | Switches to the workspace above the current workspace. |
Ctrl + Alt + down arrow | Switches to the workspace below the current workspace. |
Ctrl + Alt + d | Minimizes all windows, and gives focus to the desktop. |
F1 | Starts the online help browser, and displays appropriate online Help. |
Window Shortcut Keys
Alt + Tab | Switches between windows. When you use these shortcut keys, a list of windows that you can select is displayed. Release the keys to select a window. |
Alt + Esc | Switches between windows in reverse order. Release the keys to select a window. |
F10 | Opens the first menu on the left side of the menubar. |
Alt + spacebar | Opens the Window Menu . |
Arrow keys | Moves the focus between items in a menu. |
Return | Chooses a menu item. |
Esc | Closes an open menu. |
Ctrl + Alt + right arrow | Switches to the workspace to the right of the current workspace. |
Ctrl + Alt + left arrow | Switches to the workspace to the left of the current workspace. |
Ctrl + Alt + up arrow | Switches to the workspace above the current workspace. |
Ctrl + Alt + down arrow | Switches to the workspace below the current workspace. |
Ctrl + Alt + d | Minimizes all windows, and gives focus to the desktop. |
Panel Shortcut Keys
Ctrl + Alt + Tab | Switches the focus between the panels and the desktop. When you use these shortcut keys, a list of items that you can select is displayed. Release the keys to select an item. |
Ctrl + Alt + Esc | Switches the focus between the panels and the desktop. Release the keys to select an item. |
Ctrl + F10 | Opens the popup menu for the selected panel. |
Tab | Switches the focus between objects on a panel. |
Return | Chooses the selected panel object or menu item. |
Shift + F10 | Opens the popup menu for the selected panel object. |
Arrow keys | Moves the focus between items in a menu. Moves the focus between interface items in an applet also. |
Esc | Closes an open menu. |
F10 | Opens the Applications menu from the Menu Bar , if the Menu Bar is in a panel. |
Application Shortcut Keys
Shortcut Keys | Command |
---|---|
Ctrl + N | New |
Ctrl + X | Cut |
Ctrl + C | Copy |
Ctrl + V | Paste |
Ctrl + Z | Undo |
Ctrl + S | Save |
Ctrl + Q | Quit |
Update Error of linux-image on Ubuntu 8.04
When you install new update package named
Linux image 2.6.24-19-generic (版本 2.6.24-19.34)
(Linux kernel image for version 2.6.24 on x86/x86_64.)
, there an error :
/var/cache/apt/archives/linux-image-2.6.24-19-generic_2.6.24-19.43_i386.deb: unable to make backup link of `./boot/vmlinuz-2.6.24-19-generic' before installing new version
Solution:
Open a terminal, then execute the following command:sudo rm -fv /boot/initrd.img-2.6.24*.bak
sudo rm -fv /boot/vmlinuz-2.6.24-19-generic
sudo rm -fv /boot/initrd.img-2.6.24-19-generic
sudo rm -fv /boot/config-2.6.24-19-generic
sudo rm -fv /boot/abi-2.6.24-19-generic
sudo rm -fv /boot/System.map-2.6.24-19-generic
11/01/2008
Next:If you can see the future, you can save it
Cris (Nicholas Cage) has the power to see 2 minutes into the future, and works as a magician in Las Vegas with this talent, along with some moderate amount of sleight of hand. He notes however, that by the nature of seeing the future, every time he views it, it then changes. His ability is an innate talent he does not understand, but for a long time, Cris has been seeing a vision of a woman walking into a diner, far more than two minutes in his future. He knows the woman in his vision will arrive at 8:09, but does not know what day or if it is AM or PM, so he has been going to this diner twice a day every day to meet her and find out why he can see her farther than two minutes in the future. After drawing the suspicion of a Las Vegas casino by winning ten thousand dollars in a series of small, coincidental hands, Cage slips by their frustrated security, thwarting a robbery on his way out. The following day, after evading the FBI (that is attempting to bring him in to help with an anti-terror investigation), Cris finally sees Liz (Jessica Biel), the woman from his dream. After attempting to introduce himself repeatedly--each time seeing his advance fall flat, then changing his actions and thus the future--he charms her enough to get a ride from her to Flagstaff, Arizona. Cris is, of course, not headed there, but, thanks to his future sight, knows she is. When a road is washed out, they are forced to stay at a hotel on the edge of a cliff.
Agent Farris tracks them and assembles a large team to bring Cris in. The terrorists, who have been watching the FBI, also follow, hoping to kill Cris before he can help the authorities. Agent Farris confronts Liz while she is walking near the hotel and persuades her to drug Cris so that they can bring him in peacefully. Instead, Liz warns Cris, who tells her about his secret. When she asks why he will not help the FBI stop the terrorists, he tells her about the limitations of his ability. He can only see his future, and only two minutes in the future, but that he can see much further on matters concerning her. When Cris tries to escape, he is arrested, and the terrorists kidnap Liz.
In custody, Cris is strapped to a chair with his eyes held open and forced to watch television until he can have a vision that helps the FBI. When he sees a report of Liz being strapped with explosives and blown up, Agent Farris promises to help save her as long as Cris will help her.
Cris uses his future visions to find the terrorists and lead a tactical team on a raid to stop them. When they arrive, Cris is able to walk right up to the terrorist leader by seeing where the bullets will go and dodging them. After killing the terrorists and saving Liz, they realize that the bomb has already been moved. Agent Farris shows a seismograph to Cris hoping that he will see any tremors caused by explosions before they happen. Just then, he starts yelling that it is happening now, and in the distance, the bomb goes off, destroying everything around them.
Then we see Cris and Liz sleeping on a bed. Cris is reflecting that "every time you look into the future, it changes... because you looked at it." Because the nuclear weapon the terrorists had could hurt Liz, Cage has been able to see a day into the future, and is, as he lies there, exploring different possible courses of action, doing what, he reveals to Liz, is his duty that he has evaded for a long time, using his power to save people, now that he, having found Liz and love, has the courage to do so.
精彩对白:
Cris Johnson : You've probably seen a lot of those shows - Mentalists, Magicians, Illusionists - and wondered if they're the real deal. Your skepticism tells you it's just an act. That way, you can sleep at night. You'd be shocked to know that sometimes, not often, but sometimes, it is the real deal, masquerading as an act, hiding behind a few 50-dollar tricks, hiding in plain sight. Because if the magician doesn't do that…the alternative is impossible to live with…"
克里斯·约翰逊:你可能已经看过一些这样的表演--超能力者、巫术师、魔术师--想知道他们的能力是否是真实存在的。你怀疑的天性会告诉你,这只是一场表演……因为只有这样,你才能在晚上睡得安稳些。有的时候,你可能会对这个认知感到震惊,不是常常,是有时候--这些都是真的,只是被伪装成了一场表演,隐藏在一个只值50美元的小把戏或在眼睛能及的地方后面。因为魔术师只能假装这是不真实的把戏,否则他就没有什么选择的余地了。
Callie Ferris: Tell me what just happened. What did you see
Cris Johnson: If I do what you want, you'll keep me in this chair forever.
凯莉·弗瑞斯:告诉我刚刚发生了什么?你看到了什么?
克里斯·约翰逊:如果我告诉你,能让我永远坐在这把舒服的椅子里吗?
Liz: You can see things before they happen
Cris Johnson: Only my future... except with you. I saw far beyond anything I'd ever seen before. You need to get away from here.
莉兹:你能在事情发生前就预见到它?
克里斯·约翰逊:只是与我有关的未来……除了你之外。我刚看到了一些以前看到过的……你必须马上离开这里。
Callie Ferris: I believe that the urgency of this situation compels the use of any and all resources to obtain Cris Johnson.
凯莉·弗瑞斯:我认为目前的紧张形势,足以允许让我们使用一切手段和资源得到克里斯·约翰逊。
Cris Johnson: I've seen every possible ending. None of them are good for you.
克里斯·约翰逊:我已经看到了每一个有可能出现的结局,不过它们中的任何一个对于你来说都不是好消息。
Liz: I don't want you to die.
Cris Johnson: It happened. It just hasn't happened yet.
莉兹:我不想让你死。
克里斯·约翰逊:死亡早晚会降临的,只是现在还不到时候而已