So Tired !_! 逆水行舟, 不进则退!

16Nov/10

How to Fix VirtualBox USB Device Support UBUNTU

Posted by Nick Xu

It is actually a known fact that there

is an issue with VirtualBox and the attached USB devices that many of us are trying to use in the virtual machine. Here is a real-life example:

I am a 100% Linux user and I have a photo printer that Linux can't recognize. Let's say that I want to print some photos quickly, to give them to someone. I have a Windows installation in a virtual machine just for this reason (sad, I know) and I want to access my printer, which is connected via a USB port. To my surprise, I can see the printer in the USB device list of VirtualBox, but I can't access it (very frustrating). Firing up Firefox and searching on Google for a fix takes too long, because there are many old tutorials that teach you how to modify various files or change permissions, etc. What to do? Well, below is the answer to the endless VirtualBox – USB issue (and it's pretty damn simple too!).

This tutorial was created mostly for my needs, but I am sure that many of you will find it very helpful. Ready?

This is how a default installation of VirtualBox in Ubuntu 9.04 shows the USB devices, and we need to fix it.

Review image

Go to System -> Administration -> Users and Groups...

Review image

Click the "Unlock" button...

Review image

Type your password and click the "Authenticate" button....

Review image

Click on the "Manage Groups" button...

Review image

In the "Groups settings" window that will appear, scroll down until you see the vboxusers entry. Select it and then click on the "Properties" button...

Review image

Another window will appear, called "Group 'vboxusers' Properties. Just check the box in front of your username and click the "OK" button when you're done...

Review image

Close the "Group settings" and "Users Settings" windows and log out. Log in and open up VirtualBox, start your virtual machine and you will see that you can now access the USB devices!

Review image

Yes... it was that simple!

11Nov/10

直接把ASP.NET文件后缀改为php或者htm在IIS7上运行

Posted by Nick Xu

今天用了第三方开源的一个服务程序,返回页面写死了是PHP后缀的,因为不想修改别人的程序,只有我这边把ASP.NET的程序以PHP后缀来执行了.

问了谷哥好多次,都没有找到我想要的结果.后来想了一下,如果真正安装PHP的时候是怎样的呢?

然后我就查了一下PHP在IIS7下的安装过程(不是安装官方MSI包的那种方式哦),然后照版煮碗,结果,肯定是成功的啦,不然就不会写到这了,呵呵

我观察了一下设置完成后的WEB.CONFIG文件,其实在三个地方添加一点代码即可完成ASP.NET以PHP后缀运行,我直接把代码贴出来了.

<compilation debug="true">
<buildProviders>
<add extension=".php" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
<httpHandlers>
<add path="*.php" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true"/>
</httpHandlers>

<system.webServer>
<handlers>
<add name="php" path="*.php" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>
</system.webServer>

10Nov/10

VirtualBox的VRDP运行模式

Posted by Nick Xu

其实没什么深奥的,所谓VRDP运行模式,就是虚拟机运行的时候,没有图形窗口,但可以用VirtualBox的RDP模式远程管理,说是远程其实 在本机上用很方便,用起来和windows下的远程桌面一样。如果虚拟机上安装了vncserver之类的远程控制软件,并且从主机上能够通过tcp访 问,也一样可以管理的。

我使用的是非开源的VirtualBox,开源版本少一些功能。以下操作在windows下也是可以参照使用的。

启动VM的命令:/usr/bin/VBoxManage startvm WinXP -type vrdp,默认是-type gui即以图形界面启动虚拟机。

控制VM比如保存状态关闭的命令:/usr/bin/VBoxManage controlvm WinXP savestate

以上命令中WinXP是虚拟机的名称,也可以用uuid替代。

开启VRDP后远程控制端口默认是3389,默认认证方式是null,即无认证,任何人都可以连接上随意控制,放在网络环境下是很不安全的。还有一种认证方式是external,可以使用主机上的用户机制来认证,不过使用之前要稍微作一下设置:

cd /lib
sudo ln -s libpam.so.0 libpam.so

不然认证无法进行,连接闪一下就关闭了。远程桌面的客户端在gnome中可以用Terminal Server Client(tsclient)或者rdesktop-vrdp -u fwolf -p - localhost

要想随重启或者关机自动关闭虚拟机,要稍微麻烦一些了,首先在/etc/init.d/下创建一个文件fwolfrc

#! /bin/sh 
# Using LSB funtions:
. /lib/lsb/init-functions
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Fwolf's Init"
NAME=fwolfrc
SCRIPTNAME=/etc/init.d/$NAME

