Sunday, March 11, 2012

How to remove HTML tag

 

Below code remove the HTML tag. It removes HTML tag from your string.

public string RemoveHtmlTag(string html, bool allowHarmlessTags)

{

if (html == null || html == string.Empty)

return string.Empty;

 

if (allowHarmlessTags)

return System.Text.RegularExpressions.Regex.Replace(html, "", string.Empty);

 

return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty);

//return html;

}

 

public string RemoveHtmlTagSearch(string html)

{

if (html == null || html == string.Empty)

return string.Empty;

 

return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty);

 

}

Select random records in SQL

 

If you want random record when you run your query then you can use the below code. It takes new record each time when your run the query.

SELECT TOP 1 * FROM TableName ORDERBY newid()

Kanipakam

 

                                                                                                                                                                                          clip_image002                                                                           clip_image004

 History :Kanipakam (Telugu: కాణిపాకం), is a village located in Irala mandal of Chittoor district, Andhra Pradesh in South India.

The temple was constructed in the early 11th century CE by the Chola king Kulothunga Chola I and was expanded further in 1336 by the Emperors of Vijayanagara dynasty.

"Kani" means wetland and "Pakam" means flow of water into wetland. According to the legend of the temple there were three brothers and each one had a handicap. Viz., Dumb, Deaf and Blind. They were earning out their livelihood by cultivating a small piece of land.

In olden days water was drawn from the well by way of 'Piccota System'. As one of them used to irrigate the field through the channels, the other two used to ply on the Piccota. On one such operation they found that the water in the well got dried up and they could no longer continue their job. One of them got into the well and started digging it up. He was taken aback to see the iron implement hitting a stone like formation.

Later, he was shocked to see blood oozing out from it. Within a few seconds the entire water in the well, turned blood red in colour. Thus, startled by this divine sight, all the three became normal getting rid of their deformities. As soon as the villagers came to know about this miracle, they thronged to the well and tried to deepen the well further. But their attempt proved futile because the 'swayambhu' idol (the self-manifested) of Lord Vinayaka emerged from the swirling waters.

Ultimately they offered many number of coconuts with all prayers- modesty kneeling before the new idol afford "MAGALHARATHI" etc. They declared the ideal of "SWAYAMBHU" and tendered number of coconuts. The coconuts water flowed into the channel to a distance of more than one and a quarter acres. The indication of this led to the modification in the usage of the Tamil word "KANIPARAKAM" and later pronounced as KANIPAKAM. Even today the idol is in the original well and the springs of the well are perennial and the eternal. During the rainy season, the holy water from the well overflows even today.

clip_image006   

Another striking and strange feature of the idol is that it is still growing in size. At present, we can see the knees and the abdomen of the idol. Smt. Lakshmamma, an ardent devotee had offered a 'Kavacham' (Armour) to the Lord, fifty years ago but today it is out of size and doesn't fit the idol. The holy water from the well is offered to the devotees as theertham.

The legend behind Bahuda River Long ago there lived two brothers Sankha and Likhita. They were on a pilgrimage to Kanipakam. As the journey was tiring, the younger brother Likhita felt hungry. Disregarding the advice of the elder brother he plucked a mango from the mango grove. Sankha felt bad and reported this to the ruler of that area and pleaded for punishment for the sin committed during the pilgrimage. Thus Likhita was punished severely being deprived of both arms.

Later they took bath in the river near Kanipakam temple. Lo Behold! The chopped arms were restored to Likhita as soon as he had a dip in the sacred waters of the river. These incidents lead the ruler to rename the river as 'Bahuda' (Bahu means human arm). Thus the river beside Kanipakam temple is now known as 'Bahuda River'.

Sri Varasiddhi Vinayaka as up-holder of 'Truth' The swayambhu idol of Kanipakam is the up-holder of truth. Day to day disputes between people is resolved by taking a 'special oath'. The people in the dispute take a holy dip in the temple tank and swear before the lord. It is taken as gospel truth.

