<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>C# ASP.Net MVC Developer 

Links

Shared google reader</description><title>Dave Morrow</title><generator>Tumblr (3.0; @davemorrow)</generator><link>http://davemorrow.tumblr.com/</link><item><title>97 Things</title><description>&lt;p&gt;I came across this link to the wiki for contributions made to the book &amp;#8220;97 Things Every Programmer Should Know&amp;#8221;. It&amp;#8217;s well worth a read as there are some real nuggets in here. I would recommend reading one a day and trying to apply it to your workplace.&lt;/p&gt;
&lt;p&gt;&lt;a title="link" href="http://programmer.97things.oreilly.com/wiki/index.php/Contributions_Appearing_in_the_Book"&gt;&lt;a href="http://programmer.97things.oreilly.com/wiki/index.php/Contributions_Appearing_in_the_Book"&gt;http://programmer.97things.oreilly.com/wiki/index.php/Contributions_Appearing_in_the_Book&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/7115656992</link><guid>http://davemorrow.tumblr.com/post/7115656992</guid><pubDate>Fri, 01 Jul 2011 05:57:00 -0400</pubDate></item><item><title>Joining the Apple band-wagon</title><description>&lt;p&gt;I got an iPad (not an iPad 2, but an iPad 1).&lt;/p&gt;
&lt;p&gt;A good deal came up that I couldn&amp;#8217;t resist. I knew someone that had bought an iPad 2 and wanted to recoup som of the cost so I got it for less than half the price of a new one and in pristine condition.&lt;/p&gt;
&lt;p&gt;Aside from using it for general browsing, reading comics and, of course, wasting time playing Angry Birds, I&amp;#8217;d like to start looking into development with Mono. But now I hear that the future of Mono is less than certain, with rumours that the development team has been made redundant since Novell was sold to Attachmate.&lt;/p&gt;
&lt;p&gt;The latest update on &lt;span id="_mce_start"&gt;﻿&lt;/span&gt;the subject is &lt;a href="http://www.infoq.com/news/2011/05/Mono-Future"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I think it&amp;#8217;s still worth looking into. As a .Net developer it looks like it has a lot more to offer than Objective C (which will be covered in an upcoming workshop series).&lt;/p&gt;
&lt;p&gt;The question has to be; Will any investment in learning Mono have any benefits now?&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5389387273</link><guid>http://davemorrow.tumblr.com/post/5389387273</guid><pubDate>Wed, 11 May 2011 08:31:06 -0400</pubDate></item><item><title>Progressive Postponed</title><description>&lt;p&gt;Well it looks like I won&amp;#8217;t be going on the Progressive .Net course until September as it has been postponed.&lt;/p&gt;
&lt;p&gt;The irritating thing is - I was only officially informed yesterday (the day I would have been booking into a hotel in London). It was only because we chased for the full agenda and joining instructions for the course that we found out.&lt;/p&gt;
&lt;p&gt;Shame - I was looking forward to some advanced NHibernate among other things.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5389138597</link><guid>http://davemorrow.tumblr.com/post/5389138597</guid><pubDate>Wed, 11 May 2011 08:12:47 -0400</pubDate></item><item><title>jQuery.extend()</title><description>&lt;p&gt;jQuery extend is designed to merge objects together, so in a simple example, you could merge the following objects.&lt;/p&gt;
&lt;p&gt;var customer={&lt;/p&gt;
&lt;p&gt;   firstname:&amp;#8221;Bob&amp;#8221;,&lt;/p&gt;
&lt;p&gt;   lastname:&amp;#8221;Smith&amp;#8221;,&lt;/p&gt;
&lt;p&gt;   favouriteColour: &amp;#8220;Blue&amp;#8221;&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;var customerAddress={&lt;/p&gt;
&lt;p&gt;    street:&amp;#8221;long street&amp;#8221;,&lt;/p&gt;
&lt;p&gt;    county: &amp;#8220;sussex&amp;#8221;&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;var customerWithAddress = $.extend({}, customer, customerAddress);&lt;/p&gt;
&lt;p&gt;Note: The first argument is the target object. In this case we are using an anonymous empty object using the curly brace syntax.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5216815984</link><guid>http://davemorrow.tumblr.com/post/5216815984</guid><pubDate>Thu, 05 May 2011 08:30:06 -0400</pubDate></item><item><title>jQuery.map()</title><description>&lt;p&gt;jQuery&amp;#8217;s map method is usefull for manipulating entire arrays.&lt;/p&gt;
&lt;p&gt;For example, let&amp;#8217;s say you have an array of prices and you want to add VAT to them all, you could do that easily with jQuery map.&lt;/p&gt;
&lt;p&gt;An example:&lt;/p&gt;
&lt;p&gt;var VAT=0.20;&lt;/p&gt;
&lt;p&gt;&lt;span class="kwd"&gt;var&lt;/span&gt;&lt;span class="pln"&gt; pricesExVAT &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;[&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="str"&gt;10.50, 1.00, 3.00, 5.99&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;];&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br/&gt;var pricesIncVAT &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="pln"&gt;    jQuery&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;map&lt;/span&gt;&lt;span class="pun"&gt;(pricesExVAT &lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;function&lt;/span&gt;&lt;span class="pun"&gt;(item&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; index&lt;/span&gt;&lt;span class="pun"&gt;){&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;        &lt;/span&gt;&lt;span class="kwd"&gt;return&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;(item * VAT&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;    &lt;/span&gt;&lt;span class="pun"&gt;});&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5188187376</link><guid>http://davemorrow.tumblr.com/post/5188187376</guid><pubDate>Wed, 04 May 2011 08:30:06 -0400</pubDate></item><item><title>jQuery.grep()</title><description>&lt;p&gt;Recently I needed to search a array of javascript objects and one of the ways I found to do this was using jQuery&amp;#8217;s grep method.&lt;/p&gt;
&lt;p&gt;Grep was originally a unix command line function for searching for text in files. It&amp;#8217;s very powerful. The jQuery method obviously has little to do with it&amp;#8217;s namesake, but the core idea is there - for identify matches (searching).&lt;/p&gt;
&lt;p&gt;Like all jQuery methods, grep takes a method. This method returns true for a match and false for no match. The method returns an array of all the matches.&lt;/p&gt;
&lt;p&gt;So, you can use it to find a particular match as I needed to, or to return a list of all matches for less restrictive searches, such as:&lt;/p&gt;
&lt;p&gt;&lt;span class="kwd"&gt;var&lt;/span&gt;&lt;span class="pln"&gt; customers&lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;[&lt;/span&gt;&lt;span class="pln"&gt; &amp;#8220;dave smith&amp;#8221;&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="lit"&gt;&amp;#8220;dave jones&amp;#8221;&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="lit"&gt;&amp;#8220;alan smith&amp;#8221;&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="lit"&gt;&amp;#8220;bob jones&amp;#8221;&lt;/span&gt;&lt;span class="pun"&gt;];&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;var customersCalledDave &lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="pln"&gt;    jQuery&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;grep&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;customers&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;function&lt;/span&gt;&lt;span class="pun"&gt;(item&lt;/span&gt;&lt;span class="pun"&gt;,&lt;/span&gt;&lt;span class="pln"&gt; index&lt;/span&gt;&lt;span class="pun"&gt;){&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;       &lt;/span&gt;&lt;span class="kwd"&gt;return&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;item.&lt;span class="pln"&gt;indexOf&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="str"&gt;&amp;#8220;dave&amp;#8221;&lt;/span&gt;&lt;span class="pun"&gt;)&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;!=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="lit"&gt;1&lt;/span&gt;&lt;span class="pun"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="pun"&gt;);&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;&lt;/span&gt;&lt;span class="pun"&gt;    });&lt;/span&gt;&lt;span class="pln"&gt; &lt;br/&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5159474174</link><guid>http://davemorrow.tumblr.com/post/5159474174</guid><pubDate>Tue, 03 May 2011 08:30:06 -0400</pubDate></item><item><title>Progressive Net</title><description>&lt;p&gt;Only a few days now till I&amp;#8217;m off to the Progressive .Net course in London with a couple of collegues.&lt;/p&gt;
&lt;p&gt;I still haven&amp;#8217;t received a full agenda yet, but I do know Ayende is going to do a couple of sessions on Advanced NHibernate so I look forward to those.&lt;/p&gt;
&lt;p&gt;I have also noticed that they&amp;#8217;ve scheduled another &lt;a href="http://skillsmatter.com/event/open-source-dot-net/progressive-dot-net-tutorials-2011"&gt;course&lt;/a&gt; this year in September, so if it&amp;#8217;s any good, some other members of the team will have an opportunity to attend.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5130639072</link><guid>http://davemorrow.tumblr.com/post/5130639072</guid><pubDate>Mon, 02 May 2011 08:30:05 -0400</pubDate></item><item><title>No cream tea.</title><description>&lt;p&gt;Just a quick note that &lt;a href="http://www.dddsouthwest.com/"&gt;DDD South West&lt;/a&gt; is going to be on Saturday 11th June, but it looks like I&amp;#8217;m going to miss out this time round due to other commitments. A shame as it&amp;#8217;s a really good event and has always been well organised.&lt;/p&gt;
&lt;p&gt;Luckily I did attend &lt;a href="http://davemorrow.tumblr.com/post/3012265870/ddd9"&gt;DDD 9&lt;/a&gt; @ Reading earlier this year and often there are similarities in some of the sessions, so hopefully I wont miss too much&lt;/p&gt;
&lt;p&gt;However it does mean I&amp;#8217;ll be missing out on the cream tea and cornish pasties :(&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5098513827</link><guid>http://davemorrow.tumblr.com/post/5098513827</guid><pubDate>Sun, 01 May 2011 08:30:06 -0400</pubDate></item><item><title>Manic Month</title><description>&lt;p&gt;It&amp;#8217;s been really busy the last few weeks as I&amp;#8217;ve been taking on additional tasks as well as keeping up (for the most part) with my dev work.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve been taking a lead role for a project for one of our less experienced developers, performing telephone and first interviews with a collegue and starting to pick up some slack in an application that&amp;#8217;s overdue for having legacy technology replaced with something more current - and that has meant my estimates have been way short (the Devil is definately in the detail when dealing with legacy code).&lt;/p&gt;
&lt;p&gt;And what with the double-double-bank-holiday-weekend everyone has decided to take advantage and book up some holiday (and quite rightly so!). Anyway, this has left a team that&amp;#8217;s less than half the usual size - luckily it&amp;#8217;s been quite quiet, so I can&amp;#8217;t complain too much ;)&lt;/p&gt;
&lt;p&gt;All this has meant the cancelling of our monthly tech breifing for this month and the postponing of our newly started workshop series. On the tech breifing front, it&amp;#8217;s prob a good thing as I haven&amp;#8217;t prepared my Pub/Sub Death Match grok talk yet so now I can use the time to prepare it for next month.&lt;/p&gt;
&lt;p&gt;As for the workshop, which is titled &amp;#8221;Document (or No-SQL) Databases&amp;#8221;, this has only been postponed until next month when everyone is back in - so no losses there.&lt;/p&gt;
&lt;p&gt;But this has all given me a well overdue break in which to relax. It&amp;#8217;s amazing that last week&amp;#8217;s four day weekend was the first weekend in months that actually felt like a weekend!&lt;/p&gt;
&lt;p&gt;I guess it all goes to prove it&amp;#8217;s far too easy to forget just how much we can take on in one go - and that we all need a break from time to time. The skill is in learning to recognise it before it becomes a problem.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/5095844047</link><guid>http://davemorrow.tumblr.com/post/5095844047</guid><pubDate>Sun, 01 May 2011 04:48:57 -0400</pubDate></item><item><title>Lightcycles for breakfast?</title><description>&lt;p&gt;Yesterday the team had an early start (I&amp;#8217;m not going to say we were all bright at 8am!).&lt;/p&gt;
&lt;p&gt;The reason? Another part of our workshop on learning F#.&lt;/p&gt;
&lt;p&gt;My collegue Mark took the helm and what awsome job he did of it. This session put the goal of developing a Tron-style lightcycles game in F# and using Silverlight as the presentation layer.&lt;/p&gt;
&lt;p&gt;So, in an hour we hadn&amp;#8217;t quite managed to pull it off, but with Mark&amp;#8217;s research to back us up we&amp;#8217;d got to the stage where we had keypress handling and a moving lightcycle.&lt;/p&gt;
&lt;p&gt;In the course of this exercise we&amp;#8217;d learnt an awful lot of F#. Aside from the obvious pattern matching and pipe operators we also discovered the type keyword for types (basically the same as classes), the mutable keyword to allow changing of sets and lists, member for public properties and the &amp;lt;- operator to set values.&lt;/p&gt;
&lt;p&gt;The latter needs to be used with the do binding, which according to &lt;a title="MSDN" href="http://msdn.microsoft.com/en-us/library/dd393786.aspx"&gt;MSDN&lt;/a&gt; is used when you want to execute code independently of a function or value definition. I think it&amp;#8217;ll be a while before I fully understand what that&amp;#8217;s all about.&lt;/p&gt;
&lt;p&gt;Oh, and one gotcha which caught everyone out was the order of F# files. Oh, yes - you need to ensure all functions and types are declared before they&amp;#8217;re used. This means you may need to right-click a file in the solution explorer and choose &amp;#8220;Move Up&amp;#8221;!&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3897613561</link><guid>http://davemorrow.tumblr.com/post/3897613561</guid><pubDate>Wed, 16 Mar 2011 08:31:07 -0400</pubDate></item><item><title>To the code</title><description>&lt;p&gt;Creating queues isn&amp;#8217;t something I&amp;#8217;ll be need to be coding too often, but as I managed to uninstall MSMQ earlier today as I installed NServiceBus, I think it&amp;#8217;s wise choice to add these few lines of code to my test app.&lt;/p&gt;
&lt;blockquote&gt;const string QueueName = @&amp;#8221;.\Private$\MyNewQueue&amp;#8221;;
&lt;p&gt;MessageQueue queue;&lt;/p&gt;
&lt;p&gt;if(!MessageQueue.Exists(QueueName))&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;    queue = MessageQueue.Create(QueueName);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;else&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;queue = new MessageQueue(QueueName);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Adding a message to a queue is fairly straightforward, but it&amp;#8217;s a shame we need to do some jiggery-pokery with types for the XmlMessageFromatter to do it&amp;#8217;s job properly.&lt;/p&gt;
&lt;blockquote&gt;

&lt;p&gt;var message = new Message(messageBody,&lt;/p&gt;
&lt;p&gt;new XmlMessageFormatter(new[]{typeof(string)})&lt;/p&gt;
&lt;p&gt;);&lt;/p&gt;
&lt;p&gt;message.Label = &amp;#8220;Message Label&amp;#8221;;&lt;/p&gt;
&lt;p&gt;queue.Send(message);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Retreiving a message from a queue is fairly similar to the adding code but this time we also need to cast the message content to the correct type, which in this example is a string.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;var queue = new MessageQueue(QueueName);&lt;/p&gt;
&lt;p&gt;Message msg = queue.Receive();&lt;/p&gt;
&lt;p&gt;msg.Formatter =&lt;/p&gt;
&lt;p&gt;new XmlMessageFormatter(new[]{typeof(string)});&lt;/p&gt;
&lt;p&gt;var messageBody = (string) msg.Body;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It&amp;#8217;d be interesting to dig into MassTransit and NServiceBus to see how they deal with the typing issues - luckily the source code is openly available for both.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3830343466</link><guid>http://davemorrow.tumblr.com/post/3830343466</guid><pubDate>Sun, 13 Mar 2011 09:30:08 -0400</pubDate></item><item><title>Configuring MSMQ</title><description>&lt;p&gt;MSMQ can be installed from Windows Components in Add/Remove Programs.&lt;/p&gt;
&lt;p&gt;Once installed you can access the queues from Computer Managment and selecting Message Queuing from Services and Applications.&lt;/p&gt;
&lt;p&gt;You&amp;#8217;ll find the queues are divided into several categories. Private Queues are only available on the local machine, whereas Public queues are published in Active Directory and are therefore available on the network. For my code examples I&amp;#8217;ll stick with private queues before I look at implementing a proper across network test.&lt;/p&gt;
&lt;p&gt;There are also some system queues that are generated by MSMQ - Dead letter queues are for messages that can&amp;#8217;t be delivered and Journal queues contain copies of removed messages (although I haven&amp;#8217;t seen this in practice).&lt;/p&gt;
&lt;p&gt;Aside from configuring permissions you can actually see message contents in the queue by double-clicking one and clicking on the body tab. Instantly I can see that using the XMLMessageFormatter will be more useful for diagnoses than the BinaryMessageFormatter. There&amp;#8217;s also an ActiveXMessageFormatter but I&amp;#8217;ll take a closer look at these another time.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3805733817</link><guid>http://davemorrow.tumblr.com/post/3805733817</guid><pubDate>Sat, 12 Mar 2011 08:30:08 -0500</pubDate></item><item><title>MSMQ Overview</title><description>&lt;p&gt;I haven&amp;#8217;t been able to find anything in the way of books on MSMQ and to be honest I don&amp;#8217;t think I&amp;#8217;d want to read a whole book on the subject - chances are it&amp;#8217;d be focused on configuration and other things a Network Admin would be interested in and I&amp;#8217;d be lucky to find a single line of code. If anyone knows any differently, then please let me know.&lt;/p&gt;
&lt;p&gt;So, all I currently know about MSMQ comes from the net. One of the problems though is that it&amp;#8217;s been around for over 10 years, so I&amp;#8217;m always skeptical that what I&amp;#8217;m reading has been superceded in the latest version.&lt;/p&gt;
&lt;p&gt;So, it would seem that MSMQ caters for most of the basics you&amp;#8217;d expect from a messaging technology - it stores messages in queues which provides resilience, it supports transactions and distributed transactions as well as secure messages.&lt;/p&gt;
&lt;p&gt;It can also be clustered and load-balanced. As much as I don&amp;#8217;t need to know all about that now I will need to research it a bit as it could become an issue a few months down the line.&lt;/p&gt;
&lt;p&gt;MSMQ can&amp;#8217;t handle transactions AND clustering together. It also doesn&amp;#8217;t support messages over 4Mb, although I&amp;#8217;m aware of patterns that cater with large or multi-part messages&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3783873387</link><guid>http://davemorrow.tumblr.com/post/3783873387</guid><pubDate>Fri, 11 Mar 2011 08:30:07 -0500</pubDate></item><item><title>Messaging, please wait.</title><description>&lt;p&gt;For a while now I&amp;#8217;ve been meaning to look at messaging platforms. I was intending to download MassTransit, figure out how it works and then start using it but making a decision on frameworks before trying out some alternatives seems a very narrow minded approach.&lt;/p&gt;
&lt;p&gt;Before I delve into the messaging frameworks themselves I took a bit of time to take a quick look at MSMQ itself. I&amp;#8217;m pretty confident that MSMQ is the technology we&amp;#8217;ll be using as it&amp;#8217;s been provided with Windows Servers since NT 4.0 and is included with Windows 7. That said, I can always follow up this research afterwards by looking at the alternatives and there may be some reasons to do that.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3763008558</link><guid>http://davemorrow.tumblr.com/post/3763008558</guid><pubDate>Thu, 10 Mar 2011 08:30:07 -0500</pubDate></item><item><title>F# and .Net libraries</title><description>&lt;p&gt;I thought I&amp;#8217;d take a slight detour from the purely functional stuff we&amp;#8217;ve been doing of late - sometimes as developers we need to write code that does something other than just algorithms and computations.&lt;/p&gt;
&lt;p&gt;So it&amp;#8217;s time to take note that F# isn&amp;#8217;t a purely functional language like some of it&amp;#8217;s forebearers, such as Haskell.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s probably a good thing, otherwise we&amp;#8217;d have a hard time doing anything useful with it, such as accessing the file system or getting data from a database.&lt;/p&gt;
&lt;p&gt;Luckily we can use the .Net libraries with F# for some of those tasks, almost the same way we do in other .Net languages.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;open System.IO&lt;/p&gt;
&lt;p&gt;left file=new FileInfo(@&amp;#8221;c:\myfile.txt&amp;#8221;)&lt;/p&gt;
&lt;p&gt;use stream = file.CreateText()&lt;/p&gt;
&lt;p&gt;stream.WriteLine(&amp;#8220;this is a test&amp;#8221;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Notice the use keyword - it&amp;#8217;s the F# equivalent of the Using statement (from C#) for invoking IDisposable.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3463520733</link><guid>http://davemorrow.tumblr.com/post/3463520733</guid><pubDate>Wed, 23 Feb 2011 08:30:07 -0500</pubDate></item><item><title>Functions within functions</title><description>&lt;p&gt;F# allows you to define functions within functions.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;let myouterfunction x =&lt;/p&gt;
&lt;p&gt;    let myinnerfunction k =&lt;/p&gt;
&lt;p&gt;        printf &amp;#8220;%i&amp;#8221; k&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, myinnerfunction is defined within the scope of myouterfunction so it can&amp;#8217;t be seen by other functions.&lt;/p&gt;
&lt;p&gt;F# also allows you to return functions.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;let myouterfunction x =&lt;/p&gt;
&lt;p&gt;    let myinnerfunction k =&lt;/p&gt;
&lt;p&gt;        printf &amp;#8220;%i&amp;#8221; k&lt;/p&gt;
&lt;p&gt;    let myreturnfunction y = myinnerfunction y&lt;/p&gt;
&lt;p&gt;    // this is where we return a function&lt;/p&gt;
&lt;p&gt;    myreturnfunction&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, if an inner function is only within the scope of the function it&amp;#8217;s created in, how can it still be accessed by a returned function?&lt;/p&gt;
&lt;p&gt;The answer is a closure is generated by the compiler to encapsulate the inner function!&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3444011177</link><guid>http://davemorrow.tumblr.com/post/3444011177</guid><pubDate>Tue, 22 Feb 2011 08:31:06 -0500</pubDate></item><item><title>Whitespace and the lightweight syntax</title><description>&lt;p&gt;F# is based on Objective Caml (OCaml), but unlike it&amp;#8217;s predecessor it&amp;#8217;s white-space sensitive by default. The advantage of this is that it allows the language to be more terse and free from noise of unnecessary wrapper code (although they are still accepted). This is the &lt;em&gt;lightweight&lt;/em&gt; syntax.&lt;/p&gt;
&lt;p&gt;It also means you need to be careful with white-space -in the wrong place this could cause the compiler to think some identifiers are outside of scope!&lt;/p&gt;
&lt;p&gt;This may not be preferable, so you can enforce the use of keywords by putting the following code at the top of each file&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#light &amp;#8220;off&amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&amp;#8217;m sure it&amp;#8217;ll cause a few head scratching sessions to start with, but I&amp;#8217;m going to be trying out the lightweight syntax and see how I get on.&lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3423430051</link><guid>http://davemorrow.tumblr.com/post/3423430051</guid><pubDate>Mon, 21 Feb 2011 08:30:06 -0500</pubDate></item><item><title>F# basics</title><description>&lt;p&gt;It&amp;#8217;s time to look at some basics of F# syntax.&lt;/p&gt;
&lt;p&gt;First up, there&amp;#8217;s the &lt;strong&gt;let &lt;/strong&gt;keyword.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;let message=&amp;#8221;hello&amp;#8221;&lt;/p&gt;
&lt;p&gt;let a=34&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I know what you&amp;#8217;re thinking - it looks like variable assignment, but you&amp;#8217;d be wrong. Apparently purely functional languages don&amp;#8217;t have variables, they have identifiers.&lt;/p&gt;
&lt;p&gt;So, what&amp;#8217;s the difference between a variable and an identifier? Well, identifiers are more like constants - their values don&amp;#8217;t change. They can, however be redefined - confusing or what?!&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;let &lt;/strong&gt;keyword is used for binding an identifier to  anything, including functions.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;let myAdd = fun x y -&amp;gt; x+y&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;fun &lt;/strong&gt;is the keyword for function, but it&amp;#8217;s optional in F# (unless you&amp;#8217;re defining an anonymous function - we&amp;#8217;ll cover those another time).&lt;/p&gt;
&lt;p&gt;The lamda-like syntax -&amp;gt; separates the body of the function from the parameters, which are on the left-hand side.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;printfn&lt;/strong&gt; outputs text to the console.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;let n=10&lt;/p&gt;
&lt;p&gt;let add a b = a + b&lt;/p&gt;
&lt;p&gt;let result = add n 4&lt;/p&gt;
&lt;p&gt;printfn &amp;#8220;the result is %i&amp;#8221; result&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This code displays the following output:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;the result is 14&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://davemorrow.tumblr.com/post/3402096234</link><guid>http://davemorrow.tumblr.com/post/3402096234</guid><pubDate>Sun, 20 Feb 2011 08:30:00 -0500</pubDate></item><item><title>Getting F#</title><description>&lt;p&gt;After scanning through the first chapter of &amp;#8220;Beginning F#&amp;#8221; it seems that F# is probably already installed on your machine if you&amp;#8217;ve got Visual Studio 2010 and if it isn&amp;#8217;t, all you need to do is go to add/remove programs and install it :D&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lgrhti0L0e1qcl4zm.png"/&gt;&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;ve got VS2008 you can always download F# separately.&lt;/p&gt;
&lt;p&gt;Aside from the Visual Studio templates and tooling, the important bits of the F# package are FSC.exe and FSI.exe. FSC is the F# compiler which is either used from within Visual Studio, or from the command line to compile F# programs written in any text editor (and with and extension of .fs).&lt;/p&gt;
&lt;p&gt;FSI is the interactive console a la IRB for Ruby (not that I know much about Ruby!). The interactive console for F# allows you to write F# code and run it immediately. It&amp;#8217;s probably not that great for writing entire apps, but to spike out a bit of code I&amp;#8217;m sure it&amp;#8217;s pretty good.&lt;/p&gt;
&lt;p&gt;You can also execute F# within Visual Studio using F# Intefractive which allows you to highlight any F# code and run it by pressing Alt + Enter.&lt;/p&gt;
&lt;p&gt;As well as being great ways of trying out code when developing, I think these tools will make my workshops much more interactive &lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3380906968</link><guid>http://davemorrow.tumblr.com/post/3380906968</guid><pubDate>Sat, 19 Feb 2011 08:30:07 -0500</pubDate></item><item><title>Seven Languages</title><description>&lt;p&gt;Another book has arrived! This time it&amp;#8217;s &amp;#8220;Seven Languages in Seven Weeks&amp;#8221;&lt;/p&gt;
&lt;p&gt;I read about it in another blog post although I can&amp;#8217;t remember where.&lt;/p&gt;
&lt;p&gt;&lt;img height="120" width="100" alt="Seven Languages in Seven Weeks" src="http://ecx.images-amazon.com/images/I/51C%2BJGTYWbL._SL500_SL120_.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;It contains just enough to give you an insight into several different languages and focuses on their strengths without getting bogged down with the dull bits, like installation, security, etc.&lt;/p&gt;
&lt;p&gt;That seems like a really good idea to me. I mean, I was hardly likely to buy a full-blown book on Scala, install it and write code with it, but at least this way I get to find out about it. Who knows maybe I will be more interested after reading it?&lt;/p&gt;
&lt;p&gt;Anyway, apart from being seriously interested in looking into Ruby during the year, I also thought it would be work checking out Haskell as I&amp;#8217;m now doing this function workshop with F#.&lt;/p&gt;
&lt;p&gt;FYI - the book covers IO, Clojure, Haskell, Ruby, Erlang, Prolog and Scala&lt;/p&gt;
&lt;p&gt;My only problem now is where on earth am I going to find time to do all this reading? &lt;/p&gt;</description><link>http://davemorrow.tumblr.com/post/3362108658</link><guid>http://davemorrow.tumblr.com/post/3362108658</guid><pubDate>Fri, 18 Feb 2011 08:30:07 -0500</pubDate></item></channel></rss>
