Skip to content

Instantly share code, notes, and snippets.

@breezhang
breezhang / boot.cs
Created September 10, 2012 00:14
NB handle session life style management
//======better using IOC framework ===========================
//=======================================AssemblyInfo.cs================
[assembly: PreApplicationStartMethod(typeof(MvcAppNB2.Booter.PreApplicationStartCode), "Start")]
//========================================booter.cs=====================
public class PreApplicationStartCode
{
public static void Start()
{
// Register our module
@breezhang
breezhang / cte no cte.sql
Created September 23, 2012 04:56
child and parent
-- just a demo
-- understand child and parent relationship in one table
-- Robert Sheldon http://www.simple-talk.com/sql/t-sql-programming/sql-server-cte-basics/
USE test
GO
IF OBJECT_ID('Employees', 'U') IS NOT NULL
DROP TABLE dbo.Employees
GO
@breezhang
breezhang / simple table.sql
Created September 24, 2012 00:58
debug using cte is good
WITH xxxx(a,b,c) AS (
SELECT 0,'a',GETDATE()
UNION ALL
SELECT 1,'b',GETDATE()
UNION ALL
SELECT 2,'c',GETDATE()
)
SELECT * FROM xxxx
go
@breezhang
breezhang / SOP
Created September 25, 2012 02:54
Free-up Disk Space
--don't touch %windir%/WinSxS just one code you can do "dism /online /cleanup-image /spsuperseded"
-- cut out some stuff from drive c: to other driver then use mklink repair link
-- can vssadmin delete shadows /for=c: /all
-- cclear can do much
-- total reduce 5G space haha
@breezhang
breezhang / Number.sql
Created September 27, 2012 13:32
Number Table
IF OBJECT_ID('Number') IS NULL
BEGIN
CREATE TABLE Number (
N INT CONSTRAINT Number_PK PRIMARY KEY CLUSTERED(N)
);
WITH
L0 AS(SELECT 1 AS C UNION ALL SELECT 1 AS O), -- 2 rows
L1 AS(SELECT 1 AS C FROM L0 AS A CROSS JOIN L0 AS B), -- 4 rows
L2 AS(SELECT 1 AS C FROM L1 AS A CROSS JOIN L1 AS B), -- 16 rows
@breezhang
breezhang / sop
Created September 29, 2012 00:38
Download Northwind and Pubs from Microsoft for SQL 2005
play demo
http://www.microsoft.com/downloads/details.aspx?FamilyId=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en
/*
*/
int Main () {
printf("=================",a,b,c,d);
return 0;
}
@breezhang
breezhang / Test.cs
Last active December 10, 2015 16:28
xunit
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Xunit;
using Xunit.Sdk;
namespace demo.staticevent
@breezhang
breezhang / app.config
Last active December 10, 2015 16:28
test
s<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
@breezhang
breezhang / console.cs
Created January 6, 2013 06:32
how to .net gui app interaction command line programs
using System.Diagnostics;
using System.Text;
using System.Threading;
using Xunit;
//detail see
//http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ea8b0fd5-a660-46f9-9dcb-d525cc22dcbd/
//Check out ProcessStartInfo.CreateNoWindow
//http://www.codeproject.com/Articles/170017/Solving-Problems-of-Monitoring-Standard-Output-and
//