Fedora notes

Sunday, January 15, 2006

Thunderbird font setting for HTML mails in UTF-8

The font set for UTF-8 encoded HTML mails in TB is not from "Western" as
in Firefox, but from "Other languages"! This is inconsistent, though
it's not a big issue if you know it.

Sunday, November 20, 2005

an idea of showing/hiding a window

someday i found i need a global shortcut to activate a program window, dictionary lookup, for example. but it's not easily achieved to my surprise because the app itself does not provide a shortcut. asking for it from the author is unexpected and not my flavor. i don't wanna make my hands dirty on the original code either. after all, it's really a window management problem. i tried following approaches but dissatisfactory:

1. considering put the app into systray: kde has a very cool tool called ksystraycmd which can make *any* app with a main window into the systray. after that, you just click the trayicon to toggle showing/hiding. well, it's good enough, if you only want showing/hiding an app. to me, i expect a global shortcut!

2. considering using DCOP of KDE: this dcop is cool again, but cool only to kde apps. you can invoke commandline dcop calls to show/hide kde apps that provide DCOP interfaces. two deadly issues: 1) non-kde apps get no bless 2) i have to configure two shortcuts to show and hide, no toggle function typically available for dcop call.

3. my natural thought to the above problem is to find a proper window control tool. this was proved to be TOO HARD! luckily i found wmctrl, which is a very neat tool at the first glance. the exciting hope quickly turned into desperation. it works great BUT for "hidden or minimize"! come on...the only thing i need is not working. f**K

today i thought of a solution that temporarily comforts me:) , though i still have to code a little in perl. the idea is to move a window into a special desktop as hiding and to bring it out to the current desktop as showing. assuming i use more than two, and one of them is used as a special one hiding all windows to be toggled. i made a small perl script to do toggling, i.e. do activating when the window is at the special desktop, and do moving when it's not. thus, i am now able to use this script in KHotKeys to make global shortcuts for specific apps I want to toggle.

so, to realize a global shortcut for a specific window, i use a combination of wmctrl + a toggling script + khotkeys.
there may be better ways, though. hopefully, wmctrl could finally solve the "hidden or minimize" problem so that the script will not be necessary. another possibility is, kde itself will offer a similar feature in future.

Sunday, October 30, 2005

Minimize windows to system tray

Sometimes you might want certain program to be able to minimize to the system tray while they simply don't provide this feature. I just found under KDE a nice tool, ksystraycmd, can do so.

1. choose a keyword in the window title, e.g. you want to hide firefox, and the keyword could be 'Mozilla Firefox'.
2. issue the command: ksystraycmd --window 'keyword'

you will get a default icon of the app in systray where you can show/hide your app. cool right? :)

(Update 2005-11-03): it looks like ksystraycmd has some encoding problem when using --window argument. if you pass a Chinese window title, it cannot find any. therefore, the solution is to use another argument for finding windows, i.e. --wid, before you can do it, you can use xwininfo to obtain the window id of what you want to hide.

Tuesday, October 18, 2005

draw line arrows in inkscape

inkscape is a nice app for drawing vector figures. but when i tried today to draw a simple one, i couldn't even find the line arrow! fortunately google helps here: http://inkscape.gristle.org/2005-04-25.txt

it's too hard to access this little tiny corner of settings if you don't know!!!
1. draw a line first
2. make it selected
3. click "fill & stroke" dialog
4. in the tab "stoke style", there is arrow style for end markers for all kinda shapes.

hope it'll be useful for others.

Sunday, October 16, 2005

some learnings for x startup scripts of redhat style

while using fedora, i constantly feel it necessary to understand the process of x startup. sometimes those diverse and fancy names of x init scripts are really messing your head up when you try to add some init code for input method for example.

if you looked into those init scripts, you would find the clear answers of your relevant problems and would know later on where to insert your code properly.

have a look first at the initial bootup to runlevel 5:
  • /etc/inittab,
    • runlevel 5, /etc/X11/prefdm -nodaemon will be invoked at the last phase of init.
      • /etc/profile.d/lang.sh
        • /etc/sysconfig/i18n
        • ~/.i18n
      • it decides which display manager to use from /etc/sysconfig/desktop and $DISPLAYMANGER.
      • if nothing is specified, it starts gdm, kdm, xdm in order. (e.g. in my system, there is no gdm, so kdm is invoked)
now the problem is that it's hard to analyze the following process after kdm runs, cause kdm is not a script anymore, and each display manager probably has different process and take different x init scripts to start.

let us see the process starting from xinitrc as follows:
  • /etc/X11/xinit/xinitrc
    • /etc/X11/xinit/xinitrc-common
      • /etc/X11/xinit/xinitrc.d/
        • xinput.sh
          • poll and run ~/xinput.d/default, ..., /etc/X11/xinit/xinput.d/...
          • set related env variables (XIM, XMODIFIERS, ...)
          • run XIM_PROGRAM
    • ~/.Xclients if exists (e.g. I used switchdesk to create a .Xclients and .Xclients-default)
      • invoke ~/.Xclients-default that starts a preferred desktop environment such as startkde
    • /etc/X11/xinit/Xclients
      • start desktop env. if there is a specified one in /etc/sysconfig/desktop
      • if no pre-specified desktop, try gnome (gnome-session), kde, ... in order.
after some tests, i got following personal conclusions:
  • codes about adding input method such as fcitx can be neatly inserted in ~/.xinput.d/default. ppl will easily see the benefit than puting it in xinit/xinput.d/
  • set LC_CTYPE in ~/.i18n is better than in ~/.bash_profile and sysconfig/i18n
  • unlike gdm, kdm may init an x session by starting from xinitrc-common rather xinitrc, because as i tested, codes in ~/.Xclients never be invoked when kdm is used for display manager.

