7sharp9's blog
A cup of tea would restore my normality. - Douglas Adams
agents ast async concurrency csharp elixir elm fable fsharp functional-programming fuse games ios javascript mac mailboxprocessor metaprogramming microsoft mono monodevelop monogame monotouch myriad performance quotations running sockets threading tpl tpl-dataflow typeproviders videos xamarin youtube

© 2011 - 2020 7sharp9

Powered by Hugo with theme Dream.

Monster Zero - Revisited

Monster Zero - Revisited

Wednesday, Jun 5, 2013

@ 7sharp9

This creature is capable of tremendous destruction due to it’s size, flight (with the creature’s wings also generating hurricane strength winds) and possesses several breath weapons (e.g., heat and energy). What am I talking about here? Maybe it’s Monster Zero or King Ghidorah as it’s sometimes known. No it’s TPL Dataflow! Yeah, yeah, I have a penchant for being over dramatic and writing quirky intros. This post is about TPL Dataflow otherwise known as TDF.
I node something (Bout You)

I node something (Bout You)

Sunday, May 5, 2013

@ 7sharp9

What is Edge.js? Unless you live in a hole you have probably heard of node.js so I’ll not bother to explain what it is or what it does. An interesting project has come to light lately, namely Edge.js. The Edge.js project allows you to connect node.js with .Net. The creator of Edge.js Tomasz Janczuk sums this up nicely: An edge connects two nodes This edge connects node.js with .
iOS async revisited

iOS async revisited

Thursday, Apr 18, 2013

@ 7sharp9

In this post weare going to look as async again, but from the perspective of F#. Xamarin Evolve 2013 I have been watching the Xamarin Evolve conference this week and it was good to see Miguel announce full support for F#. Those that follow me on twitter etc, will know that I have been doing F# for quite a while in MonoDevelop and Xamarin Studio. The new support currently entails some new project templates so that you can easily create epic new F# Apps without having to refer to my blog.
A little bit of iOS async

A little bit of iOS async

Tuesday, Apr 16, 2013

@ 7sharp9

I was going to title this post as ‘Now for something completely different’ but felt that a little bit too Pythonesque, and when I thought about it a bit it isn’t really completely just slightly different, namely C# rather than my usual F# posts. Right, enough of the waffling, this post is a little tour into the relatively unknown area of async on iOS. Xamarin announced the alpha preview of async await on March 11th this year (2013).
The Lurking Horror

The Lurking Horror

Sunday, Jul 15, 2012

@ 7sharp9

Deep in the darkest depths lurks an ancient horror, when the time is right it will rise forth and leave you screaming for mercy and begging for forgiveness… OK, I have a penchant for being over dramatic but in this post I am going to reveal some little known caveats in a well known and much revelled area of F#, agents aka the MailboxProcessor. Gasp! First let me give you a demonstration:
Back to the Primitive II

Back to the Primitive II

Sunday, Apr 22, 2012

@ 7sharp9

In the last post I discussed an asynchronous version of the ManualResetEvent and as promised this time we will be looking at an asynchronous version of the AutoResetEvent. I’m using Stephen Toubs post as reference and we will be building a version that is functional in style that maps straight into asynchronous work flows without and conversion or adaptors. What is an AutoResetEvent? An AutoResetEvent can be described as a turnstile mechanism, it lets a single waiting person through before re-latching waiting for the next signal.
Back to the Primitive

Back to the Primitive

Thursday, Apr 12, 2012

@ 7sharp9

