Compunotes

There's no magic, it's all about reasons.

廣達研究院在 OSDC 上舉辦的程式競賽

去年廣達研究院在 OSDC 上舉辦了一場程式競賽, 結果本來是供佈在他們官方的粉絲頁, 不過好像被刪掉了, 所以在這裡借用版面和大家分享。

以下引用 Google 搜尋引擎的備份資料:

首先讓我們重溫戰帖內容:
Sn={0, 1, 8, 11, 69, 88, 96, 101, 111, 181,…},10秒內儘可能印出Sn數列,印出完全正確且最多者獲勝。

緊接著公佈競賽前三名得主:
狀元 bigcat (miaout17)
榜眼 kcwu
探花 tkcn

主辦單位已獲得前三名得主同意,以下公佈狀元、榜眼、探花的原始碼,讓參賽的大家可以觀摩學習。
bigcat(miaout17) http://goo.gl/oulSg

kcwu http://goo.gl/3uhRB

tkcn http://goo.gl/oVdTu

冠軍的獎品(Kindle Fire壹台)將在8月的最後一周以快遞寄出,參加獎亦會同時以掛號小包寄出。

感謝各位參加廣達研究院本次的Coding比賽,若有任何疑問都歡迎與我們聯繫 quantaresearch@quantatw.com

前三名的 source code 如下:

bigcat

kcwu

tkcn

Windows Photo Viewer Mouse Plug-in

This simple tool gives Windows Photo Viewer the following features:

  1. Middle click to toggle window’s size between normal and maximum.
  2. Scroll up/down to show previous/next image.
  3. Ctrl + scroll up/down to zoom in/out.
  4. A to show actual size.
  5. F to show fit size.
  6. Ctrl + A to toggle deafult presenting style between actual size and fit size.

Download

在 Ubuntu 12.10 的 Gcin 輸入法平台安裝嘸蝦米輸入法

步驟 1:安裝 gcin 及 im-switch

1
sudo apt-get install gcin im-switch

步驟 2:指定預設輸入法平台為 gcin,完成後重新啟動電腦

1
sudo im-switch

步驟 3:下載並解壓縮嘸蝦米官方提供的 gcin 用表格,接著開啟終端機並進入解壓縮目錄

步驟 4:將表格等檔案複製到系統中

1. 前置作業

1
sudo updatedb

2. 複製 *.gtab 到 gcin 表格目錄

a. 尋找 gcin 內建表格所在目錄
1
locate gtab | grep gcin/table | while read line; do dirname "$line"; done | sort | uniq
b. 開始複製
1
sudo cp *.gtab ${上一步的結果}

如:

1
sudo cp *.gtab /usr/lib/gcin/table

3. 複製 *.png 到 gcin icon 目錄

a. 尋找 gcin 內建 icon 所在目錄
1
locate pinyin.png | grep gcin | while read line; do dirname "$line"; done | sort | uniq
b. 開始複製
1
2
3
sudo cp *.png ${上一步的結果}
k
如:

sh sudo cp *.png /usr/share/icons/gcin

1
### 步驟 5:編輯 gtab.list

sh echo “嘸蝦米(繁) 1 boshiamy-t.gtab boshiamy-t.png” >> ~/.gcin/gtab.list “`

步驟 6:重新啟動 gcin

步驟 7:調整 gcin 設定

1. 在【內定輸入法 & 開啟/關閉】中調整嘸蝦米是否為預設輸入法、可否由 ctrl + shift 切換

2. 在【倉頡/行列/嘸蝦米/大易設定】中將【預覽/預選 字】調整為【全部開啟】

Installation Steps of Beyond Compare on Kubuntu 12.10 (KDE 4.9)

The below are the steps of installing Beyond Compare with context menu in Dolphin (KDE’s default file manager).

Step 1: Download the deb file from Beyond Compare official site

Step 2: Install it by:

1
sudo dpkg -i BEYOND_COMPARE_INSTALLER.DEB

Step 3: Create the specific directory to store the context menu settings

1
mkdir -p ~/.kde/share/kde4/services/ServiceMenus

Step 4: Install the context menu

1
/usr/lib32/beyondcompare/kde_context_menu

Installation Steps of Octopress on Ubuntu 12.10

Due to some reasons, we need to remove existing Ruby(s) and reinstall Ruby 1.9.3 before we installing Octopress.

Step 1: Remove the existing Ruby(s)

1
sudo apt-get autoremove ruby1.8 ruby1.9.1

Step 2: Install Ruby 1.9.3

1
curl -L https://get.rvm.io | bash -s stable --ruby

Step 3: Now we can follow the official guides

Syncing Samba Accounts With Unix Login Accounts

How to add a samba user and setup his password? Many answers on internet said that it should set by the below command:

1
smbpasswd –a <username>

Actually, there’s a library for setting it up with the same username and password of any loggable user. Just install it, and it’ll take effect.

libpam-smbpass

pluggable authentication module for SMB/CIFS password database

This is a stackable PAM module that allows a system administrator to easily migrate to using encrypted passwords for Samba and to keep smb passwords in sync with unix passwords. Unlike other solutions, it does this without requiring users to change their existing passwords or login to Samba using cleartext passwords.