2011年5月24日 星期二

OS X 10.6 & PC 共用的檔案格式

Mac 和 PC 要共用,最佳解法是使用 extfs.
extfs 是目前多數 linux 使用的檔案系統,完全的公開技術.
在各種平台,都有免費且完整的支援工具..
macos 用的http://sourceforge.net/projects/ext2fsx/
windows 用的http://sourceforge.net/projects/ext2fsd/

OS X 10.6 雪豹下使用 NTFS 內建或外部 USB 隨身碟

剛使用 MacBook 的時候,最不能讓我適應的是外部存檔這件事了。不管是使用網路空間還是外部硬碟,都是困難重重。好像非得要用MobileMe 才可以輕易的把檔案在不同裝置裡傳來傳去。接上原來在 PC 上使用的 NTFS 格式 USB 硬碟,檔案可以輕易的讀出,可是不能寫入。好一陣子,我都是用 FTP 在儲存我的檔案。可是我還是覺得麻煩。經過一陣子的搜尋後,終於找到幾個好用的辦法了。

在 OS X 下使用NTFS 硬碟讀寫有好幾種方式,可以修該 fstab,使用 MacFUSE + NTFS-3G 或使用付費軟體。這幾個方法我都試過了,都不錯。可是最近 google 到了一個新方法,我個人非常喜歡,因為不用下載新軟體,直接使用雪豹的程式就可以了。不過這個進階設定直接修改雪豹的 NTFS 驅動方法,風險還是有的,修改前請先有心理準備。



警告: 本文件說明了如何通過在終端機應用程式中輸入指令來修改權限設定。 不熟悉 Terminal 和 UNIX 式環境的使用者應小心進行作業。 輸入不正確的指令可能會導致資料流失及/或系統軟體無法使用。 不當修改權限可能會降低系統的安全性及/或造成私密資料外洩。


原理:

雪豹的 NTFS 驅動程式在 /sbin/ 下面,檔案名稱是 mount_ntfs。這個驅動程式原本就可以把 NTFS 硬碟裝在 OS X 的檔案系統下面,可讀可寫。可是雪豹的出廠設定只讓 NTFS 硬碟可以讀,但不能寫。我們只要修改這個設定,把參數加上“讀寫”就好了。

因為硬碟檢測是自動的,OS X 偵測到 NTFS 硬碟,就會直接調用這個程式。我們只要寫一個小小的銜接程式(mddleware),加入我們要的參數,就大功告成了。

動工修改:

因為要直接修改雪豹,我們必須開啓終端機,使用系統管理員的權限做修改。建議先開啓 time machine 備份資料,萬一修改有問題還有機會回復。

(以下修改都在終端機裡面進行)

[補充] 如果你是使用系統管理員帳戶登入的話就可以直接從 STEP 1 開始。如果你現在登入的不是系統管理員,先在終端機裡變更身分,就可以順利進行。Stanly 提供另一個啓用 root 帳號的方法也可以。記得全部做完以後再把 root 帳號關起來就是了。參考:啓用和停用 root 帳號

變更使用者身分:假設管理員帳號名稱為 vincent,在終端機裡打入 su vincent (按 return),系統會問你密碼。輸入密碼後你的身分就變成管理員 vincent 了。進行 STEP 1-》

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

[Stanley補充] 開啟root權限 (如果你從Step 1開始做發現有問題不能繼續時,請照這裡步驟先開啟root帳號,再從頭來過)

在終端機裡輸入 sudo passwd root (然後按下enter)

會跳出請你輸入password,請先輸入你這個原本帳號的密碼

然後會請你重新設定root帳號密碼,並在輸入一次確認



接著,在終端機裡輸入 su (然後按下enter)

然後輸入剛剛重新設定的root密碼就可以以root權限使用終端機



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



STEP 1. 保存並更名原有驅動程式

打入 sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig




系統會問你管理員密碼,輸入管理員密碼。



[重要補充] 檢查 mount_ntfs 是否已更名

(在終端機裡面)打入 ls /sbin/mount* (按 return)

系統會列出 /sbin 下面以 mount 開頭的所有檔案。檢查看看 mount_ntfs.orig 在不在,如果不在,檢查一下出了甚麼問題,不要直接往下做。如果沒有順利保存原有程式,你可能連讀取資料的機會都沒了。





STEP 2. 製作銜接程式(mddleware)。

(進階使用者:直接使用你熟悉的編輯軟體製作以下內容的檔案, 檔案名稱為 mount_ntfs (一律小寫),放在 /sbin 目錄下。跳到 STEP 3)

銜接程式內容只有兩行:



#!/bin/sh
/sbin/mount_ntfs.orig -o rw "$@"





