Click here to Skip to main content
15,881,852 members

Articles by George Swan (Articles: 22, Tip/Tricks: 22)

Articles: 22, Tip/Tricks: 22

RSS Feed

Average article rating: 4.88

Artificial Intelligence
27 Jan 2019   Updated: 27 Jan 2019   Rating: 4.00/5    Votes: 8   Popularity: 3.61
Licence: CPOL    Views: 17,870     Bookmarked: 13   Downloaded: 536
Please Sign up or sign in to vote.
A simple invincible implementation of Tic Tac Toe
Machine Learning
13 Apr 2019   Updated: 13 Apr 2019   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 26,036     Bookmarked: 6   Downloaded: 521
Please Sign up or sign in to vote.
An example of how the temporal difference algorithm can be used to teach a machine to become invincible at Tic Tac Toe in under a minute
Database Development
MongoDB
25 Jan 2018   Updated: 25 Jan 2018   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 21,790     Bookmarked: 6   Downloaded: 0
Please Sign up or sign in to vote.
How to use encryption and authentication to secure MongoDB
NoSQL
9 Jan 2013   Updated: 16 Sep 2018   Rating: 4.92/5    Votes: 43   Popularity: 8.03
Licence: CPOL    Views: 198,940     Bookmarked: 101   Downloaded: 3,430
Please Sign up or sign in to vote.
Highlights the latest developments in both the Mongo open-source document database and the open-source official C# driver.
Desktop Programming
WPF
18 Feb 2011   Updated: 18 Feb 2011   Rating: 4.83/5    Votes: 5   Popularity: 3.38
Licence: CPOL    Views: 37,264     Bookmarked: 27   Downloaded: 1,513
Please Sign up or sign in to vote.
This article explorers how to use WPF’s document viewing and printing classes to inspect, scale, and output mail merge letters produced from a XAML based template.
General Programming
Algorithms
6 Sep 2016   Updated: 6 Sep 2016   Rating: 5.00/5    Votes: 17   Popularity: 6.15
Licence: CPOL    Views: 29,121     Bookmarked: 16   Downloaded: 1,272
Please Sign up or sign in to vote.
An artificial life algorithm that attempts to solve a problem by flying a swarm of entities through a range of possible solutions where each entity is guided by the performance of other members of the swarm
Internet of Things
Raspberry-Pi
4 Feb 2017   Updated: 6 Feb 2017   Rating: 4.95/5    Votes: 4   Popularity: 2.98
Licence: CPOL    Views: 36,443     Bookmarked: 29   Downloaded: 348
Please Sign up or sign in to vote.
How to set up a two-way interface between a remote browser-enabled device and a Raspberry Pi
Programming Languages
C#
6 May 2020   Updated: 6 May 2020   Rating: 5.00/5    Votes: 19   Popularity: 6.39
Licence: CPOL    Views: 30,944     Bookmarked: 38   Downloaded: 714
Please Sign up or sign in to vote.
An attempt to throw some light on how state machines work and what they can be used for
25 Apr 2018   Updated: 5 May 2018   Rating: 4.95/5    Votes: 8   Popularity: 4.47
Licence: CPOL    Views: 16,929     Bookmarked: 8   Downloaded: 392
Please Sign up or sign in to vote.
This article illustrates how to solve the Dining Philosophers' Problem using the Task Based Asynchronous Pattern
11 Sep 2020   Updated: 11 Sep 2020   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 7,094     Bookmarked: 10   Downloaded: 125
Please Sign up or sign in to vote.
How to take advantage of the multi-cored architecture of modern processors by using Dataflow blocks
30 Sep 2019   Updated: 2 Oct 2019   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 8,052     Bookmarked: 4   Downloaded: 78
Please Sign up or sign in to vote.
This piece illustrates how to construct a simple generic mapper that will copy every property value from one class to another where the name and type of the property is the same in both classes; it goes on to suggest a way of constructing generic tests that can be used for any instance of the
29 May 2014   Updated: 2 Jun 2014   Rating: 4.71/5    Votes: 7   Popularity: 3.98
Licence: CPOL    Views: 32,375     Bookmarked: 26   Downloaded: 265
Please Sign up or sign in to vote.
An alternative to Observer Pattern (C#).
6 Jan 2016   Updated: 6 Jan 2016   Rating: 4.87/5    Votes: 15   Popularity: 5.73
Licence: CPOL    Views: 45,227     Bookmarked: 16   Downloaded: 979
Please Sign up or sign in to vote.
An introduction to Graph Databases
20 May 2016   Updated: 25 Sep 2016   Rating: 4.92/5    Votes: 46   Popularity: 8.09
Licence: CPOL    Views: 41,603     Bookmarked: 106   Downloaded: 676
Please Sign up or sign in to vote.
How to use the async/await keywords in .NET4.5
1 Aug 2017   Updated: 1 Aug 2017   Rating: 4.81/5    Votes: 11   Popularity: 5.01
Licence: CPOL    Views: 24,785     Bookmarked: 11   Downloaded: 639
Please Sign up or sign in to vote.
A way of adapting a particle swarm optimizer to solve the travelling salesman problem
4 Jun 2018   Updated: 4 Jun 2018   Rating: 4.64/5    Votes: 11   Popularity: 4.64
Licence: CPOL    Views: 13,424     Bookmarked: 20   Downloaded: 130
Please Sign up or sign in to vote.
This piece shows that, by returning a Task from an Event Handler instead of the usual void, the management of the event can be more structured and versatile.
10 Dec 2021   Updated: 10 Dec 2021   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 7,410     Bookmarked: 7   Downloaded: 114
Please Sign up or sign in to vote.
How asynchronous streams can improve efficiency and reduce response times in applications
7 Jan 2024   Updated: 7 Jan 2024   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 3,212     Bookmarked: 1   Downloaded: 16
Please Sign up or sign in to vote.
An explanation of the code execution pathways in an application that employs a TaskCreationSource to correlate activity between its threads
SQL
3 Jan 2023   Updated: 3 Jan 2023   Rating: 4.90/5    Votes: 7   Popularity: 4.14
Licence: CPOL    Views: 16,953     Bookmarked: 13   Downloaded: 95
Please Sign up or sign in to vote.
An introduction to employing Dapper in an ASP.NET 7 application
Web Development
ASP.NET
28 Apr 2021   Updated: 28 Apr 2021   Rating: 5.00/5    Votes: 9   Popularity: 4.77
Licence: CPOL    Views: 17,567     Bookmarked: 32   Downloaded: 254
Please Sign up or sign in to vote.
How to allow private network (LAN) clients to connect to the https port of a locally hosted ASP.NET web application
Blazor
4 Jul 2023   Updated: 7 Aug 2023   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 10,521     Bookmarked: 10   Downloaded: 105
Please Sign up or sign in to vote.
How to use Fluxor to progress applications along clearly defined pathways
HTML
29 Sep 2014   Updated: 29 Sep 2014   Rating: 4.89/5    Votes: 7   Popularity: 4.13
Licence: CPOL    Views: 40,621     Bookmarked: 19   Downloaded: 1,026
Please Sign up or sign in to vote.
This article discusses how to use the Ninject and Prism frameworks to produce a loosely-coupled modular WPF Application.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.64

Desktop Programming
Windows Forms
28 Jun 2011   Updated: 28 Jun 2011   Rating: 4.17/5    Votes: 3   Popularity: 1.99
Licence: CPOL    Views: 14,921     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Couldn't the class RegEdit be replaced by one simple method?private void SetKey(bool enableTaskManager) { using ( var mKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System")) {...
DevOps
Unit Testing
3 Jan 2016   Updated: 3 Jan 2016   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 22,355     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
How to replace the System.Timer with a mock object when testing
General Programming
Algorithms
7 Feb 2023   Updated: 7 Feb 2023   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,100     Bookmarked: 4   Downloaded: 32
Please Sign up or sign in to vote.
A .NET7 version of a Rotated Binary Search method
Regular Expressions
18 Oct 2011   Updated: 18 Oct 2011   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: CPOL    Views: 9,111     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
The Regex method uses comma, full stop, hyphen, and apostrophe as word separators. The problem with this is that these characters are not universally used as separators. The hyphen is used to join two words. Could I suggest the following?string input = "Mr O'Brien-Smith arrived at 8.30 and...
String
30 Jun 2011   Updated: 30 Jun 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 7,601     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
You can use the Aggregate method with a StringBuilder. I've modified Eric's alternative in order to save a bit of code. Only one return statement is needed as an empty StringBuilder returns an empty string.public static string Join(this IEnumerable parts, string separator) { ...
3 Feb 2013   Updated: 3 Feb 2013   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 14,541     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Dictionary.BestMatch"
Operating Systems
Windows
19 Nov 2011   Updated: 19 Nov 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 7,761     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
I prefer alternative 3 but this option may save time if multiple files are to be deleted.Disk Cleanup will remove all files stored in a folder named Windows.old in the drive's root if the option Remove Previous Versions of Windows is selected.Create a directory named Windows.old in the...
Programming Languages
C#
23 Feb 2016   Updated: 24 Feb 2016   Rating: 4.50/5    Votes: 4   Popularity: 2.71
Licence: CPOL    Views: 11,873     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Get a list of Dates for the Nth Desired Day of Week in a Month for a range of dates"
11 Jan 2012   Updated: 11 Jan 2012   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 7,963     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
How about using the extension method: return s.Count(c => (c == '\n'));
22 Oct 2011   Updated: 22 Oct 2011   Rating: 4.38/5    Votes: 5   Popularity: 3.06
Licence: CPOL    Views: 14,371     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Isn't it possible to remove the from and select statements by using a lambda expression?var bestStudents=students.Where(s=>s.Grade>9);
19 Jun 2017   Updated: 19 Jun 2017   Rating: 4.60/5    Votes: 4   Popularity: 2.77
Licence: CPOL    Views: 8,601     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
An introduction to the Reservoir Sampling of Data Streams.
6 May 2020   Updated: 6 May 2020   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 5,653     Bookmarked: 1   Downloaded: 55
Please Sign up or sign in to vote.
An alternative solution to the Spiral Print problem
30 Mar 2013   Updated: 31 Mar 2013   Rating: 4.94/5    Votes: 3   Popularity: 2.36
Licence: CPOL    Views: 27,334     Bookmarked: 10   Downloaded: 0
Please Sign up or sign in to vote.
An easy way to read CSV files.
13 Feb 2011   Updated: 13 Feb 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 8,191     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
You can use Linq to do the same thing double[] mydouble = str.Split('#').Select(x => double.Parse(x)).ToArray();
12 Sep 2011   Updated: 12 Sep 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 9,080     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
The following method starts by selecting the number 2 and eliminates each multiple of 2 up to N. Then the next valid number is selected and each multiple of it is eliminated. The process is repeated until all valid numbers have been tested. So the first three multiples to be eliminated are...
4 Oct 2011   Updated: 4 Oct 2011   Rating: 4.71/5    Votes: 4   Popularity: 2.84
Licence: CPOL    Views: 11,951     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Recursion is a neat way of calculating a number's factorial but there is a danger of the stack overflowing when the number is large. The following is a simplified version of the original. It obviates the need for the if else statements within the where loop.int Factorial(int input){ int...
15 Jun 2011   Updated: 15 Jun 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 9,140     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
As it stands, the TryParse method will fail if the string contains commas. E.g., 10,000. To get around this, you can use:bool isnumber=int.TryParse(text,System.Globalization.NumberStyles.Integer | System.Globalization.NumberStyles.AllowThousands, ...
3 Nov 2011   Updated: 3 Nov 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 11,851     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Can't this be done with a simple for loop followed by a single if statement?for(int i=0;i<characters.Length-1;i+=2){ output.Append(characters[i+1]); output.Append(characters[i]);}if (characters.Length % 2 == 1) output.Append(characters[characters.Length - 1]);
16 Jun 2021   Updated: 16 Jun 2021   Rating: 4.00/5    Votes: 2   Popularity: 1.20
Licence: CPOL    Views: 12,073     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
How to add a Spinner to a long-running library method
C# 3.5
15 Oct 2011   Updated: 15 Oct 2011   Rating: 4.00/5    Votes: 5   Popularity: 2.80
Licence: CPOL    Views: 10,980     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
The tcpEndPoints array has duplicates and members outside the required range. It may be better to restrict the array members to the required range, sort them, and remove the duplicates. The first free port can then be found by finding the first non-sequential value.using...
XML
24 Aug 2011   Updated: 24 Aug 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 13,722     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Can't you do the same thing without the need for a select statement?XElement xElement = XElement.Load(path);xElement.Elements ("Node").Remove();xElement.Save(path);
Web Development
ASP.NET
11 Nov 2011   Updated: 11 Nov 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 7,641     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Is it easier to start from the next targeted day? Subtract that date from the end date. If the result is negative, return 0 otherwise return the quotient of the difference in days between the two dates divided by 7 plus 1.public static int findWeekCount(DateTime startDate, DateTime toDate,...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Student
Wales Wales
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.