Developing a web app with Mono (opensource .NET) any examples? - linux

I am a Java, Scala, Python web app Linux guy. I want to play around with Mono (particularly F#) for web development.
I am just looking for an example web application written in Mono perhaps in Github (any CLI language is fine). I have tried googling and cannot find a good starting point (or if its even possible).
From what I gather I could sort of combine:
Fast CGI (nginx, lighttpd)
Mono
Spring framework .NET (I can't even tell if it will work on Mono)
Advanced apologies if there is a glaringly obvious resource (web site) that I missed.
(useful site: http://www.tryfsharp.org/Resources/GetMono.aspx)

To get F# dev environment for Mac/Linux setup:
http://www.tryfsharp.org/Resources/GetMono.aspx
For Ubuntu 12.04 specifically:
http://datachomp.com/archives/running-asp-net-mvc4-on-ubuntu-12-04/
To Get Fsharp to work with MonoDevelop 2.6 or greater you have to use one of forks of:
https://github.com/fsharp/fsharpbinding
Nancy looks like a good URL routing option which is all I really need:
https://github.com/NancyFx/Nancy
And for F# Mono stuff for Nancy including Djano templating:
https://github.com/NancyFx/Nancy/wiki/Building-Nancy-on-Mono
You can use the command line NuGet install tool (which is basically like Javascripts npm or Java's maven):
http://nuget.codeplex.com/releases/view/58939
Once I install the Fsharp Powerpack I should have in theory LINQ to use for persistence.
And If Nancy does not work out there appears to be a standard called OWIN (it appears to be analogous to Python's WSGI).
Other OWIN compliant projects: http://owin.org/#projects
UPDATE
Looks like ServiceStack has some good stuff also and seems to be gaining some traction. In terms of Mono you mainly want to look at daemon doc.

Check out XSP (about halfway down this page)
Mono & ASP.NET
And besides WebSharper which Daniel mentioned there's also Bistro.
Hope that helps.

Related

Is there an equivalent of Node.js for .NET developers?

I'm a .NET developer and would like to use something like Node.js and run it in the Microsoft cloud. Is there an equivalent? I know Microsoft is helping port this over but no sign of when this will happen and I need something in the meantime.
There's a couple of projects under way:
https://github.com/dnewcome/Node.net
https://github.com/Rduerden/Node.cs
I couldn't vouch for their completeness.
I'd also have a read of this post by Ayende, the comments are particularly interesting:
http://ayende.com/blog/72705/node-cs
Why would you need Node.js when .NET has supported event-driven async IO from the very beginning? (Look at the all the .Begin/.End methods in the IO and web request classes).
Furthermore, the explicitly event-driven approach used by Node.js and the .NET APM (Asynchronous Programming Model) will soon be superceded by the async/await keywords in C#. This has the benefit of producing much more readable code.
Actually a port of node to windows is already underway and currently actively worked on. You can already download a windows build of node on the official page. It is however still far from beeing production ready, but you should be able to play around with it.
Try to look at manos and it's manifesto article.
Hi i started the development of a Node.Cs like server with support for .NET MVC Controllers, Razor etc. Just to explain, is based on a system like Node.Js with few threads, without locks and with a queue of couroutines.
PS any suggestion or correction is welcome!
Documentation
MvcMusicStore sample port on Node.Cs
Packages on Nuget

Writing a Web Application in Haxe without Apache and PHP?

Haxe has Apache httpd modules and can compile to PHP code. These are 2 options I know to make a web application that runs on the server. You can start a http server with nekotools, but this is supposed to be used for development only.
Are there any more options?
I can always use the NekoVM from within a C or C++ program, running a web server or interfacing to FastCGI. Or compile to C++, using a FastCGI or web server library. But I want to hear about solutions that are actually used.
I have a VPS with nginx, so no mod_neko or mod_tora. PHP isn't a problem, but I'd rather wouldn't use it (for irrational reasons).
More correctly there is an Apache module for the nekoVM. (You do need necessarily haxe to produce neko binaries)
To your question:
As far as I know there is currently no possibility to use the C++ target for webserver application, but some people are playing arround with some stuff.
As you said, you could use PHP
mod_tora or mod_neko on a Apache setup. (Why not use Apache?)
OR: the probably most interessting thing for you be: Link 1 and Link 2 (neko as cgi / fastcgi)
hxNode uses node.js. Don't know if anybody uses hxNode, but node.js got some good press lately.
I'm continuing to keep hxNode up to date and expanding it with the node.js spec.
I'm using it for my own projects and debugging it as I come across stuff.
Currently, hxNode, has the node.js api defined in Haxe, this is the standard node.js asynchronous API. Also, I've started to recreate the Haxe standard API using this API, so for example, js.FileSystem has been implemented, this makes use of the fact that latest versions of node can call fs module syncronously.
Other things which I'm working on with this API, servlet's sitting on top, and mongo bindings based on chriskv's mongo native drivers.
bd

WCF on Linux - is it worth the effort

This is my first question here, so please don't shoot.
I've been playing with Linux recently (Ubuntu 9.04 and openSUSE 11.1) with focus on web services. The simple Hello World web service (as described on mono-project.com) works fine. Now I need to step into the wonderful world of WCF (I'm familiar with the concept). And I'm stuck. I've installed MonoDevelop and mono-wcf package (including all the dependencies) and as you can assume I can't write simple WCF server (well, I can write it, it just won't compile). I'm missing some references which I can't find: The type or namespace name 'ServiceModel' does not exist... and when I add System.ServiceModel reference (for which I have to change to Moonlight/Silverlight project type or I don't even see it in Packages) I get: The type or namespace name 'ServiceHost' does not exist, and I just don't know where it is.
What am I doing wrong? The same code compiles and runs fine on Windows (VS2008).
Please help. And still don't shoot.
Although there is work currently being put into WCF on Mono (mainly around the parts of WCF that are included in Silverlight), the WCF stack is largely incomplete. My impression is that only the most basic of operations are functional.
Regular web services, on the other hand, should be fully functional.

Haxe in the field

I had a fresh look at Haxe again recently and realized that I had overlooked some of its elegance before. But I guess it lacks some visibility among the developers still.
So my question is, does anybody here use it for production? If so, how do you use it? What are the gotchas or difficulties you encounter? Do you recommend it for future projects?
I use Haxe to develop all my Flash applications, and I love it. I develop on Linux and with Emacs,
and I really like how I can make Haxe fit within my preferred development environment. I just use
simple Makefiles that look something like:
project.swf: Project.hx
haxe project.hxml
It's really easy to get started in Haxe, and it's very elegant. I've
had no problems at all using Haxe as compared to using the Adobe Flash
builders, and have developed a bunch of big projects including PanningPedagogy, The Orchive,Cantillion and Audioscapes.
I've released the source code to all of these as GPL on SourceForge, check them out at:
https://sourceforge.net/projects/panning/
https://sourceforge.net/projects/orcaannotator/
https://sourceforge.net/projects/cantillion/
https://sourceforge.net/projects/margridflash/
You might find some useful information in the lists of Projects Using Haxe and People Using Haxe.
My company uses Haxe for production use. For programming swf content is absolutly no problem on the technical side. Using it on the server side is a little bit harder. If you Haxe for PHP you sometimes have some problems with typing (this is more or less a PHP problem). The neko vm is very stable and very very fast but it takes some time to get it running with all you other server software (mysql, apache - mod_rewrite), but once you got it you it is very stable.
We used it for generation swf applications, tried the possibilies of Haxe JS. Also we created socket server for a multiplayer game and start to generate all our webpages with Haxe PHP or neko.
The community is very helpful, the documentation is sometimes a little bit to short.
This is only my opinion and the experiences I made.
For those of us who don't know what Haxe is, it's a programming language for developing web apps. It has multiple compiler targets (Flash, php, JavaScript, and the Neko language's VM)
Welcome to haxe [haxe.org]
Haxe entry on Wikipedia
Haxe are currently gaining more popularity as a cross-platform development (mainly for game development) tools thanks to NME/OpenFL: http://www.openfl.org/
Write once in Haxe and deploy it to Flash, Android, iOS, and more..
HaxeJS is very good for web production, it allows to use all the underlying js modules while giving extra abilities like pre-processor, typed fields, conditional-compilation, classes, haxe libraries, refactoring and auto-completion from IDE etc.. plus its very quick to compile and output ready-to-use js files.
I haven't tried microsoft typescript, but so far I've been using HaxeJS for both client and server (nodejs) on a few production projects and it feels a great choice. The only issue is if i want to share js libraries or npm modules with others, I'll probably need to rewrite the js by hand then.
We used it at a previous internship, for an internal web system. We only compiled to js and I just once compiled some minor code to both js and C#. I can say it worked quite well and many custom widgets were made at the time. Debugging the produced js wasn't that bad either, but it sometimes didn't produce the code you wanted it to (I remember one string comparison issue in js, where the reference was being compared instead of the value). The code was deployed in production and had worked fine for years. I'm pretty sure they still use it today.
That was in 2013, I haven't used it since. One problem I did have was trying to compile code made in version 2.08 using version 2.10. It needed some minor, but non-obvious adjustments. I can't quite comment on more recent releases, but I'd be a bit careful on not breaking large pieces of code by upgrading to new versions of the compiler.
You compile, haxelib run flow run "target" in target you type for example web, and thats all, in your bin, folder you get your files, remember to configure your project.flow file acording to your target and project.

GUI/TUI linux library

Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source?
I know that debconf can be used with various frontends, I would like to build something similar but programmable.
The library that powers YaST independence to do ncurses, gtk and qt with one codebase provides what you are looking for, and it is not tied to YaST itself.
Actually libyui only requires the standard C++ library and phtreads (IIRC). The UI plugins require of course the respective libraries (Qt, ncurses). YaST uses libyui via a set of YCP bindings that export a YCP like API on top of libyui.
The library is a bit lowlevel (one layer below an event loop), my colleage Klaus Kämpf wrote about using it some time ago in his blog, including binding to scripting languages it using swig.
The only part that is SUSE specific is the packaging, so you would need to package it yourself. Stackoverflow did not allow me to link more than once. The code of the library is linked from Klaus blog. Replace libyui for "qt" and "ncurses" for the plugin's code.
Also google for "YaST Independence From YCP" to find a blog entry from Andreas Jäger on the subject.
you could write your program to uses ncurses, and then use PDCurses to convert it to an X11 application - as the readme advertise.
I know it because I've used it as portable curses, though I've never tested its X11 capabilities
Not exactly a library but you could consider writing a web app that degrades well to Lynx
The GoboLinux guys have created their own toolkit for python called AbsTK, they use it for their installer, which actually works really good. I have never used the toolkit myself, but the apps built with it seems solid.
There's Cursed GTK, but it seems a bit dated. I found some references to a port of Qt to ncurses called Qt Console, but it seems to have disappeared.
By using a library that targets both the text-mode and GUI environments, you have a big risk of getting stuck with the worst of both worlds.
You will be better off structuring your code using the MVC pattern, and providing separate views and controllers for each platform you target. Pushing all the logic down to the model classes has several other benefits:
The code will be easier to test because you are forced to keep the user interface out of the actual domain logic.
Your program can have user interfaces that have very little in common, e.g. a web UI, or an UI driven by speech.
You can run the program easily with no UI at all (i.e. script it) by accessing the model classes directly in the same way that the controller classes do.
I think what's used for configuring the linux kernel when compiling is dialog/cdialog/xdialog. But it's been a while since I've compiled a kernel, so my memory may be off. The most promising link I can find is this one for Xdialog.
Maybe tcl/tk would provide what you want http://www.tcl.tk/
Here's the page on interfacing with curses. There is a claim there of integration with ncurses.
http://www2.tcl.tk/2372

Resources