Showing posts with label 學習筆記. Show all posts
Showing posts with label 學習筆記. Show all posts

Nov 29, 2009

screen

這二天在想,因該好好的學習一下 screen 要怎麼使用,從最一開始使用 screen 只是很單純的把他當成一個不會因為斷線就無法執行之後工作的 terminal 來使用,從官方對於 screen 的簡介:
Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
我想,我一直漏掉 multiplexes 的重要特色。

Reference:
  1. screen 中文教學 on debian wiki
  2. screenrc 分享
  3. Screen User's Manual

Nov 22, 2009

dns timing issus when install ttf-mscorefonts

安裝 ttf-mscorefonts 會出現某些檔案無法下載,主要是因為下載時,wget 的參數 timeout 設的太短了,可參考 ubuntu Bug #431217

以下做簡單的筆記:
1. sudo vi /var/lib/dpkg/info/ttf-mscorefonts-installer.postinst #改成下面的內容

#!/bin/bash

#Version: 1.0
#Info: Bash script to install mscorefonts without using
#currently broken ttf-mscorefonts-installer (3.0) for
#Ubuntu 9.10 Karmic Koala (date: 03/11/09)

#Author: Jonathan K.
#Website: http://www.friendlytechninja.vndv.com
#Email:

#License: This is free to use and distribute (for free only) as long as
#credit is given to original author.

#Create temp and mscorefonts dir
sudo mkdir /usr/share/fonts/truetype/mscorefonts
mkdir /tmp/mscorefonts
cd /tmp/mscorefonts

#Download links
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/andale32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arial32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arialb32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/comic32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/courie32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/georgi32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/impact32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/times32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/trebuc32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/verdan32.exe/download?use_mirror=cdnetworks-kr-1
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/webdin32.exe/download?use_mirror=cdnetworks-kr-1

#Extract all .tff files
cabextract *.exe -F*.ttf -L

#Rename files and move files
sudo cp andalemo.ttf /usr/share/fonts/truetype/mscorefonts/Andale_Mono.ttf
sudo cp ariali.ttf /usr/share/fonts/truetype/mscorefonts/Arial_Italic.ttf
sudo cp arialbd.ttf /usr/share/fonts/truetype/mscorefonts/Arial_Bold.ttf
sudo cp arialbi.ttf /usr/share/fonts/truetype/mscorefonts/Arial_Bold_Italic.ttf
sudo cp arial.ttf /usr/share/fonts/truetype/mscorefonts/Arial.ttf
sudo cp ariblk.ttf /usr/share/fonts/truetype/mscorefonts/Arial_Black.ttf
sudo cp comicbd.ttf /usr/share/fonts/truetype/mscorefonts/Comic_Sans_MS_Bold.ttf
sudo cp comic.ttf /usr/share/fonts/truetype/mscorefonts/Comic_Sans_MS.ttf
sudo cp cour.ttf /usr/share/fonts/truetype/mscorefonts/Courier_New.ttf
sudo cp courbd.ttf /usr/share/fonts/truetype/mscorefonts/Courier_New_Bold.ttf
sudo cp courbi.ttf /usr/share/fonts/truetype/mscorefonts/Courier_New_Bold_Italic.ttf
sudo cp couri.ttf /usr/share/fonts/truetype/mscorefonts/Courier_New_Italic.ttf
sudo cp georgiaz.ttf /usr/share/fonts/truetype/mscorefonts/Georgia_Bold_Italic.ttf
sudo cp georgiab.ttf /usr/share/fonts/truetype/mscorefonts/Georgia_Bold.ttf
sudo cp georgiai.ttf /usr/share/fonts/truetype/mscorefonts/Georgia_Italic.ttf
sudo cp georgia.ttf /usr/share/fonts/truetype/mscorefonts/Georgia.ttf
sudo cp impact.ttf /usr/share/fonts/truetype/mscorefonts/Impact.ttf
sudo cp times.ttf /usr/share/fonts/truetype/mscorefonts/Times_New_Roman.ttf
sudo cp timesbd.ttf /usr/share/fonts/truetype/mscorefonts/Times_New_Roman_Bold.ttf
sudo cp timesbi.ttf /usr/share/fonts/truetype/mscorefonts/Times_New_Roman_Bold_Italic.ttf
sudo cp timesi.ttf /usr/share/fonts/truetype/mscorefonts/Times_New_Roman_Italic.ttf
sudo cp trebuc.ttf /usr/share/fonts/truetype/mscorefonts/Trebuchet_MS.ttf
sudo cp trebucbd.ttf /usr/share/fonts/truetype/mscorefonts/Trebuchet_MS_Bold.ttf
sudo cp trebucbi.ttf /usr/share/fonts/truetype/mscorefonts/Trebuchet_MS_Bold_Italic.ttf
sudo cp trebucit.ttf /usr/share/fonts/truetype/mscorefonts/Trebuchet_MS_Italic.ttf
sudo cp verdanab.ttf /usr/share/fonts/truetype/mscorefonts/Verdana_Bold.ttf
sudo cp verdanai.ttf /usr/share/fonts/truetype/mscorefonts/Verdana_Italic.ttf
sudo cp verdanaz.ttf /usr/share/fonts/truetype/mscorefonts/Verdana_Bold_Italic.ttf
sudo cp verdana.ttf /usr/share/fonts/truetype/mscorefonts/Verdana.ttf
sudo cp webdings.ttf /usr/share/fonts/truetype/mscorefonts/Webdings.ttf