Monday, October 03, 2005

Unified themes/icons/fonts

we may run into 6 combinations of problems about theming in linux:
1. common user in Gnome runs KDE/QT apps
i don't know if a "qt-gtk-engine" exists. anyway, use kcontrol or qtconfig to config themes of qt apps.

2. common user in Gnome runs KDE/QT apps with privileges
equivalent to 6

3. common user in Gnome runs Gnome/Gtk1/Gtk2 apps with privileges
symbolic link ~/.themes ~/.icons ~/.gtkrc-2.0 in root home

4. common user in KDE runs Gnome/Gtk1/Gtk2 apps
install gtk-qt-engine theme engine. it's a normal gtk theme engine by using current qt theme ;) furthermore it will also install a kcontrol module, so that you can config it in kcontrol.
problem: menu of gtk apps is rendered black. probably due to the transluecy feature i enabled in qt.

5. common user in KDE runs Gnome/Gtk1/Gtk2 apps with privileges
equivalent to 3

6. common user in KDE runs KDE/QT apps with privileges
symbolic link ~/.qt ~/.kde/share/icons ~/.kderc ~/.fonts in corresponding postions of root home. configure theme by running kcontrol as root if yet no effect.

summary:
the general idea here is, symbolic linking all theme related data to root home so that privileged apps can use the current theme/icon/font. furthermore, changing the current theme will directly reflect to the root apps.

for qt style -> gtk, gtk-qt-engine is used, though yet some bugs.
for gtk theme -> qt, not sure if similar engine exists.

Tuesday, September 13, 2005

fcitx 窗口条自动隐藏

默认情况下,fcitx的主窗口条不自动隐藏,网上找了很久也没人知道,原来fcitx有个很清楚的配置文件在用户目录,痛哭~~~
~/.fctix/config
只要把
主窗口隐藏模式=0
改成
主窗口隐藏模式=1
即可!
这个配置文件里还有很多很直观的参数可以修改,比如我觉得默认情况下的候选字太肥了!改了清爽多了!

Sunday, July 31, 2005

vsftpd chroot local user & access outside folder

vsftpd does not follow symlink under a local user's home folder if chroot is enabled. this is quite annoying if you try to provide download but don't want to move files at different partitions. there is a solution by using a mount feature for new kernels after 1.6 as follows:
  > mount --bind outside/dir home/dir
it makes a folder accessible at two places. a nice trick.

Wednesday, July 27, 2005

Let 'crontab -e' use vim

by default, 'crontab -e' uses vi without syntax highlights on fedora.
to make it use vim, execute the following command:
> export EDITOR=/usr/bin/vim

Saturday, July 23, 2005

font problem after you installed SimSun

if you just directly install simsun, most of programs will apply it correctly for chinese display without further configurations. but some won't. the screen effect is pretty weird that some are applied in simsun while some are applied in the old font(vague). what makes it like this? i don't know the accurate answer. but i'm sure that there is a global configuration to which those problematic programs conform, so that they have the same problematic font rendering. thing is not that simple,though. i was only able to make chinese utf-8 pages in firefox to  apply simsun by adding it into serif/sans-serif's  alias list. however, those such as rxvt-unicode and opera interface haven't given in yet. something more about font i am yet to know...

Wednesday, July 13, 2005

lftp tricks: discover + queue

for ftp downloading, one of toughest problems we may face is job queueing and retry control. sometimes we may even expect to be able to modify the queue attributes such as specifying a different download account. i figured out the other day that, in fact, lftp is able to provide a flexible queue control to meet all these needs.

you need two lftp processes for discovering resources and queueing jobs: lftp1 and lftp2
1. to set retry parameters in lftp1. by default, lftp has a 80211-like backoff mechanism. the interval delayed for the next try is multiplied by a value with the previous one. we may only need to make the delay constant, such as 30s.
set net:max-retries 0
set net:reconnect-interval-base 30
set net:reconnect-interval-multiplier 1
2. open an easy-to-connect account in lftp2, so as to discover the remote dir you decide to download
3. open the download site in lftp1, and queue jobs. since ftp_site is supposed to be difficult to connect, you should just press ctrl+c to stop the "open" command. but this command is necessary because it tells lftp that you will queue jobs on this site.
open ftp_site
<ctrl+c>
queue mirror remote_dir_you_discovered
(notes: you can do 2 and 3 more times to discover and download on other sites. )

ending: by using queue control of lftp, you will find it can do almost everything that windows ftp clients can do, and maybe even simpler.

Tuesday, July 12, 2005

Install fonts to be available to XMMS

linux font/encoding is always a haunting issue, especially for asian language users. i've been using linux for one or two years, but still have no idea what's exactly going on about chinese fonts tweaking sometimes ...

x windows usually have two font subsystems: core x font system and fontconfig/xft. those fonts installed by drag&drop in gnome or fc-cache are for fontconfig/xft system, which is only accessible by new apps based on qt3 and gtk2. some old apps using gtk1 such as xmms will not be aware of those fonts. to make your fonts available to xmms like old apps, you have to install it in core x font system.

steps:
1. create the folder where you wanna store your new font. in this example, i use "/usr/share/fonts/local/"
mkdir /usr/share/fonts/local/
2. update font info.
cd /usr/share/fonts/local/
mkfontscale
mkfontdir
3. add font path
chkfontpath --add /usr/share/fonts/local/
4. restart x server.

