Skip to main content

Posts

Showing posts from 2010

Oman world fireworks championship 2010

വീണ്ടും, ആരെങ്കിലും തെറി പറയുന്നത് വരെ ഇത് തുടരും

ഒന്നും പറയാനില്ല

ഒരു തണുത്ത വെളുപ്പാന്‍ കാലത്ത്

ഒരു തണുത്ത വെളുപ്പാന്‍ കാലത്ത്, വെളിക്കു വെളിയില്‍ ഇരിക്കാന്‍ പോയപ്പോള്‍

Macro

 സൂക്ഷ്മം

Get all the dates between two dates in SQL Server

CREATE FUNCTION [dbo].[GetDatesInBetween](@FromDate DATETIME, @ToDate DATETIME, @IncludeWeekends BIT ) RETURNS @DateTable TABLE(DATE DATETIME) AS BEGIN INSERT INTO @DateTable (DATE) VALUES (@FromDate) WHILE @FromDate < @ToDate BEGIN SELECT @FromDate = DATEADD(D, 1, @FromDate) IF @IncludeWeekends = 1 INSERT INTO @DateTable (DATE) VALUES (@FromDate) ELSE IF DATENAME(dw, @FromDate) <> 'Thursday' AND DATENAME(dw, @FromDate) <> 'Friday' INSERT INTO @DateTable (DATE) VALUES (@FromDate) END RETURN END

Strip/Remove HTML from text in SQL Server

I used the below function, because HTML contents are not fully supported in crystal report. Ref: http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/ http://lazycoders.blogspot.com/2007/06/stripping-html-from-text-in-sql-server.html CREATE FUNCTION [dbo].[StripHTML] ( @HTMLText varchar(MAX) ) RETURNS varchar(MAX) AS BEGIN DECLARE @Start int DECLARE @End int DECLARE @Length int -- Replace the HTML entity & with the '&' character (this needs to be done first, as -- '&' might be double encoded as '&') SET @Start = CHARINDEX('&', @HTMLText) SET @End = @Start + 4 SET @Length = (@End - @Start) + 1 WHILE (@Start > 0 AND @End > 0 AND @Length > 0) BEGIN SET @HTMLText = STUFF(@HTMLText, @Start, @Length, '&') SET @Start = CHARINDEX('&', @HTMLText) SET @End = @Start + 4 SET @Length = (@End - @Start) + 1 END -- Rep

A poem by my Father: A Bridge at Sun

From Dream to Reality The horizon blushed crimson The backwaters sang lullaby To the boats that rocked with the ripples In the lake that bosomed the life around. The island lay in the lap of the lake Waiting for the night to fall over The palm groves that glowed green Grew darker against a painted sky. A wistful dream of the islanders For a bridge that would fill the chasm To hug the city at random Did come true at long last. A bridge spanned across the lake Like an arch that bade welcome Fro all the sons and sisters of the island, To the comforts and warmth of a home. Life shall never be the same Speed shall rule the roads The waters that lulled the pace Shall flow quiet beneath the bridge. The darkness spreads across the waters The city blinks open its umpteen eyes The port, the boats and the ships All glittered in the waves like a sea of stars.. An old man stood on the bank A thousand sparks in his mind Of the quiet journeys in the ferry Of the be

Martin Luther King "I have a dream"

We refuse to believe that the bank of justice is bankrupt. Nineteen sixty-three is not an end, but a beginning. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force. No, no, we are not satisfied, and we will not be satisfied until "justice rolls down like waters, and righteousness like a mighty stream."¹ And so even though we face the difficulties of today and tomorrow, I still have a dream. It is a dream deeply rooted in the American dream. I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident, that all men are created equal ." I have a dream that one day on the re

C# code geneartor stored procedure

