<?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>cpradio's tidbits of information &#187; Code</title>
	<atom:link href="http://cpradio.org/categories/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://cpradio.org</link>
	<description>my life experience and information that may help others find what they need</description>
	<lastBuildDate>Sat, 05 Sep 2009 12:38:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Local Printer Support via RDP (Remote Desktop)</title>
		<link>http://cpradio.org/personal/local-printer-support-via-rdp-remote-desktop/</link>
		<comments>http://cpradio.org/personal/local-printer-support-via-rdp-remote-desktop/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 00:39:27 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[printer]]></category>
		<category><![CDATA[rdesktop]]></category>

		<guid isPermaLink="false">http://cpradio.org/?p=165</guid>
		<description><![CDATA[For those wanting to support a local printer connected to their Linux system via RDP (Remote Desktop) connecting to a Windows server, here is a quick how-to.

First look up the Printer Name on your Linux box, it is best if it is a single word and under 20 characters.  You can typically find this [...]]]></description>
			<content:encoded><![CDATA[<p>For those wanting to support a local printer connected to their Linux system via RDP (Remote Desktop) connecting to a Windows server, here is a quick how-to.</p>
<ol>
<li>First look up the Printer Name on your Linux box, it is best if it is a single word and under 20 characters.  You can typically find this by opening a document, selecting Print and it should be the name in the drop down.</li>
<li>Next you will have a script that call rdesktop like so:<br />
<code>rdesktop -r printer:&lt;YOUR PRINTER NAME ON LINUX&gt;="WINDOWS DRIVER NAME AS IT APPEARS IN ADD PRINTER" &lt;YOUR SERVER IP ADDRESS&gt;</code></li>
<li>Run the rdesktop script and login</li>
<li>Go to Printers and Faxes</li>
<li>Right-click on the Printer that matches your Linux printer&#8217;s name and choose Properties</li>
<li>Print a test page!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/personal/local-printer-support-via-rdp-remote-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex and Flex Builder 3</title>
		<link>http://cpradio.org/personal/flex-and-flex-builder-3/</link>
		<comments>http://cpradio.org/personal/flex-and-flex-builder-3/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 00:39:42 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://cpradio.org/personal/flex-and-flex-builder-3/</guid>
		<description><![CDATA[I just have to tell everyone how cool Flex really is!  When I did flash work several years ago it was a real pain developing an entire site in Flash especially if you wanted to incorporate any backend to it.  This is definitely not the case with Flex and I have to give [...]]]></description>
			<content:encoded><![CDATA[<p>I just have to tell everyone how cool Flex really is!  When I did flash work several years ago it was a real pain developing an entire site in Flash especially if you wanted to incorporate any backend to it.  This is definitely not the case with Flex and I have to give Adobe its&#8217; props on this.</p>
<p>However, let me state, that I do want to see Flex Builder 3 ported to Linux.  I could then ditch my Windows Virtual Machine and run things natively, but that is my only complaint at this moment.</p>
<p><strong>So why do I love Flex?</strong><br />
Flex is just easy to use, the components built it are amazing and you have the ability to build components on your own too!  Much like Server Controls in .NET, .NET gives you a TON to begin with and you can create your own as well.  However, this is for Flash!  That is extremely important to acknowledge, as I do not have to have Macromedia Flash MX or whatever the latest version is on my PC to build a Flash application now.</p>
<p>Not only do I love being able to build a Flash application without Macromedia Flash, but I also love how it can work with an infinite number of backends without a lot of effort.  Got a web service you want to plugin to?  No problem, how about an RSS feed?  Again, No problem.  Well how about just a plain HTTP stream with a custom format?  No Problem!  I mean literally, you can plugin to any service that can send back a response.  If it is a custom type of response, then you can write a routine to read your custom format.  However, if you are using a Web Service, be in written in .NET and it returns an XML stream, then you literally have to do nothing!  It will read it without any custom code from you, the developer.  And that my friends is the &#8220;cream of the crop&#8221;.</p>
<p><strong>So where do we go from here?</strong><br />
I am going to be doing a lot of things with Flex fromt his point on.  I was just totally amazed by the simplicity and yet the complexity you can have within it.  I still have a lot to test.  Updating the grid&#8217;s data when it has changed, and similar events.  But time will tell and so far Adobe has bought me back with this wonderful technology.  Just bring it to Linux and I will move right next to your head-quarters Adobe!</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/personal/flex-and-flex-builder-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let the code work for you.</title>
		<link>http://cpradio.org/work/let-the-code-work-for-you/</link>
		<comments>http://cpradio.org/work/let-the-code-work-for-you/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 02:03:02 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[dynamic output]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/let-the-code-work-for-you/</guid>
		<description><![CDATA[The past two/three days (work days), I have been plagued with the task of working on a complex portion of a project.  The piece I am working on, I did not start, but I did write the foundation of it for 5 other projects and its&#8217; success and easy maintenance was largely due to [...]]]></description>
			<content:encoded><![CDATA[<p>The past two/three days (work days), I have been plagued with the task of working on a complex portion of a project.  The piece I am working on, I did not start, but I did write the foundation of it for 5 other projects and its&#8217; success and easy maintenance was largely due to how I designed it.</p>
<p>To keep a long story short, the architecture I used was not followed in this piece and now I am paying the price for something I didn&#8217;t do.  The original code was developed so the code would do 50-70% of the work for me dynamically.  Yes, this has performance cost implications but they were minimal (1-2 seconds at best), but the time it saves is nearly 60-75% of development time.</p>
<p>Now the particular piece I am referring to does a lot of output work.  It takes the data inputted by the user and develops a results page to the user describing the information the user typed.  Now, to make my life easier, I build a hash table of the user&#8217;s values and associate them with a code.  The code is related to a table that defines the text to display regarding that entry.</p>
<p>By creating code to associate the hash table data with the database table, the results page can be generated dynamically saving me the countless time of programming each possibility the user can come up with.</p>
<p>Thus, sometimes it is smarter to go a dynamic route at the cost of performance, than it is to develop the most efficient masterpiece you can imagine.</p>
<p>That is my food for thought.</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/work/let-the-code-work-for-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dual Monitors and window.open(): Part 2</title>
		<link>http://cpradio.org/code/javascript/dual-monitors-and-windowopen-part-2/</link>
		<comments>http://cpradio.org/code/javascript/dual-monitors-and-windowopen-part-2/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 23:54:26 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dual monitors]]></category>
		<category><![CDATA[window.open]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/dual-monitors-and-windowopen-part-2/</guid>
		<description><![CDATA[What? There is more?!  Of course.  Previously I tackled the horizontal setup of dual monitors, now we tackle the vertical!
So just like window.screenLeft versus window.screenX, window.screenTop only works in IE and window.screenY works in everything else.  So here is the code I used to setup a window.*property*:

// Find Top Boundary of current [...]]]></description>
			<content:encoded><![CDATA[<p>What? There is more?!  Of course.  Previously I tackled the horizontal setup of dual monitors, now we tackle the vertical!</p>
<p>So just like <code>window.screenLeft</code> versus <code>window.screenX</code>, <code>window.screenTop</code> only works in IE and <code>window.screenY</code> works in everything else.  So here is the code I used to setup a window.*property*:</p>
<pre class="js">
// Find Top Boundary of current Window
function FindTopWindowBoundary()
{
	// In Internet Explorer window.screenTop is the window's top boundry
	if (window.screenTop)
	{
		return window.screenTop;
	}

	// In Firefox window.screenY is the window's top boundry
	if (window.screenY)
		return window.screenY;

	return 0;
}

window.topWindowBoundary  = FindTopWindowBoundary;
</pre>
<p>Then just like the horizontal setup, I needed to find the Monitor&#8217;s Top Border.  Like the horizontal counter-part, you need to check the negative y-axis scenario, which left me with this code:</p>
<pre class="js">
// Find Top Boundary of the Screen/Monitor
function FindTopScreenBoundary()
{
	// Check if the window is off the primary monitor in a positive axis
	// X,Y                 S = Screen, W = Window
	// 0,0     ----------
	//        |          |
	//        |          |
	//        |        S |
	//         ----------
	// X,Y
	// 0,1280  ----------
	//        |  ---     |
	//        | | W |    |
	//        |  ---   S |
	//         ----------
	if (window.topWindowBoundary() > window.screen.height)
	{
		return window.topWindowBoundary() - (window.topWindowBoundary() - window.screen.height);
	}

	// Check if the window is off the primary monitor in a negative axis
	// X,Y                   S = Screen, W = Window
	// 0,-1024   ----------
	//          |  ---     |
	//          | | W |    |
	//          |  ---   S |
	//           ----------
	// X,Y
	// 0,0       ----------
	//          |          |
	//          |          |
	//          |        S |
	//           ----------
	// This only works in Firefox at the moment due to a bug in Internet Explorer opening new windows into a negative axis
	// However, you can move opened windows into a negative axis as a workaround
	if (window.topWindowBoundary() < 0 &#038;&#038; window.topWindowBoundary() > (window.screen.height * -1))
	{
		return (window.screen.height * -1);
	}

	// If neither of the above, the monitor is on the primary monitor whose's screen Y should be 0
	return 0;
}
</pre>
<p>So now that we have the Top and Left boundaries written, we can open a window in any setup (2 monitors to 4 monitors to X monitors) using the following and be guaranteed that the new window will open in the same monitor as the parent window (except for IE where IE will not open windows in a negative axis).</p>
<pre class="js">window.open(thePage, 'windowName', 'resizable=1, scrollbars=1, fullscreen=0, height=200, width=650, screenX=' + window.leftScreenBoundary() + ' , left=' + window.leftScreenBoundary() + ',screenY=' + window.topScreenBoundary() + ',top=' + window.topScreenBoundary() + ', toolbar=0, menubar=0, status=1');</pre>
<p>And thus the finale of opening a child window in a dual, quad, whatever monitor setup.</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/code/javascript/dual-monitors-and-windowopen-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dual Monitors and window.open()</title>
		<link>http://cpradio.org/code/javascript/dual-monitors-and-windowopen/</link>
		<comments>http://cpradio.org/code/javascript/dual-monitors-and-windowopen/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 23:43:10 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dual monitors]]></category>
		<category><![CDATA[window.open]]></category>

		<guid isPermaLink="false">http://cpradio.org/code/javascript/dual-monitors-and-windowopen/</guid>
		<description><![CDATA[Lately, I have been plagued with the complicated tasks of solving problems at work that require dual monitors.  However, I only have a single monitor.  Until Today!
Today, I got my PC setup with Dual Monitors and was asked to solve the following problem:
&#8220;When the user clicks on a link that opens a new [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I have been plagued with the complicated tasks of solving problems at work that require dual monitors.  However, I only have a single monitor.  Until Today!</p>
<p>Today, I got my PC setup with Dual Monitors and was asked to solve the following problem:</p>
<blockquote><p>&#8220;When the user clicks on a link that opens a new window using window.open.  Make the window appear on the same monitor as its&#8217; parent.&#8221;</p></blockquote>
<p>So I got started.  Quickly I discovered that <code>window.screenLeft</code> (for IE) and <code>window.screenX</code> (for everyone else) will tell me where the window&#8217;s border is on the desktop.  So what better to do than to throw that in a window.*property* which gave me this code:</p>
<pre class="js">
// Find Left Boundry of current Window
function FindLeftWindowBoundry()
{
	// In Internet Explorer window.screenLeft is the window's left boundry
	if (window.screenLeft)
	{
		return window.screenLeft;
	}

	// In Firefox window.screenX is the window's left boundry
	if (window.screenX)
		return window.screenX;

	return 0;
}

window.leftWindowBoundry = FindLeftWindowBoundry;
</pre>
<p>Next, I needed to find the monitor&#8217;s left border.  Soon after, I figured out that there is no property currently for this, however, you can get the width of the current monitor your window is on by using <code>window.screen.width</code>.  There is a big pitfall that needs to be considered, you can have a monitor whose left border starts with a negative X-axis (ie: -1024&#215;0 to 0&#215;768).</p>
<p>So that left with me the following code:</p>
<pre class="js">
// Find Left Boundry of the Screen/Monitor
function FindLeftScreenBoundry()
{
	// Check if the window is off the primary monitor in a positive axis
	// X,Y                  X,Y                    S = Screen, W = Window
	// 0,0  ----------   1280,0  ----------
	//     |          |         |  ---     |
	//     |          |         | | W |    |
	//     |        S |         |  ---   S |
	//      ----------           ----------
	if (window.leftWindowBoundry() > window.screen.width)
	{
		return window.leftWindowBoundry() - (window.leftWindowBoundry() - window.screen.width);
	}

	// Check if the window is off the primary monitor in a negative axis
	// X,Y                  X,Y                    S = Screen, W = Window
	// 0,0  ----------  -1280,0  ----------
	//     |          |         |  ---     |
	//     |          |         | | W |    |
	//     |        S |         |  ---   S |
	//      ----------           ----------
	// This only works in Firefox at the moment due to a bug in Internet Explorer opening new windows into a negative axis
	// However, you can move opened windows into a negative axis as a workaround
	if (window.leftWindowBoundry() < 0 &#038;&#038; window.leftWindowBoundry() > (window.screen.width * -1))
	{
		return (window.screen.width * -1);
	}

	// If neither of the above, the monitor is on the primary monitor whose's screen X should be 0
	return 0;
}

window.leftScreenBoundry = FindLeftScreenBoundry;
</pre>
<p>Now that the code is written, you can now use <code>window.open</code> to open a window on the monitor the parent window is on.</p>
<pre class="js">window.open(thePage, 'windowName', 'resizable=1, scrollbars=1, fullscreen=0, height=200, width=650, screenX=' + window.leftScreenBoundry() + ' , left=' + window.leftScreenBoundry() + ', toolbar=0, menubar=0, status=1');</pre>
<p>Oh yeah, IE has a bug in it that prevents opening windows with <code>window.open</code> in the negative X-axis.  You have to use <code>windowName.moveTo(-1024, 0);</code> to move it to the negative X-axis.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/code/javascript/dual-monitors-and-windowopen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON versus XML</title>
		<link>http://cpradio.org/work/json-versus-xml/</link>
		<comments>http://cpradio.org/work/json-versus-xml/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 00:01:00 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/json-versus-xml/</guid>
		<description><![CDATA[There has been much debate on using XML or JSON with your AJAX, but in my mind, the debate is pointless.  Both are nice, one is quicker, one is slower.  However, when it comes to development pick what you know best and what you can implement/maintain easiest.
If you do this, you are guaranteed [...]]]></description>
			<content:encoded><![CDATA[<p>There has been much debate on using XML or JSON with your AJAX, but in my mind, the debate is pointless.  Both are nice, one is quicker, one is slower.  However, when it comes to development pick what you know best and what you can implement/maintain easiest.</p>
<p>If you do this, you are guaranteed the following:</p>
<ol>
<li>It is easy to maintain and understand the code you wrote months later</li>
<li>Chances are your application will not be the quickest in response</li>
<li>You will make use of techniques you fully understand than trying to adapt ones that you are unfamiliar with and may implement wrong</li>
</ol>
<p>So how does JSON differ from returning XML in your AJAX requests?  Lets first look at the advantages of XML.</p>
<ol>
<li>Standardized and easily serialized into via .NET</li>
<li>The XML is easy to read all within itself</li>
<li>You can make use of XSLT, DTDs, etc</li>
</ol>
<p>How about disadvantages of XML?</p>
<ol>
<li>It is slow in comparison to JSON</li>
<li>It can be clumsy when not designed properly</li>
</ol>
<p>Now for the advantages of JSON:</p>
<ol>
<li>It is faster than XML to parse in JavaScript</li>
<li>There are addin&#8217;s you can install in .NET or a library in PHP to serialize a JSON string from an object</li>
<li>It is hard to make this clumsy as it is based on the Object Design</li>
</ol>
<p>And the disadvantages of JSON:</p>
<ol>
<li>It is harder to read the serialized output</li>
<li>You can&#8217;t use XSLT, DTDs, or something of the sort to validate or style the request</li>
</ol>
<p>As for myself, I am a JSON person.  I didn&#8217;t used to be though.  My original AJAX applications were focused around XML primarily because I could make use of an XSLT and I always validated against a schema.  However, JSON has won me over due to speed.  JSON&#8217;s speed is just ridiculously fast and it showed when I converted a major application over to it.  I saved nearly a third of the time it took to do a fairly simple task.</p>
<p>However, pick the poison that you understand most, otherwise, it could have detrimental affects.</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/work/json-versus-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactoring &#8211; What a time-saver</title>
		<link>http://cpradio.org/work/refactoring-saves-you-time-in-many-ways/</link>
		<comments>http://cpradio.org/work/refactoring-saves-you-time-in-many-ways/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 02:52:52 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[kiosk]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/refactoring-saves-you-time-in-many-ways/</guid>
		<description><![CDATA[This weekend has been a nice relaxing weekend for me and so when I got back home this afternoon (on Sunday the 16th), I was in a great mood to refactor some of my kiosk code base.  Now, I should start by saying, I decided to refactor code instead of write new code tonight [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend has been a nice relaxing weekend for me and so when I got back home this afternoon (on Sunday the 16th), I was in a great mood to refactor some of my kiosk code base.  Now, I should start by saying, I decided to refactor code instead of write new code tonight because I wanted to lessen the number of files that needed to load in the Ajax functionality.</p>
<p>Kiosk, uses Ajax in interesting ways to provide a better experience, but with that, the Ajax applications were built as each page was assembled.  This caused functionality across pages to get a bit messy or functionality shared across pages to get thrown into individual files.  Well the problem with individual files, is that is yet another file for the browser to download.</p>
<p>So before I get any further, let me discuss refactoring and how it can solve many performance binds your application may be experiencing.</p>
<p>To start off, refactoring is taking common code, or code that is used across pages or frequently and moving it to a more global location so it can be called easier and the code only has to be written once.</p>
<p>So where can this help?</p>
<ul>
<li>First of all, by refactoring code into a single global file, you can limit the number of HTTP requests if that file is accessible via the web.  Since your common code is in a single file, the browser only has to fetch that code once, and will then likely cache that file for each page after, giving you even better performance.</li>
<li>Secondly, by placing the common code in a global method/function, you are writing less code.  As now when you need to call that code on your second page, it is already written, so just call the function.  Otherwise, you would need to write the code all over again.</li>
<li>Thirdly, less code equals smaller files.  By refactoring your code, you can have smaller file sizes and in turn that is quicker to download, quicker to parse, and quicker to execute.</li>
</ul>
<p>Now in my situation, I took about 4 JavaScript files and combined them into a single file adequately named &#8220;general.js&#8221;.  The file contained code to automatically log the user out after a set amount of inactivity in the UI (User Interface).  Secondly, it contained the version checking mechanism calls that see if they are running the latest version of the software.  Unfortunately, those are the only two things it does right now, but as the project progresses, I am sure more utilities will get added in this file.</p>
<p>My next task is to refactor the Data Grid functionality so it is 1) XHTML, 2) easy to build complex columns with complex rows, 3) customizable by identifying StyleSheet classes for the columns and rows.  Hopefully, I can get my head around this idea and get it working with little trouble to the programmer.</p>
<p>So what can you think of that you need to refactor?  What performance gains do you suspect you will achieve with the refactoring you do?  Any performance markers?</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/work/refactoring-saves-you-time-in-many-ways/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Harness Server Controls</title>
		<link>http://cpradio.org/work/harness-server-controls/</link>
		<comments>http://cpradio.org/work/harness-server-controls/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 01:41:03 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/harness-server-controls/</guid>
		<description><![CDATA[When you write a Server Control and write it well, it pays off immensely.  Today, I needed to rework our Custom Defaults screen (a screen that allows each user to define defaults for our quoting screens to use each time they write a new quote).  All of the fields on the Custom Defaults [...]]]></description>
			<content:encoded><![CDATA[<p>When you write a Server Control and write it well, it pays off immensely.  Today, I needed to rework our Custom Defaults screen (a screen that allows each user to define defaults for our quoting screens to use each time they write a new quote).  All of the fields on the Custom Defaults screen exist in the quote (duh, why would we provide something that didn&#8217;t? <img src='http://cpradio.org/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).  </p>
<p>Since everything in the quote is a server control, it was just drag and drop the controls onto the Custom Default page and it would act 100% like it does in the quote. <img src='http://cpradio.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />   It could not have gone any faster, I probably only spent close to 5 minutes setting up the design and flow and 30 minutes getting the code behind functionality to work.</p>
<p>Thus, harness the power of Server Controls as they can be reused across numerous applications with little trouble and little programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/work/harness-server-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ViewState, is it working properly?</title>
		<link>http://cpradio.org/work/viewstate-is-it-working-properly/</link>
		<comments>http://cpradio.org/work/viewstate-is-it-working-properly/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 00:59:10 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://cpradio.org/work/viewstate-is-it-working-properly/</guid>
		<description><![CDATA[Today, Aaron and I were wondering if ViewState actually works properly in .NET.  For example, in .NET you have the option to disable ViewState in the web.config file, the page directive, or on each control individually.  However, using any of the three methods or any combination continuously results in &#8220;__VIEWSTATE&#8221; appearing as a [...]]]></description>
			<content:encoded><![CDATA[<p>Today, Aaron and I were wondering if ViewState actually works properly in .NET.  For example, in .NET you have the option to disable ViewState in the web.config file, the page directive, or on each control individually.  However, using any of the three methods or any combination continuously results in &#8220;__VIEWSTATE&#8221; appearing as a hidden field in the form!</p>
<p>The problem gets worse when you try to submit the form to another page by overriding the form&#8217;s action.  This throws an &#8220;ViewState is corrupt or invalid for this page.&#8221; error.  We finally got around it by hacking a JavaScript event to empty the &#8220;__VIEWSTATE&#8221; hidden field so it had nothing in it before the form actually submitted the page.  But is that the only way to get rid of ViewState?</p>
<p>Code to cause ViewState corruption:</p>
<pre class="js">&lt;script type="text/javascript"&gt;
    window.onload = function()
    {
        document.getElementById('Form1').onsubmit = function()
        {
            document.getElementById('Form1').action = '/another_project/another_page.aspx';
        }
    }
&lt;/script&gt;</pre>
<p>How, we got around it:</p>
<pre class="js">&lt;script type="text/javascript"&gt;
    window.onload = function()
    {
        document.getElementById('Form1').onsubmit = function()
        {
            var inputFields = document.getElementsByTagName('input');
            for (var i = 0; i < inputFields.length; i++)
            {
                if (inputFields[i].name.toUpperCase() == "__VIEWSTATE")
                {
                    inputFields[i].value = ""; // Empty the ViewState hidden field to stop it from carrying on to the next page
                    break;
                }
            }

            document.getElementById('Form1').action = '/another_project/another_page.aspx';
        }
    }
&lt;/script&gt;</pre>
<p>Anyone else have a problem like this?</pre>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/work/viewstate-is-it-working-properly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax versus Socket Connections</title>
		<link>http://cpradio.org/code/javascript/ajax-versus-socket-connections/</link>
		<comments>http://cpradio.org/code/javascript/ajax-versus-socket-connections/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 23:55:02 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://cpradio.org/code/javascript/ajax-versus-socket-connections/</guid>
		<description><![CDATA[Ever have to argue Ajax versus Socket Connections?  Me either.  Today, I had the chance to talk about the differences, their advantages and their disadvantages.
Ajax has many advantages.  You do not have to parse content/page headers, you can parse XML, you can build objects out of JSON serializations, and above all there [...]]]></description>
			<content:encoded><![CDATA[<p>Ever have to argue Ajax versus Socket Connections?  Me either.  Today, I had the chance to talk about the differences, their advantages and their disadvantages.</p>
<p>Ajax has many advantages.  You do not have to parse content/page headers, you can parse XML, you can build objects out of JSON serializations, and above all there are a lot of frameworks that are cross-browser friendly so you do not have to worry about writing the framework yourself.</p>
<p>A Socket Connections&#8217; advantages are much smaller in my opinion.  There is no browser limitations, which is a major advantage, keeping it browser independent.  It can support any type of response content, JSON serializations, XML, HTML, strings, etc.</p>
<p>So what about the disadvantages?  Ajax has the complications of cross-browser friendliness, but that has been removed by frameworks doing all that hard work for us.  Ajax&#8217;s biggest disadvantage is probably the lack of JavaScript standards being followed by each browser.  Though this is removed by using popular frameworks, it matters for the rest of your JavaScript code to setup the Ajax event.</p>
<p>So how about Socket Connections?  Socket Connection have the complication of trying to figure out where the response data starts and where the response headers end.  Secondly, they are language dependent.  Not all languages support sockets and some may make it very complicated to use them though, whereas, Ajax is getting easier and easier to use.</p>
<p>What are your thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://cpradio.org/code/javascript/ajax-versus-socket-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

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