<?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>Terry Apodaca &#187; Code</title>
	<atom:link href="http://www.terryapodaca.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.terryapodaca.com</link>
	<description>Anything and everything of interest to me.</description>
	<lastBuildDate>Tue, 07 Sep 2010 15:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Telerik RadChart vs MSChart (Microsoft)</title>
		<link>http://www.terryapodaca.com/2010/08/19/telerik-radchart-vs-mschart-microsoft/</link>
		<comments>http://www.terryapodaca.com/2010/08/19/telerik-radchart-vs-mschart-microsoft/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 20:22:21 +0000</pubDate>
		<dc:creator>Terry Apodaca</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[mschart]]></category>
		<category><![CDATA[radchart]]></category>
		<category><![CDATA[telerik]]></category>

		<guid isPermaLink="false">http://www.terryapodaca.com/?p=787</guid>
		<description><![CDATA[We had a very large project that required some pretty intense charting of data&#8230;coming from an Oil and Gas company. So, you can only imagine the amount of data we had to massage and chart in some way, shape, or &#8230; <a href="http://www.terryapodaca.com/2010/08/19/telerik-radchart-vs-mschart-microsoft/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We had a very large project that required some pretty intense charting of data&#8230;coming from an Oil and Gas company.  So, you can only imagine the amount of data we had to massage and chart in some way, shape, or form.  </p>
<p>We used a very nice set of controls for this project in <a href="http://www.telerik.com/">Telerik</a>.   They are by far my favorite set of proprietary controls for the .NET Framework.  The project was heavily built around these controls so it was only natural to want to keep with them.  One problem&#8230;98% of the charts had to be <a href="http://en.wikipedia.org/wiki/Logarithmic_scale">Logarithmic</a>.  If you are not familiar with this&#8230;its when a charts Y Axis is equally spaced with labels dramatically increased (1, 10, 100, 1000, so on) instead of your normal Linear charting (1, 2, 3, 4, etc).  </p>
<p>This presented a problem because the <a href="http://demos.telerik.com/aspnet-ajax/chart/examples/overview/defaultcs.aspx">Telerik RadChart</a> did not represent the logarithmic minor ticks and lines properly.  They didn&#8217;t increase and scale the way they were suppose to.  It&#8217;s hard to explain in words, so here is a screenshot:<br />
<img src="http://www.terryapodaca.com/wp-content/uploads/2010/08/chart1.png" alt="" title="chart1" width="600" height="305" class="alignnone size-full wp-image-788" /></p>
<p>The image above still shows a Linear scale even though it&#8217;s actually Logarithmic.  Well, I searched all over the internet to see if this was just a bug in the Telerik RadChart control or if I was just doing something wrong.  Turns out, Telerik knows (recently) about <a href="http://www.telerik.com/community/forums/aspnet-ajax/chart/logarithmic-scale-for-minor-tick-marks-is-not-correct.aspx">this issue</a> and it has been logged.  I added a reply to that thread (in the link) asking if there was any update on the issue&#8230;and as you can read there&#8230;they said they were not going to fix this.  They did offer a workaround though&#8230;and here is a screenshot:<br />
<img src="http://www.terryapodaca.com/wp-content/uploads/2010/08/chart2.png" alt="" title="chart2" width="600" height="306" class="alignnone size-full wp-image-789" /></p>
<p>What they said to do was just remove the Minor Grid Lines and Ticks from the chart.  Well, I had already done that as a temporary fix, but if you know anything about the <a href="http://en.wikipedia.org/wiki/Petroleum_industry">oil and gas industry</a> then you know how sensitive and important the data is.  So, when we are charting their data it is very important to be as precise as possible.  The minor grid lines were very important. (BTW, this is just test data in the images, so don&#8217;t worry about any issues about showing the clients stuff).</p>
<p>I did some more digging and searching because I really didn&#8217;t want to spend too much more time and/or money on this Charting need.  I was very lucky too.  I came across <a href="http://code.msdn.microsoft.com/mschart">Microsoft&#8217;s latest Charting Controls</a> (add-on to <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual Studio 2008</a>).  What&#8217;s even better is that as of VS 2010 and .NET Framework 4 it will be already incorporated so there won&#8217;t be any installation needed.  It did take me about a day to configure, get the data bound to it, make it pretty, etc&#8230;but this was the solution I ended up using.  And, it turned out to be a lot better&#8230;and much more visually appealing.  Here is the final:<br />
<img src="http://www.terryapodaca.com/wp-content/uploads/2010/08/chart3.png" alt="" title="chart3" width="600" height="305" class="alignnone size-full wp-image-790" /></p>
<p>My only other option would have been some Flash solution or Silverlight.  And if you know me very well, you know that I HATE Flash and/or Silverlight.  This is one time I can say Hurray for <a href="http://www.microsoft.com/en/us/default.aspx">Microsoft</a> this time. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.terryapodaca.com/2010/08/19/telerik-radchart-vs-mschart-microsoft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Undo-DiggBar and others&#8230;</title>
		<link>http://www.terryapodaca.com/2009/04/07/undo-diggbar-and-others/</link>
		<comments>http://www.terryapodaca.com/2009/04/07/undo-diggbar-and-others/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:33:10 +0000</pubDate>
		<dc:creator>Terry Apodaca</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.terryapodaca.com/?p=454</guid>
		<description><![CDATA[Nathan Smith over at Sonspring just reminded me of a great script to keep your site out of iframes and other mechanisms some sites use to pawn your content off as their own. &#60;script type="text/javascript"&#62; /* &#60;![CDATA[ */ if (window.location &#8230; <a href="http://www.terryapodaca.com/2009/04/07/undo-diggbar-and-others/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Nathan Smith over at <a href="http://sonspring.com/">Sonspring</a> just reminded me of a great script to keep your site out of iframes and other mechanisms some sites use to pawn your content off as their own.<br />
<code><br />
&lt;script type="text/javascript"&gt;<br />
/* &lt;![CDATA[ */<br />
if (window.location !== window.top.location) {<br />
    window.top.location = window.location;<br />
}<br />
/* ]]&gt; */<br />
&lt;/script&gt;<br />
</code><br />
Throw this inside your <code>head</code> tags and you should be pretty secure from having your content reused as someone else&#8217;s&#8230;etc.  <a href="http://sonspring.com/journal/keeping-digg-honest">Thanks Nathan, for the reminder</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.terryapodaca.com/2009/04/07/undo-diggbar-and-others/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>960 Grid System</title>
		<link>http://www.terryapodaca.com/2008/03/27/960-grid-system/</link>
		<comments>http://www.terryapodaca.com/2008/03/27/960-grid-system/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 15:48:54 +0000</pubDate>
		<dc:creator>Terry Apodaca</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.terryapodaca.com/2008/03/27/960-grid-system/</guid>
		<description><![CDATA[A wonderfully crafted and beautifully designed system to help any and all designers when it comes to Grid Designs/Layouts. Thanks for the awesome resource Nathan!!]]></description>
			<content:encoded><![CDATA[<p>A wonderfully crafted and beautifully designed system to help any and all designers when it comes to Grid Designs/Layouts.  Thanks for the awesome resource <a href="http://sonspring.com/">Nathan</a>!!</p>
<p><a href="http://960.gs/"><img src="http://960.gs/img/h1.gif" alt="960 Grid System" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.terryapodaca.com/2008/03/27/960-grid-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset or Reseed SQL Server IDENTITY Column</title>
		<link>http://www.terryapodaca.com/2008/03/04/reset-or-reseed-sql-server-identity-column/</link>
		<comments>http://www.terryapodaca.com/2008/03/04/reset-or-reseed-sql-server-identity-column/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 21:48:32 +0000</pubDate>
		<dc:creator>Terry Apodaca</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.terryapodaca.com/2008/03/04/reset-or-reseed-sql-server-identity-column/</guid>
		<description><![CDATA[I am sure this is well known by most of you, but I am a noob! and want to help other noobs out there that are like me. I needed to Create a new Cube today, and in the process &#8230; <a href="http://www.terryapodaca.com/2008/03/04/reset-or-reseed-sql-server-identity-column/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am sure this is well known by most of you, but I am a noob!  and want to help other noobs out there that are like me.  </p>
<p>I needed to Create a new Cube today, and in the process I figured we needed an &#8216;UNKNOWN&#8217; row for all those Unknown situations that could pop up in a Pivot table.  Well, when you create a Cube, most of your Dimension and Fact tables are driven off of Keys that you set as Identity.  Or at least this is how MS came to our shop and showed us how to do it.</p>
<p>Now, the problem here is Identity is READ-ONLY so our staging tables and Views could not properly add a &#8216;UNKNOWN&#8217; with a regular INSERT when trying to force that Identity value to -1.  Why negative one?  So that you will ALWAYS know that this is either an UNKNOWN or N/A.</p>
<p>So, here is what we did within the initial load of one of the Dimension tables:</p>
<p><code>TRUNCATE TABLE PM_DWT.dbo.Dim_Partnership<br />
SET IDENTITY_INSERT PM_DWT.dbo.Dim_Partnership ON<br />
GO<br />
INSERT INTO PM_DWT.dbo.Dim_Partnership (Partnership_Key,Partner_ID,Partnership_Name)<br />
	VALUES (-1,-1,'N/A')<br />
GO<br />
SET IDENTITY_INSERT PM_DWT.dbo.Dim_Partnership OFF<br />
GO<br />
DBCC CHECKIDENT (Dim_Partnership, RESEED, 0)<br />
GO<br />
INSERT INTO PM_DWT.dbo.Dim_Partnership (Partner_ID, Partnership_Name)<br />
	SELECT<br />
		 Partner_ID<br />
		,Partner_Name<br />
	FROM PM_Cluster.dbo.v_Dim_Partnership<br />
	ORDER BY Partner_ID<br />
GO</code></p>
<p>The above code will insert your first record for -1 and UNKNOWN.  Then it will enable the Identity column again.  What happens here though, is the Identity column see an entry, so it naturally wants to add one, so that your next value inserted will actually have 2.  We want to force it to restart even though we inserted a record. </p>
<p><code>DBCC CHECKIDENT (Dim_Partnership, RESEED, 0)<br />
GO</code> </p>
<p>Will do just that&#8230;so that the main INSERT will now begin at 1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.terryapodaca.com/2008/03/04/reset-or-reseed-sql-server-identity-column/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL: First and Last Day of Year</title>
		<link>http://www.terryapodaca.com/2008/01/29/sql-first-and-last-day-of-year/</link>
		<comments>http://www.terryapodaca.com/2008/01/29/sql-first-and-last-day-of-year/#comments</comments>
		<pubDate>Tue, 29 Jan 2008 14:57:34 +0000</pubDate>
		<dc:creator>Terry Apodaca</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.terryapodaca.com/2008/01/29/sql-first-and-last-day-of-year/</guid>
		<description><![CDATA[These lines of code will get you the First and Last day of the current year. SQL: SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0),'First Day of the Year' UNION SELECT DATEADD(dd,-1,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))),'Last Day of the Year' Results: 2008-01-01 00:00:00.000 First Day of the Year &#8230; <a href="http://www.terryapodaca.com/2008/01/29/sql-first-and-last-day-of-year/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These lines of code will get you the First and Last day of the current year.</p>
<p>SQL:<br />
<code><br />
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0),'First Day of the Year'<br />
UNION<br />
SELECT DATEADD(dd,-1,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))),'Last Day of the Year'<br />
</code></p>
<p>Results:<br />
<code>2008-01-01 00:00:00.000	First Day of the Year<br />
2008-12-31 00:00:00.000	Last Day of the Year</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.terryapodaca.com/2008/01/29/sql-first-and-last-day-of-year/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.288 seconds -->
