显示标签为“linux”的博文。显示所有博文
显示标签为“linux”的博文。显示所有博文

2011年10月25日星期二

linux下浏览器backspace后退键使能

firefox版:
现在在用的fedora默认firefox,安chrome还会说可能存在各种隐患。。。先说这个吧。
进入设置界面,在地址栏输入:
about:config
搜索backspace,理论上只有一个选项叫:
browser.backspace_action
它的值设为0,即可实现回览需求。
具体如下:
0: Pressing [Backspace] will go back a page in the session history and [Shift]+[Backspace] will go forward. (Default in Windows)
1: Pressing [Backspace] will scroll up a page in the current document and [Shift]+[Backspace] will scroll down. Except Camino that does not implement any behavior for the value 1, which is unmapped. (Default in Linux builds before 2006-12-07)
Any other integer number: Any other integer value will simply unmap the backspace key. In Linux builds after 2006-12-07, the default is 2.

chrome版:
有一个插件在这里:
http://www.chromeextensions.org/appearance-functioning/backspace-as-back-for-linux-2/
参考:
1.http://www.mydigitallife.info/disable-or-enable-backspace-as-go-back-page-browsing-function-in-firefox/

create root locus in octave

MIT has make a clear tutorial of this topic.
http://web.mit.edu/6.302/www/compare/report.html
However, it doesn't work in my machine. 
I use the following codes to create a root lucos and it works!

s = tf ('s');
L = 3e4 * (0.05*s + 1)^2 / ((s+1)^3 * (0.01*s + 1));
rlocus(L);
It seems that matlab perform much better ;-P

2011年10月11日星期二

fedora 15 中文安装问题汇总(1)

最近安装了fedora15(电子定制版),和之前的ubuntu有很大不同。
现在总结遇到的问题,及解决方案如下:

1.vim问题:
fedora15默认只安装了vi,对于我这样的vim粉来说实在难以接受。。。。使用yum安装了vim,而后发现fedora的vim配置方法和ubuntu不太一样。配置文件位于
/etc/vimrc
而不是ubuntu的
/etc/vim/vimrc*
为方便起见,设置/etc/vim/vimrc.local,在这里记录自己的vim配置。而正规vimrc里只需要在最后一行加入:
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
相关vim配置文件详见:
http://linuxtoy.org/archives/vimrc.html

--------------------------------------------------------------------------------
2.引号问题
在安装时设置键盘为U.S. Internetional,现在发现无法打出引号。
解决方案如下,终端输入:
system-config-keyboard --help
得到:

Usage: system-config-keyboard [--help] [--noui] [--text] [<keyboardtype>]
       --help            Print out this message.
       --noui            Run in command line mode.
       --text            Run in text interface mode.
      
       <keyboardtype> options are: ar-azerty, ar-azerty-digits, ar-digits, ar-qwerty, ar-qwerty-digits, be-latin1, ben, ben-probhat, bg_bds-utf8, bg_pho-utf8, br-abnt2, cf, croat, cz-lat2, cz-us-qwertz, de, de-latin1, de-latin1-nodeadkeys, dev, dk, dk-latin1, dvorak, es, et, fi, fi-latin1, fr, fr-latin1, fr-latin9, fr-pc, fr_CH, fr_CH-latin1, gr, guj, gur, hu, hu101, ie, is-latin1, it, it-ibm, it2, jp106, ko, la-latin1, mk-utf, nl, no, pl2, pt-latin1, ro, ro-cedilla, ro-std, ro-std-cedilla, ru, sg, sg-latin1, sk-qwerty, slovene, sr-cy, sr-latin, sv-latin1, tj, tml-inscript, tml-uni, trq, ua-utf, uk, us, us-acentos

国内大部分键盘都是us,所以直接输入:
system-config-keyboard us
 测试发现这个只能起个暂时作用 ,因此耍个无赖,把这个语句加入
/etc/rc.d/rc.local
(这个问题至今未解决,后续跟进如下)
完成上述设置后发现还是没有变化。查阅资料发现有个
system-setup-keyboard 
可以将keyboard信息传入x11的相关设置中,这些也都改了,但是还是没有达到预期效果,要么改不了要么就是暂时的。想深入追究此问题的可以用 grep看看还有哪里涉及键盘设定。我这里就直接重安了一遍。。。。。

----------------------------------------------------------------------
3.中文输入法:
在ubuntu下就用过ibus-pinyin 和google-android的linux版,在网上发现还有ibus-sunpinyin,貌似功能比之前两个强大些。主要是google输入法在linux下没有联网,实力发挥不出来。还望相关人士努力啊!
安装方法还是用yum,就不多说了。

值得一提的一点是sunpinyin默认是不支持使用-/=切换page的,这对拼音用户来说十分不便。更DT的是sunpinyin的输入法首选项十分隐蔽。。。。。。找到这货很简单,在一个文本输入页面下选出sunpinyin输入法,右击输入法图标即可找到首选项。

-----------------------------------------------------------------------
目前只遇到这三个,未完待续

2011年10月6日星期四

Control mouse movement in linux


Related topic from my stackoverflow:
I used to write /dev/psaux to directly change the mouse movement. But it failed.
Xlib is also a good idea when not working with OpenCV. It seems some OpenCV stuff, maybe highgui, does not go well with Xlib.
So I try to write
 /dev/input/mouse* 
OR 
/dev/input/event*
By using
cat /proc/bus/input/devices
I get this:


I: Bus=0003 Vendor=0461 Product=4d81 Version=0111N: Name="USB Optical Mouse" P: Phys=usb-0000:00:1d.0-1/input0S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/input/input10U: Uniq= H: Handlers=mouse2 event10B: EV=17B: KEY=70000 0 0 0 0 0 0 0 0B: REL=143B: MSC=10
After testing, only
/dev/input/event10
works. The code is as following:


#include <stdio.h>
#include <unistd.h>
#include <linux/input.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>

int main(){
  struct input_event event, event_end;
  int fd = open("/dev/input/event10", O_RDWR);
  if(!fd){
    printf("Errro open mouse:%s\n", strerror(errno));
    return -1;
  }
  memset(&event, 0, sizeof(event));
  gettimeofday(&event.time, NULL);
  event.type = EV_REL;
  event.code = REL_X;
  event.value = 100;
  event_end.type = EV_SYN;
  event_end.code = SYN_REPORT;
  event_end.value = 0;
  for(int i=0; i<5; i++){
    write(fd, &event, sizeof(event));// Move the mouse
    write(fd, &event_end, sizeof(event_end));// Show move
    sleep(1);// wait
  }
  close(fd);
  return 0;
}

2011年10月5日星期三

Learn vim online

If you are using vim, try this! Cool!

Here is a interactive vim tutorial: