In this article we will discuss several topics that will allow you to have a ready solution to manage our data with Entity Framework.

First, we will recall the principles of the Entity Framework, the Repository pattern and discuss that of the Unit Of Work.

The next part will be dedicated to its implementation.

There are a lot of options out in the wild to add authentication to your application. While OAuth is among the most common, it isn’t your only option. Today I’ll show you how to accomplish Windows Authentication with React and .NET Core in a bare bones fashion.

Sometimes it's fun to put the big projects aside for a while and make something small. That's not to say it can't be challenging - it's most of the time during these small endeavours that I find myself learning something new that I may have been putting off for a while. This is the joy of not having the distraction of scores of components, state, props and more.

ASP.NET Core is designed from scratch to support Dependency Injection. ASP.NET Core injects objects of dependency classes through constructor or method by using built-in IoC container.

Do you have an existing hifi system that’s too old to support Apple Airplay? Don’t want to replace it with lower-quality wireless speakers, but want to stream music? It’s a common problem. The good news is, for the cost of a Raspberry Pi you can build an Airplay server so you can stream music directly from an iPhone or iPad to your hifi system.

This guide shows you how to set up Shairport-sync so you’ll have a Raspberry Pi playing music in 7 easy steps.

If you just need to get a few items from the JSON object, I would use Json.NET's LINQ to JSON JObject class.

=== For example:

JToken token = JObject.Parse(stringFullOfJson);

int page = (int)token.SelectToken("page");
int totalPages = (int)token.SelectToken("total_pages");

I like this ap...

I am writing a piece of code for C# Web Api, letting the clients to pass a column name and sort direction as parameter. Although there are, like, 30-ish properties, so the following code (despite it works) gets ugly after a while.

What are my options to avoid repeating this seemingly same pieces of code?

Using reflection, is it possible to discover all types that derive from a given type?

Presumably the scope would be limited to within a single assembly.

I have a web application that allows anonymous access and windows authentication.

Basically, the app try to auto-login users by windows authentication if the windows user is in a user list in the application, otherwise it shows the login screen. If no credential is provided, the app then shows a login screen where the user could login using a application internal user.

Given the string "ThisStringHasNoSpacesButItDoesHaveCapitals" what is the best way to add spaces before the capital letters. So the end string would be "This String Has No Spaces But It Does Have Capitals"

Here is my attempt with a RegEx:

System.Text.RegularExpressions.Regex.Replace(value, "[A-Z]", " $0")