a little bit notes about font/encoding in XMMS:
1. xmms interface font(in menu, dialog,etc.) is determined by your LANG setting and the corresponding file /etc/gtk/gtkrc.LANG, or you can create a file .gtkrc.mine under your home folder to overwriting the default settings.
2. xmms list/display font is determined by your settings in its preference for fonts. you have to enable multi-byte encoding option to correctly display asian languages. another important thing to remember is, the encoding name used in the font you specified to display non-asci characters has to be matched with that of LC_CTYPE's value.

for example, i use simsun to display chinese characters, and i specify a font in XMMS:
-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gb2312.1980-0
in this case, the encoding name is gb2312. this requires my LC_CTYPE to be set to zh_CN instead of zh_CN.utf-8 or zh_CN.gbk, etc. if you don't have LC_CTYPE=zh_CN, the chinese display in xmms is likely to be incorrect, at least in my tests of FC4. from this, we can see actually xmms is trying to use the encoding specified in LC_CTYPE, and display characters with the matched encoding font. if LC_CTYPE=zh_CN.gbk, xmms will not be able to find a font handling gbk, unless you have a font named:
-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gbk-0
to find out what encodings are available in a certain font, you can check the file fonts.dir created by mkfontdir under your font path. in my case, there is no gbk available for simsun. i don't know if it makes sense here to add lines for support gbk since simsun obviously should support gbk.

Monday, July 11, 2005

Configure sudo

visudo
add the following line with your username:
username ALL = NOPASSWD: ALL

scim: Chinese input under English locale

yum install scim-pinyin
create a symbolic link to /etc/X11/xinit/xinput.d/scim with name as xinput-YOURLOCALE under /etc/alternatives. e.g. xinput-en_US
add "scim -d" to any of your startup script, e.g. xsession, .bashrc, .bash_profile

restart x server, and you are set.

Sunday, July 10, 2005

Upgrading from FC3 to FC4

as i said, upgrading is not as enjoyable as it's supposed to be literally. directly upgrading via yum is troublesome and not encouraged for ordernary users. i have to say it really pissed my off today. after all it's not worth the effort since fresh installation is just better, faster and more predictable.

one of the things i experienced for a new installation is worth some words. if you use the old home folder in the new system, the first startup tends to overwrite the existing .bashrc and .bash_profile files. i don't know if it's just an edged bug of gnome or sth. other things went fairly well so far.

Thursday, July 07, 2005

The thing to dump outlook, evolution, OWA(browser)

fetchExc a nice tool in java for accessing ms exchange server 2000/2003. it can download new mails from your exchange account and forward to another address via smtp or save to local mbox file. the beauty of a commandline tool is that you can use cron to run it so that new mails are
automatically forwarded to any mailbox you prefer.

try it out if you are tired of using those memory hog clients.
i made a modified version of fetchExc to support sendmail forwarding.
the original author may add this option in the later release.

Wednesday, July 06, 2005

GTK 2.7 breaks firefox

upgrading was always dangerous...especially for those in test repo.
i was trying to install evince the other day. it's a fantastic viewer for pdf/ps, but requires gtk2.7 that is not available in fc3.
with no previous experience of upgrading in rawhide repo, i made myself in the risk by serving my curiosity.
the installation by yum was successful at first and evince ran smoothly. but after i reboot, firefox got broken with no text at all in its interface. what a nightmare! >_____< !

after googling around, finally target the issue on this newly gtk2.7. it's so frustrating though the workaround is simple.

vi /usr/bin/firefox
uncomment MOZ_DISABLE_PANGO=1
uncomment export MOZ_DISABLE_PANGO

Saturday, May 14, 2005

Things I miss in Windows

foobar2000: none of linux apps at present can compete with foobar2000 in my opinion. it's super lightweight and fast with very huge set of features like extremely-fast playlist managment/search, better support of non-ascii characters in id3 tags, variety of input plugins covering all music formats I have like mp3, wma, ape. You can have almost all features by installing plugins...just like firefox.

minilyrics: when I play, it can automatically display the lyrics! if it's not available locally, it will download from the internet in a second.

(thinking of any others...)

Thursday, April 14, 2005

Get vi to work with latex

1. Install latex-suite for your vi according to the instructions here:
2. My very very quick start of using this latex suite :)

*vi latex suite commands*

1. unfolding: moving cursor rightwards at the folded text.
2. folding foldable text: press za at the area
3. insert environment variables: press F5, and type the name. press ctrl+j to jump out of the current curly-braces.
4. insert references: first type \ref{} or \cite{}, then let cursor be in the braces and press F9, and you will get splitted windows for choosing reference points. use ctrl+ww to navigate among windows.
5. insert template: in command mode of vi, type TTemplate, and choose the one you want. you can add more templates to $VIM/ftplugin/latex-suite/templates/
6. compile: command mode type \ll
7. set compile output target: command mode type TTarget, and choose dvi, or ps, or pdf
8. set viewer for target: command mode type let g:Tex_ViewRule_dvi = 'xdvi', change dvi to ps or pdf accordingly if applied

Thursday, March 17, 2005

Burning CDs/DVDs

1. X-CD-Roast (xcdroast): yum install xcdroast
2. GnomeBaker: check rpms in its homepage.
3. Graveman: yum install graveman (in fedora extras repo)

I failed to run xcdroast on my system with some strange X windows error info. GnomeBaker works well. Graveman looks great, and has very clean interface.

How to copy the boot sector

A frequently used simple command:

dd if=/dev/hda1 bs=512 count=1 of=bootsect.bin

Sunday, February 27, 2005

Job/Process control

Running a job in the background is typically done when its execution is expected to take a long time and in order to free the issuing terminal after entering the command. (Some processes are not suitable for running in the background, such as text editors, which occupy the full console or terminal window screen.) Starting a program in the background is accomplished by typing its name followed by a space and an ampersand. For example, typing

