## 2010-12-30

### ubuntu 10.10 折腾控制台 | struggling with console in ubuntu 10.10

I've installed ubuntu 10.10 in my newly bought notebook, the console was perfect during installation, that was the wonderful 1366x768, as well as the beautiful splash.
I think everything was still ok just after installation, until now, I see just a blank screen, or some ugly 1024x768.
What I've done, that maybe relative, are just some tweak on grub2, and installing fglrx.
After failure in adjustment of grub2 for several times, I reboot with the live cd, and I found that vesafb is not used, and radeon is activated as the video driver.
hwinfo --framebuffer indicates that the vbe of my graphic card does not support 1366x768, however I did see that with live cd. I guess all of this should thanks to radeon and kms, while I've no idea about details.
So I just removed fglrx and rebooted.
Then come back my lovely splash and 1366x768 console.

By the way, the gnome tetris works quite well with radeon, but not fglrx.

## 2010-12-29

### gnome panel 妙用一则 | A nice trick of gnome panel

Result as the picture above, quite useful when not too much things on the panel.
To make it like this, in the "properties“ dialog of the panel, cancel "expand" and select "autohide". Then drag the panel to the top-right of the screen. At last change the gconf value "/apps/panel/toplevels/<panel name>/hide_delay" to 2147483647

## 2010-12-17

### 无flash收听sky.fm | Listen to sky.fm without a flash player

sky.fm是我的最爱，原来ios有个sky.fm app，但是现在连不上了。

Sky.fm is my favorite online radio, there's been a sky.fm app on ios, but has been not working these days.

Non-flash links are also provided by sky.fm, however you'll need to visit the flash player page first, then get the links. While doing this with safari on ipad, you'll be redirect to a page which asks you to install flash player.

Of course, I can get the links from another computer, but there is not such another computer.

So I googled for a while, until I found sky.fm/mobile. Quite useful, since safari would call quicktime to play the list, so I can even listen to it putting it into background.

## 2010-12-08

Now I'd like to subscribe a private RSS feed, where login is necessary, you won't see anything from the feed url without login.

After wasting several minutes in Googling, I came up with an idea, that to subscribe the feed using Firefox, as it's holding my Cookies.

Then of course I succeeded.

### Firefox 强制显示书签工具栏内容 | Force displaying bookmark item in Firefox toolbars

#bookmarksBarContent .bookmark-item {
visibility: visible !important;
}

Recently I've subscribed a live feed using Firefox, I want it being displayed in my browser all the time, but I don't like the bookmark toolbar which wastes the entire line space. Therefore I drag the bookmark toolbar item to the end of the location bar.

However, that item will automatically collapse, resulting in that there's just a blank area, with an expand button, I have to view the item after expand the item, so stupid.

The solution is, by stylish:

#bookmarksBarContent .bookmark-item {
visibility: visible !important;
}

works like a charm.

## 2010-09-27

### 调整gnome音量调节的幅度 | Adjust the value of volume step in gnome

/apps/gnome_settings_daemon/volume_step

There's a volume wheel on my notebook, one touch would make a number of keypress event, therefore the volume will be enlarged or reduced too much, which is very annoying. After spending some time on searching, I found the corresponding gconf key:

/apps/gnome_settings_daemon/volume_step

The default value was 6, changing it to 2 is good for me.

## 2010-09-17

### 让 pstree 的 圆圈节点 Tcircle 保持一样大小 | Make all Tcircle nodes in pstree a fixed size

\Tcircle{\makebox[\somefixedsize][c]{content}}

I need to draw some trees in latex, so I learned some pstricks, I found pstree is rather easy to use, but there's somethings with the Tcircle, the size of the circles is related to its content, for example for circles for 'a' and 'f' are not of the same size, which makes the tree very ugly.

I didn't found anything useful in the pstrick's document, after rather some time searching on the web, I realized that I can take advantage of makebox, that's a easy but great idea, however I was still not familiar enough with latex...

The solution is:

\Tcircle{\makebox[\somefixedsize][c]{content}}

## 2010-08-30

### 不能启用触摸板的临时办法 | A workaround of enabling touchpad

The symptom is that although my touchpad is recognized, and when I press the enable/disable key on my keyboard, there's right notification on the screen, but my touchpad just is not working.

One possible reason is that I've disabled it in Windows, then I restarted my machine and entered Ubuntu.

Another thing I found is that only when holding the enable/disable key can I use the touchpad.

