已安裝 SQLExpress SP2 但要改裝 SQL2005 的方法

今天第一次遇到 SQLExpress 中的資料庫大小超出限制的情況,主要是因為客戶要求所有上傳的檔案都要儲存在 SQL Server 中的緣故,所以資料庫的成長量十分驚人。

而當我想改裝 SQL Server 2005 Developer Edition 時想說連 Management Studio Express 也一併升級到 Management Studio 版本,雖然資料庫安裝十分順利,但安裝 Management Studio 時卻發生無法安裝的狀況,我嘗試將 Management Studio Express 解除安裝後還是無法正常安裝,他還是叫我移除一些東西,不過我實在想不出還要移除哪些程式,因為若是再移除就要移除資料庫了,就想說這應該不太對,我試了好幾次才試出來如何安裝成功。主要原因是因為安裝程式判斷出我現有的主機的用戶端元件是 Service Pack 2 的版本,而嘗試要安裝的工具卻是沒有 Service Pack 的版本(因為剛安裝當然沒有SP2),所以無法執行升級的程序。

要能成功改裝 Management Studio 首先必須到控制台的「新增或移除程式」找到 Microsoft SQL Server 2005 並點選「變更」,接著會出現「Microsoft SQL Server 2005 維護」視窗:

Microsoft SQL Server 2005 維護

選取「工作站元件」後按「下一步」幾次,直到以下畫面出現:

接著點選「變更安裝的元件」

接著點選「變更安裝的元件」並將「用戶端元件」全部移除

將「用戶端元件」全部移除

然後一直按下一步將安裝程式執行完就會將「用戶端元件」完整移除,這時再去安裝 Management Studio 就會安裝成功了。

相關連結

  

此文章由 will 發表於 2008/4/30 上午 12:14:14

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: SQL Server

標籤: ,

收藏:

修正 Linux 時區的方式

之前在安裝 Ubuntu 的時候不知道怎麼選的,時區選錯了,導致怎麼校時都不對,且都沒有現成的工具程式可以幫我切換。

其實只有三行指令要下而已,底下的範例是將時區切換到 Asia/Taipei 的時區:

cd /etc
mv localtime localtime.OLD
cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime

調整完時區之後在做一次時間校正就可以了:

root@server:~# ntpdate tick.stdtime.gov.tw
29 Apr 19:09:41 ntpdate[7660]: adjust time server 220.130.158.51 offset 0.447079 sec

相關連結

  

此文章由 will 發表於 2008/4/29 下午 07:06:30

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: Linux

標籤:

收藏:

.NET Framework 3.5 在非英語語系無法安裝的問題

今天去客戶那裝機發現 .NET Framework 3.5 無法安裝,主因是 .NET Framework 3.5 在安裝的時候會偵測原作業系統的語系然,如果不是「英文語系」就會動態下載 Language Pack (語言套件) 回來安裝,即便你去下載中文版的 .Net Framework 3.5 安裝檔Microsoft .NET Framework 3.5 完整套件 都一樣,裡面都沒有包含中文語系檔,都需要在安裝過程進行下載的動作。

但客戶端的主機因為安全考量將所有連外的網路全部切斷而導致無法下載,所以每次安裝到一半就卡住了,此時立即上網找到了答案,共有三個步驟要做:

1. 首先必須先到這裡下載 dotNetFx35setup.exe 安裝檔,並執行以下指令解壓縮檔案

dotNetFx35setup.exe /x

2. 假設你解壓縮到 D:\dotnetfx35 目錄下,執行以下指令直接指明安裝「英文版」,就可以跳過動態下載中文語系的問題了。

D:\dotnetfx35\setup.exe /lang:ENU

3. 之後再去下載 Microsoft .NET Framework 3.5 語言套件 並上傳到伺服器另外安裝即可。

相關連結

  

此文章由 will 發表於 2008/4/29 上午 12:02:46

永久連結 | 評論 (4) | 此文章的RSSRSS comment feed |

分類: .Net | 系統管理

標籤:

收藏:

SQL 2000 的 Uniqueidentifier 欄位在 LINQ to SQL 的問題

