RSS
 

Archive for the ‘Linux’ Category

iPhone 4 與 i9000 的抉擇?!

15 Sep

這兩隻手機個有特色. 很難一較高下. 購買前也是要猶豫很久. 到底要選誰呢? 是”愛瘋屎” (iPhone 4) 還是”愛就簽” (i9000)?

螢幕 PK :
i9000 (480 x 800 pixels, 4.0″) 螢幕比 iPhone 4 (640 x 960 pixels, 3.5″) 大. 但是 iPhone 4 (retina) 螢幕解析度比 i9000 (super amoled) 好很多. 在看 iPhone 4 的螢幕幾乎看不到點了.而 i9000 還可以看到點點. 畫面細緻 iPhone 勝 螢幕大小 i9000 勝

相機 PK :
兩台都是500萬畫素(5 MP, 2592 x 1944 pixels), 錄影等級也是一樣 720p@30fps. iPhone 4 有閃光燈 i9000 沒有. 內建軟體 iPhone 4 可以拍 HDR i9000 不行. 內建軟體 i9000 可以拍環景(Panorama) iPhone 不行. iPhone 4 可以調整遠近(room in/ out) i9000 不行. i9000 有拍攝情境 iPhone 4 沒有….etc 還有好多. XD 不過整體而言. i9000 的相機軟體寫得比較好. 畢竟 samsung 有在做相機. apple 只是亂搞一通而已. i9000 勝

效能 PK :
iPhone 4 使用 1 GHz Apple A4 processor, i9000 使用 ARM Cortex A8 1GHz processor, 兩台都是 512 MB RAM. 就操作流暢度而言. iPhone 4 比較流暢. 也許是因為假多工的關係. 反觀 i9000 在 v2.1 (Eclair) 版本使用起來很卡. 常常要等待. 且有時候還懷疑自己有沒有按好. i9000 在 v2.2 (Froyo) 採用 JIT (Just-in-time) 技術, 效能已經有改善. 但是, samsung 原廠使用 rfs 效能不好. 所以還是沒有到完美流暢. 不過, 如果有使用卡三爽修改過後使用 jfs 速度會大幅提昇. 就一般而言不破解的狀況 iPhone 勝. 如果i9000經過卡三爽調校後. i9000 , iPhone 難分高下

網頁瀏覽 PK :
i9000 在 v2.2 (Froyo) 有支援 Flash 功能. 雖然開啟之後, 感覺比較耗電. 而 iPhone 4 沒有支援 Flash 瀏覽功能, iPhone 需要 JB 後 安裝 Frash 才能瀏覽有 Flash 網頁內容. 所以 i9000勝

整合性 PK :
i9000 可以直接登入 Google 帳號. 免費把通訊錄 行事曆 下載回來並且同步. iPhone 4 搭配 me.com 服務可以完美整合. 但是每年需要花費99美金. 如果要使用 iPhone 4 與 Google 帳號整合, 那並不能完全支援. 例如, 在 Mac 內的Address Book的通訊錄雖然可以設定與Google帳戶同步, 但是同步後還是有些小問題, 例如生日欄位無法同步. 且不能透過線上同步. 必須經由 iTunes 與 Address Book 同步再與 Google 通訊錄同步. 至於, Google 行事曆必須要額外設定後才能順利與 iPhone 4 通訊錄同步. 雖然, 有謠言指出 me.com 要開放免費給大家使用. 但是目前還沒開放. 所以, i9000 勝.

人機介面 PK :
iPhone 4 與 i9000 各有優缺點. 就中文輸入而言. i9000的注音輸入法是比較接近我們平常用的模式. iPhone 則是用他們的排法. 複製貼上功能 iPhone 4 做得比 i9000 好.我在使用 i9000 複製貼上功能幾乎快要瘋掉. i9000 多了 menu 和 return 鍵. 設計上好像很合理. 但是常常會誤觸. 另外, iPhone 4 只有 home 按鈕所以iPhone 4 操作畫面會看起來比較小.