Ref: http://www.codeproject.com/KB/database/CSCodeBuilder.aspx CREATE PROCEDURE tools_CS_SPROC_Builder ( @objName nvarchar(100) ) AS SET NOCOUNT ON DECLARE @parameterCount int DECLARE @errMsg varchar(100) DECLARE @parameterAt varchar(1) DECLARE @connName varchar(100) //Change the following variable to the name of your connection instance SET @connName='conn.Connection' SET @parameterAt='' SELECT dbo.sysobjects.name AS ObjName, dbo.sysobjects.xtype AS ObjType, dbo.syscolumns.name AS ColName, dbo.syscolumns.colorder AS ColOrder, dbo.syscolumns.length AS ColLen, dbo.syscolumns.colstat AS ColKey, dbo.systypes.xtype INTO #t_obj FROM dbo.syscolumns INNER JOIN dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.id INNER JOIN dbo.systypes ON dbo.syscolumns.xtype = dbo.systypes.xtype WHERE (dbo.sysobjects.name = @objName) AND (dbo.systypes.status <> 1) ORDER BY dbo.sy

Visual Studio 2005 Crashing in Windows 7 randomly

faulting module craxddrt.dll_unloaded The problem was that when opening my solution, by default it opened the last crystal report that i was working on. This seemed to start some crystal report ActiveX thing that didn’t work on Windows 7. It would always crash, even if i closed the report straight away. To stop this problem was to load up VS, close the report immediately and safely close VS before it got a chance to crash! The next time it opens, there is no crystal report and the ActiveX control never loads. So the next time you save the solution and close visual studio be sure to close all Crystal Reports window Also I installed Service Pack for VS 2005, http://www.microsoft.com/downloads/en/details.aspx?FamilyID=90e2942d-3ad1-4873-a2ee-4acc0aace5b6&displaylang=en

Export responses of sharepoint survey with rating scales to excell sheet

Last day I was not able to export the responses of a sharepoint survey which has multiple rating scale questions. I removed '&' from the questions .I created a new page in the site with single dataview using sharepoint designer. But none of them did not work for me. At last resolved the issue by removing 'tabs' from the questions. It happened when I copied questions from a word document, while I created survey.

Single Responsibility Principle Poster

Just because you can implement all the features in a single device, you shouldn't". Why? Because, it adds lot of manageability problems for you in the long run.

Synchronize data between MS Access and SQL Server database using Linked Server

I used linked server to export data from an access database to Sql server database at regular interval. I feel it is much easier rather than creating a windows service/scheduled job. Add a linked server EXEC sp_addlinkedserver @server = N'AccessDB', @provider = N'Microsoft.Jet.OLEDB.4.0', @srvproduct = N'OLE DB Provider for Jet', @datasrc = N'C:\SourceData.mdb' Set up login EXEC sp_addlinkedsrvlogin @rmtsrvname = N'AccessDB', @useself = N'False', @rmtuser = N'Admin', @rmtpassword = '' Now you can exceute sql statement with this access database. Eg: simple select statement:- SELECT * FROM OPENQUERY(AccessDB,  'SELECT * FROM Order') In my case I wrote an insert statement in side sql job with scheduled time interval.

TIMESTAMP/ROWVERSION and UNIQUEIDENTIFIER in SQL Server

A blog post after very very long gap...... The TIMESTAMP column does not contain any information about date/time . It is not dependent on the system or system date   This is just a binary format string, which denote version of row. This value will be incremented by 1 on every insert/update of the record.   So it can be used for redundancy check on multiple user updating tables ROWVERSION and TIMESTAMP in sql server are exactly same, where as there are some difference with UNIQUEIDENTIFIER.   Size of TIMESTAMP value is 8 bytes whereas size of UNIQUEIDENTIFIER is 16 bytes. TIMESTAMP is not based on system date or time. However, UNIQUEIDENTIFIER value is based on the computer's MAC addresses and system date time. The purpose to TIMESTAMP is to track the operation in tables on the database level. The purpose of UNIQUEIDENTIFIER is to have a unique value assigned to a row (maybe as primary key). It remains unique in any system in the world .