In this post we are going back to the primitive. No it’s not about the same named song by Soulfly, (which incidentally does contains F# notes) but a return to thread synchronisation primitives and their asynchronous counterparts. We are going to be looking at an asynchronous version of the ManualResetEvent. This was recently covered by Stephen Toub on the pfx team blog. We will be taking a slightly different view on this as we will be using asynchronous workflows which will give us nice idiomatic usage within F#.
FSharp Dataflow agents III

FSharp Dataflow agents III

Monday, Feb 20, 2012

@ 7sharp9

This will be the last post on rebuilding the MailboxProcessor using TDF, here’s a quick discussion of the missing pieces… First, lets start with the simple ones, these don’t really require much discussion. DefaultTimeout let mutable defaultTimeout = Timeout.Infinite member x.DefaultTimeout with get() = defaultTimeout and set(value) = defaultTimeout <- value This simply provides a mutable property using Timeout.Infinite as a default setting. CurrentQueueLength member x.CurrentQueueLength() = incomingMessages.Count Another simple one, this methods uses into the underlying BufferBlock to extract its current queue length using its Count property.
F# Dataflow Agents Part II

F# Dataflow Agents Part II

Monday, Jan 30, 2012

@ 7sharp9

Right, no messing about this time, straight to the code. Construction This is pretty straight forward and I don’t want to detract from the important bits of this post, the only thing of note is the cancellationToken which is initialized to a default value using the defaultArg function if the optional parameter cancellationToken is not supplied. The TDF construct that we to use to perform most of the hard work is incomingMessages which is a BufferBlock<'Msg>.
F# Dataflow Agents Part I

F# Dataflow Agents Part I

Sunday, Jan 22, 2012

@ 7sharp9

This is going to be a new series on using TPL Dataflow with F#. First a little bit of history and background. TPL Dataflows heritage and background TPL Dataflow or (TDF) has been around for quite a while, it first surfaced more than a year ago as the successor to the Concurrency and Coordination Runtime (CCR) and with coming release of .Net 4.5 it will be part of the System.Threading.Tasks.Dataflow namespace.
Fixing a hole...

Fixing a hole...

Sunday, Dec 11, 2011

@ 7sharp9

Due to popular demand… well, I had a couple of requests anyway :-) Heres a post inspired by my recent encounters profiling some of the code in Fracture-IO. I have recently been profiling the code in fracture to remove any so called low hanging fruits. During this time I also noticed an increase in memory allocation. I remembered I had recently been experimenting in a branch using pipelets as a buffer between the send and receive stages in the Http Server, so I set up a simple test to see if pipelets were contributing to the memory allocation issues I was seeing.
Agent based scheduling

Agent based scheduling

Sunday, Jul 3, 2011

@ 7sharp9

One of the areas that I am very interested in is agents and I have been doing quite a lot of work in this area lately. Agents can be used for a multitude of different purposes ranging from: isolated message passing, object caching, finite state machines, web crawling, and even reactive user interfaces. One of the ideas that I have been looking into lately is agent based scheduling.SchedulerAgent A simple Agent based scheduler:
 Agents and ObjectPools

Agents and ObjectPools

Sunday, Jun 5, 2011

@ 7sharp9

Everyone knows F# agents are cool right? Well here’s yet another example of how versatile they can be… There was a series of posts last April by Stephen Toub from the pfxteam at Microsoft. I was reading through some of the posts again the other day and thought some of the ideas presented there would make interesting projects in F# to demonstrate the flexibility and succinctness of the language. I thought the ObjectPool example would make an interesting project in F# using agents aka MailboxProcessors.
Pipeline processing 3

Pipeline processing 3

Monday, Apr 4, 2011

@ 7sharp9

Ok so I have been offline for a while now, what with starting a new financial contract in London and not having any broadband access for a while. I have been working on something, honest! Since the last post I have been reflecting on the pipeline design and it had a distinct object orientated feel to it that I wasnt happy with, so I have amended the structure of the code and come up with the following which simplifies in some areas and expands in others…module Pipeline open System.
Pipeline processing 2

Pipeline processing 2

Sunday, Feb 13, 2011

@ 7sharp9

Welcome to pipeline processing part 2. I feel I need to backtrack slightly from the previous post, having worked with pipelines for quite some time I have the advantage of knowing all of the details that may be alluded to in these articles without being effected by any omissions I may make, obviously you guys aren’t in that position, so I’m going to try and rectify that a bit now. If you have any queries then please leave a comment and I will try to address them in further articles.
Pipeline processing 1

Pipeline processing 1

Tuesday, Feb 1, 2011

@ 7sharp9

Welcome to new series of articles on pipeline processing. First up, what’s a pipeline? Well according to Wikipedia: A pipeline is a set of data processing elements connected in series, so that the output of one element is the input of the next one. The elements of a pipeline are often executed in parallel or in time-sliced fashion; in that case, some amount of buffer storage is often inserted between elements.

About Me

Hi, my name is Dave Thomas and Im a software engineer from the Uk. I work primarily in F# but also like to tinker with pretty much any interesting language. Im drawn to more functional languages like F#, Swift and Rust.

Have questions or suggestions? Feel free to ask me on Twitter.

Thanks for reading!

Dave Thomas