______11 |> F# – Some Hackery – A String Calculator Kata

Now for some F# hacking. The first thing I did was actually go through a Code Kata, which I’ll present here.

The first step I took was to get a project started. For that I used the ProjectScaffold to build a clean project via bash.

First cloned…

git clone git@github.com:fsprojects/ProjectScaffold.git sharpKataStringCalc

…then I navigated into the directory and executed the build.sh script…

cd sharpKataStringCalc/
./build.sh

…then I got prompted for some input.

  #####################################################

# Project Scaffold Init Script
# Please answer a few questions and we will generate
# two files:
#
# build.fsx               This will be your build script
# docs/tools/generate.fsx This script will generate your
#                         documentation
#
# NOTE: Aside from the Project Name, you may leave any
# of these blank, but you will need to change the defaults
# in the generated scripts.
#

  #####################################################

Project Name (used for solution/project files): sharpKataStringCalc
Summary (a short description): A code kata for the string calculator exercise.
Description (longer description used by NuGet): The code kata, kicked off my Roy Osherove, this is my iteration of it (at least my first iteration of it).
Author: Adron Hall
Tags (separated by spaces): fsharp f# code kata stringcalculator
Github User or Organization: adron
Github Project Name (leave blank to use Project Name):

Once I hit enter after entering the information I’ve gotten more than a few of these broken builds.

Time Elapsed 00:00:00.1609190
Running build failed.
Error:
Building /Users/adronhall/Coderz/sharpKataStringCalc/sharpKataStringCalc.sln failed with exitcode 1.

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target         Duration
------         --------
Clean          00:00:00.0019508
AssemblyInfo   00:00:00.0107624
Total:         00:00:00.6460652
Status:        Failure
---------------------------------------------------------------------
  1) Building /Users/adronhall/Coderz/sharpKataStringCalc/sharpKataStringCalc.sln failed with exitcode 1.
  2) : /Users/adronhall/Coderz/sharpKataStringCalc/src/sharpKataStringCalc/sharpKataStringCalc.fsproj(0,0): Target named 'Rebuild' not found in the project.
  3) : /Users/adronhall/Coderz/sharpKataStringCalc/tests/sharpKataStringCalc.Tests/sharpKataStringCalc.Tests.fsproj(0,0): /Users/adronhall/Coderz/sharpKataStringCalc/tests/sharpKataStringCalc.Tests/sharpKataStringCalc.Tests.fsproj: The required attribute "Project" in Import is empty
---------------------------------------------------------------------

This problem I was able to solve once, based on what I did in a previous blog entry “That Non-Windows Scaffolding for OS-X and Linux |> I Broke It! But…“. Which seemed odd that I fixed it previously. To help with the build I actually opened it up in Xamarin Studio. Now, one of the problems with doing this, is that it’s only available on Windows & OS-X. I’m however interested in using this stuff on Linux too, but that’s looking a bit more difficult the more I work with the toolchain unfortunately.

After working through the issue I found that on one OS-X box I’d installed Mono via make and F# via make and that messes things up. Do one or the other and you should be ok. So on my other two OS-X boxes (I’ve a personal retina and a work retina) the build worked flawlessly, and when it works flawlessly it looks like this toward the end of the build execution.

Finished Target: GenerateReferenceDocs
Starting Target: GenerateDocs (==> GenerateReferenceDocs, GenerateReferenceDocs)
Finished Target: GenerateDocs
Starting Target: All (==> GenerateDocs)
Finished Target: All

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target                  Duration
------                  --------
Clean                   00:00:00.0035253
AssemblyInfo            00:00:00.0103142
Build                   00:00:04.9369669
CopyBinaries            00:00:00.0052210
RunTests                00:00:00.6568475
CleanDocs               00:00:00.0025772
GenerateHelp            00:00:08.6989318
GenerateReferenceDocs   00:00:11.7627584
GenerateDocs            00:00:00.0003409
All                     00:00:00.0000324
Total:                  00:00:26.1162623
Status:                 Ok
---------------------------------------------------------------------

