<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for Coding Notes</title>
	<atom:link href="http://megocode3.wordpress.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://megocode3.wordpress.com</link>
	<description>Ideas and thoughts from Seth Long</description>
	<lastBuildDate>Wed, 16 Sep 2009 15:59:11 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Understanding a SQL Junction Table by Will bids farewell: how to build a course database &#171; Course Tools</title>
		<link>http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-94</link>
		<dc:creator>Will bids farewell: how to build a course database &#171; Course Tools</dc:creator>
		<pubDate>Wed, 16 Sep 2009 15:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-94</guid>
		<description>[...] added additional tables to the database for each of these groupings, with associated join tables (what&#8217;s a join table?). This would create multiple routes through the hierarchy and make it less clear where data should [...]</description>
		<content:encoded><![CDATA[<p>[...] added additional tables to the database for each of these groupings, with associated join tables (what&#8217;s a join table?). This would create multiple routes through the hierarchy and make it less clear where data should [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Understanding a SQL Junction Table by Music Collection relationships? - dBforums</title>
		<link>http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-91</link>
		<dc:creator>Music Collection relationships? - dBforums</dc:creator>
		<pubDate>Sun, 16 Aug 2009 22:16:23 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-91</guid>
		<description>[...] : How to implement a many-to-many relationship using Linq to Sql ? Database Design - Many-to-many Understanding a SQL Junction Table Coding Notes Oracle - What is a junction table and how is it used in Microsoft Access? junction table ebook [...]</description>
		<content:encoded><![CDATA[<p>[...] : How to implement a many-to-many relationship using Linq to Sql ? Database Design &#8211; Many-to-many Understanding a SQL Junction Table Coding Notes Oracle &#8211; What is a junction table and how is it used in Microsoft Access? junction table ebook [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Understanding a SQL Junction Table by aarklon</title>
		<link>http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-89</link>
		<dc:creator>aarklon</dc:creator>
		<pubDate>Sun, 05 Jul 2009 05:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-89</guid>
		<description>but SELECT StudentName, RoomNumber
FROM StudentClassroom in this query 

SELECT StudentName, RoomNumber
FROM StudentClassroom
JOIN Students ON Students.StudentID = StudentClassroom.StudentID
JOIN Classrooms ON Classrooms.ClassroomID = StudentClassroom.ClassroomID

doesn&#039;t seem to be correct isn&#039;t it ?</description>
		<content:encoded><![CDATA[<p>but SELECT StudentName, RoomNumber<br />
FROM StudentClassroom in this query </p>
<p>SELECT StudentName, RoomNumber<br />
FROM StudentClassroom<br />
JOIN Students ON Students.StudentID = StudentClassroom.StudentID<br />
JOIN Classrooms ON Classrooms.ClassroomID = StudentClassroom.ClassroomID</p>
<p>doesn&#8217;t seem to be correct isn&#8217;t it ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Haversine Formula in C# and in SQL by ALEJANDRO VARELA</title>
		<link>http://megocode3.wordpress.com/2008/02/05/haversine-formula-in-c/#comment-53</link>
		<dc:creator>ALEJANDRO VARELA</dc:creator>
		<pubDate>Wed, 06 May 2009 14:50:11 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/?p=11#comment-53</guid>
		<description>excelente post!
justo lo que necesitaba.</description>
		<content:encoded><![CDATA[<p>excelente post!<br />
justo lo que necesitaba.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Haversine Formula in C# and in SQL by mathtalk</title>
		<link>http://megocode3.wordpress.com/2008/02/05/haversine-formula-in-c/#comment-40</link>
		<dc:creator>mathtalk</dc:creator>
		<pubDate>Sun, 19 Apr 2009 21:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/?p=11#comment-40</guid>
		<description>I&#039;m responding to a few points Brad Dre brings up.

The haversine fomula is more accurate over short distances than some slightly simpler formulas, e.g. based on the law of spherical cosines.  So, while it mathematically true:

sin(dLat/2)*sin(dLat/2) = (1 - cos(dLat))/2

the left-hand side avoids any loss of precision by cancellation that could occur on the right-hand side when the difference in latitudes dLat is small.

Brad asks about:

&quot;The Haversine formula on Wikipedia doesn’t have Math.Min(1, Math.Sqrt(a)) in it, just Math.Sqrt(a).

&quot;Do you know whether Min is important here? I’ve decided not to use it.&quot;

A comment by the ubiquitous SQL expert Joe Celko cleared this up for me.  It is useful at the other extreme of distances when two points are nearly at opposite sides of the sphere (antipodal).  Then it guards against round-off errors leading to a &gt; 1, which would make an arcsine calculation blow-up.

Finally, with regard to including altitude (and presumably, a difference in altitudes) in the distance calculation, it seems to me one has now entered a context in which &quot;great circle&quot; distances (produced by the haversine formula) may be less the question than Euclidean (straightline) distances.  Someone might want to give the context in which they consider altitude important, e.g. orbital calculations?  The haversine formula assumes a spherical model, and as Brad also pointed out, the variation in radius from north/south latitude variation can exceed the variation in altitude.

Adrian&#039;s suggestion, to add the altitude to the Earth&#039;s radius, is correct if one is asking about the distance between two points of equal altitude.  However this would be a correction of less than 0.2% even at Mount Everest&#039;s elevation.

When a difference in altitude is smallish relative to the great circle distance, a quick approximation is to add the two.  This is essentially the approximation of a right triangle&#039;s hypotenuse by adding the lengths of the two legs, reliable when one leg is much longer than the other.  If the two distances were similar in magnitude, the Pythagorean formula would be more accurate, i.e. the square root of the square of altitude difference plus the square of the great circle distance.

regards, mt</description>
		<content:encoded><![CDATA[<p>I&#8217;m responding to a few points Brad Dre brings up.</p>
<p>The haversine fomula is more accurate over short distances than some slightly simpler formulas, e.g. based on the law of spherical cosines.  So, while it mathematically true:</p>
<p>sin(dLat/2)*sin(dLat/2) = (1 &#8211; cos(dLat))/2</p>
<p>the left-hand side avoids any loss of precision by cancellation that could occur on the right-hand side when the difference in latitudes dLat is small.</p>
<p>Brad asks about:</p>
<p>&#8220;The Haversine formula on Wikipedia doesn’t have Math.Min(1, Math.Sqrt(a)) in it, just Math.Sqrt(a).</p>
<p>&#8220;Do you know whether Min is important here? I’ve decided not to use it.&#8221;</p>
<p>A comment by the ubiquitous SQL expert Joe Celko cleared this up for me.  It is useful at the other extreme of distances when two points are nearly at opposite sides of the sphere (antipodal).  Then it guards against round-off errors leading to a &gt; 1, which would make an arcsine calculation blow-up.</p>
<p>Finally, with regard to including altitude (and presumably, a difference in altitudes) in the distance calculation, it seems to me one has now entered a context in which &#8220;great circle&#8221; distances (produced by the haversine formula) may be less the question than Euclidean (straightline) distances.  Someone might want to give the context in which they consider altitude important, e.g. orbital calculations?  The haversine formula assumes a spherical model, and as Brad also pointed out, the variation in radius from north/south latitude variation can exceed the variation in altitude.</p>
<p>Adrian&#8217;s suggestion, to add the altitude to the Earth&#8217;s radius, is correct if one is asking about the distance between two points of equal altitude.  However this would be a correction of less than 0.2% even at Mount Everest&#8217;s elevation.</p>
<p>When a difference in altitude is smallish relative to the great circle distance, a quick approximation is to add the two.  This is essentially the approximation of a right triangle&#8217;s hypotenuse by adding the lengths of the two legs, reliable when one leg is much longer than the other.  If the two distances were similar in magnitude, the Pythagorean formula would be more accurate, i.e. the square root of the square of altitude difference plus the square of the great circle distance.</p>
<p>regards, mt</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Understanding a SQL Junction Table by Lee</title>
		<link>http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-38</link>
		<dc:creator>Lee</dc:creator>
		<pubDate>Fri, 20 Feb 2009 16:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/04/understanding-a-sql-junction-table/#comment-38</guid>
		<description>Wonderful, was frustratingly trying to create a junction table through the visual editor and more importantly set the relationships to the other two tables which seems impossible but to no avail....i should have been using sql....thanks so much

Good explanation on the junction table!! You are a star disaster!!</description>
		<content:encoded><![CDATA[<p>Wonderful, was frustratingly trying to create a junction table through the visual editor and more importantly set the relationships to the other two tables which seems impossible but to no avail&#8230;.i should have been using sql&#8230;.thanks so much</p>
<p>Good explanation on the junction table!! You are a star disaster!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Haversine Formula in C# and in SQL by Jim</title>
		<link>http://megocode3.wordpress.com/2008/02/05/haversine-formula-in-c/#comment-37</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 13 Feb 2009 15:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/?p=11#comment-37</guid>
		<description>Thanks for the info! I&#039;ve updated my own version of the SQL function for use in my Silverlight application. My version makes some minor changes to radius values as described here: http://weblogs.asp.net/jimjackson/archive/2009/02/13/calculating-distances-between-latitude-and-longitude-t-sql-haversine.aspx

Jim</description>
		<content:encoded><![CDATA[<p>Thanks for the info! I&#8217;ve updated my own version of the SQL function for use in my Silverlight application. My version makes some minor changes to radius values as described here: <a href="http://weblogs.asp.net/jimjackson/archive/2009/02/13/calculating-distances-between-latitude-and-longitude-t-sql-haversine.aspx" rel="nofollow">http://weblogs.asp.net/jimjackson/archive/2009/02/13/calculating-distances-between-latitude-and-longitude-t-sql-haversine.aspx</a></p>
<p>Jim</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Haversine Formula in C# and in SQL by Calculating Distances Between Latitude and Longitude – T-SQL – Haversine - Jim Jackson</title>
		<link>http://megocode3.wordpress.com/2008/02/05/haversine-formula-in-c/#comment-36</link>
		<dc:creator>Calculating Distances Between Latitude and Longitude – T-SQL – Haversine - Jim Jackson</dc:creator>
		<pubDate>Fri, 13 Feb 2009 15:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/?p=11#comment-36</guid>
		<description>[...] I’ve got lots of lat/long information for my Silverlight 2 application and I’m now tinkering with getting the elevation view working in my spare time. The problem is that the distances are very small and the haversine formulae I’ve located on the internet are all either miles or kilometers. Not going to work when your next position is only 50 feet away. So I wrote the simple SQL function below based directly on Seth Long’s version here. [...]</description>
		<content:encoded><![CDATA[<p>[...] I’ve got lots of lat/long information for my Silverlight 2 application and I’m now tinkering with getting the elevation view working in my spare time. The problem is that the distances are very small and the haversine formulae I’ve located on the internet are all either miles or kilometers. Not going to work when your next position is only 50 feet away. So I wrote the simple SQL function below based directly on Seth Long’s version here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Fisher-Yates Shuffle Algorithm by Seth Long</title>
		<link>http://megocode3.wordpress.com/2008/01/03/fisher-yates-shuffle-algorithm/#comment-34</link>
		<dc:creator>Seth Long</dc:creator>
		<pubDate>Fri, 12 Dec 2008 01:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/03/fisher-yates-shuffle-algorithm/#comment-34</guid>
		<description>Thank you for alerting me to the error. I guess it&#039;s a fairly common mistake to make and a very serious one. Here is a link with more information on the error should anyone else need an explanation of how the error was made.

&lt;a href=&quot;http://dev.netcetera.org/blog/2007/08/24/good-knuth-bad-knuth/&quot; rel=&quot;nofollow&quot;&gt;Good Knuth, Bad Knuth&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Thank you for alerting me to the error. I guess it&#8217;s a fairly common mistake to make and a very serious one. Here is a link with more information on the error should anyone else need an explanation of how the error was made.</p>
<p><a href="http://dev.netcetera.org/blog/2007/08/24/good-knuth-bad-knuth/" rel="nofollow">Good Knuth, Bad Knuth</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Fisher-Yates Shuffle Algorithm by monn</title>
		<link>http://megocode3.wordpress.com/2008/01/03/fisher-yates-shuffle-algorithm/#comment-33</link>
		<dc:creator>monn</dc:creator>
		<pubDate>Fri, 05 Dec 2008 09:31:45 +0000</pubDate>
		<guid isPermaLink="false">http://megocode3.wordpress.com/2008/01/03/fisher-yates-shuffle-algorithm/#comment-33</guid>
		<description>Hi

Although that your code is valid for most practical purpose, I&#039;m afraid that the algorithm is not a correct Fisher-Yates shuffle implementation. There should be N! possible permutation (instead of N^N produced by your code) from which one of permutation will be chosen.


Consider using this code :

for (int i = ary.Length - 1; i &gt;= 0; i++)
    {
        int r = rnd.Next(0, i + 1);

        int tmp = ary[i];
        ary[i] = ary[r];
        ary[r] = tmp;
    }</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>Although that your code is valid for most practical purpose, I&#8217;m afraid that the algorithm is not a correct Fisher-Yates shuffle implementation. There should be N! possible permutation (instead of N^N produced by your code) from which one of permutation will be chosen.</p>
<p>Consider using this code :</p>
<p>for (int i = ary.Length &#8211; 1; i &gt;= 0; i++)<br />
    {<br />
        int r = rnd.Next(0, i + 1);</p>
<p>        int tmp = ary[i];<br />
        ary[i] = ary[r];<br />
        ary[r] = tmp;<br />
    }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
