Author Archives: Rainer Schaack

Wieder aktiv nach vielen Jahren Pause

Seit 1983 bin ich lizensiert als DK2ZR. Damals im OV B04, dann viele Jahre nicht mehr aktiv.

Seit Anfang 2021 “wieder dabei”, jetzt im OV F40 Großkrotzenburg.

Bisher waren in dem Blog hauptsächlich Artikel über Programmierung, Windows und Linux zu finden. Und alles in Englisch.

Wobei ich hier auch lange nichts mehr gepostet habe 🙂

Bis demnächst,

73

de Rainer, DK2ZR

Creating a Web Application with Node.js, AngularJS, bootstrap and ng-table

Introduction

In  a previous post https://www.rsprog.de/aspnet-webapi2-angularjs/  I used ASP.NET WebAPI 2 for creating a small sample web application. Here, I will use Node.js as the server backend.

Node.js can be an alternative way for the server backend. It is especially useful if we want to have the option of providing support for Linux too.

In this article, we concentrate on Windows and describe how we install Node.js and create the server.

Continue reading

Creating a Web Application with ASP.NET Web API 2, AngularJS, bootstrap and ng-table

Introduction

I’ve been a developer for .NET Windows Forms, WPF and background services for many years, but I’ve always been a denier of web development. Not that I haven’t tried it and even developed some small web applications, but I’ve always found it cumbersome and not intuitive.

Some time ago, I developed a kiosk type application with AngularJS and NodeJS on a Raspberry Pi, which brought me to the idea of doing something similar in Windows with ASP.NET.

The following is a very special how-to for developers with programming experience, who want to start with web. Wait, probably this is nothing for you. At least, it has been something for me.

Continue reading

Active Directory user validation

This is part of an answer I posted on StackOverflow

(https://stackoverflow.com/questions/28667830/validate-users-of-remote-active-directory-in-c-sharp/28690682#28690682)

 

First some basics (independent of this question)

Authentication

The system checks if Bob is really Bob. In an Active Directory environment, this is usually done with a domain login from the workstation, Bob enters his username and password, and he gets a Kerberos ticket. Later, if he wants to access e.g. a file share on a remote fileserver, he does not need to login anymore, and can access the files without entering username/password.

Continue reading

ping in C#

This is what I recommend for checking if a remote host is pingable.

This code is from a diagnostics tool which runs in production for many years.

public static bool Ping(string host)
{
    for (int pass = 0; pass < 3; ++pass)
    {
        try
        {
            Ping pingSender = new Ping();
            PingReply reply = pingSender.Send(host);
            if (reply.Status == IPStatus.Success)
                return true;
        }
        catch (Exception)
        {
            return false;
        }
    }

    return false;
}

Creating a Windows service with self-installer with VS 2015

Preface

I wrote some Windows services before with Visual Studio 2010, which provided the Visual Studio Setup Project. It had some quirks, but it worked for me. Starting with Visual Studio 2012, Microsoft did not include this project type anymore. Many complaints of the community followed, and in the end they built a VS extension, which brought back the old setup.

But there is an alternative way. Some years ago I thought that it would require to do it all yourself: writing registry entries and so on.

But it is easier:

Continue reading

MP3 Tools and music title search in C#

Since some years I am hacking on a music search library, which queries AcoustID (https://acoustid.org/), MusicBrainz (http://musicbrainz.org/) and freeDB (http://www.freedb.org/).

The idea is not only searching for a recording, but also getting the album / release information, and do some heuristics for matching the correct album for a directory of MP3 files.

“Since some years” means I started the project in my free time and later had some more important things to do.

If some admin of MusicBrainz lands on this page (since I coded the URL in the user-agent string):

I do not think that this project will generate much traffic in the future. If it will be finished someday, I will probably release it under an open source license.

Using SQLite with Visual Studio 2013 and Entity Framework

First we need a tool for creating and managing the database.

We use this Firefox AddIn: https://addons.mozilla.org/de/firefox/addon/sqlite-manager/
Create a new database and a table in it. Do not forget to set a primary key.

Install SQLite package:

http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
And here:

Setups for 32-bit Windows (.NET Framework 4.5.1)

In the Visual Studio project, add this NuGet package:

System.Data.SQLite (x86/x64)
During the install, EF 6.0 will be installed as a prerequisite

Build

Add New Item -> Data => ADO.NET Entity Data Model

EF Designer from Database

This should be available:
System.Data.SQLite Database File (.NET Framework Data Provider for SQLite)

Browse to the DB file and open it

In the “Choose Your Database Objects and Settings” dialog select the table(s)
you want to use

Then you can do something like this:

using (var db = new sqliteEntities())
{
  db.Person.Add(new Person { Name = "Rainer", Age = 51 });
  db.SaveChanges();
}

Creating a Windows service & installer with VS 2013

Preface

I wrote some Windows services before with Visual Studio 2010, which provided the Visual Studio Setup Project. It had some  quirks, but it worked for me. Starting with Visual Studio 2012, Microsoft did not include this project type anymore. Many complaints of the community followed, and in the end they built a VS extension, which brought back the old setup.

See more at http://blogs.msdn.com/b/visualstudio/archive/2014/04/17/visual-studio-installer-projects-extension.aspx

There is also (the better way) going with WiX installer (https://wix.codeplex.com), there is even a service template: https://visualstudiogallery.msdn.microsoft.com/7f35c8ce-1763-4340-b720-ab2d359009c5

In this post, however, I will use the new VS setup project extension.

Continue reading