網路分享 PK :
i9000 可以把手機設定成為無線網路基地台 (wireless ap) 而 iPhone 4 在 iOS 4.2.1 以前的版本, 只能透過藍芽或是USB分享網路. i9000可以1對多 iPhone 4 只能1對1. 除非要JB iPhone 4 然後安裝 MyWi 才能透過 wifi 分享網路.

在 iOS 4.2.1 以前的版本 :

iPhone 4 有限的分享能力


當然可以透過JB 然後購買 MyWi 的軟體(19.99美金) 就可以分享了. MyWi 分享給 Windows 使用者需要比較進階的設定才能上網. 還是有點小麻煩.


Andriod 這樣分享才是王道阿

在 iOS 4.3 以後的版本

真正的官方無線網路分享也到來了, 蘋果你讓大家等太久了吧..蘋果你終於上道了..

iPhone 4 在 iOS 4.3 之後的版本, 可以建立 Personal Hotspot. 所以, i9000 , iPhone 難分高下.

網路電話 PK :
iPhone 4 有 skype 軟體. i9000 也有 skype. 但是在 v2.1 (Eclair) 不相容. 無法正常登入. 一旦登入 skype 後 會導致 i9000 當機. i9000 在 v2.2 (Froyo) 已沒這樣的問題了. i9000 , iPhone 難分高下

視訊 PK :
iPhone 4 FaceTime. 可以在飛航模式下使用. 而且很順暢. 理論上又不用花額外的費用?! (這等我下個月帳單來在釐清一下) 而 i9000 視訊應該是透過 3G. 是要額外付費. 品質如何? 我還沒側試過 :$ 不過我認為 iPhone 勝

影像播放 PK :
iPhone 4 能支援下列影像格式

  • H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats;
  • MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats;
  • Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

i9000 能支援下列格式 :

  • Supported Codec: MPEG-4, H.264, H.263, H263Sorenson, DivX HD/ XviD, VC-1
  • Supported Video Format: 3gp (mp4), WMV (asf), AVI (divx), MKV, FLV

大多數的影音檔案在 i9000 都不用轉換就可以直接在 i9000 播放. 反觀 iPhone 4 就需要轉換成它支援的特定格式才可以播放. i9000勝

電池 PK :
i9000 (1500 mAh) 電池容量比 iPhone 4 (1420mAh) 大. i9000 可以換電池 iPhone 4 不行. i9000勝

重量 PK :
i9000 (119 g) 比 iPhone 4 (137 g) 輕很多. i9000勝

大小 PK :
iPhone 4 (115.2 x 58.6 x 9.3 mm) 比 i9000 (122.4 x 64.2 x 9.9 mm) 小. iPhone 勝

質感 PK :
iPhone 4 質感比 i9000好. iPhone 採用耐刮玻璃(Scratch-resistant). i9000採用塑膠材質. iPhone 勝

大致上列出上列的優缺點. 應該可以幫助你購買手機的決策. 謝謝收看 : P

參考 : Samsung I9000 Galaxy S, Apple iPhone 4

最後更新日期 3/8/2011

相關閱讀 : iPad Wi-Fi 與 iPad 3G 抉擇?!, iPhone 4 終於有 Personal Hotspot

 
 

將目錄內所有的某附檔名遞迴移除

05 Sep

例如我要將桌面內所有 .wma 檔案遞迴移除. 可以用下列指令 :

find ~/Desktop/ -name *.wma -exec rm -v {} \;

 
No Comments

Posted in Linux

 

Android – 機房溫度監測簡單範例

01 Sep

分享一個簡單的 android 程式範例. 主要用 ImageView 顯示某 URL 的圖片. 這算是我第一隻比較有用處的 Android 程式


將手機連接到電腦. 啟用 debug 模式. 執行之後就可以將程式部屬到 android 手機了. 這比起蘋果的 Xcode 方便許多. iphone 系列手機沒破解的話就不能直接在設備上執行. 真是有點令人討厭.


執行 Temperature 程式結果

