Leaderboard (728 x 90)

Monday, December 21, 2009

PEAR on Windows reports "Invalid configuration directive"

After running go-pear.bat to configure PEAR on a Windows Server you may encounter the PHP error dialog "Invalid configuration directive". To correct the issue, modify the file C:\Program Files (x86)\PHP\pear.bat. Scroll down to the :RUN section and modify the line with the PHP directive "-d include_path":

Prepend ".;" before "%PHP_PEAR_INSTALL_DIR%", and do not include the quotes. The section of line will read:

"... -d include_path=".;%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEA..."

Save the file and re-run the "pear" command.

Reference: http://kb.rackforce.com/?View=entry&EntryID=97

Sunday, December 20, 2009

How to change hostname in Linux

run these command

vi /etc/sysconfig/network

edit HOSTNAME parameter to your new hostname
ex: HOSTNAME=server1.example.com

save and restart network and xinetd service with this command
/etc/init.d/network restart
/etc/init.d/xinetd restart

run this command to change current system's hostname
hostname server1.example.com

edit file /etc/hosts following
127.0.0.1 server1.example.com server1

exit shell and re-login to check the result

Monday, December 7, 2009

Default Seach Provider corrupt in IE8

When you install IE7 or IE8 on winxp sp2 before upgrade windows to sp3, you will can't remove IE7/IE8 by Add and Remove Program.

If you upgrade IE7 to IE8 on winxp sp3, you may receive following error when you launch IE.
รูปภาพ

Resolution:

1. Click Start.
2. Click Run.
3. Type in regedit and press enter.
4. In the registry editor, expand and navigate to the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders.
5. Right click User Shell Folders.
6. Select New and then Expandable String value.
7. A new value is added in right pane.
8. Type in AppData and press enter.
9. Double click AppData.
10. Under value data type in:

%USERPROFILE%\Application Data

11. Note: If there is already AppData in the right pane, double click and correct it to %USERPROFILE%\Application Data

If the above steps do not work,
1. Click Start.
2. Click Control Panel.
3. Click User Accounts.
4. Click Create a new user account.
5. Choose appropirate name for the new user account.
6. Choose Administrator or Limited or Standard user. It's upto you.
7. Click Create.
8. Click Start, Log out from the current user account and log back in with the new one.
9. If the new user account is working for you, obviously, the old user account has got corrupted and you will have to use the new user account. Also, FYI: you can transfer old user settings and files to the new user account.

Repair Internet Explorer 6

A number of XP users have reported situations with Internet Explorer 6 becoming corrupted and reporting a number of different errors. While there is certainly no guarantee, the two procedures listed below have restored functionality to IE6 for many users experiencing problems.

Note: Both methods listed require that the Microsoft Windows XP CD-ROM be available.

Method 1: Microsoft Internet Explorer 6.x Repair for Windows XP

  • From the Start menu, select Run.
  • In the Open field, type sfc /scannow (Note: There is a space between sfc and /scannow)
  • Select the OK button.
  • Follow the prompts throughout the System File Checker process.
  • Reboot the computer when System File Checker completes.

Method 2: Microsoft Internet Explorer 6.x Repair for Windows XP

  • From the Start menu, select Search, select All Files and Folders.
  • Select More Advanced Options and place a checkmark beside Search Hidden Files and Folders option.
  • Ensure that Search System Folders and Search Subfolders are also checked.
  • In the All or Part of the File Name box, type ie.inf
  • In the Look In drop-down menu, select C: or the letter of the hard drive that contains the Windows folder.
  • Click the Search button.
  • In the search results pane, find the ie.inf file located in Windows\Inf folder.
  • Right click the ie.inf file and click Install on the context menu.
  • Reboot the computer when the file copy process is complete.
Reference: http://www.theeldergeek.com/repair_ie6.htm

Friday, December 4, 2009

How to Truncate Log File in SQL Server 2005

Introduction

SQL Server 2005 is quite different from SQL Server 2000. To truncate log file is one thing which is different from SQL Server 2000. In SQL Server 2000, you just use Shrink to whatever file size you like. In SQL Server 2005, sometimes I cannot shrink the log file at all.

Here I want to describe some tricks to truncate log file for a database in SQL Server 2005. The work environment is Microsoft SQL Server Management Studio.

I. Shrink the Log File Size at the Right Time

I found out this trick:

Immediately after I use the SSIS package or Import the data to the database (highlight the database->Tasks->Import data …), or Export the data from the database (highlight the database->Tasks->Export data …), I can shrink the log file to the desired size, for example, 1MB. That is, highlight the database->Tasks->Shrink->Files , set the file size, say, 1MB.

Then, click OK and you are done.

II. Eliminate the Log File Completely

Sometimes, we just do not need the big log file. For example, I have a 40GB log file. I am sure I do not need this log file and want to get rid of it completely to free up the hard drive space. The logic is:

  1. Detach the database
  2. Rename the log file
  3. Attach the database without the log file
  4. Delete the log file

Let’s say, the database name is testDev. In the SQL Server Management Studio,

  1. Highlight the database-> Tasks->Detach..-> Click OK
  2. Go to log file folder -> rename the testDev_log.ldf to be like testDev_log-aa.ldf
  3. Highlight Databases->Attach…-> Click Add -> add the database testDev, highlight the log file and click the ‘Remove’ button. This means you only attach testDev.mdf
  4. After this is done, you can verify the contents of the attached database and then delete the log file

This way we can safely delete the log file and free up the space.

Reference Site: http://www.codeproject.com/KB/database/truncate_log_SQL_server.aspx

Thursday, December 3, 2009

How to clear log and shrink database in MSSQL with transaction-sql

run this command:

backup log databasename with no_log
backup log databasename with truncate_only
dbcc shrinkdatabase(databasename,1)

How to check all database size in MSSQL

run this command in Management Studio
# exec sp_databases