I’ve gotten this to work on OS-X and Windows just fine using the straight up ProjectScaffold and the ./build.sh. So all is good, I’m going to move forward with writing the kata based on that and loop back around to straighten out the Linux issues.

To run the tests, execute the following script after creating the project scaffold.

./build.sh RunTests

First off, what are the ideas behind the string calculator kata? Well here’s how Roy Osherove lays it out this particular code kata.

Before you start:

  • Try not to read ahead.
  • Do one task at a time. The trick is to learn to work incrementally.
  • Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata.

String Calculator

  1. Create a simple String calculator with a method int Add(string numbers)
    1. The method can take 0, 1 or 2 numbers, and will return their sum (for an empty string it will return 0) for example “” or “1” or “1 2”
    2. Start with the simplest test case of an empty string and move to 1 and two numbers
    3. Remember to solve things as simply as possible so that you force yourself to write tests you did not think about
    4. Remember to refactor after each passing test
  2. Allow the Add method to handle an unknown amount of numbers.
  3. Allow the Add method to handle new lines between numbers (instead of an empty space).
    1. the following input is ok: “1\n2 3” (will equal 6)
    2. the following input is NOT ok: “1 \n” (not need to prove it – just clarifying)
  4. Support different delimiters
    1. to change a delimiter, the beginning of the string will contain a separate line that looks like this: “//[delimiter]\n[numbers…]” for example “//;\n1;2” should return three where the default delimiter is ‘;’ .
    2. the first line is optional. all existing scenarios should still be supported
  5. Calling Add with a negative number will throw an exception “negatives not allowed” – and the negative that was passed.if there are multiple negatives, show all of them in the exception message
  6. Numbers bigger than 1000 should be ignored, so adding 2 + 1001 = 2
  7. Delimiters can be of any length with the following format: “//[delimiter]\n” for example: “//[***]\n1***2***3” should return 6
  8. Allow multiple delimiters like this: “//[delim1][delim2]\n” for example “//[*][%]\n1*2%3” should return 6.
  9. Make sure you can also handle multiple delimiters with length longer than one char.

Ok, so now that we’re clear on the string calculator, I’m going to dig into knocking out the first item, “Create a simple string calculator with a method int Add (string numbers)”

But first, in TDD fashion let’s write the test and make it fail first. I changed the code in the Tests.fs file in the tests directory and tests project to read as follows.

module sharpKataStringCalc.Tests

open System
open sharpKataStringCalc
open NUnit.Framework

[<TestFixture>]
type CalculatorTests() =
  [<Test>]
  member x.add_empty_string() =
    let calculator = Calculator()
    let result = calculator.Add ""
    Assert.That(result, Is.EqualTo 0)

That gets us a failing test, since we don’t even have any implementation yet. So now I’ll add the first part of the implementation code. First I created a Calculator.fs file and deleted the other file that ProjectScaffold put in there in the first place.

namespace sharpKataStringCalc

open System

type Calculator() = 
  member x.Add express = 
    0

Ok, that gives me a passing test for the first phase of all this. Now since I’m a total F# newb still I’ve got to kind of dig around and read documentation while I’m working through this. So I’m taking a couple of hours while Roy’s suggestion is to use 30 minutes to do this kata. But I figured it is a good way to force myself to learn the syntax and start getting into an F# refactoring practice.

The first thing I started to do was write a test where I set the Calculator() again that looked something like this. I didn’t like that so I tried to pull it out of the test.

  [<TestCase("1", Result = 1)>]
  member x.Add_single_number_returns_that_number expression =
    let calculator = Calculator()
    calculator.Add expression

I ended up with something like this then.

let calculator = Calculator()

[<TestFixture>]
type CalculatorTests() =
  [<Test>]
  member x.add_empty_string() =
    let result = calculator.Add ""
    Assert.That(result, Is.EqualTo 0)

  [<TestCase("1", Result = 1)>]
  member x.Add_single_number_returns_that_number expression =
    calculator.Add expression

After adding that code with that little refactor I ran it, red light fail, so I then moved on to implementation for this test.

type Calculator() = 
  member x.Add expression = 
    match expression with
    | "" -> 0
    | _ -> 1