#Clean up
cd ~
rm -r /tmp/mscorefonts

2. sudo dpkg --configure -a

應該選那一個 File System 呢?

Linux 2.6.28 之後,開始支援 EXT4,最近重灌 ubuntu 9.10 發現多了 EXT4 可以選擇,一開始還不確定是不是要直接升級到 EXT4 ,剛剛 Survey 了一下,我想,下直別想那麼多了,直接使用 EXT4 就好了

Reference:

Generate PDF by JS

Reference: 用 JavaScript 產生 PDF 檔

jspdf - jsPDF generates PDF documents using pure JavaScript

我的舊筆電 M2N 裝 Ubuntu 9.10

Reference: Ubuntu karmic freeze on Asus M2n

之前M2N上一直是使用 ubuntu 8.04 一直沒有升級,這次等 9.10 一出,一口氣從新安裝新版的 ubuntu,中間出現蠻多相容性的問題。

1. ubuntu 9.10 安裝時,多增加
acpi=off and nolapic
2. 安裝完之後,更改 grub 開機參數
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT 中加入 nolapic nomodeset
3. xorg.conf 改使用 vesa
Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection

Feb 3, 2009

VMware Server

VMware Server 於二年多前已公告可以免費下載使用,我想,最主要原因還是 Microsoft Virtual PC, Xen .... 等競爭對手一一出現,今天本想在 WIndows 上使用 QEMU 安裝 CentOS5 測試一些東西,不知為何一直有問題,後來直接放棄改試試 VMware Server,安裝上沒問題難度,但一開始使用,有二個地方小卡了一下

  1. VMware Server 是利用web管理自已的系統(= =.這個該很久以前使用VMware Workstation的感覺剛全不一樣,不過那已經是五、六年前的事了),進入時會因為 ssl sing 的問題而被檔掉,需要自行加入例外
    Firefox : 工具 -> 選項 -> 檢視憑證清單 -> 伺服器 -> 加入例外清單
  2. 登入時,需要輸入帳號/密碼,這時指的是你電腦裡的帳號密碼

Oct 27, 2008

Linux MTD Driver Reference

引用至 lazyf's den

MTD NAND Driver Programming Interface

Thomas Gleixner
http://www.linux-mtd.infradead.org/tech/mtdnand/book1.html

HOW TO USE MTD/JFFS2 UNDER µClinux
Patrice KADIONIK, Professor Assistant at the ENSEIRB School of Electrical Engineering, Telecommunication, and Computer Science
http://uuu.enseirb.fr/~kadionik/embedded/uclinux/mtd/howto_mtd.html

Find your Root File System with MTD
http://www.ucdot.org/article.pl?sid=03/01/11/1049210&mode=thread

Sep 12, 2008

install ubuntu 8.04 on usb stick

前幾天,照著 USB Ubuntu 8.04.1 Persistent install from Linux 在隨身硬上安裝 ubuntu 還蠻有趣的,有時間可以在進一步的研究研究

Dec 20, 2007

一個好用的 Patch 管理工具 - quilt

先在目錄下 mkdir patches
  1. quilt new patchname #新增一個patch file
  2. quilt add filename #把要修改的 file 加入 top most patch 中,也可使用 quilt [vi] edit filename ,這樣就會幫你自動先 add 就直接建入 editor
  3. quilt refresh #updata your patch
  4. quilt remove filepath #把 此 file 的更改移出此patch
  5. quilt delete patchname #remove unapplied patch
  6. quilt push #將下一個patch file apply進來,或是全部的apply [-a]
  7. quilt pop #unpapply回上一個 patch,或是全部都unpapply [-a] 回去
  8. 一些 display 指令
