Karuta’s ASP & M$ SQLserver

Dicas, códigos e outras coisinhas de meus estudos para não esquecer…

Archive for abril \07\UTC 2010

Zerar Campo ID

Posted by karuta em abril 7, 2010

select * from [tabela]
delete  [tabela]
DBCC CHECKIDENT ([ [tabela]],RESEED, 0)
Anúncios

Posted in sql server, store procedure | Leave a Comment »

Auto-Link String

Posted by karuta em abril 7, 2010

Achei essa ótima função em ASP para criar AUTO-LINKS em strings…. muito usado agora em sites como Twitter:

<%
'*********************************************
'* @TITLE: Regexp Autolink Function
'* @PACKAGE: Simple Classic ASP Twitter API
'* @AUTHOR: Ariel G. Saputra <webmaster@asp.web.id>
'* @DESCRIPTION: function to search and replace url in a text into clickable url
'* @DATE: May 15 2009
'*********************************************
function aspTwitterAutolink(strHtml)
Dim objRegex,strReturn
set objRegex = new regexp
objRegex.Pattern = "(\b(?:(?:https?|ftp|file)://|www\.|ftp\.)(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[A-Z0-9+&@#/%=~_|$]))"
objRegex.IgnoreCase = true
objRegex.Global = true
strReturn = objRegex.Replace(strHtml, "<a href=""$1"" rel = ""nofollow"" target = ""_blank"">$1</a>")
set objRegex = nothing
aspTwitterAutolink = strReturn
end function
%>
<%
Dim strHtml
strHtml = "Just a test HTML text http://www.asp.web.id with valid url, https://php.web.id, regexp turn these links on!"
Response.Write aspTwitterAutolink(strHtml)
%>

<%'*********************************************'* @TITLE: Regexp Autolink Function'* @PACKAGE: Simple Classic ASP Twitter API'* @AUTHOR: Ariel G. Saputra <webmaster@asp.web.id>'* @DESCRIPTION: function to search and replace url in a text into clickable url'* @DATE: May 15 2009'*********************************************function aspTwitterAutolink(strHtml)Dim objRegex,strReturnset objRegex = new regexpobjRegex.Pattern = "(\b(?:(?:https?|ftp|file)://|www\.|ftp\.)(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[A-Z0-9+&@#/%=~_|$]))"objRegex.IgnoreCase = trueobjRegex.Global = truestrReturn = objRegex.Replace(strHtml, "<a href=""$1"" rel = ""nofollow"" target = ""_blank"">$1</a>")set objRegex = nothingaspTwitterAutolink = strReturnend function%>

<%Dim strHtmlstrHtml = "Just a test HTML text http://www.asp.web.id with valid url, https://php.web.id, regexp turn these links on!"Response.Write aspTwitterAutolink(strHtml)%>

Posted in asp | Leave a Comment »