CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Jon Sagara
 
 
$dbDir = "C:\Dev\MyProject\branches\1.0.0\src\Database\"
$viewsDir = [IO.Path]::Combine($dbDir, "Views")
$functionsDir = [IO.Path]::Combine($dbDir, "Functions")
$sprocsDir = [IO.Path]::Combine($dbDir, "Stored Procedures")
$dbServer = "(local)\SQL2k8"
 
#Write-Host $dbDir
#Write-Host $viewsDir
by Jon Sagara   December 27, 2010 @ 5:43pm
147 Views
no comments
 
# -------------------------------------------------------------------------------------------------
# Pinger.ps1
#
# 2011-05-25: moved to gist.github.com
# https://gist.github.com/992625
# -------------------------------------------------------------------------------------------------
by Jon Sagara   December 13, 2010 @ 2:53pm
697 Views
no comments
 
# -------------------------------------------------------------------------------------------------
# InstallUtilPs.ps1
#
# Wrapper around InstallUtil.exe.
# -------------------------------------------------------------------------------------------------
 
# Script params
param([switch]$u) # uninstall
 
$dotNetRuntimeDir = [System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
by Jon Sagara   December 13, 2010 @ 2:50pm
262 Views
no comments
 
C#
public class SqlAppender : AppenderSkeleton
{
    private static readonly string CommandText = "INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)";
 
    public string ConnectionString { get; set; }
 
    protected override void Append(LoggingEvent loggingEvent)
    {
        using (var conn = new SqlConnection(ConnectionString))
        using (var cmd = new SqlCommand(CommandText, conn))
by Jon Sagara   April 25, 2010 @ 1:14am
270 Views
no comments
 
C#
public static void ResizeImage()
{
    using (Bitmap src = new Bitmap(_ImgOriginal))
    {
        int destWidth = (int)(0.5 * src.Width);
        int destHeight = (int)(0.5 * src.Height);
        
        using (Bitmap dest = new Bitmap(destWidth, destHeight))
        using (Graphics gDest = Graphics.FromImage(dest))
        {
by Jon Sagara   January 14, 2010 @ 4:31pm
Tags: c#, gdi+, image, resize
325 Views
no comments
 
C#
// 2010-10-12: Code has moved to http://bitbucket.org/jonsagara/extensionmethods/
by Jon Sagara   November 02, 2009 @ 1:20pm
268 Views
no comments
 
C#
// Update 2010-10-12: This code has been moved to BitBucket:
// http://bitbucket.org/jonsagara/weightedrandom/
by Jon Sagara   October 17, 2009 @ 3:25pm
Tags: c#, statistics
575 Views
no comments
 
C#
using System;
using System.Runtime.InteropServices;
 
 
/// <summary>
/// Class that encapsulates the Win32 function CLSIDFromString.  Idea taken from
/// http://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-throwing-exceptions/287877#287877
/// </summary>
public static class GuidHelper
{
by Jon Sagara   September 22, 2009 @ 9:46pm
Tags: Guid, TryParse, C#, .NET
354 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate