How to select duplicate values in a SQL table

First make a selection of duplicate values using count:
col1, COUNT(col1) AS CountOf
FROM test

Then join this selection with the table on table keys:

select [key],a.col1 from
test a
inner join (SELECT
col1, COUNT(col1) AS CountOf
FROM test
HAVING COUNT(col1)>1) b on a.col1 = b.col1

Samsung account problemen na wijzigen wachtwoord

Foutmelding ‘VERWERKEN MISLUKT’ op mijn Samsung telefoon:

Omdat ik meerdere malen contact met Samsung support moest zoeken en uiteindelijk naar een servicepunt voor herstel werd gestuurd TERWIJL DIT NIET NODIG IS, schrijf ik dit artikel zodat hiermee hopelijk andere mensen geholpen zijn.


Vanaf het begin: Het hele verhaal begon bij het wijzigen van het wachtwoord van mijn Samsung account welke ik gebruik op mijn telefoon.

Mijn Samsung telefoon gaf bij het invoeren van het gewijzigde wachtwoord alleen de melding ‘VERWERKEN MISLUKT’. Dit had ik gegoogeld en hier kwamen allerlei verontrustende resultaten naar voren dat de telefoon naar fabrieksinstellingen gereset zou moeten worden.

Ik vond dit nogal zot dus daarom heb ik maar de support lijn gebeld van Samsung. Eerst een 088 nummer gebeld, daar het probleem uitgelegd. De medewerkster zei meteen dat de telefoon naar fabrieksinstellingen teruggezet gaat moeten worden. Ik nogmaals gezegd dat mijn telefoon verder wel bruikbaar was maar dat alleen geen verbinding met Samsung services mogelijk was vanaf mijn telefoon. Via de browser lukte het mijn wel om in te loggen.

Na nogmaals protest gaf de vriendelijke mevrouw mij het nummer van account services van Samsung. Het nummer van account services gebeld en hier nogmaals uitgelegd wat er scheelde. Ze zouden mij een link via email sturen om mijn wachtwoord te resetten. Dit zou volgens de medewerker kunnen helpen, maar het kon enkele minuten duren voor de mail was aangekomen. In de mail zou ook staan hoe verder te handelen indien de reset van het wachtwoord niet zou helpen.

Na een kwartier wachten had ik nog geen mail ontvangen. Hierna nogmaals gebeld om te vragen om hulp. Terwijl ik nog aan de telefoon was werd de mail wel verstuurd maar mocht het resetten niet helpen. De mevrouw vertelde dat het enige dat nu overbleef als oplossing om bij een servicepunt van Samsung langs te gaan of om zelf een logbestand te laten bouwen door de telefoon en dit op te sturen. Ik vroeg waar een servicepunt was maar toen vertelde ze me dat ik voor deze informatie het 088 nummer weer moest bellen. Bedankt voor de service en zelf nog even aan het zoeken gegaan…

Conclusie: Het netwerk waarmee ik probeerde in te loggen zorgde voor de fout. Ik heb WIFI uitgeschakeld en alle problemen waren opgelost.

Where does Windows save Lock screen images

If you are using Windows 10 you might want to save the lock screen images as a background or just because you like them.

The images can be found in this folder:

Select all and copy these files to a new folder where you want to keep / edit them.

The files in this new folder have to be renamed to .jpg to use them with a image viewer / editor. You can do this by starting a command line window and make the folder you created as the current directory. Then execute “ren *.* *.jpg” from this command line window.

Git merge branche Development into master

Today the standard source control with Visual Studio is GIT. This source control has a lot of powerful features and options.

For me it took some investigation, testing and searching the internet on how to best merge a development branch (or a bugfix branch, etc.) into the main (master) branch.

git checkout master
git merge –squash Development
git commit OR git commit -m “This is a merge from branch to branch at moment x”

What these commands will do is compact all commits to the development branch and add them to the master in one separate commit.

ATTENTION: When you check the source tree you will also notice that there is NO “merge branch” line.

Next I have added an extra branch, commit a change. Last action was to merge the branch using “git merge HotfixOnMaster”:

After merging a complete branch without squashing. Every commit remains in the master history:

Alternative found on
Squash several Git commits into a single commit
This note shows how to merge an ugly feature branch with multiple dirty WIP commits back into the master as one pretty commit.

git checkout master # Switch to the master branch and make sure you are up to date.
 git fetch # this may be necessary (depending on your git config) to receive updates on origin/master
 git pull
 git merge feature_branch # Merge the feature branch into the master branch.
 git reset origin/master # Reset the master branch to origin's state. Git now considers all changes as unstaged changes. We can add these changes as one commit. Adding, will also add untracked files.
 git add --all
 git commit

Note that this is not touching the feature branch at all. If you would merge the feature branch into the master again at a later stage all of its commits would reappear in the log.

Report progress in a task in C sharp

One of my first questions starting programming in Visual Studio WPF was how to run processes without freezing the GUI.

After learning the basic concepts of backgroundworkers and tasks in c sharp programming I wanted to know how to report task progress while the task was not yet finished.

I found all kind of solutions to update a progress bar. I also found solutions to use the result for a specific task.