Everything passed. So now on to the next scenario other subsequent number strings. I add another test and result condition.

  [<TestCase("1", Result = 1)>]
  [<TestCase("2", Result = 2)>]
  member x.Add_single_number_returns_that_number expression =
    calculator.Add expression

It runs, gets a red light fail, I then implement with this minor addition.

type Calculator() = 
  member x.Add expression = 
    match expression with
    | "" -> 0
    | _ -> Int32.Parse expression

Before moving on, I’m just going to cover some of the syntax I’ve been using. The | delimits individual matches, individual discriminated union cases, and enumeration values. In this particular case I’m just using it to match the empty string or the
wildcard. Which speaking of, the _ is a wildcard match or specifies a generic parameter. To learn more about these in detail check out match expressions or generics. There are lots of good things in there.

The other syntax is somewhat more self-explanatory so I’m going to leave it as is for the moment. It is, in the end, when executing the tests evident what is going on at least. Alright, back to the kata. Let’s actually add two numbers. For the test I’m just going to add another TestCase with two actual numbers.

  [<TestCase("1", Result = 1)>]
  [<TestCase("2", Result = 2)>]
  [<TestCase("1 2", Result = 3)>]
  member x.Add_single_number_returns_that_number expression =
    calculator.Add expression

Fails, so on to implementation. I’m just going to do this the cheap “it works” way and do something dumb.

type Calculator() = 
  member x.Add expression = 
    match expression with
    | "" -> 0
    | _ when expression.Contains " " -> 3
    | _ -> Int32.Parse expression

That’ll give me a passing green light, but I’ll add another bit of attribute to the test and get another failing test.

  [<TestCase("1", Result = 1)>]
  [<TestCase("2", Result = 2)>]
  [<TestCase("1 2", Result = 3)>]
  [<TestCase("2 3", Result = 5)>]
  member x.Add_single_number_returns_that_number expression =
    calculator.Add expression

I’ll add the following code to implement and get a passing test.

type Calculator() = 
  member x.Add expression = 
    match expression with
    | "" -> 0
    | _ when expression.Contains " " -> 
        let numbers = expression.Split [| ' ' |]
        (Int32.Parse numbers.[0]) + (Int32.Parse numbers.[1])
    | _ -> Int32.Parse expression

Ok. So that part of the match looks for an empty space, and then takes the two numbers opposite sides of that empty space (array item 0 and 1) and then parses them and adds them together. Keep in mind that ‘ ‘ signifies a single character, and not a string, even though for the contains method that executes on a string, passing in a string with ” ” is ok and the appropriate actions are taken by the compiler.

For the tests I’m going to do a refactor and break them apart just a bit and rename them using the “ xyz “ technique of methods. After the refactor the code looked like this. I got this idea from the “Use F# to write unit tests with readable names” tip.

[<TestFixture>]
type CalculatorTests() =
  [<Test>]
  member x.``should return zero if no string value is passed in.``() =
    let result = calculator.Add ""
    Assert.That(result, Is.EqualTo 0)

  [<TestCase("1", Result = 1)>]
  [<TestCase("2", Result = 2)>]
  member x.``take one number and return that number`` expression =
    calculator.Add expression

  [<TestCase("1 2", Result = 3)>]
  [<TestCase("2 3", Result = 5)>]
  member x.``add single number to single number and return sum`` expression =
    calculator.Add expression

At this point I’m going to take a break, and wrap this up in a subsequent part of this series. It’s been a fun troubleshooting and getting started string calculator kata. So stay tuned and I’ll be slinging some F# math at ya real soon.

Reference:

_______1 |> F# – Getting Started, Thinking Functionally (Notes)

Recently I took the plunge into writing F# on OS-X and Linux (Ubuntu specifically). This is the first of a new series I’m starting (along with my other ongoing series on JavaScript workflow and practices). In this article particularly I’m just going to provide an overview and notes of key paradigms in functional programming. Most of these notes are derived from a great series called “Thinking Functionally“.

#1 Thinking Functionally: Introduction