I found the corresponding key in gconf, and indeed I observed that the key is enabled only when the enable/disable key is being held.

A workaround is to run the following command.

After that the enable/disable key works well.

This must be a bug in Xorg or GNOME.

## 2010-07-24

### Windows Server 2008 R2中配置游戏手柄 | Configuring gamepads in Windows Server 2008 R2

Windows Server 2008 R2 中似乎并没有游戏控制器的相关配置，以至我新买的手柄一直不能正确配置。

http://www.win2008r2workstation.com/win2008r2/game-controllers

Seems that the configuration dialog of gamepads is missing in Windows Server 2008 R2, which made my new gamepad not working all the time.

Several necessary files for gamepad configurations are provided in
http://www.win2008r2workstation.com/win2008r2/game-controllers
including 32bit and 64bit versions.

Just follow the instructions to install it, and then it can be found in the Control Panel, which is exactly the same as the gamepad configuration in previous versions of Windows.

Just visit the following URL:

## 2010-06-01

### 指定excel输出csv文件的分隔符 | Specify the separator in csv file outputted by Excel

Excel 导入csv文件时候可以指定分隔符，但是输出是没有明显的选项，只是txt用空格，csv用逗号。

In Excel the separator can be specified when import a csv file using the wizard, but there's no such an option when exporting, the only choices are txt and csv, where the space and comma are used as separator respectively.

And I found on the Internet that, to change the symbol, go to the control panel, then "regional and language options". In the advanced options under the "format" tab, there's a "number" tab, where you can change the "list separator".

This option is hidden so well...

## 2010-05-16

### ptrace 在 linux 和 freebsd 下的若干区别 | Several differences of ptrace between Linux and FreeBSD

Recently I've been porting a software from Linux to Debian-kfreebsd, but it's not as easy as I had expected. The problem is the interface of ptrace is not exactly the same between linux and kfreebsd.

The first is the names of the macros, which are PTRACE_* under linux and PT_* under freebsd.

Secondly the function ptrace' is not the same, the parameter value' is long' under Linux, but int' under freebsd, so it seems that there'll be a problem on 64 bit freebsd.

However, there's another operation called PT_IO under freebsd, using which we can specify the number of bytes we want to read or write.

The last and the most annoying one I've met, is the parameter addr' for the CONTINUE operations. Under linux this parameter is ignored, and the child process will continue at where it had been interrupted; but under freebsd, we can specify this location by setting this parameter, and we can also let it continue at where it had been interrupted but setting the value to 1.

Now that's all for my program, and it seems that the interface under freebsd is better than that under linux.

## 2010-05-03

sudo update-grub

### windows server 2008 r2 当桌面系统使用的配置

1. Disable shutdown event tracker
Start->Run->"gpedit.msc" -> Administrative tools->System-> Display Shutdown event tracked -> Disable
2. Disable IE Security
Start->Server Manager->Configure IE Sec->Off both options.
3. Enable Wireless Support
4. Enable Audio support
Start->Run->"Service.msc"->Windows Audio -> Automatic
Start->Run->Services.msc"->Windows Audio Endpoint Builder->Automatic
5. Install hardware drivers
I am using ThinkPad t60p so my driver list is here
Note that mobility center is missing from windows 2008 server so there is no need to install it.
IBM Network access connection will crash on you if you will not enable the wireless support (Look above)
6. Enable Vista Experience (look & feel including Aero, Media Player etc.)

More info including how to enable sleep support on windows 2008 server you may find over this kb: http://support.microsoft.com/kb/947036)
7. Enable Themes
Start->Run->"Service.msc"->Themes->Automatic
8. Enable .NET 3.0
Start->Server Manager->Features->Add Feature->.NET Framework 3.0 Features
9. Enable Windows Search (for searching outlook emails)
10. Enable SuperFetch
Start->Run->"regedit"

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters

Add a new DWORD by the name of EnablePrefetcher and assign is the value of 3
Add a new DWORD by the name of EnableSuperfetch and assign is the value of 3

Start->Run->"services.msc"->SuperFetch->Automatic
11. Install Messenger
Latest Live Messenger will not install on Windows 2008 Server, you should install a former version (8.1 and not 8.5) and then you may copy the Live Messenger folder from a working machine and work with it.
12. Install Skype
Latest Skype version will crash 2 seconds after login, you need to install a former skype version Skype 3.1.0.152 works great.
13. Install Office 2007
14. Install Visual Studio 2008
15. Setting Processor Scheduling
update:
16. Changing DEP Mode
Start->Control Panel ->System ->Advanced system settings-> Advanced -> Performance -> Settings-> Data Execution Prevention-> Turn On DEP for essential Windows programs and services.
update2:
17. Fixing ASP.NET Development Server
After installing visual studio you might want to start working with Casini, the asp.net dev server but it seems that the ie cant find it.
Edit the hosts file located at: C:/windows/system32/drivers/etc

