Posts

How to reseed SQL Server identity coloumn

dbcc checkident ('TableName', reseed, 100)

How to find the top 10 largest files or directories in Linux

du -a /var | sort -n -r | head -n 10

Execute JavaScript in ASP.NET Code Behind

If you want to execute JavaScript in code behind for example after an event, you can: ScriptManager.RegisterStartupScript(this, GetType(), "anyName", "myScript();", true);

Include JavaScript in ASP.NET Master Page

When I directly put the following script in the markup of Master File. There is also some JavaScript error. It is because .aspx in different folder may using this master page, so javascript path may become incorrect. To solve it, you need to register the javascript in page_load method. Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/Script/jquery-1.4.2.min.js"));

The SQL Server Service Broker for the current database is not enabled

The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications. ----Check if the service broker is enabled SELECT is_broker_enabled FROM sys.databases WHERE name = 'YOUR_DB' -- Enable broker ALTER DATABASE YOUR_DB SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE -- If fail above then new broker ALTER DATABASE YOUR_DB SET NEW_BROKER WITH ROLLBACK IMMEDIATE

SQL Server 2005: List all databases

List all the databases on SQL Server: ----SQL SERVER 2005 System Procedures EXEC sp_databases EXEC sp_helpdb ----SQL 2000 Method still works in SQL Server 2005 SELECT name FROM sys.databases SELECT name FROM sys.sysdatabases ----SQL SERVER Un-Documented Procedure EXEC sp_msForEachDB 'PRINT ''?'''

Service Unavailable of IIS

Today after installed some Windows patches to the server and reboot, one of a website does not work. It shows "Service Unavailable" when browse it. I try to restart the website but problem still exist. Finally found that the Application Pools cannot start properly because of the AD account used have changed the password.