array (6) atom (4) CSV (2) Data (4) JSON (4) SQL Server (2) T-SQL (1) XLinq (3) XML (6)

Snippets in category Data

  • Array shuffle

    Shuffle an array

    27 people like this
    Posted: 1 years ago by Laurent

  • Minimal XML DSL

    This snippet provides a very small internal DSL for creating and querying XML using the underlying XLinq classes.

    230 people like this
    Posted: 1 years ago by Blake Coverett

  • Convert an object to json, and json to object

    There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...

    40 people like this
    Posted: 1 years ago by Tuomas Hietanen

  • Clojure's Atoms

    Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics

    17 people like this
    Posted: 1 years ago by Nick Palladinos

  • Clojure's Atoms

    Clojure's Atoms are ref like structures, with the addition of (Compare And Swap) update semantics

    16 people like this
    Posted: 1 years ago by Nick Palladinos

  • Quote SQL Server identifiers

    Quotes SQL Server identifiers. Handles embedded quotes.

    1 people like this
    Posted: 1 years ago by Daniel Robinson

  • A Clojure inspired (race free) memoize function

    A Clojure inspired (race free) memoize function, that uses a mutable atom cell.

    17 people like this
    Posted: 1 years ago by Nick Palladinos

  • get the list of LAN Sql servers

    get the list of ethernet sql servers

    46 people like this
    Posted: 1 years ago by nCdy

  • reference to array element

    Nice thing you can do in F# that you can't do in C#, pulling a reference to an array element as a local var.

    18 people like this
    Posted: 1 years ago by fholm

  • Functional XML Construction and Query

    This snippet shows how to construct and query XML using XLinq without too many helper functions.

    17 people like this
    Posted: 1 years ago by Taha Hachana

  • Dumping record type sequence to file

    Easy dump of record type sequence to file

    17 people like this
    Posted: 1 years ago by Chief Inspector Clouseau

  • Manage Variable Length Dictionary Entries

    Populate and displaythe contents of a dictionary with a variable number of nested records - useful if you want to store and retrieve an arbitrary set of data from a database or other data source

    2 people like this
    Posted: 1 years ago by Brendan Campbell

  • CSV reader

    I've modified the CSV sample from Expert F# to my needs. I don't wann be forced to use the csv schema as defined by column rows. Therefore I've done two major modifications. 1. remove the permutation 2. added a new column name option to the ColumnAttribute 3. added a name to csv index mapping So basically you now have 3 options. 1. Don't annotate your record at all and use it as POCO. The order of the record fields is mapped directly to the order in the csv. UPDATE: I don't recommend this any more. As of the writing of this snippet I wasn't aware of the fact, that field order isn't guaranted by the reflection mechanism. 2. Use the index option of the ColumnAttribute. Same as before. 3. Use the name option. This is what I've looked for. I've to deal with tons of csv that has more columns I'm interested in. Have a look at the sample usage below. I've moved the type conversion out of the CsvReader class in order to be easyly expandable with custom type conversation (i.e. for combined column values - denormalized data)

    4 people like this
    Posted: 1 years ago by Rainer Schuster

  • CSV writer

    A simple CSV writer implementation as two type extensions for the Seq module. Use it with Records, Classes and Tuples. Have a look at the modified CSV reader sample from Don Symes Expert F# too http://fssnip.net/3T in order to advance this snippet using the ColumnAttribute

    3 people like this
    Posted: 1 years ago by Rainer Schuster

  • Circular queue

    A circular queue implemented over an array.

    3 people like this
    Posted: 8 months ago by Johann Deneux

  • csproj-file parsing with Linq2Xml

    This program reads all *.csproj-files from a path and then uses Linq2Xml to show data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.

    6 people like this
    Posted: 7 months ago by Tuomas Hietanen

  • JSON Parser

    JSON Parser using Regular Expressions & Active Patterns (just for fun).

    5 people like this
    Posted: 7 months ago by Phillip Trelford

  • Copy-set an array

    Copy an array into a new one, changing the value at index 42 to 123. Uses "function" and pattern patching.

    0 people like this
    Posted: 6 months ago by Johann Deneux

  • LINQ to SQLite

    Simplest possible sample code for accessing an in-process SQLite database file using LINQ The code does not use a dbml file for the mapping, but an attribute enriched type. (F# script, .Net 4.0, F# 2.0)

    6 people like this
    Posted: 6 months ago by Dirk Devriendt

  • Light XML DSL

    A light domain specific language for declaring xml in F# as code.

    4 people like this
    Posted: 5 months ago by Huw Simpson

  • Random Subset

    A function that takes a random subset from a seq<'T>.

    0 people like this
    Posted: 5 months ago by Taha Hachana

  • Using units of measure for safe array access

    A typical problem when working with arrays and indices is that it's easy to access an array with the wrong index. Units of measure in F# can be applied to integers, which makes it possible to abuse them to prevent this kind of error.

    6 people like this
    Posted: 4 months ago by Johann Deneux

  • Simple sql command helper

    Minimalist assistant to read data / execute database command.

    4 people like this
    Posted: 3 months ago by S. Kasperovich

  • Stackoverflow API script

    A script that consumes the Stackoverflow API in a dynamic fashion

    5 people like this
    Posted: 3 months ago by Mauricio Scheffer

  • csproj-file parsing with Linq2Xml - part 2

    This program reads all *.csproj-files from a path and then uses Linq2Xml to show or modify data about the projects. This should be a good template for scripts to manage tons of c#-project files. F# and LINQ-to-XML is very powerful combination.

    7 people like this
    Posted: 2 months ago by Tuomas Hietanen

  • Lazy Xml

    A Lazy Xml structure for processing large xml documents.

    6 people like this
    Posted: 1 months ago by Nick Palladinos

  • Lightweight syntax for creating JSon objects using Newtonsoft's Json.Net

    There's an easy way to create JSon objects using Newtonsoft's Json.Net. The common problem with Json.Net is that there's usualy a lot of overhead when creating Json with it as there're a lot of 'new', parentheses, nested objects when we don't need them. And it becomes annoying quite fast. DU Json and toJson function allow to create Json tree and convert it to Json.Net JObject hierarchy. On the examples the usage of lightweight syntax doesn't give a lot of win but it will be more clearer when it come to more complicated objects.

    4 people like this
    Posted: 1 months ago by Dmitry Lobanov

  • Monadic transactions for Clojure-style atoms

    This is a simple implementation of a monadic transaction builder for Clojure-style atoms. Based on original code by Nick Palladinos.

    10 people like this
    Posted: 1 months ago by Eirik Tsarpalis