# Function that starts the daemon/service.
d_start() {
    touch /var/lock/subsys/$NAME
    log_daemon_msg "Starting $DESC" "$NAME"
}

# Function that stops the daemon/service.
d_stop() {
    su -c "/usr/bin/VBoxManage controlvm WinXP savestate" fwolf
    rm /var/lock/subsys/$NAME
}

# Function that sends a SIGHUP to the daemon/service.
case "$1" in
  start)
        d_start
    ;;
  stop)
        d_stop
    ;;
  *)
    log_warning_msg "Usage: $SCRIPTNAME {start|stop}" >&2
    exit 3
    ;;
esac

exit 0

我也是直接从/etc/init.d/里套过来修改的,详细信息可以看参考文章或者其它关于关机自动执行脚本的资料。然后把这个文件ln为以下几个:

  • /etc/rc0.d/K01fwolfrc
  • /etc/rc6.d/K01fwolfrc
  • /etc/rc3.d/S99fwolfrc
  • /etc/rc5.d/S99fwolfrc

可以看到开机时是最后执行,而关机时是最先执行。注意我上面的脚本里,在开机是并没有自动启动虚拟机,习惯手工开。

9Nov/10

UBUNTU编译出能运行在DD-WRT、Tomato下的软件

Posted by Nick Xu

我的系统环境:vista

在虚拟机virtualbox中安装ubuntu

1.装好ubuntu,安装增强工具

2.在ubuntu的用户目录下建立以下几个文件夹cross、tools、source。

tools:放置交叉编译工具 source:存放源代码

3.到DD-WRT的官方网站下载交叉编译工具toolchains.x86.debian.sp1.tar.bz2

4.将toolchains.x86.debian.sp1.tar.bz2中的4.1.0-uclibc-0.9.28,解压缩到tools目录,并改名为dd

这个交叉编译工具编译出的程序可在tomato和dd-wrt下正常运行

5.安装一些所需要的工具

sudo apt-get install bison flex build-essential patch libncurses5-dev

6. 到这个时候准备工作就基本完成了

每次新打开终端,使用前请运行

export PATH="$PATH:/home/jacky/tools/dd/bin" (请根据实际情况修改路径)

1.下载libpcap源码http://www.tcpdump.org/release/

(我用的是0.9.8,因为这个版本编译出来的libpcap.a比较小254KB)

2.将其解压缩到cross目录

3.进入libpcap目录,cd /home/jacky/cross/libpcap-0.9.8

4.运行命令 export PATH="$PATH:/home/jacky/tools/dd/bin"

5.运行命令 export ac_cv_linux_vers=2.6

6.运行命令 ./configure --host=mipsel-linux-uclibc --prefix=/home/jacky/tools/dd --with-pcap=linux

(--host=HOST 指定软件运行的系统平台,configure --host=mipsel-linux-uclibc这个就是mipsel的交叉编译选项。

prefix是你要安装的位置,这里我把libpcap安装到交叉编译工具所在目录)

7.运行命令 make

8.运行命令 make install

...............................

红色字体部分,请按实际情况修改路径

通常交叉编译开源软件一般只需以下几步即可编译

1 export PATH="$PATH:/home/jacky/tools/dd/bin"

2 ./configure --host=mipsel-linux

3 make

...........................................................................

针对tomato对xclient进行的小修改

xclient源码中,使用了pkill、dhclient命令,但是tomato中并没有这两个命令,

所以用killall替代pkill,用dhcpc-renew替代dhclient。

通常在tomato中客户端是设置成开机自动运行的,我们难以知道客户端运行情况。

所以我想了一个折中的方法,把拨号时的提示信息输出到日志文件中。

tomato中有个logger命令,可以用他把信息输入到日志文件中,

如运行logger hello,可在tomato日志中发现信息user.notice root: hello

具体修改如图所示

............................................................................

相关文章:

http://felix021.com/blog/read.php?1467

http://www.right.com.cn/forum/viewthread.php?tid=22853&extra=page%3D1&page=1

http://groups.google.com/group/njit8021xclient

http://gforge.osdn.net.cn/projects/njit8021xclient/

http://hi.baidu.com/syshall/blog/item/d75d89182368904243a9adda.html

9Nov/10

ubuntu 安装极点五笔(五笔拼音)

Posted by Nick Xu

ibus下用法如下:

1.下载附件文件vissible-ibus.tar.gz