以下為 Android 各檔案的內容 :
AndroidManifest.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="tw.edu.sinica.tiara.temperature"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Temperature"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 
    </application>
    <uses-sdk android:minSdkVersion="5" />
 
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

在這裡要注意是否加入 <uses-permission android:name=”android.permission.INTERNET”></uses-permission>. 如果沒加入的話.程式不能存取 internet. 這個我搞了好久才想起來要這樣弄.

下面檔案主要在描述 UI 部分
layout/main.xml

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:text="@string/title" android:gravity="center" android:textSize="16sp" android:textColor="#FF000000" android:background="#FFFFFFFF"/>
<ImageView android:id="@+id/ImageViewR937" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFFFF"></ImageView>
</LinearLayout>

下列檔案在描述 strings
values/strings.xml

1
2
3
4
5
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="title">R937</string>
    <string name="app_name">Temperature</string>
</resources>

以下為程式主要的檔案 :
Temperature.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package tw.edu.sinica.tiara.temperature;
 
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
 
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
 
public class Temperature extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        ImageView imgView = (ImageView)findViewById(R.id.ImageViewR937);
        Drawable drawable = ImageOperations("http://somewhere/monitoring/temp.jpg");
        imgView.setImageDrawable(drawable);
    }
 
    private Drawable ImageOperations(String url) {
		try {
			InputStream is = (InputStream) new URL(url).getContent();
			Drawable d = Drawable.createFromStream(is, "src name");
			return d;
		} catch (MalformedURLException e) {
			e.printStackTrace();
			return null;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
 
}

這樣算是勉強能用的程式. 這還需要在改進. 例如, 使用 Timer 定時讀溫度. 然後設定超過多少溫度顯示 Alert. 當然, 要弄個 Setting 介面讓使用者定義 interval & alert temperature. 之後, 在慢慢加入. 暫時先這樣!

 

Samsung i9000 HTC clock & weather

20 Aug


之前在使用 iPhone 的時候就很想要這個功能. HTC clock & weather widget. 很可惜 iPhone 沒有支援 widget. 上面的畫面是由 Samsung i9000 截圖.

上面的 HTC clock & weather 的 widget 名稱是 : Weather & Toggle Widget 一個 1.99 美金, 必須要有美國的 IP 才能購買. 當然購買前要先加入 Google Checkout 才能付款. 購買後要再下載 H7C Clock & H7C Weather 才能設定成上面美美的畫面. 然後再下載 Weather Widget Forecast Addon. 就可以看到天氣動畫. 可惜台灣平地不下雪.還真想看看雪的動畫.

 
No Comments

Posted in Android

 

ls 忽略某些檔案

17 Aug

# ls

Applications Documents Library Music Public
Desktop Downloads Movies Pictures Sites

# ls | grep -v Applications

Desktop
Documents
Downloads
Library
Movies
Music
Pictures
Public
Sites

 
No Comments

Posted in Linux

 

解決 Vim 在 ubuntu 的問題

12 Aug

使用 ubuntu 的 vi 當你在 insert 模式的時候, 方向鍵會失效. 解決方式如下 :

#vi ~/.vimrc
set nocompatible

加入”set nocompatible” 在 .vimrc 檔案. 就可以解決了.

 
No Comments

Posted in Linux

 

hdparm notes

29 Jul

# hdparm -t /dev/sdb1

/dev/sdb1:
Timing buffered disk reads: 750 MB in 3.01 seconds = 249.58 MB/sec

 
No Comments

Posted in Linux

 

Linux 檢查檔案系統的 block 大小

29 Jul

方法一 :
# echo “foo” > bar
# du -h bar

4.0K bar

方法二 :
# tune2fs -l /dev/sda1 | grep ‘Block size’

Block size: 4096

方法三 :
# dumpe2fs -h /dev/sda1 | grep ‘Block size’

dumpe2fs 1.39 (29-May-2006)
Block size: 4096

方法四 :
# blockdev –getbsz /dev/sda1

4096

 
No Comments

Posted in Linux

 

iozone notes

29 Jul

# iozone -a -i 0 -i 1 -f /xxx/xxx/iozone.test -q 64k -n 32M -g 1G > iozone.out
# Generate_Graphs iozone.out

 
No Comments

Posted in Linux

 

架設 FreeNX server

20 Jul

由於 NoMachine免費版本只能支援 2 個使用者. 在家用當然是足夠. 但是要給多人用就沒辦法了. 只好自己架設免費的 FreeNX server.

在安裝 FreeNX Server 前. 請記得安裝 expect.
# yum install expect

Loaded plugins: kernel-module
sl-base | 1.1 kB 00:00
sl-security | 1.9 kB 00:00
sl-security/primary_db | 1.8 MB 00:02
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
–> Running transaction check
—> Package expect.i386 0:5.43.0-5.1 set to be updated
—> Package expect.x86_64 0:5.43.0-5.1 set to be updated
–> Finished Dependency Resolution
Beginning Kernel Module Plugin
Finished Kernel Module Plugin

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
expect i386 5.43.0-5.1 sl-base 158 k
expect x86_64 5.43.0-5.1 sl-base 160 k

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 318 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): expect-5.43.0-5.1.i386.rpm | 158 kB 00:01
(2/2): expect-5.43.0-5.1.x86_64.rpm | 160 kB 00:00
——————————————————————————–
Total 153 kB/s | 318 kB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : expect 1/2
Installing : expect 2/2

