Welcome to Atalasoft Community Sign in | Help

Still fresh in my mind is the day that I interviewed at Atalasoft.  It was 2007, the economy was still in full swing, and companies were hiring computer science graduates like it was going out of style.  I interviewed with a number of companies but Atalasoft stood out in one important aspect:

It was the hardest interview process I’ve ever endured bar-none.  I was nervous, I was shaking, I felt like I was going to throw up… I was pushed to my limits.

This might sound like an awful thing to endure, but it meant a lot to me.  It wasn’t the highest paying offer I had, it wasn’t at the most prestigious company, it wasn’t even working with the most cutting edge technology.  However, I knew I was going to be working with very smart people and I knew that they would be expecting a lot from me day one. 

This, I thought, is a company that will force me to grow fast. 

Today, I know I made the right decision in coming to Atalasoft.  They have gone above and beyond in supporting me in all of my endeavors, whether it had immediately tangible benefits for the company or not.  I’ll always remember Atalasoft as the place I became an author, a Microsoft MVP and as the place where I graduated from being a mere programmer to a true Software Engineer.


If you’ve enjoyed reading my posts you can continue to follow me on my personal blog.  I’ll be announcing a new community site for my F# Discoveries This Week series just as soon as my ISP turns on the domain.

I’ve been very busy lately what with getting ready for the move to Hoboken, trying to put together an online version of my F# Ant AI Contest, and working on my talk for the F# in Education Workshop.  Nonetheless, I’ve set some time aside to bring you the F# links you crave.  Cheers!

 

News

October 2010 Community 4 F# Meeting - Trees, Language Oriented Programming and F# with Robert Pickering on 10/19

In this presentation Robert Pickering will take a look at the concept of the tree data structure, and we’ll see how trees are everywhere we look in programing — from XML to lisp, and passing by indexes in RMDS.

Daniel Mohl’s Speaking at the October Nashville Web Dev User Group Meeting on 10/12

“In this talk, we will quickly go over some of the basics of the F# language, then dive into four quick ways to get started developing web application in F#.”

Skills Matter : Functional Programming eXchange 2011 18-03-1

“Following on from the success of the last Functional Programming eXchange in December 2009, Skills”

 

Tools

Microsoft Solver Foundation

“Solver Foundation Services (SFS) can automatically analyze models and determine which solver is most appropriate.”

Funtastic

“A simple tool for working with F# interactive.”

 

General

Luke Hoban's Benoit Mandelbrot

“In honor of Mandelbrot, here are two very simple takes on the Mandelbrot fractal that I’ve written in the last couple years.”

Scott Philip Brown's Turtle Graphics and L-systems with F# and WPF

“This article will explain how to use the turtle graphics program, and show the F# and WPF code which was used to implement it, and provide some example code for generating fractal shapes using L-system grammars.”

Tomas Petricek's Formatting F# source code for the Web

“In this article, I presented a tool for generating nice HTML snippets from F# source code called F# Web Snippets. The most interesting thing about the tool is that it also generates tool tips with type information for F# identifiers.”

Satnam Singh's F# Black-Scholes running on GPUs and SSE3 Multicore Processors using Accelerator

“The objective of this blog is to give you a feel for what data-parallel programming looks like with the Accelerator system.”

Kean Walmsley's SortOnVersion in F#

“I had a very nice surprise in my inbox, this morning. Thorsten Meinecke, from GTB in Berlin, decided to convert the VB.NET code contained in the last post into an F# script and to share it with this blog’s readership.”

Robert Pickering's TwitMemento a twitter client in F#

“It’s written in F# (as you might have guessed if you follow this blog regularly). It's based on Twitter’s new HTTP streaming API's so tweets come in as they happen, no need to refresh, and uses OAuth so your password is never seen by the app.”

Ade Miller's Gotchas: Assembly Level Attributes in F#

“It turns out that the module needs an empty do() statement at the end of it. So your assemblyInfo.fs file might look something like this.”

Mauricio Scheffer's A functional wrapper over ADO.NET

“ADO.NET is the de-facto basic library for data access in .NET, and as everything in the BCL, it's object oriented. Which forces you to write object-oriented code when you use ADO.NET in F#.”

Mauricio Scheffer's A functional wrapper over ADO.NET (part 2)

“FsSql aims to wrap ADO.NET to make it more idiomatic for F# consumers, providing several fine-grained functions meant to be reused or combined as necessary, as is usual in functional programming.”

Rey Dacoco's Mouse Trails using Basic shapes

“Obsessed with mouse trails? Try the following sample applications:”

Luis Diego Fallas' Using C#'s implicit type conversions from other .NET languages

“One interesting C# feature is the ability to define a method that implements implicit conversion from one type to another. In this post I'm going to show how to use this feature from IronPython, F#, VB.NET and IronRuby.”

ASP.NET with F# and Mono

“ASP.NET is the implementation of server-side code based on .NET to create dynamic web pages. Mono does support ASP.NET with some additional configuration F# can also be used to create dynamic web content.”

F# to Canvas

“A rudimentary library of functions that enable F# algorithms to turn their output into visual representations using the HTML5 canvas by outputting javascript”

 

Teaching and Basics

Ivan Towlson's F# and first-class functions, parts one, two, three and four

“In previous instalments of this series, I’ve described F#’s support for first-class functions in terms of relatively simple, isolated examples. In this final part, I want to draw on a real-world example to show how F# has made it easy for me to use higher-order functions to address a genuine business requirement.”

Richard Minerich's A CUFP Tutorial, F# Day at the … Oh God, Ants!

“Everyone was ready for a nice relaxing day at the beach when they showed up for my CUFP tutorial…”

 

Community

Matthew Podwysocki's Continuation Monad with Error Handling

Fredrik Holmström's A few custom F# operators I use

As always, a ton of great posts this week on a large number of interesting topics.  It’s great to be part of such a productive community.  I particularly enjoyed Vladimir’s Zebra Puzzle post.  The code is just beautiful.

I also have some bittersweet news to share.  I’ll soon be leaving Atalasoft to join a yet unnamed company in the NYC area.  I’ll miss Atalasoft for sure, it’s a great company full of very smart people.  Keep an eye on the career page and you might just be lucky enough to work with these fine folks.

I’m planning on starting a NYC F# user group once I get settled.  Please let me know if you’re interested in helping to get it off of the ground.

 

News

October Community for F# meeting - Trees, Language Oriented Programming and F# with Robert Pickering

When: Tuesday, Oct 19, 2010 11:00 AM (PDT)

“In this presentation Robert Pickering will take a look at the concept of the tree data structure, and we’ll see how trees are everywhere we look in programing”

Adam Granicz's F# MVP Award - 2010

Sorry I missed you last week Adam!  Congrats on the award!

Summary of CUFP 2010

“The star of the show was definitely F# in my opinion. The weakest part of the conference was the lack of outlets.”

Mono 2.8 Released

“Mono 2.8 is a portable and open source implementation of the .NET framework for Unix, Windows, MacOS and other operating systems.”

 

Audio and Video

Anton Tayanovskyy - Developing WebSharper 2.0 Applications

“In this talk Anton will present a pre-release version of WebSharper 2.0 by developing and testing a small standalone JavaScript component.”

 

Tools / Projects

huwmancode - Release: Release 0.2 Alpha

“Features seamless debug support enabled for VS 2010 - Place a breakpoint in your service code and run! (Make sure to install the service first!)”

RouteTester