comment the following line :
::1 localhost
by replacing it with:
#::1

(the "::1" is use for the localhost for ipv6)

## 2010-03-13

### 软件推荐: checkgmail & ibus-sunpinyin

checkgmail: 靠feed读取未读邮件，可以在不打开gmail的情况下标记为已读，十分方便。

ibus-sunpinyin: 靠统计模型的拼音输入法，响应速度非常快。

## 2010-01-11

### pygtk 异步显示对话框

def handler():
dialog = gtk.MessageDialog(...)
dialog.run()
dialog.destroy()

xxx_window.show()
gtk.main()

## 2010-01-10

### 内存错误调试工具 valgrind

valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./a.out

## 2010-01-09

### GameConqueror 0.09 -- Linux 游戏作弊工具

Gameconqueror 是一款Linux游戏修改工具，用PyGTK写成，以scanmem作为后端。

=============================================

PPA

SVN

=============================================

GameConqueror的BUG或者不恰当的使用会导致程序崩溃，请务必注意备份数据，资料等等。

=============================================

- 界面改进（搜索进度条，出错提示，用户交互等等）
- 指针搜索
- 可选的浮点数取整方式
- 十六进制内存查看/编辑器

- 变速 （类似变速齿轮，这个不是不想写，而是不会写，有谁能教教我？）
- 反汇编器

### GameConqueror 0.09 -- Linux Game Hacking Tool

If you are a game hacker
If you've been looking for a CheatEngine for Linux

Then you can't miss this.

==============================================

GameConqueror is a game hacking tool for linux, it's written in PyGTK and uses scanmem as its backend.

It's supposed to be with most useful features of CheatEngine for Linux.

Currently, I've implemented almost everything about scanning, involving variant data types and scan types:

Data Types: int{8/16/32/64}, float{32/64}, unknown type(int or float) and unknown width(will try each of them), byte array and string
Scan Types: equal, greater, less, changed, unchanged, increased(by), decreased(by)

This should be enough for most cases, so I decided to release it at the current status.

=============================================

Here's how you can get it

PPA (for Ubuntu users)
(I've not test it in 32bit environments or Jaunty, do please inform me if it doesn't work)

SVN

Homepage:
make sure you selected the correct version 0.09

You'll need python and python-gtk to run it, and to build it from source code, you'll need libreadline (this should have been installed for most of you)

=============================================

NOTE THAT GAMECONQUEROR MAY CRASH YOUR PROGRAM DUE TO BUGS OR IMPROPERLY USAGE, DO BACKUP YOUR PROGRESS BEFOREHAND.

To use it, actually I've created a menu item, which could be found in the 'Games' category, or you can run it by executing gameconqueror, and please do this in a terminal (see below)

Read the tooltip of the label 'Value' to get familiar with the syntax

About the annoying terminal window, now this is the only place where you can see the progress of scanning, and the error message if something goes wrong. This terrible thing is basically because I've mainly focused on the features of scanmem so far, and I'll fix this in the next version.

=============================================

What will be added in the next (or maybe future) version:

- better ui (progress bar, error message, user interaction, etc...)
- search for pointers
- optional float rounding method
- memory viewer/editor

