Saturday, 21 January 2017

HTML color code

HTML color code

ColorColor HEXColor RGB
 #000000rgb(0,0,0)
 #FF0000rgb(255,0,0)
 #00FF00rgb(0,255,0)
 #0000FFrgb(0,0,255)
 #FFFF00rgb(255,255,0)
 #00FFFFrgb(0,255,255)
 #FF00FFrgb(255,0,255)
 #C0C0C0rgb(192,192,192)
 #FFFFFFrgb(255,255,255)

Red LightColor HEXColor RGB
 #000000 rgb(0,0,0) 
 #080000 rgb(8,0,0) 
 #100000 rgb(16,0,0) 
 #180000 rgb(24,0,0) 
 #200000 rgb(32,0,0) 
 #280000 rgb(40,0,0) 
 #300000 rgb(48,0,0) 
 #380000 rgb(56,0,0) 
 #400000 rgb(64,0,0) 
 #480000 rgb(72,0,0) 
 #500000 rgb(80,0,0) 
 #580000 rgb(88,0,0) 
 #600000 rgb(96,0,0) 
 #680000 rgb(104,0,0) 
 #700000 rgb(112,0,0) 
 #780000 rgb(120,0,0) 
 #800000 rgb(128,0,0) 
 #880000 rgb(136,0,0) 
 #900000 rgb(144,0,0) 
 #980000 rgb(152,0,0) 
 #A00000 rgb(160,0,0) 
 #A80000 rgb(168,0,0) 
 #B00000 rgb(176,0,0) 
 #B80000 rgb(184,0,0) 
 #C00000 rgb(192,0,0) 
 #C80000 rgb(200,0,0) 
 #D00000 rgb(208,0,0) 
 #D80000 rgb(216,0,0) 
 #E00000 rgb(224,0,0) 
 #E80000 rgb(232,0,0) 
 #F00000 rgb(240,0,0) 
 #F80000 rgb(248,0,0) 
 #FF0000 rgb(255,0,0) 


Shades of Gray

Gray colors are created by using an equal amount of power to all of the light sources.
To make it easier for you to select the correct shade, we have created a table of gray shades for you:
Gray ShadesColor HEXColor RGB
 #000000 rgb(0,0,0) 
 #080808 rgb(8,8,8) 
 #101010 rgb(16,16,16) 
 #181818 rgb(24,24,24) 
 #202020 rgb(32,32,32) 
 #282828 rgb(40,40,40) 
 #303030 rgb(48,48,48) 
 #383838 rgb(56,56,56) 
 #404040 rgb(64,64,64) 
 #484848 rgb(72,72,72) 
 #505050 rgb(80,80,80) 
 #585858 rgb(88,88,88) 
 #606060 rgb(96,96,96) 
 #686868 rgb(104,104,104) 
 #707070 rgb(112,112,112) 
 #787878 rgb(120,120,120) 
 #808080 rgb(128,128,128) 
 #888888 rgb(136,136,136) 
 #909090 rgb(144,144,144) 
 #989898 rgb(152,152,152) 
 #A0A0A0 rgb(160,160,160) 
 #A8A8A8 rgb(168,168,168) 
 #B0B0B0 rgb(176,176,176) 
 #B8B8B8 rgb(184,184,184) 
 #C0C0C0 rgb(192,192,192) 
 #C8C8C8 rgb(200,200,200) 
 #D0D0D0 rgb(208,208,208) 
 #D8D8D8 rgb(216,216,216) 
 #E0E0E0 rgb(224,224,224) 
 #E8E8E8 rgb(232,232,232) 
 #F0F0F0 rgb(240,240,240) 
 #F8F8F8 rgb(248,248,248) 
 #FFFFFF rgb(255,255,255) 


Web Safe Colors?

