2010年12月8日 星期三

解讀 Drupal 的 hook_menu()

假若  
$items['mypath/%objectA'] = array( ... 

需要實作
function objectA_load() { return $object;}

page callback 就能取得完整 object 或是 array,而非只是 id

參考這篇
Anatomy of hook_menu

2010年12月5日 星期日

使用 php 產生 /etc/shadow 的 hashed password

/etc/shadow 格式
http://www.linux.org.tw/CLDP/HOWTO/admin/Shadow-Password-HOWTO/Shadow-Password-HOWTO-2.html

<?php
// MD5
echo crypt($_GET['password'], '$1$');

2010年12月2日 星期四

SONY VAIO TZ37 無法開啟無線網路。Wireless Keeps turning itself off.



手動把硬體的 wireless/bluetooth 開關設成 off,然後 on,接著就無法使用 wlan,機殼上的 wlan 的燈沒亮,無法使用 VAIO 所附的 wireless switch software 去設定 wlan (只顯示藍芽的部分),而裝置管理員看到的 wlan 網卡又似乎很正常。重灌 intel wlan driver 也沒用。


據 SONY 光華維修中心的工程師說,bluetooth 及 wireless 的狀態,有被記錄在 CMOS 上面,但從 BIOS 又無法設定 on/off,他們猜測是我的系統有問題,以致於進系統後,wireless 又被設成 off。他們搞很久還是無法修復我的 VAIO,建議我重灌 XP。當下接上另一台 TZ37 的硬碟,wireless 卻很正常,最後,唯一能確定的是硬體方面沒問題。


後來回家,在 google 查到以下的方法,確實可行,在此留下記錄,希望可以幫到大家。


- turn the wireless and bluetooth on by the hardware switch or button or Fn+
- close the wireless switch software ( the wireless icon on the windows bar )
- hibernate the laptop (休眠)
- take off the laptop battery and take the power cable off (取下電源線及電池)
- wait for around 1 min. (等待一分鐘)
- turn the hardware switch to on- put everything back in place and start the laptop, you should be able to see the wireless working now. (打開無線網路的硬體開關,接上電源)
- make sure the bluetooth and wireless are working
- go to control panel and uninstall the wireless switch software
- restart you laptop and everything should be working fire and smooth now.


http://www.wirelessforums.org/troubleshooting/sony-vaio-wireless-network-connection-problems-52551.html


結論是,不要安裝 wireless switch software。我現在用硬體開關切換,一切正常。

2010年12月1日 星期三

Compiling with GCC on low memory

 
# 8MB for min heapsize 
CFLAGS="$CFLAGS --param ggc-min-expand=0 --param ggc-min-heapsize=8192" 

Compiling with GCC on low memory VPS

2010年11月30日 星期二

2010年10月21日 星期四

2010年9月7日 星期二

Drupal 用 php 讀取欄位 (CCK) 屬性

<?php

$node_type = 'page';
$cck_video_field = content_fields('field_video', $node_type);
// content_fields( ) in cck/content.module

2010年8月14日 星期六

於下次重開機時,自動執行 fsck

方法一:
# touch /forcefsck
# reboot

方法二:
# shutdown -rF now

2010年8月13日 星期五

sed & awk 的用法

http://www.delightpress.com.tw/bookRead/skns00004_read.pdf

windows 要使用 awk, sed 的話,請下載
http://sourceforge.net/projects/unxutils/
可把 \usr\local\wbin 目錄設定到 PATH

2010年8月11日 星期三