Friday, October 24, 2014

Wednesday, October 15, 2014

How to check temp table exist in MS SQL Server?

IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL
    DROP TABLE #TempTavle

How to write error information into MS SQL Server log?

DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end

How to check exists file in MS SQL server

DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end

101 Great Answers to the Toughest Interview Questions: Fourth Edition

http://allanjwilson.weebly.com/uploads/1/3/4/0/13401940/101_great_answers_to_the_toughest_interview_questions.pdf

Thursday, October 9, 2014

If url includes Dot/Period, will cause 404 error for ASP.NET routing

Need to change web.config setting at:

<system.webServer>

<modules runAllManagedModulesForAllRequests="true">

<remove name="FormsAuthenticationModule" />

</modules>

</system.webServer>

Enable hotlinking on Bayimg

I made a tool to upload image to bayimg and get raw image url right way:
http://bayimghelper.apphb.com/

But Bayimg blocks hotlinking. So write a function to enable it.
For example:
Original Bayimg link:
http://image.bayimg.com/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg
You can use following to get access this image
http://bayimghelper.apphb.com/i/38ba4e167a8f6ee9dc800b604cb0cfc6663bd720.jpg


The source code is located at:
https://github.com/raysaspnet/bayimghelper

How to prevent image hotlinking in ASP.NET?

In IIS Server by URL rewrite:

http://www.it-notebook.org/iis/article/prevent_hotlinking_url_rewrite.htm

HOW TO DOUBLE YOUR APP DOWNLOADS WITH KEYWORD OPTIMIZATION

http://blog.discofingers.com/blog/2014/10/8/how-to-double-your-downloads-with-keywords-optimization