This is the article that kicks off the series. The emphasis is focused around realizing that a different way of thinking needs applied when using a functional language. The difference between functional thinking and imperative. The key topics of the series includes:

  • Mathematical Functions
  • Functions and Values
  • Types
  • Functions with Multiple Parameters
  • Defining Functions
  • Function Signatures
  • Organizing Functions

#2 Mathematical Functions

Functional programming, its paradigms and its origins, are all rooted in mathematics. A mathematical function looks something like this:

Add1(x) = x + 1

  • The set of values that can be used as input to the function is called the domain.
  • The set of possible output values from the function is called the range.
  • The function is said to map the domain to the range.

If F# the definition would look like this.

let add1 x = x + 1

The signature of the function would look like this.

val add1 : int -> int

Key Properties of Mathematical Functions

  • A function always gives the same output value for a given input value.
  • A function has no side effects.

Pure functions

  • They are trivially parallelizable.
  • I can use a function lazily.
  • A function only needs to be evaluated once. (i.e. memoization)
  • The function can be evaluated in any order.

Prospectively “Unhelpful” properties of mathematical functions

  • The input and output values are immutable.
  • A function always has exactly one input and one output

#3 Function Values and Simple Values

Looking at this function again:

let add1 x = x + 1

The x means:

  • Accept some value from the input domain.
  • Use the name “x” to represent that value so that we can refer to it later.

It is also referred to as x is bound to the input value. In this binding it will only ever be that input value. This is not an assignment of a variable. Emphasis on the fact that there are no “variables”, only values. This is a critical part of functional thinking.

Function Values: this is a value that provides binding for a function to a name.

Simple Values: This is what one might think of as constants.

let c = 5

Simple Values vs. Function Values

Both are bound to names using the keyword let. The key difference is a function needs to be application to an argument to get a result, and a simple value doesn’t, as it is the value it is.

“Values” vs. “Objects”

In F# most things are referred to as “values”, contrary to “objects” in C# (or other languages like JavaScript for that matter). A value is just a member of a domain, such as a domain of ints, string, or functions that map ints to strings. In theory a value is immutable and has no behavior attached to it. However in F#, even some primitive values have some object-like behavior such as calling a member or property with dot notation syntax like “theValue”.Length or something similar.

Naming Values

Most of the naming is the general ruleset that applies to practically every language. However there is one odd feature that comes in handy in some scenarios. Let’s say you want to have a name such as “this is my really long and flippantly ridiculous name” for a domain. Well, what you can use is the “this is my really long and flippantly ridiculous name“ to have that be the name. It’s a strange feature, but I’ll cover more of it in subsequent articles.

In F# it is also practice to name functions and values with camel case instead of pascal case (camelCase vs. PascalCase).

#4 How Types Work with Functions

Function signatures look like this, with the arrow notation.

val functionName : domain -> range

Example functions:

let intToString x = sprintf "x is %i" x  // format int to string
let stringToInt x = System.Int32.Parse(x)

Example function signatures:

val intToString : int -> string
val stringToInt : string -> int

This means:

  • intToString has a domain of int which it maps onto the range string.
  • stringToInt has a domain of string which it maps onto the range int.

Primitive Types

Standard known types you’d expect: string, int, float, bool, char, byte, etc.

Type Annotations

Sometimes type might not be inferred, if that is the case, the compiler can take annotations to resolve type.

let stringLength (x:string) = x.Length   
let stringLengthAsInt (x:string) :int = x.Length 

Function Types as Parameters

A function that takes other functions as parameters, or returns a function, is called a higher-order function (sometimes abbreviated as HOF).

Example:

let evalWith5ThenAdd2 fn = fn 5 + 2 

The signature looks like:

val evalWith5ThenAdd2 : (int -> int) -> int

Looking at an example executing. The example:

let times3 x = x * 3
evalWith5ThenAdd2 times3

The signature looks like:

val times3 : int -> int
val it : int = 17

Also these are very sensitive to types, so beward.

let times3float x = x * 3.0
evalWith5ThenAdd2 times3float

Gives an error:

error FS0001: Type mismatch. Expecting a int -> int but 
              given a float -> float

Function as Output

A function value can also be the output of a function. For example, the following function will generate an “adder” function that adds using the input value.

let adderGenerator numberToAdd = (+) numberToAdd

Using Type Annotations to Constrain Function Types

This example:

let evalWith5ThenAdd2 fn = fn 5 +2

Becomes this:

let evalWith5AsInt (fn:int->int) = fn 5

…or maybe this:

let evalWith5AsFloat (fn:int->float) = fn 5

The “unit” Type

When a function returns no output, it still requires a range, and since there isn’t a void function in mathematical functions this supplants the void as return output. This special range is called a “unit” and has one specific value only, a “()”. It is similar to a void type or a null in C# but also is not, in that it is the value “()”.

Parameterless Functions

For a WAT moment here, parameterless functions come up. In this example we might expect “unit” and “unit”.

let printHello = printf "hello world" 

But what we actually get is:

hello world
val printHello : unit = ()

Like I said, a very WAT kind of moment. To get what we expect, we need to force the definition to have a “unit” argument, as shown.

let printHelloFn () = printf "hello world"

Then we get what we expect.

val printHelloFn : unit -> unit

So why is this? Well, you’ll have to dive in a little deeper and check out the F# for fun and profitThinking Functional” entry on “How Types Work with Functions” for the full low down on that. Suffice it I’ve documented how you get what you would expect, the writer on the site goes into the nitty gritty of what is actually happening here. Possibly, you might have guessed what is happen already. There is also some strange behavior that takes place with forcing unit types with the ignore function that you may want to read on that article too, but if you’re itching to move on, and get going faster than digging through all of this errata, keep going. I’m going to jump ahead to the last section I want to cover for this blog entry of notes, currying.

#5 Currying

Haskell Curry

Haskell Curry

Breaking multi-parameter functions into smaller one-parameter functions. The way to write a function with more than one parameter is to use a process called currying. For more history on this check out Haskell Curry the mathematician to dive deep into his work (which also covers a LOT of other things beside merely currying, like combinatory logic and Curry’s paradox for instance).

Basic example:

let printTwoParameters x y = 
   printfn "x=%i y=%i" x y

This of course looks neat enough right? Well, if we look at the compiler rewrite, it gets rather interesting.

let printTwoParameters x =
   let subFunction y = 
      printfn "x=%i y=%i" x y
   subFunction

That Non-Windows Scaffolding for OS-X and Linux |> I Broke It! But…

I dove into the ProjectScaffold solution recently to see where I could get with this project. Just like in the instructions I first cloned the project.

git clone

Then executed the shell script to get an appropriate download of Paket and related tools.

$ ./build.sh

On OS-X my first attempt I got scaffolding but a bad build right off. See the video below for that example.

Trying the same thing on Ubuntu gave me this issue. This issue seemed to be different from the OS-X issue so I’m working to resolve it separately.

adron@ubuntu ~/C/ProjectScaffold> ./build.sh
No version specified. Downloading latest stable.
Github download failed. Try downloading Paket directly from 'nuget.org'.
Error getting response stream (Write: The authentication or decryption has failed.): SendFailure

Then trying it on OS-X gave me this issue.  :-/

Grumble grumble, fuss, fuss, alright, going into debugging and troubleshooting mode. I made a video of the exact steps I went through.

So if you have any ideas, let me know, I’m currently looking through the code and trying out some things. Once I get this working I’ll update this blog entry below the video with the updated resolution. Thanks!

UPDATED: Dammit, the dumbest things are what always punch me in the face the hardest. I fixed it, and it didn’t require a pull request after all! When naming a project be sure to use only string characters to be safe. As I wrote in the github issue, the name “sharp-kata-01” breaks the build in a way that gives completely erroneous messages. Once I renamed it things moved forward.

Polyglot Conf 2015 Highlights & High Level Notes

A few highlights from Polyglot Conf 2015

JavaScript State of the Union

