Building a RESTful WebApi with F# and NetCore

It is a common misconception that F# is just for data science, machine learning, and quantitative finance; in the .NET eco-system you turn to C# for enterprise and web development and, eventually, you’ll look at F# for serious number crunching. While it is undoubtedly true that functional languages are ideally suited for solving numerical problems, some of them - and F# in particular - are perfectly fine for tackling so many different domains other than scientific ones. F# is a cross-platform, functional-first, general purpose language. Stress on functional-first and general purpose. Line-of-business applications are almost always perfect candidates for F# development. On this topic, I recommend you take a look at Scott Wlaschin’s “Why F# is the best enterprise language” ...

February 24, 2019

NuGet Gems: DeepEqual

This handy little package does one simple thing, and it does it well. According to its description, DeepEqual is: An extensible deep comparison library for .NET. I am sure you too have come across this a few times. You have some code that shuffles around objects, and at some point, you’d like to make sure that two instances of the same class are, indeed, equal. And no, you don’t mean “equal” as in reference equality. That’s easy to achieve with .NET. Most of the time, what you want is to check for value equality. ...

January 26, 2019

FatturaElettronica for .NET v0.9 has been released

FatturaElettronica for .NET v0.9 has been released. The companion Extensions package also hits v0.4. The main new feature is the FromJson() extension method which allows, you guessed it, for deserialization of a JSON stream into a Fattura class instance: var fattura = Fattura.CreateInstance(Instance.Privati); fattura.FromJson(new JsonTextReader(new StringReader(json))); // or, if FatturaElettronica.Extensions v0.4 is being used: fattura.FromJson(json); // Invoice is now ready for inspection. foreach (var documento in fattura.Body) { var dati = documento.DatiGenerali.DatiGeneraliDocumento; Console.WriteLine($"fatt. num. {dati.Numero} del {dati.Data}"); } I should probably mention that FatturaElettronica.Core 0.4 is also out, and that that is the actual place where all the new juice comes from, courtesy of Emanuele Zavallone. You don’t have to directly install Core, it will be pulled down for you by the main packages. ...

October 27, 2018

Eve 0.8.1 has been released

Just a quick note to report that Eve v0.8.1 is out and ready to rock. It brings a number of fixes, some improvements as well as a couple of new features. Check out the changelog for details. Join the newsletter to get an email alert when a new post surfaces on this site. If you want to get in touch, I am @nicolaiarocci on twitter.

October 5, 2018

Lettura di fatture elettroniche con firma digitale in .NET (.p7m)

Sorry folks. Because of its target audience, this post is in Italian. Ho appena rilasciato FatturaElettronica.Extensions. Si tratta di un package che estende FatturaElettronica.NET aggiungendo (per ora) un solo extension method: ReadXmlSigned Il metodo si affianca all’esistente ReadXml ed accetta un file in formato standard fattura elettronica già firmato digitalmente (estensione .p7m), lo legge, verifica che le firme siano valide, quindi lo carica in un oggetto FatturaElettronica che lo rappresenta interamente: ...

September 27, 2018

Code Magazine: Learn Python with Visual Studio

On the July/August issue of Code Magazine, available both printed and online, you can find my article Learn Python with Visual Studio. From the incipit: In the Stack Overflow Developer Survey for 2018, Python sits comfortably in the first place as the most wanted programming language, with JavaScript and Go coming second and third. Python also ranks third in the “most loved” category. Despite the age (20 years and counting), Python’s popularity keeps growing, and for good reasons. It’s reliable, flexible, easy to learn, open-source, and cross-platform since the beginning. It also helps that, over time, it enjoys a robust and active developer community and incredibly rich eco-system of free libraries supporting all kind of usages: Web applications and services, desktop apps, scientific computing, scripting—you name it. ...

July 6, 2018

Eve 0.8 has been released

I am pleased to announce that the latest version of Eve, v0.8, has been released. As always, this release has been carefully crafted with love and passion by yours truly, with the help of a fantastic bunch of contributors. Highlights include data-validation-on-steroids thanks to the full support for Cerberus 1.x, also recently released, partial media requests (think media streaming), new hooks which allow you to attach custom callbacks to aggregation and soft deletion events, some new query operators, support for the mongo decimal type, and more. There are also many critical fixes and improvements. ...

May 10, 2018

Mac Notification Center does not work: the Quick Fix

I had this happen to me a few times already. Notification Center on the Mac goes completely numb: no more notifications and the list is empty. I’m writing down the fix, so I do not have to google the forums once again the next time. Open the Terminal, then: # this usually fails, as the notification server is already running launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist # kills and restarts the notification center - fixed!. killall NotificationCenter Join the newsletter to get an email alert when a new post surfaces on this site. If you want to get in touch, I am @nicolaiarocci on twitter. ...

April 12, 2018

Announcing my first online course

I am super excited to announce the launch of Eve: Building RESTful APIs with MongoDB and Flask, a brand new TalkPython Training course. Authoring this course has been a new experience for me, and I must say that I very much enjoyed every minute of it. Finding myself in the exciting position being at the same time both the project author and the instructor, I did my best to focus on the typical issues I know from experience most people face when they start setting up their first RESTful web service with Flask and Eve. ...

March 15, 2018

Quick fix: MongoDB fails when saving Decimal fields

So today I was trying to store some decimal fields on a MongoDB 3.4 instance and I kept failing, miserably. In Compass I was getting a somewhat obscure “connection lost” message on every save attempt. Upgrading to Mongo 3.4.10 (I was on 3.4.4) improved things, as the error message was now hinting at the setFeatureCompatibilityVersion setting which, apparently, was preventing some features to be made available. Now that made sense, as this specific database had been upgraded all the way from up Mongo 2.6. A quick lookup revealed that, when upgrading to 3.4, setFeatureCompatibilityVersion is automatically set to "3.2". As we all know, support for Decimal type only comes with Mongo 3.4. ...

November 23, 2017