詳細步驟(在終端機裡面進行):

開啓編輯器,打入 nano /sbin/mount_ntfs (然後按下enter)



輸入程式碼



按 Control -O 儲存檔案,再按 Control -X 離開編輯器



STEP 3. 授與銜接程式適當權限

在終端機中打入

sudo chown root:wheel /sbin/mount_ntfs (然後按下enter)

sudo chmod 755 /sbin/mount_ntfs (然後按下enter)




大功告成!!



****還原步驟*****

如果有任何理由想要還原上述變更的話,只要打入 sudo mv /sbin/mount_ntfs.orig /sbin/mount_ntfs 把原來的檔還原就好了。





**注意事項:網路上有相同的方法,而且程式檔案已經做好,可以免費下載。但為了電腦安全,建議不要下載不明軟體,還是自己花點時間,敲敲鍵盤吧!

reference : http://www.macuknow.com/node/6718

2011年5月10日 星期二

PHP CLI slow to exit with CURL + MySQL extensions

Description:
------------
OK, this is a strange one. If you have CURL and either the php_mysql or php_pdo_mysql extensions active, then PHP (command line) will hang for about 5 seconds before actually exiting the script.

This is especially problematic in a CGI scenario, because the connection to the browser isn't closed during this delay and it looks like the request isn't complete.

The problem goes away if I comment out the Mysql extensions in my ini file.

2011年4月24日 星期日

Failed: There was a problem authoring the DVD

solution:
Burn -> Preferences -> Video -> DVD -> NTSC

2011年4月21日 星期四

Comparison of file systems

The following tables compare general and technical information for a number of file systems.

reference : http://en.wikipedia.org/wiki/Comparison_of_file_systems

2011年4月17日 星期日

2011年4月15日 星期五

NirCmd v2.52 - Freeware Windows command-line tool

NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line option, you can write and delete values and keys in the Registry, write values into INI file, dial to your internet account or connect to a VPN network, restart windows or shut down the computer, create shortcut to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more...

Examples of what you can do with NirCmd