There are instances when the person who committed that sin voluntarily agrees as soon as he had the dip and much before entering the temple itself. It seems the Lord lawns invisibly on the sinner and makes him repent and feel guilty for his sinful deeds.

Thus the glory of Sri Varasiddhi Vinayaka spread far and wide and the honorable courts uphold the 'special oath' in their judicial pronouncements.

 

The Temple

The swayambhu idol of Kanipakam known as the up-holder of truth. Disputes are solved between people is resolved by taking a 'special oath'. The people in the dispute take a holy dip in the temple tank and swear before the lord. It is taken as gospel truth.

There are instances when the person who committed that sin voluntarily agrees as soon as he had the dip and much before entering the temple itself. It seems the Lord lawns invisibly on the sinner and makes him repent and feel guilty for his sinful deeds.

clip_image008

Bramhostavams and Utsavams

Bramhostavam is held in Kanipakam for Lord Sri Varasiddhi Vinayaka every year. It starts from Vinayaka chavithi and goes on for 20 days. The Utsavamurthi (Festive idol) is taken out in procession into town different Vahanams.

The annual Brahmotsavam commences from Ganesh Chaturthi. It goes on for 20 days with all traditional pomp and gaiety. The utsavamurthi (Festive idol) is taken out in procession on all the days colourfully decked on different vahanams (Carriages). The soulful participation of the devotees is praise worthy. The float festival attracts pilgrims from all over the country.

Below are the Different Appearances of God. Dwagarohanam, Gramotsavam, Hamsa Vahanam, Peacock Vahanam, Mooshika Vahanam, Shasha Vahanam, Vrishabha Vahanam, Gaja Vahanam, Rathotsavam(Chairot), Thiru Kalyanam and Vadayathu Utsavam.

Morning Abishekam is performed on all the days of Bramhostavam.

Hamsa Vahanam, around 6-7 P.M when Star Chitta enters Kanya lagnam.

The list of Vahanams in the Order:

Special Utsavams, Adhikara Nandi Vahanam, Ravana Bhramha, Yali Vahanam, Surya Prabha, Chandra Prabha, Kamadhenu Vahanam, Poling Seva, Kalpvriksha Vahanam, Puspha Pallaki and Vimanotsavam

 

 

 

How to execute query in stored procedures

 

Sometimes developer write custom query in stored procedures and wants to execute that query into the stored procedure the best method to do this is the below one. First you create your query and then execute that query using EXEC sp_executesql. It would give you result

 

DECLARE @@strQuery NVARCHAR(200)

SET @@strQuery = 'SELECT * FROM TABLE_NAME'

EXEC sp_executesql @@strQuery

 

Always use ntext/nchar/nvarchar data type

How do I check JavaScript is Enable or Disable

 

You can use the below code to check whether JavaScript is enable in client machine or not.

Suppose you have two pages

1. test.htm

2. noscript.htm (to show message)

Put below code in your test.htm page if javascript is disable in client machine then test.htm does not open and it redirects to noscript.htm. At noscript.htm you can show the message that your javascript is not enable like this

<noscript>

<meta http-equiv="REFRESH"content="0;URL="noscript.htm">

</noscript>

Above is the easy way to check whether JavaScript is enable on client machine or not

How to find duplicates rows in SQL


Suppose you have a table that contains duplicate data and you want to find duplicate data. To find duplicate data use the below code

SELECT *
FROM
TableName
WHERE ID NOT
IN
(
     SELECT MAX(ID
)
FROM TableName
     GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3
)

It finds the duplicates rows, the table must have an identity column, Here ID is the identity column which is used to find the duplicates rows. These are the duplicates columns DuplicateColumn1, DuplicateColumn2, DuplicateColumn3
To delete duplicate rows simply change the SELECT to Delete the code look like this. Run the below query to delete duplicates rows

DELETE
FROM
TableName
WHERE ID NOT
IN
(
     SELECT MAX(ID
)
FROM TableName
     GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3
)
If you don't have Identity column then use the below code
SELECT Column_Name1,Column_Name2, COUNT(*)
FROM TableName
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3
HAVING COUNT(*) > 1