Wednesday, 11 August 2010

make bootable CD in win32

Usually we use mkisofs to make bootable CD in Linux. There is also mkisofs win32 package :

http://www.student.tugraz.at/thomas.plank/index_en.html

Download 3 zip files, save into d:\cdrtools folder and uncompress all files.
- cdrtools-xxx-win32-bin.zip
- dlls.zip
- DLL version 1.7.5

I use grub4DOS as boot loader, download it at http://sourceforge.net/projects/grub4dos/files/
Get the grub4dos-0.4.4.zip and uncompress. I will save the zip file into d:\grub4dos folder.

At DOS console, type

D:\cdrtools>copy d:\grub4dos\grlder
D:\cdrtools>mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso .
Setting input-charset to 'UTF-8' from locale.
mkisofs: './grldr.iso' is the archive. Not dumped.
Size of boot image is 4 sectors -> No emulation
Total translation table size: 2048
Total rockridge attributes bytes: 5027
Total directory bytes: 6144
Path table size(bytes): 34
Max brk space used 30000
4910 extents written (9 MB)

Caution : The last character of mkisofs command IS "."

Output file is grldr.iso. Burn the grldr.iso file into CD. Finished.

Monday, 2 August 2010

Debian 5 Lenny NFS

Just setup a NFS server on Debian Lenny, then mount the nfs folder and got error message :

support@client03:~$ sudo mount -t nfs 192.168.0.9:/media/HD /media/iso
mount.nfs: 192.168.0.9:/media/HD failed, reason given by server: Permission denied

Usually the problem is file /etc/exports, /etc/hosts.allow and /etc/hosts.deny

For file /etc/exports, usually many people say I can do like this to share the folder for while subnet :
/media/HD 192.168.0.0/24 (ro)

But it doesn't work.

In Debian Lenny, I have to make it as below. It solved the "Permission denied" problem.
/media/HD 192.168.0.0/255.255.255.0 (ro)

Saturday, 24 July 2010

校園O嘴事件簿 - 作者華容道



這書是說有關於校園內外發生事情, 主⻆大多是學生。 家長們只能在家內觀察自己子女,在家外便一無所知。讀過這書, 或多或少可了解時下學生行為和心態, 家長們亦可多些了解自己子女。

作者華容道是我舊同學, 他第一次出書, 期代有第二集、第三集、....第N集。

Thursday, 22 July 2010

由繁體中文 utf8 檔案轉為簡體中文 utf8 檔案

由 繁體中文 utf8 -> BIG5 ->GB -> 簡體中文 utf8
$ iconv -f utf8 -t big5 note.tw.utf8 > note.big5
$ iconv -f big5 -t gb2312 note.big5 > note.gb
$ iconv -f gb2312 -t utf8 note.gb > note.cn.utf8

可用pipe簡化 為一 command :
$ iconv -f utf8 -t big5 note.tw.utf8 | \
> iconv -f big5 -t gb2312 | \
> iconv -f gb2312 -t utf8 > note.cn.utf8

參考 :
http://samuelololol.blogspot.com/2009/11/mplayer-iconv.html


最簡單方法 :
$ cconv -f UTF8-TW -t UTF8-CN note.tw.utf8

cconv 是很新的程式, 但很好用,希望它繼續發展, 令翻譯工作更加方便。

它的homepage :
http://code.google.com/p/cconv/

Friday, 9 July 2010

Joomla SEO (二) : 404

網頁顯示404有很多原因, 例如輸入錯誤網址。

有二種方法解決Joomla 404 問題 :
1. 安裝 extension
2. 改 Joomla code

1. Joomla extension :
http://extensions.joomla.org/extensions/site-management/sef
這些 extension 是幫助你的site在SEO 做得更好, 解決404是功能之一。

各extension比較, 一目了然 :
http://www.alledia.com/blog/seo/joomla-15-seo-extension-comparison/

最有名是 sh404SEF, 但是收費的。

2. 改 Joomla code

其實網頁顯示404都有二種error message :
I.
中間紅色box 和顯示404 - Component not found

II.
Not Found
The requested URL /xxx was not found on this server.

這是Joomla official tutorial
http://docs.joomla.org/Tutorial:Create_a_Custom_404_Error_Page

如果看不明, 可以跟我方法, 我是用JA_Puity template

解決 I) 問題 :
1. 複製檔案 由 /templates/system/error.php 去 /templates/ja_purity/error.php
2. 修改檔案 error.php :

在這行之下(約第14行)
defined( '_JEXEC' ) or die( 'Restricted access' );
加入

if (($this->error->code) == '404') {
header('Location: index.php');
exit;
}

儲存


解決 II) 問題 :
在website目錄最上層新加檔案 .htaccess

.htaccess 內容 :
ErrorDocument 404 /index.php


完成後每次user打錯網址, 都會自動轉到首頁。

Wednesday, 7 July 2010

Joomla SEO : 改 page title

幫朋友做完了website, backend 是Joomla v1.5。 現在要優化它, 第一步要做就是Search Engine Optimization,SEO, 這 topic 一直很hit。

我要每一page title 都加上公司名稱, (即在browser最頂那一行) ,這功能對於 SEO 是重要的。但不知可解, 在Joomla就是沒有項功能。

通常有二種方法解決Joomla 問題 :
1. 安裝 extension (component/plugins)
2. 改 Joomla code

1. 安裝 extension 是最快捷方法, 功能多, 而且一定成功。在 Joomla Extension -> Site Management->SEO &Metadata, 有很多好用的extension :
http://extensions.joomla.org/extensions/site-management/seo-a-metadata

如只想改page title , 可以選擇 :
Title Manager Plugin
http://extensions.joomla.org/extensions/site-management/seo-a-metadata/3521

Website Name PluginLanguage
http://extensions.joomla.org/extensions/site-management/seo-a-metadata/3352

從安裝到完成, 不須五分鐘。


2. 改 Joomla code是很麻煩的, 又不一定成功。

這是英文教學 :
http://www.howtojoomla.net/2008060586/how-tos/templates/how-to-display-your-page-title-in-your-template-joomla-15

這是中文教學 :
http://www.hksilicon.com/kb/articles/648/1/Joomla-15----lttitlegt/Page1.html

但他們方法都有一個小問題, 是發生在 home page上, 如果你的公司名稱是"美好公司" , 而在front page又設定顯示"美好公司", home page title 會顯示 :

美好公司 - 美好公司


解決方法很簡單, 這是我的 code :


<?php

$mydoc =& JFactory::getDocument();
$mytitle = $mydoc->getTitle();

$conf =& JFactory::getConfig();
$sitename = $conf->getValue('config.sitename'); // get site name

if ($mytitle == $sitename) // check same title and sitename
$mydoc->setTitle($sitename);
else
$mydoc->setTitle($mytitle.' - '.$sitename);

?>

Tuesday, 18 May 2010

Joomla : QContacts 繁體中文 language pack

Joomla 內的 contact module 基本上是好用的, 但中文化後有點問題, 所以要轉用其他 module。 我選擇了 QContacts。 在 QContacts official site 只簡體中文 language pack, 沒有繁體中文(或稱正體中文, traditional chinese),我把簡體language pack轉為繁體,QContacts 版本是v1.06, 你們可在這裡下載, :

http://www.4shared.com/file/69DDSXWw/zh-tw_com_qcontacts_site.html

下載後請留言, 謝謝。