Ubuntu 9.10 Quick Guide

1. partitioning

If you’re using alternative image to install Ubuntu from ISO without CD, you’ll find that the problem of unable partitioning hard disk is solved. That problem exists in both 8.10 and 9.04 releases. In the installation wizard, there is a newly added dialog to ask if you want to umount the hard disk. Choose yes if you want to partition hard disk.

2. coexisting with Windows XP

If your computer has Windows XP and Ubuntu coexisting, and want to keep using Windows boot loader to intialize computer. You need to install Ubuntu boot loader to a location other than MBR, for example, I installed it to /dev/sda6 which is the root partition (/) of my Ubuntu installation. Since Ubuntu 9.10, GRUB2 replaces GRUB. The dd approach doesn’t work any more. The grub4dos tool offers us a workaround: NTLDR -> grldr -> grub -> grub2 -> Ubuntu. It’s not perfect but works.

  1. Extract grldr from grub4dos package, and put it into Windows C:\ folder.
  2. Create a text file menu.lst under C:\ folder. The content of menu.lst as following:
    title grub4dos
    root (hd0,5)
    kernel /boot/grub/core.img
    boot
  3. Add the following to the end of boot.ini
    C:\grldr="grub4dos"

3. Chinese input method

IBus replaces SCIM in Ubuntu 9.10. I like IBus, but seems that the factory settings of IBus in Ubuntu 9.10 are not correct. Open IBus Preferences, switch to the “Input Method” tab, delete all existing methods from the list, then add “PinYin” method into the list.

4. adjustments

4.1. default font

By default, Ubuntu 9.10 uses the embedded bitmap font of WenQuanYi ZenHei. I don’t know why not use vector font. It’s weird. Follow this post to enable vector font.

4.2. desktop interface

Open Appearance Preferences, and switch to the “Interface” tab. Make sure the item “Show icons in menus” is checked, and select “Icons only” in the drop list of “Toolbar button labels”.

5. problems and workarounds

5.1. Eclipse

In Ubuntu 9.10, mouse clicking on some buttons of Eclipse doesn’t work, but keyboard works. This bug is fixed in Eclipse 3.6M2. If you’re using 3.5.x or earlier release, there is a workaround for you.

5.2. Lotus Notes 8.5.x