Open the door of J: CD-ROM drive nircmd.exe cdrom open j:
Close the door of Y: CD-ROM drive nircmd.exe cdrom close y:
Speaks the text currently in the clipboard (For Windows XP and Vista). speak text ~$clipboard$
Increase the system volume by 2000 units (out of 65535) nircmd.exe changesysvolume 2000
Decrease the system volume by 5000 units (out of 65535) nircmd.exe changesysvolume -5000
Set the volume to the highest value nircmd.exe setsysvolume 65535
Mute the system volume nircmd.exe mutesysvolume 1
Unmute the system volume nircmd.exe mutesysvolume 0
Switch the system volume between the mute and normal state. nircmd.exe mutesysvolume 2
Create a shortcut on your desktop that switch the system volume between the mute and normal state. nircmd.exe cmdshortcut "~$folder.desktop$" "Switch Volume" mutesysvolume 2
Turn off the monitor nircmd.exe monitor off
Start the default screen saver nircmd.exe screensaver
Put your computer in 'standby' mode nircmd.exe standby
log off the current user nircmd.exe exitwin logoff
Ask if you want to reboot, and if you answer 'Yes', reboot the computer. nircmd.exe qboxcom "Do you want to reboot ?" "question" exitwin reboot
Turn off your computer nircmd.exe exitwin poweroff
Turn off all computers specified in computers.txt ! multiremote copy "c:\temp\computers.txt" exitwin poweroff force
Dial to "My Internet" connection nircmd.exe rasdial "My Internet"
Disconnect the "My Internet" connection nircmd.exe rashangup "My Internet"
Make your Internet Explorer windows 75% transparent ! (192 / 256) nircmd.exe win trans ititle "internet explorer" 192
Minimize all your Internet Explorer windows nircmd.exe win min class "IEFrame"
Close all your Internet Explorer windows nircmd.exe win close class "IEFrame"
Close all your Explorer windows (My Computer, folders, and so on) nircmd.exe win close class "CabinetWClass"
Hide all your Internet Explorer windows nircmd.exe win hide class "IEFrame"
Show all your Internet Explorer windows (after you made them hidden with previous example) nircmd.exe win show class "IEFrame"
Center all top-level windows nircmd.exe win center alltop
Remove the title bar of My Computer window. nircmd.exe win -style title "my computer" 0x00C00000
Return the title bar of My Computer window that we removed in the previous example. nircmd.exe win +style title "my computer" 0x00C00000
Set the My Computer window to right-to-left order (For hebrew and arabic languages) nircmd win +exstyle title "my computer" 0x00400000
Set all child windows of My Computer window to right-to-left order (For hebrew and arabic languages) nircmd win child title "my computer" +exstyle all 0x00400000
Create a shortcut on your desktop that closes all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Close All IE" win close class "IEFrame"
Create a shortcut on your desktop that hides all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Hide All IE" win hide class "IEFrame"
Create a shortcut on your desktop that shows back all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Show All IE" win show class "IEFrame"
Set the Windows Calculator as top-most window (above all other windows) nircmd.exe win settopmost title "Calculator" 1
Set the Windows Calculator back to regular window (non top-most window) nircmd.exe win settopmost title "Calculator" 0
Create a shortcut to Windows calculator under Start Menu->Programs->Calculators nircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator"
Hide the desktop window nircmd.exe win hide class progman
Show the desktop window (After hiding it in previous example) nircmd.exe win show class progman
Hide the start button on the system tray nircmd.exe win child class "Shell_TrayWnd" hide class "button"
Show the start button on the system tray nircmd.exe win child class "Shell_TrayWnd" show class "button"
Hide the clock on the system tray nircmd.exe win child class "Shell_TrayWnd" hide class "TrayClockWClass"
Show the clock on the system tray nircmd.exe win child class "Shell_TrayWnd" show class "TrayClockWClass"
Kill (terminate) all instance of Internet Explorer processes nircmd.exe killprocess iexplore.exe
Create a shortcut on your desktop that opens the door of K: CDROM drive when you run it. nircmd.exe cmdshortcut "~$folder.desktop$" "Open CDROM" cdrom open k:
Create a shortcut to NirSoft Web site on your desktop nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.desktop$" "NirSoft"
Add NirSoft Web site to your Favorities under Links folder. nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.favorites$\Links" "NirSoft"
Create a shortcut to NirSoft Web site on the desktop of all computers listed in computers.txt nircmd.exe multiremote copy "c:\temp\computers.txt" urlshortcut "http://www.nirsoft.net" "~$folder.common_desktop$" "NirSoft"
Set the display mode to 800x600x24bit colors nircmd.exe setdisplay 800 600 24
Create a shortcut on the desktop that set the display mode to 800x600x24bit colors nircmd.exe cmdshortcut "~$folder.desktop$" "800x600x24" setdisplay 800 600 24
Copy all shortcuts on your desktop to another folder (f:\temp\desktop). nircmd.exe execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktop
Restart your Apache server (under Windows NT/2000/XP/2003) nircmd.exe service restart apache
Create a shortcut on your desktop that restarts the Apache server nircmd.exe cmdshortcut "~$folder.desktop$" "Restart Apache" service restart apache
Restart your IIS nircmd.exe service restart w3svc
Restart MySql nircmd.exe service restart MySql
Open the desired Registry key/value in RegEdit nircmd.exe regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir"
Open the Registry key that you copied to the clipboard in RegEdit. nircmd regedit "~$clipboard$"
Disable the screen saver nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 0
Enable the screen saver nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 1
Change the date/time of the specified filename (creation time and modified time) nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56"
Copy your desktop folder path to the clipboard nircmd.exe clipboard set ~$folder.desktop$
Copy your start menu folder path to the clipboard nircmd.exe clipboard set ~$folder.start_menu$
Copy the content of info1.txt (simple text file) to the clipboard nircmd.exe clipboard readfile "c:\My Files\info1.txt"
Add the text content of clipboard to info1.txt nircmd.exe clipboard addfile "c:\My Files\info1.txt"
Clear the clipboard nircmd.exe clipboard clear
Create all folders specified in "c:\temp\folders.txt". The folder path names are separated by CRLF characters. nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$
Install the specified .NET assembly in the global assembly cache (like gacutil) nircmd.exe gac install "C:\temp\MyAssembly\bin\MyAssembly.dll"
Empty the recycle bin in all drives. nircmd.exe emptybin
Answer 'Yes' to a standard Windows message-box. nircmd.exe dlg "" "" click yes
Wait 2 seconds, and then save the current screen to shot.png nircmd.exe cmdwait 2000 savescreenshot "f:\temp\shot.png"
Save 10 screenshots in a loop, and wait 60 seconds between the screenshot save calls. The filenames of the screenshot will contain the time and date of the saved screenshot. nircmd.exe loop 10 60000 savescreenshot c:\temp\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png
Wait until Firefox is closed, and then say "Firefox was closed" waitprocess firefox.exe speak text "Firefox was closed"

System Requirements

This utility can work in all 32-bit Windows operating systems: Windows 9x/ME, Windows NT, Windows 2000, Windows XP, Windows Server 2003, and Windows Vista. However, some of NirCmd commands works only on Windows NT/2000/XP/2003/Vista.

官網:http://www.nirsoft.net/utils/nircmd.html

wibiya widget