Posts

Showing posts from July, 2006

HOW TO strip HTML tags and show just web page text

Using C# & Regular Expressions, it can be done like this - string stripped = System.Text.RegularExpressions.Regex.Replace(text,@"<(.|\n)*?>",string.Empty); The lean, mean & Swiss knife of an editor,  Editplus has a short cut for it - Ctrl + Shift + P or from the menu: Edit > HTML > Strip HTML tags Also see:  HOW TO convert HTML content to plain text with Excel

HOW TO prevent Leeching of images

Scott Hanselman , one of the most popular Microsoft MVP s, is also a Microsoft RD & co-author of ASP.NET 2.0 MVP Hacks and Tips . In the book, he has an interesting tip on discouraging Leeching using an Image-Specific HttpHandler.

HOW TO detect status of a service & manipulate it programmatically

This KB article which explains how to detect status of SQL Server Express service & start it programmatically , can also be used to detect any other service by replacing the appropriate service name. The System.ServiceProcess.ServiceController class is used to detect the status of a service and start it if required.

P&P Guidance Explorer

Guidance Explorer is a tool from P&P , complementary to FX Cop rules, that helps to find and use relevant patterns & practices guidance .

HOW TO debug Javascript in ASP.NET apps

There are multiple ways to debug Javascript in ASP.NET apps: * Using VS.NET & IE * Venkman , Mozilla's JavaScript Debugger . * Javascript Console in Firefox (Tools > Javascript Console)

ASP.NET 2.0 Webcasts

The ASP.NET 2.0 Webcast Series is a great compilation of Webcasts on ASP.NET 2.0 that's good for starters as well as developers migrating from other platforms

Database Schema Samples

Image
Barry Williams' library of 'Kick-Start' Data Models is a great resource to check when starting work on designing a database schema ( Thanks ScottGu )

Javascript best practices

Matt Kruse 's Javascript Toolbox is an indispensable repository of reusable code libraries. There is also a compilation of Javascript best practices.

Why do stored procedures recompile?

When SQL Server stored procedures recompile, it is not always good news for performance conscious developers and to identify the potential issues, SQL Profiler can be used . The SP:Recompile event in SQL Profiler shows when a stored procedure or a trigger is being recompiled. In SQL Server 2000 SP2 or in SQL Server 2005, the SP:Recompile event identifies the reason for the recompilation with an integer code in the EventSubClass column. Here is a list of the integer codes with the reason for recompilation: SQL Server 2000 SP2 Integer code - Reason for recompilation ----------------------------------------------------------------------- 1 - Schema, bindings, or permissions changed between compile or execute. 2 - Statistics changed. 3 - Object not found at compile time, deferred check to run time. 4 - Set option changed in batch. 5 - Temp table schema, binding, or permission changed. 6

The optgroup tag

Optgroup, label, fieldset/legend, col/colgroup and acronym are rich and useful but infrequently used HTML tags. GMail makes good use of the OptGroup tag for its mail labeling feature. The optgroup, which stands for Option Group, is an element that groups a set of option elements, inside a select element, and labels them. It is perfect for showing states and cities, countries and states, and other similar categorized items. Unfortunately, this element is not generated by any ASP.NET server controls... XList is a custom Server control that supports the OptGroup tag