Archives

gravatar

降低MacBook電源接頭的高頻聲

MacBook 的電源接頭那邊,只要接上 AC Power,就會有高頻的滋滋聲。其他使用者也有類似問題,看板上的網友回答是,這是 MacBook 的"三高"之一。以前用過其他 IBM 的筆記型電腦也有類似的聲音。Anyway,聲音不是很大,但是在安靜的房間仔細聽起來也是蠻惱人的。不過後來發現,接上 iPod Touch 之後,聲音就沒有了。但是接上耗電量比較少的裝置,像是 USB Solid-state disk,Optical Mouse,還是一樣會有這個問題。所以就是要讓 USB 消耗大一點的電源,才能降低高頻聲。但是不可能一直開著 iPod touch 放在那邊。看來可以找些小玩意來裝,例如 USB 臭氧、負離子產生器,USB 風扇(夏天快到了),NoteBook散熱底座,...

gravatar

My First iPhone App

This is my first iPhone application written in iPhone OS 2.0 SDK. Unfortunately, it only runs on iPhone simulator not the real iPhone or iPod touch device. Even I use iPhone toolchain from third party to rebuild the source code, some UIKit classes are miss in current iPhone/iPod touch 1.1.4 firmware.
The purpose of this application is to help users to browse the UDN news items and read news page more easily. Rich content web pages with javascript are not user-friendly on mobile device and touch device. However, this might not have chance to run on iPhone platform due to Apple's App Store restrictions and 2.0 firmware.
iPhone SDK provides an integrated environment and simulator to develop applications easily. But under the restriction, the 3rd party iPhone toolchain and jailbreaked environment should be more useful for ordinary developers.

gravatar

iPhone雙重開機

iPhone Dual Boot / Jailbreak。應該也可以適用 ipod touch。

gravatar

MacBook vs iBook G4

MacBook 13.3" 2.16Ghz vs iBook G4 12" 1.2Ghz
花了 34,900 元帶他回家, 但是 3/6 馬上又降價了, 改成 31,900 元。打去退差價 3000. ^+++^

gravatar

iPhone SDK 開放下載

Apple 首頁已經刊出 iPhone SDK 開放下載(但是似乎連不上 ADC server)。也可以試用 Enterprise Beta Program。

gravatar

iPhone SDK 新聞

節錄自MacRumors部份內容及翻譯。給企業使用者的功能, iPhone下個更新將會包含有 Push Email、Push Calendar、Push Contacts、Global Address List、Cisco VPN、WPA2/802.1x、安全原則、裝置設定、Remote Wipe、ActiveSync(用來同步 Exchange 到現有的 mail, calendar, contacts)
SDK 部份, Apple 釋出他們用來開發 iPhone 應用程式的相同 API。給 OS X 用的 iPhone 模擬器可以幫助開發者。支援動畫、3D、攝影機、網路、檔案存取和錄音的強大 API。
原生(Native)的iPhone應用程式需要透過iTunes的應用程式商店, 用無線網路下載。開發者決定價格、並且可以得到 70% 的收益。沒有其他的額外費用。每個月付給開發者。
SDK 今天起可以免費下載。然而要發佈應用程式, 則需要 $99 美金 (約三千台幣)的開發者費用。

gravatar

[OSX]更多的browser效能評比

利用 WebKit 所提供的 SunSpider benchmark 來測試 Mac OS X 上各家的瀏覽器裡面 JavaScript 的效能。 測試平台是 Mac OS X 10.5.2 Leopard on Apple iBook 1.2Ghz。瀏覽器包含正式版的 Firefox 2.0.11、Safari 3,測試版的 Firefox 3.0b5pre、WebKit Nightly Build、Opera 9.5beta。測試結果看來都是測試版的瀏覽器大獲全勝,其中又以 Firefox 3.0b5pre 最為突出,一改 Firefox 讓人詬病的速度問題。再來是 WebKit,效能上只輸 Firefox 3b5pre 一點,很難想像用他來作為核心的 Safari 竟然會有這麼大的差距。接著是 Opera 9.5beta,雖然他們號稱速度上是第一,可能整體上來說沒錯,但是畢竟在單純 JavaScript 上沒有這麼好的成績。敬陪末座的就是舊版 Gecko 核心的 Camino 1.5 和 Firefox 2.0.11。
在 Firefox 3b5pre 釋出後不到一天,一些 Addons 已經更新支援最新的 Firefox 3 beta nightly build,例如 Adblock Plus。