Lotus Notes fails to draw several windows in Ubuntu 9.10. IBM is going to fix this bug in next minor release 8.5.2. If you’re using 8.5.1, like me, or 8.5.0, don’t worry, there is also an easy workaround (in #13 reply).

Posted in Linux | Tagged | 1 Comment

Android Twitter 翻墙指南

其实这个标题我是成心这么起的,因为在 Android 下根本就不用做太多操作,很无缝无痛地就能避开 G-F-W 的拦阻。

如果你喜欢使用客户端程式来登录 Twitter service,比如赫赫有名的 Twidroid,你只需要在设置帐号时选 Other, 并使用以下配置:

API URL: nest.onedd.net/api
Twitter ID: your_id_here
Password: your_pwd_here

觉得以上过多技术细节?好吧,还有更简单的,直接在浏览器里打开 http://dabr.co.uk/ 并使用你的 Twitter username/password 登录,就可以了。dabr 是什么?来一段它的介绍吧:

dabr is a mobile web interface to Twitter’s API. It has been described as m.twitter.com on steroids, and tries to provide as much mobile functionality as possible.

还有更多其他的备选,比如 slandr, twitstat, tweete, et al.

我想这就是开放的好处,Twitter 开放了自己的接口,人们可以通过任意自己喜欢的手段在 Twitter 中发布信息。从很大程度上,Twitter 已经成为了信息流的主管道,是否是通过 Twitter 官方网站发布的一点都不重要了。

Posted in Android | Tagged , | Leave a comment

入手 G2 及 Android Apps 推荐

等了差不多三个月,终于按耐不住了,上上周六出手 G2,购入一部 台版 HTC Magic,3200 大洋,外加一张屏幕保护膜 50 大洋、8G 高速 KINGMAX microSD 卡 150 大洋,总共耗资 天朝币 3400 大洋。

HTC Magic 目前世面上可以看到的版本主要有 Vodafone 版、T-Mobile 版、台湾版、香港版。个人觉得最好选择台湾版。可以很容易在网路上找到不同版本的对照表。

Android 出自 Google 门下,自然与 Google 诸多服务绑定紧密。如果你跟我一样严重依赖 Google Services 的话,Android 系 smart phone 真的非常合适。设置了你的 Google Account 后,Gmail, Google Contacts, Google Calendar 等主要服务都会自动同步。Google 目前的主要服务基本都有移动版本,比如 Google Maps, Google Docs, Picasaweb, Google Reader 等等,都针对手机设备进行了调节和优化。

Smart phone 最吸引人的地方之一应该就是它的第三方应用程序,可以极大地拓展其功能和应用范围。就像 iPhone 有 App Store 一样,Android phone 也有一个类似的东西,叫做 App Market. 当然,其丰富程度比不上 App Store, 不过我相信会慢慢赶上来的。

恰好这周在外培训,有了大把的时间可以好好把玩这部机器,也尝试了很多应用程序,下面是我目前的 must-have:

AK Notepad:一个记事本程式。试过好几个记事本程式,最后还是这个正。

子午播放器(安装后名称是英文的,叫做 Meridian):一个全功能多媒体播放器,不过我只用它来播放电影。它支持 srt 格式的字幕(文件内码得是 UTF-8 编码),对中国人来说这很重要。著名的 Video Player 就不支持字幕。

Astrid Task/Todo List:一个任务管理程式。它可以与 RTM 无缝地同步,非常棒。

Meebo IM:相当于 Linux 下的 Pidgin,一个支持多协议的即时通讯工具。我主要用它来登录 MSN 和 Yahoo Messengers. 比那个 Hi MSN 好的不是一点半点。

The Weather Channel:天气预报。

ConnectBot:一个 telnet/ssh 客户端。比系统自带的那个 telnet 客户端好用多了。这样我在路上也可以远程操作我的服务器主机了。

Places Directory:一项来自 Google 的寻址服务。就是可以找出在你周围的一些服务设施,比如宾馆、餐厅、咖啡厅、茶馆、加油站等。

Compass:指南针。这玩意儿对我这样方向感不强的人很有用的。

Wapedia Mobile Wiki:wikipedia 的移动版客户端。支持中文。

Beelicious:在浏览器中共享到 del.icio.us. 因为我一直使用 del.icio.us 管理我的 bookmarks, 所以这个插件对我很有用。

Posted in Android | Leave a comment

Playing with MLDonkey

If you’re a non-Windows user, Linux or Mac, whatever, and want a client to connect eDonkey network, probably you’ll try aMule which is a clone of eMule. I’m not saying that aMule sucks, but… it’s just not good enough. Actually we do have another choice, MLDonkey. Know what’s coolest? MLDonkey is a multi-protocol P2P client. In addition to eDonkey, it also supports BitTorrent, HTTP, FTP, FastTrack, etc. Check out the full list.

Ubuntu repository has MLDonkey, but the version is a bit little old. If you don’t mind, it’s easy to get it installed through apt-get utility, of course. I’m going to compile MLDonkey from source code, because it’s also easy to do the compilation.

Firstly install the prerequisites to make your enviroment ready for compiling:

$ sudo apt-get install ocaml libbz2-dev libgd2-xpm-dev libmagic-dev

Then get the source package and compile it:

$ tar jxvf mldonkey-3.0.0.tar.bz2
$ cd mldonkey-3.0.0
$ ./configure
$ make

No necessary to run any command like ‘sudo make install’ to finish the installation, because what we need is only one file. It’s mlnet generated after compiling. Just copy it to any place you want, e.g., /usr/local/bin.

$ sudo cp mlnet /usr/local/bin

The installation is done!

Run mlnet to start MLDonkey:

$ mlnet &

A working folder, .mldonkey, is created in the current logged-in user’s home directory during the first running.

Two official ways are provided to interact with MLDonkey:

  • CLI via telnet. Default port is 4000. Try telnet localhost 4000
  • web interface via browser. Default port is 4080. Try http://localhost:4080

If you dislike both and want a full-function GUI tool, you can try Sancho. CLI is my favorite. The following is a list of common-use commands.

> ?
short help

> ??
long help

> save
save options into the configuration files

> kill
shutdown MLDonkey

> q
exit the CLI admin console

> users
print all MLDonkey users

> whoami
print the current logged-in MLDonkey user

> passwd <thepwd>
change your password

> auth <username> <password>
authicate yourself before executing any directive

> networks
print the enabled networks currently

> disable <num>
disable the specified network

> set client_name <new-client-name>
set the client name

> set allowed_ips “ip1 ip2 ip3″
set which IPs have access to admin consoles.
For example,
> set allowed_ips “127.0.0.1 192.168.0.157″

> set max_hard_download_rate <digit>
set the maximal download rate. 0 means umlimited.
For example,
> set max_hard_download_rate 0

> servers <URL>
load servers from a file or a URL
For example,
> servers http://www.emule.org.cn/server.met

> n <server name or IP> [<port>]
add a new server manually
For example,
> n no1.eserver.emule.org.cn 8080
> n no2.eserver.emule.org.cn 8080

> vm
print the connected servers

> dllink <download-link>
add a download task

> vd
print the downloading tasks

> reshare
check shared files for removal

By default the downloaded files can be found in $HOME/.mldonkey/incoming/files or $HOME/.mldonkey/incoming/directories. Just move the downloaded files out, then run the above ‘reshare’ command.

BTW, I’m using Ubuntu Linux 9.04 when playing MLDonkey.

Posted in Linux | Tagged | 3 Comments

Say Goodbye to Partial Content in Google Reader

Hate those feeds not providing full content? Users of Firefox and Google Reader don’t have to suffer more, like me. There are always sweet workarounds for us. Extensibility is the power.

First of all, install greasemonkey which allows using javascript to change web pages on-the-fly. It likes a kind of container for javascript in Firefox. Then go to userscripts.org, and install this script: google reader full feed changer.

According to your OS, you can find a .js file under the folder

  • Ubuntu Linux: $HOME/.mozilla/firefox/profile_id/gm_scripts/
  • Windows XP: %APPDATA%\Mozilla\Firefox\Profiles\profile_id\gm_scripts\

Use your favorite editor to open it, and add your definitions in SITE_INFO like the following code snippet:

{
  url: 'http://chinese.wsj.com',
  xpath: '//div[@id="A"]',
  charset: 'gb2312'
},
{
  url: 'http://cn.reuters.com/',
  xpath: '//div[@id="resizeableText"]'
},
{
  url: 'http://www.ftchinese.com/',
  xpath: '//div[@class="content"]'
},
{
  url: 'http://www.infzm.com',
  xpath: '//div[@id="content-context"]'
}

url: define the domain name(s). If the URLs of feed and detail page have different domains, you need to define them all, for example,
url: ‘http://(www|feed).openow.net’
url: ‘http://(huang.yunsong.net|feeds2.feedburner.com)’

xpath: define the HTML tag before the content. You can find the tag in the HTML source code of any detail page.

charset: define the character set of the detail page. It’s an optional parameter.

OK. That’s it!

Hmm… feeling… too much technical above. It might be a bit little boring and not easy to get started. Some of you doesn’t like it. Right? OK, here comes an independent compiled Firefox add-on for making Google Reader better. Try it instead. Have fun!

Posted in Uncategorized | Tagged , | Leave a comment

NVIDIA Graphics Driver 180 Not Stable

Everything was fine when my ThinkPad T61p worked with the version 177 or 173 of NVIDIA Graphics Driver. When I got a notification that there was a new version 180 available, I was happy to upgrade it at once. Then problems came… sometimes my laptop got sudden black-screen crash on both Ubuntu 8.10 and 9.04! Yes, it’s black-screen, not Microsoft style blue-screen.

I found the following entries in /var/log/messages

Apr 25 12:35:56 hystp2 kernel: [ 5123.002987] Xorg[2927]: segfault at 5 ip b64df209 sp bfb99f60 error 4 in nvidia_drv.so[b6491000+3b4000]
Apr 25 12:35:56 hystp2 bonobo-activation-server (huangys-6077): could not associate with desktop session: Failed to connect to socket /tmp/dbus-n45hu1LoDE

Seems that keeping crash is caused by NVIDIA driver. I have to switch back to 173. Is there any better solution than back to an old version?

Years passed, lacking of hardware driver support is still a big problem for Linux promotion. Although NVIDIA driver has bugs, it supports Linux better than ATI. Speaking of ATI driver for Linux… it really sucks.

Posted in Linux | Tagged | 3 Comments

Hotmail Enables Free POP3 Access

Guess it’s an old news already. The Hotmail’s POP3 access service, which was provided to Hotmail Plus subscribers only, is free now! Lots of people have switched or are switching to Gmail which provides many great features including free POP3 and IMAP access services, but it’s still a good thing to see this happen to Hotmail, right?

POP3 server: pop3.live.com
port: 995
security: SSL
username: yours@hotmail.com (or any other domains supported by Microsoft, e.g., msn.com, live.com)

SMTP server: smtp.live.com
port: 587
security: TLS
authentication required: Yes. Use your POP username here.

Posted in Uncategorized | Leave a comment

Rocks! WordPress MU + HyperDB

Indeed it’s very easy to get WPMU installed and up, but you’ll find the number of tables in WPMU database increases every time a new blog is created. If you’re providing public blogging service, the number of tables is going to 100, 1000, … very soon. Yes, WPMU is great, but the tables keep increasing, that may drive you mad. I was mad, at least.

In WPMU version 2.7, there are 9 global tables: blogs, blog_versions, registration_log, signups, site, sitecategories, sitemeta, usermeta, users. These 9 tables are fixed and serving for WPMU system globally. Every blog has its own 8 tables: comments, links, options, postmeta, posts, terms, term_relationships, term_taxonomy. These 8 tables are created over and over every new blog is created.

This designing is cool and useful from scalability view, especially for those big blogging service providers, wordpress.com is a good example. But WPMU uses only one database by default, it’s hard to manage the excessive tables in one database, and the performance should also not be good. OK, here comes HyperDB, which can solve this problem. Actually HyperDB is derived from the code using by wordpress.com.

Before starting installing and configuring, we need to define a rule for databases. In this post, the rule is:

  • One database (wpmu_db0) for the global tables and the tables of first blog. It can be called global database.
  • Additional 3 databases (wpmu_db1, wpmu_db2, wpmu_db3) for the tables of other blogs, each database serves 2 blogs.

Of course, you can define your own rules based-on your needs. It’s flexible.

We can start now. The first thing is to set up a standard WPMU using the global database in the installation wizard. After that, go to WordPress website and download HyperDB. The version I’m using is 2008-11-27. There are three files in HyperDB package:

  • db.php, which needs to be uploaded to wp-content directory
  • db-settings.php, which needs to be uploaded to the directory that holds wp-config.php
  • readme.txt, oh, you know what it means

Then add the following lines near the top of wp-config.php

define('WPMU', true);
require('db-settings.php');

Then add the blow code at the bottom of db-settings.php

// a handy function for mapping blog tables to dataset
function add_blog_tables($ds, $blog_id){
  add_db_table($ds, 'wp_' . $blog_id . '_comments');
  add_db_table($ds, 'wp_' . $blog_id . '_links');
  add_db_table($ds, 'wp_' . $blog_id . '_options');
  add_db_table($ds, 'wp_' . $blog_id . '_postmeta');
  add_db_table($ds, 'wp_' . $blog_id . '_posts');
  add_db_table($ds, 'wp_' . $blog_id . '_terms');
  add_db_table($ds, 'wp_' . $blog_id . '_term_relationships');
  add_db_table($ds, 'wp_' . $blog_id . '_term_taxonomy');
}
 
// add databases
add_db_server('global', 0, 'mysql3326_1', 1, 1, 'localhost:3326', '', 'wpmu_db0', 'wpuser', 'thepwd');
add_db_server('s1', 0, 'mysql3326_2', 1, 1, 'localhost:3326', '', 'wpmu_db1', 'wpuser', 'thepwd');
add_db_server('s2', 0, 'mysql3306_1', 1, 1, 'localhost:3306', '', 'wpmu_db2', 'wpuser', 'thepwd');
add_db_server('s3', 0, 'mysql3306_2', 1, 1, 'localhost:3306', '', 'wpmu_db3', 'wpuser', 'thepwd');
 
// add global tables which are in global database
add_db_table('global',  'wp_blogs');
add_db_table('global', 'wp_blog_versions');
add_db_table('global', 'wp_registration_log');
add_db_table('global', 'wp_signups');
add_db_table('global', 'wp_site');
add_db_table('global', 'wp_sitecategories');
add_db_table('global', 'wp_sitemeta');
add_db_table('global', 'wp_usermeta');
 
// add the tables for the first blog (created during wpmu installation)
// the first blog's tables are in global database
// of course, you can move it to any database you want
add_blog_tables('global', 1);
 
$dbsnum=3; // 3 additional databases
$blogs_per_db=2; // each database serves 2 blogs
 
for($db_id=1; $db_id&lt;=$dbsnum; $db_id++){
  $dataset = 's' . $db_id;
  $max = $db_id * $blogs_per_db + 1; // include
  $min = $max - $blogs_per_db + 1; // include
  for($blog_id=$min; $blog_id&lt;=$max; $blog_id++){
    add_blog_tables($dataset, $blog_id);
  }
}

That’s it!

Posted in WordPress | 27 Comments

WordPress MU Local Installation

Resovling Domain Names Locally

Wanna try WPMU on local machine? If you use localhost or 127.0.0.1 as the server address directly, you always get a message similar to the following:

Do not use an IP address (like 127.0.0.1) as your server address. Do not use a single word hostname like localhost.

That means a FQDN is needed, the good thing is that it’s easy to resolve domain names virtually locally. Open the hosts file:

  • C:\WINDOWS\system32\drivers\etc\hosts (Windows)
  • /etc/hosts (Linux)

Add or modify something, and make sure there is a line like the following in the file:

127.0.0.1    localhost hys.lan bloga.hys.lan blogb.hys.lan blogc.hys.lan blogd.hys.lan

Here, hys.lan is used to install WPMU, blog(a-d).hys.lan are addresses for testing, I’ll use these four to create weblogs.

Configuring Apache

Make sure two things:

  • Apache is listening on port 80, because WPMU doesn’t support server address with port number.
  • mod_rewrite is enabled.

Then adds a virtual host section:

<VirtualHost *:80>
  DocumentRoot /opt/wordpress-mu
  ServerName hys.lan
  ServerAlias *.hys.lan
  <Directory "/opt/wordpress-mu">
    AllowOverride FileInfo
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Preparing Database

Create an empty database, and grant permissions to a database user.

mysql> create database wpmu_db;
mysql> grant all privileges on wpmu_db.* to wpuser@'%' identified by 'thepwd';
mysql> flush privileges;

Installing WPMU

It’s very easy to get WPMU up. Open your browser, and type the server address, in my case, it’s http://hys.lan. Provide the required information, and press the “Submit” button to go. Waiting for a while, WPMU is installed and runs successfully.

Posted in WordPress | 6 Comments

Enable OpenSSL Support for PHP on Windows

As a prerequisite, two libraries must be existing in your Windows system: libeay32.dll and ssleay32.dll. Two ways to achieve this:

  • Install OpenSSL for Windows
  • Or, copy these two files to C:\WINDOWS\system32 folder. They’re shipped with PHP package, you can find them in PHP root folder.

OK, it’s time to open php.ini by using any text editor, and remove the semicolon before the following line:

extension=php_openssl.dll

Done!

Posted in Uncategorized | Tagged | 4 Comments