November 2008 Archives

From: VMware Communities

if you want to automate your backups in a script, you can suspend and restart your virtual machines using this sort of command

vmrun -T server -h https://:8333/sdk -u -p suspend "[standard] "

replace with the IP or name of the host server
replace and with the username/password you login to the VMWare remote console with
replace with the folder and filename of the .VMX file of the virtual machine you want to suspend. eg. if you have the virtual machine stored at "C:\Virtual Machines\WinXP\WinXP.vmx" then this parameter should be "WinXP\WinXP.vmx", presuming that "c:\Virtual Machines" is the path to your data store.

Replace 'suspend' with 'start' to restart the machine after the backup.

Spring Framework using RAD7

| No TrackBacks

Reference from: Developing a Spring Framework MVC application step-by-step


If you want to use Spring in Rational Application Developer v.7, follow below steps.
1.Create A EAR project to contain Spring web project.
2.Create A Dynamic Web Project, add to an EAR. In Project Facets, adds support for Struts to your project.
3.Copy spring.jar (from spring-framework-2.5/dist), spring-webmvc.jar (from spring-framework-2.5/dist/modules) and commons-logging.jar (from spring-framework-2.5/lib/jakarta-commons) to the '/WEB-INF/lib'.
4.In project properties -> Java Build Path -> Libraries, Add Step 3 those jar files using Add External JARs.
5.Open Web Deployment Descriptor, add a servlet, check Use existing Servlet class, Browse. Type DispatcherServlet, select that in springframework package. Name: springapp, modify URL Mapping from /DispatcherServlet to *.htm, Finish.
6.Create /WEB-INF/springapp-servlet.xml, like below.

<beans xmlns="http://www.springframework.org/schema/beans">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- the application context definition for the springapp DispatcherServlet -->
<bean name="/hello.htm" class="springapp.web.HelloController">
</bean></beans>
7.Create the Controller, HelloController.
8.Write a test for the Controller, HelloControllerTests. To test the Controller, HelloController.
9.Create the View, hello.jsp.
10.Click Add and Remove Projects, add EAR to WAS server.
11.Open Browser, http://localhost:9080/Spring/hello.htm. You will see the hello.jsp content.

線上英漢字典 Bookmarklet

| 3 Comments | No TrackBacks

之前分享使用FireFox書籤來即時翻譯網頁
而單字翻譯,Google toolbar仍有其不足,故寫了個小小Bookmarklet,線上英漢字典,將網頁文字圈選,即可利用http://cdict.net/來查詢此單字。
請將下列Bookmarklet置換那http://cdict.net/的Bookmark。

javascript:(function(){d=document;w=window;S=w.getSelection();U="http://cdict.net/"+S;if(S!=""){w.open(U,"%E7%B7%9A%E4%B8%8A%E8%8B%B1%E6%96%87%E5%AD%97%E5%85%B8","width=600,height=500,location,status,scrollbars,resizable,dependent=yes");}else{w.alert("%E8%AB%8B%E9%81%B8%E6%93%87%E6%96%87%E5%AD%97%EF%BC%81%EF%BC%81");}})()

參考來源:Bookmarklet 的小技巧

Ubuntu Disk management

| 2 Comments | No TrackBacks

1.Fdisk /dev/xxx
2.mkfs.XXXXX /dev/xxx
3.mount /dev/xxx /home/xxx
4.Modify /etc/fstab, type "sudo vol_id /dev/sdb1" to get device uid.

Apt & dpkg

| No TrackBacks

