Format:
Recent snippets for: Robert.Eberhart
# SetVersion.ps1 # # Set the version in all the AssemblyInfo.cs or AssemblyInfo.vb files in any subdirectory. # # usage: # from cmd.exe: # powershell.exe SetVersion.ps1 2.8.3.0 # # from powershell.exe prompt: # .\SetVersion.ps1 2.8.3.0
152 Views
no comments
public static void AddDomainUserToLocalGroup(String domain, String userName, String groupName) { String groupPath = String.Format("WinNT://{0}/{1},group", Environment.MachineName, groupName); DirectoryEntry theGroup = new DirectoryEntry(groupPath); if (theGroup.SchemaClassName != "Group") { throw new ArgumentException("The local group specified doesn't exist."); } String userPath = String.Format("WinNT://{0}/{1},user", domain, userName);
64 Views
no comments
public IList MergeSort(IList list) { if (list.Count <= 1) return list; int mid = list.Count / 2; IList left = new ArrayList(); IList right = new ArrayList();
270 Views
no comments
private static ISessionFactory CreateSessionFactory() { var cfg = new Configuration().Configure("nhibernate.config"); cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionStringName, System.Configuration.ConfigurationManager.ConnectionStrings[System.Environment.MachineName].ConnectionString)); return cfg.BuildSessionFactory(); }
183 Views
no comments
public abstract class EntityBase { private object key; protected EntityBase() : this(null) { } protected EntityBase(object key) { this.key = key; }
139 Views
no comments
/// <summary> /// This is a trivial class that is used to make sure that Equals and GetHashCode /// are properly overloaded with the correct semantics. This is exteremely important /// if you are going to deal with objects outside the current Unit of Work. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TKey"></typeparam> public abstract class EqualityAndHashCodeProvider<T, TKey> where T : EqualityAndHashCodeProvider<T, TKey> {
85 Views
no comments
namespace Northwind { /// <summary> /// A base class for all entities that implements identity equality. /// </summary> /// <typeparam name="TId">The type of the ID.</typeparam> /// <typeparam name="T">The type of the derived class (required for equality)</typeparam> public abstract class EntityBase<TId, T> where T : EntityBase<TId, T> { private TId _id;
223 Views
no comments
private static char[] base26Chars = "abcdefghijklmnopqrstuvwxyz".ToCharArray(); public static string Base26Encode(Int64 value) { string returnValue = null; do { returnValue = base26Chars[value % 26] + returnValue; value /= 26; } while (value-- != 0); return returnValue;
196 Views
no comments
private LinkedList<Element>MergeSort(LinkedList<Element> linkedList, string sortType) { if (linkedList.Count <= 1){ return linkedList; } LinkedList<Element> left, right, result; int middle = linkedList.Count / 2; left = ReturnLinkedListSegment(0, middle, linkedList);
161 Views
no comments
$newVirtualDirectory = $args[0] $physicalPath = $args[1] # gets the IIS root object $iis = [ADSI]"IIS://localhost/w3svc/1/root" $vdir = $iis.psbase.children | where {$_.AppRoot -eq ('/LM/W3SVC/1/Root/' + $newVirtualDirectory)} # Check to see if the virtual directory exists if (!$vdir) {
237 Views
no comments
$(function() {
$('input [id$btnSort]').click(
function(e) {
e.preventDefault();
var sortedDdl = $.makeArray($('select[id$=DDL]option'))
.sort(function() {
return #(0).text() < $(n).text ? -1 : 1;
}
);
183 Views
no comments
public static bool operator ==(Region r1, Region r2) { if (object.ReferenceEquals( r1, r2)) { // handles if both are null as well as object identity return true; } if ((object)r1 == null || (object)r2 == null) { return false;
82 Views
1 comments
public static bool IsNullOrWhiteSpace(string value) { if (value != null) { for (int i = 0; i < value.Length; i++)
116 Views
1 comments
SELECT Distinct MenuItemParentID FROM ( select * from MenuItem A where a.MenuItemParentId is not null ) TestTable WHERE not exists( select * from MenuItem TestItems where testItems.MenuItemId = TestTable.MenuItemParentId )
158 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
