I thought it would be nice to share some of the technical books that I have learnt most from, and still love to look through or use as reference to this day. These are in no particular order and cover a variety of technical subjects, and some are far from recent. If you are interested in any of these areas and have not read these books, I cannot recommend them highly enough! I have many, many many books and have read countless over the years, many of them are awesome but are not making this list as it would just be too long. I also have lots of books that are simply terrible (and I still have most of those too…!)
The nuget package is still pre-release. You can find it in Visual Studio by toggling the search filter to include pre-release packages. I'm sure Xamarin has a similar feature. Once this work has been tested well enough, I will likely upgrade the SQL Provider to a proper release.
Did you know that it is the 50th anniversary of the BASIC programming language today? (1st May) No? Well why not! BASIC is the language that brought computers to the mainstream. Back in the day, if you had a computer, you learnt how to program it in basic. Infact, when you switched it on, that’s what you were presented with. These computers wanted to be programmed. Thousands of people purchased these expensive computers purely to learn how to program them.
I figured I should do something to mark the anniversary. Many of you will already know about my various crazy type providers, including MineSweeper and Choose Your Own Adventrue. So, I thought to myself, wouldn’t it be great if we could write some equivalents of the very early BASIC games via a re-usable and extensible type provider? One which doesn’t require you to write any type-providing code, but is abstracted away from all that …
Tomas Petricek posted an article recently about how he used F# to solve a puzzle he had been given for Christmas. This reminded me of several similar mini-projects I have developed in the past, the most recent being a program to help solve a specific sort of puzzle in the game Puzzle Quest, which I shall now describe.
Puzzle Quest is a match-3 game, with various game modes. One game mode in particular, “Capture”, has a specific layout of tiles which can be matched in a certain way to leave no tiles behind at the end. Some of these are really quite tricky, and I thought it would be fun to write a program to solve them. Here is a example of a puzzle:
Someone asked me what the secret type provider I am working on is. I neglected to tell them, and instead joked that it would be the Don Syme type provider. Later I reflected that the idea had actually been a stroke of genius, so just knocked this together in 20 of your English minutes – the Don Syme fact provider! It will produce an endless stream of true facts about the mystery man known as the Father of F#. Get it from my github here.
Being able to play Mine Sweeper inside your IDE via intellisense, that is what you have always wanted right? Well, I’m always willing to lend a hand! With this fantastic new type provider you can pretend you are working when really you are avoiding mines. To get started simply clone and build the provider from here. Reference your new shiny type provider library from a script file and create a type alias and then an instance of it like so:
Introducing my latest top-o-the-line type provider that everyone wants and needs. The Squirrelify provider! This very useful type provider will create an INFINITE type system and show you random pictures of ASCII art in intellisense.
It turns out that intellisense was not really designed for this and it struggles with various formatting and layout, but the provider tries the best it can. It also doesn't have many images as I couldn't find a webservice for them and had to do it manually.
"Wow Ross!" I hear you cry. "How can we get started with this??"
It's easy! simply go and build the source from here, then reference the library it produces in a script file as shown in the picture below. Once you have done that, you will need to alias a type and call create() on it. The resulting type will have an infinite series of properties named``Squirrelify!``which will display said ASCII art.
Note that this is the LITE version of the type provider. They PRO pay-for version includes a static parameter "keyword" which is used to search google images, convert said images to ASCII and display them.
edit - this is not just squirrels. You can expect other delights such as unicorns, snowmen, and various other things you will not be able to identify
This post is intended to show how easy it is to use the F# programming language in order to explore new libraries and get stuff going quickly. It also shows the usage of various great F# features such as Record Types, Discriminated Unions, Computation Expressions and Async workflows, whilst also using a bit of mutable state, integrating with various other 3rd party .NET libraries (including use of an XBOX pad and even a Kinect!), and even some low level bit shifting and masking stuff.
F# is definitely NOT just for number crunching programs!
So, the step-son got a toy robotic arm for Christmas (no, not from me), which he has largely ignored. Partly this was due to the lack of batteries in it, which we addressed recently. However, he still wasn't really interested in it, so I figured I would have a play with it instead (a couple of weeks ago). It was either that or write documentation for the SQLProvider.
After my talk last night, several people expressed an interest in the script I was using to draw the LINQ expression trees. I have uploadedhere on github.
This is just a script I use in development. It doesn't visualize every node by a long shot, and does a fair bit of name replacing to make some of the very long generic type names readable. You will need GraphVizinstalled to use this script. You might need to point the function that does the generation at the location where you've installed it.
You can use it like this from FSI :
1 2 3
#load "GraphViz.fsx" FSharp.Data.Sql.Common.QueryEvents.LinqExpressionEvent |> Observable.add GraphViz.toGraph
Now, whenever you evaluate a query expression, it will pop up a bunch of images with whatever your machine uses to view SVG files, like this rather lovely one below. Have fun.
edit; this will spam your temp directory with svg files!
The provider now has support for connecting to PostgreSQL databases! How exciting. Like SQLite, this new mode uses dynamic assembly loading and is based on the .NET connector libraries here.