A method to call another method n times or until it returns true (success). Used to talk to wireless devices in a noisy environment where each call has a chance of failure. bool Try(uint n, Func<bool> func) { int i = (int)(n == 0 ? 1 : n); do { if (func()) return true; i–; […]
Continue readingTag Archives: c#
Update to SortableBindingList
I’ve been a using this implementation of the SortableBindingList by Tim Van Wassenhove for a few years now but recently I noticed that although making a change to the list updated all bound controls it did not update the backing collection. I switched back to a standard BindingList<T> in an attempt to resolve the issue and […]
Continue readingYourLo.ca/tion updates
Blue Toque Software designed and built the web service YourLo.ca/tion a while back, and it became useful just a few weeks later on a search, assisting a local SAR group in locating a group of missing hikers. Since then SAR groups from around the world have been using the service and offering feedback. We are […]
Continue readingMagnetic Declination in C#
The short story is that I don’t have enough scientific knowledge to know how to calculate magnetic declination, but enough to know that it can be done, using just a position on the surface of the earth and some information about the earth’s magnetic field. This is such an important topic that I was pretty […]
Continue readingCohen-Sutherland Line Clipping in C#
While busy working on TrueNorth, I implemented this based on the the Wikipedia Article. The Extents class, and the PointDType are simple structures to contain the view window, and the double precision coordinates respectively.
Continue readingSerializable base class added to XSDToClasses project
At the prompting (or complaint) of a reader, I’ve shared a base class that I use with my code generator. The generated code is “pure” in that it doesn’t contain any methods that don’t have to do with the data — it doesn’t implement saving and loading methods. I could create a codemodifier for this, […]
Continue readingComparing performance of GDAL and Proj.NET
There are two major free/open source projection libraries available for use under .NET: GDAL and Proj.NET. GDAL has a long history, and is written in C++, so it’s compiled to machine code. The C# bindings are generated by a tool. Calling C++ from C# uses a process called “pinvoke” (Platform Invoke), and a certain amount […]
Continue readingInstalling an MVC Application in a subdirectory of WordPress
For several reasons I have WordPress installed in the root directory of my hosted web space. I’ve been experimenting with the new ASP.NET MVC framework, Entity Framework 4, SQL Server Compact Edition 4 and other new technologies, and I wanted to do a test deployment. I was quite surprised when, after deploying to a subdirectory […]
Continue readingXsdToClasses Open Sourced
XsdToClasses is open source
Continue readingQuadTree
Introduction A QuadTree is a spatial partitioning strategy used to make queries on relationships between 2D spatial data such as coordinates in a Geographic Information System (GIS), or the location of objects in a video game. For instance, you may need to know all the objects within a region on a map, test whether objects are visible by […]
Continue reading