gftp &
at the command line starts gftp, an open source FTP (file transfer protocol) program, in the background. This frees the console or terminal window for use by other commands while gftp is downloading or uploading programs.

A process that is running in the foreground can be suspended by pressing CTRL+z and can be terminated by pressing CTRL+c. The command bg reactivates a suspended program in the background, and the command fg puts a suspended program or a program that is running in the background into the foreground. The command jobs shows a list of jobs with its jobid that can be used in bg and fg.

Friday, February 18, 2005

Nice Mac Themes

http://www.users.monornet.hu/linux/index2.html provides a lot of greats Mac themes for GTK2 & Metacity based on those in http://www.maxthemes.com. Thanks to the author.

Monday, February 14, 2005

Which linux distribtion to use?

i'd like to suggest beginner picking one distribution most popularly used around, which gives you enough direct support. in fact almost every distro has a good documentation and a well maintained community available for help. but beginners tend to be too lazy or too newbie to find sth related within a bearable period. experienced people around even free of charge will be always preferable:)

as for a distro, package management is essential , and package means software while software lives with support. therefore, support is essential for a distro. a distro with best support always wins, i suppose. the scope of "support" is not limited to only user side, though. who knows tomorrow debian wouldn't anounce that it died. of course, debian shouldn't die:) but a good distro should have a long run of quality development and support. to some extent, it's quite similar to programming languages, some of which actually really shouldn't say it's better over the other but radically the support behind does. How much the language can do does matter only to the support rather than how the language syntax is different. Programmers don't think a language is good because of its language details, but its support and functionality. well, things should not be that simple, though.

but for experts, in fact, the difference among all distros is nearly negligible.

Saturday, February 12, 2005

Mount Filesystems By Common User

There are several ways of mounting filesystem by common users. But I finally found using "uid,gid" options is so straightforward and what I feel best. At the very beginning, I used to use "defaults, umask=000, ..." which makes root to mount but enables everybody to read and write. It's no good because of security issue. The second way I used is "noauto,user,..." which enables one user to mount and umount explicitly. It's a generally ok solution, but I have to invoke mount when login, which troubles me where to put the script for mounting. .bash_profile? no, because everytime a new bash session is established, the script is executed. probably put it in .Xclients? ye, but still troublesome.

What I found today in mount's manual page is that several filesystems' mount can have uid and gid options, including vfat, smbfs, ... some examples of fstab as follow:

/dev/hda1 /mnt/hda1 vfat defaults,uid=zz,gid=zz,iocharset=cp936,codepage=936 0 0
//sambashare/ /mnt/share smbfs defaults,uid=zz,gid=zz,username=domain/user%pwd 0 0

Friday, February 11, 2005

Xterm: some little tweaking

add following lines to file: /usr/lib/X11/app-defaults/XTerm

XTerm*background: black
XTerm*cursorColor: lightgrey
XTerm*foreground: white
XTerm*saveLines: 1024
XTerm*scrollBar: true
XTerm*rightScrollBar: true

Yum repositories I collect for my FC3 (subject to update)

[up2date: /etc/sysconfig/rhn/sources]

i don't know why the official update sites just don't work :( so i comment them out, and set a singpaore mirror for official updates.
yum sg-mirror ftp://ftp.oss.eznetsols.org/linux/fedora/updates/3/i386/
#yum fedora-core-3 http://download.fedora.redhat.com/pub/fedora/linux/core/3/$ARCH/os/
#yum updates-released-fc3 http://download.fedora.redhat.com/pub/fedora/linux/core/updates/3/$ARCH/

#yum-mirror fedora-core-3 http://fedora.redhat.com/download/up2date-mirrors/fedora-core-3
#yum-mirror updates-released-fc3 http://fedora.redhat.com/download/up2date-mirrors/updates-released-fc3

#yum updates-testing http://download.fedora.redhat.com/pub/fedora/linux/core/updates/testing/3/$ARCH/
#yum-mirror updates-testing http://fedora.redhat.com/download/up2date-mirrors/updates-testing-fc3

#yum development http://download.fedora.redhat.com/pub/fedora/linux/core/development/$ARCH/
#yum-mirror development http://fedora.redhat.com/download/up2date-mirrors/fedora-core-rawhide

[yum repos: /etc/yum.repos.d/]
to add a new yum repo, you just put it in yum.conf or save as a separate file under yum.repos.d
[dag]
name=Dag RPM Repository for Fedora Core
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag

[freshrpms]
name=Red Hat Linux $releasever - $basearch - freshrpms
baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms
enabled=1
gpgcheck=1

Make Xfce4.2 Default

My installation of xfce4.2 (rpm/fc3) does not make itself a defaultable desktop session in gdm. That is, I can choose Xfce to login but it never becomes default. I don't know how to activate gdm to change the default session, but just find out a little modification over two files to change the default session manually, though my hands get a little dirty :p and hope it's not messing around.

1. /etc/X11/xinit/Xclients : this file is invoked in /etc/X11/xinit/xinitrc, which handles the default action on session selection. to add xfce4 as default session options, modify the file as follows:

# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
if [ "$DESKTOP" = "GNOME" ]; then
PREFERRED=gnome-session
elif [ "$DESKTOP" = "KDE" ]; then
PREFERRED=startkde
elif [ "$DESKTOP" = "XFCE" ]; then
PREFERRED=startxfce4
fi
fi

2. /etc/sysconfig/desktop: if you are careful enough, you will find out this file that needs modification too.
DESKTOP="XFCE"

Concluding remarks: it's also quite easy to switch to other desktop later. only modifying the /etc/sysconfig/desktop will do. but i wonder if any one-time change can activate gdm to be aware of saving default sessions when user explicity switches ...
(Update: there is a command for this "switchdesk [KDE/GNOME/XFce/...]". It simply creates two files ~/.Xclients and ~/.Xclients-default that will take over the control of /etc/X11/xinit/.Xclients :))