gravatar

Firefox 3 Beta5 Pre-release

Firefox 3 的第五個測試版本出來了,舊的測試版用戶可以透過 Update 直接升級。但是升級的缺點就是一些 addons 都不能用,其實應該是相容,但是受限版本檢查限制,全部不能用。尤其我最重要的 adblock plus 一失效的話,yahoo、udn 等等廣告全部跑出來了,花花綠綠的真是不習慣。
順便做了 WebKit 上得 Sunspider 效能測試,來試驗現在各家版本的 JavaScript 效能。

  1. Firefox 3 b5pre: 13495.8ms
  2. Firefox 2: 53977.4ms
  3. Safari 3: 42380.8ms
結果很明顯,Firefox 3 的速度完全勝出。測試平台為 PowerPC G4 1.2Ghz。

gravatar

Firefox 3 beta pre4

Firefox 2 在 mac os x 執行,除了網頁資料下載速度快點,顯示還有效能都不如 Safari。連字體都是只有醜醜的 Gray Level AntiAlias。Firefox 3 測試版出來時,就迫不及待的去嘗試。因為主要是把 Carbon 換成 Cocoa,把畫面和字型繪製改由 Cairo。結果一試就大失所望,因為效能真是慢到一個不行。以常用的 Google Spreadsheets 來說,在儲存格上上打注音輸入中文真是慢到一個不行。所以還是想等到他推出正式版本再說吧,畢竟現在還是 beta。在 Slashdot文章和這篇 Undocumented API 才是王道提到一些主要原因。接著再下載最新的 Firefox 3 nightly build 來試試看,果然感覺速度或效能已經比 Firefox 2 快了,搭配 Arial Unicode MS 字體,Cairo 畫出來的 CJK 字型很美觀,已經有點迫不及待想要丟掉 Firefox 2.0。
至於 Apple 在 WebKit 裡面擺的 binary lib 果然是大有來頭,因為從 WebKit repository checkout 的程式碼,擺著沒有 source code 的 lib 就已經很讓人猜疑。

gravatar

iPhone SDK on 3/6

MacRumors 消息 apple 將在 3/6 舉辦一場特別的活動,並且在禮拜二已經把邀請函發給記者。此外除了 SDK,還有令人振奮的新 enterprise features。

Please join us to learn about the iPhone software roadmap, including the iPhone SDK and some exciting new enterprise features. The event takes place at Apple, Building 4, Town Hall on March 6 at 10:00 a.m. Registration begins at 9:00 a.m. Arrive early for this invitation-only event. RSVP to rsvp.media@apple.com

gravatar

Fully software jailbreak for 1.1.3 iPod touch/

ZiPhone 可以直接針對 1.1.3 firmware 的 iPod touch/iPhone 作 jailbreak。在我的 Mac OS X 10.5.2 環境下,iTunes 為 7.6,iPod touch 1.1.3版。直接接上 usb 後,離開 iTunes,執行 ziphone -j -v 一段時間後,iPod 就自己重新開機,並且顯示一堆文字模式的開機和安裝過程。經過再一次重新開機,裡面就已經安裝有 Installer,這時候就算已經 jailbreak 成功,並且可以自己安裝程式。
破解原理:透過 Apple Mobile Device 的介面把 zibri.dat 這個 ramdisk 傳送到 iPod/iPhone,然後設定 nvram 裡面屬性(把要做的事情記在 nvram),並且設 boot-args rd=md0 pmd0=0x09CC2000.0x0133D000,OpenFirmware 使用者應該很清楚,可以設定 boot-args 在開機時候指定 root disk,這裡指定到 memory disk。開機後就會執行到 /etc/profile。然後就 mount 系統本來 flash 裡面的 disk,開始 patch,然後清掉設定的 nvram 屬性,恢復原本開機 root disk,重開機 done。Great Works!!