“ A sitemap-based url tester that runs in parallel (F#).”

IronJS at 0.1.90-preview

“IronJS - A Javascript implementation for the DLR written in F#”

F# Sample: Google Reader API Port

“This F# Google Reader API code is a port from a project that was originally developed in C#. It supports the 'unofficial' reader API and can get lists of subscriptions, posts, tags etc. for a Google Reader account.”

FSharp.Reactive

“Extensions and wrappers for using the Reactive Extensions (Rx) with F#.”

 

General

Vladimir Matveev's Solving Zebra Puzzle

“Zebra puzzle (often referred as Einstein's problem) is a well-known class of logic puzzles where you need to reconstruct the missing parts from the set of known facts”

Diego Echeverris Starting with WebSharper Interface Generator

“Sometimes though, the library you want to create wraps for contains hundreds of classes, configuration objects and enumerations. Doing this manually is not only error-prone but extremely boring.”

Steve Gilham's Computing per-service SIDs without sc.exe

“Here's a quick script to do it, that can be the basis for including the computation programmatically into e.g. installer generation.”

Ashley Feniello's 8-Queens in 8 Lines

“Brushing up on “whiteboard coding” for internal interviews… Inspired by Hal Ableson’s streams-based solution to this old classic in the SICP lectures, here’s a pretty concise n-Queens solution:”

Brian McNamara’s Unit tests + debugger = code understanding

“When you have good unit tests, everything is better; if you’re already a TDD-er, then  saying that is just preaching to the choir.  And when you have a good debugger, using that tool is a great way to learn about an unfamiliar code base (stepping through code, setting breakpoints, looking at stacks, changing values of locals or the next statement to see how things react).  Put those two together, and the effect is even more powerful.”

Phillip Trelford's Game of Life

“Michael used a video of Jon Conway himself to explain the rules; which he followed up by showing a very interesting implementation using APL. Afterwards we all paired up to try implementations in various languages. After about half an hour my pair came up with the following F# implementation.”

Dean Chalk's Interacting With WPF Dispatcher Via F# Interactive Window

“So what this means now is that we can create sophosticated WPF controls, invoke them in the FSI window, and then apply long-running upddates via FSI without the WPF window freezing on us.”

 

Teaching and Basics

Embedded WebBrowser in F#

“Luckily, Winforms provides an embedded web browser through System.Windows.Forms.WebBrowser. The Mono implementation relies on the Mozilla Gecko engine.”

 

 

Just getting in from ICFP / CUFP and what a fantastic time it was.  Mike Gordon’s ICFP tribute to Robin Milner left no one in the crowd untouched.  CUFP had quite a few interesting F# related talks and they should be up on Vimeo soon. 

I also want to mention that the F# community has three brand new Microsoft MVPs!  Daniel Mohl, Talbott Crowell and Chris Marinos were awarded at just the beginning of this month.  If you have twitter, please be sure to say hi and thank them for their hard work.

Lastly, I apologize for not posting last week.  I used the time to refine my CUFP F# workshop.  The contents of that workshop will be online within the next few days on my personal blog.

 

News

F# in Education Workshop - Microsoft Research (Nov 5th)

“The special reduced rate at the Liberty Hotel for workshop attendees is available for only a limited number of rooms and expires on October 15.”

Anton Tayanovskyy – Developing WebSharper 2.0 Applications at the New England F# User Group (October 4th)

“In this talk I will present a pre-release version of WebSharper 2.0 by developing and testing a small standalone JavaScript component.”

 

Audio and Video

Mike Gordon's Tribute to Robin Milner at ICFP 2010

“Officially titled "ML - metalanguage or object language", this invited talk by Mike Gordon (Cambridge) at the ACM International Conference on Functional Programming 2010 (Baltimore) really was a life story of Robin Milner and of ML.”

Use of F# at Microsoft Research

“An interview of David Stern and Jurgen Van Gael by David Brown”

An Introduction to F# with Don Syme (#1 of 4)

“Don, who created F#, introduces the language and describes the best way to begin developing with F#.”

An F# Tutorial with Don Syme (#2 of 4)

“Don, who created F#, demonstrates the language with live coding examples, such as analysing a real-time Twitter feed using F# Interactive.”

F# and Windows Azure with Don Syme (#3 of 4)

“Don, who created F#, demonstrates the language with live coding examples in F# Interactive, focussing on Windows Azure.”

F# in use at Microsoft Research (#4 of 4)

“- Project Emporia, which filters updates from the Twitter public feed and automatically develops topic-based “lenses”.
- AdCenter & AdPredictor, which determines the best adverts to display in Bing search results.
- The Path of Go, an AI implementation for the popular, ancient Chinese board game on XBOX 360.”

 

Tools

TickSpec (An F# BDD Framework) Oct 3 2001 Release

“Lots of new features” […] “Production Ready”

Fenetics is a simple F# library for genetic algorithms

“Fenetics is a simple F# library which demonstrates genetic algorithms in action, the name is a contraction of F(#) and (G)enetics. This is lab project and as such not a commercial component, not even a potential candidate but rather a slow move towards building enterprise-level F# libraries.”

 

General

Kean Walmsley's BrowsePhotosynth for AutoCAD

“For those of you interested in gory details, the code – which is installed with the application – is primarily in C# but also includes an F# module for downloading the various point cloud files asynchronously.”

Adam Granicz's Tutorial: Implementing a shopping cart with WebSharper

“The code provided here should work on any existing 1.0.X installation, preferably on the latest 1.0.28 release.”

Yin Zhu's F# and Data Mining: WekaSharp: more features

“This post will contain improvement over the minimal wrapper, e.g. more Dataset processing function, some plot functionality, etc”

Daniel Mohl's F#, Caliburn.Micro, and a New WP7 Template

“Ever since I first heard about Caliburn.Micro, I have wanted to build an F# template that used it. With
the new WP7 panorama C# template that was included in the RTW release of the Windows Phone Developer Tools, I found a good opportunity. ”

Daniel Mohl's Version 1.1 of the F# Windows Phone 7 Templates

“The two F# Windows Phone 7 templates (F# and C# Win Phone App (Silverlight) and F# and C# Win Phone List App(Silverlight)) have been updated to support Windows Phone Developer Tools RTW.”

Neil Carrier's More Novice F# Computation Expression Bind/Return Mechanics

“Today’s post is more F# “beginner” stuff I’m doing to help myself learn to think about workflows (or computation expressions as they are also called).”

Neil Carrier's F# Computation Expressions, Yield/For Mechanics

“Today’s episode of the ongoing computation expression saga features Yield/YieldFrom and For. One encounters fewer examples of these than of Bind/Return, though in most respects their operation is every bit as fundamental.”

Neil Carrier's F# Computation Expression Bind/Return Mechanics Continued.

“Isn’t it always the way? Almost as soon as I posted the previous entry, I came up with an example I like better. Rather than replace that example, I’ll just post the new one here.”

Neil Carrier's F# Computation Expressions, a Simple Bind/Return Mnemonic

“Below is one I’ve come up with for basic Bind/Return operation. It’s just a simple computation expression that increments a different column of a base ten number depending on the operation.”

Neil Carrier's F# Computation Expressions: Basic Data Retrieval Mechanics

“The test database itself consists of two record types. The first is a simple key/value pair. The second is a linking record type which consists of two keys. This keeps things simple for the test, but the method would remain the same even for more complex record structures.”

Neil Carrier's F# Workflow for Building Immutable Trees from Delimited Strings

“I really wanted to create an immutable version, but I lacked the skill with computation expressions at the time of the earlier post.”

Stefano Ricciardi's A RPN Calculator in F#

“While continuing my journey in F#, after playing with Project Eulero problems for a few weeks, I have come across another excellent  excercise site which goes under the name of Programming Praxis.”

Joh's F# for game development: Final development stages of Asteroid Hunter

“Things are a bit slow on the XNA development front on my side these days. I have stopped adding features to Asteroid Hunter, and am now in the process of getting the last feedback from testers before submitting the game to peer review.”

Daniel Moore's Interview with Kalani Thielen: Trends in Programming Languages

“F#, Clojure, and Scala are all fairly new and popular languages this decade, the former two with striking resemblance to OCaml and Lisp, respectively, and the lattermost being more original in syntax. In what way do these languages represent forward thinking in language design, or how do they fail to build upon lessons learned in more venerable languages like Haskell?”

Alexander Rautenberg’s Stepping Stone Algorithm in F#, Part 1

“The calculations are mostly routine and not very interesting, but at the heart of it all is a little mechanism that I found lends itself to be coded in a very succinct and elegant way, with a few standard library calls and little more”

Alexander Rautenberg’s Stepping Stone Algorithm in F#, Part 2

“These are only a few points of information regarding the previous post.”

Matthew Manela's Functional stateful programming in F#

“While you may not always need the full power of the State monad, it along with explicit state passing are key tools for writing functional programs. With them you can approach many complex problems without the need for mutable state.”

Chris Marinos' C# Expressions vs. F# Quotations: A Syntax Comparison

“Now that I better understand some problems of implicit casting to expressions/quotations, I appreciate the explicit approach- even if I’m still not a big fan of the characters used to make the tags.”

Ian Voyce's Public static fields gone from F# 2.0

“The change itself is simple: static fields can no longer be public. Static fields can still be created, but they must be private.”

 

Teaching and Basics

Interactive Session #9: Processing XML

“Reading and interpreting XML data is performed through the System.Xml package. You need to create a new XmlDocument value and load the XML text into the XmlDocument.”

Interactive Session #10: List, Array, Sequence

“F# supports three different list-like data structures to store values of the same type: List, Array and Sequence. In this session we want to explore the similarities and differences among these three types.”

Interactive Session #11: Units of Measure

“F# includes a language feature to annotate your code with units of measure like meter, second or kilogram, preferably from the SI system. These units are statically checked during compile time and will not be part of the compiled code.”

Rick Minerich's Learning F# for Fabulous Prizes

“I found that the anticipation caused by not knowing when the next question might be asked kept attendees on their toes. Energy ran high throughout the session, higher than I’ve ever seen before.”

Ashley Feniello's Project Euler Problem #13

“It would be interesting to do without BigInts. Could use doubles with enough precision for just the first ten digits or some such thing, but just wanted the correct answer to plug into the site and I’m lazy :-)”

Ashley Feniello's Project Euler Problem #12

“First triangle number to have over five hundred divisors.”

Ashley Feniello's Project Euler Problem #11

“Greatest product of four adjacent numbers (up, down, left, right, or diagonally) in this 20x20 grid:”

Ashley Feniello's Project Euler Problem #10

“Easy problem, but way too slow (taking several minutes) with the naïve prime number generator from problem 7. This new version is 10x faster”

 

Community

Line of business applications: Will F# make my life easy?

“I am not asking whether it is possible to develop Line of Business application in F#. I am asking whether F# will make my life easier to develop Line of Business applications when compared to C#? My main concern will be threading & UI synchronization.”

How to limit the number of threads created for an asynchronous Seq.map operation in F#?

“The problem is, this tends to create too many threads and crash the application periodically”

Pattern matching on the beginning of a string in F#

“I am trying to match the beginning of strings in f#. Not sure if I have to treat them as a list of characters or what. Any suggestions would be appreciated”

 

ICFP approaches quickly and I’m working hard to make that those four hours of CUFP F# tutorial will be well worth your time.  Meanwhile I’ve gathered the best the of the F# community for your enjoyment.  Dig in!

 

News

September 23rd at CUFPx Michigan - Mark Harris: "A Commercial Deployment of F# "

“Mark Harris, formerly of Microsoft, currently working for Grange Insurance in Columbus, Ohio, will be presenting a case study of a commercial deployment of an F# solution. One of the highlights of this deployment--a process which took 18 hours was cut down to 6 minutes. Mark will be discussing the benefits and drawbacks of using F# in Grange's commercial app.

 

Audio and Video

Deep Fried Bytes Technology Podcast Episode 60: The Futures of the F# Language with Luke Hoban

“In this episode Keith and Woody sit down with F# Program Manager Luke Hoban at TechEd 2010 to discuss the futures of the F# language. Luke gave the guys the scoop on what developers can accomplish with F# and what the team has planned for upcoming releases of F# with Visual Studio.”

 

General

Dmitri Nesteruk 's Making DSLs in F#

“This article shows that making a DSL in F# is really simple. Of course, the thing about DSLs is they are domain-specific, so for the domain you choose you might encounter a lot more challenges. Have fun!”

Neil Carrier's Basic F# Computation Expressions Using Yield and Combine

“I decided to learn a little bit about computation expressions beyond the basic Bind/Return operations. So I made a goal of learning something about the Yield/Combine operations.”

Neil Carrier's F# Async Computation Expressions: A Tiny Model System

“Continuing my quest to learn computation expressions, I decided to explore from scratch the implementation of basic asynchronous behavior. This post is the result.”

Robert Pickering's What is object oriented programming really all about?

“People often ask me what functional programming is all about and why is it useful. In an attempt to answer this question in a way that is relevant to object oriented programmers it struck me it might be useful to look at what people find useful in modern object oriented programming.”

Celso Axelrud's Vector, Matrix and Linear Algebra in F#

“The following script snippets present the vector and matrix functionalities in Microsoft.Fsharp.Numerics namespace from Fsharp.PowerPack assemble.”

Daniel Markham's Functional TDD: Codd is my Copilot

“You work for the IRS. Your job today is to select a list of people with large bank balances so that you can do some kind of indescribably-complex tax-stuff to them. Your boss would like a list of these guys on his desk by noon.”

Vladimir Matveev's Slides And Samples

“Presentation and code samples from my recent talk on FSUG meeting.”

Stefano Ricciardi's Project Euler Problem 10 in F#

“Calculate the sum of all the primes below two million.”

Ashley Feniello's Project Euler Problem #8

“Largest products of five consecutive digits in this 1000-digit number.”

Ashley Feniello's Project Euler Problem #9

“Pythagorean triplet where a + b + c = 1000”

Ray Dacoco's TabControl in Visual F#

“TabControl is a control that can be used to organize information. It can be utilized as a good alternative to menustrip control.”

Ray Dacoco's Changing the Pointer when the mouse hovers an object

“To change the mouse pointer when the mouse hovers an object, use the Cursor property. All form controls in Visual F# has Cursor property.”

 

Community

StackOverflow - Does Functional Programming Replace GoF Design Patterns?

“Functional languages have plenty of best practice rules of the form "when you encounter problem X, use code that looks like Y", which is basically what a design pattern is.”

StackOverflow - F# Type declaration possible ala Haskell?

“If you want to keep readable type declarations separately from the implementation, you can use 'fsi' files (F# Signature File).”

 

A Look Outside

Chris Waggoner's Category Theory

“Category Theory is like Set Theory, but supposedly better. What is it, though?”

Perhaps a day late but certainly not a dollar short, I’ve gathered every piece of relevant F# information I could find for your consuming pleasure.  I do have a rather good excuse for the delay this time around.

Yesterday I handed in my very final edits for Professional F# 2.0.  It’s very exciting to have wrapped up the final details of our first edition.  It will be shipping within the next couple of months and I’m just dying to hear what you all think of it.

 

News

Microsoft Research's F# in Education Workshop on November 5th

“F# in Education is a one-day workshop for educators and industrialists, to be held in Cambridge, Massachusetts, U.S., on November 5, 2010.”

FSUG's September 13th Meeting – Vladimir Matveev on Web Development in F#

“In this talk I will give a WebSharper overview and explore its applications.  Code samples will include: rich client-side programming capabilities (WebExcel), integration with existing JavaScript libraries (demo with minor subset of JsRX), and client-server communication.”

TVUG's September 16th Meeting - F# and You!

“Come to our September 16th meeting where Rick Minerich will present F#. F# is a programming language that provides support for functional programming in addition to traditional object-oriented and imperative (procedural) programming.”

 

Audio and Video

  

Don Syme's A Taste of F# Today

“Don Syme, the architect of F#, presents to the London F# user group”

Microsoft Research's F# - Putting the Fun into Functional Programming

“Microsoft Researchers discuss F# and it's many applications.”

 

Tools

LINQPad - 4.26.2 Beta

“You can now to use LINQPad as a F# scratchpad”

 

General

Tomas Petricek's Parallel Programming in F# Parts 1 - 4

“Parallel Programming with Microsoft .NET [^] is a guide written by the patterns & practices group at Microsoft. It introduces .NET programmers to patterns for including parallelism in their applications (using support for parallel programming in .NET 4.0).”

Luke Hoban's Twitter OAuth in F#

“Recently, Twitter moved to require OAuth for accessing Twitter APIs on behalf of a user. Below is the F# code I wrote to integrate OAuth, which should work for any other F# Twitter scripts and apps.”

David Cooksey's Lexing and Parsing with F# – Part I

“FsLex and FsYacc are F# implementations of Ocaml’s Lex and Yacc. They are part of the F# Powerpack released for Visual Studio 2010.”

Mauricio Scheffer's Nullable in F#

“In F#, unlike VB.NET and C#, Nullable<T> is not a language-supported construct.”

Daniel Mohl's Pure-F# Templates Now Support the Visual Studio 2010 Shell SKU

“With the announcement of the F# 2.0 standalone tools update for Visual Studio 2010 Shell, I have updated the pure-F# templates to support the IntegratedShell SKU.”

Neil Carrier's F# Fuzzy0 Update

“Just a quick note to say that the Fuzzy0 reference code has been updated. I added a few comments, a constant output function, and the input modifiers “very” and “somewhat.””

Neil Carrier's Discrete Classification using F# and Fuzzy Logic

“This post shows the first example based on the F# fuzzy logic reference module Fuzzy0. I continue with the theme of tomatoes. The example shows how fuzzy logic can be used to classify items such as tomatoes into discrete categories.”

Array Bounds Check Elimination in the CLR

“If a compiler can prove statically that an array index operation is safe, it doesn’t need to generate a dynamic test.”

Vitality Liptchinsky's Basics of dataflow programming in F# and C#

“This article presents basic implementations of dataflow variable in both C# and F#. Also article demonstrates examples of dataflow programming in C# using futures.
@author Vitaliy Liptchinsky”

 

Community

Stack Overflow - Handy F# snippets

“I'd like to make this a kind of handy reference page. As such there will be no right answer, but hopefully lots of good ones.”

 

Teaching, Basics and Others

Aaron Erickson's The Unheralded Benefits of the F# Programming Language

“As great as these features are, there are a couple features, that in my more mundane F# experiences, seem to stand out as things that “save my ass”, for lack of a better phrase, more often than not.”

Mike Murray's F# Pipeline Operator in C#?

“For those regular, non-fluent method calls in the rest of the .NET API, you must use old-fashioned Object-Oriented Programming practices of breaking code up into meaningful, atomic units of statements and naming and encapsulating functions cohesively in order to get more readable code.”

Moritz Lenz's Protected Attributes Make No Sense

“In C++, you can declare an attribute or a method as "protected". Which means that it is private, but subclasses can still access them. This makes just as much sense as saying you only get access to these attributes if you wear a funny yellow hat.”

One of the greatest things about running this blog, other than having a structured way to read all of the F# community content, is that I’ve been able to watch the community grow in a very concrete way.  Looking back to a year ago there was only six posts on F# over the course of a week, now we have well over twenty.  It’s truly amazing to see.

Now, on to the links.
 

Audio and Video

Dr. Ralf Lämmel's C9 Lectures: Advanced Functional Programming - Type Classes

“In this second lecture in the series, Ralf digs into Type Classes, which are type system constructs that were originally introduced to provide a form of ad hoc polymorphism (i.e., an advanced form of overloading).”

Rick Minerich's Functional Language Paradigms with F#

“I've got great news. F# is here and is poised to increase your productivity and reduce your suffering.”

Peter Sestoft's Teaching programming language concepts with F#

“Peter introduces the curriculum, lecture plan and lecture notes for the course "Programs as data" that uses the functional programming concepts in F# to teach students language concepts and implementation details.”

 

Tools

Essential F# | Refcardz

“This DZone Refcard will lead you through the basic essentials so that you can quickly move on to using this Functional Programming Language for creating some mind-bending code.”

fsxplat - Released: FSharp packages 1.2

“F# packages and samples for use across platforms”

Phillip Trelford's TickSpec: An F# BDD Framework

“Right now TickSpec is intended as a lightweight framework to get you started with BDD using F#. It is standards based, supporting a subset of the Gherkin language, so should be easy to change to another Gherkin based framework like Cucumber, SpecFlow or StorEvil.”

 
 

General

Vladimir Matveev's F#: Building compiler from sources.

“Of course, compiling them sources and observing all internal compiler activities, so to say “in action’.”

Ashley Feniello's Fixing Decades-old Bugs in the HP-35

“To make an assembler, I just parse with a series of regular expressions. F#’s active patterns came in super handy for this! In fact, the assembler turned out to be fewer lines of code than the disassembler.”

Ashley Feniello's Microcode-level HP-35 Emulator (in JavaScript!)

“I had the (silly) idea of building a JavaScript-based emulator. Looking at Peter Monta’s Python-based disassembler and his object code listing, it looked simple enough to automatically generate script from David Cochran’s original bits. I wrote my own little straight forward 100-line disassembler in F#, producting an array of JavaScript functions”

Brian McNamara's F# for puzzles (Morse code decoder)

“The idea is simple; the computer works out all the possibilities for the next 3 letters, and then the human selects which prefixes “look promising” to investigate further.”

Neil Carrier's TechNeilogy: Fuzzy Logic F# Reference Module: Fuzzy0

“Below is the fuzzy logic reference code for module Fuzzy0. Tomorrow I’ll post an example of its use that explores some extensions of earlier techniques.”

Yin Zhu's F# and Data Mining: WekaSharp: Tutorial for using Weka in F#/.Net

“The minimal wrapper in F# for Weka.”

Daniel Markham's Structuring Larger F# Functional Projects

“So here's a suggested structure outline for those larger functional projects”

Ade Miller's F# Samples for Parallel Programming with Microsoft .NET

“We’ve been working with the F# Team to get the samples for Parallel Programming with Microsoft .NET ported to F#.”

Neil Carrier's TechNeilogy: F#, Fuzzy Logic, WPF, and Tomatoes!

“This is my 100th blog post, and to celebrate, I’m pulling out all the stops. This example will combine F#, fuzzy logic, WPF, and tomatoes!”

Neil Carrier's TechNeilogy: Conjunctive Fuzzy Logic Rules in F#

“It shows how to make multipart conjunctive rules by storing the input sets in a list and using the “min” operator to combine the results into a truncation height. To do this, it adds vector versions of the fire and fire all functions.”

Justin Angel's Windows Phone 7 supports VB.Net and F#

“In this article we’ll review Windows Phone 7 support for the Visual Basic .Net and F# programming languages. Our goal is to demonstrate that Windows Phone 7 can indeed support F# and VisualBasic.Net code libraries and user controls.”

F# Artificial Intelligence Library Tutorial

“This step-by-step tutorial describes how to use the library in fsx script and C# project.”

Chris Marinos's 5 Reasons to use F# Interactive in Visual Studio 2010

“I find that I use F# Interactive more for performance analysis, learning F#, and verifying Base Class Library behavior than for spiking or scripting.”

 

Community

Stack Overflow - Calling F# (.Net dll) code from php

“Yes you can, by using PHP COM class but it works only on Windows version of PHP5+ and needs no separate installation.”

Stack Overflow - Scrap Your Boilerplate in f#

“I've used the Scrap Your Boilerplate and Uniplate libraries in the Haskell programming language, and I would find that form of generic programming over discriminated unions to be really useful. Is there an equivalent library in the f# programming language?”

Stack Overflow - Path to Become a Better F# Programmer

“What should be my steps from now on to become a better/professional F# programmer?”

 

 

Teaching and Basics

Bill Morrissey's Learning F# for C# developers: Scope, Workflow and Lists

“This post is part two of a series of posts looking at syntactical examples of F# and C#. This post will supply you with easy to understand F# coding examples.”

Anders Hesselbom's Type inference in F#

“I have recently been to a short F# presentation at HiQ in Arboga. One of the things that got mentioned was type inference.”

Rey Dacoco's WebBrowser control (Visual F# Windows Forms Application)

“WebBrowser control is a control used to display a web page or web document. To create a WebBrowser control in F#, use the following syntax:”

I’m back again with another edition of F# Discoveries this Week.  The most exciting announcement this week is the new F# August 2010 CTP which brings with it the ability to build your own VS2010 F# Express Edition with Visual Studio Shell and the prospect of building F# applications on Windows Phone 7.  Be sure to check out Daniel Mohl’s Windows Phone 7 template before getting started.

 

News and Upcoming Talks

F# (August 2010 CTP)

Announcing the F# 2.0 Standalone Tools Update

A standing invitation to F# users to "get in touch"

Don Syme lecturing at the F#unctional Londoners Meetup (9/9)

 

Tools and Libraries

WekaSharp: An F# wrapper for Weka (Yin Zhu)

F# and C# Win Phone List Template (Silverlight) (Daniel Mohl)

fsai Release FSharp AI library 1.10.0 (Lukáš Kouřil)

RockScroll: my new favourite Visual Studio Add-In (Kean Walmsley)

 

Video, Audio and Slides

Slides and samples from F# talk in Manchester (Oliver Sturm)

F# Intro Talk at NextGenUG in So’ton (Phillip Trelford)

Slides from Combinators, DSLs, HTML, and F# (Robert Pickering)

Busy .NET Developer’s Guide to F#: Basics (Ted Neward)

 

Technical Articles

iTunes via F# Interactive (Cameron Taggart)

F# for puzzles (Morse code decoder) (Brian McNamara)

Extracting elements from Win32 resource files (Luis Diego Fallas)

A variation on Matt Moloney's "Memento" pattern (Don Syme)

Bound Variables in F#: What Reflection Reveals (Neil Carrier)

Getting F# Running on a Continuous Integration Server (Ade Miller)

How F#'s async really works? (George Cullen)

Segment Tree in F# (Neil Carrier)

Bound Variables in F#: What Reflection Reveals (Neil Carrier)

Fuzzy Logic Experiments in F# (Neil Carrier)

Fuzzy Logic in F#, Example 1 (Neil Carrier)

Fuzzy Logic in F#, Now More Functional! (Neil Carrier)

F# “fun” with Windows Phone 7 (Fahad)

Getting started with Windows Phone in F# (Senthil Kumar)

Euler Problem 10 (Mark Pearl)

Euler Problem 16 (Mark Pearl)

Project Euler Problem 9 in F# (Stefano Ricciardi)

Project Euler Problem 8 in F# (Stefano Ricciardi)

Project Euler Problem 6 and 7 in F# (Stefano Ricciardi)

Enumerable.Skip vs Seq.skip (Mauricio Scheffer)

 

Getting Started and Evangelism Articles

Putting the fun in functional programming (Daniel Markham)

Back to school : Getting to know F# (Mehfuz Hossain)

Learning F# by writing C# (Alan Hemmings)

F# - sharper than C# (Josh Reuben)

Learning F# for C# developers (Bill Morrissey)

 

F# Community

Ars Technica - What do you think of F# ?

SO - How to merge sorted sequences in F#.

SO - Which to use, C# or F#? In this "real world" case

hubFS: F# Databse Application Samples & Articles

hubFS: MailboxProcessor.TryScan paradigm

Tons of great links along with a brand new less cluttered format today.  Let me know what you think on twitter.

 

News / Talks

Talbott Crowell at San Fancisco Bay Area F# Users Group (8/16)

Don Syme at the Community for F# Online (8/17)

Luke Hoban will be giving a F# keynote at CUFP (10/2)

Joel Pobar "Smart Software with F#" at JAOO (10/6)

 

 

Podcasts / Screencasts / Videos

Perspectives on Clojure and F# (with Rich Hickey and Joe Pamer) (Joey deVilla)

Advanced Functional Programming - The Expression Problem (Dr. Ralf Lämmel)

The Language Matters on the Software Engineering Productivity Podcast (Rick Minerich)

 

 

Articles

Undo / Redo using the Memento Pattern and Command Pattern in F# (Matt Moloney)

A variation on Matt Moloney's Undo/Redo "Memento" pattern (Don Syme)

Hindley Milner Type Inference Sample Implementation (Edmondo Pentangelo)

INotifyPropertyChanged strikes back (Vladimir Matveev)

WebSharper, part 2: WebExcel (Vladimir Matveev)

OOP Virtualization vs. F# Discriminated Unions (Neil Carrier)

Segment Tree in F# (Neil Carrier)

A F# Silverlight Template (Daniel Mohl)

Reading F# Projects, Part I: The Common Knowledge (Yin Zhu)

Reading F# Projects, Part II: F# Set (Yin Zhu)

Reading F# Projects, Part III: The F# math providers. (Yin Zhu)

Query Zune Music Collection with F# (Cameron Taggart)

How to merge sorted sequences in F# - Stack Overflow (Neil Carrier)

Combining memoization and tail-recursion – Stack Overflow (Ronald Wildenberg)

"I think F# is very cool" - Rich Hickey (Flying Frog Consultancy Ltd.)

F# – Euler Problem 10 (Mark Pearl)

Seq.unfold (Bohdan Szymanik)

Back to school : Getting to know F# - Mehfuz's WebLog (mehfuzh)

Slides from Combinators, DSLs, HTML, and F# (Robert Pickering)

Steve's Tech Talk : Using a Proxy Class to Fix F# Protected Access ... (Steve Hawley)

 

Tools

FastSharp 2.0 (Matt Manela)

NDjango 0.9.8 (Michael Feingold)

F# Project Extender 0.9.3 (Michael Feingold)

Quantifa: F# open-source project for quantitative finance and risk management (Don Syme)

VsVim (Jared Parsons)

So many links, all well worth your time.  I know one thing I won’t be missing is Don Syme’s online talk at C4FSharp on 8/17.  It’s great to be part of a language community in which the founder interacts in such a direct way.

 

News

Draft F# Component Design Guidelines now Available (pdf)

Don Syme will be speaking online for the Community for F# on 8/17

I’ll be speaking at the NYC ALT.NET User Group on 8/25

Kevin Hazzard’s Slides from DevConnections are up

Howard Mansell will present Eden: (An F#/WPF framework for building GUI tools) at CUFP

F# is now at 93% on langref, only 1% behind scala. (Great Going!)

PexForFun.com now has puzzles for F#

FSharp Cross Platform Packages and Samples 1.1 Released

 

 

Audio/Video

Jon Harrop at the London F-Sharp User Group: QR Decomposition

This lecture takes the audience from a tiny numerically-robust implementation of a common linear algebra algorithm through several stages of optimization, culminating in a high-performance solution that easily outperforms Intel’s Math Kernel Library. The algorithm studied is QR decomposition, which is commonly used for linear least squares best fit.

 

 

F# Articles

Adam Granicz’s Expert F# 2.0 – what’s new?

There comes a time when you just have to stop working for a minute and take a few moments to enjoy the fruits of your hard labor. For me, one of these moments lately came when I received the author copies of our book, Expert F# 2.0

 

Daniel Mohl’s F# Templates Now On Visual Studio Gallery

As Don Syme mentioned in a recent blog post, I've been working to get the five F# templates that have been announced on this blog up on Visual Studio Gallery.  I'm happy to say that all are now available.

 

Vagif Abilov’s Mock framework challenges in F#

So far I only tried very basic mocking described in the first post of Richard’s series: faking return value. As I expected, even such a simple operation became a challenge when executed from F# code. I managed to make tests work only for two and half frameworks.

 

Mauricio Scheffer’s Figment: a web DSL for F#

As I said, this is very much work in progress, and there's still a lot to do. I intend to make it fully open source when I finish writing my thesis.

 

Neil Carrier’s Segment Tree in F#

Suffice to say that a segment tree stores a group of intervals on an ordered set, in such a way that all the intervals containing a given value can be efficiently located. Such a query is sometimes called a “stabbing query,” because it’s like sticking a spear through the data and seeing which entries get stabbed.

 

Neil Carrier’s F# Sequence Lazy Evaluation Gotchas

Today’s post will be old news to experienced F# programmers. Actually, it’s old news to me, relative newcomer that I am. However, it’s one of those things I tend to forget until it jumps up to bite me, as it did today.

 

Edgar Sanchez’s F#, the ACM, and the SEC

And it is this last recommendation on DSLs that carries interesting news for F# because at the end of page 6 it states “Experience seems to show that higher-order programming languages such as F# provide a particularly good basis for domain-specific languages.

 

Jon Harrop’s Pure F# now only 2× slower than OCaml

This is a surprising and encouraging result not only because it makes F# competitive for an even wider variety of tasks but because it also implies that Microsoft are taking F# so seriously that they are optimizing the .NET garbage collector for it!

 

Steve Hawley’s Protect Yourself

One solution is to label things that need to be protected, disassemble the output, run a regular expression to search/replace the accessibility and reassemble.

 

F# and .NET needed at Credit Suisse? Is there a future for this and Microsoft in the quant world?

As I said, when you compare to these other languages in the world of quant, F# appears to be taking an early lead.

 

Stefano Ricciardi’s Project Euler Problem 4 in F#

The actual algorithm uses brute force to test for palindromicity (neologism?) all the numbers that can be composed multiplying together 3 digits numbers (those from 100 to 999), picking the highest one.

 

 

Miscellaneous

Lambda the Ultimate’s OSCON 2010 Emerging Languages Camp Roundup

It’s Friday and once again I’ve gathered up more F# content for your viewing pleasure.  If you happen find yourself in the Boston area this next Monday come meet me for our New England F# User Group meeting.  We are always happy to have new people interested in checking out functional programming.

 

News

VS2010 Keyboard Shortcuts Now Available in Letter and A4 Size

F# samples are 74% complete on langref.org (nudge nudge)

Two Contract Positions: F# Interactive in Silverlight

Scott Theleman will be speaking at New England FSUG on 8/2

 

Audio / Video

eXpress Persistant Objects and the F# Language

 

 

Articles

Don Syme’s Some F# Project Templates Available Online and Daniel Mohl’s An F# Silverlight MVVM Mutli-Project Template

If you have your own templates or projects-that-could-be-turned-into-templates, here are the steps to make and publish a template to the Visual Studio Gallery, making it really easy to access by the whole community.

 

Ben Hutchison’s Study Functional Programming or Be Ignorant

Right now, if you want to understand the state of the art in computer programming, those are your choices as I see them.

 

Bohdan Szymanik’s Heat/Image Mapping with .NET/F#

Most of the effort was spent aggregating and binning the data, the actual image prep was trivial. The following assumes you have an array of data to display.

 

Neil Carrier’s Cartesian Product of Lists in F#

So without further ado (other than to note that all the code here is presented "as-is" and without warranty or implied fitness of any kind; use at your own risk) here is my Cartesian product of lists code.

 

Jared Parsons’ Converting System.Func<T1..TN> to FSharpFunc<T,TResult>

Interop of delegate style types between F# and other .Net languages is a pain point that results from a fundamental difference in how delegates are represented in the F# language.

 

Steve Hawley’s Limit Your Memoization, Please

So the lesson in this (and in many CS problems) is that you need to really understand the specific domain of your problem before applying a sweeping technique like memoization.

 

Cameron Taggart’s Exploring the GAC with F# and Mono.Cecil

Mono.Cecil can be used to look inside assemblies. May be you want to search GAC to find types that implement a certain interface. In this post, I’ll show how to find all the types that implement IDisposable as an example.

 

Cameron Taggart’s Find Authenticode Signed Assemblies

Mono.Security can be used to check for the presence of an Authenticode signature on a assembly.

 

Gary Short’s XPO – F# Lists and Seqs Oh My!

Let’s assume we have a small database of people and we wish to calculate the combined age. The functional method of doing that would be to “fold” the elements of a collection of People over a function that accumulates the age of each person, in an accumulator value, which is threaded through the fold.

 

Mark Pearl’s F# Euler Problem 9

After some more thinking, I decided to use tuples instead and generate the permutations using the Seq.unfold method.

 

Maurizio Colucci’s How F# adapts to the way we think – part1

This is the first episode of a series meant to show how easily F# adapts to the way we think. I assume no knowledge of functional languages, but I do assume knowledge of an imperative language such as C#.

 

Wiston Gubantes’ F# Asynchronous Programming

Async programming in functional languages such as F# is such a breeze....

 

 

Community

Stack Overflow: Immutable data structures performance

Stack Overflow: Functional Reactive F# - Storing States in Games

One of my favorite things about the F# community is that its members tend to build things that are a bit more interesting, and think about concepts that are a bit deeper.  This week is no exception.  Come on in and see what’s been happening in the F# world.

A quick note to those giving F# talks or running events: If you would like listed here please don’t hesitate to contact me via the email link at the top of the page.  I’d love to help you help others to learn F#.

 

Events

Nashville Geek Lunch 11:30 AM Next Tuesday (7/27/2010)

 

 

Articles

Tomas Petricek’s The Duality of Object and Event references

In this article, I'll talk about an interesting example of duality that (to my best knowledge) wasn't described by anyone before. The two dual structures are references between objects in a normal program and references between events in a reactive application.

 

Marius Bancila’s Resources for the F# Presentation at Ronua Roadshow

The program that I shown exhibits traits of both functional (for computing the fractal) and object oriented (for displaying the fractal) paradigms.

 

Neil Carrier’s A Two-Instruction Virtual RISC

One of my favorite hobbies is building really tiny virtual computers. The experience has even paid off a time or two when I needed to create a compact domain-specific language (DSL).

 

Neil Carrier’s F#'s Little-Known (?) and (?<-) Operators

These two operators work similar to the C/C++ “stringizing” pre-processor operator. That is, they convert non-string code (limited to simple identifiers in the case of F#) into strings according to the following translation patterns:

 

Julien Ortin’s Arbitraging bookmakers with F#

The principle is rather simple.  Take the best quotes for each outcome, and process.  If the sum of 1/quote_i is less than one, an arbitrage opportunity exists.  The amount to bet on each outcome is 100/quote.

 

Vladimir Matveev’s Tricky late binding operators

F# Dynamic and DynamicAssignment operators are not as simple as they appear ex facte. Most popular sample of their usage is something like this:

 

Vladimir Matveev’s Playing with WebSharper

As a sample we’ll make simple StickyNotes application. Web design is not my primary and favorite skill, so I'll omit cross-browser compatibility and bind all styles to Firefox.

 

Naveen Srinivasan’s Using F# to Automate Reading–The Morning Brew

I like to try and automate most of the stuff . So I thought why not write a script that reads the Morning Brew feed, filter the excluded content that I am not interested in and open the urls before I come in.

 

Steve Gilham’s Building PartCover 4 on Vista

Following on from earlier in the week, I pulled the current trunk from SourceForge, and set about building it then putting it to work on some F# code which had caused an earlier version (the most recent available at the end of last year) to balk.

 

Gert-Jan van der Kamp’s Using a DataReader like a list in F#

This article demonstrates a technique how you can write recursive algorithms in F# using a Reader instead of a list, so you don't have to load all your data into memory first.

 

Steve Jenson’s Building F# on Mac OS X

Joe says his team at Microsoft runs into these issues often with users and was kind enough to walk me through the steps to get F# running on the mac.

As promised, a fresh batch of links to sooth your aching desire for more F#.  I’m particularly excited to announce I’ll give giving a F# tutorial this year at the Commercial Users of Functional Programming conference.  CUFP is going to have a lot of great content this year and will be well worth attending for anyone interested in functional programming.

 

News

FAKE – F# Make 1.40.5.0 Released

F# Jobs at Credit Suisse, London

I’ll be giving a F# tutorial at CUFP

 

 

Video

Steffen Forkmann speaks on F# Open Source Tools at the New England F# User Group

Presented at the New England F# User Group on June 7, 2010, Steffen discusses FAKE and NaturalSpec. Steffen is the author of the two open source F# projects "FAKE - F# Make" and "NaturalSpec".

 

 

Articles

Alex Pedenko’s Introducing Furious – A proof-of-concept RRM for F#

Meet furious. Furious is a RRM - a Record Relation Mapping system. It is a database-independent object query dsl for records, that currently has a (barebones) mysql implementation. Here's how it works. Suppose you have a record graph like so…

 

Vagif Abilov’s Exploring Amazon S3 with F#

The purpose of this article is to show how fast you can dig into low level details of an unknown technology using F#, and how little code you need to write. Therefore I keep the text of the article short, focusing just on the required steps.

 

Yin Zhu’s F# Async workflow application: a Flickr crawler

My strategy is to use the search query to search images with some specific tags and from the result page(as shown below), the url of each image is extracted, from which the image and its tags are then crawled.

 

Daniel Markham’s F# Versus Microsoft's Regex. A Lesson in Types

I was doing some text processing. As part of that, I set up a few RegExes. As I continued coding, I realized that I was following a pattern: apply the regex, check the match count, and if there were a bunch of matches, either get the first or last item.

 

Jon Harrop’s F# vs Mathematica: an even faster pricer for American options

This new optimized and parallelized F# solution is now a whopping 960× faster than the original Mathematica code from Sal Mangano's Mathematica Cookbook.

 

Neil Carrier’s Pure OOP – A Personal Retrospective

Almost instantly, my thoughts about the problem undergo a phase change, and I re-write my earlier code to be more succinct, maintainable, and composable, and usually more computationally efficient.

 

Neil Carrier’s Integer Square Roots

This is an old algorithm, once popular in assembly language programs on small processors. The fact that it uses only integers, addition, subtraction, and less-than branching, mean that its hardware and software requirements are at rock bottom.

 

Julien Ortin’s F# Event module extension

Functions to extend the F# Event module.

 

Julien Ortin’s Socket helpers in F#

This post describes a module to perform common socket operations using asynchronous operations and reactive programming.

 

Julien Ortin’s European Central Bank – extracting reference rates with F#

Every day, the European Central Bank publishes “official” reference FX (foreign exchange) rates where currencies are quoted against the Euro (expressed as EUR/XXX), or 1 EUR = xxx XXX.  The exchange rates of the last thirty sessions are available in xml format which we shall try to parse.  In order to do so, we use F# and active patterns, based on Don Syme’s draft paper.

 

Petr Lepilov’s F# interactive, AppFabric cache and PowerShell Part 1 and Part 2

Applications can store any serializable CLR object without worrying about where the object gets stored. Scalability can be achieved by simply adding more computers on demand. The cache also allows for copies of data to be stored across the cluster, thus protecting data against failures. It runs as a service accessed over the network.

 

Steve Gilham’s dotcover 1.0 beta – first impressions

Not having R# at home -- because I rarely use C# even if I'm writing for .net -- it's this which interested me more. So, I gave it a try on my current F# project

 

Kurt Schelfthout’s F# and Code Contracts: not quite there yet

In this post I’ll show how you can get Code Contracts sort of working for F#. From my very initial explorations, I would conclude that they seem basically usable for F# programming – but you’ll need some glue and tape, and not everything works as you’d expect.

 

Edmon Begoli’s Scala vs. F#, Application Programming Features Round 1 and Round 2

F# and Scala, two relatively recent programming languages, provide most .NET and Java software developers with new functional programming features that are worth understanding and evaluating.

 

Ivan Towlson’s F# pattern matching for beginners, Part 1, Part 2 and Part 3

Pattern matching provides a concise but clear and highly expressive way of writing conditional logic, because it combines the conditional flow with the ability to extract values of interest

About a year ago I was working on building our DotTwain ActiveX control and wrote two articles on some useful tips that I discovered.  Since that time, I’ve seen a problem on a few customer computers where, after upgrading once, the control would never run.  Instead, it would just try to reinstall after every page load.

After much frustration, it turned out that the problem is related to a little-known Internet Explorer registry entry called VerCache. 

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{GUID}] "VerCache"

I figured this out after noticing that every machine exhibiting this problem had the same value for VerCache.  Once the VerCache was set to this value, uninstalling did nothing.  The repeated-reinstallation behavior happened with any new version installed which shared the control GUID.

 

 

What’s a VerCache?

Strangely enough, searching for “VerCache” ActiveX gives you little more than an IE Team blog post and one MSDN forums entry.

At first, I was very excited when I found this IE team blog post.  It appeared that I had found my solution.

Here in the above mentioned screenshots they both are having same file date time stamps and that Causes the VerCache registry key to not get updated.

To resolve this , ensure that at least one of these parameters - “Created” date time stamp, “Modified” date time stamp or the file size, on the updated control is different from the old version of the control and you should be GTG!

Unfortunately, this information seems to be incorrect, or at least overly vague.  I observed the same bad VerCache value on different machines with different version of the control.  Each of these had different “created” and “modified” time stamps.  In fact, the CAB, the installer in the CAB, and the control assembly itself each had different “created” and “modified” time stamps for every single version.  I even tried updating the INF and setup launcher timestamps to no avail.

The only thing which did not vary consistently was file size as we rebuild and repackage our control for each DotImage version we release.

 

 

Some of the things I tried or considered.

Early on, I discovered simply deleting the registry key after uninstalling fixed the issue temporarily and was under the impression that it was a single bad version of the control causing this.  So, I wrote a small cleaner utility to fix the issue.  However, as time wore on it was apparent that this issue occurred in a somewhat random fashion with all versions of the control.

Another simple fix I thought about was updating the control GUID with each version.  However, this would require updating both our documentation and demos with every build.  Additionally, our customers would need to update their javascript with every upgrade.  This was unacceptable.

The next thing I tried was to have the installer launch a custom console program on install which cleaned the registry value.  This worked great in XP.  However, in Windows 7 the console program, even as admin, did not have access to the registry values I wanted to delete.

 

 

Finally, a solution.

In the end the only solution I found worked consistently and met our needs was to put custom installer actions into the control itself.  When both installing and uninstalling the installer calls the control’s custom actions which removes any existing VerCache value for the control.

 

First, I snagged a class I had made previously for cleaning guid-based registry entries:

Code Snippet
  1. public delegate bool RegActionBreakOnTrue(RegistryKey basekey, string key);
  2.  
  3. public class EventArgs<T> : EventArgs { private T eventData; public EventArgs(T eventData) { this.eventData = eventData; } public T EventData { get { return eventData; } } }
  4.  
  5. public class RegGuidCleaner
  6. {
  7.     string _guid;
  8.     public RegGuidCleaner(string guid)
  9.     {
  10.         _guid = guid;
  11.         Locations = new string[] {};
  12.     }
  13.  
  14.     public string[] Locations { get; set; }
  15.  
  16.     public RegistryKey GetPathBase(string path)
  17.     {
  18.         RegistryKey baseKey;
  19.         if (path.StartsWith(@"HKEY_CURRENT_USER\"))
  20.             baseKey = Registry.CurrentUser;
  21.         else if (path.StartsWith(@"HKEY_LOCAL_MACHINE\"))
  22.             baseKey = Registry.LocalMachine;
  23.         else
  24.             throw new ApplicationException("Unexpected location type: " + path);
  25.         return baseKey;
  26.     }
  27.  
  28.     private string GetBaselessPath(string location)
  29.     {
  30.         string truncatedLoc = location.Substring(location.IndexOf('\\') + 1);
  31.         return truncatedLoc;
  32.     }
  33.  
  34.     public void PerformRegActionForEach(RegActionBreakOnTrue action)
  35.     {
  36.         foreach (var location in Locations)
  37.         {
  38.             string fullPath = location + _guid;
  39.             RegistryKey baseKey = GetPathBase(fullPath);
  40.             string baselessPath = GetBaselessPath(fullPath);
  41.  
  42.             if (action(baseKey, baselessPath))
  43.                 break;
  44.         }
  45.     }
  46.  
  47.     public bool EnteriesExist
  48.     {
  49.         get
  50.         {
  51.             bool doesKeyExist = false;
  52.             PerformRegActionForEach((baseKey, subkey) =>
  53.             {
  54.                 var key = baseKey.OpenSubKey(subkey);
  55.                 if (key != null)
  56.                 {
  57.                     doesKeyExist = true;
  58.                     return true;
  59.                 }
  60.                 else
  61.                     return false;
  62.             });
  63.             return doesKeyExist;
  64.         }
  65.     }
  66.  
  67.     public void DeleteEntries()
  68.     {
  69.         PerformRegActionForEach((baseKey, subkey) =>
  70.         {
  71.             try
  72.             {
  73.                 Messages(this, new EventArgs<String>("Deleting Registry Key: " + baseKey.ToString() + @"\" + subkey));
  74.                 baseKey.DeleteSubKeyTree(subkey);
  75.             }
  76.             catch (Exception ex)
  77.             {
  78.                 Messages(this, new EventArgs<String>(ex.ToString()));
  79.             }
  80.  
  81.             return false;
  82.         });
  83.     }
  84.  
  85.     public event EventHandler<EventArgs<String>> Messages = delegate { };
  86. }

Please forgive the catch (Exception ex).  So far it has been unnecessary to handle failure cases for anything other than logging.

 

Next, I added a custom installer class to remove the entries:

Code Snippet
  1. [RunInstaller(true)]
  2. public partial class RegistryCleanerInstallerClass : Installer
  3. {
  4.     public RegistryCleanerInstallerClass()
  5.     {
  6.         InitializeComponent();
  7.     }
  8.  
  9.     private void CleanVerCache()
  10.     {
  11.         try
  12.         {
  13.             RegGuidCleaner cleaner = new RegGuidCleaner("{" + typeof(AcquisitionControl).GUID + "}");
  14.             cleaner.Locations = new string[] {
  15.                 @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\",
  16.              };
  17.  
  18.             cleaner.DeleteEntries();
  19.         }
  20.         catch { }
  21.     }
  22.  
  23.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  24.     public override void Install(IDictionary stateSaver)
  25.     {
  26.         base.Install(stateSaver);
  27.         CleanVerCache();
  28.     }
  29.  
  30.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  31.     public override void Commit(IDictionary savedState)
  32.     {
  33.         base.Commit(savedState);
  34.     }
  35.  
  36.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  37.     public override void Rollback(IDictionary savedState)
  38.     {
  39.         base.Rollback(savedState);
  40.         CleanVerCache();
  41.     }
  42.  
  43.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  44.     public override void Uninstall(IDictionary savedState)
  45.     {
  46.         base.Uninstall(savedState);
  47.         CleanVerCache();
  48.     }
  49. }

 

I also decided to move the com registration into a custom action as well.  The installer-based registration had been intermittently not working which caused us to hand test every release version of the control before sending it out.

Code Snippet
  1. [RunInstaller(true)]
  2. public partial class ComRegisterInstallerClass : Installer
  3. {
  4.     public ComRegisterInstallerClass()
  5.     {
  6.         InitializeComponent();
  7.     }
  8.  
  9.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  10.     public override void Install(IDictionary stateSaver)
  11.     {
  12.         base.Install(stateSaver);
  13.  
  14.         try
  15.         {
  16.             RegistrationServices regSrv = new System.Runtime.InteropServices.RegistrationServices();
  17.  
  18.             if (!regSrv.RegisterAssembly(
  19.                 this.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))
  20.             {
  21.                 throw new InstallException("Failed to register componenet for COM interop");
  22.             }
  23.         }
  24.         catch
  25.         {
  26.         }
  27.     }
  28.  
  29.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  30.     public override void Commit(IDictionary savedState)
  31.     {
  32.         base.Commit(savedState);
  33.     }
  34.  
  35.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  36.     public override void Rollback(IDictionary savedState)
  37.     {
  38.         base.Rollback(savedState);
  39.  
  40.         try
  41.         {
  42.             RegistrationServices regSrv = new System.Runtime.InteropServices.RegistrationServices();
  43.  
  44.             if (!regSrv.UnregisterAssembly(this.GetType().Assembly))
  45.             {
  46.                 throw new InstallException("Failed to unregister componenet for COM interop");
  47.             }
  48.         }
  49.         catch
  50.         {
  51.         }
  52.     }
  53.  
  54.     [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
  55.     public override void Uninstall(IDictionary savedState)
  56.     {
  57.         base.Uninstall(savedState);
  58.  
  59.         try
  60.         {
  61.             RegistrationServices regSrv = new System.Runtime.InteropServices.RegistrationServices();
  62.  
  63.             if (!regSrv.UnregisterAssembly(this.GetType().Assembly))
  64.             {
  65.                 throw new InstallException("Failed to unregister componenet for COM interop");
  66.             }
  67.         }
  68.         catch
  69.         {
  70.         }
  71.     }
  72. }

 

Finally, I added the the custom action calls to the installer.

customAction1

customAction2

 

This still won’t allow an existing broken control to upgrade.  However, after manually uninstalling the old control, the new one will install and work fine.  At least that’s what I’ve found in IE 8.0.7600.16385 Update 0 on Windows 7 Enterprise 64-bit.  ActiveX tends to be a bit of a moving target these days.

Now, let’s hope I never need speak of this again.

This week we once again reap another huge crop of fantastic F# content.  In fact, it’s been getting so overwhelming that I’ll be moving to an every week format from here on out.  Please come in, read, and enjoy! 

 

News

A New F# Case Study on Microsoft.com

With its new tools, the bank can speed development by 50 percent or more, improve quality, and reduce costs.

 

Next F# London Meetup Announced: July 28th

The next meetup of the F#unctional London Meetup Group will be held on July 28, with Zach Bray talking on Agile Acceptance Testing with F#

 

Tim Anderson (of The Register) Interviews Don Syme

I met Syme at the QCon conference in London, in March 2010, and interviewed him shortly afterwards. Some quotes from that interviewed have already been published in an article for The Register, but I am now posting nearly all of it here.

 

DotNetKicks Now has a F# Section

Thanks to everyone on twitter who voted!

 

Quantifa 0.0.2 Released

Quantifa is an F# open-source library for quantitative finance and risk management.

 

F#-mode for Emacs updated to 0.3

The F# mode for Emacs is two years old, and has been downloaded more than 1,000 times.

 

Tables: Organize Your Files. Written in F#

Tabbles is a new way of organizing files: it combines virtual folders and tags, and auto-organizes and tags your files in very intelligent ways.

 

 

Audio / Video

Svea Ekonomi on F# for automated billing system for the Telecom industry

In earlier versions of the billing system, much of the business logic resided in SQL Server and various Perl and Java programs. That made the solution hard to maintain and tailor to the needs of the customers. By using F# instead of an object oriented language the developers at Svea Ekonomi can be a lot more productive.

 

 

Articles

 

Ian Voyce’s Minilight renderer in F#

I’m a sucker for eye-candy, and the other day I came across the beautifully lit renders produced by Minilight. It’s a nice, minimal implementation of a global illumination renderer that’s been ported to a wide variety of different languages from C to ActionScript. So of course, I couldn’t resist trying to implement it in F#.

 

Jon Harrop’s F# vs Mathematica: fast pricer for American options

Another example from Sal Mangano's Mathematica Cookbook, this time taken from Andreas Lauschke's example, is a "fast" pricer for American options. The relevant section of the book stresses the importance of performance in this context and the Mathematica code presented was heavily optimized by experts.

 

Jon Harrop’s F# vs Mathematica: parametric plots

Another example from Sal Mangano's Mathematica Cookbook (p.520) is an elegant little Mathematica program that uses a crude numerical integrator to plot the trajectory of a differential equation representing the populations of predators (foxes) and prey (rabbits):

 

Jon Harrop’s F# vs Mathematica: red-black trees

The simpler F# solution is also 20× faster at inserting 100k elements and 100× faster at computing the range of depths in the resulting tree.

 

Jon Harrop’s Lorenz Attractor

The Lorenz attractor is a fractal derived from the trajectory of a 3-dimensional dynamical system that exhibits chaotic flow. This blog post describes a 35-line program that computes trajectories of this attractor and visualizes them as a beautiful whisp using Windows Presentation Foundation.

 

Neil Carrier’s Composable Order Relations

Even before I started experimenting, I realized that checking a list for sorting was just a specific example of checking whether the pairs in a list satisfied a certain binary order relation. So I decided to work directly on a more general solution.

 

Neil Carrier’s Continuation-Passing Mnemonics

Learning to construct continuations can be tough. It’s easy to state how they work: they facilitate tail recursion by recursively passing the remainder of a computation. But it can be a lot harder to actually get one working from scratch.

 

Neil Carrier’s Dijkstra’s Shunting-Yard Algorithm

Without further ado, here is my first F# implementation of Dijkstra’s shunting-yard algorithm, including a basic test (based on the example at Wikipedia). This is probably not a minimal or most-efficient implementation, but it is a starting place.

 

Neil Carrier’s Arity and Unit Arguments in F# 2.0

While working on an internal domain-specific language, I encountered a case where passing a unit into a function made the syntax somewhat more readable. The completely artificial example below illustrates the concept as the function xfer1. I also tried a two-unit version, which is illustrated as xfer2.

 

Daniel Mohl’s Presentation: 5 Best Practices for F# Development slides and examples

Thanks to all who come out to the New England F# User Group meeting tonight!

 

Tomas Petricek’s Dynamic in F#: Reading data from SQL database

If you ever tried to call a SQL stored procedure directly using the SqlCommand, then you can surely appreciate the elegance of this code snippet. Let's now take a look at a larger example and some of the neat tricks that make this possible...

 

Erik Schulz’s Cartesian Tree Sort – Revisited, Cartesian Tree Sort – Skew Heap and Beating Quick Sort - Cartesian Tree Merge

After looking at skew heap, merge sort and Cartesian tree, I figured there has to be a way to combine all three.

 

Julien Ortin’s SEO Analysis in F#, and SEO Analysis in F#, a friendly application

Last time, we created a library of Search Engine Optimization (SEO) helpers. This time we’ll see how to use them to actually fetch information about your webiste rankings (and your competitors’).

 

Julien Ortin’s European Central Bank – extracting reference rates with F#

Every day, the European Central Bank publishes “official” reference FX (foreign exchange) rates where currencies are quoted against the Euro (expressed as EUR/XXX), or 1 EUR = xxx XXX. The exchange rates of the last thirty sessions are available in xml format which we shall try to parse.  In order to do so, we use F# and active patterns, based on Don Syme’s draft paper.

 

Anton Tayanovskyy’s Optimizing JavaScript with F#

The need for optimizing JavaScript is very peculiar. This is not about delivering top wall-clock performance, but rather delivering the most compact (in Release mode) and most readable (in Debug mode) source. In the case of WebSharper™, it is also about relieving the compiler and the macro writer from the burden of emitting optimal code.

 

Chris Ballard’s My First F# Post

That said, this post will take you through my solution for Euler 54, which (somewhat unusually) isn't a particularly mathematical problem, but turns out to be a great way to demonstrate some of the features of the F# language. The basic principle of this problem is to compare two hands of cards in the game of poker, and to determine which is the winning hand.

 

Chris Ballard’s Prime Numbers - Building the EulerMaths library in F#

Those of you who are doing Project Euler know what I am talking about by the EulerMaths library. There are certain fundamentals which crop up again and again in the questions and it is important to work these into a reusable and performant library.

 

Daniel Mohl’s WPF MVVM Multi-Project Template: A Polyglot Approach

As an advocate for using the right tool for the job, I have created a new WPF MVVM multi-project template composed of an C# View project, an F# ViewModel project, and an F# Model project. 

 

Rodolfo Ortega’s Eliza like chat bot in F# language for fun

This is a very simple Eliza like chat bot. I call it Meliza Sharp. I wrote it for having fun learning the F# language shipped with Visual Studio 2010.

 

Mauricio Scheffer’s Abusing PrintfFormat in F#

Pretty cool, huh? This trick can be used for other things, since PrintfFormatProc is fully reusable. For example, I'm currently using PrintfFormat manipulation to define type-safe routing in a web application

 

Mark Pearl’s Depressingly simple text file access

Today I was doing some work work and kept having to parse a log file. After a few hours of doing the same routine stuff I thought I might try and automate it using F#.

 

Mathias’s On the road from C# to F#: reading stock quotes and more stocks

Mads Kristensen has a nice post where he shows how to read  stock quotes from Yahoo finance using C#, which was very helpful to get started. I figured it would be interesting to try out a conversion to F# and see what the result looked like.

More Posts Next page »