我有個專案原本都在 SQL Server 2005 上面開發的,到最後才將資料庫轉換到 SQL Server 2000 上,結果在執行 Insert 的時候卻發生 "The primary key column of type 'UniqueIdentifier' cannot be generated by the server. " 錯誤訊息,如下圖:

The primary key column of type 'UniqueIdentifier' cannot be generated by the server.

不過我在「建立時間」欄位上設定 Auto Generated Value 為 True 是可以正常運作的!

看這個樣子應該是 LINQ to SQL 在 SQL Server 2000 資料庫中的 Primary Key 不支援 Auto Generated Value,也就是說我的 LINQ to SQL Class 裡面每一個表格的 Primary Key 定義都必須將 Auto Generated Value 設定為 False ( 也是預設的狀態 ),但為了減少現有程式的修改量,我在每一個表格加上一個 OnCreated() Partial Method,並在這裡指定預設的 Guid 就解決所有問題了。

public partial class Role
{
    partial void OnCreated()
    {
        if (this.ID.CompareTo(new Guid()) == 0)
        {
            this.ID = Guid.NewGuid();
        }
    }
}

LINQ to SQL 的架構真的很直覺,有很多以前要寫很多 Code 的地方現在都簡化了,我也自從開始用 LINQ to SQL 之後,就一直不斷發現一些小地方讓我十分滿意。

  

此文章由 will 發表於 2008/4/28 上午 12:00:44

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: .Net | ASP.NET | LINQ | SQL Server

標籤: , , ,

收藏:

Ubuntu 8.04 LTS 如何安裝 PHP4

據我所知 Ubuntu Linux 大概從 6.06 (Dapper) 開始就不支援 PHP4 了,且 PHP 官方網站也宣布從 2007-12-31 起停止了 PHP4 的計畫(也就是以後也不會再出新版),不過我想應該還是有不少網站是用 PHP4 寫的,要讓這些網站在短時間內全部升級改寫成 PHP5 的版本還真不太容易。今天我也把 Ubuntu 8.04 LTS 裝起來了,並嘗試著也將 php4 裝起來,以下是在 Ubuntu 8.04 成功安裝 php4 的心得分享(當然這個方法在 Ubuntu 6.06, 6.10 或 7.10 一樣適用)。

1. 建立一個檔案到 /etc/apt/sources.list.d/ 目錄下:

# vi /etc/apt/sources.list.d/dapper.sources.list

   檔案內容僅需要輸入一行即可:

deb http://tw.archive.ubuntu.com/ubuntu/ dapper universe main restricted multiverse

2. 執行 apt-get update 指令更新 Packages 資料庫

root@ubuntu804:~# apt-get update
Hit http://tw.archive.ubuntu.com hardy Release.gpg
Hit http://tw.archive.ubuntu.com hardy-updates Release.gpg
Hit http://tw.archive.ubuntu.com dapper Release.gpg
Hit http://tw.archive.ubuntu.com hardy Release
Hit http://tw.archive.ubuntu.com hardy-updates Release
Hit http://tw.archive.ubuntu.com dapper Release
Hit http://tw.archive.ubuntu.com hardy/main Packages
Hit http://tw.archive.ubuntu.com hardy/restricted Packages
Hit http://tw.archive.ubuntu.com hardy/main Sources
Hit http://tw.archive.ubuntu.com hardy/restricted Sources
Hit http://tw.archive.ubuntu.com hardy/universe Packages
Hit http://tw.archive.ubuntu.com hardy/universe Sources
Hit http://tw.archive.ubuntu.com hardy/multiverse Packages
Hit http://tw.archive.ubuntu.com hardy/multiverse Sources
Hit http://tw.archive.ubuntu.com hardy-updates/main Packages
Hit http://tw.archive.ubuntu.com hardy-updates/restricted Packages
Hit http://tw.archive.ubuntu.com hardy-updates/main Sources
Hit http://security.ubuntu.com hardy-security Release.gpg
Hit http://tw.archive.ubuntu.com hardy-updates/restricted Sources
Hit http://security.ubuntu.com hardy-security Release
Hit http://security.ubuntu.com hardy-security/main Packages
Hit http://tw.archive.ubuntu.com hardy-updates/universe Packages
Hit http://security.ubuntu.com hardy-security/restricted Packages
Hit http://security.ubuntu.com hardy-security/main Sources
Hit http://security.ubuntu.com hardy-security/restricted Sources
Hit http://tw.archive.ubuntu.com hardy-updates/universe Sources
Hit http://security.ubuntu.com hardy-security/universe Packages
Hit http://security.ubuntu.com hardy-security/universe Sources
Hit http://security.ubuntu.com hardy-security/multiverse Packages
Hit http://security.ubuntu.com hardy-security/multiverse Sources
Hit http://tw.archive.ubuntu.com hardy-updates/multiverse Packages
Hit http://tw.archive.ubuntu.com hardy-updates/multiverse Sources
Hit http://tw.archive.ubuntu.com dapper/universe Packages
Hit http://tw.archive.ubuntu.com dapper/main Packages
Hit http://tw.archive.ubuntu.com dapper/restricted Packages
Hit http://tw.archive.ubuntu.com dapper/multiverse Packages
Reading package lists... Done

   你可以發現最後面取得的時 dapper/universe 套件,這裡面就有包括 php4 的所有相關套件。

