星期四, 5月 17, 2007

[HowTo] FreeBSD console framebuffer

First thing we have to do is add VESA and SC_PIXEL_MODE to the kernel and rebuild. You should always cvsup and rebuild your kernel and world to the latest available. However, don't try to 'optimize' the BSD kernel. It is already well optimized. If there is an option, like this, that you need to have, then go for it. We need to open the kernel config file. I would recommend that you cvsup first so that you rebuild the latest world/kernel, but it's optional.
cvsup -h cvsup2.freebsd.org -g -L 2 /usr/share/examples/cvsup/standard-supfile
Obviously, you can use whichever cvsup server you want. You can install fastest_cvsup to fins what server is fastest for your location as well. If this is the first time you are cvsup-ing, it will take some time. When it completes, we will continue.
cp /usr/src/sys/i386/conf/GENERIC /usr/src/sys/i386/conf/GENERICVESA
Name it to whatever you want.
vi /usr/src/sys/i386/conf/GENERICVESA
You will see, a couple of lines down an "ident GENERIC" line. You can change this if you want. It will be the display of the kernel in uname.

Directly after that, you will start to see 'option xxxxx #Description' sections..

This is where we add our options:
options VESA
options SC_PIXEL_MODE

Save your changes and exit.

From here, you generally build the world, and the kernel, install the kernel, reboot to single-user mode, mergemaster, installworld, etc... but I'm going to skip the buildworld because it will eat up a lot of time, and we can do it after the kernel.
cd /usr/src
make buildkernel KERNCONF=GENERICVESA
make installkernel KERNCONF=GENERICVESA
reboot
Now, you won't get the resolution just yet, we're not quite done. Boot back up and do the following:
kldload vesa
vidcontrol -i mode | less
You should see a punch of different modes. Scroll through and find one you'd like. For me, 1024x768x24 is the size I want. The first column shows the mode number, mine being 280.

Choose the one you want and try:
vidcontrol MODE_xxx
Substituting "xxx" for the number of the mode you want. The screen will go bank for a second, then it should come back with the prompt. If it cannot handle the resolution you specified, it should return with an error.

If it works, GREAT! Now we can add this to /etc/rc.conf to load on boot-up. However, we must make sure we load vesa on boot-up as well.
vi /boot/loader.conf
add the line :
vesa_load="NO"
change it to "YES" (maintaining caps)

Save, and exit.
vi /etc/rc.conf
and add to the end:
allscreens_flags="MODE_xxx"

星期三, 5月 16, 2007

網球終於有點Sense了

這學期選的透早網球課,終於有點收獲了.
雖然只是對牆打,但也抓到了一些輕鬆打的感覺。

今天的心得是.... 收拍要快,下一次揮拍擊球時,才能在身體的前方(90度半圓)的球點擊球。
多旋轉身體,會打得又遠又輕鬆。(這可以靠調整後拉拍的深度達到)
還有擊球後,手部的推出送球動作,也要注意。(推球動作能穩定你的球路)

ps. 當你總覺得擊球不順時,滿有可能是收拍太慢,使得下一次的擊球點,在身體的內側。
試著在擊球後,喊「後拉」、「拉」等字眼,提醒自己收拍,調整收拍的節奏。

星期三, 5月 09, 2007

安裝FreeBSD在Asus u5f

唔,最近老闆開金口,要擴充一台notebook。
在鳥鳥的中信局採購單、網卡要能快速的build與更改的考量下,買了U5f...
( 說實在的,我很想買Ferrari 1005耶! 如果我不是負責此產學案的人,就勸敗了啦~!!! )
在打開了純白色的u5f,安裝了Unbuntu 7.04之後....
一時興起,拿起來FreeBSD 6.2想要安裝。
結果.... 冏

星期五, 3月 30, 2007

wikipedia