Think still missing for me was to get a screen to show task progress, with detailed logging while the task was still running. In the end this article helped me finding a solution:

To implement this logic in a solution I started with a form on which I added a button and a listbox.

The button got the following implementation:

private async void ButtonAsyncFileProcessing_Click(object sender, RoutedEventArgs e)
    var progressIndicator = new Progress<MyTaskProgress>(ReportProgress);
    await MyMethodAsync(progressIndicator);

For the progress indicator I added the following class:

public class MyTaskProgress
    //current progress
    public int CurrentProgressAmount { get; set; }
    //total progress
    public int TotalProgressAmount { get; set; }
    //some message to pass to the UI of current progress
    public List<string> CurrentProgressLogging { get; set; }

The async method I used for testing was this:

async Task MyMethodAsync(IProgress<MyTaskProgress> progress)
    int sleepTime = 1000;
    int totalAmount = 10000;
    List<string> log = new List<string>();

    for (int i = 0; i <= totalAmount;)
        await Task.Delay(sleepTime);
        log.Add(string.Format("On {0} Message", i));
        progress.Report(new MyTaskProgress
                CurrentProgressAmount = i, TotalProgressAmount = totalAmount, CurrentProgressLogging = log });
        i = i + sleepTime;

The ReportProgress method used in the button click progressIndicator:

private void ReportProgress(MyTaskProgress progress)
string.Format("{0} out of {1}",

And this last method calls a UpdateScreen method:

private void UpdateScreen(List<string> info, string status)
    foreach (string s in info)
    buttonAsyncFileProcessing.Content = "AsyncFileProcessing" +
    "\n" + status;

The article that helped me understanding Tasks and backgroundworkers is:

Change settings for eventlog in Service installer

I was developing a Windows service. Everything went smooth until I was asked to add logging for the service into a separate log file in the event viewer. I want to share my journey with you so it may help finding a solution for similar or the same issue.

After I had learned to install a service using a service installer, I ran into some troubles configuring the event viewer. My service had three logging options. First is to a text file on disk, second is to the Windows Event Viewer and I added an extra option to send a message to a messaging app. All service issues where logging fine. As a last option I was asked to log to a separate log in the event viewer like this:

First I tried adding all kind of options to my logging library to check, add and change the logging destination. That didn’t work and I found that the log needed to be set during initial installation of the service. Reason that previous attempts failed was that when changing these settings, the application needs admin privileges and changing logging options afterwards needed the machine to be rebooted etc.

I searched the internet for a solution and after a couple o hours I stumbled upon this article:

The post of Simon Mattes in this article helped me out. I altered the code a bit for my own use:

public ProjectInstaller()
//Skip through all ServiceInstallers.
foreach (ServiceInstaller ThisInstaller in Installers.OfType())
//Find the first default EventLogInstaller.
EventLogInstaller ThisLogInstaller = ThisInstaller.Installers.OfType().FirstOrDefault();
if (ThisLogInstaller != null)
//Modify the used log from "Application" to the same name as the source name.
//This creates a source in the "Applications and Services log" which separates your service logs from the default application log.
ThisLogInstaller.Log = "TestApplication"; //ThisLogInstaller.Log = ThisLogInstaller.Source;
ThisLogInstaller.Source = "TestSource";

Check out this post on adding an installer to your application:

Registering / installing a Windows service part 2

In this article I want to describe an easy way to add an easy installer to a Windows Service project.

Steps are: – Add the installer for the service
– Configure the service parameters
– Add parameters to start up of the program

Add the installer for the service can be done when you open the service.cs. This will show a gray screen with two links:

Right click this screen and select Add installer in the pop up menu. This will add a ProjectInstaller.cs file with a ProjectInstaller class inside.

Open the Projectinstaller file. This will show two components.

Change settings for the two components according to your needs.

Last step is to add the installer to the program start up. For this we need to change the Program.cs.

static class Program
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main(string[] args)
        if (args.Length > 0)
            //Install service
            if (args[0].Trim().ToLower() == "/i")
        new string[] { "/i", Assembly.GetExecutingAssembly().Location });

            //Uninstall service                 
            else if (args[0].Trim().ToLower() == "/u")
        new string[] { "/u", Assembly.GetExecutingAssembly().Location });
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            new ServiceMonitor()

Can’t Sync Windows 10 PC Clock to The Internet

While a workgroup computer is connected to the internet, it might not be able to reach the time servers configured. The error: “An error occurred while Windows was synchronizing with The peer is unreachable.” is displayed.An error occurred while Windows was synchronizing with The peer is unreachable.

I’ve found a method to add your local time server to these entries and sync time with a local time server.

Please note: Availability of certain settings can be disabled via distributed Computer policies. These policies are managed by the Computer / Domain administrator.

First you have to start the registry editor with the command regedit.

Navigate to the container: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers”. In this container add a new entry right clicking in the window. Add a new entry with the next number as name.

Double click the entry and add the IP address of the local time server.

Next go to the control panel and navigate to Internet Time Settings via: “Time & Language”, then “Additional date, time, & regional settings” in bottom part “Related settings”. Open “Date and Time” and then select the third tab named “Internet Time” and click the button “Change settings…”.

Select your local time server and press “Update now”.