Windows 7 Tricks

From "Windows 7 Up and Running"

Open a command window anywhere Shift-Right-click on a folder

Ctrl-click an application icon in the taskbar This action will cycle through all the open windows belonging to the application. For example, suppose that you have five IE windows open. Pressing the Ctrl key while you click the IE icon in the taskbar will toggle between all the opened IE windows (including tab pages).

Shift-click (or middle-click) an application icon in the taskbar This will launch a new instance of the application.

Ctrl-Shift-Click an application icon in the taskbar This action will launch the application in administrator mode.

北卡Outer Banks归来

赶在夏天的尾巴,去了一趟outer banks (OBX),为了纪念我们初识的日子。

自从老婆经常写游记和传照片以来,我就懒了不少,去好多地方也提不起劲去记录一笔,不过本人的习惯就是,喜欢把有用的信息记录下来,以备以后查阅。

从Charlottesville去OBX,先走I-64,到Norfolk时走环城高速664,然后从168向南再走158便到了,一路上都有路牌提示因此很好走,不过与Google/Bing/GPS显示略有不同。168那一段Chesapeake Expressway是收费的,只需两元。全程共250 Mi左右,虽然158不是州际高速,大家还是开的飞快。回来的时候胸有成竹,没想到在158上没有看到转上168的路牌就一路开过去了,最后只好按照GPS的指示转上US-17,略有些绕路。

进入北卡以后一路都是农田,还插了很多No OLF的标志,后来了解到是当地居民抗议政府在那边建立空军基地的计划。Youtube上还能找到介绍。再开一会,一路上就都是OBX的广告了,让人顿时蠢蠢欲动。

Outer Banks是一串远离大陆的岛链,忘了在哪里看到说她有着美国第三棒的海滩。原以为与Key West类似,到了之后发现又略有些不同,去Key West的路很狭长,经常能在路边就看到海,很多时候车速很慢,而OBX的交通明显要好很多。沿海有一条12号公路,以Virginia Dare命名,与之平行的158公路则是主路,一路上还有很多餐馆商店等。从Kitty Hawk开始,往南每隔0.5mi便有一个milepost。我们想起在Key West找到0mi标志时的情景,也想去找到OBX的0mi,没想到在路上开了两遍只有1mi的标志,奉劝有同样想法的朋友放弃这个念头,呵呵。

与VA最近的三个小town是Kitty Hawk, Kill Devil Hills和Nags Head,属于Dare County,网上有人称作大胆县,到了之后才知道是以Virginia Dare命名的,呵呵。这三个小town都很近,搞不懂怎么还分这么细。

OBX有四个灯塔,我们看了Bodie(不能爬)和Hatteras(规模最大,有visitor center并可以爬)的两个,最北的和最南的两个放弃了。从Kill Devil Hills去Hatteras要一个小时,往南坐渡船应该会很有意思,可惜我当时身体不适,于是作罢。OBX的海岸线极长,到处都是beach,Hatteras的national seashore并没有显得多有意思,不过我们在那里看到了kiteboarding的帅哥们,真是一项非常刺激的活动。

Wright Brothers Memorial 6pm后关门,我们过去远远看了看,还误打误撞到了First Flight Airport,是个非常小的供小型飞机起降的机场,在那里看到了停着的两架小飞机。

Jockeys Ridge State Park是我最喜欢的去处,从入口的trail进去后,眼前一下子豁然开朗,给人造成黄沙万里的错觉,还真以为是到了沙漠。沙子非常细,赤脚走上去好舒服。爬上沙丘后,面朝西就可以看到落日。Kitty Hawk Sports在公园里开设hang gliding班,初级班90多,先在教室里学习基本知识,再从沙丘上滑翔下来共计五次,真的挺有意思的,可惜我们到的时候运气不好,我身体不舒服。还有一种是用飞机把你拉到天上,可以选择不同的高度,再由一位教练陪着你滑翔下来,130多,有机会一定要搞一次。

我们还去Roanoke Island参观了Fort Raleigh的历史遗迹,当初英国人在这片新大陆殖民的遗迹已经荡然无存,于是荣耀给了后来的殖民地Jamestown。那里还有个植物园Elizabethan Gardens,是老婆的最爱。岛上还有个水族馆。岛上有个小town叫做Manteo,以一位印第安人命名,我们后来坐在beach看海,天上有飞机做广告说可以参加air tour,飞机就从Manteo起飞。

我们这一次根据TripAdvisor的建议住在Cavalier Motel,真的很不错,oceanfront的房间确实对着海,不像有的旅馆对着的其实是一片杂草。而且是family friendly的,有一块playground可以给小朋友玩,价钱也相对合理。

Some info about Linux console

Most people never need to worry about the Linux keyboard and console HOWTO. Although it's written in 2002, I still find it worth reading, and below is a summary.

The kbd package contains important programs to tweak console settings. It also contains data such as keymaps and fonts. Debian family likes to split packages so the data resides in another package known as console-data. There's also a kbd clone, namely console-tools.

When a key is pressed, the keyboard controller sends scancode to the kernel keyboard driver. Unless in scancode mode, the driver parses scancodes into keycodes. Unless in keycode mode, the keycodes are looked up in the keymap (which can be changed with loadkeys or xmodmap), and the characters found there are transmitted to the application. The program showkey can examine scancodes and keycodes. Under X, use xev.

Fonts are loaded into the video card's character ROM, and can be changed using setfont.

Why is it that you sometimes get a lot of line-drawing characters, e.g., after catting a binary to the screen? Well, there are various character set changing escape sequences, and by accident your binary might contain some of these.

Bash, Emacs and X all do their own tty input handling.

