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

https://twitter.com/dsyme/status/728629457154654210

  • 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#

Eugene Tolmachev's avatarI 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

F# Weekly #13, 2016

Welcome to F# Weekly,

A roundup of F# content from this past week:

News

Videos/Presentations

Blogs

F# vNext

Open source projects

  • Fakta – A Consul + Vault F# library
  • generator-suave-microservice – Yeoman generator for Suave (Micro)Services.
  • ServiceFabricSuaveStateful – Sample of stateful and stateless Service Fabric services with Suave and NetMQ
  • Infers – A library for deriving F# values from their types and, in a way, a direct application of the Curry-Howard correspondence aka Propositions as Types.
  • Logibit.Hawk – An F# Hawk implementation with a strongly typed API that guides your usage and minimises security programming errors.
  • fsharp-demonstrator – A sample server-side web app with support to run in the Azure App Service
  • hype – Compositional Machine Learning and Hyperparameter Optimization

New Releases

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

Previous F# Weekly edition – #12Subscribe

About JavaScript memory leaks. Again.

Worth to read, at least, if you are not JS dev

Anton Gorbikov's avatarAnton Gorbikov's Blog

Web applications are getting more and more complex from year to year. Couple of years ago nobody cared about the memory leaks on the web pages (yeah, they were really a set of web pages, but not web applications). Even if you forget to clean up some memory – it’s not expected, that user will spend a lot of time on the same page. There were a lot of navigation links, which removed information about the entire page from memory and loaded new page.

But now you cannot relate on this behavior, because now web sites turned into web applications. User loads one small HTML file, one script file and some other stuff (like CSS and images) and that’s it. Making requests from browser to servers user can stay on on the “page” for ages. In the worst scenario you will receive a report from production user: “Oh, your application…

View original post 2,020 more words