Friday, August 26, 2005

Fast Delicious Bookmarklet

Today I noticed that Chris Lott was looking for a super-fast way to post to del.icio.us after having posted a link to this bookmarklet on his del.icio.us link page.

The bookmarklet provides the following functionality:

* The ability to type ‘d tag1 tag2 …’ on the location bar to tag a new URL.
* If you select a block of text on the page, that is saved as the extended description. (Borrowed from here)
* The window is automatically closed after the link is posted. (Wanted by the author)

If you wish to use this, in Firefox, there are a couple steps which you have to take:

1. drag this link to your toolbar
2. Right-Click the bookmarklet and select properties.
3. In the Name field, change it to something like ‘tag’ (or whatever you like).
4. In the location field look for the text ‘CHANGEME’ and replace it with your del.icio.us username.
5. In the keyword field of the property window type the letter(s) that you would like to use to do your quick tag. I like to use ‘d’. (thanks craig!)
6. Click OK to close the Properties window. Now go to the location bar go to ‘about:config’.
7. Note: If you’d rather not have the window automatically close, skip the next two steps.
8. In the search field type ‘allow_sc’.
9. Right-Click the field labeled ‘dom.allow_scripts_to_close_windows’ and click ‘Toggle’.
10. You will now be able to type ‘d tag1 tag2 tag3…’ in your location bar then hit enter (just like if you were entering a URL). This will easily tag a page - enjoy! Don’t click the link in your bookmark toolbar, as you’ll end up tagging your pages with ‘%s‘!

from: http://ejohn.org/blog/super-fast-delicious-bookmarklet/

Wednesday, August 24, 2005

五步大幅提高firefox页面加载速度

1.先在地址栏键入about:config
2.Set "network.http.pipelining" to "true"
3.Set "network.http.proxy.pipelining" to "true"
4.Set "network.http.pipelining.maxrequests" to 30
5.单击右键,选择新建->整数,命名为nglayout.initialpaint.delay,值为0

Tuesday, August 23, 2005

linux sound system

from:http://ubuntuforums.org/showthread.php?t=26567&highlight=realplayer
from:http://ubuntuforums.org/showpost.php?p=80282&postcount=21
Introduction

Many questions are related to sound. In many cases, there is no hardware problem, but simply a lack of understanding how the system works.
Here are some technical explanations. It's a bit complicated, so if you really do not get the point, please go straight to the next topic.

Technical Explanations

OSS: Open Sound System
The Linux kernel is sending the sound to the sound card, by using the appropriate sound driver. A long time ago, the system which allowed to do that was OSS. Many drivers have been developed for OSS. Applications thus use the OSS interface to send sound to the driver.

ALSA: Advanced Linux Sound Architecture
OSS is not technically perfect, so a better system has been developed, namely ALSA. As a consequence, programs making use of sound have to be rewritten in order to be able to use ALSA instead of OSS. That's why, for example, xmms has an OSS plugin and an ALSA plugin. (The output plugin can be chosen in xmms, in options -> preferences).
Nevertheless, for older applications to go on working, a compatibility layer exists in ALSA. It ensures OSS applications believe they do use OSS while they actually use ALSA (as for example the flash plugin).

ESD: Enlightened Sound Daemon
In theory, only one sound can be played, since there is only one loud speaker. In order to play many sounds, one uses a sound mixer. That's the role of ESD. Applications send their sounds to ESD, the latter mixes these sounds, sends the result to OSS, which transmits it to ALSA.

In case you have a problem, read this before you post on the forum

One must be aware that only one application can use the sound card. In the default configuration, ESD (which is itself an application) is launched on startup and has access to the sound card.
In most cases, you cannot get sound simply because ESD blocks the access to the sound card.

The first thing to do is thus to kill ESD (use the command: killall esd), and then to have a look at what applications use the sound card:
Code:

lsof /dev/dsp

tells you which programs use OSS
Code:

