0.9.0

Implement OWIN-compatible Startup and self-hosting support

Introduces support for OWIN-compatible web servers and MS Katana/OwinHost v2-rtm.

The above enables minimal bootstrapping for running Simple.Web with any OWIN-compatible server with specific support for Katana v2. Note Katana Project is currently only availble as a pre-release package.

Note: As Katana v2 is only available as RTM Simple.Web.Hosting.Self depends on a custom NuGet source; furthermore a custom build ensuring mono-compatibility. To use Simple.Web.Hosting.Self add https://www.myget.org/F/katana-mono to your available package sources.

0.8.1

IOutput<RawHTML> doesn’t work on Mono

IOutputBehaviours not being applied during scanning on Mono (tested against v3.2.1). Despite a Behaviour (e.g. IOutput<RawHtml>) being present Simple.Web would instead default to locating a media-type handler. This was due to an issue with Mono and method groups not being applied as expected.

0.8.0

Media Type resolution failing for wildcard matches

Pull-request addressing wildcard matches failing for custom media types. Thanks @tapmantwo!

Added status helper for 202 Accepted

Status helpers can optionally be used to return known http status codes. “202 Accepted” was added and RedirectLocation renamed to HeaderLocation (a potentially breaking change).

Improved type scanning

Improved scanning of exported types for indirect references that would otherwise throw a ReflectionTypeLoadException exception.

Fix SandBox.LoginPost redirect issue (empty ReturnUrl)

Issue reported with Sandbox project not redirecting as expected on login. Thanks @eddiegarmon!

Fixed web.config.transform

Reported that Simple.Web.AspNet did not transform the web.config correct upon nuget install.

Miscellaneous improvements for Katana compatibility

Changes to enable native support for Katana v1-beta, in particular handing of streams and headers.

Use Encoding.UTF8 instead of Encoding.Default

Change to use UTF8 encoding as default (opposed to Encoding.Default) to support Cyrillic text.

Ensure that Content-Type headers always have a charset section

Ensure that outgoing content-types have a charset declared (e.g. “; charset=utf8”).

Definition

(Polyglot Programming) Different programming languages bring different strengths. Polyglot programming allows developers to combine multiple languages on a single project. — JetBrains

Summary

We still have yet to complete support for Razor partials and HTML helpers but efforts have focused on stability and performance, indeed we believe Simple.Web (in terms of requests per second) is becoming one of the fastest web frameworks available. It’s also recognised with the continued popularity of client-side MV* frameworks that server-side view engine generation may no longer be the priority for many consumers, but fast and easy integration with a server-side API is – and thats surely Simple.Web’s sweet spot!

If you have any issues or need something, please do raise an issue, we’d love to hear from you :–)

NuGet package restore does work on Mono with xbuild, but you may find some nix builds fail because the imported target that uses $(SolutionDir) fails on Mono due to a double forward-slash in the path. As xbuild doesn’t support property functions I found this crued solution ensures Visual Studio doesn’t re-add the import line but does allow xbuild on nix to complete.

1
2
<Import Condition="$(MSBuildProgramFiles32) == ''" Project="$(SolutionDir).nuget\nuget.targets" />
<Import Condition="$(MSBuildProgramFiles32) != ''" Project="$(SolutionDir)\.nuget\nuget.targets" />

If you’ve found a better solution let me know :–)

Some quick notes from setting up a TeamCity mono build agent on Ubuntu.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

# THESE ARE NOTES, NOT TESTED AS SCRIPT!

# We need the following to get and run teamcity agent
sudo apt-get install openjdk-7-jre-headless
sudo apt-get install unzip #For unzipping buildAgent.zip

# For compiling Simple.Web
sudo apt-get install ruby1.9.1

# We need the following for compiling mono
sudo apt-get install build-essential #For compiling source
sudo apt-get install autoconf #Should get automake
sudo apt-get install libtool
sudo apt-get install gettext
sudo apt-get install mono-complete #Believe it or not,  we need Mono to build Mono

