This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void Upload(string ftpServer, string userName, string password, string filename) | |
{ | |
using (System.Net.WebClient client = new System.Net.WebClient()) | |
{ | |
client.Credentials = new System.Net.NetworkCredential(userName, password); | |
client.UploadFile(ftpServer + "/" + new FileInfo(filename).Name, "STOR", filename); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//static for extension.. | |
//this allows us to always make sure we're using our controls on the | |
//thread they were created on, regardless of the thread we're calling from... | |
public static class ISynchronizeInvokeExtensions | |
{ | |
public static void InvokeEx<T>(this T @this, Action<T> action) where T : ISynchronizeInvoke | |
{ | |
if (@this.InvokeRequired) | |
@this.BeginInvoke(action, new object[] { @this }); | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
@echo Stopping SharePoint 2010 services... | |
iisreset /stop /noforce | |
net stop "SharePoint 2010 User Code Host" | |
net stop "SharePoint 2010 Timer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContentDisplayWebPart : ContentByQueryWebPart | |
{ | |
protected override void OnLoad(EventArgs e) | |
{ | |
base.OnLoad(e); | |
string headerlink = "/Style%20Library/XSL%20Style%20Sheets/CustomXsl/______.xsl"; | |
string itemlink = "/Style%20Library/XSL%20Style%20Sheets/CustomXsl/______.xsl"; | |
if (this.HeaderXslLink != headerlink) { this.HeaderXslLink = headerlink; } | |
if (this.ItemXslLink != itemlink) { this.ItemXslLink = itemlink; } | |
if (this.CommonViewFields != (string)HttpContext.Current.Cache[this.Title + "_CommonViewFields"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In SP Header template xslt have you ever noticed the attribute mode | |
<xsl:template name="someTemplateName" match="*[@GroupStyle='someTemplateName']" mode="header"> | |
//well there is another option mode="footer" now by default it isnt hooked up so you need to copy CallHeaderTemplate or modify CallFooterTemplate to the following: | |
<xsl:template name="OuterTemplate.CallFooterTemplate"> | |
<xsl:value-of disable-output-escaping="yes" select="$EndList" /> | |
<xsl:apply-templates select="." mode="footer"> | |
</xsl:apply-templates> | |
<xsl:value-of disable-output-escaping="yes" select="$EndListItem" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First you define some data. This will be the data that will define how one player differs to another. | |
class PlayerDetails { | |
var TotalHP : float = 100.0; | |
var HP : float = 100.0; | |
var EXP : int = 0; | |
var jumpSpeed:float = 8.0; | |
var runSpeed:float = 5.0; | |
var attackSpeed: float = 1.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Behavior | |
{ | |
//Branch | |
public static Action Selector(Func<bool> cond, Action ifTrue, Action ifFalse) { | |
return () => { if (cond()) { ifTrue(); } else { ifFalse(); } }; | |
} | |
public static Action Sequencer(Action a, Action b) { | |
return () => { a(); b(); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static double Calculate(double sLatitude,double sLongitude, double eLatitude, | |
double eLongitude) | |
{ | |
var sLatitudeRadians = sLatitude * (Math.PI / 180.0); | |
var sLongitudeRadians = sLongitude * (Math.PI / 180.0); | |
var eLatitudeRadians = eLatitude * (Math.PI / 180.0); | |
var eLongitudeRadians = eLongitude * (Math.PI / 180.0); | |
var dLongitude = eLongitudeRadians - sLongitudeRadians; | |
var dLatitude = eLatitudeRadians - sLatitudeRadians; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
namespace System.Web.Routing | |
{ | |
public class HttpHandlerRoute : IRouteHandler | |
{ | |
private String _virtualPath = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$configType = read-host "Do you wish to create a new farm? (Y/N)" | |
if ($ConfigType -eq "N") { | |
$DatabaseServer = read-host "Preparing to join existing farm. Please specify the name of your SQL Server"; | |
$ConfigDB = read-host "Next, specify the name of your Farm Configuration Database"; | |
$Passphrase = read-host "Finally, please enter your Farm passphrase" -assecurestring | |
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) { | |
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue; | |
} |
OlderNewer