ibus的文件下载地址 :

http://www.uudisc.com/user/vissible/file/3496164

download

2. 解压

tar xvzf vissible-ibus.tar.gz

3. 执行如下命令:

cd vissible-ibus

sudo cp vissible.db /usr/share/ibus-table/tables

sudo cp vissible.gif /usr/share/ibus-table/icons

4.重启ibus或注销再登录,ibus里添加极点五笔即可

scim下用法如下:

1.下载附件文件vissible-scim.tar.gz

scim的文件载地址 :

http://www.uudisc.com/user/vissible/file/3496159

2. 解压

tar xvzf vissible-scim.tar.gz

3. 执行如下命令:

cd vissible-scim

sudo cp vissible.bin /usr/share/scim/tables

sudo cp vissible.gif /usr/share/scim/icons

4.重启scim或注销再登录,scim里选择极点五笔即可

-------------------------------------------------------------------------------------------------

如果没有安装SCIM,还需按以下方法安装SCIM

ubuntu scim输入法及输入法管理器的安装:

$sudo apt-get install scim

$sudo atp-get install scim-modules-socket

$sudo apt-get install scim-modules-table

$sudo apt-get install scim-pinyin

$sudo apt-get install scim-tables-zh

$sudo apt-get install scim-input-pad

启动scim输入法

$scim -d

说明:以上也可以在软件管理包中自动安装。

给Ubuntu安装极点五笔

1、安装Ubuntu语言包

2、下载

3、在Ubuntu系统中选择[系统]-[首先项]-[SCIM输入法设置]-[输入法引擎]-[通用码表]-[码表管理]-[安装],找到上一步下载的freeim.bin,进行安装并重启系统!

4、在Ubuntu系统中选择[系统]-[首先项]-[SCIM输入法设置]-[输入法引擎]-[全局设置]-[简体中文],确认激活freeime选项,就可以在Ubuntu中使用“极点永不言弃2010-09-16 14:23:27笔”了!

极点五笔是 Windows 下非常优秀的五笔输入法之一,而 SCIM 自带的五笔输入法却不是很理想,所以如果能在 Ubuntu 下用上极点五笔会非常不错。以下就是方法。

一、安装

解压、复制 极点五笔.bin 到主目录下

sudo mv 极点五笔.bin /usr/share/scim/tables

sudo pkill scim && scim -d

出终端再执行下面命令

scim-setup

二、设置

输入法引擎:全局设置:简体中文:极点五笔 6.1(勾选):确定

sudo pkill scim && scim -d

退出终端

3Nov/10

install thinkpad drivers on ubuntu 10.10

Posted by Nick Xu

1.红点

sudo agt-get install gpointing-device-settings

2.thinkpad APS & Battery charge control features

# aptitude install tp-smapi-source
# module-assistant prepare tp-smapi
# module-assistant auto-install tp-smapi
# modprobe tp-smapi
# echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
# echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
# cat /sys/devices/platform/smapi/BAT0/*_charge_thresh
http://www.thinkwiki.org/wiki/Tp_smapi
http://sourceforge.net/projects/tpctl/files/tp_smapi

Installation from source

You will need the kernel headers and makefiles corresponding to your current kernel version. On Fedora, this means # yum install kernel-devel-$(uname -r) .

# tar xzvf tp_smapi-0.40.tgz
# cd tp_smapi-0.40

Then, either compile and load the driver within the current working directory (for testing):

# make load

OR compile and install into the kernel's module path:

# make install

If you use the HDAPS driver, add HDAPS=1 to also patch the hdaps for compatibility with tp_smapi (this requires a kernel source tree matching the current kernel). Again, either load the driver within the current working directory:

# make load HDAPS=1

OR install into the kernel's module path:

# make install HDAPS=1

To prepare a stand-alone patch against the current kernel tree (including a patch against hdaps and new Kconfig entries):

# make patch

To delete all autogenerated files:

# make clean

The original kernel tree is never modified by any these commands. The /lib/modules directory is modified only by # make install.

To install the gnome-panel-applet type these lines into the terminal:

wget http://www.zen24593.zen.co.uk/hdaps/gnome-hdaps-applet-20081204.tar.gz
tar -xf gnome-hdaps-applet-20081204.tar.gz
sudo apt-get install libpanel-applet2-dev
cd Desktop/gnome-hdaps-applet-20081204
gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
sudo cp gnome-hdaps-applet /usr/bin/
sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/
   
site
site