嗯,从下午那恶心的软工补考归来了,写点东西…
上一篇翻译的 tutorial 有点泛泛了,那么,举个编程的经典例子”Hello World”吧。

首先建立下列目录结构

1
2
3
4
5
6
7
8
9
10
/hello
  /chrome
    /hello
      hello.xul
      hello.js
  chrome.manifest
  /defaults
    /preferences
      prefs.js
  application.ini


hello.xul 的内容为:

?Download hello.xul
1
2
3
4
5
<?xml version="1.0"?>
<window>
  <script src="hello.js" type="text/javascript"/>
  <button label="Hello" oncommand="hello();"/>
</window>

hello.js 的内容为:

?Download hello.js
1
2
3
function hello() {
  alert("Hello World!");
}

chrome.manifest 的内容为:

1
content hello file:hello/

prefs.js 的内容为:

?Download prefs.js
1
pref("toolkit.defaultChromeURI", "chrome://hello/content/hello.xul");

application.ini 的内容为:

1
2
3
4
5
6
7
8
9
[App]
Vendor=Duo
Name=hello
Version=0.1
BuildID=20060414
 
[Gecko]
MinVersion=1.8
MaxVersion=1.8

上述工作做完后,运行:

1
xulrunner application.ini

做完这些后就会发现,其实主要的工作和原先的 mozilla 的开发没有区别。
所以 XULRunner 的文档虽然少,不过应该没太大关系,只要看 mozilla 的文档就好了。
只不过是为了在 XULRunner 上运行加了几个文件而已。
不过用 XULRunner 调试程序非常方便,而且我在 mozilla 下死活执行不了 I/O 的操作,目前只能靠 XULRunner 了…

Tags:

XULRunner tutorial

Mozilla April 13th, 2006

发现自己是越来越吊儿郎当了, 不务正业了…明天软工补考…现在还没再看过…今晚反而玩魔兽去了…
打了几盘后没事干就开始翻译 xulrunner 的 tutorial…

嗯,首先是 xulrunner 官方的介绍:

XULRunner是一个单独的“gecko运行时”安装包,可用于启动多种如同 Firefox 和 Thunderbird 一样丰富的 XUL+XPCOM 应用程序。它提供了安装、升级和反安装这些应用程序的机制。XULRunner 还将提供 libxul,这个解决方案允许把Mozilla技术嵌入到其它项目和产品中。

下面是正文…
依照惯例, 斜体字为变量, 可以被替换为您的应用程序的有意义值.
建立您的文件结构

把您的应用程序建立成这个样子:

/applicationName
  /chrome
  /applicationName
    your app files
  chrome.manifest
  /defaults
    /preferences
      prefs.js
  application.ini

事实上有更复杂的方法来做到这点, 不过在这儿一个简单的骨架也许足够了. 接下来开始建立配置文件.
建立您的 application.ini
Read the rest of this entry »

Tags:

1. 从 ATi 的网站上下载 Linux 下的驱动, 一般是那个 .run 文件. 不算太大, 30多M.
2. 运行

1
sh ati-driver-installer-8.22.5-i386.run --buildpkg Debian/sid

来生成Debian Sid 的 deb 包( 生成其它软件包可以通过 sh ati-driver-installer-8.22.5-i386.run –get-supported 获得帮助).
这时会在您的主目录下生成5个deb包
fglrx-control-qt3_8.22.5-1_i386.deb
fglrx-driver_8.22.5-1_i386.deb
fglrx-kernel-src_8.22.5-1_i386.deb
fglrx-driver-dev_8.22.5-1_i386.deb
fglrx-sources_8.22.5-1_i386.deb
3. 安装内核头文件, 比如我的是 linux-headers-2.6.15-1-686.
4.

1
dpkg -i fglrx-kernel-src_8.22.5-1_i386.deb

Read the rest of this entry »

Tags: ,