1.修改fields.ini
[ip]
widget:type=hidden
visibility:list=0
2.修改tablename.php -> class tables_tablename 加入
function beforeSave(&$record){
$record->setValue('ip', $_SERVER['REMOTE_ADDR']);
}
這個部落格僅作為個人工作上遇到的問題和解決方案紀錄,相關步驟未經完整驗證,不一定適用於您所遭遇的狀況,系統如有問題建議您諮詢專業人士,不要自行操作不熟悉的指令或動作,以免造成更嚴重的損害。文中所提各軟體屬各軟體所有權人所有,軟體之異常情形大多為本人操作錯誤所造成,並非軟體原始設計之問題,且大多數問題都在軟體版本更新後獲得解決,本人因所知有限未能即時更新相關資訊,謹此致歉。
星期二, 6月 30, 2009
Xataface-製作動態選單
在Xataface中設定動態選單(雙層選單)並不困難,這裡示範的是單一資料表方式,也可將第一層和第二層選單分開存在兩個資料表(areas)。
1.修改valuelists.ini
[cities]
__sql__ = "select city_id, name, province_id from areas order by city_id"
[provinces]
__sql__ = "select province_id,province_name from areas where SUBSTR(city_id,4,2)="00" order by province_id"
2.修改fields.ini
[province]
vocabulary=provinces
[city]
vocabulary=cities
3.修改應用程式目錄/tables/tablename.php
class tables_tablename {
http://xataface.com/wiki/index.php?-table=wiki&-action=browse&page_id=%3D90
} //End of class
| province_id | city_id | name |
| U01 | U0100 | province_1 |
| U01 | U0101 | city_1 |
| U01 | U0102 | city_2 |
| U02 | U0200 | province_2 |
| U02 | U0201 | city_3 |
| U02 | U0202 | city_4 |
1.修改valuelists.ini
[cities]
__sql__ = "select city_id, name, province_id from areas order by city_id"
[provinces]
__sql__ = "select province_id,province_name from areas where SUBSTR(city_id,4,2)="00" order by province_id"
2.修改fields.ini
[province]
vocabulary=provinces
[city]
vocabulary=cities
3.修改應用程式目錄/tables/tablename.php
class tables_tablename {
http://xataface.com/wiki/index.php?-table=wiki&-action=browse&page_id=%3D90
} //End of class
星期二, 4月 07, 2009
讓ubcd支援網路分享並從網路掛載dosapp
UBCD內建許多DOS系統工具,可以透過memdisk使用pxe開機的方式啟動。
本文介紹如何修改UBCD的fdubcd.img,讓它具備掛載網路分享的功能,使得pxe開機後可以透過網路執行UBCD中的眾多DOS工具(dosapps)。
本文介紹如何修改UBCD的fdubcd.img,讓它具備掛載網路分享的功能,使得pxe開機後可以透過網路執行UBCD中的眾多DOS工具(dosapps)。
- 解開dosubcd.igz得到fdubcd.img
- 掛載fdubcd.img
- 將fdubcd.img的內容與UBCD的dosappa複製到網路分享
- 從網路下載freedos的more.exe到網路分享\bin
- 從網路下載freedos的subst.exe到網路分享\bin
- 刪除level0/nwlan.cab、lib/odi16/、lib/nw*、lib/wget.cab
- 修改/etc/autoset.bat,設ramsz=50000
- 從fdmsrrc.igz的level3/msnet.cab複製到/level2、lib/Ngis到lib/Ngis、etc/_ms*複製到etc/
- 修改/etc/global.set,設定G_PROFILE=client
- 複製並修改/etc/profile/client.pro,設定P_USER=網芳帳號
- 複製並修改/etc/profile/client.bat,加入以下內容
- @net use r: \\share_server\diskimg
- @if exist r:\fdubcd\autoexec.bat set srcdrv=r:\fdubcd
- @if exist r:\fdubcd\autoexec.bat set _srcdrv=r:\fdubcd
- @inifile q:\net\wattcp.cfg [] my_ip=%ipaddr%
- @inifile q:\net\wattcp.cfg [] netmask=255.255.255.0
- @echo %ipaddr%|lmod /L1 /S. @set gateway=[$1].[$2].[$3].254 > %tmp%\_gate.bat
- @call %tmp%\_gate.bat
- @inifile q:\net\wattcp.cfg [] gateway=%gateway%
- @inifile q:\net\tcp.cfg [] my_ip=%ipaddr%
- @inifile q:\net\tcp.cfg [] netmask=255.255.255.0
- @inifile q:\net\tcp.cfg [] gateway=%gateway%
- 修改\autoexec.bat加入if %ubcdcmd%==xxapp inifile %ramdrv%\etc\profile\client.pro [ ] P_USER=xxuser,讓不同的dosapp使用不同的網芳帳號
星期四, 4月 02, 2009
簡化Gnome工作面板的選單
Gnome的工作面板選單分為 "應用程式、位置、系統" 雖然方便,但是如果螢幕不大就會太佔空間。如果要簡化可以在選單上按滑鼠右鍵選 "從面板移除" ,另外在面板上按滑鼠右鍵選 "加入面板" 並將 "主選單"加入面板。完成後如下圖
星期五, 1月 16, 2009
在GNU/Linux連MS SQL資料庫
1.安裝 tdsodbc、freetds-bin、libsybdb5、freetds-common、unixodbc
2.執行 TDSVER=8.0 tsql -H ser.ver.ip.1 -p 1433 -U username -P password (測試freetds,OK 出現 "1>" )
3.編輯 /etc/freetds.conf
[server_ts]
host = ser.ver.ip.1
port = 1433
tds version = 8.0
client charset = UTF-8
4.執行 tsql -S server_ts -U username -P password (測試 freetds.conf 設定)
5.編輯 /etc/odbcinst.ini (預設即可,記住[ms_sql]標簽)
[ms_sql]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
6.編輯 /etc/odbc.ini
[DSNname]
Description = test database
Driver = ms_sql -------------------------->odbcinst.ini中的標簽
Servername = server_ts ------------------>freetds.conf中的標簽
;Server = ser.ver.ip.1 ---------------->如不使用Servername就要使用Server和Port但中文有問題,在這指定client charset 沒有用
;Port = 1433
Database = databasename
7.執行 isql -v DSNname username password (測試odbc.ini設定,出現 "sql>" 即可)
8.如在odbc.ini中使用Servername方式不行而使用Server加Port方式可以,表示isql找不到freetds.conf
可能要執行 ln -s /etc/freetds.conf /usr/local/etc/freetds.conf
補充64位元版本
/etc/odbcinst.ini內改為
Driver64=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup64=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
2.執行 TDSVER=8.0 tsql -H ser.ver.ip.1 -p 1433 -U username -P password (測試freetds,OK 出現 "1>" )
3.編輯 /etc/freetds.conf
[server_ts]
host = ser.ver.ip.1
port = 1433
tds version = 8.0
client charset = UTF-8
4.執行 tsql -S server_ts -U username -P password (測試 freetds.conf 設定)
5.編輯 /etc/odbcinst.ini (預設即可,記住[ms_sql]標簽)
[ms_sql]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
6.編輯 /etc/odbc.ini
[DSNname]
Description = test database
Driver = ms_sql -------------------------->odbcinst.ini中的標簽
Servername = server_ts ------------------>freetds.conf中的標簽
;Server = ser.ver.ip.1 ---------------->如不使用Servername就要使用Server和Port但中文有問題,在這指定client charset 沒有用
;Port = 1433
Database = databasename
7.執行 isql -v DSNname username password (測試odbc.ini設定,出現 "sql>" 即可)
8.如在odbc.ini中使用Servername方式不行而使用Server加Port方式可以,表示isql找不到freetds.conf
可能要執行 ln -s /etc/freetds.conf /usr/local/etc/freetds.conf
補充64位元版本
/etc/odbcinst.ini內改為
Driver64=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup64=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
星期二, 6月 10, 2008
用GNU/Linux遠端管理MS Windows電腦
winexe是GNU/Linux下類似psexec的工具,可以讓被控端在不開啟telnet service或安裝sshd的情況下從遠端呼叫被控執行程式或取得被控端的command shell。
常用的執行範例如下
$ winexe --uninstall --reinstall --interactive=1 --system -U administrator //pc001 cmd
--uninstall Uninstall winexe service after
remote execution
--reinstall Reinstall winexe service before
remote execution
--system Use SYSTEM account
--runas=[DOMAIN\]USERNAME%PASSWORD Run as user (BEWARE: password is
sent in cleartext over net)
--interactive=INT Desktop interaction: 0 -
disallow, 1 - allow. If you
allow use also --system switch
(Win requirement). Vista do not
support this option.
常用的執行範例如下
$ winexe --uninstall --reinstall --interactive=1 --system -U administrator //pc001 cmd
--uninstall Uninstall winexe service after
remote execution
--reinstall Reinstall winexe service before
remote execution
--system Use SYSTEM account
--runas=[DOMAIN\]USERNAME%PASSWORD Run as user (BEWARE: password is
sent in cleartext over net)
--interactive=INT Desktop interaction: 0 -
disallow, 1 - allow. If you
allow use also --system switch
(Win requirement). Vista do not
support this option.
星期三, 6月 04, 2008
用debootstrap安裝系統
1.準備並掛載根目錄
mkdir /new_root
mount /dev/new_partition /new_root
mkdir /new_root/dev
mount --bind /dev /new_root/dev
mkdir /new_root/proc
mount -t proc proc /new_root/proc
mkdir /new_root/sys
mount -t sysfs sys /new_root/sys
2.安裝基礎系統
sudo apt-get install debootstrap
debootstrap dapper /new_root
cp /etc/apt/sources.list /new_root/etc/apt
cp /etc/resolv.conf /new_root/etc
cp /etc/hosts /new_root/etc
cp -a /etc/network* /new_root/etc
3.chroot到new_root繼續安裝
sudo chroot /new_root
apt-get update
apt-get install ubuntu-base linux-386 ubuntu-desktop dmraid grub
4.安裝GRUB
mkdir /boot/grub
cp /lib/grub/i386-pc/stage1 /boot/grub/
cp /lib/grub/i386-pc/stage2 /boot/grub/
grub
device (hd0) /dev/new_disk
root (hd0,0)
setup (hd0)
quit
update-grub
5.檢查並修改設定
vi /boot/grub/menu.lst
vi /etc/fstab
mkdir /new_root
mount /dev/new_partition /new_root
mkdir /new_root/dev
mount --bind /dev /new_root/dev
mkdir /new_root/proc
mount -t proc proc /new_root/proc
mkdir /new_root/sys
mount -t sysfs sys /new_root/sys
2.安裝基礎系統
sudo apt-get install debootstrap
debootstrap dapper /new_root
cp /etc/apt/sources.list /new_root/etc/apt
cp /etc/resolv.conf /new_root/etc
cp /etc/hosts /new_root/etc
cp -a /etc/network* /new_root/etc
3.chroot到new_root繼續安裝
sudo chroot /new_root
apt-get update
apt-get install ubuntu-base linux-386 ubuntu-desktop dmraid grub
4.安裝GRUB
mkdir /boot/grub
cp /lib/grub/i386-pc/stage1 /boot/grub/
cp /lib/grub/i386-pc/stage2 /boot/grub/
grub
device (hd0) /dev/new_disk
root (hd0,0)
setup (hd0)
quit
update-grub
5.檢查並修改設定
vi /boot/grub/menu.lst
vi /etc/fstab
訂閱:
文章 (Atom)