New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: David R. Longnecker
C#
// pseudo: if month(entered) greater than or equal to 7, return year(entered)
// else return year(entered)-1 (for school year conversion)
// returns distinct list of "school years"
 
var criteria = Session.CreateCriteria<MyEntity>();
var convertToSchoolYearProjection = 
Projections.Conditional(
 Restrictions.Ge(
  Projections.SqlFunction("month", 
    NHibernateUtil.Int32, 
by David R. Longnecker   May 21, 2010 @ 7:58am
206 Views
no comments
 
Write-Host $("{0},{1}" -f "Hello", "World") -fore Red
by David R. Longnecker   May 11, 2010 @ 2:05pm
74 Views
no comments
 
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{03B0C811-992E-4C52-A3B9-5084B2CB3A45}"
    ProjectSection(SolutionItems) = preProject
        BuildEvents.txt = BuildEvents.txt
        default.ps1 = default.ps1
        VersionNumber.targets = VersionNumber.targets
    EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Framework.Test", "Framework.Test\Framework.Test.csproj", "{72E82DE7-AEFE-416E-B38B-1BB63296A1F3}"
by David R. Longnecker   April 15, 2010 @ 5:26am
Tags:
44 Views
no comments
 
XML
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Windows Error Reporting" /> 
  <EventID Qualifiers="0">1001</EventID> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2010-02-11T02:06:35.000000000Z" /> 
  <EventRecordID>3305</EventRecordID> 
  <Channel>Application</Channel> 
by David R. Longnecker   February 10, 2010 @ 6:09pm
98 Views
no comments
 
<var columnClass="new [] {'span-11 column', 'span-11 column last' }" />
<div each="var item in o.Items" columnClass="${lastClass[itemIndex%2]}">
 
</div>
by David R. Longnecker   November 30, 2009 @ 2:25pm
102 Views
no comments
 
Original HTML+BluePrintCSS
 
<div id="header" class="container">
    <div id="title" class="span-10">
        <h1>${H(ApplicationName)}</h1>
    </div>
    <div id="logindisplay" class="prepend-8 span-6 last">
        <logOnUserControl />
    </div>
    <div id="menucontainer" class="span-24 last">
by David R. Longnecker   November 20, 2009 @ 8:38am
103 Views
no comments
 
CSS
#header {
    #title {
        .span-10, .column;
    }
    
    #logindisplay {
        .prepend-8, .span-6, .column, .last;
        text-align: right;
    }
    
by David R. Longnecker   November 20, 2009 @ 7:50am
140 Views
4 comments
 
param ([string] $filename)
 
function splitString([string]$string, [int]$length)
{
    $lines = @();
    $stringLength = $string.Length;
    $position = 0;
 
    while ($position -lt $stringLength)
    {
by David R. Longnecker   October 13, 2009 @ 11:00am
322 Views
no comments
 
$path = resolve-path .
$rand = New-Object system.random
$port = $rand.next(2048,10240)
$path_to_devserver = "C:\\Program Files (x86)\\Common Files\\microsoft shared\\DevServer\\9.0\\Webdev.WebServer.exe"
 
& $path_to_devserver /port:$port /path:$path
(new-object -com shell.application).ShellExecute("http:\\localhost:$port")
by David R. Longnecker   September 09, 2009 @ 9:51am
273 Views
no comments
 
properties { 
  
  # ****************  CONFIGURE **************** 
    $solution_name =         "Framework"
    $test_library =         "$solution_name.Test.dll"
  
    $libraries_to_merge =     "antlr3.runtime.dll", `
                    "ajaxcontroltoolkit.dll", `
                    "Castle.DynamicProxy2.dll", `
                    "Castle.Core.dll", `
by David R. Longnecker   September 08, 2009 @ 11:12am
297 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using FluentNHibernate.Automapping;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Xunit;
by David R. Longnecker   September 02, 2009 @ 7:35am
Tags:
133 Views
no comments
 
param (
    [string]$server = ".",
    [string]$instance = $(throw "a database name is required"),
    [string]$query
)
 
[System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") | out-null
$connection = new-object system.data.oracleclient.oracleconnection( `
    "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$server)(PORT=1521)) `
    (CONNECT_DATA=(SERVICE_NAME=$instance)));User Id=USER_ID;Password=PASSWORD;");
by David R. Longnecker   September 01, 2009 @ 5:51am
591 Views
no comments
 
param (
    [string]$server = ".",
      [string]$instance = $(throw "a database name is required"),
    [string]$query
)
 
$connection = new-object system.data.sqlclient.sqlconnection( `
    "Data Source=$server;Initial Catalog=$instance;Integrated Security=SSPI;");
    
$adapter = new-object system.data.sqlclient.sqldataadapter ($query, $connection)
by David R. Longnecker   August 31, 2009 @ 12:07pm
477 Views
2 comments
 
param ([string]$computerName = (gc env:computername))
 
function GetExceptionType($type, $logEvent)
{
 if ($type -ne "Error") { $logEvent.ReplacementStrings[17] }
 else {
        $rx = [regex]"Exception:.([0-9a-zA-Z].+)"
        $matches = $rx.match($logEvent.ReplacementStrings[0])
        $matches.Groups[1].Value
 }
by David R. Longnecker   August 25, 2009 @ 12:53pm
279 Views
no comments
 
function truncate-string([string]$value, [int]$length)
{
    if ($value.Length -gt $length) { $value.Substring(0, $length) }
    else { $value }
}
by David R. Longnecker   August 25, 2009 @ 7:34am
578 Views
no comments
 
param (
    $fileToImport = $(throw "must have a file to import!")
)
$from = "myemail@domain.com"
$smtpServer = "smtp.server"
$logoName = "d:\path_to_embedded_File\logo.jpg"
 
 
#Import-Csv $fileToImport | 
#    select to, htmlContent, AttachmentFileName | 
by David R. Longnecker   August 21, 2009 @ 10:00pm
261 Views
no comments
 
function ReadyEnvironment (
            [string]$sharedDrive, 
            [string]$userName, 
            [string]$computerName)
{
    set-variable tools "$sharedDrive\shared_tools" -scope 1
    set-variable scripts "$sharedDrive\shared_scripts" -scope 1
    set-variable rdpDirectory "$sharedDrive\shared_tools\RDP" -scope 1
    set-variable desktop "C:\Users\$userName\DESKTOP" -scope 1
    Write-Host "Setting environment for $computerName" -foregroundcolor cyan
by David R. Longnecker   August 21, 2009 @ 6:39pm
641 Views
no comments
 
C#
public class ComponentPropertyConvention : IPropertyConvention, IPropertyConventionAcceptance
{
    public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
    {
        criteria.Expect(x => x.EntityType.IsAny(typeof (IndividualInfo), typeof (CompanyInfo), typeof (Address)));
    }
 
    public void Apply(IPropertyInstance instance)
    {
        var name = string.Format("{0}_{1}", instance.EntityType.Name, instance.Property.Name);
by David R. Longnecker   August 19, 2009 @ 7:48pm
117 Views
no comments
 
C#
[Precompile]
   public class WorkoutController : Controller
   {
       public ActionResult Index()
       {
          
               var workouts = new WorkoutRepository().GetAll();
               ViewData["workouts"] = new WorkoutIndexViewModel().Render(workouts);
               return View();
       }
by David R. Longnecker   August 10, 2009 @ 9:09pm
100 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