Thursday, January 27, 2005

Who said ASLA CAN'T mix sounds?

Sound Mixing with ALSA - FedoraNEWS.ORG

Edit the file ~/.asoundrc so that it contains something like this:

pcm.!default {
type plug
slave.pcm "swmixer"
}

pcm.swmixer {
type dmix
ipc_key 1234
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
}

We have just created two multichannel-enabled devices default and swmixer. Now, all we have to do is configure apps to use ALSA and to use swmixer as the audio device. In order to test the newly created mixing device, you could try:

aplay -Dplug:swmixer soundfile

If this works, try in several terminals concurrently.

XMMS:
1. open configuration dialog (CTRL+P)
2. choose "ALSA x.x.x output plugin [libALSA.so]"
3. press "Configure" button for advanced configuration
4. check the "user defined" toggle
5. replace whatever is on the textbox for your new device swmixer (leave other settings untouched)

gaim:
On gaim's preferences dialog, go to Sounds section, and choose Command on the Sound method setting. Then, on the Sound command textbox, enter:

aplay -Dplug:swmixer %s

Now gaim won't hang anymore whenever it plays a sound.

Monday, January 24, 2005

linux 有这样的音频播放器就这么难吗

1. 可以放mp3, wma, ape (xmms-mp3, xmms-wma, xmms-mac-in)
2. 可以搜索playlist (xmms有插件可以)
3. 可以rate每首歌,像itune一样.
4. 可以在playlist里直接删文件
5. 可以正常显示中文tag

基本上xmms好像都可以了,就是没有rating这个功能,郁闷,要求就这么高吗? 咋就没有一个软件可以全有这几个这么简单的功能呢?
==============================
好像amaroK现在做的不错...不过somehow i don't like kde...-_-!

Friday, January 14, 2005

Synchronizing FTP Files with Perl | Linux Journal

Synchronizing FTP Files with Perl | Linux Journal - A nice perl script that just matches what i need...Many thanks to the author Luis.

Thursday, January 13, 2005

Font-handling Puzzles
Handling fonts in linux is really a pain especially when tuning about Chinese display with new fonts. After reading an article "A font primer for Linux" written by Nathan Willis , I finally got a rough idea about this kind of type-display magic.

Rough ideas of all puzzle concepts about fonts in linux:
1. fontconfig: Fontconfig is a library for configuring and customizing font access.
2. xft: provides a client-side font API for X applications. It uses Fontconfig to select fonts and the X protocol for rendering them.
3. FreeType: is a free, high-quality portable font engine used by Xft to rasterize fonts

Summary:
A lot of applications, GNOME, KDE, GTK+/Pango, QT, despite of their internal dependencies, uses xft to request for string displays with specified font. And xft uses fontconfig to find the font in the system, and uses FreeType font engine for accessing and rendering font. Furthermore, FreeType supports a variety of font formats like Type 1(adobe), TrueType(apple), OpenType(ms&adobe), ...

Therefore, fontconfig should be the right target and the lowest level for configuring font usage after installing new fonts. I've also checked a simple way of installing a TrueType font manually, but which hasn't been tried yet. Basic steps as follow:
1. move font files(.ttf) to /usr/fonts/...
2. cd to that directory you put files, and do commands "> mkfontscale && mkfontdir"
3. add fontpath to "file" section of X config file, for fedora core, it's /etc/X11/xorg.conf
FontPath /usr/fonts/....
4. restart X.

Wednesday, January 12, 2005

Test from Drivel

A nice blogging tool of LiveJounal for Gnome! 中文支持吗?

Monday, January 03, 2005

Editing ability - vi

What I love about vi (not mean to be exclusive):
1. I don't need to leave the edit environment such as switching from GUI application when I happen to need some console operations.
2. Full featured editor for console. Basically it meets all I need at present. Let me list some features I use most:
- text navigation: "[[" goes to the head, "]]" goes to the end.
- copy, cut & paste: "yy" for copying current line, "dd" for cutting the current line, "p" for pasting
- find pattern: "/pattern"
- find&replace: ":g/pattern/s/target/replace/g", 'pattern' is a longer text than 'target' to locate, and 'target' is the exact pattern that 'replace' will replace. of course, 'target' is supposed inside 'pattern'.
- run external commands: ":!command"
- run shell: ":sh"
- word count: ":!wc -w %"
- spell check: ":!ispell %"
- latex compile: ":!latex %"
- dvi2pdf: I don't know how to run it inside vi 'cause %'s extension changes to dvi, and even pdf if i also want to view the final pdf. Please tell me if anyone knows.
3. Reliable failure recovery mechanism. swp files...

The only thing that I feel sad about vi:
1. I cannot easily copy a long text from vi to external applications, e.g. browser. Of course I can use mouse selection for copy and middle-click for pasting, but I refer to a "long" text that may span several screens of display. I just cannot be that way of copying, scrolling, and copying again in order to copy the whole text.

Sunday, January 02, 2005

Modify Firefox Interface Fonts

since firefox is built on gtk2, its interface font is controlled by gtk2 font config. add or modify in ~/.gtkrc-2.0 as follows:
gtk-font-name="MiscFixed 10" # replace the font name as like

Friday, December 31, 2004

Monkey's Audio Forum - Linux ape player mini how-to