# System-wide .profile for sh(1)
PATH="/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin"
export PATH
/bin/sleep 5
/bin/echo "Starting unlock..."
if [ "`/usr/bin/nvram -p|/bin/grep unlock1`" != "" ] ; then /zib/gunlock /zib/secpack /zib/ICE04.02.13_G.fls; fi
if [ "`/usr/bin/nvram -p|/bin/grep unlock2`" != "" ] ; then /zib/gunlock2 /zib/secpack /zib/ICE04.02.13_G.fls a12345
6789012345 ; fi
/sbin/fsck_hfs /dev/disk0s1
/sbin/fsck_hfs /dev/disk0s2
if [ "`/usr/bin/nvram -p|/bin/grep jailbreak`" != "" ] ; then
/bin/echo "Starting jailbreak..."
/sbin/mount_hfs -o noasync,sync /dev/disk0s1 /mnt1
/sbin/mount_hfs -o noasync,sync /dev/disk0s2 /mnt2
if [ -e /dev/rmd1 ]; then /bin/dd if=/dev/rmd1 of=/mnt2/root/mem_dump.bin bs=4096 count=4096; fi
#/zib/bbupdater -l /zib/BOOT03.09_M3S2.fls
#/bin/sleep 20
# jailbreak
# disk0s1
if [ "`/usr/bin/nvram -p|/bin/grep activate`" != "" ] ; then 
/bin/echo "Patching lockdownd..."
/bin/ipatcher -l /mnt1/usr/libexec/lockdownd
/bin/cp /zib/fstab /mnt1/private/etc/fstab
/usr/bin/unzip -o -K -X /zib/Installer.zip -d /mnt1/Applications/
#/usr/bin/unzip -o -K -X /zib/BSD_Subsystem.zip -d /mnt1/
#/usr/bin/unzip -o -K -X /zib/openssh-4.6p1-1.zip -d /mnt1/
# disk0s2
if [ "`/usr/bin/nvram -p|/bin/grep activate`" != "" ] ; then
/bin/echo "Activating youtube..."
/bin/mkdir -p /mnt2/private/var/root/Library/Lockdown
/bin/cp /zib/data_ark.plist /mnt2/root/Library/Lockdown/
/bin/cp /zib/device_private_key.pem /mnt2/root/Library/Lockdown/
/bin/cp /zib/device_public_key.pem /mnt2/root/Library/Lockdown/
/bin/mkdir -p /mnt2/mobile/Library/Installer/Temp
/bin/mkdir -p /mnt2/root/Library/Installer/Temp
/bin/cp /zib/LocalPackages.plist /mnt2/mobile/Library/Installer/ 
/bin/cp /zib/LocalPackages.plist /mnt2/root/Library/Installer/ 
#/bin/cp /zib/RemotePackages.plist /mnt2/mobile/Library/Installer/ 
#/bin/cp /zib/RemotePackages.plist /mnt2/root/Library/Installer/ 
/bin/cp /zib/PackageSources.plist /mnt2/mobile/Library/Installer/ 
/bin/cp /zib/PackageSources.plist /mnt2/root/Library/Installer/ 
/bin/cp /zib/TrustedSources.plist /mnt2/mobile/Library/Installer/ 
/bin/cp /zib/TrustedSources.plist /mnt2/root/Library/Installer/
/bin/cp /zib/com.apptapp.Installer.plist /mnt2/mobile/Library/Preferences/
/bin/cp /zib/com.apptapp.Installer.plist /mnt2/root/Library/Preferences/
#end jailbreak
/bin/echo "Unmounting filesystems..."
/usr/bin/umount /mnt1
/usr/bin/umount /mnt2
/sbin/fsck_hfs /dev/disk0s1
/sbin/fsck_hfs /dev/disk0s2
/usr/bin/nvram auto-boot=true
/usr/bin/nvram boot-args=""
/usr/bin/nvram -d unlock1
/usr/bin/nvram -d unlock2
/usr/bin/nvram -d jailbreak
/usr/bin/nvram -d activate
#/usr/bin/nvram -d unlock2
/bin/echo "Now rebooting..."
/sbin/reboot
while (true); do sleep 1; done

