Edit shortcuts in Places bar in Save dialog / Open dialog in Windows

It's absolutely boring to navigate to your most often used folder in windows save or open dialogs. Th purpose of Places bar is to help you to do this faster. The Places bar locations can be edited via Group Policy editor in Windows XP Pro and Vista. Use the following way:

1. Open gpedit.msc (Start->Run)
2. Navigate to User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer -> Common Open File Dialog
3. Open "Items displayed in Places bar" and write down the locations you want with their paths. Symbolic names are also allowed like Desktop.

SQL: How to check for existing contraint

Just an example how to get it form the database information schema:

IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='dbo' AND CONSTRAINT_NAME='IX_Constraint' AND TABLE_NAME='TableName')
BEGIN
ALTER TABLE [dbo].[TableName] WITH CHECK ADD CONSTRAINT ..... /* constraints */
END

How to set column width in a CheckBoxList in an ASP.NET page

Maybe this is common problem since CheckBoxList control doesn't have set of parameters for obtaining column width and row height. But we always can use CSS for styling this control getting in mind he is rendered as html table or floated div tag.


<asp:checkboxlist runat="server" id="chkBoxList1" cssclass="chkBoxList" repeatcolumns="4" repeatlayout="Table">
</asp:checkboxlist>


Here we explicitly define the layout to be rendered as table (which is by default) and also need to define the css class "chkBoxList" in current page or web site theme.


<style>
.chkBoxList tr
{
height:24px;
}

.chkBoxList td
{
width:120px; /* or percent value: 25% */
}
</style>

Of course any other css styles can be attached here.

Only ASP.NET :)

SQL Stored Procedures - getting return value

Starting directly with example:

CREATE PROCEDURE ProcessValue
(
@value int,
@returnValue int OUTPUT
)
AS
BEGIN
/* do calculation and processing and assign the result value to output parameter */
SET @returnValue = value + 5*value

END

The following calling of the procedure shows how to get output parameter.
declare @result int
EXEC ProcessValue 15, @result OUTPUT


Of course this example is pretty simple - only for showing how to use. For such usage the SQL scalar-valued functions are better way.