# Get build agent from TC server and unpack in /var/TeamCity
(cd ~/; wget http://teamcity.cloudapp.net/update/buildAgent.zip)
(cd /var; sudo mkdir TeamCity; cd TeamCity)
sudo unzip ~/buildAgent.zip
(cd bin; sudo chmod +x agent.sh)
(cd ../conf; sudo cp buildAgent.dist.properties buildAgent.properties)

# We need to configure the agent
### Change the TeamCity URL (e.g. "http://teamcity.cloudapp.net") and specify a name (e.g. "monotcagent")
sudo vi buildAgent.properties

### We need to tell the machine to start our agent when it boots, like this:
### #!/bin/bash
### /etc/TeamCity/bin/agent.sh start
sudo vi /etc/init.d/teamcity
sudo chmod +x /etc/init.d/teamcity
sudo update-rc.d teamcity defaults

# Lets compile mono from source (if we aren't happy with the version coming from apt-get mono-complete)
cd ~/
(mkdir code; cd code)
(git clone git://github.com/mono/mono.git; cd mono; git checkout mono-3.0.3)
./autogen.sh --prefix=/usr/local
make
make install

# Make sure NuGet.exe knows whos certs to trust
sudo mozroots --import --sync

# We need to open port 9090 so our server can talk to our agent
sudo iptables -A INPUT -p tcp -d 0/0 -s <ip address of your teamcity server>/255.255.255.255 --dport 9090 -j ACCEPT

# Lets reboot to ensure compiled Mono is system default
sudo /sbin/shutdown -r now

# You can always start/stop the agent manually
sudo /var/TeamCity/bin/agent.sh stop
sudo /var/TeamCity/bin/agent.sh start

Just wanted to make a quick post to explain my recent lack of activity; I became a Dad! :–)

#MollyBobs

Service should now resume, largely around continued contribution to Simple.Web.

Working to compile Simple.Web on Mono this week needed to pass properties to xbuild via build tool “FAKE” (F# Make), although the solution applies equally to Windows/MSBuild.

Note

I’m new to both F# and FAKE having only spent a few hours delving into the source-code; as such it’s likely their is a better way of achieving the below. If you are interested in FAKE I suggest hooking yourself up to the Google Group.

Example

In this scenario Sandbox.csproj uses $(VSToolsPath) in it’s project file, as xbuild/Mono won’t substitute this upon compilation I need to pass our path in as a property. We are also capitalising our build target as FAKE is case-sensitive in this regard.

First of all let’s update our script with a parameter that defaults:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
TARGET=$1
BUILDTARGETS=$2

if [ -z "$BUILDTARGETS" ]
  then
  BUILDTARGETS="/Library/Frameworks/Mono.framework/Libraries/mono/xbuild/Microsoft/VisualStudio/v9.0"
fi

if [ -z "$TARGET" ]
  then
  CTARGET="Default"
else
  CTARGET=`echo ${TARGET:0:1} | tr "[:lower:]" "[:upper:]"``echo ${TARGET:1} | tr "[:upper:]" "[:lower:]"`
fi

if [ ! -d "$BUILDTARGETS" ]
  then
  echo "BuildTargets directory '${BUILDTARGETS}' does not exist."
  exit $?
else
  export BUILDTARGETS="$BUILDTARGETS"
fi

echo "Executing command: $CTARGET"

mono packages/FAKE.1.64.6/tools/Fake.exe build.fsx target=$CTARGET

Now we need to update our FAKE .fsx file to pass this to the build process. This requires us to first retrieve the environment variable with environVarOrDefault and bypass the usual MSBuildRelease and MSBuildDebug methods going instead directly to MSBuild:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#I @"packages/FAKE.1.64.6/tools"
#r "FakeLib.dll"
open Fake

let buildDir = @"./build/"
let testDir = @"./test"

let fxReferences = !! @"*/*.csproj"
let testReferences = !! @"Tests/**/*.csproj"
let buildTargets = environVarOrDefault "BUILDTARGETS" ""

Target "Clean" (fun _ ->
    CleanDirs [buildDir; testDir]
)

Target "Build" (fun _ ->
    MSBuild buildDir "Build" ["Configuration","Debug"; "VSToolsPath",buildTargets] fxReferences
        |> Log "Build-Output: "
)

Target "BuildTest" (fun _ ->
    MSBuildRelease testDir "Build" testReferences
        |> Log "Test-Output: "
)

Target "Test" (fun _ ->
    !! (testDir  + @"/*.Tests.dll")
        |> xUnit (fun p ->
            { p with
                ShadowCopy = true;
                HtmlOutput = true;
                XmlOutput = true;
                OutputDir = testDir })
)

"Clean"
  ==> "Build"

"Build"
  ==> "BuildTest"

Target "Default" DoNothing

RunParameterTargetOrDefault "target" "Default"

Note: If you are running Mono 2.11 + it is likely that fsi and fsc have been replaced with fsharpi and fsharpc, I suggest you (like me) create two bash scripts to redirect any calls by FAKE (see fsc:here and fsi:here).

I’ve posted before how to configure git so ‘mergetool’ uses Araxis Merge, this was however slanted heavily towards a Windows installation. Doing the same for OS X isn’t that much different but does require an extra step.

  • Download & Mount Araxis Merge for Mac OS X

  • Drag Araxis across to your ~/Applications folder as normal

  • Copy the contents of the Utilities folder to (eg) /usr/local/araxis/bin (info here)

  • Add the path to your startup script: export PATH="$PATH:/usr/local/araxis/bin"

NB: Make sure the command-line files have execute permissions (e.g. chmod -x /usr/local/araxis/bin/*).

Now update your .gitconfig to use the merge command-line file:

1
2
3
4
[merge]
  tool = araxis
[mergetool "araxis"]
  cmd = araxisgitmerge "$REMOTE" "$BASE" "$PWD/LOCAL" "$PWD/MERGED"

BISH BASH BOSH!

Found myself wanting to use NuGet under Mono today and thought I’d share;

  • Download the NuGet BootStrapper from nuget.codeplex.com/releases
  • Tell Mono certs to trust when doing https: mozroots --import --sync
  • Use an environment variable to enable package restore (suggest shell startup): export EnableNuGetPackageRestore=true
  • Install NuGet (via BootStrapped) into location (~/.local/shared/NuGet):
    mono NuGet.exe
  • Create a nice bash script to run from console:
1
2
 #!/bin/sh
  exec mono --runtime=v4.0.30319 --gc=sgen "/users/ian/.local/share/NuGet/NuGet.exe" "$@"

BISH BASH BOSH!

“Do what you love! Don’t settle.”
— Steve Jobs, Stanford 2005 Commencement Address

Ian @ Crossroads

I always find it amusing when my mind evolves its thinking to a point of self-proclaimed wisdom only to then realise somebody in my life has been telling me just that all along.

In fact it’s often the case that the wisdom that people credit you with is far from original. Knowing and walking the path are indeed very different things. One such wonderful piece of wisdom came form my father when I first ventured into the world of commercial software development;

“If you can be a bin man and be happy, be a bin man.”

I always knew what my father meant, not that he would advocate settling for less than your true ambition and potential, that you must love what you do and if that happens to be emptying bins – so be it.

He repeated this several times over the years, largely because I was often unhappy in my career, ambition got in the way.

Ambition vs Challenge

I realised many years ago much of my career-related angst was caused by being caught up in a wave of career progression that superiors assumed would pass my celery test. It didn’t. I’d just quit and find another job challenge. What I really craved was an innovative environment that could supply me with a constant stream of mouth-watering development challenges.

Joining AHC in 2009 as Development Manager, a split role between development and management, was perfect. Spliting my time between architecture and training, whilst embracing the opportunity to demonstrate that management “done right” can support team growth, innovation, and cathedral building – whilst meeting business expectations, has been amazing.

It has however presented me with an wonderful dilemma, that with growth of our team do I concentrate on management and pursue the associated career path, or do I return fully to architecture and training? The decison has to take me to where I pass my celery test, to what I love doing most, and that’s writing great software.

Could you be our new Development Manager?

So we’re now looking for a new Development Manager, and boy you’re gonna have to be amazing! We love what we do and we won’t settle for anyone who doesn’t love it also. You are going to have to pass our celery test as well as your own. Let me tell you our team vision to whet your appetite;

Our Team Vision:–
Everything we do, we believe is focused on enabling health-care professionals to improve the life of patients. We believe that through passion and dedication the software we write brings true innovation to our industry.

The way we do this is by putting ourselves in the shoes of those for which the software provides, and the shoes of the individual whose quality of life depends on it.

We think beyond requirements to a truer intent, to the best it can be. We happen to love writing software, but we love to help people even more.

Interested? Keep an eye on our careers page for upcoming details Check out the job spec here :)