Installed:
expect.i386 0:5.43.0-5.1 expect.x86_64 0:5.43.0-5.1

Complete!

之後就去下載 FreeNX 和 NoMachine Client 的套件(freenx-0.7.3-4.el5.centos.x86_64.rpm, nx-3.4.0-4.el5.centos.x86_64.rpm and nxclient-3.4.0-7.x86_64.rpm)然後安裝 :
# rpm -ivh freenx-0.7.3-4.el5.centos.x86_64.rpm nx-3.4.0-4.el5.centos.x86_64.rpm nxclient-3.4.0-7.x86_64.rpm

Preparing… ########################################### [100%]
1:nx ########################################### [ 33%]
2:freenx ########################################### [ 67%]
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
Starting freenx-server: [ OK ]

3:nxclient ########################################### [100%]
Showing file: /usr/NX/share/documents/client/cups-info

CUPS Printing Backend

The NX Client set-up procedure detected that your “IPP CUPS” printing
backend doesn’t allow printing from the NX session. In order to have
printing support in your NX system, you need to set proper permissions
on the IPP backend. Please execute:

chmod 755 /usr/lib/cups/backend/ipp

設定 NX server :
# nxsetup –install –setup-nomachine-key

Setting up /etc/nxserver …done
Setting up /var/lib/nxserver/db …done
Setting up /var/log/nxserver.log …done
Adding user “nx” to group “utmp” …done
Setting up known_hosts and authorized_keys2 …done
Setting up permissions …done
Setting up cups nxipp backend …done

—-> Testing your nxserver configuration …
(omit)
<---- done

----> Testing your nxserver connection …
HELLO NXSERVER – Version 3.2.0-73 OS (GPL, using backend: not detected)
<--- done

Ok, nxserver is ready.

PAM authentication enabled:
All users will be able to login with their normal passwords.

PAM authentication will be done through SSH.
Please ensure that SSHD on localhost accepts password authentication.

You can change this behaviour in the /etc/nxserver/node.conf file.
Have Fun!

複製 node.conf.sample 範本檔案到 node.conf :
# cp /etc/nxserver/node.conf.sample /etc/nxserver/node.conf

檢查 FreeNX Server 是否有執行 :
# nxserver –status

NX> 100 NXSERVER – Version 3.2.0-73 OS (GPL, using backend: not detected)
NX> 110 NX Server is running
NX> 999 Bye

將 /usr/bin/nxserver –start 指令放在 /etc/rc.local 內 機器每次開機都執行 FreeNX sever

 
No Comments

Posted in Linux