gravatar

iJailBreak 0.4.1

iJailBreak 0.4.1出現了,可以適合用在破解 1.1.3 的 firmware,不過很巧合的有同樣的限制,必須在已經 jailbreak 的 1.1.1 或 1.1.2 才能使用。而且也是使用 iPhone 的 firmware。因為 iPod touch 的 firmware vfdecrypt key 還沒被解出來。雖然這是個 13 歲的開發者寫的軟體,不過其實他應用的就是前幾介紹的方法。詳細內容請參考 iJailBreak.app/Contents/Resources。

gravatar

看別人的尾牙

在永遠的真田幸村中的看到一篇「看了種花電信的尾牙,覺得自己單位真的很幸福」。仔細去看那兩篇分別為2007、2008的為牙文章內容,感覺作者還真是苦中作樂。也感覺的確自己的單位比起來是幸福多了,雖然常常跟前面的比,實在完全是比不上,但是能說是比下有餘嗎 XD。至少最低通通有獎 2k,這樣也能說是約等同於「種花電信」的大獎了;抽到 5k,就等於頭獎了;抽到 8k,那就可以算特獎囉。所以大家都有抽到大獎就不用太計較了。

gravatar

Mac OS X 上推薦的瀏覽器字型

在 WebKit based 的瀏覽器上,瀏覽器顯示的字型是以 International Pane 所選擇的地區順序設定來挑選 fallback 字型。(當該字型沒有該字的 Glyph,則繼續選用候選字型)所以常常可以在某些網頁上看到本來是細明體的字型,穿插著黑體字。或者是在黑體字中間,穿插著粗細或高低不一的字。尤其是在 firefox 瀏覽器上常常看得到。 這個原因是 firefox 本身有 unicode 地區的編碼分類,以及各種語系之間使用不同的字型因素。像是台灣中文是 Apple LiGothic Medium,日文是 Hiragino Kaku Gothic,韓文是 Apple Gothic。而當某些 unicode 網頁中出現某些字型,可能會依照該字碼挑選地區來選擇字型。或者看起來像是繁體的中文字,卻挑選了日文的字型來繪製。而這些字型的挑選,雖然在程式已經提供了讓使用者可以挑選各地區的字型,但是真正繪出文字的字型可能不是使用者希望的。所以最好的方法就是,在這些 CJK 語系地區使用統一的字型,而且該字型又有幾近完整的 unicode glyph 資料,才不會到時候缺字又要使用其他字型補字。 在 Mac OS X 上,有一個字型叫做 Arial Unicode MS。雖然名字有 MS 但不是微軟做的,是一家 Monotype 字型公司。英文字型看起來是 Arial,亞洲字體看起來像是黑體(雖然經過 Apple AntiAlias後看起來沒有黑體那麼黑和清晰)。用起來在 firefox 上效果不錯,對於本身我自己習慣看 Sans-Serif 字體來說,是相當好的選擇,就連 Safari 預設字型都設成這個字型。

gravatar

iPhone/iPod Touch 1.1.3 jailbreak 軟體內容