quilt files #list files in patch
quilt diff #show patch
quilt previous, top, next #show previous, topmost, next patch name
quilt filename #list patches modifying file
quilt applied/unapplied #show applied/unapplied patch names
quilt series #list all patch names in series

我想,在配合下面這張圖應該就能很清楚的了解,他的使用


如果還不是很了解,可以看一下,下面這幾個連結 :)

Dec 16, 2007

screen capture with import

以前在windows時,都是使用 HyperSnap 而Linux下,一直沒去注意,是否有取代方案,剛剛google一下,發現,原來 ImageMagick裡早已有這樣的功能,我主要要求是可以讓我自已選譯 capture 的 region,於 ImageMagick 裡有一個名為 import 的工具,只需打 import {Filename}.{File format},螢幕就會出現一個十字, Draw 出一個 region 後會自動幫你存檔,真是太方便了 XD。
不過,要一直打 command 真的有點麻煩,有時我只想砍下我要的畫面檔名對我來說不是很重要,所以寫了一個非常簡單的 script
#!/bin/sh
/usr/bin/import $RANDOM.png
在加到 Gconf 中的快速鍵,哈,這樣使用起來比 HyperSnap 還要方便

Dec 13, 2007

我要看 海賊王 :)

前段時間,跟一位朋友聊到,平時到 ptt 都會逛那些好玩的板,中間他有提到 海賊版 ,之前無聊,把所有熱門的版加到 我的最愛裡,海賊版就是其中之一,也沒認真去逛過,只是覺的,一個卡通有那麼好閒嗎 = =“ (有也是海賊迷),昨天去認真小看一下,丫勒,原來熱門是因該有很多黑暗在,哈哈,這時又想起,我好像有快半年沒看海賊王了,下載了幾集試看看,發現,電 腦裡沒有 realplayer codec 試了把 win32codec 裝到 /usr/lib/win32 播放時,會出現下現錯誤,但是有聲音沒畫面,我一直以為,它在 /usr/lib/codecs 找不到 drvc.so 會換至 /usr/lib/win32 試看看,原來不會 - -“,只好在建一個 ln -s win32 codecs 這樣就沒問題了,哈,又可快快樂樂看海賊王了 :)
============== 下面是難看的 Error Output ====================
Opening video decoder: [realvid] RealVideo decoder
Error: /usr/lib/codecs/drvc.so: cannot open shared object file: No such file or directory
Win32 LoadLibrary failed to load: drvc.so, /usr/lib/win32/drvc.so, /usr/local/lib/win32/drvc.so
Error loading dll
ERROR: Could not open required DirectShow codec drvc.so.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Win32 LoadLibrary failed to load: drvc.dll, /usr/lib/win32/drvc.dll, /usr/local/lib/win32/drvc.dll
Error loading dll
ERROR: Could not open required DirectShow codec drvc.dll.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Error: /usr/lib/codecs/drv4.so.6.0: cannot open shared object file: No such file or directory
Win32 LoadLibrary failed to load: drv4.so.6.0, /usr/lib/win32/drv4.so.6.0, /usr/local/lib/win32/drv4.so.6.0
Error loading dll
ERROR: Could not open required DirectShow codec drv4.so.6.0.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Win32 LoadLibrary failed to load: drv43260.dll, /usr/lib/win32/drv43260.dll, /usr/local/lib/win32/drv43260.dll
Error loading dll
ERROR: Could not open required DirectShow codec drv43260.dll.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Error: /usr/lib/codecs/drvc.bundle/Contents/MacOS/drvc: cannot open shared object file: No such file or directory
Win32 LoadLibrary failed to load: drvc.bundle/Contents/MacOS/drvc, /usr/lib/win32/drvc.bundle/Contents/MacOS/drvc, /usr/local/lib/win32/drvc.bundle/Contents/MacOS/drvc
Error loading dll
ERROR: Could not open required DirectShow codec drvc.bundle/Contents/MacOS/drvc.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Cannot find codec matching selected -vo and video format 0x30345652.
Read DOCS/HTML/en/codecs.html!
==========================================================================

Dec 7, 2007

一些關於測試的名詞

