TDD
http://codebetter.com/blogs/jeremy.miller/archive/2008/12/10/design-and-testability.aspx
Posted by elberon5 Wed, 10 Dec 2008 14:52:00 GMT
Posted by elberon5 Wed, 10 Dec 2008 14:52:00 GMT
http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx
Posted by elberon5 Fri, 19 Sep 2008 16:01:00 GMT
Posted by elberon5 Wed, 10 Sep 2008 19:03:00 GMT
Posted by elberon5 Wed, 10 Sep 2008 19:02:31 GMT
I was just sending a bunch of links to a friend about what i've been trying to get into with asp.net. These relate to getting myself out of the UI model of programming asp.net where i create web forms with tons of code in them to handle everything.
I'm trying to move from the above method to one that implements efficient OOP using LINQtoSQL, MVP (Model-View-Presenter), Domain Driven Design, and Test Driven Design. It has been a hard jump and i'll probably be struggling with it for some time.
Here are the links.
MVP Stuff
Posted by elberon5 Wed, 20 Aug 2008 18:34:00 GMT
You'll need this - using_the_corpscon_dll.pdf
You'll need to create a new class that incorporates all of this. Drop the corpscon.dll file into your bin folder.
In your class in order to link in the corpscon6.dll file you use System.Runtime.InteropServices and [DllImport] to do this. The dll is written in C so you'll have a tough time sorting out what datatypes to pass for your wrapper. The toughest will be the char* types. I used a System.Text.StringBuilder for it. I only needed this to grab the error message. You'll want to wrap everything specified in the algorithm function that the PDF tells you to use. Like i did in convertNJPoint.
Feel free to reuse this code. No guarantees that it'll even do anything. Any suggestions are definitely welcome. I know DllImport is dangerous with how it handles memory and i'm probably letting the GC do too much for me.
Here's how i call it in my project
GIS.CorpsCon cc = new GIS.CorpsCon(); double[] dblarr = cc.convertNJPoint(Double.Parse(txtN.Text), Double.Parse(txtE.Text)); txtLat.Text = dblarr[0].ToString(); txtLon.Text = '-' + dblarr[1].ToString();
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections.Generic;
namespace GIS
{
public class CorpsCon
{
public int InUnits
{
get { return GetInUnits(); }
set { SetInUnits(value); }
}
public CorpsCon()
{
}
public static string getErrorMessage(int error_code)
{
StringBuilder msg = new StringBuilder();
msg.Length = 2000; //This is not right. Will error if returned values is more than 2000 characters.
GetErrorMessage(error_code, msg);
corpscon_clean_up();
return msg.ToString();
}
public double[] convertNJPoint(double Northing, double Easting)
{
double[] dblResults = new double[3];
corpscon_default_config();
SetNadconPath("c:\\program files\\Corpscon6x\\Nadcon\\".ToCharArray());
SetVertconPath("c:\\program files\\Corpscon6x\\vertcon\\".ToCharArray());
SetGeoidPath("c:\\program files\\Corpscon6x\\Geoid\\".ToCharArray());
SetInSystem(2);
SetInDatum(1983);
SetInUnits(1);
SetInZone(2900);
SetOutSystem(1);
SetOutDatum(1983);
SetOutUnits(3);
SetOutZone(18);
corpscon_initialize_convert();
SetXIn(Easting);
SetYIn(Northing);
int result = corpscon_convert();
dblResults[0] = GetYOut();
dblResults[1] = GetXOut();
dblResults[2] = result;
corpscon_clean_up();
return dblResults;
}
[DllImport("corpscon_v6.dll")]
static extern int corpscon_default_config();
[DllImport("corpscon_v6.dll")]
static extern int SetInSystem(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutSystem(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetInDatum(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutDatum(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetInUnits(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutUnits(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetInZone(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutZone(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetInVDatum(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutVDatum(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetInVUnits(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutVUnits(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetOutUSNGDigits(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetNadconPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int SetInHPGNArea(char[] area);
[DllImport("corpscon_v6.dll")]
static extern int SetOutHPGNArea(char[] area);
[DllImport("corpscon_v6.dll")]
static extern int SetVertconPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int SetUseVertconCustomAreas(int opt);
[DllImport("corpscon_v6.dll")]
static extern int SetVertconCustomAreaListFile(char[] file);
[DllImport("corpscon_v6.dll")]
static extern int SetGeoidPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int SetGeoidCodeBase(int val);
[DllImport("corpscon_v6.dll")]
static extern int SetUseGeoidCustomAreas(int opt);
[DllImport("corpscon_v6.dll")]
static extern int SetGeoidCustomAreaListFile(char[] file);
[DllImport("corpscon_v6.dll")]
static extern int corpscon_initialize_convert();
[DllImport("corpscon_v6.dll")]
static extern int SetXIn(double val);
[DllImport("corpscon_v6.dll")]
static extern int SetYIn(double val);
[DllImport("corpscon_v6.dll")]
static extern int SetZIn(double val);
[DllImport("corpscon_v6.dll")]
static extern int SetUSNGIn(char[] val);
[DllImport("corpscon_v6.dll")]
static extern int corpscon_convert();
[DllImport("corpscon_v6.dll", CharSet = CharSet.Ansi, SetLastError = true)]
static extern int GetErrorMessage(int err_code, StringBuilder msg);
[DllImport("corpscon_v6.dll")]
static extern double GetXOut();
[DllImport("corpscon_v6.dll")]
static extern double GetYOut();
[DllImport("corpscon_v6.dll")]
static extern double GetZOut();
[DllImport("corpscon_v6.dll")]
static extern int GetUSNGOut(char[] val);
[DllImport("corpscon_v6.dll")]
static extern int GetCorpsconValue(int code, double[] val);
[DllImport("corpscon_v6.dll")]
static extern int corpscon_clean_up();
[DllImport("corpscon_v6.dll")]
static extern int GetInSystem();
[DllImport("corpscon_v6.dll")]
static extern int GetOutSystem();
[DllImport("corpscon_v6.dll")]
static extern int GetInDatum();
[DllImport("corpscon_v6.dll")]
static extern int GetOutDatum();
[DllImport("corpscon_v6.dll")]
static extern int GetInUnits();
[DllImport("corpscon_v6.dll")]
static extern int GetOutUnits();
[DllImport("corpscon_v6.dll")]
static extern int GetInZone();
[DllImport("corpscon_v6.dll")]
static extern int GetOutZone();
[DllImport("corpscon_v6.dll")]
static extern int GetInVDatum();
[DllImport("corpscon_v6.dll")]
static extern int GetInVUnits();
[DllImport("corpscon_v6.dll")]
static extern int GetOutVUnits();
[DllImport("corpscon_v6.dll")]
static extern int GetOutUSNGDigits();
[DllImport("corpscon_v6.dll")]
static extern int GetNadconPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int GetInHPGNArea(char[] area);
[DllImport("corpscon_v6.dll")]
static extern int GetOutHPGNArea(char[] area);
[DllImport("corpscon_v6.dll")]
static extern int GetVertconPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int GetVertconCustomAreaListFile(char[] filename);
[DllImport("corpscon_v6.dll")]
static extern int GetUseVertconCustomAreas();
[DllImport("corpscon_v6.dll")]
static extern int GetGeoidCodeBase();
[DllImport("corpscon_v6.dll")]
static extern int GetGeoidPath(char[] path);
[DllImport("corpscon_v6.dll")]
static extern int GetGeoidCustomAreaListFile(char[] filename);
[DllImport("corpscon_v6.dll")]
static extern int GetUseGeoidCustomAreas();
}
}
Posted by elberon5 Wed, 30 Jan 2008 19:21:00 GMT
You can also do Ctrl+Shift+H for a global replace.
Whatever you do don't build your project while this is searching. It wont ever stop searching, and it will never find anything. Hit the 'Stop background find' button in the 'Find Results' dialog to cancel a long running search.
Posted by elberon5 Thu, 20 Dec 2007 22:01:00 GMT
Posted by elberon5 Tue, 23 Oct 2007 23:35:00 GMT