Tuesday, September 2, 2008

Send pictures to flickr with thunar file manager

1. install postr (under archlinux use: yaourt -S postr)
2. create a file under ~/.local/share/Thunar/sendto/postr.desktop (if directory not exist, create it):

[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
TryExec=postr
Exec=postr %F
Icon=postr
Name=Flickr
MimeType=image/jpeg;


3. open thunar and select a picture for upload. (right click -> sendto -> flicr) . multiple pictures supported.

4. authorise postr.

5. enjoy it~~

Wednesday, May 28, 2008

generate html with tex4ht

sudo texhash

htlatex xxxxxxxx.tex

Thursday, January 31, 2008

Make glossary for your LaTeX work.


% At first add these two lines in your preamble to load the glossary package and create refence.
\usepackage{glossary}
\makeglossary

% This line is for your output.
\printglossary

% In document you can create your glossary entry like this:
GPL\glossary{name={GPL}, description={General Public License}}

At last, you must run this command in your terminal:


makeindex -s yourfile.ist -t yourfile.glg -o yourfile.gls yourfile.glo

Sunday, January 27, 2008

Setup hotmail in your thunderbird under UBUNTU

You needn't login hotmail to check your new mails (maybe spam) now. Webmail extension is born for it. Webmail supported not only for hotmail, even more, check here: http://webmail.mozdev.com.

Under ubuntu to setup webmail is so simple. Go to the homepage of webmail, download the extension of webmail, and the component for hotmail. Then install them into your thunderbird.

Restart your thunderbird, what for? You knows it ;)

Go to the preference and change all of port number here bigger than 1024. Restart thunderbird again...

Now, open the menu: File->New->Account, Select "Web Mail" to continue. Follow the wizard and supply what it wants. Don't forget that, your incoming name is your full domain email address.

After that, open the preference of "hotmail component" in your addons. You can see your fresh new account here. Check on the "WebDAV", then everything should be fine. Fetch your mails and have fun.

Wednesday, January 23, 2008

Restart Gnome-Do with Gnome-Do

UPDATE: Now we can by setting the /apps/gnome-do/preferences/enable_updating gconf key to true to resolve this. Thanks Christopher~~

Like the most applications, Gnome-Do can not load the most recent changes you made after you have already launched Gnome-Do. So I wrote this script to resolve this problem. Stupid way, but works, :)

Copy the source code below and save a file named restartdo in /home/[uid]/bin or you wished destination. Then run chmod + x /home/[uid]/bin/restartdo to give this script the ability to execute. Don't forget to replace the [uid] with your user name.

Now, check if your directory already in ~/.do/FileItemSource.config. If not, add in it. Restart your Gnome-Do, try this script, have fun with Gnome-Do.


#!/bin/bash
# vim:sts=4:ai:et:

x=3
while (( x-- > 0 )) && {
killall gnome-do >/dev/null 2>&1
ps x | grep Do | grep -v grep >/dev/null 2>&1
}
do
sleep 3
done

if {
ps x | grep Do | grep -v grep >/dev/null 2>&1
}
then
echo 'Failed to stop Gnome-Do'
return -1
fi

echo 'Gnome-Do stopped'


while ! {
ps x | grep compiz | grep -v grep >/dev/null 2>&1
}
do
sleep 3
done

exec gnome-do >/dev/null 2>&1 &
echo "Gnome-Do started"

Monday, January 21, 2008

Touchpad rocks

本来想写英文的 blog,可考虑到好像还没有特别详细的介绍配置 触摸板 的中文文章,还是用中文算了,一是可以给我 so poor 的英文语法遮羞,二来可以丰富一下中文的 Linux资源,三来一会还要继续我的 LaTex work,节省点查字典的时间。

不知道是不是大家都像我一样忽略了配置笔记本的触摸板,我似乎这些年都一直在用笔记本工作,学习,娱乐,一直都额外再配个鼠标,一直忽略了强大的触摸板。最近看了 Apple 刚出的 Macbook Air 的多功能触摸板,心血来潮,研究了一下 Linux 下面 X
的触摸板的驱动的配置,发现其强大无比,如果你早知道了,莫要笑话我,哈哈,let's go。

