The “with” keyword is a crucial part of a functional programmer’s toolbox, but is sadly lacking in C#. In this blog post, I document the development of a template that will automatically generate a With() method for C# classes.
Dot Net What Not Posts
I recently switched to Windows 10, and have found that one really annoying habit it has is that it will randomly switch focus without warning. I can be typing an email, scrolling down through the errors in the event viewer to see what vital parts of Windows crashed today and so on, and suddenly I find that my words are not entered into the email, the events aren’t scrolling, etc.
A quick bit of searching revealed that a lot of people have had the same problem, and very few have managed to solve it. The main problem is finding out what gets the focus.
This post explains how I found out.
Whilst I’m getting increasingly frustrated with Windows 10, the number of errors that seem to crop up, and the number of basic features that seem to stop working for no good reason, it has produced more than its fair share of amusements.
Today’s suggests that Microsoft have an amazing level of confidence in the staying power of Windows 10.
I was just looking in the Event Viewer, and saw the following… You can’t make this stuff up you know!
I just lurve clients sometimes!
Our main client has the (probably not uncommon) habit of labelling every ticket as urgent. The problem with this is that when something really urgent comes along, they have no way of making it stand out above the other urgent jobs. This predictably led to the creation of a “Very urgent” rating.
Today they outdid themselves…
This led to a lively debate as to what would come next. How about “-1. Life threatening”?
Faced with the task of modifying every varchar(n) column of every table in a database to be varchar(max), whilst avoiding default constraint errors, I came up with a script to generate the SQL for me.
How to generate classes to represent discriminated unions in C#
Following on from my experiments in timing the algorithms in part 9 of this series, I was curious as to why my code for Wilson’s algorithm took so much longer than the code for the Aldous-Broder algorithm. Jamis Buck (the author of the book this is all based on) was foolish enough to leave his email address on his blog, inviting people like me to ask him questions! I asked if he had seen anything like this difference. Turns out he hadn’t actually tried timing them, so couldn’t comment. This got me curious, so I pulled up his code, and started searching around to find out how to time code in Ruby. This turned out to be fairly simple (as it should), giving me the following… This gave me 10 numbers, which enabled me to calculate an average, as well as check on the variation (standard deviation for the statistical…
One of the idea he had for modifying the Aldous-Broder algorithm was to force it to pick an unvisited neighbour, if one exists. I think the idea was to cut down on the number of very short dead ends that the basic algorithm produces. If you look at the following sample, you can see that there are a lot of places in the maze where there are many short walls, making it pretty obvious which way to go… The plain algorithm picks a random cell from the current cell’s neighbours… It was pretty easy to change this so that it would always pick an unvisited cell if there were any… With a little thought, I could probably change the Where clause to include both cases, but it didn’t seem worth it at the time. Anyway, this simple change produced a marked difference in the quality of the mazes. Apart from…
Having coded up two more complex algorithms, I analysed them to see how they compared, and then combined the two in an attempt (failed) to produce a hybrid algorithm that was faster than either of its parents.
Leave a Comment