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: code
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 readingTrueNorth in beta testing
Sometimes you work on something so hard for so long you actually miss the point where it became, for lack of a better word, “usable”. There’s this idea in software development of the minimum viable product, which in my opinion isn’t the same thing as the minimum useful feature set, but there’s probably some debate. The first […]
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 readingImplementing ArcGis tile layer using BruTile
I recently went to the trouble of figuring out how to use BruTile to access ArcGIS online maps. ArcGIS serves the maps as a tileserver. I came up with the following URL to access the tiles of the world topographic map. http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer Then I used the following code to configure the TileSource TileSource = new ArcGisTileSource(m_url, […]
Continue readingAnnouncing SharpGpx
One of the major features of TrueNorth is data interoperability, and one of the most common file formats for exchanging GPS data is GPX. GPX is supported by many smart phones, GPS devices, and hundreds of software packages. So, one of the earliest features added to TrueNorth was GPX support. GPX is an XML File […]
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 readingOn Horrible Software
I was just reading The State of the Art is Terrible by Zack Morris, which is quite well written. I couldn’t have put it better. In his words It really, truly, is all crap. And it’s much worse than anybody realizes In my words, the entire software world from banking, to games, is held together with rubber […]
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 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