雖然wiki本是一種大家編輯網站的方式,而裡面的資料可信度或是正確性沒有保證。
Wiki是一種可在網路上開放多人協同創作的超文本系統
一個wiki網站讓人能夠用網頁瀏覽器以及很簡單的標記語言合作撰寫文件。wiki技術的關鍵特質是能輕易用來創造與更新許多網頁。一般來說,改變網頁是不經審核的。大部分的wiki都是公開給一般大眾,不用註冊帳號。有些wiki會替使用者自動簽名,並且要求使用者持有一個「cookie」。私人的wiki之中,大多會要求身分認證。大部分的編輯都是即時的,而且幾乎會立即出現在網路上。這一點常導致系統被濫用。-----引自wikipedia

但是近幾年wikipedia這個網站在世界各地人們的建構下,形成一個龐大的資料庫,裡面有的資料包羅萬象。雖然沒有保證正確性,但至少有個參考說法,不是嗎?
所以除了google之外,使用wikipedia當作學習各類新名詞的人也逐漸上升中,可預見的,wikipedia將在網路中占有一席之地。
但是,這個網站在中國大陸如今卻被封鎖了。詳情請見Wikipedia talk:應對封禁。我想,這對對岸同胞的資訊來源是一大損失吧

星期四, 3月 29, 2007

sftp可能會發生的問題

今天想連到linux工作站的sftp,結果發生悲劇...

因為filezilla連線時,就卡在CONNECT上,完全不知道原因。
用wireshark看trace時,也只發現到有很多encrypted packet。
試著用linux的sftp連上工作站時,出現了戲劇化的轉折-
Received message too long 1500476704

What????

Google發現原來是sftp的FAQ阿(我真是太弱了...)
問題出在大家的 .bashrc/.tcshrc/.cshrc 這幾個檔案裡面。
如果我們在 .tcshrc/.cshrc/.bashrc 裡面 echo 一些東西,
或者是執行像是 date, nfrm, whosebirthday 等會印出東西的
動作,因為 sftp 執行時也會去執行這些檔案中的動作,所以
當這些檔案一輸出東西,sftp 的 server 就產生錯誤,而導致
上面所說的錯誤訊息並且斷線。

那solution呢?
當然是把會印出訊息的地方轉到sftp登入時不會執行的檔案上;
也就是.....bash的bash_profile。
或者也可以加上if [$?prompt]來限制sftp去印這些東西~

ps. 如果執行一些命令時發生錯誤,那麼印出的錯誤訊息也會使sftp爛掉喔~

星期日, 3月 25, 2007

Nikon Coolpix 4500隱藏的祕密

本來想找4500的增距鏡有哪幾種。找著找著,看到了神奇的東西..
原來4500除了能存TIFF之外,還能存RAW....這真是大福音阿~!
雖然我現在少了圓頭的usb傳輸線,所以不能測試。但還是先把這麼重要的資訊記下吧~!
偷k也用得到呢

2篇關於打開4500 RAW的教學 1 2
關於RAW於TIFF的差別
个人认为 RAW 的主要优势不是分辨率,而是层次,12-bit 的 RAW 在层次上会明显强过 8-bit 的 JPEG,内置的 TIFF 也是 8-bit 的,所以实际价值不是太大。另外 12-bit 意味着可能具有更大的动态范围(具体的动态范围增加的幅度与机器有关)。
但是显然的,人眼对色彩和层次的分辨率是比较低的,不如对明度的分辨率,因而人眼看起来 100% 大小的 RAW 与 JPG 不会有明显区别,但放大到 400% 时就会有区别。我们似乎更重要的是提高色彩层次,从而具有更多的后期调整的空间。


使用RAW的後續編輯心得 1

星期六, 3月 24, 2007

World of Warcraft on Windows Vista

唔,最近wow台版要開放70級了,所以試著登入遊戲中。
沒想到,使用vista玩wow,是這麼的糟!!
當我用full screen時,螢幕三不五時就閃一下,還會黑掉1秒再復原....
當我試著使用新版的Intel Chipset driver installation安裝之後,一切....還是很糟。

在請教google之後,找到了幾篇相關文章:Wow官方的英文討論帖1 討論帖2
除此之外,還有篇「如何在Vista上玩魔獸世界」
而我用的硬體是Intel 945G,在官方討論中寫到

Intel 945 & 950 Graphics