3. 搜尋所有 php4 相關的套件

root@ubuntu804:~# apt-cache search php4
apache2-prefork-dev - development headers for apache2
cakephp - MVC rapid application development framework for PHP
cakephp1.2 - MVC rapid application development framework for PHP (1.2 version)
caudium - An extensible WWW server written in Pike
dtc - web control panel for admin and accounting hosting services
libphp-phplot - The graphic library for PHP
php-image-canvas - Image_Canvas module for PEAR
php-image-graph - Image_Graph module for PEAR
php5-syck - YAML parser kit -- PHP5 bindings
php-doc - Documentation for PHP4 and PHP5
dbtcp - Miscellaneous command-line DBTCP utils
fibusql - Web based double-entry accounting
libapache-mod-php4 - server-side, HTML-embedded scripting language (apache 1.3 module)
libapache2-mod-php4 - server-side, HTML-embedded scripting language (apache 2.0 module)
odontolinux - Dental office management software (PHP4 + PostgreSQL)
php4 - server-side, HTML-embedded scripting language (meta-package)
php4-apd - PHP code execution profiler and debugger
php4-auth-pam - A PHP extension for PAM authentication
php4-cgi - server-side, HTML-embedded scripting language (CGI binary)
php4-clamavlib - PHP ClamAV Lib - ClamAV Interface for PHP4 Scripts
php4-cli - command-line interpreter for the php4 scripting language
php4-common - Common files for packages built from the php4 source
php4-curl - CURL module for php4
php4-dbtcp - PHP bindings for DBTCP
php4-dev - Files for PHP4 module development
php4-domxml - XMLv2 module for php4
php4-gd - GD module for php4
php4-gpib - libgpib php bindings
php4-idn - PHP api for the IDNA library
php4-imagick - ImageMagick module for php4
php4-imap - IMAP module for php4
php4-interbase - interbase/firebird module for php4
php4-json - json serialiser for PHP4
php4-kadm5 - An extension to manage kerberos admin information
php4-lasso - Liberty ID-FF library - PHP 4 bindings
php4-ldap - LDAP module for php4
php4-mapscript - module for php4-cgi to use mapserver
php4-maxdb - PHP extension to access MaxDB databases
php4-mcal - MCAL calendar module for php4
php4-mcrypt - MCrypt module for php4
php4-mhash - MHASH module for php4
php4-mysql - MySQL module for php4
php4-odbc - ODBC module for php4
php4-pear - PHP Extension and Application Repository (transitional package)
php4-pear-log - Log module for PEAR
php4-pgsql - PostgreSQL module for php4
php4-ps - An extension to create PostScript files
php4-pspell - pspell module for php4
php4-recode - Character recoding module for php4
php4-rrdtool - RRD module for php4
php4-snmp - SNMP module for php4
php4-spplus - Secured payment system of the Caisse d'Epargne (French bank)
php4-sqlite - PHP4 bindings to SQLite, a file-based SQL engine
php4-sqlrelay - SQL Relay PHP API
php4-sybase - Sybase / MS SQL Server module for php4
php4-tclink - TrustCommerce TCLink module for php4
php4-uuid - OSSP uuid module for php4
php4-xslt - XSLT module for php4
php4-yaz - php/yaz z39.50 module
phpgroupware-felamimail - phpGroupWare felamimail (Squirrelmail) module

