星期二, 8月 17, 2010
星期二, 5月 18, 2010
Linux中的Type with Constant Length
許久以來,programming時常看到一堆類似的type define.
今天剛好用到,就整理一下嘍
---------------------
Linux中用户态和内核态定义了若干定长类型, 以32位无符号整数为例:
u_int32_t (BSD类型,目前netfilter中就使用这种类型)
用户态定义位于sys/types.h
在内核态见头文件include/linux/types.h
typedef __u32 u_int32_t;
uint32_t (C99类型, 内核态和用户态都能使用的类型,可移植性更好)
在用户态中见头文件/usr/include/stdint.h
在内核态见头文件include/linux/types.h
typedef __u32 uint32_t;
u32
typedef unsigned int u32;
include/asm-i386/types.h
只能在内核态使用
__u32 (Linux严格类型,内核中应该使用这种类型)
typedef unsigned int __u32;
include/asm-i386/types.h
也可以在用户态使用
unsigned long
unsigned int
标准C语言整数类型, 架构相关
----轉自周知远的博客
總結來說,推薦使用 uintxx_t 系列的C99 type.
只要include 即可。
星期四, 4月 22, 2010
XiphQT + Fluke = Flac in iTunes
Well, since Flac is more and more popular in world of music sharing, it's time to let iTunes support Flac !
There're some trick about flac in iTunes:
First, you need to install XiphQT to play flac with Quicktime core.
Then you still need a plugin named Fluke. Since iTunes won't accept flac ether in dragging files into iTunes database or double clicking flac files, with Fluke, you could cheat iTunes to add flac when double click on flac files.
http://www.xiph.org/quicktime/download.html
http://blowintopieces.com/fluke/
星期三, 2月 24, 2010
Network Setting problem in Ubuntu 9.04
And even if you know how to set a /etc/network/interface config file to manually start networking, you get no nothing after reboot system.
A simple way to solve this problem is set
[ifupdown] managed=true
in /etc/NetworkManager/nm-system-settings.conf to resolved the issue.
Keyboard & Mouse settings in OS X Terminal
Well, just set the following keyboard mappings in OS X Terminal preferences.
And you'll get all keys work !
Key Escape Sequence
Home \033[1~
End \033[4~
Page Up \033[5~
Page Down \033[6~
Besides, if you would like to scroll terminal by mouse, MouseTerm will be helpful.