By default, to get a screen to scroll, Linux leaves the text in video memory as it is, but change the viewing origin. The kernel console driver will write text starting at the top of the video memory, continuing to the bottom, then copy the bottom part to the top again, and continue. You can scroll back until the top of the video memory by using Shift-PageUp and scroll down again using Shift-PageDown, assuming a default keymap. The amount of scrollback is thus limited to the amount of video memory you happen to have and you cannot increase this amount. Upon changing virtual consoles, the screen content of the old VT is copied to kernel memory, and the screen content of the new VT is copied from kernel memory to video memory. Only the visible screen is copied, not all of video memory, so switching consoles means losing the scrollback information.

How to extract full text RSS

http://feedex.net/

Yahoo Pipes

Leave comment if you know better ways.

Fun with NULL pointers

This post is actually stimulated by a recent kernel bug

I always took it as granted that null pointers aren't accessible. However, after reading that lwn article I learned that it's by default allowed to map a page at address 0. This behavior of course can be controlled by the vm.mmap_min_addr sysctl knob. (UPDATE: According to this blog, this knob was introduced since kernel 2.6.23.)

The following code demonstrates my point.

$ cat a.c
#include "stdio.h"
#include "sys/mman.h"

#define PAGESIZE 4096
#define STEP (4096/sizeof(int))

int main() {
  int *p = 0;
  void *ret = mmap(p, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
  if ((int)ret == -1) {
    perror("mmap");
    // Look for the lowest mappable address
    do {
      p += STEP;
      ret = mmap(p, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
    } while ((int)ret == -1);
  }
  *p = 3;
  printf("*(%p) == %d\n", p, *p);
}

By default, we can establish a mapping at address 0.

$ /sbin/sysctl vm.mmap_min_addr 
vm.mmap_min_addr = 0

$ ./a.out 
*((nil)) == 3

(UPDATE: On 8/15/09, Debian kernel 2.6.30-6 changed this default value to 4096. Presumably, this change is made to defeat this even more powerful exploit.)

We can enforce a restriction through sysctl. The lowest mappable address will be rounded to the next page boundary. The root user doesn't seem to be restricted at all.

$ sudo sysctl vm.mmap_min_addr=10000
vm.mmap_min_addr = 10000

$ ./a.out 
mmap: Permission denied
*(0x3000) == 3

$ sudo ./a.out 
*((nil)) == 3

Linkin Park vs. Transformers!

What I've Done

New Divide

Cool guys don't look at explosions


A newly discovered browser, Conkeror

Google Chrome has been my browser of choice for a long time, because of its snappy speed, clean UI, and secure design. However, when it comes to UI, what can beat Emacs-like browser with a Mozilla kernel?

Enter conkeror, written completely in Javascript that extends xulrunner. It's customizable by writing new Javascript code (what a pity it's not Lisp!)

Emacs users can start navigating very quickly. What frees users from mice is the "hinting system". To start, press "f" for follow. For more information, refer to the tutorial (C-h t).

Below is my .conkerorrc:

// Tab bar
require("new-tabs.js");
// Middle click on a tab to close
tab_bar_button_close = 1;

// Open Middle-Clicked Links in New Buffers require("clicks-in-new-buffer.js"); clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND;

// Switch to Buffers 1-10 Using Number Keys 1 through 0 function define_key_buffer_switch(key, buf_num) { // define_key(content_buffer_normal_keymap, key, function (I) { define_key(default_global_keymap, key, function (I) { switch_to_buffer(I.window, I.window.buffers.get_buffer(buf_num)); }); define_key(download_buffer_keymap, key, function (I) { switch_to_buffer(I.window, I.window.buffers.get_buffer(buf_num)); }); } for (let i = 0; i < 10; ++i) { define_key_buffer_switch(i == 9 ? "0" : (i+1).toString(), i); }

// Key bindings for compatibility with other browsers define_key(default_global_keymap, "C-w", "kill-current-buffer"); // Some keybindings must be rebound in a proper keymap to take effect define_key(content_buffer_normal_keymap, "back_space", "go-back");

// The binding to find-url didn't prefill with current URL define_key(content_buffer_normal_keymap, "g", "find-alternate-url");

/* I'd like to enable caret mode by default, but I always get a javascript error. session_pref("accessibility.browsewithcaret", true); So I'm trying a workaround by pushing caret-mode to any URL / var my_re = new RegExp("."); // There's a star not showing up in my blog?! auto_mode_list.push([my_re, caret_mode]); define_key(content_buffer_normal_keymap, "f7", "caret-mode");

Tips:

M-x reinit                      reloads the rc file
conkeror -daemon &      keep a daemon running (Be careful that C-x C-c will kill the daemon)

Complaints:

No friendly way for changing page encoding

小知识:美国的两种医学学位

因为MD(Doctor of Medicine)比DO(Doctor of Osteopathic Medicine)多得多,以前一直只知道MD这一种学位。翻看电话本,看到还有DO之说,于是查了一下,还挺有意思的。

http://www.askdrwalker.com/index/What_is_a_doctor_of_osteopathic_.htm

http://www.creative-wisdom.com/education/essays/others/do.shtml

DO强调把人体看做一个整体治疗,MD则针对各个器官头痛医头脚痛医脚,还真有点象中西医的区别。

新偶像,侯高俊杰

记得几年前,网上有高手将《本草纲目》和《辣妹子》mix在一起,效果真的很搭。居然今年春晚周杰伦和宋祖英真的同台演唱了,央视现在也很会搞了嘛。不过两人风格实在差别太多,春晚也没有想出办法让他们同时唱,呵呵。隆重推荐,侯高俊杰底迪。


Syndicate content