4. 安裝 php4-cli

root@ubuntu804:~# apt-get install php4-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libdb4.3 libpcre3 libzzip-0-12 php4-common
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libdb4.3 libpcre3 libzzip-0-12 php4-cli php4-common
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/2389kB of archives.
After this operation, 5018kB of additional disk space will be used.
Do you want to continue [Y/n]?
Selecting previously deselected package libdb4.3.
(Reading database ... 16202 files and directories currently installed.)
Unpacking libdb4.3 (from .../libdb4.3_4.3.29-11ubuntu1_i386.deb) ...
Selecting previously deselected package libpcre3.
Unpacking libpcre3 (from .../libpcre3_7.4-1ubuntu2_i386.deb) ...
Selecting previously deselected package libzzip-0-12.
Unpacking libzzip-0-12 (from .../libzzip-0-12_0.12.83-5_i386.deb) ...
Selecting previously deselected package php4-common.
Unpacking php4-common (from .../php4-common_4%3a4.4.2-1build1_i386.deb) ...
Selecting previously deselected package php4-cli.
Unpacking php4-cli (from .../php4-cli_4%3a4.4.2-1build1_i386.deb) ...
Setting up libdb4.3 (4.3.29-11ubuntu1) ...
Setting up libpcre3 (7.4-1ubuntu2) ...

Setting up libzzip-0-12 (0.12.83-5) ...

Setting up php4-common (4:4.4.2-1build1) ...
Setting up php4-cli (4:4.4.2-1build1) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

5. 大功告成!我們來測試一下 php4 是否可以正常執行:

root@ubuntu804:~# php4 -v
PHP Warning:  mime_magic: type search/400       \\input         text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type search/400       \\section       text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type search/400       \\setlength     text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type search/400       \\documentstyle text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type search/400       \\chapter       text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type search/400       \\documentclass text/x-tex invalid in Unknown on line 0
PHP Warning:  mime_magic: type regex            [Cc]onstant[[:space:]]+[Ss]tory text/x-inform invalid in Unknown on line 0
PHP 4.4.2-1build1 (cli) (built: Apr  6 2006 09:44:32)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

   你可以發現執行的過程會出現一堆 PHP Warning 的警告訊息,這是因為 Ubuntu 8.04 中預設的 /usr/share/file/magic.mime (MIME 定義檔) 檔案中有幾行 php4 認不得,而導致出現警示訊息,不過這幾行並不會影響 PHP 的運作。

   因為在 magic.mime 中的這 7 行是用來定義 TeX documents 與 Inform interactive fiction language 的檔案類型,因為很少用到,所以我覺得將這幾行註解掉應該沒關係!所以我們還是修改一下 magic.mime 檔案,將這幾行「太新」的 MIME 定義給註解掉,讓 php4 不會出現警告訊息。你開啟 /usr/share/file/magic.mime 檔案後直接跳到第598行:

# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
0       search/400      \\input         text/x-tex
0       search/400      \\section       text/x-tex
0       search/400      \\setlength     text/x-tex
0       search/400      \\documentstyle text/x-tex
0       search/400      \\chapter       text/x-tex
0       search/400      \\documentclass text/x-tex

# Type: Inform interactive fiction language
# URL:  http://www.inform-fiction.org/
# From: Reuben Thomas <rrt@sc3d.org>
0       regex           [Cc]onstant[[:space:]]+[Ss]tory text/x-inform

這要將這幾行最前面加上井字號 ( # ) 後存檔,然後我們在測試一下 php4 是否正常執行:

root@ubuntu804:~# php -v
PHP 4.4.2-1build1 (cli) (built: Apr  6 2006 09:44:32)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

完成 php4 安裝!

相關連結

  

此文章由 will 發表於 2008/4/27 上午 12:05:16

永久連結 | 評論 (0) | 此文章的RSSRSS comment feed |

分類: Linux

標籤: , , ,

收藏: