Archive for the ‘Computer & Internet’ Category.
May 26, 2010, 6:38 pm
Not all websites have links to “printable version” like wikipedia. Although many websites have stunning look, it is really ugly when you try to print them. Some parts of the pages will be missing or the format is totally a mess. Instead of waiting the website owner realize this and prepare printer friendly pages for you, you can try to use the “web developer” firefox plugin to solve this problem. Just install the plugin, then on the web page you would like to print, right click your mouse and find the menus shown in the following picture, choose display CSS only for printer. The web page will become fluid and ready to be printed.
Continue reading ‘Print view for any web page with firefox web developer plugin’ »
May 26, 2010, 2:52 pm
I’m using Pidgin v2.7 and Windows XP. I’ve tried most of the methods flying on the internet about changing themes for Pidgin, but none of them works. These include using the gtkthemeselector.exe. I noticed the latest Pidgin using a “%APPDATA%\.purple\gtkrc-2.0″ to control the look and feel once the “GTK+ theme control” plugin is enabled. The contents of this file look very similar to the contents of the theme files under “c:\program files\common files\gtk\2.0\share\themes\***\gtk-2.0\gtkrc”. I tried to copy the contents of gtkrc file of the “Clearlooks-DarkLime” theme and pasted them to the “%APPDATA%\.purple\gtkrc-2.0″. After restarting Pidgin, I saw this 
Continue reading ‘Change Pidgin theme on Windows’ »
April 8, 2010, 12:54 am
To get subversion+apache2 work on Debian is not very difficult. Basically including the following steps (ref: this post):
- sudo apt-get install apache2 subversion libapache2-svn
- sudo a2enmod dav_svn (load the svn module)
- sudo nano /etc/apache2/mods-enabled/dav_svn.conf (edit this file to specify the actual svn repositories path and setup basic user authentication)
- sudo mkdir /var/svn-repos ;sudo svnadmin create /var/svn-repos (create svn repository)
- sudo chown -R www-data:www-data /var/svn-repos; sudo chmod -R 770 /var/svn-repos (give right permission to apache server. This is crucial for browsing the svn repos via web browser. Some articles suggest creating a new group ‘subversion’ and add all svn user to that group, but I found that’s not the best solution to use svn+ssh protocol and websvn together. Then we can use ‘adduser’ command to create new users, and add them to the group ‘www-data‘ using ‘usermod -G www-data user_name’ command. Without this step, the users cannot update or commit via http or svn+ssh because only the users in www-data group can access the repos with permission 770 set above. I also found this is a workaround for the SSH permission problem due to the owner change when codes are committed by specific users, because all the svn users are now the members of www-data group and they all have access to the repos due to group policy, although the ownership can change to the user who commits codes if svn+ssh protocol is used. If users commit codes via http, the ownership of the repo folders will not change and always belongs to the ‘www-data’ user. )
- sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd bob (Add a user ‘bob’ to allow browsing the svn repo. Bob should be in the subversion group. This command will ask to input user password.Note:remember the path of this file, we will use it again when we set up websvn.)
- sudo /etc/init.d/apache2 restart (restart apache to enable the new settings.)
- Now we should be able to access the svn repo via http://hostname/svn/repo_name (the path depends the settings in /etc/apache2/mod-available/dav_svn.conf. Note the ‘SVNParentPath’ setting.)
Continue reading ‘Subversion+websvn on Debian’ »
April 7, 2010, 2:08 am
Virtualbox支持客户机和宿主机之间共享目录,但是根据版本不同,会有些问题。例如对于3.1.x版本,windows XP host和Debian guest组合下,VBox自己的共享目录(写入)性能极差甚至报错(本人遇到)。其实,在客户机和宿主机之间共享文件的还有一些其他方式,例如可以通过ftp或samba,二者都支持所有操作系统下的共享,但是相比之下samba更具优点,因为在Windows和Linux下都可以把Samba共享目录映射为本地磁盘目录。
先来看Linux访问Windows共享目录的情况。这比较容易,因为Windows上共享文件十分方便,可以通过点击右键实现文件夹共享。在Linux客户端,只要使用smbclient或者smbmount命令即可以实现远程共享目录的访问和映射。具体步骤包括:
1. 在Windows机器上选择文件夹,点击属性-》共享,指定共享名称和权限(是否可写)
2. 在Linux客户机上安装smbclient,然后执行smbclient -L ip_of_win_server来查看服务器所有共享资源。
3. 链接到共享文件夹,smbclient //ip_of_win_server/sharename -U username来连接,如果成功则会出现smb提示符可以使用samba client的命令操作远程目录。(默认需要Windows用户密码)或者使用sudo smbmount //ip_of_win_server/sharename local_path -o uid=your_user_name gid=your_group_name 来映射磁盘目录。
Continue reading ‘通过Samba在VirtualBox的guest和host间共享目录’ »
April 6, 2010, 2:08 pm
The download link of this version on the Mozilla webpage has broken.
But you can find it here.
April 1, 2010, 5:14 pm
Bash下可以使用”cd -”来实现在当前目录和上一次访问的路径间切换。 如果我们需要回退多级目录怎么实现呢?
Bash有两个内置命令pushd和popd,每次调用它们,系统会把当前目录压入目录栈中保存起来,或者从栈顶弹出一级目录并进入那个目录。利用这两个命令可以实现访问路径的存储与调用。为了使用方便可以在~/.bashrc中创建一个自己的命令,例如
1 2 3 4 5 6
| function cd {
if [ -n "$1" ]; then pushd $1 > /dev/null
else pushd $HOME > /dev/null
fi
}
alias pd='popd > /dev/null' |
这里创建的cd函数覆盖了built-in的cd命令,可以自动保存当前路径到栈中。而调用pd命令则可以返回上次访问的目录。
如果我们想恢复系统默认的cd命令怎么办呢?可以使用“unset -f cd”来取消自定义的cd函数。
Continue reading ‘Bash下的目录回退’ »
March 22, 2010, 7:54 pm
By default Notepad2 add a .txt extension to the file name when you save a newly created file. For files already having extensions, this will not be done. However, this is sometimes annoying if you often create files which do not use txt as extension although they are actually plain text files. I think this is almost a daily work for programmers. To cancel this feature, there are two ways. First, when you save the newly created file, simply add quote symbols around the file name like “new_file”, then the file will be save without an extension or with any extension you give. This trick also works for the Windows Notepad program. Another hack is to modify notepad2.ini, there you can create a new section (if it’s not there already) named “[settings2]“. The settings given in this section will override the default behavior. Then add an entry “DefaultExtension=”, yeah just leave nothing behind the equal sign, no suffix will be appended automatically then. There are more options for the customized section, see here.
No doubt, Notepad2 should be a must-have replacement on Windows.
March 12, 2010, 3:55 pm
I’ve tried to download many freeware or trial versions in order to convert lots of html files downloaded from internet into some Ebook format, such as chm or pdf. Unfortunately and surprisingly none of them is satisfactory. Some cracked commercial software do exist, but I don’t like to be a victim of Trojan.
What a luck! I found this Chinese guy (strongerhorse, or old horse in Chinese) made many useful programs and releases them as freeware. Two of them are just for the task I mentioned in the beginning.
Continue reading ‘Killer apps to tidy up html files and make Ebook’ »
March 1, 2010, 4:32 pm
Both Linux Bash and Windows DOS support random number generation. The random number is ‘stored’ in a system environment variable named “RANDOM” (I believe this variable links to a script to generate the actual random numbers on both systems), use it in the same way as you use other ENV variables. E.g.
On Linux:
;
Continue reading ‘Get random numbers under BASH and DOS’ »
February 5, 2010, 4:05 pm
This document demonstrates how we could run client-server software via SSH. The main purpose of using this technique relies on that on most HPC servers most of the IP ports are nromally blocked except for the SSH port 22.
- SSH tunneling settings in PuTTY
In this case, the server port 8888 is mapped to the local port 7777. The meaing of this is simple: once connected to the server using PuTTY, any data on the server sent/received at port 8888 will be redirect to the port 7777 of the local machine (the computer you are using PuTTY at the moment). As a result, any client software running on the client computer can communicate with the server program via the local port 7777.
Continue reading ‘SSH tunneling and example Python client-server codes’ »