I didn’t actually plan to record this session, but whipped out the iPhone 6 and figured I’d give it a go. I ended up just recording the entire session. This is basically a level set and review of where and what’s up with the voluminous amount of JavaScript Frameworks, but everybody delves into a number of other things too. The sound is a little rough, but crank it up and you’ll be able to hear everybody speaking just fine.

Type Providers – Type Systems – Haskell and Conversations

I had more than one conversation, and listened in on more than a few. There was a LOT of hard core knowledge getting discussed and ideas for the future of languages. Everything from F# Type Providers (read more) to Haskell’s Type Safety and the lack there of. Also a few tidbits about building type providers. There was also some pretty big conversations around monolithic and micro-services.

Check out Martin Fowler’s write up on Monolith First.

I also got to chat with Elana Popovici about her workshop on Science Driven Decision Making, which delved into decision making around statistical analysis and related topics. The other workshop that I wish I’d been able to attend, but at least got to catch up with @BrianDorsey and @tavisrudd for a short time and discussed their Docker & Kubernetes workshop.

To be prepared for next years conference, follow the @PolyglotConf twitter account and be sure to get your tickets early, it tends to sell out.

Vancouver Itself

Polyglot Conference is held yearly in beautiful Vancouver BC. I don’t say Vancouver BC is beautiful just because I’m writing filler junk, this is, without question one of the most beautiful cities on earth along with being one of the most organized and well designed cities on Earth. It is, simply, impressive on a number of fronts. So if you know anything about cities, this is definitely one to visit and admire.

Even if beautiful cities aren’t your thing, Vancouver has an ever increasing array of great breweries, places to explore (in the city and outside), and a host of other places to check out that just add to the atmosphere of the conference itself.

Other benefits of being in Vancouver early for Polyglot conf.

OpenStack Conference

This year, the OpenStack 2015 had a stop in Vancouver, and this year that was great for me too. Even though I didn’t actually go attend the conference I got to meet a number of people in town for that conference since I came into town a few days early for Polyglot Conference.

Now, the OpenStack space is all fine and dandy, but it’s also a political field of landmines. So I’m always glad to just reap the benefits and not go wandering around in that space. I’m perfectly happy sitting above the OpenStack layer and working on applications and systems level operations that are a bit higher in the stack. So, thanks to all those that fight their way through all of that for us DevOps Coders that tend to stay higher in the stack. Kudos to all of you fighting that battle to make OpenStack awesome!

For some background on the war stories, check out

Rabbit MQ

Speaking of happenstance and such I got to meet @michaelklishin thanks to @lenadroid. Thanks for that introduction!

Michael and I dove into topics ranging from Cloud Foundry to Rabbit MQ, both things you may know of as Pivotal efforts these days. It just so happened I’ve got a little Cloud Foundry history and am working on using or implementing both on a current contract job I’m doing.

It was good conversation and if you’re into similar things definitely give Michael a follow on twitter and github. He’s also pretty involved in a bunch of OSS work (including of course Rabbit MQ and related) so dive in and introduce yourself.

Summary: I’m already aiming to be there, looking forward to more solid discussion and prospectively putting together a workshop myself and prospectively getting a little hacking festival going on pre- or post- conference.

Want to Go To the Progressive .NET Conference in London?

…but you just need a ticket? Well here’s the deal. I’ve got a ticket, it fell from the tree of random tickets and I shall make it free to one who might want to go. Here’s the smallest catch that I have…

I want to have some extra demo code to show during my presentation on Visual Studio & .NET on OS–X, Linux, and Windows, and I’d love to talk somebody’s demo code up during my presentation. So throw together some demo code in C# or F# that shows something cool, mathematically crazy, or something else that’s interesting to you. This is up to you, so get some code committed to github and ping me with the repo. I’ll hook you up with a ticket to the Progressive .NET Conference in London the 1st, 2nd AND 3rd of July. The way to submit the code is super easy, this really shouldn’t take more than about 20-30 minutes for a ticket that is worth £395, which is over $600 bucks in US dollars – just sayin’, weak US dollar to the British pound and all!

