Tag Archives: algorithms

Generate a random password in C#

As I mentioned in a recent post, you should always use a strong password for every login. Remember, a computer can perform millions or billions of operations per second, so your daughter’s birthday or the name of your son’s guinea … Continue reading

Posted in algorithms, cryptography, internet | Tagged , , , , , , , , , | Leave a comment

Find duplicate files in C#, Part 4 of 4

The last three posts described an application that searches for duplicate files and removes them. The program seems to work fairly well, at least for small test directories. When I tried it on a directory containing around 8,000 files, however, … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 3 of 4

The last two posts described an application that searches for duplicate files and removes them. This post explains how the program removes the files when you click the Delete Selected button. When you click the button, the following code executes. … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Find duplicate files in C#, Part 2 of 4

The previous post Find duplicate files in C#, Part 1 of 4 explained how the example uses a LINQ query to select files grouped by hash code. This post explains how the program displays the files’ contents and how the … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 1 of 4

This example lets you find and remove duplicate files. It’s fairly complex, so I’m going to cover it’s more interesting pieces in several posts. I won’t cover some of the less interesting pieces at all. Enter a directory path or … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

Calculate hash codes for a file in C#

Hash codes are codes that concisely represent files or other chunks of data. The basic idea is to combine the data’s bytes in ways so that two different files are likely to have different hash codes. If you save a … Continue reading

Posted in algorithms, cryptography, files | Tagged , , , , , , , , , , , , | 1 Comment

Use LINQ with an embedded lambda expression to find prime numbers in C# (Part 3 of 3)

The example Use more efficient LINQ to find prime numbers in C# (Part 2 of 3) uses a LINQ query to find prime numbers. It creates a delegate variable named IsOddPrime referring to a lambda expression and uses it to … Continue reading

Posted in algorithms, LINQ, mathematics | Tagged , , , , , , , , , , | 4 Comments

Use more efficient LINQ to find prime numbers in C# (Part 2 of 3)

The previous post showed how you can use LINQ to find prime numbers. For every number between 1 and a maximum, the LINQ query called the IsPrime method to see if the number should be part of the selection. That … Continue reading

Posted in algorithms, LINQ, mathematics | Tagged , , , , , , , , , , | 1 Comment

Use LINQ to find prime numbers in C# (Part 1 of 3)

This example uses LINQ to find prime numbers between 1 and a maximum value that you enter. It defines the following IsPrime method to determine whether a number is prime. // Return true if the number is prime. private bool … Continue reading

Posted in algorithms, LINQ, mathematics | Tagged , , , , , , , , , | 1 Comment

Draw text on a circle in C#

This example uses some of the techniques described in the post Measure character positions when drawing long strings in C# to draw text on a circle. The previous post explains how to determine where the characters in a string will … Continue reading

Posted in algorithms, fonts, geometry, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment