Friday

call webservice from sql function

here is function allowing you to do so:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[Call_WebService] (@inId AS VARCHAR(50))
RETURNS XML
AS BEGIN

DECLARE @Object AS INT ;
DECLARE @ResponseText AS VARCHAR(8000) ;
DECLARE @Url AS VARCHAR(MAX) ;

SELECT @Url = 'http://myserver/CCRequestProxy.aspx?RequestID=' + @inId

EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT ;
EXEC sp_OAMethod @Object, 'open', NULL, 'get', @Url, 'false'
EXEC sp_OAMethod @Object, 'send'
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
EXEC sp_OADestroy @Object
EXEC sp_OAStop ;


--load into Xml
DECLARE @XmlResponse AS XML ;
SELECT @XmlResponse = CAST(@ResponseText AS XML)
RETURN @XmlResponse

END

disable cache on asp page

add following instruction on top of the page
<%@ OutputCache Location="None" VaryByParam="None" %>

Thursday

Relevance in Fulltext Search

Create Fulltext index first:
CREATE FULLTEXT INDEX indx_text
ON attachment (text)

Add relevance field for select:
SELECT MATCH('text') AGAINST ('financial') as Relevance FROM attachment WHERE MATCH
('text ') AGAINST('+financial +bank' IN
BOOLEAN MODE) HAVING Relevance > 0.2 ORDER
BY Relevance DESC

full search documentation

SQL update with join : update table with count from another table

let's say we have two tables connected like this:
SELECT a.saved_list_id, COUNT(b.saved_list_entry_id)
FROM saved_list a
LEFT OUTER JOIN saved_list_entry b ON (a.saved_list_id = b.saved_list_id)
GROUP BY a.saved_list_id;

so update will be looking like follows:
update saved_list p JOIN saved_list_entry c ON p.saved_list_id = c.saved_list_id
SET p.`number_entries` = (SELECT count(saved_list_entry_id) as number_entries
FROM saved_list_entry c where c.saved_list_id = p.saved_list_id)

Monday

Team Foundation Server (TFS) - How to see history of whole project or see last changed files

How to see history of whole project in Team Foundation Server (TFS) or see last changed files:
-Locate Team Foundation Server Client -tf.exe file, usually located into
"c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\TF.exe"
-Run this from console inside project:
"c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\TF.exe" history /recursive *
it will return list of changesets,click on changeset to view list of files

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...