Here’s the rules:

  1. You must submit the code to me before June 26th so I can get it thoroughly tested, because YES I will demo with it and give you a shout out.
  2. It must be in a simple C# or F# project that is either a console app or just a library that has tests for it that shows or describes what it is doing. (If you do this, I might even throw in another $100 bucks just because you wrote tests!)
  3. Put the code in a git repo, and push it up to github. I’ll check it out and declare a winner on the 27th of June.
  4. Ping me on twitter @Adron.

See you at Prog Net Conf 2015!

__3 “Going the Full Mile, Continuous Delivery.”

In the last few issues of this series, the team has done the following:

  1. Introducing the Thrashing Code Team & Projects” – Know who’s working on what and what the projects are.
  2. Getting Started, Kanban & First Steps for a Sharing App” – Getting the kanban put together and the team involved.
  3. Starting a Basic Loopback API & Continuous Integration” – Getting the skeleton of the API application setup and the continuous integration services running.

In this issue of the series Keartida is continuing with setup and configuration of the next step, getting to a basic continuous delivery of services with a basic AWS Elastic Beanstalk setup.

AWS Elastic Beanstalk

Let’s talk a little bit about the solutions and working with teams in the solutions before diving into Keartida’s efforts. With each of the SaaS solutions that I’ve pointed out in the last couple of entries each has a specific connection, integration, or reliance on Github. This is, of course perfect so that each part works seamlessly together. AWS has it’s own user management system which also needs to be taken into account.

In CodeShip

It’s easy to add members to a build, which I covered in the previous entry in this series.

In Waffle.io

Waffle.io actually is pretty simple. Simply sign in with your github account and you’re in with an account. But to access certain projects one does have to setup and share the respective kanban boards. The way to do this with Waffle.io is to actually setup users based on the github permissions setup for the user for the particular project.

In AWS

To get users setup in AWS is a little differently. What we need to setup a full build and delivery of the application to AWS is to get the user’s key pair. Let’s take a look at setting up a group and a user in Amazon for this purpose. In this case I am going to create a user for deployment purposes.

On the main AWS Dashboard here, click on Identity & Access Management.

AWS

AWS

On that page there are several options listed on the left hand side. Click on the Groups and then click on the Create New Group button. After that a wizard will come up.

Groups

Groups

Enter the group name and click next.

Group Name

Group Name

In the Attach Policy step, slect the S3 Full Access and Elastic Beanstalk Full Access policies for this account.

Selecting Policies

Selecting Policies

Once the appropriate polices are selected to be attached, click on next step, review and then add the group. Then select the group that was just created and click on the

Add Users to Group

Add Users to Group

Once the appropriate user is added, then the parts to wrap up the delivery part of the deployment are all set. Back to what Keartida was working on!

Keartida Deploys coder-swap

First step, Keartida logged into the AWS management console.

AWS Management Console

AWS Management Console

Since this is the first Elastic Beanstalk Application that Keartida has deployed, when she clicks on Elastic Beanstalk this screen appears.

Welcome to Elastic Beanstalk

Welcome to Elastic Beanstalk

From here, she selected Node.js from the drop down and Launch Now. From there a quick wizard appears and let her enter the name of the application and a description.

Creating the first Node.js Application

Creating the first Node.js Application

The application starts being created.

Creating the Application.

Creating the Application.

When this is created, the funny thing is the wizard creates a application environment name that causes problems. Keartida and I found this out the hard way, and figured out it is best to just delete this application and create an application and an environment name that works better.

Deleting the Application With the Odd Naming

Deleting the Application With the Odd Naming

So this time going back she created the application space specifically and went through the various steps to create the application.

Creating the New Environment in the new Application Space.

Creating the New Environment in the new Application Space.

Creating a new environment.

Creating a new environment.

Creating a load balanced, auto-scaled elastic beanstalk application

Creating a load balanced, auto-scaled elastic beanstalk application

Basic Settings

Basic Settings

More Settings.

More Settings.

Keep clicking next and then…

Then let the beanstalk start.

Then let the beanstalk start.

Now that this is started Keartida logged into CodeShip to setup the final deployment steps for good builds to deploy directly to this beanstalk application.

CodeShip Builds and Where to find Deployments