* Users are reporting that it will crash into a black screen. A message saying that the Display driver stopped responding and has recovered will follow. It has been reproduced in-house. Some users reported success using a new set of drivers drivers for the 945/950 series. These are released 2/4/07.



Desktop 945: http://downloadfinder.intel.com/scripts-df-external/Product_Filter.aspx?ProductID=2102&lang=eng


Mobile 945: http://downloadfinder.intel.com/scripts-df-external/Product_Filter.aspx?ProductID=2301



We are currently testing the game on these drivers. Early test indicate that these drivers have fixed the crash on the areas we have noted. If you want, try them and report your findings here.

事實上,在我使用window模式執行wow之後,狀況改善很多.....
而且如果電腦的配備是1GB以上的RAM時,有測試文章寫到Vista比WinXP好一點點。所以,扣除wow裡AddOns的相容性,在Vista跑wow其實沒有大家想像中的慘。

星期二, 3月 13, 2007

Ubuntu字型的設定

賴廣甫本來debian是用fontconfig設定字型的,在Ubuntu中,fontconfig預設沒有安裝,但是有fontconfig-voodoo這個套件。雖然到現在還是不知道這有啥用.....
簡述一下如何安裝ttf字型在edgy中吧!!
  1. 把ttf copy到/usr/share/font/truetype裡

  2. 執行fc-cache -v -f,重抓字型

  3. 使用fc-list |grep 字型名稱,找看看新安裝的字型是否在其中

以上是小總結。
ps.我在找如何在e17安裝字型時,發現一位高手的blog,裡面整理了linux的各種字型管理方法。

Kim Lai
賴廣甫
Kim Lai
Kimk Lai

星期日, 3月 11, 2007

游泳..

話說,最近開始嘗試捷式的左邊換氣。
動機是左右開弓的三次換氣,泳者的姿勢較不容易走樣....XD

以前,沒被教過捷式該怎游。只有在泳池偷看別人的方法,還有找書看。還記得那時候閒著沒事,自已練右換氣時,整個就是一團糟阿。捷式竟然比蛙式慢,令人吐血;而且勉強說是會換氣後,游起捷式比蛙式慢就算了,竟然還累得要死。大約游100m之後,兩隻手就不行了吧XD
這完全與我知道的「捷式是最快最省力的泳姿,因此在自由式賽項常被使用,故又稱自由式」相違背阿~~~!!!
在偷看了許多帥哥美女之後,我漸漸的會輕鬆快速的以捷式前進。那感覺就像是漂在水面上,用划手與打水推進;在換氣時,轉動身体吸氣就搞定了。但,這一切是建立在右換氣上。當試用左換氣時,世界變得不一樣了...
那個捷式游得比蛙式慢的我又回來了!!! 哇哈哈哈哈...I'm back !!!! Orz

看來,還需要偷看很多會左換氣的美女才行...

捷式教學 蛙式教學 仰式教學 蝶式教學
這是我在某blog看到的,上面有清楚的影片教學...四式都有喔
賴廣甫
Kim Lai
賴廣甫
Kim Lai
Kimk Lai

星期五, 3月 02, 2007

Vista的權限管理