Monkey's Audio Forum - Linux ape player mini how-to: "Salve !!! You can get APE XMMS plugin from: http://rpm.pbone.net/
just find in search engine this RPM's and instal :
xmms-in-mac-0.2.1-alt2.i586.rpm (plugin)
and additional library libmac.so.2
libmac.so.2 you will find in : libmac-3.99.u4-alt2.i586.rpm

and enjoy ape quality sound in xmms ."

Couldn't execl robot child process: Permission denied

Unfortunately I ran into this problem today when using Jabref, a bibtex tool. It never happens to my windows system. With the help of google and the following hints, fortunately the problem was successfully killed. :)

===============================
original post
"execl" is a system call, So, the api was trying to run a native application to assume the controls of the keyboard and mouse.
When jvm tries to create a child process to execute this function, it receive the message from OS (linux): "Permission Denied".
Search for two files on directory jre/lib/i386: awt_robot and awt_robot_g. Then use "chmod +x" on both files as root and the Robots will be created without error messages.

Samir

Wednesday, December 29, 2004

Towards A "Usable" Free Software System

Recently Singapore governement announced a new law for protecting intellectual right against piracy. Probably it even prompts the attentions of people to the linux? But why not use a totally free system without the risk of being accused if say you don't have enough money? Let me try to evaluate the current GNU licenced "free" software systems, so that we could have enough courage for the safe switching. In fact, from my personal experience, quite a few linux-based systems have been already qualified enough for replacing windows. In this post, I will only discuss one possible instance{Linux+Gnome+Firefox} that I am using, and sth that might be a little problematic for linux system to handle.

1. Web browsing:
1) Java support for some internet banking: firefox + java plugin
2) Standard coded streaming media playback: firefox + mplayerplug-in
3) ActiveX coded streaming media playback: firefox + mozilla activex plugin
4) ActiveX enabled pages or sites: {probably cannot at present}
5) Fast&reliable downloading: firefox/flashgot+download X
6) Gmail support: firefox

2. Messaging:
1) Email: evolution/OWA for exchange, hotwayd for pop3 gateway of httpmail(yahoo,hotmail), my simple perl script can handle pop3 mail retrieval and even forwarding via smtp. mutt is great for text-base email client.
2) Instant chat: gaim-msn/yahoo/qq/...

3. Basic Editing: vi

4. Office suite(optional): OpenOffice(compatible to ms office)

5. Latex system: tetex(latex, xdvi, dvipdf,...), vi, gpdf, ggv

6. Entertainment:
1) mp3 playback: xmms, rhythmbox, xmms-mp3, gstream-plugin
2) avi/divx & windows media playback: mplayer
3) dvd playback: xine player
4) cd playback: cdplay (gnome) 7. System update or upgrade: yum, apt-get, or simply reinstall your whole system;), which doesn't take too much time in fact.

Summary: good thing is that they are all free, bad thing is that setting them up requires experience or self-study, which takes time. so it's desirable that the free system community can build a frequently updated handbook for newbies to setup their usable system.

What else do you need?

Tuesday, December 28, 2004

English Interface with Chinese support

1. Select Chinese language when login (e.g. GDM login)
2. export LC_CTYPE="zh_CN" #for chinese encoding including input method
3. export LC_MESSAGES="en_US" # for interface language

type '$ locale' command to show current locale settings.

Monday, December 20, 2004

Handy Tips for FC3

Remove system icons on Gnome Desktop:
1. Applications -> System Tools -> Configuration Editor
2. apps->nautilus->desktop: untick those you want to remove

A few tips of FC3:
http://home.gagme.com/greg/linux/fc3-tips.php

中文字体美化:
Check the following link for a better solution:
http://www.linuxsir.org/bbs/showthread.php?s=&threadid=68734
----------------------------------------------------------------------------------------
Check http://www.linuxsir.org/ periodically for any update of improving Chinese font display.
1. copy simsun.ttc from Windows to /usr/share/fonts/zh_CN/
2. run command "fc_cache /usr/share/fonts/zh_CN/simsum.ttc"
3. continue instructions as said here.
After that, chinese characters are defaultly displayed in simsun. English characters can be changed freely in standard control panel of Gnome or KDE.


Saturday, December 18, 2004

Nightmare for Installing Fedora Core 3 - The Second Day

The Second Day
With the first day's experience of installing Fedora Core 3, I thought I am so good at handling this, and nothing's gonna be barrier for installing without the partition issue. I was totally wrong for it!!! God knows what's gonna happen! The second day is even worse, when I attempt to upgrading Red Hat 8 on my lab machine.

1. With the same method of installing from iso images(successful in the first day), I boot the machine into GRUB for NT. Let GRUB locate the kernel and run the installer. But installer assertions came after I selected the language and keyboard layout. Something like "assertion(heads>0) at disk_doc.c ...". Began to be a little angry since nothing happened to my laptop installation on the first day. After all, I have to consult to the Internet by rebooting into the pre-existing windows.

2. With help of google, the problem is confirmed as a bug of FC3 installer. People are discussing their solutions or viewpoints or problems after the filed bug, where I decided to try some of the solutions claimed to be successful in individual case, though the real cause of the bug is not that clear to me. 1) the first notable and related solution is to use the command "sfdisk -d /dev/hda | sfdisk --no-reread H255 --force". I use a Knoppix CD to boot the machine and typed that command, but the same errors happened. 2) the second solution seems to be tricky and helpful, but it's the source of my later nightmare. Some said he uses partition magic to resize all windows partitions to enforce a "rewrite" to partition table, and he succeeded without any errors through the installation. I installed Partition Magic 8(PM), and it pops up a message saying that something is wrong with the "LPBR" records, or LBPR?(forgot), on my second drive. It was really confusing to me since so far I am not dealing with any stuff on the second drive, it's just a well-working drive for all my data, no OS or other stuff on it. This moment was really horrible for me and counted for all later troubles. I selected to correct the error PM detected. And the second and third partition of that drive all gone. PM was really a nightmare! Most silly tool I've ever seen. Misleading me to lose data on a completely unrelated drive!