I have an angular 2+ project and when I run it from localhost:4200/route-a, it works fine and when I refresh the browser, all works well as expected. However, when I build it with ng build and run it from a web server, navigating to localhost/route-a returns a 404. Here is my code for routing:

 imports: [BrowserModule, HttpModule, FormsModule, RouterModule.forRoot([
    { path: 'home', component: HomeComponent },
    { path: 'route-a', component: RouteAComponent },
    { path: '', redirectTo: '/home', pathMatch: 'full' }

I have a List of objects, which are of my type QuoteHeader and I want to pass this list as a list of objects to a method which is able to accept a List<object>.

My line of code reads...


But I get the following error at design time...

Cannot convert type 'System.Collections.Generic.List<MyNameSpace.QuoteHeader>' 
to 'System.Collections.Generic.List<object>'

Do I need to do anything to my class to allow this? I thought that all classes inherit from object so I can't understand why this wouldn't work?

Few examples for AWK text processor.

We would like to stream multiple analogue microphone inputs through Raspberry Pi.

We have a following configuration:

  • Raspberry Pi 3B/4
  • 2 identical USB audio cards

As the Linux kernel might order the USB cards randomly during bootup, we cannot really rely on the arecord -l output. The ls -la /proc/asound/cards does not help to distinguish by device ID either.

How to identify USB sound cards to avoid this situation?


In this article, we are going to understand how to connect .NET Core Application with MySQL/MariaDB and read data from MySQL (placed in Docker container), using .NET Core MySQL connector.

How to set up VLC to play media content / stream to a different output other than the default?

We would like to stream multiple analogue microphone inputs through Raspberry Pi.

We have a following configuration:

  • Raspberry Pi 3B/4
  • 2 or more identical USB audio cards

How to create script to start HTTP streaming audio inputs when available?

Debian Linux is known for being stable and unchanging. For most, this philosophy is pretty great. Everything works well, and nothing breaks down. However, this stability comes at a cost. Often, users are stuck on an old, outdated Linux kernel.

How do I create or write to images to disk on Apple Mac OS X (macOS) Unix operating system with dd command?

You could call the TryParse method dynamically using Reflection. This way you won't get a time consuming Exception if the conversion fails.

There are some specific scenarios specially when you manipulate the DOM with ng-repeat directive. Lets imagine we have a code that prints a list of element using an ng-repeat. In your controller you have a code to instantiate a bootstrap tooltip for all the elements that are going to be rendered when the ng-repeat is compiled by AngularJs. As a best practice it is better to place this type of code in a directive, for this example purpose, we are going to keep it simple and leave it in the controller.

Yet one other thing I love about OSX is that .iso is a first-class citizen. I’m able to mount/burn iso files without installing any other software (yes, I’m looking at you Windows).

After updating to Angular 6, I get the following error on ng serve:

Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName".
Error: Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName".
    at Object.resolve (/home/Projects/myProjectName/node_modules/@angular-devkit/core/node/resolve.js:141:11)
    at Observable.rxjs_1.Observable [as _subscribe] (/home/Projects/myProjectName/node_modules/@angular-devkit/architect/src/architect.js:132:40)

ng update says everything is in order. Deleting node_modules folder and a fresh npm install install did not help either.

I want to do this command in one line:

git pull && [my passphrase]

How to do it?

Debian Linux is known for being stable and unchanging. For most, this philosophy is pretty great. Everything works well, and nothing breaks down. However, this stability comes at a cost. Often, users are stuck on an old, outdated Linux kernel.

The Raspberry Pi is a fantastic little computer for recording video. For about €50,- you can record in HD with full customizability and for as long as you want or have storage for. However, one issue is that the .h264 container it records in is hard to work with. It is therefore often important to convert videos to widely applicable formats like .mp4 to be able to view them properly and get the right meta information. For this I recommend the program FFmpeg.

Installing ffmpeg on a Raspberry Pi is not as simple as downloading an executable from the command line, but it is also not too difficult.

Is there a nice function to to turn something like


to this:

First Name?

After my page is done loading. I want jQuery to nicely scroll to the bottom of the page, animating quickly, not a snap/jolt.

Is there a way to grab a video thumbnail in FFmpeg?

I'd like to grab the middle-most frame as the video and use that as the thumbnail. Video duration is unknown.

If I set TreeViewItem Background it highlights the header only. How can I highlight the whole line?

Nor JavaScript nor TypeScript has no equivalent for the language-integrated-natural-query aspect of LINQ. (hey, isn't that literally the whole acronym?)

A watchdog timer is a special kind of timer commonly found on embedded systems that is used to detect when the running software is hung up on some task. The watchdog timer is basically a countdown timer that counts from some initial value down to zero. When zero is reached, the watchdog timer understands that the system is hung up and resets it. Therefore, the running software must periodically update the watchdog timer with a new value to stop it from reaching zero and causing a reset. When the running software is locked up doing a certain task and cannot update the watchdog timer, the timer will inevitably reach zero and a reset will occur.

Luckily for us, the Broadcom BCM2835 SoC on the Raspberry Pi comes with a hardware-based watchdog timer that can do just that. You will find this specially useful if you have a Raspberry Pi in a remote location and the operating system hangs and there's no one around to reboot it.

Some of my docker containers use NFS mounts that are configured in /etc/fstab. During a reboot, I’ve seen my containers failing to start when docker engine is started before all the mount points are mounted. There is a relatively simple but not too obvious solution to this which involves tweaking systemd rules such as Requires and After.

I'm using logback in my current project.

It offers six levels of logging: TRACE DEBUG INFO WARN ERROR OFF

I'm looking for a rule of thumb to determine the log level for common activities. For instance, if a thread is locked, should the log message be set to the debug level or the info level. Or if a socket is being used, should its specific id be logged at the debug level or the trace level.

I will appreciate answers with more examples for each logging level.

I come from WPF and I don't know if it's possible to make a ListView to distribute items horizontally, with all the extras like mouse-wheel scrolling (mouse devices) and swiping (touch devices).

I've tried this, but it doesn't behave like the vertical one. Example: I cannot scroll with the mouse-wheel.

<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled" 
 ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemsSource="{Binding Collection}" >
            <StackPanel Orientation="Horizontal"></StackPanel>

A fellow emailed me earlier asking how to get the namespaces from an XML document, but he was having trouble because the XML had some XML declarations like <?foo?>.

I want to bind the background color of a button to an enum. I wonder if there is an enum object that can hold multiple values, for example the state and the color. I want to avoid two enums that could be out of sync. Here are two enums that I would like to integrate with each other.

enum StateValue { Player, Wall, Box }
enum StateColor { Colors.Red, Colors.Grey, Colors.Brown }

Then I need to create a binding for the XAML button.

<Button Content="Player" Background="{Binding Source=...?}" />

Maybe, a dictionary like the following is helpful. But still I do not know how the binding needs to be written.

public Dictionary<StateValue, Color> stateValueColor = 
new Dictionary<ElementState, Color>()
 { StateValue.Player, Colors.Red },
 { StateValue.Wall, Colors.Grey },
 { StateValue.Box, Colors.Brown }

I have a div box (called flux) with a variable amount of content inside. This divbox has overflow set to auto.

Now, what I am trying to do, is, when the use scroll to the bottom of this DIV-box, load more content into the page, I know how to do this (load the content) but I don't know how to detect when the user has scrolled to the bottom of the div tag? If I wanted to do it for the entire page, I'd take .scrollTop and subtract that from .height.

But I can't seem to do that here?

I've tried taking .scrollTop from flux, and then wrapping all the content inside a div called inner, but if I take the innerHeight of flux it returns 564px (the div is set to 500 as height) and the height of 'innner' it returns 1064, and the scrolltop, when at the bottom of the div says 564.

What can I do?