From Apt和dpkg快速參考
apt-cache search # ------(package 搜索包)
apt-cache show #------(package 獲取包的相關信息,如說明、大小、版本等)
sudo apt-get install # ------(package 安裝包)
sudo apt-get install # -----(package - - reinstall 重新安裝包)
sudo apt-get -f install # -----(強制安裝?#"-f = --fix-missing"當是修復安裝吧...)
sudo apt-get remove #-----(package 刪除包)
sudo apt-get remove - - purge # ------(package 刪除包,包括刪除配置文件等)
sudo apt-get autoremove --purge # ----(package 刪除包及其依賴的軟體包+配置文件等(只對6.10有效,強烈推薦))
sudo apt-get update #------更新源
sudo apt-get upgrade #------更新已安裝的包
sudo apt-get dist-upgrade # ---------升級系統
sudo apt-get dselect-upgrade #------使用 dselect 升級
apt-cache depends #-------(package 了解使用依賴)
apt-cache rdepends # ------(package 了解某個具體的依賴?#當是查看該包被哪些包依賴吧...)
sudo apt-get build-dep # ------(package 安裝相關的編譯環境)
apt-get source #------(package 下載該包的源代碼)
sudo apt-get clean && sudo apt-get autoclean # --------清理下載文件的存檔 && 只清理過時的包
sudo apt-get check #-------檢查是否有損壞的依賴