[How to delete Windows Vista's System files]
有別於舊的WindowsXP系統,Vista的系統檔是分給一個叫TrustedInstaller的傢伙,而且這傢伙的權限還沒有刪除的能力。這使得我們需要刪除系統檔時,得要花上更多步。

簡單的說,要先把檔案或目錄的Owner改成自己(目前的UserName),然後把權限管理的頁面中,本機電腦/User的權限提升到有刪除能力,確定排在上面的權限中,沒有Deny或是擋掉刪除之類的。因為vista好像是從上而下inherit權限,如果上面沒有刪除能力( 比如說是SYSTEM ),那下面的User改了也沒用。

比較機車的地方在於,當使用vista的GUI界面修改Owner或權限時,預設是不會讓子目錄、檔案inherit新設定的權限。所以不論是改Owner或是權限時,記得要把inherit勾選。
賴廣甫
Kim Lai
賴廣甫
Kim Lai
Kimk Lai

The Devil Wears Prada

一時興起,想找部片來看,就選中這片嘍~
本想就算是影片不好看,起碼還能欣賞一下服裝設計。

這部影片除了fashion的服飾之外。主要表達出女主角在領導fashion、開創自己的事業時,失去了哪些。其實整部影片的劇情不多,用一句話就能表達:「初入社會的小女子,在得到令人稱羡的工作時,逐漸失去初衷;最後猛然醒悟,找回自己的人生。」

以演技來說,Meryl Streep不愧是拿了幾次獎的得主,光是片尾的個人表情獨秀,就顯出其功力。Stanley Tucci則飾演一個在時裝界的....助手吧( 我也不知道怎麼定位 ),他在片中有點娘娘腔(也許叫纖細),但眼光到位;在最終被出賣、犧牲時,無奈的吞下苦楚,那表現真是令人感同身受。Anne Hathaway飾演初入社會的小女生,對抗穿prada的惡魔;她充分的表現出其倔強、不服輸。

其實每個人都會追求成為目光的焦點,不論是在見面的打扮、事業的成功等等。但當你往這方向走的時候,是否能有機會一直思考這種生活是否是你所希望的呢?人是貪心的,總想要活得精采。如何在人生的路途上,搖搖擺擺的走,修正自己的路;我想,這是人生中的最大課題。其中,知道該修正自己時,還需要向未知、不穩定邁步的勇氣。
賴廣甫Kim Lai賴廣甫Kim LaiKimk Lai

星期二, 2月 13, 2007

創意製圖


賴廣甫
今天由cym的blog看到了神奇的圖片.....
是由這個網站 ImageChef 製做出來的~

小試了一下,這張圖片像不像真的咖啡拉花呢?

星期二, 1月 30, 2007

雜記

賴廣甫
話說被某人鼓勵要多增加產量之後,懶惰的我要開始在blog上寫生活雜記了。

最近台北冷得要死,起床完全不想洗臉(洗手台對面有大樓風 Orz)。但是看到雅婷、泡芙她們在國外都是向下破蛋的;相比之下,俺還是很幸福的?? 也許因為如此,泡在溫水游泳池中,還真是舒服.....

把阿健上傳的古琴曲挑出來聽,雖然音質不好,但大師彈的就是不一樣....聽著聽著,我又想把琴拿出來了,自己彈琴,爽度又往上提升!
ps. 最近發現在琴腳的地方,琴身有些裂開,不知道要不要緊....改天找阿健或花輪幫我看一下?

星期五, 1月 19, 2007

XGL, E17

Well, there're lots of window manager.
But I think the 2 ones above have most credits of eye-candy !

If your video card is Intel integrated chipset, than maybe you should try AIGLX rather than XGL.
I saw combinations of GNOME+XGL or KDE+XGL, and I've installed AIGLX+Beryl+GNOME on Intel 945G successfully. I have to say XGL's transparency and cube's rotation is really outstanding. When you press ALT+wheel, you can tweak the transparency. When you press SHIFT+wheel, you can tweak the lightness. When you press windows key+wheel, you'll get a zooming!
It's a good news that XGL seems to be easily installed on Ubuntu Edgy(6.10).
And also, edevelop.org team has been working Elbuntu which window manager is Enlightenment 17 rather then GNOME.

Ubuntu had been a excellent distribution with nice compatibility. Now, I can see it will be a shining distribution!
賴廣甫

星期三, 1月 10, 2007

FILE的IO與Encoding

常用的IO class StreamReader就可以設定Encoding
StreamReader sr = new StreamReader("dic/wordlist_utf8.txt", Encoding.UTF8)

至於要把程式內的utf8 string轉成其它Encoding,以下是msdn的示範
string unicodeString = "This string contains the unicode character Pi(\u03a0)喔 是這樣嗎";

// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding unicode = Encoding.Unicode;

// Convert the string into a byte[].
byte[] unicodeBytes = unicode.GetBytes(unicodeString);

// Perform the conversion from one encoding to the other.
byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes);

// Convert the new byte[] into a char[] and then into a string.
// This is a slightly different approach to converting to illustrate
// the use of GetCharCount/GetChars.
char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
string asciiString = new string(asciiChars);

