<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title></title>
	<atom:link href="http://bruceburge.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bruceburge.com</link>
	<description></description>
	<lastBuildDate>Mon, 28 Jan 2013 21:04:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Automatically adding events to a google calendar from a google form submission.</title>
		<link>http://bruceburge.com/2012/09/05/automatically-adding-events-to-a-google-calendar-from-a-google-form-submission/</link>
		<comments>http://bruceburge.com/2012/09/05/automatically-adding-events-to-a-google-calendar-from-a-google-form-submission/#comments</comments>
		<pubDate>Wed, 05 Sep 2012 19:25:10 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[google calendar]]></category>
		<category><![CDATA[google forms]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=484</guid>
		<description><![CDATA[I often find myself using google forms a lot more, and recently the issue came up that we wanted to be able to submit events to a google form, and wanted to be able to add that event to a google calendar automatically. The script below does just that. Some things you will need to [...]]]></description>
				<content:encoded><![CDATA[<p style="Padding:5px";>
I often find myself using google forms a lot more, and recently the issue came up that we wanted to be able to submit events to a google form, and wanted to be able to add that event to a google calendar automatically.  The script below does just that.</p>
<p>Some things you will need to know<br/><br />
<b>calendarId :</b> if you don&#8217;t know how to find the google calendar Id start <a href="https://www.google.com/search?q=how+to+find+google+calendar+id">here</a> once you&#8217;ve got that, the rest is fairly simple.<br/></p>
<p><b>Adding the script to a spread sheet :</b><br/></p>
<ol>
<li>Open your spread sheet in question</li>
<li>click Tools</li>
<li>click Script Editor</li>
<li>Create Blank Project</li>
<li>Paste code below into project (over writing existing text)</li>
<li>save project (name doesn&#8217;t really matter)</li>
</ol>
<p><b>Adding the hook for when the form is submitted :</b><br/><br />
while still in the scripting project window<br/></p>
<ol>
<li>click Resources</li>
<li>click All Your Triggers</li>
<li>click Add a new trigger</li>
<li>select getLatestAndSubmitToCalendar in first drop down</li>
<li>select from spread sheet in the second drop down</li>
<li>select on form submit in the third drop down</li>
<li>click Save</li>
</ol>
<p><br/><br/><br />
you will likely have to adjust the Id variables below to match which column contains those values in your spread sheet/form, but if all went well, now when you submit an event to your google form associated with your spread sheet, an event will be added to your calendar.</p>
<pre class="brush: javascript";>
//this is the ID of the calendar to add the event to, this is found on the calendar settings page of the calendar in question
var calendarId = "CALENDAR_ID_HERE";

//below are the column ids of that represents the values used in the spreadsheet (these are non zero indexed)
var startDtId = 4;
var endDtId = 5;
var titleId = 3;
var descId = 2;
var formTimeStampId = 1;

function getLatestAndSubmitToCalendar() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var rows = sheet.getDataRange();
  var numRows = rows.getNumRows();
  var values = rows.getValues();
  var lr = rows.getLastRow();
  var startDt = sheet.getRange(lr,startDtId,1,1).getValue();
  //set to first hour and minute of the day.
  startDt.setHours(0);
  startDt.setMinutes(00);
  var endDt = sheet.getRange(lr,endDtId,1,1).getValue();
  //set endDt to last hour and minute of the day
  endDt.setHours(23);
  endDt.setMinutes(59);
  var subOn = "Submitted on :"+sheet.getRange(lr,formTimeStampId,1,1).getValue();
  var desc = "Added by :"+sheet.getRange(lr,descId,1,1).getValue()+"\n"+subOn;
  var title = sheet.getRange(lr,titleId,1,1).getValue()+" Vacation";
    createEvent(calendarId,title,startDt,endDt,desc);
}​
  
  function createEvent(calendarId,title,startDt,endDt,desc) {
  var cal = CalendarApp.getCalendarById(calendarId);
  var start = new Date(startDt);
  var end = new Date(endDt);
  var loc = 'Script Center';

  var event = cal.createEvent(title, start, end, {
      description : desc,
      location : loc
  });
};
</pre></p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2012%2F09%2F05%2Fautomatically-adding-events-to-a-google-calendar-from-a-google-form-submission%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2012/09/05/automatically-adding-events-to-a-google-calendar-from-a-google-form-submission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Matching SqlCeException&#8217;s NativeError code to meaningful information.</title>
		<link>http://bruceburge.com/2012/07/13/matching-sqlceexceptions-nativeerror-code-to-meaningful-information/</link>
		<comments>http://bruceburge.com/2012/07/13/matching-sqlceexceptions-nativeerror-code-to-meaningful-information/#comments</comments>
		<pubDate>Fri, 13 Jul 2012 23:12:07 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=458</guid>
		<description><![CDATA[Download: DatabaseUtilities.zip Lately I&#8217;ve been doing a lot of work with SqlCe, its a nice file based database, and works well for the project&#8217;s purposes, but there are issues, mounds of them in fact. The purpose of this article however isn&#8217;t to go into those problems but to help better deal with the situation when [...]]]></description>
				<content:encoded><![CDATA[<p style="Padding:5px";>
<p><b>Download: <a href='http://bruceburge.com/wp-content/uploads/2012/07/DatabaseUtilities.zip'>DatabaseUtilities.zip</a></b><br/><br/></p>
<p>Lately I&#8217;ve been doing a lot of work with SqlCe, its a nice file based database, and works well for the project&#8217;s purposes, but there are issues, mounds of them in fact. The purpose of this article however isn&#8217;t to go into those problems but to help better deal with the situation when you do encounter a problem.<br/><br/></p>
<p>Often times on the Msdn and other locations on the web, when looking for information on dealing with sqlCeExceptions, you&#8217;ll find code very similar to this.<br/></p>
<pre class="brush: csharp;">
SqlCeConnection conn = new SqlCeConnection("Data Source=nonExistingSource.sdf;");

try
{
    conn.Open();
}
catch (SqlCeException e)
{
    // Use SqlCeException properties if you need specific
    // application logic depending on the error condition
    //
    if (25046 == e.NativeError /*SSCE_M_FILENOTFOUND*/)
    {
        // Error specific logic goes here...
        //
    }

    MessageBox.Show(e.Message);
}
</pre>
<p>Perhaps this is fine to some, but to do an equality of an error code against a numerical literal is a personal pet peeve of mine, its far to easy to confuse, transpose, and in the future is hard to remember what the literal means, if that error code changes, you have to go through your code and change it.</p>
<p>My solution was to create a helper class out of the information made available<br />
on the Msdn site <a href="http://technet.microsoft.com/en-us/library/ms171849" target="_blank">http://technet.microsoft.com/en-us/library/ms171849</a> which gives a fair amount of information about these errors. </p>
<p>the Helper contains an Enum of error codes to Token, so the code above could written like </p>
<pre class="brush: csharp;">
SqlCeConnection conn = new SqlCeConnection("Data Source=nonExistingSource.sdf;");

try
{
    conn.Open();
}
catch (SqlCeException e)
{
    // Use SqlCeException properties if you need specific
    // application logic depending on the error condition
    //
    if (SqlCeErrorDetails.SqlCeNativeErrorNumToToken.SSCE_M_FILENOTFOUND == e.NativeError)
    {
      //error code
    }

    MessageBox.Show(e.Message);
}
</pre>
<p>the helper also contains a dictionary to get back a object containing detailed information about the error you are having to use it, you do something like the following.</p>
<pre class="brush: csharp;">
...
catch (SqlCeException ceException)
{
 
if (SqlCeErrorDetails.SqlCeErrorDetailDictionary.ContainsKey((uint)ceException.NativeError))
  {
    SqlCeErrorDetails.SqlCeErrorDetail errorDetail = SqlCeErrorDetails.SqlCeErrorDetailDictionary[(uint)ceException.NativeError];
        //errorDetail exposes the following info
	//errorDetail.Code;
	//errorDetail.Description;
	//errorDetail.ErrorCategory;
	//errorDetail.ErrorToken;
	//errorDetail.NumericParameter;
	//errorDetail.StringParameter;
  }
 else
  {
   //unknown error code
  }
}
</pre>
<p>This information is a lot more useful when logging, and you can get fairly specific details out of it.  Regardless, its useful to me, so I thought I would put it up here.</p>
<p>I would also suggest that if you are going to deal with SqlCe at all, you should really check out <a href="http://erikej.blogspot.com/">http://erikej.blogspot.com/</a>.  Erik is super knowledgable on the subject and you will find him to be the source of a lot of sqlce answer on stackoverflow and microsoft forums.<br/><br/></p>
<p><b>Download: <a href='http://bruceburge.com/wp-content/uploads/2012/07/DatabaseUtilities.zip'>DatabaseUtilities.zip</a></b><br/><br/></p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2012%2F07%2F13%2Fmatching-sqlceexceptions-nativeerror-code-to-meaningful-information%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2012/07/13/matching-sqlceexceptions-nativeerror-code-to-meaningful-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generically Returning a New instance of an Object, if The passed Object is null</title>
		<link>http://bruceburge.com/2012/03/30/generically-returning-a-new-instance-of-an-object-if-the-passed-object-is-null/</link>
		<comments>http://bruceburge.com/2012/03/30/generically-returning-a-new-instance-of-an-object-if-the-passed-object-is-null/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 22:06:35 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=449</guid>
		<description><![CDATA[public T IfNullObjReturnNewObj&#60;T>(T obj) where T : class, new()
{
	if (obj == null)
	{
		return new T();
	}
	else
	{
		return obj;
	}
}]]></description>
				<content:encoded><![CDATA[<p style="Padding:5px";>
Tired of doing the classic </p>
<pre class="brush: csharp;">
 TestClass tmpClass = null;

if(/*logic about tmpClass related stuff*/)
{
   if(tmpClass = null)
    {
     tmpClass = new TestClass();
    }
}
</pre>
<p><b>(ok, probably not that big a situation, but it does come up, and can get ugly.)<br />
My solution  to the situation is this.</b></p>
<p></p>
<pre class="brush: csharp;">


public T IfNullObjReturnNewObj&lt;T>(T obj) where T : class, new()
{
	if (obj == null)
	{
		return new T();
	}
	else
	{
		return obj;
	}
}


private class TestClass
{
	public TestClass()  //must have blank constructor
	{
	
	}
}


void Main()
{
	TestClass tmp = null;

	if(tmp == null)
	{
		"Null".Dump();
	}

	tmp = IfNullObjReturnNewObj&lt;TestClass>(tmp);

	if(tmp == null)
	{
		"Null".Dump();
	}
	else
	{
		"Not Null".Dump();
	}
}
</pre>
<p>Also, you may notice the .Dump() calls, this is from <a href="http://www.linqpad.net/" target="_blank">Linq Pad</a>, a wonderful program for prototyping out C# (or vb.net) code, its a wonderful tool, and the intellisense is worth the price of the upgrade.</p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2012%2F03%2F30%2Fgenerically-returning-a-new-instance-of-an-object-if-the-passed-object-is-null%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2012/03/30/generically-returning-a-new-instance-of-an-object-if-the-passed-object-is-null/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun With Validation using reflection in C#.</title>
		<link>http://bruceburge.com/2012/03/28/fun-with-validation-using-reflection-in-c/</link>
		<comments>http://bruceburge.com/2012/03/28/fun-with-validation-using-reflection-in-c/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 22:52:14 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=429</guid>
		<description><![CDATA[Quick and dirty validation of a non-static class using reflection. This allows you to easily validate the values of a class, and skip fields you don&#8217;t want validated, this again is quick and dirty example code, and not meant to be directly implemented. this is largely, based off of dotnetperls.com code example for static classes. [...]]]></description>
				<content:encoded><![CDATA[<p style="Padding:5px";>
Quick and dirty validation of a non-static class using reflection.</p>
<p>This allows you to easily validate the values of a class, and skip fields you don&#8217;t want validated, this again is quick and dirty example code, and not meant to be directly implemented.<br />
this is largely, based off of <a href="http://www.dotnetperls.com/reflection-field" title="dotnetperls.com" target="_blank">dotnetperls.com</a> code example for static classes.<br />
</p>
<pre class="brush: csharp;">

		public bool Validate&lt;T>(T objToValidate, List&lt;string> doNotValidate)
		{
			Type type = typeof(T); // Get type pointer
	
			foreach (var property in type.GetProperties()) // Loop through properties
			{
				string name = property.Name; // Get string name
				object temp = property.GetValue(objToValidate,null); // Get value
				
				if (!doNotValidate.Contains(name))
				{
				/*  Add Validation Logic Here */

					if (temp is int) // See if it is an integer.
					{
						int value = (int)temp;
						//if our int values are null or not greater than 0 config is not valid
						if (value == null || value <= 0)
						{						
							return false;
						}
					}
					else if (temp is string) // See if it is a string.
					{
						string value = temp as string;
						//if the value is null or an empty string config is not valid
						if (String.IsNullOrEmpty(value))
						{						
							return false;
						}

					}
				}
			}			

			return true;
		}
	
	public class IpcPluginConfig
	{
		public int AlarmListIntervalMs { get; set; }
		public int AlarmHistoryIntervalMs { get; set; }
		public int KranProductionIntervalMs { get; set; }
		public int KranFhuererIntervalMs { get; set; }
		public int LastaufnahmeIntervalMs { get; set; }
		public int IpcMachineTimeIntervalMs { get; set; }

		//UNCAccessWithCredentials values
		public string uncPath { get; set; }
		public string uncUserName { get; set; }
		public string uncDomain { get; set; }
		public string uncPassword { get; set; }

		public string IpcConnectionString { get; set; }
		public string IpcProviderName { get; set; }

		public string HtpcConnectionString { get; set; }
		public string HtpcProviderName { get; set; }


	}



void Main()
{
	var tmp = new IpcPluginConfig();
	tmp.AlarmHistoryIntervalMs = 1;
	tmp.AlarmListIntervalMs = 1;
	tmp.HtpcConnectionString = "test";
	tmp.HtpcProviderName = "test";
	tmp.IpcConnectionString = "test";
	tmp.IpcProviderName = "test";
	tmp.KranFhuererIntervalMs = 1;
	tmp.KranProductionIntervalMs = 1;
	tmp.LastaufnahmeIntervalMs = 1;
	tmp.IpcMachineTimeIntervalMs = 1;
	
	var doNotValidate = new List&lt;string>();
	doNotValidate.Add("uncPath");
	doNotValidate.Add("uncUserName");
	doNotValidate.Add("uncDomain");
	doNotValidate.Add("uncPassword");
	
	Validate&lt;IpcPluginConfig>(tmp, doNotValidate);
	
	
	
}

</pre></p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2012%2F03%2F28%2Ffun-with-validation-using-reflection-in-c%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2012/03/28/fun-with-validation-using-reflection-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Journal Format</title>
		<link>http://bruceburge.com/2012/03/27/new-journal-format/</link>
		<comments>http://bruceburge.com/2012/03/27/new-journal-format/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 17:09:15 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[Notice]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=443</guid>
		<description><![CDATA[As its clear, pretty clear, I won&#8217;t make the time to do long complex journal post, I plan to move the posting here to more of an adhoc, when I come across something interesting or useful. I will rely more on inline code commenting to explain what I post rather than lengthy explanations, this may [...]]]></description>
				<content:encoded><![CDATA[<p>As its clear, pretty clear, I won&#8217;t make the time to do long complex journal post, I plan to move the posting here to more of an adhoc, when I come across something interesting or useful.</p>
<p>I will rely more on inline code commenting to explain what I post rather than lengthy explanations, this may not be the best method of presenting data, but I do feel it will encourage me to post more, and ultimately share more information I feel is useful to the those that would care to see it. </p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2012%2F03%2F27%2Fnew-journal-format%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2012/03/27/new-journal-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing .net library DLLs between Asp classic and Asp.net</title>
		<link>http://bruceburge.com/2009/06/11/sharing-net-libary-dlls-between-asp-classic-and-aspnet/</link>
		<comments>http://bruceburge.com/2009/06/11/sharing-net-libary-dlls-between-asp-classic-and-aspnet/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 06:34:22 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[asp classic]]></category>
		<category><![CDATA[Asp.net]]></category>
		<category><![CDATA[com]]></category>
		<category><![CDATA[com-visible]]></category>
		<category><![CDATA[GAC]]></category>
		<category><![CDATA[library dll]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=251</guid>
		<description><![CDATA[Preface Let me first start by saying that I am writing this example after I spent many hours frustrated at the lack of documentation, the abundance of disinformation, and the endless chasing of MSDN dead links. The information contained here is based off many sources all over the net. Though I did not find a [...]]]></description>
				<content:encoded><![CDATA[<p><h3>Preface</h3>
<p>Let me first start by saying that I am writing this example after I spent many hours frustrated at the lack of documentation, the abundance of disinformation, and the endless chasing of MSDN dead links.  The information contained here is based off many sources all over the net. Though I did not find a single one that clearly laid out how to do it all at once. I will attempt to do that here, in a clear manner; these are the steps that I took to get consistent working results.  There may be steps here that are not needed, though I have worked to remove as many of them as time would allow some may have slipped by.<br /> <br />
My examples and screen shots will be from <br />
<b>Visual Studio 2005, Standard Edition, Frame work ver. 2.0.5xxx sp2</b><br />
Web server this example was deployed on was<br />
<b>Windows 2003 Standard running IIS 6.0 / ASP 3.0</b>
</p>
<p><br/></p>
<p>The first thing you are going to need to get this project off the ground is a <em>Library DLL</em>.  There are a few changes you need to be aware before writing your Library DLL.<br/></p>
<h3>Methods should not be static</h3>
<p>I am guessing here, due to the fact that asp classic does not support static classes, it stands to reason, it can&#8217;t reference one in a DLL library.  I attempted a few different was to get this to work and constantly received the following error  <br />&#8220;<b><em>Microsoft VBScript runtime error &#8217;800a01b6&#8242; Object doesn&#8217;t support this property or method: &#8216;myMethod&#8217;</em></b>.&#8221;<br />
My advice, save the headache and avoid the static methods, if you are reading this, and know a solution please comment.
</p>
<p><br/></p>
<p><h3>Dll must be marked as Com-visible</h3>
<p>To make a DLL com-visible, you need to modify the assembly information.  There are multiple ways of doing this, the easiest method is to use visual studio, go to your projects properties then click the &#8220;<b>Assembly Information</b>&#8221; button and check the checkbox at the bottom of the window that says &#8220;<b>Make assembly COM-Visible</b>&#8221; (as seen below)<br />
<img src="http://bruceburge.com/wp-content/uploads/2009/06/com-visible.png" alt="com-visible" title="com-visible" width="390" height="379" class="alignnone size-full wp-image-264" /><br />
you can also do this by hand by manually editing the AssemblyInfo.cs and adding the following code</p>
<pre class="brush: csharp;">
[assembly: ComVisible(true)]
</pre>
<p>Lastly, you can make these changes at run time.  I don&#8217;t suggest doing that, but if you must, googling &#8220;<b>Com-visible runtime</b>&#8221; will likely bring you to the right place for it, (<em style="font-size:smaller">I&#8217;d post a link to the MSDN page, but in my experience it will change in the future and ultimately be useless.</em>)  Another important note, you should not confuse this with, <b>&#8220;Register for COM interop&#8221;</b> in the build section of the projects properties.  In fact you need to make sure this option is <b>UNCHECKED</b> as it will cause problems later, I&#8217;ll explain more on this in the following steps.
</p>
<p><br/></p>
<p><h3>Your Project Should be Signed</h3>
<p>Long story short this step, is done mainly to avoid warnings and possible issues of entering your assembly into the GAC (Global Assembly Cache). This step is easily done using the Visual studio IDE, and Googling &#8220;<b>signing assemblies</b>&#8221; will show many tutorials on how to do this from the command line if you wish to do so.  Signing an Assembly will also protect your libaray from being confused or replaced by other assemblies by mistake, or through nefarious means.<br />
<img src="http://bruceburge.com/wp-content/uploads/2009/06/signingbuild.png" alt="signingbuild" title="signingbuild" width="496" height="374" class="alignnone size-full wp-image-273" />
</p>
<p><br/></p>
<p><h3>Building the Installer</h3>
<p>Now that you have got the prep work done and your code written, you will need to get your library on to your web server, once again this can be done by hand through various command line methods. But the easiest and most convent way for the developer, and web server management is to do this via a setup project, using the installer will add an easy way to add and remove your library to the server.  To do this you need to create a new setup project.<br/><br />
<a href="http://bruceburge.com/wp-content/uploads/2009/06/newproject.png" rel="prettyPhoto[g251]"><img src="http://bruceburge.com/wp-content/uploads/2009/06/newproject-300x218.png" alt="newproject" title="newproject" width="300" height="218" class="alignnone size-medium wp-image-284" /></a><br/></p>
<p>Once you have your setup project added to your library solution,</p>
<ol>
<li>Click on the setup project in the solution explorer window, you should now see a new set of icons for this type of project</li>
<li>The second icon is for the &#8220;<b>File System Editor</b>&#8221; click this and it will bring up a new window for &#8220;<b>File System on Target Machine</b>&#8220;</li>
<li>Right click in the left hand side of the window and select &#8220;<b>Add Special Folder</b>&#8221; select &#8220;<b>Global Assembly Cache Folder</b>.&#8221; </li>
<li>Single Click the &#8220;<b>Global Assembly Cache Folder</b>.&#8221; once highlighted, right click on it and select &#8220;<b>Add</b>, the select &#8220;<b>Product output</b>&#8220;</li>
<li>In the popup window select &#8220;<b>Primary Output</b>&#8220;</li>
</ol>
<p>See screen shot below <br/><br />
<a href="http://bruceburge.com/wp-content/uploads/2009/06/setup.png" rel="prettyPhoto[g251]"><img src="http://bruceburge.com/wp-content/uploads/2009/06/setup-300x211.png" alt="setup" title="setup" width="300" height="211" class="alignnone size-medium wp-image-285" /></a><br />
At this point, you should be ready to build the project and produce your installer, the setup MSI and setup.exe should be in the setup projects Release or Debug folder depending on the option you chose during build time.<br/><br />
<b>Note:</b><br /> If you are have a .tlb file being placed in your CAG folder along with your primary output, this is a result of having &#8220;<b>Register for COM interop</b>&#8221; checked in your coding projects build options, to resolve this, either uncheck the box in the build options, or add a &#8220;ExcludeFilter&#8221; for *.tlb in your installer project.
</p>
<p><br/></p>
<p><h3>Installing</h3>
<p>Copy the Msi and setup.exe over to your web server and install your Library, this should be done from an administrator account.  Assuming all went well in your install process you should check the GAC,Typically (c:\windows\assembly) to make sure your library is registered.  while here you will need to gather a bit of information so that we can reference the library in our asp.net website. you are going to need the <br />
<b>Name:<br /> Culture:<br /> Version: <br />Public Key Token:</b><br /> You can do this by right clicking on your assembly and going to properties.<br/>
</p>
<p><br/></p>
<p><h3>Using the Code</h3>
<p>Once you have this information, you are ready to start using your library on your site, first we will cover using the code in asp.net(c#).  The first thing we need to do, is to add the assembly to your web.config for your site. To do this, add the following code to your web.config <br /> <b>(you shouldn&#8217;t need to add the system.web its there to show placement)</b></p>
<pre class="brush: csharp;">
&lt;system.web>
  &lt;compilation>	
    &lt;assemblies>
      &lt;add assembly="MyAssembly, Version=1.0.0.1, Culture=neutral,PublicKeyToken=8c7fff0114cec090" />
    &lt;/assemblies>
  &lt;/compilation>
&lt;/system.web>
</pre>
<p>Once you have the assembly information added to your web.config, you can use the assembly like any other referenced library. Here is an Example</p>
<pre class="brush: csharp;">
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
     MyAssembly.Crypto tmpExample = new MyAssembly.Crypto();

     string phrase = "test";
     string crypted = tmpExample.Encrypting(phrase);     
     string decrypted = tmpExample.Decrypting(crypted);

     Response.Write("Test phrase " + phrase+"&lt;br>");
     Response.Write("encrypted " + crypted + "&lt;br>");
     Response.Write("decypted " + decrypted + "&lt;br>");
    }
}
</pre>
<p>Since you have made the Library available system wide, and made it com-visible, you won&#8217;t have to do<br />
anything to make it visible to asp classic, other than adding it to the code itself. Here is an example of how to use the Library in asp classic (vbscript)</p>
<pre class="brush: vb;">
Dim tmpExample 
Set tmpExample = Server.CreateObject("MyAssembly.Crypto")

phrase = "test"
crypted = tmpExample.Encrypting(phrase)     
decrypted = tmpExample.Decrypting(crypted)

Response.Write("Test phrase " + phrase+"&lt;br>")
Response.Write("encrypted " + crypted + "&lt;br>")
Response.Write("decypted " + decrypted + "&lt;br>")
</pre>
</p>
<p><br/></p>
<p><h3>Conclusion</h3>
<p>I have tried to be as detailed as possible without being to verbose, but it is possible some details may have slipped past me. So if I have made a mistake, feel free to leave a comment, and I will work hard to resolve the issue.  Also, I have found other partial examples on the net that suggest doing the same thing, but in different ways.  Some of these examples turned out to be either unnecessary, or completely wrong.  What  I have posted here is the a method I have found to be the fastest, easiest, and most reliable way of sharing the library DLL between asp.net and asp classic via COM.</p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2009%2F06%2F11%2Fsharing-net-libary-dlls-between-asp-classic-and-aspnet%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2009/06/11/sharing-net-libary-dlls-between-asp-classic-and-aspnet/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Captcha without graphics libraries</title>
		<link>http://bruceburge.com/2009/05/23/captcha-without-graphics-libraries/</link>
		<comments>http://bruceburge.com/2009/05/23/captcha-without-graphics-libraries/#comments</comments>
		<pubDate>Sat, 23 May 2009 07:02:54 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Capthca]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=161</guid>
		<description><![CDATA[Sometimes we need to perform Captcha on a form, but we don&#8217;t have access to a method of dynamically generating graphics, you can if you wish to bring in a third party and use something like reCaptcha. But if you aren&#8217;t keen on the third party idea, than this is an alternative. Another possible use [...]]]></description>
				<content:encoded><![CDATA[<p>
Sometimes we need to perform Captcha on a form, but we don&#8217;t have access to a method of dynamically generating graphics, you can if you wish to bring in a third party and use something like <a href="http://recaptcha.net/" target="_blank">reCaptcha</a>.  But if you aren&#8217;t keen on the third party idea, than this is an alternative.</p>
<p>
Another possible use for this method is context based captcha, so say for example you presented your user with the following picture<br />
<div id="attachment_184" class="wp-caption alignnone" style="width: 143px"><img src="http://bruceburge.com/wp-content/uploads/2009/05/sjirlzqoaopd.jpg" alt="What show am I on?" title="sjirlzqoaopd.jpg" width="133" height="120" class="size-full wp-image-184" /><p class="wp-caption-text">What show am I on?</p></div><br />
Since there are multiple answers, you can add multiple entries into your has hash</p>
<pre class="brush: php;">
&lt;?php
$cc_hashtable["star trek"] = "img/sjirlzqoaopd.jpg";
$cc_hashtable["startrek"] = "img/sjirlzqoaopd.jpg";
$cc_hashtable["star trek: TOS"] = "img/sjirlzqoaopd.jpg";
$cc_hashtable["old star trek"] = "img/sjirlzqoaopd.jpg";
...
?> 
</pre>
<p>There are limitations to this method, such as language issues, for example, due to my poor choice in question construction if someone from German came across my form they may enter &#8220;Raumschiff Enterprise&#8221; which is correct to them, but would not work for your site.  So be aware of that, it is best to come up with single answer questions, and localization may require a hash for each language.
</p>
<p>
With all that said, the first thing you will need to do is to gain access to images that contain captcha data, the easiest way to do this, is to find a site that can dynamically generate captcha images and copy and image from there, and refresh and repeat till you have built up enough images to meet your needs, the more images, the more the system will seem dynamic, and decrease the chances of your method being found out.  Once you have your images, you want to add them to the cc_hash.php, you also want to load the captcha phrase from each image as its key in the hash table. </p>
<p>
The second thing is to integrate the code into your form, the functions are set up in such away placing the following function calls in your form will generate two new fields in your form variables<br/><br />
adds the captcha image to the form.</p>
<pre class="brush: php;">
&lt;?=cc_form_image($cc_hashtable)?>
</pre>
<p>adds the input field for the captcha to the form<br/></p>
<pre class="brush: php;">
&lt;?=cc_form_text_field()?>
</pre>
</p>
<p>try it out for yourself<br/><br />
<a href="http://bruceburge.com/codeexamples/cheapcheck/" target="_blank">Cheap Check Example</a></p>
<p>continue reading for the code examples.<br />
<span id="more-161"></span></p>
<hr />
cc_hash.php</p>
<p style="padding:5px;">
Each of the images in the hash, should contain the phrase that is used as its key, so that if a user&#8217;s randomly loaded captcha image is the file &#8220;<b>ptytfyiwonsq.jpg</b>&#8221; his correct challenge input would be <b>rwet</b><br />
<em style="font-size:smaller;">I separate this file from the rest, because it is likely that I would use a database to populate $cc_hashtable, but have not for this example.</em>
</p>
<hr />
<pre class="brush: php;">
&lt;?php
$cc_hashtable['wert'] = "img/sjirlzqoaopd.jpg";
$cc_hashtable['rwet'] = "img/ptytfyiwonsq.jpg";
$cc_hashtable['bars'] = "img/rmglpqghaozm.jpg";
?>
</pre>
<hr />
cc_functions.php</p>
<p style="padding:5px;">
This is the core file of the script, it contains the configuration, as well as the 3 primary functions used to make this method work
</p>
<hr />
<pre class="brush: php; html-script: false">
&lt;?php
/*#######################################################################
this program is designed to recreate the dynamic images on many contact 
forms used to prevent automated emailers from spamming via contact forms.
#######################################################################*/

/*Config*/
$GLOBALS['cc_error'] = "";
$GLOBALS['cc_form_text_field_name'] = "cc_contacttext";
$GLOBALS['cc_form_image_name'] = "cc_contactimage";
 /*if they enter a key that exist but not the correct one*/
$GLOBALS['cc_error_match_fail'] = "Input does not match current image";
/*if they enter completely incorrect input*/
$GLOBALS['cc_error_invalid_input'] = $GLOBALS['cc_error_match_fail'];  

/*file containing hash of images and phrases*/
require "cc_hash.php";

/*#######################################################################
######################Do not edit below#######################################
#######################################################################*/

function cc_parser($cc_posted_image,$cc_posted_text,$cc_hashtable)
{
 if(array_key_exists($cc_posted_text,$cc_hashtable))
  {
   if($cc_hashtable[$cc_posted_text] == $cc_posted_image)
    {
	 return true;
	}
  else
   {
    $GLOBALS['cc_error'] = $GLOBALS['cc_error_match_fail'];
    return false;
   }	  
  }
 else
  {
  $GLOBALS['cc_error'] = $GLOBALS['cc_error_invalid_input'];
   return false;
  } 
}

function cc_form_image($cc_hashtable)
{
 $foo = $cc_hashtable[array_rand($cc_hashtable)];
 return "&lt;img src="".$foo.""><input name="".$GLOBALS['cc_form_image_name']."" type="hidden" value="".$foo."">";
}

function cc_form_text_field()
{
 return "<input type="text" name="".$GLOBALS['cc_form_text_field_name']."" value="">";
}

?>
</pre>
<hr />
demo.php</p>
<p style="padding:5px;">
Below is an example of how one can deploy the script
</p>
<hr />
<pre class="brush: php;">
&lt;?php
require "cc_functions.php";

function print_form($cc_hashtable)
{
?>

<form action="" method="post">
&lt;?=cc_form_image($cc_hashtable)?>
<br />
&lt;?=cc_form_text_field()?>
<input type="submit">
</form>
&lt;?

}


if($_POST)
{
	if(cc_parser($_POST['cc_contactimage'],$_POST['cc_contacttext'],$cc_hashtable))
	 {
	  //process form 
	  echo "Success";
	 }
	else
	 {
	 	echo "Image verification failed ";
		print_form($cc_hashtable);
	 }
}
else
 {
  print_form($cc_hashtable);
 }
?>
</pre>
<p><em>(the cc_ prefix used in the code stands for &#8220;cheap check&#8221; and is used to reduce the likelihood of conflicting function names.)</em></p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2009%2F05%2F23%2Fcaptcha-without-graphics-libraries%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2009/05/23/captcha-without-graphics-libraries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Progress</title>
		<link>http://bruceburge.com/2009/05/20/progress/</link>
		<comments>http://bruceburge.com/2009/05/20/progress/#comments</comments>
		<pubDate>Wed, 20 May 2009 20:42:32 +0000</pubDate>
		<dc:creator>Bruce</dc:creator>
				<category><![CDATA[Notice]]></category>

		<guid isPermaLink="false">http://bruceburge.com/?p=15</guid>
		<description><![CDATA[The process of moving from a (failed) google apps attempt at a personal site is almost complete, the software section has been brought up to date with my desktop applications, and in the coming days I hope to add a few scripts I&#8217;ve written to this journal section.]]></description>
				<content:encoded><![CDATA[<p>The process of moving from a (failed) <a href="http://google.com/a">google apps</a> attempt at a personal site is almost complete, the software section has been brought up to date with my desktop applications, and in the coming days I hope to add a few scripts I&#8217;ve written to this journal section.</p>

<div class="like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fbruceburge.com%2F2009%2F05%2F20%2Fprogress%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:24px; "></iframe>
</div>
]]></content:encoded>
			<wfw:commentRss>http://bruceburge.com/2009/05/20/progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