apt-get install
下載 以及所有倚賴的包裹,同時進行包裹的安裝或升級。如果某個包裹被設置了 hold (停止標誌,就會被擱在一邊(即不會被升級)。更多 hold 細節請看下面。

apt-get remove [--purge]
移除 以及任何倚賴這個包裹的其它包裹。
--purge 指明這個包裹應該被完全清除 (purged) ,更多信息請看 dpkg -P。

apt-get update
升級來自 Debian 鏡像的包裹列表,如果你想安裝當天的任何軟體,至少每天運行一次,而且每次修改了
/etc/apt/sources.list 后,必須執行。

apt-get upgrade [-u]
升級所以已經安裝的包裹為最新可用版本。不會安裝新的或移除老的包裹。如果一個包改變了倚賴關係而需要安裝一個新的包裹,那麼它將不會被升級,而是標誌為 hold。apt-get update 不會升級被標誌為 hold 的包裹 (這個也就是 hold 的意思)。請看下文如何手動設置包裹為 hold。我建議同時使用 '-u' 選項,因為這樣你就能看到哪些包裹將會被升級。

apt-get dist-upgrade [-u]
和 apt-get upgrade 類似,除了 dist-upgrade 會安裝和移除包裹來滿足倚賴關係。因此具有一定的危險性。

apt-cache search
搜索滿足 的包裹和描述。

apt-cache show
顯示 的完整的描述。

apt-cache showpkg
顯示 許多細節,以及和其它包裹的關係。

dselect
console-apt
aptitude
gnome-apt
APT 的幾個圖形前端(其中一些在使用前得先安裝)。這裡 dselect 無疑是最強大的,也是最古老,最難駕馭。

普通 Dpkg 用法
dpkg -i
安裝一個 Debian 包裹文件,如你手動下載的文件。

dpkg -c
列出 的內容。

dpkg -I
從 中提取包裹信息。

dpkg -r
移除一個已安裝的包裹。

dpkg -P
完全清除一個已安裝的包裹。和 remove 不同的是,remove 只是刪掉數據和可執行文件,purge 另外還刪除所有的配製文件。

dpkg -L
列出 安裝的所有文件清單。同時請看 dpkg -c 來檢查一個 .deb 文件的內容。

dpkg -s
顯示已安裝包裹的信息。同時請看 apt-cache 顯示 Debian 存檔中的包裹信息,以及 dpkg -I 來顯示從一個 .deb 文件中提取的包裹信息。

dpkg-reconfigure
重新配製一個已經安裝的包裹,如果它使用的是 debconf (debconf 為包裹安裝提供了一個統一的配製界面)。你能夠重新配製 debconf 它本身,如你想改變它的前端或提問的優先權。例如,重新配製 debconf,使用一個 dialog 前端,簡單運行:

dpkg-reconfigure --frontend=dialog debconf (如果你安裝時選錯了,這裡可以改回來喲:)

echo " hold" | dpkg --set-selections
設置 的狀態為 hlod (命令行方式)

dpkg --get-selections ""
取的 的當前狀態 (命令行方式)

支持通配符,如:
Debian:~# dpkg --get-selections *wine*
libwine hold
libwine-alsa hold
libwine-arts hold
libwine-dev hold
libwine-nas hold
libwine-print hold
libwine-twain hold
wine hold
wine+ hold
wine-doc hold
wine-utils hold

例如:
大家現在用的都是 gaim-0.58 + QQ-plugin,為了防止 gaim 被升級,我們可以採用如下方法:

方法一:
Debian:~# echo "gaim hold" | dpkg --set-selections
然後用下面命令檢查一下:
Debian:~# dpkg --get-selections "gaim"
gaim hold
現在的狀態標誌是 hold,就不能被升級了。

如果想恢復怎麼辦呢?
Debian:~# echo "gaim install" | dpkg --set-selections
Debian:~# dpkg --get-selections "gaim"
gaim install
這時狀態標誌又被重置為 install,可以繼續升級了。

同志們會問,哪個這些狀態標誌都寫在哪個文件中呢?
在 /var/lib/dpkg/status 里,你也可以通過修改這個文件實現 hold。

有時你會發現有的軟體狀態標誌是 purge,不要奇怪。
如:事先已經安裝了 amsn,然後把它卸了。
apt-get remove --purge amsn
那麼狀態標誌就從 install 變成 purge。

方法二:
在/etc/apt 下手動建一個 preferences 文件
內容:
Package: gaim
Pin: version 0.58*
保存

dpkg -S
在包裹資料庫中查找 ,並告訴你哪個包裹包含了這個文件。(注:查找的是事先已經安裝的包裹)

CVS Configuration on Ubuntu

| No TrackBacks

1.sudo apt-get install cvsd
2.cancel the setup screen.
3.The default cvsd work directory is /var/lib/cvsd. If want to change, use cvsd-buildroot /home/cvs. Then modify /etc/cvsd/cvsd.conf, find RootJail, change /var/lib/cvsd to /home/cvs.
4. The /var/lib/cvs is default repository. If want to create a new repository, use cvs -d /home/cvs/cvsroot init. Then modify /etc/cvsd/cvsd.conf, find Repos, change /xxxxx to /cvsroot.
5. Restart cvsd.
6. Add New repository, cvs -d /home/cvs/newproject init

Extended Reading Secure CVS Pserver Mini-HOWTO

轉碼工具 convmv

| No TrackBacks

convnv --list 列出支援那些編碼。
convmv -f big5 -t utf8 xxxx 將xxxx從big5轉成utf8。
convnv -r -f big5 -t utf8 [dir] 將dri目錄所有檔案從big5轉成utf8。
上述皆不會真正變更只是測試,需加上--notest才會執行。
convnv -r -f big5 -t utf8 --notest [dir]
另外如判斷錯誤,加上--nosmart則強迫皆轉換。

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Archives

Powered by Movable Type 4.34-en

Recent Comments

  • panandy: 3Q read more
  • Anonymous: philipz大 沒有邀請碼,無法註冊,致無法下載工具 請問有何方法可以解決? 感恩 read more
  • philipz: harushard, It is your java code problem. Check it and read more
  • harushard: java.lang.NoClassDefFoundError: Could not initialize class examples.ExamplesMCRFactory could you explain why read more
  • philipz: IM已經是無解了,建議可以用Plurk Api試看看。 read more
  • ann: hi,請問以上問題解決了沒?可以分享一下嗎? read more
  • Anonymous: 邀請碼沒有~無法下載工具~~怎麼辦 read more
  • Melody: test read more
  • philipz: Ginger: 您好,請您在我的噗浪上留言即可一起討論。 read more
  • Ginger: 版大您好: 在看過您做的期貨即時訊息BOT後覺得很不錯,自己也有一些想法不知能否與您交流與協助呢? 若您覺得ok的話,可以email或是噗浪(ID: king0355)與我聯繫。感謝 : ) read more

About this Archive

This page is an archive of entries from November 2008 listed from newest to oldest.

October 2008 is the previous archive.

December 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.