some mysql tips

  • mysql 的 innodb 重裝或改了 innodb_log_file_size 後, 發現 xxx/yyy.frm 壞了 , 解決辦法是 把 /var/lib/mysql/ib_logfile* 砍了, 再 restart mysql
  • http://dev.mysql.com/doc/refman/5.1/en/alter-table.html 中提到….
    若要大量 bluk 作 insert 動作前, 下 ALTER TABLE tbl_name DISABLE KEYS , 這樣可以讓 insert 加快,

    但是作完 insert 後還是得 enable keys , 把 missing 的 indexs 補回來, 我想這時也是非常耗時間吧!!

    另外 enable / disable keys 對於 mysql 5.1.1 以前的 partition table 沒有用

那一年的 Christmas ….

URL : http://en.wikipedia.org/wiki/Do_They_Know_It%27s_Christmas%3F

1984年由 Bob Geldof 及 Midge Ure 寫了這一首 “Do They Know It’s Christmas?” 並由英國最有名的樂團/歌手組成 Band Aid 灌錄單曲, 這是我認為最讚的耶誕歌曲之一, 25年了這旋律還是那麼熟悉.

Do They Know It’s Christmas? : http://www.youtube.com/watch?v=8jEnTSQStGE

3948828256cb68be2170651de9a43a98

哇! 看到 … Phil Collins, Culture Club (Boy George) ,  Paul Young , Sting (U2) , Paul McCartney , David Bowie , Duran Duran , Bananarama , George Michael (Wham), 神奇的是我還記得他們的名字.

這是另 hardcore 版本的”Do They Know It’s Christmas?” , 其中的電吉他旋律是最讚的部份!
http://yccmcb.blogspot.com/2009/12/do-they-know-its-christmas.html

2009.1223 memories

P018

昨天趁空擋爸爸帶我們三個去吃小時候吃過的肉圓, 那是傳統市場用蒸的現作肉圓, 很好吃, 我們重溫了小時的記憶, 但心情也 down 了一下, 畢竟這次在家鄉聚在一起的原因並不好.

CodeIgniter MVC CRUD + memcache = Secret Message http://msg.monster.com.tw

這個 idea 是來自這個網站 : https://privnote.com/ , 簡單的說它是一個經由 https 保護傳送內容的網路服務 , user 用這個服務把臨時要給朋友的機密/私人資料譬如 password / URL 之類的 data 存放在這網站上, 然後此系統會給 user 一個唯一網址, 再把這網址給朋友, 開啟這個唯一網址後, 就可以看到這個訊息, 系統同時會把這訊息從系統中刪除… 哈哈! 看懂了嗎?

我的改進是用 memcache 的 expire 機制, 設定 10分鐘後, 若 user 沒讀過此訊息, 訊息會 ‘自動’ 銷毀… 我的站若再去申請 ssl 加密的話就跟那個站功能是類似的了.

codeigniter 的 MVC 架構, 讓我很快的把這個 idea implement 出來了 , 基本上就是一個簡單版的 CRUD

我的 Secret Message 服務長像非常的陽春 😛 , 僅用簡單的 HTML , 若有空再加上 style 美化一下版面, 不過基本功能是有的了, 大家用看看, 有 idea 或意見請再告訴我.

目前 message 不提供 HTML / VBB , 但是有簡單的 skype 版表情符號 ( icon 正在慢慢搜集中 ) ….

Secret Message 網址是: http://msg.monster.com.tw/

 

dc34889242b1d25e1f4c4d477e85c96c

4185a388c19629704edc284514c6cfe5

CI 表情符號改寫例:

0fe1a40bfd47887c51ed60fc2af4a3a0

3a21610697fc7f7b5983a1358a9f7713d5617ad16b86596c9c44642a08193875

[monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting

昨天晚上去一位朋友公司幫忙用他們的 server , 回來就想要做幾件事:

1. 記錄一下自己的 server 某些重要檔案, 也可供其他人參考

2. 備份重要 file

3. 隨時準備好最新版的救援CD/Live CD/Live USB , 最新版的 Monster LAMP pack 也要燒好收著.

4. 準備一個 “萬用” 含各類 driver 的 linux kernel , 以供救援使用.

5. 搞懂 booting steps / GRUB setting


a93c35eaf5a0019c7f7a42f461dae3de

root@park:~# cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#              

proc            /proc           proc    defaults        0       0
# / was on /dev/sda1 during installation
UUID=46312252-8925-4e60-ab5f-af240b4b440f /               ext3    relatime,errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=bf9a64f1-3eb8-433c-8311-8d971be82dc2 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

service / daemon 管理工具

sysv-rc-conf text based utility :

sudo apt-get install sysv-rc-conf

另一套 GUI

sudo apt-get install gnome-system-tools gdm

monster.tw 是裝這個 apt-get install rcconf

列出 runlevels 的 program : chkconfig

裝 圖形介面 / GUI / gnome desktop

sudo apt-get install ubuntu-desktop --no-install-recommends

啟動 desktop manager :

/etc/init.d/gdm start

stop x server / 關掉 x window: /etc/init.d/gdm stop

改 IP address

cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 172.30.0.42
        netmask 255.255.255.0
        network 172.30.0.0
        broadcast 172.30.0.255
        gateway 172.30.0.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8
        dns-search monster.tw

重新啟動 networking
/etc/init.d/networking restart

若要使用 DHCP 的話

auto eth0
iface eth0 inet dhcp

加上 default route

gateway 1.2.3.4

或另一個 static route

up route add -net 1.2.3.0 netmask 255.255.255.0 gw 1.2.3.4

change host name:

改 /etc/hostname
改 /etc/hosts

若是用 vmware 之類的軟體導致 clone 出來的 ubuntu 網路 interface 跑掉, 可以砍掉 
/etc/udev/rules.d/70-persistent-net.rules
後 reboot , 就可以解決了.

debian / ubuntu 裝 memcached 跟 pecl memcache

裝 memcached :

apt-get install memcached

/etc/default/memcached 裡面設 yes –> 啟用 設定檔 /etc/memcached.conf

裝 php5 的 memcache extension

apt-get install php5-memcache

會產生 /etc/php5/conf.d/memcache.ini 內容是

extension=memcache.so

[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0

—– 以下是舊的方法, 2010.0630 前

裝 pecl memcache

aptitude install libevent-dev

因為 pecl 要用到 phpize , 所以要裝 php5-dev 套件

apt-get install php5-dev

apt-get install php-pear

pecl install memcache

裝好了, 要在 /etc/php5/conf.d 設一個檔 memcache.ini

cat > /etc/php5/conf.d/memcache.ini
extension=memcache.so