Some years ago, when computers supported max 256 different colors, a list of 216 "Web Safe Colors" was suggested as a Web standard, reserving 40 fixed system colors.
The 216 cross-browser color palette was created to ensure that all computers would display the colors correctly when running a 256 color palette.
This is not important today, since most computers can display millions of different colors. Anyway, here is the list:
0000000000330000660000990000CC0000FF
0033000033330033660033990033CC0033FF
0066000066330066660066990066CC0066FF
0099000099330099660099990099CC0099FF
00CC0000CC3300CC6600CC9900CCCC00CCFF
00FF0000FF3300FF6600FF9900FFCC00FFFF
3300003300333300663300993300CC3300FF
3333003333333333663333993333CC3333FF
3366003366333366663366993366CC3366FF
3399003399333399663399993399CC3399FF
33CC0033CC3333CC6633CC9933CCCC33CCFF
33FF0033FF3333FF6633FF9933FFCC33FFFF
6600006600336600666600996600CC6600FF
6633006633336633666633996633CC6633FF
6666006666336666666666996666CC6666FF
6699006699336699666699996699CC6699FF
66CC0066CC3366CC6666CC9966CCCC66CCFF
66FF0066FF3366FF6666FF9966FFCC66FFFF
9900009900339900669900999900CC9900FF
9933009933339933669933999933CC9933FF
9966009966339966669966999966CC9966FF
9999009999339999669999999999CC9999FF
99CC0099CC3399CC6699CC9999CCCC99CCFF
99FF0099FF3399FF6699FF9999FFCC99FFFF
CC0000CC0033CC0066CC0099CC00CCCC00FF
CC3300CC3333CC3366CC3399CC33CCCC33FF
CC6600CC6633CC6666CC6699CC66CCCC66FF
CC9900CC9933CC9966CC9999CC99CCCC99FF
CCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFF
FF0000FF0033FF0066FF0099FF00CCFF00FF
FF3300FF3333FF3366FF3399FF33CCFF33FF
FF6600FF6633FF6666FF6699FF66CCFF66FF
FF9900FF9933FF9966FF9999FF99CCFF99FF
FFCC00FFCC33FFCC66FFCC99FFCCCCFFCCFF
FFFF00FFFF33FFFF66FFFF99FFFFCCFFFFFF

Monday, 9 January 2017

Search anything is SQL Server Full Text Search

create Proc SearchAnything
@SearchValue nvarchar(100)
AS
BEGIN

DECLARE @SearchStrColumnName nvarchar(100), @SearchStrColumnValue nvarchar(100), @SearchStrInXML bit
SET @SearchStrColumnValue = '%'+@SearchValue+'%' /* use LIKE syntax */
SET @SearchStrColumnName = NULL /* NULL for all, use LIKE syntax */
SET @SearchStrInXML = 0 /* Searching XML data may be slow */
 
IF OBJECT_ID('tempdb..#Results') IS NOT NULL DROP TABLE #Results

CREATE TABLE #Results (TableName nvarchar(128), ColumnName nvarchar(128), ColumnValue nvarchar(max),ColumnType nvarchar(20))
 
SET NOCOUNT ON
 
DECLARE @TableName nvarchar(256) = '',@ColumnName nvarchar(128),@ColumnType nvarchar(20), @QuotedSearchStrColumnValue nvarchar(110), @QuotedSearchStrColumnName nvarchar(110)