再述前一篇的 1.1.3 firmware 升級方法,並沒有將你的 firmware 完全升級為 1.1.3,實際上是 1.1.1/1.1.2 jailbreak firmware + 部份 1.1.3 軟體。舉例來說,如果手動下載一個韌體後, 把 .ipsw 改成 .zip 後解壓縮,其實裡面包含了一些 dmg, flash, darwin kernel。而其中它把某個 dmg 抽取出來處理後再透過 iPHUC upload 到 iPod/iPhone。所以說它並沒有將其他部份,像是 kernel/driver 的部份升級到 1.1.3 對應的版本。你自己也可以將他透過 vfdecrypt 所產生出來解密的 dmg 打開來看,其實裡面跟一般 Mac OS X 的目錄和檔案 layout 很像,但是裡面並沒有 kernel 檔案。所以說,目前的作法是將 1.1.1/1.1.2 已經 jailbreak 的 kernel 和驅動程式保留住,只升級內部的軟體。所以如此升級的話,結果就是 1.1.1/1.1.2+1.1.3 的混血版本。對於 iPod Touch 來說,比較沒有差別,因為 touch 不會有太多的 driver,像是手機 base band, BT,...。所以如此升級,還是可以保留大部分優點,像是 Application 部份的 bugfixes,以及免 USD 20 元的軟體。

gravatar

iPhone/iPod Touch 1.1.3 firmware 破解

目前網路上找得到的 1.1.3 firmware package maker 破解方式都經由原版 iPhone 1.1.3 firmware,透過已知的 decryption key 把 dmg 解開,然後再安插 1.1.1/1.1.2 的 patch 後再 upload 到 iPhone/iPod 上,前提是機子要是 1.1.1 or 1.1.2 已經 jailbreak 的韌體。 如果是在 PowerPC based 機器上作這件事,需要先將 package maker 的 data 目錄內一些執行檔再重新編譯一次,sdelta & dmg2img 可以在裡面 source 目錄編譯完後,複製到 data 目錄使用。而 vfdecrypt 則可以到 Google Code iphone elite team 去下載,然後把 #include <byteswap.h> 刪除後,gcc -o vfdecrypt vfdecrypt.c -lcrypto 就可以了。 更詳細的教學和畫面在http://www.iclarified.com/entry/index.php?enid=606

gravatar

iBook LCD Display

自從上次 iBook 螢幕顯示壞掉之後,螢幕就是花花綠綠一片。於是就拆掉螢幕,接上大的寬螢幕使用。這樣用起來還蠻有一番趣味,因為 iBook 放在外接螢幕前,就好像只是鍵盤一樣,不會有 LCD panel 擋住外接螢幕視線。但是缺點就是,本來 portable 就變成不 portable。前幾個禮拜看到有人在賣 iBook 零件,剛好有上蓋那部份整個 LCD panel,而且不貴加上運費才不到 2.5k。於是就敗了回來,但是拆 iBook 實在也是一件浩大工程,所以遲了幾天後才正式開工。經過一陣子 iBook 解剖之後,終於把螢幕給裝回去。順便把 Hitachi 的硬碟拆下來接到 PC,用 feature tool 把調整 acoustic level 為 quiet seek mode。因為說實在的,從以前新硬碟裝上去之後,都覺得三不五時常常會有「框搭」的聲音,尤其夜深人靜時候更是明顯。而 feature tool 又只能在 PC 上跑,所以趁這個機會挖出硬碟來改。又一陣兵荒馬亂之後,把整台 iBook 完全組裝完畢。於是 iBook 又有自己的「頭」了,不過,嗯,怎麼每拆一次 iBook 就莫名其妙生出一些小螺絲,記得明明都有鎖到 XD。
ps: 先前順便把壞掉的螢幕拆掉,原來裡面用的是 LG Philips 的面板。

gravatar

SafariPowerToy next stage