CodeShip Builds and Where to find Deployments

Once Keartida clicked on Deployment she had options to pick what to deploy to. One of the options is of course Elastic Beanstalk.

Selecting a Branch and What to Deploy To

Selecting a Branch and What to Deploy To

Selecting Elastic Beanstalk to deploy to

Selecting Elastic Beanstalk to deploy to

The next screen provides options to select branches of the build to deploy with and related information.

Set the Elastic Beanstalk Parameters

Set the Elastic Beanstalk Parameters

Keartida set the key ID and access key. After that she selected the US West 2 data center, the environment and application names, and the S3 bucket. She retrieved the S3 bucket name by navigating into the S3 service and finding the name on the management console as shown.

S3 Buckets

S3 Buckets

Once all the parameters were entered Keartida then clicked on create and CodeShip then shows the settings saved as shown below.

Saved Settings

Saved Settings

After that Keartida created the production branch and pushed it to github. There the build started as shown and began the deploy to AWS Elastic Beanstalk.

Beanstalk Deploy starts after the build

Beanstalk Deploy starts after the build

Finally once the deployment is detected to have successfully been pushed out and launched in AWS Elastic Beanstalk a message will appear and the build will go green.

Deployment Successful!

Deployment Successful!

Now, after Keartida completed this it’s time to really dive into the workflow of development. Next up, we’ll get a basic site and API services up and running.

Progressive .NET Tutorials 2015

I’ll be Speaking @ Progressive .NET Tutorials in July

Why

Recently Microsoft has really gotten it’s act together, at least for those of us that really love some of the Microsoft tools, but really don’t want to touch Windows. I’m perfectly happy not dealing with Windows, so this has been great news for me.

With the recent Build event Microsoft released Visual Studio Code, which is a fully cross-system compatible IDE that is lean, fast, and allows for building software with multiple languages. Of course, it works with several .NET languages such as F# and C#, and even will let you dive heavily in JavaScript Node.js based applications. I wrote a quick “Notes From the Front: 5 Minutes With Visual Studio #Code” a short while ago. Along with that I wrote “OS-X and F# [Clone It, Build It, Install It, Hack It]” and “Why F#, and Why Not Windows” as a follow up to this new growing world of Microsoft options.

Now, don’t get me wrong, Windows definitely has some plusses. It just isn’t the system I’d prefer these days, as it doesn’t hack it in the startup lands of Silicon Valley, Portland, Seattle, Vancouver BC, or other such places. In these lands, people speak and work with the *nix landscape first, and everything else is secondary. But that doesn’t remove the desire I have for applications, devices, and other tooling that enables compatibility across all of these systems.

With those thoughts, I sat down and started putting together some presentations on what’s possible with this new freedom around Microsoft tooling. Already I’d worked pretty extensively with Node.js and the tooling Microsoft has added to Visual Studio, Azure, and all those related things. Now I’m looking forward to checking out some of the other capabilities around F#, and the respective API options and other new OSS technologies like Akka .NET, and even M-brace. So here’s the gist of my presentation so far, and as I give this talk I’ll provide other related information on the page I’ve setup for the talk here.

Presentation Title: Visual Studio & .NET on OS–X, Linux, and Windows

From the inception of Mono on through to today’s Omnisharp and the introduction of Visual Studio Code at Build 2015. I’ll take a look at where cross-platform compatible solutions have been and where we are now with code samples along the way with some discussion on mobile topics too.

I’ll be adding a bit more to this also, and will have the demos and related code samples located here.

Who, What, When, Where

So where am I giving this presentation? Check out Progressive .NET Tutorials 2015 for more information. The conference is in London and I’m officially on the program page (so obviously I’m going eh!). They haven’t released the exact time of each talk, but what you should do is just come attend the whole conference! I’ll be speaking on the 3rd. The location of the conference is in the grand city of London, located specifically at this fine establishment.

I’ll have more about the conference and other technical tidbits in the near future. Very soon I will also be announcing a chance to win a ticket to Prog .NET Tutorials, so stay tuned, subscribe, and follow me on Twitter @adron for more info.