This file contains hidden or 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.IO; | |
using System.Xml; | |
using System.Xml.Linq; | |
using System.Xml.Serialization; | |
public static class GenericExtensions | |
{ | |
public static XElement ToXElement<T>(this T obj) | |
{ |
This file contains hidden or 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 Boolean IsValidUSZip(String number) | |
{ | |
String pattern = @"^(\d{5}-\d{4}|\d{5}|\d{9})$"; | |
var match = new Regex(pattern); | |
return match.IsMatch(number); | |
} |
This file contains hidden or 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
declare | |
@CurCount int, @MaxCount int | |
set @CurCount = 0 | |
set @MaxCount = 100000 | |
set nocount on; | |
while 1 = 1 | |
begin | |
This file contains hidden or 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
"\\\\filepath" + | |
(DT_WSTR, 4) YEAR( DATEADD("d", -1, getdate()) ) + | |
( MONTH( DATEADD("d", -1, getdate()) ) < 10 ? "0" : "" ) + (DT_WSTR, 2) MONTH( DATEADD("d", -1, getdate()) ) + | |
( DAY( DATEADD("d", -1, getdate()) ) < 10?"0":"" ) + (DT_WSTR, 2) DAY( DATEADD("d", -1, getdate()) ) + | |
".txt" |
This file contains hidden or 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
create function dbo.fn_HtmlEncode ( | |
@Html as varchar ( max ) | |
) | |
returns varchar ( max ) | |
as | |
/* | |
select dbo.fn_HtmlEncode('<This is a T&st #>') | |
*/ |
This file contains hidden or 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
DECLARE | |
@mon1 MONEY , | |
@mon2 MONEY , | |
@mon3 MONEY , | |
@mon4 MONEY , | |
@num1 DECIMAL ( 19 , 4 ), | |
@num2 DECIMAL ( 19 , 4 ), | |
@num3 DECIMAL ( 19 , 4 ), | |
@num4 DECIMAL ( 19 , 4 ) | |
This file contains hidden or 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.IO; | |
using System.Json; | |
using System.Net; | |
using MonoTouch.Dialog; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
namespace MonoTouch.Dialog.JsonExample |
This file contains hidden or 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
'From http://www.fryan0911.com/2009/05/vbnet-how-to-read-csv-file-into-array.html | |
Imports System.IO | |
Private Sub ReadCSVFileToArray() | |
Dim strfilename As String | |
Dim num_rows As Long | |
Dim num_cols As Long | |
Dim x As Integer | |
Dim y As Integer |
This file contains hidden or 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 override bool FinishedLaunching (UIApplication app, NSDictionary options) | |
{ | |
window.AddSubview (navigationController.View); | |
demoRoot = CreateRoot(String.Empty, String.Empty); | |
controller = new DialogViewController (demoRoot) { | |
Autorotate = true | |
}; | |
navigationController.PushViewController (controller, true); | |
window.MakeKeyAndVisible (); | |
return true; |
This file contains hidden or 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 TwitterSearch | |
{ | |
private const string urlTemplate = "http://search.twitter.com/search.atom?q={0}"; | |
private static XNamespace atomNS = "http://www.w3.org/2005/Atom"; | |
public static List<Tweet> Query(string query) | |
{ | |
XDocument xDoc = XDocument.Load(string.Format(urlTemplate, query)); | |
var tweets = |