基本上因為有些 code 是牽涉到 platform/machine dependency,所以在沒有 x86 機器情況下,我沒辦法去測試,所以就不包這部份的 binary。那功能上的部份就不探討這些方面。
那下一個 stage 是什麼,比較簡單的就是改掉簡繁轉換的某些字元衝突。像是簡體字"只"對應到正體可能也會有“隻“,"斗"或許是對應到"鬥",但是只和斗也是正體常用的字,把他們任意轉換之後,正體文就怪了。另外一招就是學中文 wikipedia,建一堆辭彙轉換。不過當然就是增加一堆 trade off。試想,在內部都用 unicode 表示下,簡繁字體都可以並存,drawing 時候全部丟去辭彙 search/replace,應該不是一個好方法。目前只是單一個字元,並且用 GNU perfect hash 產生出來的表格,至少快很多。那為什麼不直接把儲存的 unicode 內容本質上就改成正體編碼。我想還是不要任意去更動使用者內部儲存的資料比較好,因為目的和用途不知道情況下,這樣可能會破壞使用者在網頁上的輸入和 submit 資料。
另外一個部份,是想實作類似 Firefox 上使用 google toolbar 的 translation 其中一個功能,在滑鼠游標下的英文字彙,可以有類似 Dr.eye 的翻譯效果。這對看英文網頁幫助不少(汗),因為 firefox 的肥大和速度讓我不喜歡在 Mac OS X 下使用,所以有這樣的東西相對就拉近兩者所需功能的距離。如果你有打開 Universal Access 的話,在 Safari 裡面滑鼠移動到某個英文字,然後按下 Ctrl-Cmd-D,就可以直接在內建的 Dictionary 裡面查到英英解釋。這就是透過 Apple Accessibility API 所得到的效果,當然 WebKit 裡面也是有支援 Accessibility API 才有辦法。但是研究了很久 Apple Accessibility API,以及 WebKit 裡面的支援(這部份都還沒 document)。還是沒有辦法只取到單一個英文字,頂多只有整段片段。另外一個方法就是反組譯 Dictionary.app 去看他怎麼抓這部份單字,當然這也是一個苦差事,因為反組譯和他使用的 API 方式都很難懂。所以有對 Accessibility API 有經驗的朋友,希望能夠得到一些分享經驗或知識,就像隔行如隔山,搞不好點破就一切通了XD。

gravatar

Dedicate swap partition for Leopard

Prior to 10.5, it needs to modify /etc/rc.local to mount the disk partition because that dynamic pager is run before mounting volumes.
In Mac OS X 10.5 Leopard, /etc/rc.local does not no longer exist. Instead, lanuchd is used to run some daemons after system start. In /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist, it controls the dynamic swap size and location. In my case, I have a separated partition name ".swap" and will be mounted under /Volumes/.swap. Just run Terminal.app and sudo vi com.apple.dynamic_pager.plist to edit it. Here is a portion of an example,

<key>Label</key> <string>com.apple.dynamic_pager</string> <key>ProgramArguments</key> <array> <string>/sbin/dynamic_pager</string> <string>-S</string> <string>1073741824</string> <string>-H</string> <string>4096</string> <string>-L</string> <string>1073750016</string> <string>-F</string> <string>/Volumes/.swap/swapfile</string> </array> <key>OnDemand</key>
After reboot, the swapfile will be relocated to /Volumes/.swap and size is fixed to 1GiB. note: remember to delete /var/vm/swapfile* to release unused swap spaces.

gravatar

SafariPowerToy 0.2 for 10.5 Leopard

Only available and tested for PowerPC 32-bit Mac OS X environment.
Objective-C 2.0 and the WebKit build of 10.5 Leopard are incompatible with previous build of SafariPowerToy on 10.4. A new version for Leopard is released.
The InputManagers installation is not like that on 10.4 Tiger. Please refer to the manual for the detail.
For developer compatible topics: 1. Objective-C 2.0 does not support

IMP func = [class methodFor:@selector(method)]
to get the method address. It will result coredump in Leopard Objective-C 2.0. Using class_getClassMethod() and method_getImplementation() instead. For example,
Method method = class_getClassMethod(NSClassFromString(@"NSString"), @selector(initWithString));
IMP func = method_getImplementation(method);
2. Method.method_imp is not supported in Objective-C 2.0. MethodSwizzle will not correctly work. Instead, using
method_exchangeImplementations( method1, method2 );
is simple and easy.