lsof /dev/snd/*

tells you which program use ALSA

Before you post, please check that all this is empty, and tell it in your post.

Howto properly configure the sound

A good thing to do is to tell ESD not to run when one does not need it. Do (assuming gedit is your prefered editor):
Code:

sudo gedit /etc/esound/esd.conf


and edit it so that it looks like
Code:

[esd] auto_spawn=1 spawn_options=-terminate -nobeeps -as 2 -d default spawn_wait_ms=100 # default options are used in spawned and non-spawned mode default_options=


Restart your session, and normally you should not have problems with games such as frozen-bubble. You just have to stop the music two seconds before you start the game.

You still have some problems !

Please follow these steps:

1) Check your loud speakers, if they are properly plugged in, etc...

2) Check the sound volume ! In alsamixer, MASTER, PCM must be at some high value value, and without MM above or under.

3) If the music seems to play properly but you hear nothing, check the above two points. If Linux does not detect the sound card, it NEVER plays any sound ! and LWAYS gives an error ! Check that your computer does not have two sound cards, and plug your loud speakers on the other one (using a particular sound card is another problem).

4) If you get an error message of the type: "Not found or busy", check with "lsof" (see above)

5) In any other desperate situation, post on the forum and give:
- the precise error type
- the precise model of your sound card
- the result of "lsmod|grep snd"

Howto go further: listening many sounds at the same time, without ESD !

Now it becomes more technical and so also facultative. But it can be of interest for more than one person.
!!! BE CAREFUL !!! You should try the following only if you already managed to get proper ALSA sound (for example xmms manages to play with the ALSA plugin).
It is not clear that the following will work for any sound card.

The first thing to be done is to tell ESD to use ALSA instead of OSS:

Code:

sudo apt-get install libesd-alsa0



One now creates the asound file:
Code:

sudo gedit /etc/asound.conf


which should look like
Code:

pcm.card0 { type hw card 0 } pcm.!default { type plug slave.pcm "dmixer" } pcm.dmixer { type dmix ipc_key 1025 slave { pcm "hw:0,0" period_time 0 period_size 1024 buffer_size 4096 periods 128 rate 44100 } bindings { 0 0 1 1 } }



Then one restarts ALSA:
Code:

sudo /etc/init.d/alsa restart



Restart your session (that's for ESD), and there you are, you should in principle be able to hear all the "click click" of the interface, to listen to music with xmms, and to play a video with totem, everything at the same time (applications must use ESD or ALSA, ALSA being a better choice).

The only dark point: OSS applications can still only have access to the sound card one after the other, which is the case of the flash plugin. Thus it is necessary to switch off all sound before launching a flash animation. Sometimes one even has to restart the navigator.

If someone knows a trick to make flash use ALSA or ESD, please tell us ! About this, you can go and see the post by wrochal in this thread

For people having two sound cards: You should have a look at the posts by MonoLT in this thread, and at his thread called 'HOWTO Set sound if you have 2 soundcards', http://www.ubuntuforums.org/showthread.php?t=27186


------------------------------------------------------------------------------
Here's my solution (it enables Realplay to work either standalone or as mozilla plugin)

1. Enable Alsa soft-mixing as described in post http://ubuntuforums.org/showthread....+multiple+sound
(also setup esd and multimedia system settings as described in that post)

2. Install realplayer as described in http://ubuntuguide.org/#realplayer

3. Install alsa-oss

4. Open the launcher script realplay located in Realplayer's install directory (/opt/RealPlayer if you followed previous instructions)

5. Find lines
Code:

if [ -n "$LD_PRELOAD" ]; then echo "Warning: LD_PRELOAD=\"$LD_PRELOAD\"" fi


6. ...and after add this code:
Code:

LD_PRELOAD="$LDPRELOAD:/usr/lib/libaoss.so" export LD_PRELOAD



7. Now you get RealPlayer working with Alsa mixing (and so combinations of Realplay, Xine, Mplayer, Frozen Bubble,...sounds work at the same time \\/ )

Friday, August 05, 2005

true type font create in fc3

-choose the true type fonts' location, e.g.: /usr/share/fonts/zh_CN/TrueType
copy windows fonts(e.g.:tahoma.ttf, tahomabd.ttf, simsun.ttc, mingliu.ttc) to: /usr/share/fonts/zh_CN/TrueType, and rename *.ttc to ttf

-change the truetype fonts' access attributes
chmod 744 /usr/share/fonts/zh_CN/TrueType/*

-if the font is scalable (e.g.: SimSun), need to generate the scale file first at the truetype font's directory.
mkfontscale && mkfontdir

-modifty the file: /etc/X11/xorg.conf (this file is the xorg version of XF86Config), and add your true type's font path to the FontPath.
FontPath "/usr/share/fonts/zh_CN/TrueType/"

-execute fontcashe
fc-cache -v -f