3. Originally, I am stuck in the strange installation problem. And now suddenly I lost two partitions of 50G data in total with the betray of PM8!!! Crashing situation for me, you know...I really suppose the installation on my lab machine should be a piece of cake with no more than a hour's job. But I was again pulled into marsh, deeper and deeper...

4. As a sharp tool, I started to consult my diskman, which is located on the bootable CD of WinMe used on the first day. I cannot imagine it simply does not run as expectedly as on my laptop. Can't believe this! This CD boots all other machines with perfect runs of diskman but fails only on my lab machine for no excuse, and especially when I was so sucked. It's not kinda starting failure, but runs with messed display. I cannot even see a word on the program interface. How can I use then?! I should say God is punishing me now.

5. I suddenly though it might be a problem of Dell LCD panel problem. So I changed the monitor with other non-Dell machines in my lab. It's only possible on Sunday with few people in, you know ;) Otherwise, I must be stopped by technician -__-! In fact, at last my fancy idea didn't work at all. It's not a problem of a monitor, but the whole architecture or configuration used. My laptop and other machines are able to run, except my lab machine. Why?!

6. It was almost the end of the second day, and I have done nothing but faked 50G of my data and all these mess with horrible mood. Even the worst, I don't know what to do next.

7. Just a lucky side of the second day, I found I have ever burned a Paragon bootable CD which is able to run DOS 7,which might be possible to boot a DOS with better support of monitor display. I was right this time. A great hope rase. And the diskman this time perfectly recovers the partition table on this drive. It knows it should not disappoint me any more...:)

8. Back to deal with installing problem, i.e. "assertion (heads>0) ..." problem. I followed all solutions discussed in official bugzilla site except the "installer update" since it requires rawrite an update img to a floppy disc which is almost impossible to find nowadays. Fortunately, the only person in my lab having floppies is in presence at the moment! where I decided to do the final try with no more struggles. Furthermore, I hadn't used this solution because I also have to burn all ISO images into CDs to perform the installation update. Now I've already deviated far from my original plan. What I want is to finish this sick stuff. I was near to crash mentally as well as physically.

9. Another thing worth mentioning, I don't know it's lucky or unlucky side, is that at that moment I had exactly 4 free CDRs! If I had fewer than 3, would I have killed myself? haha... After burning all 4 CDs, I successfuly passed that error messages until the end of installation.

10. I should say, it's not the end of the story, that's also why it's worth the blog. Rebooting after installation, Grub starts with "loading stage2 ...", and nothing happened! You know what I feeled. I got a motivation of murdering! That's called kill! Furthermore, I thought this would be a great moment for me to train myself to be more cultivated, and well-minded. Quickly reorganize my mood, and I got the idea of booting into Knoppix, and find someway to re-install GRUB 'cause I thought it was due to an improper writing of GRUB to MBR. Since I was a newbie of that, learn it right away from Internet. Finally, I got the idea of using "grub-install" to rewrite GRUB to MBR. A little trouble of doing that because I have nothing to boot into the new Fedora to do "grub-install". All I do is to install a free GRUB, and after rebooting, I manually specify the partition for kernel(vmlinuz-version) and ramdisk(initrd-version.img).

Summary: details are omitted, but enough to show the nightmare I experienced. I shouldnot say all that is bad 'cause I learned a lot from that. For example, how to deal with grub, cfdisk, sfdisk, ... and got a lot more knowledge over partition table and disk structures from the data loss.

Furthermore, I thought bad lucks will let you see the good lucks.
1. Damn WinXP blue crash! Thank Zhou Chen for his mobile hard drive for swapping.
2. Damn PM8! Thank Huiqing for his CD with diskman, and myself with Paragon CD.
3. Damn FC3 Installer Bug! Thank Haijie for his floppy disks.

Install Fedora from ISO images

The idea is just to let the computer boot from new kernel and ramdisk for installation, which will let you specify the specific way for installation including local CD-ROM, Hard Drive, FTP, NFS image, FTP, and HTTP. Although the post title mainly means for installing from hard drive, other ways are same with the following methods. Furthermore, if you can find a fast mirror of ISO images, FTP would be a great option.

Prepare Files Beforehand
1. download kernel and ramdisk files: vmlinuz and initrd.img
If you are in singapore, you can download here: ftp://ftp.oss.eznetsols.org/linux/fedora/3/i386/os/isolinux/

Using NTLDR for NT/XP
If the preexisting system is windows, then you need a program called GRUB for DOS/NT which includes file "grldr" and directory "/boot". "/boot" includes the /boot/grub/menu.lst that will be used by grldr. You put vmlinuz and initrd.img in /boot/, and move the whole directory and grldr to the root of first partition where NTLDR is, usually C:\. So far, we have C:\boot\grub\menu.lst, C:\boot\vmlinuz, C:\boot\initrd.img, C:\grldr. Then we need to modify C:\boot.ini (disable read-only temporily). Add the following line:
C:\grldr="Start Grub ..."
This lets NTLDR to insert a menu option when startup, you will be able to choose this option to start grub for installing linux. Another file to modify is menu.lst, add following lines:
title Install Fedora
kernel (hd0,0)/boot/vmlinuz
initrd (hd0,0)/boot/initrd.img