SET @QuotedSearchStrColumnValue = QUOTENAME(@SearchStrColumnValue,'''')

DECLARE @ColumnNameTable TABLE (COLUMN_NAME nvarchar(128),DATA_TYPE nvarchar(20))
 
WHILE @TableName IS NOT NULL
BEGIN
SET @TableName =
(
   SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
   FROM INFORMATION_SCHEMA.TABLES
   WHERE TABLE_TYPE = 'BASE TABLE'
   AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
   AND OBJECTPROPERTY(OBJECT_ID(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)), 'IsMSShipped') = 0
)
 
IF @TableName IS NOT NULL
BEGIN
DECLARE @sql VARCHAR(MAX)
SET @sql = 'SELECT QUOTENAME(COLUMN_NAME),DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(''' + @TableName + ''', 2)
AND TABLE_NAME = PARSENAME(''' + @TableName + ''', 1)
AND DATA_TYPE IN (' + CASE WHEN ISNUMERIC(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@SearchStrColumnValue,'%',''),'_',''),'[',''),']',''),'-','')) = 1 THEN '''tinyint'',''int'',''bigint'',' ELSE '' END + '''char'',''varchar'',''nchar'',''nvarchar''' + CASE @SearchStrInXML WHEN 1 THEN ',''xml''' ELSE '' END + ')
AND COLUMN_NAME LIKE COALESCE(' + CASE WHEN @SearchStrColumnName IS NULL THEN 'NULL' ELSE '''' + @SearchStrColumnName + '''' END  + ',COLUMN_NAME)'

INSERT INTO @ColumnNameTable
EXEC (@sql)
WHILE EXISTS (SELECT TOP 1 COLUMN_NAME FROM @ColumnNameTable)
BEGIN
SELECT TOP 1 @ColumnName = COLUMN_NAME,@ColumnType = DATA_TYPE FROM @ColumnNameTable
SET @sql = 'SELECT ''' + @TableName + ''',''' + @ColumnName + ''',' + CASE @SearchStrInXML WHEN 1 THEN 'LEFT(CAST(' + @ColumnName + ' AS nvarchar(MAX)), 4096),''' ELSE 'LEFT(' + @ColumnName + ', 4096),''' END + @ColumnType + '''
FROM ' + @TableName + ' (NOLOCK) ' +
' WHERE ' + CASE @SearchStrInXML WHEN 1 THEN 'CAST(' + @ColumnName + ' AS nvarchar(MAX))' ELSE @ColumnName END + ' LIKE ' + @QuotedSearchStrColumnValue
INSERT INTO #Results
EXEC(@sql)
DELETE FROM @ColumnNameTable WHERE COLUMN_NAME = @ColumnName
END  
END
END

SET NOCOUNT OFF
SELECT TableName, ColumnName, ColumnValue, ColumnType, COUNT(*) AS Count FROM #Results
GROUP BY TableName, ColumnName, ColumnValue, ColumnType
END
GO

Remove Extra Line in Procedure

-- =============================================                                                                                                                                              
   -- Author:  <Author,Ashish Srivastava>                                                                                                                                              
   -- Create date: <Create Date,02-April-2016>                                                                                                                                              
   -- Description: <Description,Remove Extra Line in Procedure  >                                                                                          
                                                                                                                                       
   -- =============================================      
create PROCEDURE [dbo].[sp_helptext2] (@ProcName NVARCHAR(256))
AS
BEGIN
  DECLARE @PROC_TABLE TABLE (X1  NVARCHAR(MAX))
 
  DECLARE @Proc NVARCHAR(MAX)
  DECLARE @Procedure NVARCHAR(MAX)
  DECLARE @ProcLines TABLE (PLID INT IDENTITY(1,1), Line NVARCHAR(MAX))
 
  SELECT @Procedure = 'SELECT DEFINITION FROM '+db_name()+'.SYS.SQL_MODULES WHERE OBJECT_ID = OBJECT_ID('''+@ProcName+''')'
 
  insert into @PROC_TABLE (X1)
        exec  (@Procedure)
 
  SELECT @Proc=X1 from @PROC_TABLE
 
  WHILE CHARINDEX(CHAR(13)+CHAR(10),@Proc) > 0
  BEGIN
        INSERT @ProcLines
        SELECT LEFT(@Proc,CHARINDEX(CHAR(13)+CHAR(10),@Proc)-1)
        SELECT @Proc = SUBSTRING(@Proc,CHARINDEX(CHAR(13)+CHAR(10),@Proc)+2,LEN(@Proc))
  END
 --* inserts last line
 insert @ProcLines  
 select @Proc ;
 
 --edited here. (where Line<>'')
 SELECT Line FROM @ProcLines where Line<>'' ORDER BY PLID
END
GO

Monday, 2 January 2017

Gridview Excel Export In C#

  1. void             BindGrid()  
  2. {  
  3.   
  4.  DataSet objds = "";  
  5.            GridView1.DataSource = objds;  
  6.             GridView1.DataBind();  
  7. }  
  8.   
  9. void ExcelExport  
  10. {  
  11.             Response.ClearContent();  
  12.             Response.Buffer = true;  
  13.             Response.AddHeader("content-disposition"string.Format("attachment; filename={0}""UserDetails.xls"));  
  14.             Response.ContentType = "application/ms-excel";  
  15.             StringWriter sw = new StringWriter();  
  16.             HtmlTextWriter htw = new HtmlTextWriter(sw);  
  17.             gvAdminDetails.AllowPaging = false;  
  18.             BindGrid();  
  19.             //Change the Header Row back to white color  
  20.             Gridview1.HeaderRow.Style.Add("background-color""#FFFFFF");  
  21.               
  22.             //Applying stlye to gridview header cells  
  23.             for (int i = 0; i < gvAdminDetails.HeaderRow.Cells.Count; i++)  
  24.             {  
  25.                Gridview1.HeaderRow.Cells[i].Style.Add("background-color""#F0F0F0");  
  26.             }  
  27.             int j = 1;  
  28.             //This loop is used to apply stlye to cells based on particular row  
  29.             foreach (GridViewRow gvrow in gvAdminDetails.Rows)  
  30.             {  
  31.                 gvrow.BackColor = System.Drawing.Color.White;  
  32.                 if (j <= Gridview1.Rows.Count)  
  33.                 {  
  34.                     if (j % 2 != 0)  
  35.                     {  
  36.                         for (int k = 0; k < gvrow.Cells.Count; k++)  
  37.                         {  
  38.                             gvrow.Cells[k].Style.Add("background-color""#F0F0F0");  
  39.                         }  
  40.                     }  
  41.                 }  
  42.                 j++;  
  43.             }  
  44.   
  45.            Gridview1.RenderControl(htw);  
  46.             Response.Write(sw.ToString());  
  47.              
  48.            Gridview1.AllowPaging = true;  
  49.             Response.End();  
  50. }  
  51.   
  52.    
  53. public override void VerifyRenderingInServerForm(Control control)  
  54.     {  
  55.         //required to avoid the runtime error "  
  56.       //Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."  
  57.     }  

Bulk SMS Sender ID Codes

Bulk SMS Sender ID Codes Following table is of Telecom Operator Code. Provider Code Airtel A BSNL B Datacom Solu...