and what will not be added
- speed hack (I've no idea about how to implement this in Linux, can anyone tell me plz?)
- disassembler
- many other too powerful features in CheatEngine

any feedbacks will be appreciated.

## 2010-01-04

### autotools, deb 和 PPA 不完全攻略

autotools:
AutoconfAutomake

deb packaging:
Debian New Maintainers' Guide
Ubuntu Packaging Guide
Building Package for PPA

PPA stuff
PPA Overview

1. AUTOTOOLS
autotools 的精髓是让开发者免于手写繁琐的Makefile，同时又让最后生成的源码包符合GNU的一套标准。然而autotools本身也很难用。。。入门门槛比较高。当然难用是相对的，掌握了基本要领就可以了

configure.ac定义了源码包整体信息，如名称，版本，编译环境等，最后根据configure.ac输出configure，而configure可以判断编译环境是否满足需要，这就是著名的./configure && make 的前一半

Makefile.am则是Makefile的另一种格式，由于绝大多数C/C++或一些其他语言的程序编译，打包，安装等等都是同一模式，所以才有了automake，Makefile.am的作用是决定程序的编译方式，还有各个文件的类型，是否打包，安装位置等等，这些由automake生成许多Makefile.in一起打包，等到编译时./configure会把Makefile.in再变成Makefile

DATAPATH=@INSTALLPATH@

# do anything with $DATAPATH 然后在configure.ac里加上AC_CONFIG_FILES([script]) 以及AS_AC_EXPAND(INSTALLPATH, "some path") 这样到时候configure的时候就会生成一个script，里面是DATAPATH=some path 其中AS_AC_EXPAND不是autotools里的宏，我是从ubuntu-tweak包里抄来的，再往上就找不到确切出处了 把这段放configure.ac里就好了 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) dnl dnl example dnl AS_AC_EXPAND(SYSCONFDIR,$sysconfdir)
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local

AC_DEFUN([AS_AC_EXPAND],
[
EXP_VAR=[$1] FROM_VAR=[$2]

dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix exec_prefix_save=$exec_prefix

dnl if no prefix given, then use /usr/local, the default prefix
if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix
fi
dnl if no exec_prefix given, then use prefix
if test "x$exec_prefix" = "xNONE"; then exec_prefix=$prefix
fi

full_var="$FROM_VAR" dnl loop until it doesn't change anymore while true; do new_full_var="eval echo$full_var`"
if test "x$new_full_var" = "x$full_var"; then break; fi
full_var=$new_full_var done dnl clean up full_var=$new_full_var
AC_SUBST([$1], "$full_var")

dnl restore prefix and exec_prefix
prefix=$prefix_save exec_prefix=$exec_prefix_save
])

bin_PROGRAMS: bin是安装路径，即${prefix}/bin, 而prefix就是configure时指定的那个--prefix _PROGRAMS: 是autotools里预设的宏，好比说，我想到了LaTeX里的\documentclass,基本就是一回事，其他还有_SCRIPTS, _DATA, _LIBRARIES，具体去查文档 如果定义了bin_PROGRAMS = scanmem # scanmem就是我正在搞的那个包 那么下面就会有scanmem_SOURCES = xxx.c yyy.c 这种，scanmem_XXX就是指定scanmem的具体内容了，除了_SOURCES还有_CFLAGS等等 类似的例子是dist_doc_DATA = AAA BBB, 这样 AAA BBB 会被安装到 docdir 里去，这也是个标准定义，一般是${prefix}/share/doc/\$PACKAGE。 dist_则是前缀，为了将来把AAA BBB一起打包， make dist 默认是不把_DATA的内容放到包里

EXTRA_DIST： 这种是强制把某些内容放到源码包里
SUBDIRS： 表示make的时候需要光顾的目录，如果 SUBDIRS = aaa . bbb， 那么就分别到aaa, 当前目录和bbb去make一番

AC_CONFIG_FILES([Makefile
src/Makefile
xxx/Makefile
])

2. DEB 打包

control最简单了，照猫画虎就好了，第一大段是源码包信息，下面若干段是deb包信息，这个源码包最后打出几个deb包来就写几段

changelog需要一定格式，用dch命令，非常好用

dch：在最新的changelog entry加一段文字
dch -i: 新建一个changeleog entry，版本修订号加1
dch -v :新建一个changelog entry， 指定版本号为version

rules：这个是打包用的Makefile，对于简单的包，可以用cdbs，虽然一听新名词显得很麻烦，但是实际上只需要如下几行

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_EXTRA_FLAGS := --enable-gui

1.debuild是编译成.dsc .orig.tar.gz .diff.gz这三个文件，还有个.changes 而dpkg-buildpackages则是最终搞若干个.deb

2.我的另一个需求是一个源码包搞出两个deb package出来，这个我搜了好久，现在似乎唯一可用的资源是ubuntu packaing guide以及这个链接http://www.miriamruiz.es/weblog/?p=42，我再整理一下，大致是这个样子

#scanmem.install
usr/bin/scanmem

#gameconqueror.install
usr/bin/gameconqueror
usr/share/gameconqueror/*

3.我看了Debian的打包说明，发现了svn-buildpackage这个好东西，适合我这种直接在svn里搞的人。

3. PPA
ubuntu 社区的PPA确实是个好东西，装了很多PPA很是羡慕，现在也终于有一个自己的PPA了