Skip to content

Instantly share code, notes, and snippets.

public class TestController : Controller
{
public string ViewThis()
{
return "Test, Dennis";
}
}
//using default routes from Empty MVC2 Web Application, http://localhost:xxxxx/Test/ViewThis should return just that text
SELECT UserLogin, FirstName, LastName
FROM Users
LEFT OUTER JOIN
(
SELECT UserID
FROM UserPropertyValues
WHERE PropertyValueID IN (@PropertyIDs)
GROUP BY UserID
HAVING COUNT(UserID) =
(
SET NOCOUNT ON
IF OBJECT_ID('tempdb..##INDEXTEMP') IS NOT NULL begin exec sp_executesql N'DROP TABLE ##INDEXTEMP' end
EXEC sp_MSforeachtable
@command1 = N'INSERT INTO ##INDEXTEMP ([name], [rows], [reserved], [data], [index_size], [unused]) exec sp_spaceused ''?'', ''true'';'
, @precommand = N'CREATE TABLE ##INDEXTEMP ([id] int identity(1,1) not null,[name] sysname,[rows] int,[reserved] varchar(20),[data] varchar(20),[index_size] varchar(20),[unused] varchar(20))'
, @postcommand = N'
SELECT
[name], [rows], [reserved], [data], [index_size], [unused]
$server = "localhost"; # The SQL Server instance name
$database = "MyDB"; # The database name
# Load the SMO assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
# Create the SMO objects
$srv = New-Object "Microsoft.SqlServer.Management.SMO.Server" $server;
$db = New-Object ("Microsoft.SqlServer.Management.SMO.Database");
Uri uri = new Uri(url);
Console.WriteLine(uri.GetLeftPart(UriPartial.Path));
Public Class Bootstrapper
Public Shared Sub BootstrapStructureMap()
ObjectFactory.Initialize(AddressOf AutoRegisterStructureMap)
End Sub
Private Shared Sub AutoRegisterStructureMap(ByVal s As IInitializationExpression)
s.Scan(AddressOf ScanAssemblies)
End Sub
DECLARE @sql VARCHAR(255)
SET @sql = 'SELECT Testing FROM @tbl WHERE CONTAINS(*, ''"' + @p0 + '*"'')'
EXEC @sql
<script type="text/javascript">
function redirectToHttps()
{
var httpURL = window.location.hostname + window.location.pathname + window.location.search;
var httpsURL = "https://" + httpURL ;
window.location = httpsURL ;
}
redirectToHttps();
@underwhelmed
underwhelmed / hosts
Created October 20, 2010 14:25
Best Time Saving Method
127.0.0.1 twitter.com
@underwhelmed
underwhelmed / DateTime.cs
Created October 22, 2010 16:12
What's wrong with this method?
public bool IsValidSmallDateTime(DateTime date)
{
return date >= Convert.ToDateTime("1/1/1900") || date <= Convert.ToDateTime("6/6/2079");
}