
Recent Posts

Recent Comments
Archives
 March 2017
 February 2017
 January 2017
 December 2016
 November 2016
 October 2016
 September 2016
 August 2016
 July 2016
 June 2016
 May 2016
 April 2016
 March 2016
 February 2016
 January 2016
 December 2015
 November 2015
 October 2015
 September 2015
 August 2015
 July 2015
 June 2015
 May 2015
 April 2015
 March 2015
 February 2015
 January 2015
 December 2014
 November 2014
 October 2014
 September 2014
 August 2014
 July 2014
 June 2014
 May 2014
 March 2014
 February 2014
 January 2014
 December 2013
 November 2013
 October 2013
 September 2013
 August 2013
 July 2013
 June 2013
 May 2013
 April 2013
 March 2013
 February 2013
 January 2013
 December 2012
 November 2012
 October 2012
 September 2012
 August 2012
 July 2012
 June 2012
 May 2012
 April 2012
 January 2012
 December 2011
 November 2011
 May 2011
 April 2011
 February 2011
 December 2010
Categories
 .NET
 ADO.NET
 algorithms
 animation
 API
 arrays
 attributes
 audio
 books
 calculations
 challenges
 classes
 clipboard
 coding
 combinatorics
 console
 controls
 cryptography
 curve fitting
 database
 debugging
 dialogs
 directories
 Drag and Drop
 drawing
 drawings
 enums
 Event
 events
 Excel
 extension methods
 extensions
 files
 finance
 fonts
 formatting
 forms
 fractals
 ftp
 games
 GDI+
 generic
 geometry
 globalization
 graphics
 html
 IDE
 image processing
 inheritance
 interfaces
 internationalization
 internet
 interoperability
 LINQ
 lists
 localization
 mathematics
 memory
 menus
 MessageBox
 methods
 miscellany
 multimedia
 network
 Office
 OOP
 operators
 parsing
 performance
 phone
 PowerPoint
 printers
 printing
 productivity
 programs
 puzzles
 recursion
 reflection
 registry
 regular expressions
 serialization
 settings
 SQL
 stories
 strings
 syntax
 system
 threading
 tips
 tools
 transformations
 Uncategorized
 user interface
 variables
 VBA
 web
 Windows Forms programming
 WMI
 Word
 wpf
 XAML
 XML
Meta
Tag Archives: algorithms
Solution: The 40 pound stone puzzle
This is the solution to The 40 pound stone puzzle. If you haven’t read the puzzle yet, click here before you read the solution. This puzzle similar to some of the puzzles in my book Interview Puzzles Dissected. The … Continue reading
Posted in algorithms, books, games, puzzles
Tagged 40 pound stone, algorithms, books, farmer, forty pound stone, games, interview puzzles, Interview Puzzles Dissected, puzzles
Leave a comment
Use digits of Pi to draw a picture in C#
The article 10 stunning images show the beauty hidden in pi shows several ways to use Pi to generate pictures. This example demonstrates one of them. The program starts drawing at the origin (0, 0). It then scans through the … Continue reading
Posted in algorithms, drawing, graphics, mathematics, strings
Tagged algorithms, approximation, C#, C# programming, convergence, digits of Pi, drawing, error, example, example program, graphics, image of pi, mathematics, Pi, Pi Day, pi image, strings, Windows Forms programming
Leave a comment
Look for dates in the digits of Pi in C#
The example Find patterns within pi in C# looks for patterns within the digits of Pi. You can use that example to look for dates such as 4/1. This example determines whether the first 100 thousand digits of Pi contains … Continue reading
Posted in algorithms, mathematics, strings
Tagged algorithms, C#, C# programming, dates, dates in pi, digits of Pi, example, example program, mathematics, Pi, Pi Day, strings, Windows Forms programming
Leave a comment
Find patterns within Pi in C#
March 14 is known as Pi Day because its numeric representation 3/14 includes the first three digits of Pi: 3.14. (At least in the United States. In Europe where they usually write dates month first, Pi Day is July 22 … Continue reading
Posted in algorithms, mathematics, strings
Tagged algorithms, approximation, C#, C# programming, convergence, digits of Pi, error, example, example program, mathematics, Pi, Pi Day, strings, Windows Forms programming
1 Comment
Puzzle: The 40 pound stone
This is a variation of a puzzle given on Car Talk. It’s similar to some of the puzzles in my book Interview Puzzles Dissected. A farmer uses a doublepan balance and a 40 pound stone to measure 40 pound weights: … Continue reading
Posted in algorithms, books, games, puzzles
Tagged 40 pound stone, algorithms, books, farmer, forty pound stone, games, interview puzzles, Interview Puzzles Dissected, puzzles
Leave a comment
Use an improved extension method to calculate standard deviation in C#
The example Calculate standard deviation in C# makes an extension method that calculates standard deviation for an IEnumerable of integers. Unfortunately because that example works with integers, it cannot work with other data types. Rian Meier showed me this method, … Continue reading
Make a hangman game in C#
Special thanks to Jeff Scarterfield for the skeleton drawing used by the program. This example builds a simple hangman game that uses the dictionary created by the example Use LINQ to select words of certain lengths from a file in … Continue reading
Posted in algorithms, files, games, graphics, strings
Tagged algorithms, C#, C# programming, example, example program, files, games, graphics, hangman, hangman game, random, strings, Windows Forms programming
Leave a comment
Use LINQ to select words of certain lengths from a file in C#
This example uses LINQ to read a file, remove unwanted characters, select words of a specified length, and save the result in a new file. Recently I needed a big word list so I searched around for public domain dictionaries. … Continue reading
Posted in algorithms, files, LINQ
Tagged algorithms, C#, C# programming, dictionary, example, example program, files, LINQ, select words, Windows Forms programming, word list, WriteAllLines
2 Comments
Draw a golden spiral in C#
This example shows how to draw a golden spiral (or phi spiral) in C#. The example Draw a nested series of golden rectangles in C# draws nested rectangles and connects their corners to make a square “spiral.” This example makes … Continue reading
Posted in algorithms, drawing, graphics, mathematics
Tagged algorithms, C#, C# programming, drawing, example, example program, golden mean, golden ratio, golden rectangles, golden spiral, graphics, mathematics, phi, phi spiral, Windows Forms programming
3 Comments
Draw a nested series of golden rectangles in C#
This program draws golden rectangles, rectangles whose side ratio is equal to φ. For information on φ, see Examine the relationship between the Fibonacci sequence and phi in C#. The program first draws a golden rectangle. It then removes the … Continue reading
Posted in algorithms, drawing, graphics, mathematics
Tagged algorithms, C#, C# programming, drawing, example, example program, golden mean, golden ratio, golden rectangles, graphics, mathematics, phi, Windows Forms programming
2 Comments