News for hackers. Stuff that matters.
Re:Mono 3.2.7 is out by romanovcode on Wednesday February 26, 2014 @11:06AM (#7305701)
MVC5 still not working tho. Good thing we have Nancy.

Edit: Seems like many do not know about Nancy, check it out, some even say it's better than MVC. The good side is that it's 100% compatible with Mono because they run tests against it too so you can host your C# websites on Linux.

Github: https://github.com/NancyFx/Nancy

Re:Mono 3.2.7 is out by skrowl on Wednesday February 26, 2014 @11:17AM (#7305785)
First time I've heard of Nancy. Anyone got a URL since it's name is so terrible that you can't google it?
Re:Mono 3.2.7 is out by Thieum22 on Wednesday February 26, 2014 @11:20AM (#7305816)
Re:Mono 3.2.7 is out by Yuioup on Wednesday February 26, 2014 @11:20AM (#7305811)
I had the same problem. I googled "Mono Nancy" and eventually found this:

https://github.com/NancyFx/Nancy

EDIT: It seems to be a .NET clone of node.js

Re:Mono 3.2.7 is out by JohnBooty on Wednesday February 26, 2014 @11:34AM (#7305902)
No, it's a Sinatra-inspired framework for .NET ...and it's quite good!

(Thus the name. Frank Sinatra's daughter is named Nancy Sinatra)

Re:Mono 3.2.7 is out by rjzzleep on Wednesday February 26, 2014 @11:34AM (#7305905)
no it's not. it's a .NET clone of sinatra. it's a web framework. it has little to nothing to do with node.js. although .net have pretty powerful multiprocessing and async routines, and can therefore be connected to node.js without too much effort.
Re:Mono 3.2.7 is out by brokenparser on Wednesday February 26, 2014 @02:11PM (#7306895)
If you don't mind me asking, I'm stuck trying to get the project templates to work with Monodevelop 4. I'm using this repository to run the latest Mono and Monodevelop on Fedora: http://download.opensuse.org/repositories/home:/tpokorra:/mo...

When I open the vsix file, all I get is a hexdump. I also tried installing it as an add-in, but it doesn't appear to accept vsix files.

The goal is to get past step one of these instructions: https://github.com/NancyFx/Nancy/wiki/Introduction

How to make this work, pretty please?

Re:Mono 3.2.7 is out by rjzzleep on Wednesday February 26, 2014 @05:28PM (#7308576)
monodevelop is not really supported. i would try compiling the latest mlnodevelop and see if there is a fork of the nancy templates.

you can work around that issue if you make an empty asp.net project and then use nuget to install-package nancy.hosting.aspnet

at least i think so, i haven't been doing .net in a while

Re:Mono 3.2.7 is out by brokenparser on Wednesday February 26, 2014 @11:40PM (#7310433)
SUCCESS! I followed these:

http://rubygems.org/gems/albacore/versions/1.0.0.rc.1 (for the command to install albacore), and

https://github.com/NancyFx/Nancy/wiki/Running-Nancy-on-your-...

This works on Fedora and probably other distributions as well, though this uses HTTP which might be less optimal than FastCGI with Fos. I got Fos to compile with Mono but it's not usable yet, it can't find IAppBuilder in my "console" application no matter what references or using directives I add. Nowin compiles cleanly but the example projects don't, so it'll take some effort to get it to work. Things are progressing, though. But I really can't recommend anyone use Mono for web development as it stands.

Re:Mono 3.2.7 is out by skrowl on Wednesday February 26, 2014 @11:39AM (#7305937)
How does it compare to Web API?
Re:Mono 3.2.7 is out by JohnBooty on Wednesday February 26, 2014 @04:20PM (#7307937)
Nancy, like Sinatra, is a general-purpose web framework. You could implement an API in it, or you could implement a user-facing website.

Nancy and Sinatra are typically used for smaller sites. They're based around routes, controllers, and views but they don't (for better or worse) lock you into an MVC project structure like ASP.Net MVC or Rails.

Web API, by comparison, is pretty much "just for implementing a web-based API" and not something you'd want to use for a user-facing web application that serves up HTML pages.

Re:Mono 3.2.7 is out by hhandoko on Wednesday February 26, 2014 @08:32PM (#7309681)
ServiceStack [1] is a closer comparison to Web API. A lot easier to set up and runs in Mono, but not free (although it is open source [2]).

[1] - http://servicestack.net [2] - https://github.com/ServiceStack/ServiceStack

Re:Mono 3.2.7 is out by skrowl on Wednesday February 26, 2014 @11:29AM (#7305868)
.NET clone of node.js would be nice, because I like the idea of node.js but not enough to ditch all my .NET stuff (especially entity framework).
Re:Mono 3.2.7 is out by lucian1900 on Wednesday February 26, 2014 @12:45PM (#7306328)
There's nothing in node.js that you can't get with .NET/Mono except for JavaScript, and even if you must run JS for some reason there are some solutions (like IronJS).
Re:Mono 3.2.7 is out by chadzawistowski on Wednesday February 26, 2014 @12:02PM (#7306074)
Edge.js might interest you. It's an interop library for .Net and node.js: http://tjanczuk.github.io/edge/#/
Re:Mono 3.2.7 is out by nbevans on Wednesday February 26, 2014 @02:15PM (#7306921)
Entity Framework is really not a good excuse. .NET has lots of great things going for it. Entity Framework is firmly on the "enterprise .NET" list of such items though.

.NET has always been able to do what Node does anyway. It has had HttpListener since v1.0...

Re:Mono 3.2.7 is out by mattmanser on Wednesday February 26, 2014 @07:50PM (#7309481)
Think you'll be getting a shock in a couple of years if you think the EF is enterprise. It's changed massively and coding without it is becoming a little like coding javqscript without jQuery.

You can do it, but why bother writing all those crud operations yourself??

Even with complicated SQL you can hand roll it and then tell the EF which class you're.returning and it'll handle all the boring `rs.GetInt(rs.GetOrdinal("ID"))` crap.

Re:Mono 3.2.7 is out by tracker1 on Wednesday February 26, 2014 @12:32PM (#7306251)
I think that the LINQ integration with EF is nice.. but EF in and of itself isn't all that great imho... Most of what it does is generate types to correspond to your database tables.

When you use a language with real variable types, it's less of an issue... If you really want it, you could shoehorn generators and other db platforms into the hyena[1] package.

In general, I've found that using databases tend to be much more straight forward under node, and that using ORM tools are less necessary.

[1] https://www.npmjs.org/package/hyena

Re:Mono 3.2.7 is out by j_s on Wednesday February 26, 2014 @10:44PM (#7310269)
C# (.NET4+) has real variable types, and a library to use them for database access.

Using Type dynamic - http://msdn.microsoft.com/en-us/library/dd264736.aspx

https://github.com/robconery/massive

Re:Mono 3.2.7 is out by tracker1 on Monday March 03, 2014 @03:11PM (#7336120)
When you use dynamic, you lose the biggest advantage of C# in general, intellisense in VS. Don't get me wrong, it can be great to use dynamic at times... I just feel you're losing the advantage that VS/C# give you when you do, so you may as well be using something else. (I like node.js)
Re:Mono 3.2.7 is out by martydill on Wednesday February 26, 2014 @11:13PM (#7310372)
I started something along these lines a while ago. Haven't touched in quite some time though.

https://github.com/martydill/node.fs

Re:Mono 3.2.7 is out by PallarelCoedr on Wednesday February 26, 2014 @02:21PM (#7306962)
OWIN will give some of what you are looking for.
Re:Mono 3.2.7 is out by profquail on Wednesday February 26, 2014 @11:56AM (#7306028)
I haven't tried them yet, but here are some directions I found (on /r/dotnet) a few days ago for tweaking MVC5 so it runs correctly on Mono:

http://curtis.schlak.com/2014/02/04/setup-asp-net-mvc-4-on-m...

Re:Mono 3.2.7 is out by Xdes on Wednesday February 26, 2014 @12:48PM (#7306345)
What *nix needs is an OWIN compatible web server.
Re:Mono 3.2.7 is out by friism on Wednesday February 26, 2014 @04:08PM (#7307821)
You can run OWIN apps self-hosted on Mono/*nix. Here's my write-up for doing that on Heroku: http://friism.com/running-owin-katana-apps-on-heroku
Re:Mono 3.2.7 is out by jongalloway2 on Wednesday February 26, 2014 @02:01PM (#7306830)
I've heard Nowin runs well on Mono (haven't tried it yet myself). https://github.com/Bobris/Nowin
Re:Mono 3.2.7 is out by wintersFright on Wednesday February 26, 2014 @03:51PM (#7307670)
Miguel tweeted this a week ago:

NoWin, Nancy, SignalR & Lego on the raspberry pi:

https://www.youtube.com/watch?v=s_ZQtiupyzE

Re:Mono 3.2.7 is out by oblio on Wednesday February 26, 2014 @01:12PM (#7306505)
From the FAQ: https://github.com/owin/owin/wiki/faq - OWIN is inspired by rack, WSGI and node.js.

I'd say there are plenty of alternatives to OWIN (and the .Net stack) for *nix. That's probably why there's not much interest around Mono, too.

Re:Mono 3.2.7 is out by damianh on Wednesday February 26, 2014 @02:27PM (#7307022)
There is also Fos (FastCgi Owin Server) https://github.com/mzabani/Fos
Re:Mono 3.2.7 is out by brokenparser on Wednesday February 26, 2014 @02:56PM (#7307233)
Neat! It even almost works! http://i.imgur.com/f1HjoNW.png

SO close...

Re:Mono 3.2.7 is out by voltagex_ on Wednesday February 26, 2014 @05:23PM (#7308532)
Looks like the Owin dependencies didn't come down - does NuGet run under MonoDevelop?
Re:Mono 3.2.7 is out by brokenparser on Wednesday February 26, 2014 @06:55PM (#7309209)
No, can't compile the add-in nor the cli program itself :(
Re:Mono 3.2.7 is out by voltagex_ on Thursday February 27, 2014 @07:06PM (#7316319)
NuGet.exe should run on Mono 3.2.x - http://nuget.org/nuget.exe
Re:Mono 3.2.7 is out by brokenparser on Friday February 28, 2014 @05:02AM (#7317905)
It may run but it won't compile. I'm no fan of Gentoo, but if it's open source I ought to be able to reproduce the binary with those sources.

Edit: An open source program must never depend on binaries in the build process where those binaries can't themselves be rebuilt from source. Again, I'm not a zealot but as a developer I see dependencies on arbitrary binaries as damage and try to work around them.

Re:Mono 3.2.7 is out by rjzzleep on Wednesday February 26, 2014 @11:08AM (#7305719)
didn't know mvc5 was out. but i can tell you mvc4 with f# was nifty weeeee

(as nifty as mvc can possibly be anyway)

Re:Mono 3.2.7 is out by yawgmoth on Wednesday February 26, 2014 @02:20PM (#7306957)
On [1], what does the underscore mean?

public SampleModule() { Get["/"] = _ => "Hello World!"; }

[1] http://nancyfx.org/

Re:Mono 3.2.7 is out by damianh on Wednesday February 26, 2014 @02:25PM (#7307003)
It's the 'Dynamic Dictionary' [0]. It's usually called 'parameters' but it's idiomatic in dotnet to name lambda input parameter '_' if don't use it in your expression.

[0] https://github.com/NancyFx/Nancy/wiki/Taking-a-look-at-the-D...

Re:Mono 3.2.7 is out by JohnBooty on Wednesday February 26, 2014 @04:28PM (#7307994)
As others have said, it's idiomatic to name a lambda param "_" if you're not using it.

To perhaps clarify a bit, here's what the Hello World example would look like if we added a second route that uses the lambda parameter, and a third route that does something else, and a fourth route that renders a view template.

  public SampleModule() { 
    Get["/"] = _ => "Hello World!"; 

    Get["/hello/{name}"] = p => ("Hello, " + p.name + "!");

    Get["/something-complicated"] = _ => {
      // complicated stuff happens here
      return "OK... we're all done";
    };

    // A variety of template engines are supported
    Get["/my-resume"] = _ => View["resume.cshtml"];
   
  }
Re:Mono 3.2.7 is out by ntnj on Wednesday February 26, 2014 @02:22PM (#7306986)
Unused parameter for lambda function.
Re:Mono 3.2.7 is out by SideburnsOfDoom on Wednesday February 26, 2014 @02:40PM (#7307110)
This is the most accurate reply. The expression

    Get["/"] = _ => "Hello World!";
is actually of the form a = b;

Where "a", i.e. "Get["/"]" is an array-like property (http://msdn.microsoft.com/en-us/library/2549tw02.aspx ) and the "b" value assigned to it is an anonymous function with one parameter, i.e.

    _ => "Hello World!"
In Nancy these handlers are of the type Func<dynamic, dynamic> ( http://msdn.microsoft.com/en-us/library/bb549151(v=vs.110).a... ) The parameter could be given any legal name, but an underscore is a convention meaning "I am not using this param".
Re:Mono 3.2.7 is out by romanovcode on Wednesday February 26, 2014 @02:29PM (#7307032)
It's dynamic path element.

    public SampleModule()
    {
        Get["/{id:int}"] = _ =>
        {
            int id = _.id;
            return "Parameter ID is: " + id.ToString();
        };
    }
Re:Mono 3.2.7 is out by manuletroll on Wednesday February 26, 2014 @01:55PM (#7306788)
Nancy is indeed an excellent framework, I use it for practically every web project at my day job these days.
Re:Mono 3.2.7 is out by antihero on Wednesday February 26, 2014 @07:04PM (#7309253)
How does Nancy stack up to ServiceStack?
Re:Mono 3.2.7 is out by kayone on Wednesday February 26, 2014 @07:26PM (#7309367)
servicestack is no longer free as far as I can tell, https://servicestack.net/pricing
Re:Mono 3.2.7 is out by antihero on Tuesday March 04, 2014 @10:19AM (#7340671)
Indeed, but for funded projects, their licensing is okay.