F# Weekly #21, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • genit – A cross-platform website generator and server using F#, Suave and PostgreSQL.
  • FSharp.Data.GraphQL – FSharp implementation of Facebook GraphQL query language
  • Atropos -machine learning models in F#
  • fable-hotload – Code from Getting-Started-with-Fable-and-Webpack by Krzysztof Cieslak (F# transpiled to JS with Fable compiler). Webpack devserver, hotload etc included

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #20Subscribe

F# Weekly #20, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • FSharp.AspNetCore.Examples – Example of AspNetCore Running on Kestrel all inside a Windows Service
  • FSharp.Control.FusionTasks – F# Async computation <–> .NET Task an easy seamless interoperability library
  • quickjump – EasyMotion clone for MonoDevelop and Xamarin Studio 6.0 and higher
  • FsActorApp – Updated: Service fabric reliable actor app in F#
  • IfSharp – Jupiter notebook integration for F#

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #19Subscribe

F# Weekly #19, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • hlsl.typeprovider – F# type provider for HLSL shaders
  • FsMap3 – A Function Library for Procedural 3-D Textures
  • Endorphin.Core – Infrastructure for scientific instrument control in F#
  • fsharp-data-processing-pipeline – Provides an extensible solution for creating Data Processing Pipelines in F#.
  • AIFAD – Automated Induction of Functions over Algebraic Data Types

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #17-#18Subscribe

Google Cloud Vision API from .NET\F# (OAuth2 with ServiceAccount.json)

Google Cloud Platform provides a wide range of APIs, one of which is Cloud Vision API that allows you to detect faces in images, extract sentiments, detect landmark, OCR and etc.

One of available annotators is “Logo Detection” that allows you to find company logo in your image and recognize it.

.NET is not the part of mainstream Google Cloud SDK. Google maintains google-api-dotnet-client that should allow you to authenticate to and call all available services. API design looks slightly not intuitive for .NET world (at least from my point of view).

I spent some time on Google/SO/Github trying to understand how to use OAuth2 in server-to-server authentication scenario with ServiceAccount.json file generated by Google API Manager.

s2s

You cannot use this API without billing account, so you have to put your credit card info, if you want to play with this API.

Also, note that you need to have two NuGet packages Google.Apis.Vision.v1Google.Apis.Oauth2.v2 (and a lot of their dependencies)

So, here is the full sample:

#I __SOURCE_DIRECTORY__
#load "Scripts/load-references-debug.fsx"

open System.IO
open Google.Apis.Auth.OAuth2
open Google.Apis.Services
open Google.Apis.Vision.v1
open Google.Apis.Vision.v1.Data

// OAuth2 authentication using service account JSON file
let credentials =
    let jsonServiceAccount = @"d:\ServiceAccount.json"
    use stream = new FileStream(jsonServiceAccount, 
                         FileMode.Open, FileAccess.Read)
    GoogleCredential.FromStream(stream)
        .CreateScoped(VisionService.Scope.CloudPlatform)

let visionService = // Google Cloud Vision Service
    BaseClientService.Initializer(
        ApplicationName = "my-cool-app",
        HttpClientInitializer = credentials)
    |> VisionService

// Logo detection request for one image
let createRequest content = 
  let wrap (xs:'a list) = System.Collections.Generic.List(xs)
  BatchAnnotateImagesRequest(
    Requests = wrap
      [AnnotateImageRequest(
        Features = wrap [Feature(Type = "LOGO_DETECTION")],
        Image = Image(Content = content))
      ])
  |> visionService.Images.Annotate


let call fileName = // Call and interpret results
    let request =
        File.ReadAllBytes fileName
        |> System.Convert.ToBase64String
        |> createRequest
    let response = request.Execute()

    [ for x in response.Responses do
        for y in x.LogoAnnotations do
          yield y.Description
    ] |> List.toArray


let x = call "D:\\fsharp256.png"
// val x : string [] = [|"F#"|]

F# Weekly #17-18, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • higher – A lightweight library of abstractions for Higher-kinded programming in F#
  • LibAAS – Another sample project showing event sourcing in F#
  • fantomas – FSharp source code formatter
  • azure-fsharp-helpers – A set of files which help provide better support for Azure with a number of F# projects.
  • AkkaSftpWorkshop.Tasks – Tasks for workshop exploring use of Akka.NET and F# to implement FTP file distribution.
  • Kaggle.HomeDepot – F# datascience code from the Home Deport Kaggle competition
  • Imms – High Performance, Immutable Data Structures for .NET
  • JoinCML – A research project to create an extension of CML with a join combinator.
  • xlamx – Lambda calc stepper for mobile devices
  • FSharp.Data.GraphQL – FSharp implementation of Facebook GraphQL query language

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #16Subscribe

F# Weekly #16, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • pomodorowin – Pomodoro Timer that integrates with Lync
  • mitls-fstar – TLS implemented in F*
  • fszmq – An F# binding for the ZeroMQ distributed computing library
  • BranchDocuments – Command line utility for saving and restoring Visual Studio document window layouts across different Git branches.
  • FSharpApiSearch – F# API search engine

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #15Subscribe

F# Weekly #15, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #14Subscribe

FsShelter: a Storm shell for F#

I think, therefore I spam.

About a year ago Prolucid adopted Apache Storm as our platform of choice for event stream processing and F# as our language of choice for all of our “cloud” development.

FsStorm was an essential part that let us iterate, scale and deliver quickly, but even from the earliest days it was obvious that the developer experience could be improved. Unfortunately, it meant a complete rewrite of FsStorm:

  • FsStorm DSL is a really thin layer on top of Nimbus API model:
    • has explicit IDs when describing components in a topology
    • uses strings in all the names
    • matching of inputs/outputs is not guaranteed
  • FsStorm uses Json AST as it’s public API:
    • messages, tuples, configuration
    • serialization mechanism is hard-baked into the API

We’ve worked around some of the problems, usually by writing more code.

It actually makes sense that Storm itself doesn’t care about the type of the tuples/fields. It runs on JVM, which is very much typed…

View original post 220 more words

F# Weekly #14, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

New Releases

That’s all for now. Have a great week.

Previous F# Weekly edition – #13Subscribe