// Display the strings created before and after the conversion.
Console.WriteLine("Original string: {0}", unicodeString);
Console.WriteLine("Ascii converted string: {0}", asciiString);
簡單的說,就是利用Encoding.Convert轉成不同encoding的byte[],然後再把byte[]轉成char[]或是string。

星期五, 1月 05, 2007

Rmote Desktop 6.0

Network Level Authentication

Network Level Authentication is a new authentication method that finishes user authentication before you establish a full Remote Desktop Connection and the logon screen appears.

The advantages of Network Level Authentication are as follows:
• It requires fewer remote computer resources at first because remote computer uses a limited number of resources before it authenticates the user. In earlier versions, the remote computer starts a full Remote Desktop Connection.
•It can help provide better security by reducing the risk of denial of service attacks (a denial of service attack attempts to limit or prevent access to the Internet).
• It uses remote computer authentication. This helps protect users from connecting to remote computers that are set up for malicious purposes.

Server authentication

In Remote Desktop Connection, server authentication verifies that you are connecting to the correct remote computer or server. This security measure helps prevent you from connecting to a different computer or server than you intend to connect to. This also prevents you from unintentionally exposing confidential information.

Resource redirection

The Remote Desktop Connection 6.0 client update helps you redirect Plug and Play devices that support redirection.

TS Gateway servers

A TS Gateway server is a type of gateway that enables authorized users to connect to remote computers on a corporate network. These authorized users can connect from any computer by using an Internet connection. TS Gateway uses the Remote Desktop Protocol (RDP) together with the HTTPS protocol to help create a more secure, encrypted connection.

However, earlier versions of Remote Desktop Connection cannot connect to remote computers across firewalls and network address translators. This behavior occurs because port 3389 is typically blocked to enhance network security. Port 3389 is the port that is used for Remote Desktop connections. However, a TS Gateway server uses port 443. Port 443 transmits data through a Secure Sockets Layer (SSL) tunnel.

The advantages of a TS Gateway server are as follows:
• It enables Remote Desktop connections to a corporate network from the Internet without setting up a virtual private network (VPN) connection.
• It enables connections to remote computers across firewalls.
•It helps you share a network connection with other programs that are running on the computer. This enables you to use the Internet service provider (ISP) connection instead of the corporate network to send and receive data over the remote connection.

Terminal Services Remote Programs

Remote Programs are a feature of Windows Server Terminal Services that lets client computers connect to a remote computer and use programs that are installed on it. For example, a workplace may have a remote computer to which employees can connect and run Microsoft Word. An administrator must first publish the programs for end-users to access them. The experience is the same as running a program that is installed on the computer.

Remote Programs make system administration easier because there is only one copy of a program to upgrade or to maintain instead of many copies that are installed on individual computers.

Monitor spanning

Remote Desktop Connection supports high-resolution displays that can be spanned across multiple monitors. However, the total resolution on all monitors must be under 4096 x 2048 pixels. The monitors must have the same resolution. Additionally, the monitors must be aligned side-by-side.

To have the desktop of the remote computer span multiple monitors, type Mstsc /span at a command prompt.

Visual improvements

Remote Desktop Connection now supports 32-bit color and font smoothing.
ref link:
http://support.microsoft.com/kb/925876

星期五, 12月 29, 2006

元氣地球人: 打鼾

節錄些重點吧!

打鼾不只會影響枕邊人而已....
輕度打鼾是翻身之後,鼾聲即停止。重度打鼾則是鼾聲不停。
重度打鼾則有可能會使你在睡眠時呼吸停止。當停止呼吸時,腎上腺素增加,心、肺血管收縮;除了增加身体的負擔外,還會從睡眠中驚醒,無法好好休息。

改善打鼾的方法:
  • Tennis Ball trick:因為打鼾與平躺的姿勢有關,所以在褲子屁股後方放個網球,讓你自然會側睡,同時並不會中斷睡眠。

  • 床傾高10cm:將床的頭部傾高10cm左右,讓整個床有幅度。如此也可改善打鼾的狀況。

  • 枕頭不能讓脖子彎:睡在枕頭上,有時候會使得脖子彎曲,反而會打鼾。因此要注意使用的枕頭與睡姿。

  • 睡前別喝酒與吃東西:先點出個平常被誤導的觀念「睡前喝點酒,有助睡眠」,這並無錯誤;但是,喝了酒之後,會使得之後的睡眠變短,品質也比較不好,明顯的好處只有加快入睡。
    而對於會打鼾的人,睡前吃東西與喝酒,會使得打鼾的狀況更加的嚴重喔!