This lets GRUB add a menu option "Install Fedora", after you select "Start Grub" in NTLDR menu list.
Done! Reboot to select "Start Grub..." and "Install Fedora", the installer will be activated. You can install from ISO images. I provide a link here for downloading the grub for nt.

Using existing GRUB of a linux system
It's much easier. Reconfig grub by editing grub.conf to add one more menu option for installation. Store vmlinuz and initrd.img at a partition where grub can load with, i.e. matching what has been specified in grub.conf. For syntax of grub.conf, check manual of grub.

Nightmare for Installing Fedora Core 3 - The First Day

Two consecutive horrible days for me...I just don't want to recall it, but for a thing to record. Let's see who is able to have a worse luck of it.

The first day
1. I decided to install FC3 on my laptop with WinXP pre-existing. Before doing actual installation , I went to check my disk allocation in disk management tool, followed by the first luck. WinXP suddenly crashed blue, and was not able to boot up due to the potential partition table damage during system crash.
2. To diagnose the problem, I borrowed a bootable CD for WindowMe with a bunch of disk tools. From my experience, I love the tool called "Diskman" for checking partition table. But this time, it was just not that strong to detect all partitions. Instead, It prompted me that there is a partition table in the second sector of c0-h0, i.e. after the boot sector, and asked me if it should rewrite with it. Considering diskman was not able to detect all partitions, I risked the great to confirm this action. The worst thing is not my confirmation, but I hadn't backup the partition table in the first place. In fact, it's not a slipping of my mind either, 'cause my laptop has no floppy drive, and the only available partition is NTFS, which is not readable at that moment. I just didn't have any place to backup. My mad decision made the first reboot exciting because the machine resurrected. But diskman this time didn't save me, but put me to the situation that my D: partition gone! All my data is on it!!! so far, my machine can boot up again, but partition D lost.
3. Machine alive again, but data lost. Luckily, I could use resurrected WinXP to check over the Internet for solutions to recover my data. Though it took a little time, yet went smoothly, I finally found a software called EasyRecovery, which is able to recover all my data by scanning the disk sector by sector, and with so called "file signature" technique to identify all files and directories like a miracle. The only bad thing is that it takes a long time to identify all data because the lost partition has 18G! Furthermore, it needs a non-source partition for storing the recovered data. Since no more space(considering the lost partition) I have on the laptop, fortunately one of my labmates has a mobile harddrive with enough free capacity as my temporary swap. This was my real lucky side.
4. After scanning, saving recovered data, reclaiming the lost partition(formatting), and swapping in, it was almost the end of the day, considering every action is over a large volume with certainly not the full speed transfer. And finally it came to my very first goal of all the mess, i.e. installing Fedora Core 3. I copied all 4 iso images from pre-download location to my laptop, and start installing from hard disk. Another real lucky side of the day was that the installation went smoothly.

It's not the end of my luck ...

Friday, December 17, 2004

Ns2 Building Experiences

building ns2 in linux proves to be troublesome, especially with specific combination of the ns2 versions and os versions. more or less the problems lie in legacy issues of gcc and ns2 source. i collect here my personal experiences of building ns2 over a constantly upgrading linux systems in an "issue-with-patch" manner.

Ns2 version I used in all platforms: ns-2.1b6, tclcl-1.0b8, tcl8.0.4, tk8.0.4, otcl-1.0a4

Fedora Core 3 (gcc3.4.2):
1. compiling tclcl:
tclcl-mappings.h: In static member function `static int TclObjectHelper::dispatch_(void*, Tcl_Interp*, int, char**)':
tclcl-mappings.h:51: error: incomplete type `Tcl' used in nested name specifier
tclcl-mappings.h:52: error: invalid use of undefined type `struct Tcl'
tclcl-mappings.h:41: error: forward declaration of `struct Tcl'
tclcl-mappings.h:57: error: invalid use of undefined type `struct Tcl'
tclcl-mappings.h:41: error: forward declaration of `struct Tcl'
make: *** [Tcl.o] Error 1

[apply the following patch]
 #include "tclcl-config.h"

-#include "tclcl-mappings.h"
#include "tracedvar.h"
+// tclcl-mappings.h included below, AFTER definition of class Tcl

struct Tk_Window_;

@@ -158,6 +158,8 @@
Tcl_HashTable objs_;
};

+#include "tclcl-mappings.h"
+
class InstVar;

class TclObject {
2. compiling ns2:
locdbase.cc: In member function `virtual int LocDbase::command(int, const char* const*)':
locdbase.cc:67: error: array bound forbidden after parenthesized type-id
locdbase.cc:67: note: try removing the parentheses around the type-id
make: *** [locdbase.o] Error 1

[patch] locdbase.cc:67: table_ = new (MobileNode *)[nn_]; --> table_ = new MobileNode *[nn_];

./arp.h:126: error: `void ARPTable::arprequest(nsaddr_t, nsaddr_t, LL*)' is private
ll.h:82: error: within this context
make: *** [trace-ip.o] Error 1

solution: make the method "public"

Red Hat Linux 8:
1. "memcpy""memset""bcopy""bzero" declarations have collision in string.h
solution: comment the declaration of "bcopy" and "bzero" in /usr/include/string.h
2. "friend declaration requires class-key"
solution: add 'class'or 'struct' after keyword 'friend'
3. rap/utilities.h:59:9: "and" cannot be used as a macro name as it is an operator in C++, rap/utilities.h:60:9: "or" cannot be used as a macro name as it is an operator in C++
solution: comment "and" and "or" macro definition in file rap/utilities.h
4. some error message may be given like this: 'default argument is given after the specification ...', which means no need to specify default argument when implementing.
solution: remove the default value specified in the function implementation part.