如果你装的是 Ubuntu 发行版,那么基本上你的 X 的配置文件里面已经设置好了相关的驱动,是默认设置,你只需要添加些相关的参数就 ok 了。下面的 ubuntu 默认的触摸板的配置:

Section "InputDevice"
    Identifier "Synaptics Touchpad"
     Driver "synaptics"
     Option "SendCoreEvents" "true"
     Option "Device" "/dev/psaux"
     Option "Protocol" "auto-dev"
     Option "HorizScrollDelta" "0"
EndSection


先让我们来使我们之后的修改不需要重启 X 就能生效,在上面的里面添加:

     Option "SHMConfig" "on"

然后重启一下 X,这样你就可以动态的通过 synclient 命令来修改你的触摸板的参数,当然也有 Gui 的程序,比如 qsynaptics。看你习惯吧,推荐用 synclient,只有命令行才最强大,不是么,哈。比如 synclient Var1=value1 Var2=value2 ....

因为各位的显示器的分辨率都不一样,所以默认的设置可能会让你觉得使用触摸板移动指针太慢了,没关系,let's correct this:

     Option "MinSpeed" "0.9"
     Option "MaxSpeed" "1.5"
     Option "AccelFactor" "0.0750"

这是我的设置,我的分辨率是 1920 x 1200, 所以你们酌情修改。。。一般来讲 MinSpeed 0.5, MaxSpeed 0.9, AccelFactor 0.0350 就 OK 了。

很多电脑上面的触摸板下面只有两个 Pads, 没有中键这怎么办?ok,这么办:

    Option "RBCornerButton" "3"

现在你点击你的触摸板的右上角就是中键了,帅吧。 一般触摸板的右下角是右键,右上角是中键,然后右面边缘是上下 scroll, 下面边缘是 左右 scroll,这些是默认设置,可以通过 synclient -l 来查看你机器上面的默认设置。

如果上面的一些和边边角角有关的设置不起作用的话,肯定是默认的 edge 的设置不对,你可以设置一下 LeftEdge,RightEdge,TopEdge,BottomEdge 来适应你的需要。

如果你的触摸板支持多点的话,你也可以设置成类似 MacBook 那样用两只手指 scroll 哦。

最后再推荐一个小程序,可以模拟测试你的输入设备的行为,xev。

还有很多微调的参数,man synaptics 自己去研究吧。

通过 synclient 只能即时的测试效果,如果想每次开机都有效的话,记得把合适的配置添加到你的 xorg.conf 里面,路径一般是 /etc/X11/xorg.conf。

Gnome-Do startup script

Gnome-do 是非常酷的一个 Linux 下的应用程序。最近更新了版本,插件的功能有所增强,现在已经是我不可或缺的日常应用了。我可以随便敲几个键就呼出想用的应用程序,可以随便敲入几个键就 播放我想听的专辑,可以随便敲入几个键就搜索出我想回顾的笔记,可以随便敲入几个键就和某个朋友聊天或者发送电子邮件,可以随便。。。very awesome。。。基本不用动鼠标了。。。如果你对 mac 下面的 Quicksilver 有所了解的话,就不难理解 Gnome-do 是干嘛的了,我只希望Gnome-do 的作者多多努力,早日赶超 Quicksilver,哈。

如果你也在使用 Linux,如果你也对键盘有特殊偏爱,那么我强烈想你推荐 Gnome-do,官方主页在这里:http://do.davebsd.com/ 去折腾吧。。。

现在的 Gnome-do 版本在启动的时候如果同时启动 Compiz 就有可能会出现 Conflict,导致背景变透明,这样在某些白色背景的应用程序上面可能就看不清楚字母了,没关系,写了一个 script 来解决这个问题,和解决 avant window navigator 类似问题的方法一样。

1. sudo vim /usr/local/bin/startdo
2. 输入下面的代码

#!/bin/bash
# vim:sts=4:ai:et:

while ! {
    ps x | grep compiz | grep -v grep >/dev/null 2>&1
}
do
     sleep 3
done

exec gnome-do -quiet >/dev/null 2>&1 &
echo "Gnome-Do started"

3. :wq! 存盘退出 vim
4. sudo chmod +x /usr/local/bin/startdo
5. 在你开机启动 gnome-do 的地方换成 startdo

enjoy it, 哈。