星期四, 12月 28, 2006

Visual Studio 2003自動加上的[STAThread] Tag

這是描述程式是哪種Thread型態:
  • Single-threaded Apartment[STA]

  • Multi-threaded Apartment[MTA]
稍微測試了一下,Visual Studio 2005在開新的C#專案時,並不會自動在Class宣告上加上這行[STAThread];所以應該是Visual Studio 2003才會這樣做。
至於詳細的差別,就要講到Single-thread與Multi-thread和COM的關係了。
When the STAThreadAttribute is applied, it changes the apartment state of the current thread to be single threaded. Without getting into a huge discussion about COM and threading, this attribute ensures the communication mechanism between the current thread and other threads that may want to talk to it via COM. When you're using Windows Forms, depending on the feature you're using, it may be using COM interop in order to communicate with operating system components. Good examples of this are the Clipboard and the File Dialogs.

Windows Forms is not supported within a MTA or free threaded apartment.Applications using Windows Forms should always declare the apartment style they're using, as some other component could initialize the apartment state of thread improperly.

星期三, 12月 27, 2006

西藏阿姐鼓--已被禁止的「人皮鼓」傳奇

沒想到在「阿姐鼓」盪氣迴腸的音樂背後,隱藏著這麼一段悲淒的傳說……。
從歌詞中推敲....
阿姐鼓 Sister Drum
何訓田製作
演唱者:朱哲琴

我的阿姐從小不會說話
在我記事的那年離開了家
從此我就天天天天的想阿姐啊

一直想到阿姐那樣大
我突然間懂得了她
從此我就天天天天的找阿姐啊
瑪尼堆前坐著一位老人
反反覆覆念著一句話
唔嘛呢叭咪唔嘛呢叭咪
唔嘛呢叭咪唔嘛呢叭咪

我的阿姐從小不會說話
在我記事的那年離開了家
從此我就天天天天的想阿姐啊

一直想到阿姐那樣大
我突然間懂得了她
從此我就天天天天的找阿姐啊
天邊傳來陣陣鼓聲
那是阿姐對我說話
唔嘛呢叭咪唔嘛呢叭咪
唔嘛呢叭咪唔嘛呢叭咪
唔嘛呢叭咪唔嘛呢叭咪

不會說話的阿姐啊!從小離家,天邊傳來陣陣鼓聲,那是阿姐在對我說話啊!原來阿姐已經被製作成了人皮鼓……!

人皮鼓就是手鼓,這是西藏早已廢除的酷刑之一,它是以純潔少女的皮做成祭神的鼓。

人皮鼓是藏傳佛教中的忿怒尊或持明尊所持的法器。以兩個天靈蓋相背接合,再覆蓋人皮,塗成綠色,修法頌讚時,配合金剛鈴杵使用。傳言也有用道行高深喇嘛的皮去做手鼓,因為喇嘛佛法無邊,可以上通佛祖、菩薩,直達天聽。祈福祝禱時,清敲人皮鼓,我佛慈悲便能從天而降,造福人間。

歌詞中,「瑪尼堆」又叫麻尼堆,在有藏人的地區,到處可見一座座以石塊疊成的瑪尼堆。這是藏人將刻有經文、六字真言、咒語或佛像的石塊堆積而成的,再插上經幡,成為藏人往來巡禮的瑪尼堆。藏人相信繞行瑪尼堆,可以祈福消災。尤其是在遠離寺院的僻遠鄉野,瑪尼堆更是藏人宗教生活不可或缺的所在。

何訓田曾說過:「我們到西藏並不是為了尋找西藏,而是為了找尋我們自己……」

在鼓聲中尋找阿姐,尋找失落的自己……。
註: 這是無意間在ETTody上看到的