Quantcast
Channel: UH.LEE.KA » Code Snippits
Browsing all 9 articles
Browse latest View live

C# Serialization

Xml Serialization and Binary Serialization to a Base64 string Xml Serialization Snippit: Take a serializable object and serialize it into an xml string, stored in a System.Text.StringBuilder...

View Article



Generic List to DataTable using Reflection

The following function takes in a System.Collections.Generic.List<T> and returns a System.Data.DataTable with the properties (via reflection) of T as columns. public static System.Data.DataTable...

View Article

Less than percent colon – code render blocks in ASP.NET

ASP.NET 4.0 introduces the following code render block syntax: <%: YourOutput() %> The search terms “less than percent colon” and “less than percentage colon” did not turn up anything for me in...

View Article

C# Thread.Sleep(TimeSpan) to Run Every 10 minutes

Based on truncating a DateTime to the second in C# while preserving the “Kind” (Local, UTC, Undefined): dateTime = dateTime.AddTicks( - (dateTime.Ticks % TimeSpan.TicksPerSecond)); Thread.Sleep until...

View Article

C# Hash String to Hexadecimal String

Outputs a 40 character hexadecimal hash string using the MD5 algorithm. private string ToHash(string source) { byte[] bytes; char[] c; byte b; //using (SHA1 m = new...

View Article


SharePoint 2010 SPSecurity.RunWithElevatedPrivileges HandleAccessDenied

The Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges method enables you to supply a delegate that runs a subset of code in the context of an account with higher privileges than the current...

View Article

Git Sparse Checkout

From the root of your local git repo: $ git config core.sparsecheckout true $ echo a_directory_i_want_to_include/ > .git/info/sparse-checkout $ echo another_directory_i_want_to_include/ >>...

View Article

SharePoint 2010 PowerShell snippit for deleting all items in a list

$SPAssignment = Start-SPAssignment; $SPWeb = Get-SPWeb https://my.sharepoint.site.com -AssignmentCollection $SPAssignment; $items = $SPWeb.Lists["My List to Delete All Items"].Items;...

View Article


PerformancePoint Dashboard Render Callback

Doing some JIT branding on a SharePoint 2010 site with bootstrap v2, I needed a way to determine when the PerformancePoint elements on a dashboard had finished loading. PerformancePoint has a problem...

View Article

Browsing all 9 articles
Browse latest View live




Latest Images