Programming

SonarQube configuration tutorial

This post will be a simple tutorial to install, configure and use SonarQube to analyse your project code quality. This tutorial will be directed to C# and JavaScript projects in a Windows environment.

1- Download SonarQube

2- Create a SQL Server database

If you don’t have SQL Server installed download SQL Server Express, a free and limited SQL Server edition option (SQL Server editions comparison here).

Run the following command:

CREATE DATABASE SonarQube;

Just after this command the collation from the recently created database needs to be changed as recommended in the SonarQube website:

Quick tips for building a API using Nancy

Hello! I’m writing this brief post to help everyone that is using Nancy for the first time to not make the same mistakes that I did. I’m not even remotely interested in covering all possible aspects involved in developing a web application using Nancy, I just thought I’d share some of my mental notes gathered a few months ago. So, here we go.

Know how to properly use CORS

If you are using CORS avoid to use the wildcard in the Access-Control-Allow-Headers CORS header because he can have unpredictable behavior.

Defining cross cutting concerns using the MediatR library

Hello! A few months ago I did a freelance gig in which I found myself having trouble to define where exactly to put things like logging, authentication, persistence common logic and so on. These elements are somehow detached from the core business logic and are very similar or exact the same in every application. If you decide to insert them in all your methods you are going to have a lot of repeated and unmaintainable code very fast.

TypeScript + Webpack

Hey, hello! As always, it’s been a long time since I posted. Anyway, probably nobody cares besides me so I just going to straight to the point to be discussed in the post, a simple integration between TypeScript and Webpack.

First of all, this post assumes you already know a little about JavaScript and already heard about - or used - a task-runner like Grunt or Gulp.

Defining TypeScript

In a nutshell TypeScript is a javascript-based kind of language that compiles to JavaScript. TypeScript most important feature is being statically typed, bypassing JavaScript dynamic nature and allowing the development of big, scalable applications more easily.

Resumo do primeiro dia do BrazilJS 2015

Daí pessoal, tudo certo? Resolvi fazer este post com um pequeno resumo das palestras do primeiro dia do BrazilJS 2015. É importante destacar que tudo aqui escrito vem da minha experiência do evento e de tudo aquilo que pude absorver e/ou achei interessante o bastante para comentar.

Espero que atenda as tuas expectativas!

Palestra 1 - Christian Heilmann - ES6 - Baseline para a web moderna?

O Chris procurou falar sobre dois pilares bastante discutidos entre desenvolvedores JavaScript: a nova versão do ECMAScript, o ES6 e sobre comos precisamos depositar todos os nossos esforços em trazer a maior quantidade de boas funcionalidades para o browser ao invés de ficar “apenas” criando frameworks, bibliotecas e trabalhando com JavaScript em ambientes fechados como no NodeJS. Alguns pontos interessantes que ele levantou:

Using dependency injection in MongoDB CSharp Driver

Hello! So, it seems that I delayed once again new posts in here. Since I promise to no one that I need to post here on regular basis I don’t think that I need to apologize, hehe (just kidding). So, as the title says I here to talk a little about dependency injection and post a code snippet about using DI on MongoDB CSharp Driver basic classes.

Dependency Injection

If you don’t want to know or already know the concept behind dependency injection, just jump to the code. As you may know dependency injection helps us programmers to control code dependencies easier. When you use dependency injection (or DI) depending on the language that you are using you just need to use an attribute, annotation or something else that helps to inject (like the name says, doh!) the dependencies into your code without the need to instantiate or set the objects manually.

Null propagator operator on C# 6.0

Hello again! Today I’m going to talk briefly about a specific feature from the next version of C#: the not so new null propagator operator. Yes, its been awhile since C# 6 was announced but I want to talk about this, so you cant do anything to stop me! The main reason I’m talking about this it’s because since I saw the proposal for implementing the operator in C# I really liked and hoped that Microsoft implement, and he did it! In the latest Visual Studio 2014 CTP version the operator was there and of course I looked. Verdict: tested and approved!

CORS vs JSONP

Hello! So, here I am again! Sorry for the delay, almost 2 months since I last posted here. Anyway, I here today to talk about CORS and JSONP. Basically I will introduce the terms and cite some implementation examples using JavaScript and ASP.NET WebAPI (because I am a .NET fan, of course!).

JSONP

First I will talk about JSONP. The acronym stands for “JSON with padding”. We have a lot of resources telling about the concept in the internet today, so I will be short. “JSON with padding” it’s basically a hack that makes possible inter-domain requests. And that’s it. This hack consists from return a function (often named ‘callback’ or whatever you want) that receives a JSON parameter like the following.

Solve a simple problem during RabbitMQ setup in Windows

RabbitMQ

Hello! So, for you that don’t know what is exactly RabbitMQ, let me briefly explain before anything else: RabbitMQ is a framework that provides a messaging system based on the AMQP standard (click here to know more).

Considering my experience developing Microsoft solutions today I got interested in learn how to use EasyNetQ, a .NET API implementation for RabbitMQ. Before trying to do anything using EasyNetQ I start following the Quick Start Guide for EasyNetQ and had some problems. This post focus on those problems and describes a simple way to solve them.