Unit test: 單元測試,針對某個component或method做的測試
Black box test: 黑箱測試
Unit test: 單元測試,針對某個component或method做的測試
Black box test: 黑箱測試,針對功能面來做測試
White box test: 白箱測試,針對內部實作的流程來做測試
Stress test: 壓力測試,測試系統的效能極限
Regression test: 回歸測試,當新功能增加的同時,會不會影響到舊功能的正確性
Integration test: 整合測試,兩個系統整合後有沒有錯誤
System test: 整個system跑起來後的測試
Alpha test: 開放內部測試人員做測試
Beta test: 開放給外部使用者做測試
Monkey test: 搞怪測試,盡可能惡搞來看系統穩定度
,針對功能面來做測試
White box test: 白箱測試,針對內部實作的流程來做測試
Stress test: 壓力測試,測試系統的效能極限
Regression test: 回歸測試,當新功能增加的同時,會不會影響到舊功能的正確性
Integration test: 整合測試,兩個系統整合後有沒有錯誤
System test: 整個system跑起來後的測試
Alpha test: 開放內部測試人員做測試
Beta test: 開放給外部使用者做測試
Monkey test: 搞怪測試,盡可能惡搞來看系統穩定度
Acceptance test: 測試系統或產品是否會滿足客戶的需求

Dec 6, 2007

Linux下的除錯工具

先記錄一下,有機會一定要試看看 :)

MPatrol : 記憶體除錯
http://www.cbmamiga.demon.co.uk/mpatrol/
OProfile : 系統負載低且全系統性的效能表現監視工具
http://rhn.uta.edu/pub/docs/RH-DOCS/rhel-sag-zh_tw-3/ch-oprofile.html
http://oprofile.sourceforge.net/
LTTng : LTTng is the kernel tracer that generates traces of an instrumented Linux kernel. LTTV is a modular viewer that can perform analysis on such traces and show the result in text or in a graphical interface.
http://ltt.polymtl.ca/
DevRocket : 結合了上面三個的商業套件

Dec 4, 2007

Gnome hotkey

剛想設定習慣的HotKey時,發現怎麼有麼東西在 Keyboard Shortcuts 工具裡找不到,如:我開了六個 workspace 但卻只能設定 前二個的 HotKey,後來發現,原來也可以直接在 gconf-editor -> apps -> metacity 修改就可以了 :)

setting widescreen monitor

前陣子退伍後,運氣還不錯,馬上就找到工作,到公司後,拿到一台不錯的電腦(我想對一般人來說算還好,沒辨法,我家還是用intel HT cpu & DDR 1G )
blue119@YPWang:~$ lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 02)

Monitor是 ViewSonic VG1921wm

剛灌完ubuntu 7.10後,沒辨法正常的顯示 16:9,就算是選了1440x900 跑出來,還是一樣 4:3 ,畫面的左右二邊會被壓縮到只剩下 1200 左右,只好 google 一下,沒辨法,沒用過 widescreen monitor沒經驗,下面是我改完之後的 xorg.conf
Section "Device"
Identifier "Intel Corporation Integrated Graphics Controller"
Boardname "intel"
Busid "PCI:0:2:0"
Driver "intel"
Screen 0
EndSection

Section "Monitor"
Identifier "Generic Monitor"
Vendorname "ViewSonic"
Modelname "ViewSonic VG1921wm"
Horizsync 30-82
Vertrefresh 50-75
Modeline "1440x900_70.00" 126.98 1440 1536 1688 1936 900 901 904 937 -HSync +Vsync
Modeline "1440x900_60.00" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
Gamma 1.0
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation Integrated Graphics Controller"
Monitor "Generic Monitor"
Defaultdepth 24
SubSection "Display"

Depth 24
Virtual 1440 900
Modes "1440x900@60"
EndSubSection
EndSection
改完之後,強制退出 Xorg 回來還是一樣,不過到 System -> 偏好設定 -> resolution 裡,先改到其它的解析度後在改回 1440 x 900,很新奇的monitor就正常了 @@"

Jun 15, 2007

ubuntu 下使用 fon 上網

因為 fon 使用 wpa 方式加密,所以在 linux 下會比 windows 麻煩一點....
  1. 安裝 wpasupplicant
  2. $su -c wpa_passphrase > /etc/wpa_supplicant/fonera.conf
  3. $su -c wpa_supplicant -BDwext -ieth1 -c/etc/wpa_supplicant/fonera.conf
  4. $dhclient eth1

May 31, 2007

觀看CPU與硬碟溫度

sudo apt-get install sensor-applet hddtemp