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
let (>|>) x f = | |
let timer = new System.Diagnostics.Stopwatch() | |
timer.Start() | |
let r = f x | |
printfn "Elapsed Time: %i" timer.ElapsedMilliseconds | |
r | |
[1..1000] | |
>|> List.map (fun x -> [1..x] |> List.sum) | |
>|> List.max |
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
#r @"packages\NodaTime\lib\net35-Client\NodaTime.dll" | |
open NodaTime | |
SystemClock.Instance.Now | |
let pattern = NodaTime.Text.LocalDateTimePattern.CreateWithInvariantCulture("MM/dd/yyyy HH:mm") | |
pattern.Parse("11/05/2014 21:15") | |
let dt s = DateTime.ParseExact(s, "d/MM/yyyy h:mm:ss tt", CultureInfo.CurrentCulture) |
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
open System | |
open FSharp.Data | |
open System | |
open System.ServiceModel | |
open Microsoft.FSharp.Linq | |
open Microsoft.FSharp.Data.TypeProviders | |
(* execute the following commented stuff only once to get the wsdl, then leave commented | |
(* bit dumb but because service requests authentication, and we can't do that in the wsdlservice tp, we have to download wsdl, load it up locally, set |
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
open System | |
open System.ServiceModel | |
open Microsoft.FSharp.Linq | |
open Microsoft.FSharp.Data.TypeProviders | |
(* bit dumb but because service requests authentication, and we can't do that in the wsdlservice tp, we have to download wsdl, load it up locally, set | |
binding up properly, then use tp *) | |
open System.Net | |
open System.IO | |
open System.Text |
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://blog.oddhead.com/2006/10/30/implementing-hansons-market-maker/ | |
*) | |
open System | |
// --------------------------------------------------- | |
// first off some helper functionality to report messages as events, copied straight off Don Syme's blog: http://blogs.msdn.com/b/dsyme/archive/2010/01/10/async-and-parallel-design-patterns-in-f-reporting-progress-with-events-plus-twitter-sample.aspx |
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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/vs/2009/dgml" version="1.0"> | |
<xsl:output method="xml" indent="yes"/> | |
<xsl:template match="/"> | |
<DirectedGraph> | |
<Nodes> | |
<xsl:apply-templates select="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType" /> | |
</Nodes> | |
<Links> | |
<xsl:apply-templates select="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType" /> |
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
-- T-SQL based sentiment analysis on text following approach in http://dl.dropboxusercontent.com/u/4839225/twitter%20text%20mining%20with%20R.pdf | |
-- with trending over time | |
-- create scoreword table and populate from a list of word scores such as the opinion lexicon listed in http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html | |
CREATE TABLE [ScoreWords]( | |
[word] [varchar](50) NOT NULL, | |
[score] [int] NOT NULL | |
) ON [PRIMARY] | |
-- create a table of stopwords and populate them with a suitable list eg check http://en.wikipedia.org/wiki/Stop_words |
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
#r "System.IO" | |
#r "System.IO.Compression" | |
#r "System.IO.Compression.FileSystem" | |
open System.IO | |
open System.IO.Compression | |
// open up streams from there | |
for entry in Compression.ZipFile.OpenRead(@"c:/temp/test.zip").Entries do | |
printfn "%s" entry.FullName |
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
open System | |
#r @"../packages/FSharp.Data.1.1.10/lib/net40/FSharp.Data.dll" | |
#r @"c:\wd\MathDemo\packages\MathNet.Numerics.2.6.2\lib\net40\MathNet.Numerics.dll" | |
#r "../packages/MathNet.Numerics.FSharp.2.6.0/lib/net40/MathNet.Numerics.FSharp.dll" | |
open MathNet.Numerics.LinearAlgebra | |
open MathNet.Numerics.LinearAlgebra.Double |
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
#r @"C:\wd\AzureTxnUploader\packages\WindowsAzure.Storage.2.0.6.0\lib\net40\Microsoft.WindowsAzure.Storage.dll" | |
#r @"C:\wd\AzureTxnUploader\packages\Microsoft.Data.OData.5.2.0\lib\net40\Microsoft.Data.OData.dll" | |
#r @"C:\wd\AzureTxnUploader\packages\Microsoft.Data.Edm.5.2.0\lib\net40\Microsoft.Data.Edm.dll" | |
#r @"C:\wd\AzureTxnUploader\packages\System.Spatial.5.2.0\lib\net40\System.Spatial.dll" | |
#r "Microsoft.WindowsAzure.ServiceRuntime" | |
open System | |
open Microsoft.WindowsAzure | |
open Microsoft.WindowsAzure.Storage |