<?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>Logan Buesching &#187; Development</title>
	<atom:link href="http://agoln.net/archives/category/development/feed" rel="self" type="application/rss+xml" />
	<link>http://agoln.net</link>
	<description>Development and personal site</description>
	<lastBuildDate>Thu, 09 Sep 2010 21:01:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Resource Hacker Can&#8217;t Export Binary Resources</title>
		<link>http://agoln.net/archives/223</link>
		<comments>http://agoln.net/archives/223#comments</comments>
		<pubDate>Fri, 28 Aug 2009 01:06:00 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/223</guid>
		<description><![CDATA[So I came across a rather interesting problem today.&#160; Basically, I need to embed a Microsoft Cabinet file into an executable.&#160; This is done in an automated type of way, so in order to verify that it got embedded correctly, I used Resource Hacker to open the EXE, and export the resource.&#160; Looking at what [...]]]></description>
			<content:encoded><![CDATA[<p>So I came across a rather interesting problem today.&#160; Basically, I need to embed a <a href="http://en.wikipedia.org/wiki/Cabinet_(file_format)">Microsoft Cabinet</a> file into an executable.&#160; This is done in an automated type of way, so in order to verify that it got embedded correctly, I used <a href="http://angusj.com/resourcehacker/">Resource Hacker</a> to open the EXE, and export the resource.&#160; Looking at what Resource Hacker spit out seems like it got embedded OK. </p>
<p><a href="http://agoln.net/wp-content/uploads/2009/08/reshacker1.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="ResHacker-1" border="0" alt="ResHacker-1" src="http://agoln.net/wp-content/uploads/2009/08/reshacker1-thumb.png" width="471" height="57" /></a>&#160;&#160; </p>
<p>I then exported the resource to disk to ensure that the cabinet archive contained the file I embedded into it.&#160; When I went to open the .cab file, it didn&#8217;t seem to have any entries in it, and WinRar gave an error when trying to open the file.&#160; Weird, I thought.&#160; So, for fun, I opened the file in Notepad to only notice that it <em>literally</em> saved the text as it was shown in the hex editor.&#160; </p>
<p>&#160;<a href="http://agoln.net/wp-content/uploads/2009/08/reshacker2.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="ResHacker-2" border="0" alt="ResHacker-2" src="http://agoln.net/wp-content/uploads/2009/08/reshacker2-thumb.png" width="458" height="118" /></a></p>
<p>What a weird bug!</p>
<p>I ended up opening the exe in VS2008, exporting the resource from there and verifying it.&#160; Here is what opening it in notepad looks like.</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/08/reshacker3.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="ResHacker-3" border="0" alt="ResHacker-3" src="http://agoln.net/wp-content/uploads/2009/08/reshacker3-thumb.png" width="454" height="160" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/223/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing SQL Server 2008 Express Edition</title>
		<link>http://agoln.net/archives/211</link>
		<comments>http://agoln.net/archives/211#comments</comments>
		<pubDate>Tue, 05 May 2009 06:34:00 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/211</guid>
		<description><![CDATA[I have been wanting to get back into developing my big project I did in my college years, which was basically a LAMP application.&#160; This time, I wanted to set it up as a WIMP environment (har har harrrr, wimp).&#160; All went pretty well until I tried to install SQL Server 2008 Express Edition. Prerequisites [...]]]></description>
			<content:encoded><![CDATA[<p>I have been wanting to get back into developing my big project I did in my college years, which was basically a LAMP application.&#160; This time, I wanted to set it up as a WIMP environment (har har harrrr, wimp).&#160; All went pretty well until I tried to install SQL Server 2008 Express Edition.</p>
<h2>Prerequisites</h2>
<p>When I started the installation, I was informed that I needed .net 3.5 SP1.&#160; So I went and got it, rebooted my machine, then re-ran the installation.&#160; Then I was told I needed Windows Installer 4.5.&#160; Once again, I got the installation, rebooted, and started the installation.&#160; A third time, during the installation, I was notified that I needed PowerShell!&#160; Although the UI for showing me I needed PowerShell was much nicer, it was extremely annoying to have to run the installer three times and reboot my machine twice before I finally had all of the prerequisites.</p>
<h2>Installing</h2>
<p>My machine is running out of space on my C:\ drive, so I wanted to install on my D:\ drive.&#160; So I change the drive and find the following errors:</p>
<p>&#160;<a href="http://agoln.net/wp-content/uploads/2009/05/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb.png" width="423" height="102" /></a> <a href="http://agoln.net/wp-content/uploads/2009/05/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb1.png" width="425" height="102" /></a></p>
<p>&#160;</p>
<p>What the hell are these errors? I mean, I realize that when I told the installer to create a directory it may not have the attributes the installer wants, but can’t the installer set those attributes?&#160; And INSTANCESHAREDWOWDIR? Wow, that’s an ambiguous error.&#160; So I decide to bite the bullet and install in the default directory.&#160; I cancel out and low and behold!</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb2.png" width="415" height="315" /></a> </p>
<p>The installation link has become disabled!&#160; So now I have to close the entire installer and reopen it, how fun!&#160; But wait, there’s more!&#160; When I attempt to reopen the installer, I get another friendly error!</p>
</p>
</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb3.png" width="398" height="163" /></a>&#160;</p>
<p>I assume it has something to do with the eight setup processes that are running, consuming over 250MB of RAM</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb4.png" width="410" height="102" /></a> </p>
<p>I finally get to run the installer, I give up and let it try to install on the C:\ drive, so finally I am at “Server Configuration” where I am told to enter my service accounts.&#160; Again, I get another error</p>
</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb5.png" width="389" height="92" /></a> </p>
<p>For some reason it says I have invalid credentials, but let’s take a look at the install window. (My emphasis highlighted in the below picture)</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb6.png" width="412" height="312" /></a> </p>
<p>Very nicely done SQL Server 2008.&#160; Tell me to click help for more information… <strong>WHEN THERE IS NO HELP LINK</strong>.&#160; Apparently I had to set up the account in the upper dialog, and not the lower one.</p>
<p>So now I’m just one step away from “ready to install”.&#160; My nightmare will be over!&#160; And guess what happens? You guessed it, ANOTHER ERROR!</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/05/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/05/image-thumb7.png" width="400" height="181" /></a> </p>
<p>Apparently, there was another prerequisite that I needed to install that it failed to tell me about!</p>
<p>In the end, I just ended up installing <a href="http://mysql.com/">MySQL</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/211/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IHTMLDocument2 hyperlinks open in new window</title>
		<link>http://agoln.net/archives/193</link>
		<comments>http://agoln.net/archives/193#comments</comments>
		<pubDate>Thu, 30 Apr 2009 03:06:04 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/193</guid>
		<description><![CDATA[I spent (most) of the day at work today trying to figure out why my IHTMLDocument2&#8242;s hyperlinks were opening in new windows, instead of the current window it was in. Finally, I stumbled upon this: Resolving Hyperlinks. By the time anyone reads this, MSDN will probably have changed the link structure, so I&#8217;ll also explain [...]]]></description>
			<content:encoded><![CDATA[<p>I spent (most) of the day at work today trying to figure out why my IHTMLDocument2&#8242;s hyperlinks were opening in new windows, instead of the current window it was in.  Finally, I stumbled upon this:<br />
<a href="http://msdn.microsoft.com/en-us/library/bb508516(VS.85).aspx#Resolving_Hyperlinks">Resolving Hyperlinks</a>.</p>
<p>By the time anyone reads this, MSDN will probably have changed the link structure, so I&#8217;ll also explain it here:<br />
<quote>If a user clicks a link within an HTML page viewed in MSHTML, MSHTML calls the HlinkNavigate function (after implementing an IHlink interface). If the host does not implement IHlinkFrame, this function launches a separate application to follow the hyperlink.</quote></p>
<p>Wow, that was frustrating!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/193/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Be scared of doing arithmetic</title>
		<link>http://agoln.net/archives/183</link>
		<comments>http://agoln.net/archives/183#comments</comments>
		<pubDate>Tue, 13 Jan 2009 00:40:46 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/183</guid>
		<description><![CDATA[Without a doubt, reading Secure Coding in C and C++ made me quite scared of coding securely.&#160; In particular, all the ways you can mess up integer security.&#160; Ever since I had read that book, it has given me a whole new perspective on things to look out for and security problems that can arise.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Without a doubt, reading <a title="Secure Coding in C and C++" href="http://www.cert.org/books/secure-coding/moreinfo.html">Secure Coding in C and C++</a> made me quite scared of coding securely.&#160; In particular, all the ways you can mess up <a title="Chapter 5. Integer Security" href="http://www.informit.com/content/images/0321335724/samplechapter/seacord_ch05.pdf">integer security</a>.&#160; Ever since I had read that book, it has given me a whole new perspective on things to look out for and security problems that can arise.&#160; Lets take a look at what’s going to be a future interview question I’m going to ask people.
</p>
<pre>
// Returns true if set, false if not set
bool ToDecimal(char* string, unsigned long* pdw)
{
    char* end = NULL;
    unsigned long dw = <a title="Returns signed long" href="http://msdn.microsoft.com/en-us/library/w4z2wdyc.aspx">strtol</a>(string, &amp;end, 10);
    if ( dw == LONG_MAX || dw == LONG_MIN
     || (dw == 0 &amp;&amp; wzEnd=string) )
    {
        return false;
    }
    *pdw = dw;
    return true;
}</pre>
</p>
<p>Find the bug!</p>
<p>So what’s wrong with this code? Hint: many things are wrong (which is why I like it), but I’m speaking of what’s relevant to my post. Well, <a title="Returns signed long" href="http://msdn.microsoft.com/en-us/library/w4z2wdyc.aspx">strtol</a> happens to return a signed integer, not an unsigned integer.&#160; What happens if –1 is passed in?&#160; Well, strtol will return –1 (and on most machines it’s represented as 0xffffffff).&#160; The compiler will then stick it into the unsigned long and away they go!</p>
</p>
<pre>int main()
{
    //Sploits!
    unsigned long age = 25;
    unsigned long brosAge = 0;
    char* theInput = &quot;-1000&quot; //Nasty input
    if (ToDecimal(theInput, &amp;brosAge))
    {
        printf(&quot;My age + my brothers age = %d&quot;,
		(age+brosAge)); //4294966320
    }
}</pre>
<p>In my theoretical program, it’s hardly a problem, but what happens if I reserved a buffer, was doing pointer arithmetic, or something else that could cause serious damage?&#160; This could have just become an entry point into a security hole.&#160; So please, check your signs!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/183/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>An Overview of the Windows Live Installer</title>
		<link>http://agoln.net/archives/130</link>
		<comments>http://agoln.net/archives/130#comments</comments>
		<pubDate>Thu, 08 Jan 2009 06:51:07 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/?p=130</guid>
		<description><![CDATA[Over the past six months, I have been working on the Windows Live Installer, and I thought some readers of my blog would like to know some of the technical details that are involved in creating our installer. View Full Album Overview For those that use Linux, our installer is similar to a package manager. [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past six months, I have been working on the Windows Live Installer, and I thought some readers of my blog would like to know some of the technical details that are involved in creating our installer.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:66721397-FF69-4ca6-AEC4-17E6B3208830:dab2c8b5-b1d4-4289-b168-f691bfc68381" class="wlWriterEditableSmartContent"><a style="border:0px" href="http://cid-382c17ab51531387.skydrive.live.com/redir.aspx?page=browse&amp;resid=382C17AB51531387!214&amp;ct=photos"><img style="border:0px" alt="View Installer Photos" src="http://agoln.net/wp-content/uploads/2008/12/inlinerepresentationdb98f87ab22e44ba849df28186af7b05.jpg" /></a>
<div style="width:400px;text-align:right;" ><a href="http://cid-382c17ab51531387.skydrive.live.com/redir.aspx?page=browse&amp;resid=382C17AB51531387!214&amp;ct=photos">View Full Album</a></div>
</div>
<h2>Overview</h2>
<p>For those that use Linux, our installer is similar to a package manager. Each product team creates a package (usually installed via MSI), and a collection of packages is described in the catalog.</p>
<p style="padding-bottom: 0px">Some of the cooler features include the following: </p>
<ul style="margin-top: 0px; padding-top: 0px">
<li>Completely data driven by the catalog and configuration. </li>
<li>Full rule engine to exclude or include packages and products given a condition (os, service pack, specific software version installed, etc…) </li>
<li>Robust downloading of packages. </li>
<li>Transactional installation of packages and dependencies. </li>
<li>Reducing the number of reboot’s necessary. </li>
</ul>
<h2>Catalog, Configuration, and Rule Processing</h2>
<p>What I have worked on the most was the catalog, configuration and rule processing.&#160; When the installer starts up, the first thing that it does is process the catalog and determine which products are applicable for installation or upgrade.&#160; Rules are processed which determine weather or not a product can be installed.</p>
<p>Part of the catalog processing is to load the configuration.&#160; This was the first thing that I worked on when I started.&#160; If you look at the resources inside of the executable, you will notice items such as CONFIG0, CONFIG1, etc… Each of these configurations will be loaded at runtime in the order listed, with newer configuration files overriding the previous settings.&#160; This allows us to easily change some settings for different languages or builds, without having to change anything in the code.&#160; These may include reversing the text for right-to-left languages, choosing which products from the catalog to be displayed, or not having a checkbox checked by default due to privacy laws.</p>
<p>For the beta, users of Windows XP may see long startup times.&#160; This is due to one of the products needing to find out if a certain hotfix is installed.&#160; In order to check and see if these hotfixes are installed, we must make a <a href="http://msdn.microsoft.com/en-us/library/aa394582.aspx"><acronym title="Windows Management Instrumentation">WMI</acronym></a> query, which for some reason or another is very, very slow on certain machines.&#160; For the final release, the product was able to check for this information itself and we were able to remove the queries.</p>
<p>Part of our installer was to introduce a robust downloader that can download packages in the background and be resistant to network connectivity issues.&#160; We also wanted to make sure that if we have partially downloaded a product, we can resume from where we left off.&#160; Although the number of 56k users has dwindled in the US, there are still many people with slow connections, or pay per-kilobyte that we need to create a good user experience.</p>
<h2>Transactional Installation</h2>
<p>Part of the installation of the products includes a feature that allows us to install packages using transactions.&#160; In the past (and in early internal releases of the installer), if a user had cancelled the installation, then we could only rollback the current package that is being installed.&#160; So for Windows Live Messenger, if it installed a dependency and then started to install messenger, then the user cancelled it, we would only rollback the installation of messenger and leave the dependency.&#160; With our transactional installer, we are able to have the rollback chain go as many packages back as we need to for the transaction.&#160; This ensures that the user does not have incompatible dependencies after installation.</p>
<h2>Reboot Reduction</h2>
<p>Everybody hates to reboot their computer after installing a product.&#160; Unfortunately in a lot of cases and the current state of Windows, we must live with the fact that reboots are necessary.&#160; One of the items we worked on in this release was to reduce the number of people who needed to reboot their computer.&#160; Through closing certain applications while installing the Windows Live products, we are able to prevent reboot’s.</p>
<p>One major change to this feature between the beta and the final release was the UI associated with it.&#160; For the beta, the installer would check for files in use when the user selected the applications to install.&#160; This may have lead to a long pause where the user would believe that the applications was frozen.</p>
<p><a href="http://agoln.net/wp-content/uploads/2008/12/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Select Programs BETA" border="0" alt="Select Programs BETA" src="http://agoln.net/wp-content/uploads/2008/12/image-thumb.png" width="244" height="208" /></a>&#160;</p>
<p>After checking for files in use, the installer did not give the option for users to leave their applications open, it only showed a list of applications it was going to close.</p>
<p><a href="http://agoln.net/wp-content/uploads/2008/12/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Files In Use BETA" border="0" alt="Files In Use BETA" src="http://agoln.net/wp-content/uploads/2008/12/image-thumb1.png" width="244" height="209" /></a>&#160;</p>
<p>For the final release, we implemented a progress bar while checking for files in use (with the option to skip the check), and allowed the user to manually close the applications which have files in use.</p>
</p>
</p>
</p>
<p><a href="http://agoln.net/wp-content/uploads/2008/12/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Files In Use RELEASE" border="0" alt="Files In Use RELEASE" src="http://agoln.net/wp-content/uploads/2008/12/image-thumb2.png" width="209" height="177" /></a> <a href="http://agoln.net/wp-content/uploads/2008/12/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Files In Use RELEASE" border="0" alt="Files In Use RELEASE" src="http://agoln.net/wp-content/uploads/2008/12/image-thumb3.png" width="208" height="177" /></a> </p>
<h2></h2>
</p>
<h2>Questions?</h2>
<p>That’s about all that I can think of to cover.&#160; What do you want to know about the installer? Any features you want to see implemented?</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/130/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alice Does, or It Does?</title>
		<link>http://agoln.net/archives/129</link>
		<comments>http://agoln.net/archives/129#comments</comments>
		<pubDate>Mon, 25 Aug 2008 20:41:19 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/129</guid>
		<description><![CDATA[Over the past few weeks while developing the next version of the Windows Live Installer, I have had discussions with other developers over different parts of the system.&#160; Each and every time we have some part of the software to discuss, I am always torn on how to describe what the software does.&#160; Should I [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few weeks while developing the next version of the Windows Live Installer, I have had discussions with other developers over different parts of the system.&#160; Each and every time we have some part of the software to discuss, I am always torn on how to describe what the software does.&#160; Should I say something like “<strong>The engine</strong> does X, Y, then Z” or should it be “<strong>Alice’s code</strong> does X, Y, then Z”.&#160; </p>
<p>I’m pretty sure that I have settled on “The Engine” instead of saying the developer who wrote the code. What does everyone out there think?</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/129/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio Cannot Enumerate Resources in the Executable</title>
		<link>http://agoln.net/archives/127</link>
		<comments>http://agoln.net/archives/127#comments</comments>
		<pubDate>Thu, 31 Jul 2008 20:58:06 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/127</guid>
		<description><![CDATA[Ever get the following error message when opening a PE file? Turns out that if you have custom resource types, the names of the resources in that type cannot be lower case. As you see in this example, my resources begin with an upper case P.&#160; Visual Studio will cry if you embed these resources [...]]]></description>
			<content:encoded><![CDATA[<p>Ever get the following error message when opening a <acronym name="Portable Executable">PE</acronym> file?</p>
<p><a href="http://agoln.net/wp-content/uploads/2008/07/vsresources.jpg"><img title="Cannot enumerate resources in the executable" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="115" alt="Cannot enumerate resources in the executable" src="http://agoln.net/wp-content/uploads/2008/07/vsresources-thumb.jpg" width="240" border="0" /></a> </p>
<p>Turns out that if you have custom resource types, the names of the resources in that type cannot be lower case.</p>
<p><a href="http://agoln.net/wp-content/uploads/2008/07/resources.jpg"><img title="Portable Executable resources" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="141" alt="Portable Executable resources" src="http://agoln.net/wp-content/uploads/2008/07/resources-thumb.jpg" width="193" border="0" /></a> </p>
<p>As you see in this example, my resources begin with an upper case P.&#160; Visual Studio will cry if you embed these resources with a lower case P.</p>
<p>Thank you, Visual Studio, for making my work week <em>that</em> much longer…</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/127/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running AIR applications w/o installing AIR on Linux</title>
		<link>http://agoln.net/archives/106</link>
		<comments>http://agoln.net/archives/106#comments</comments>
		<pubDate>Fri, 02 May 2008 08:13:29 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/?p=106</guid>
		<description><![CDATA[Recently, Adobe released an AIR client for Linux. Some people complained about the need for root privileges for not only installing AIR itself, but also for installing AIR applications. If you are worried about providing your root password to a binary, here is a work around. Download the AIR SDK Unzip the AIR SDK Download [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Adobe released an <a href="http://labs.adobe.com/downloads/air_linux.html">AIR client for Linux</a>.  Some people <a href="http://www.splitbrain.org/blog/2008-04/18-adobe_air_on_linux-a_security_nightmare">complained about the need for root privileges</a> for not only installing AIR itself, but also for installing AIR applications.  If you are worried about providing your root password to a binary, here is a work around.</p>
<ol>
<li>Download the <a href="http://download.macromedia.com/pub/labs/air/linux/adobeair_linux_sdk_a1_033108.tbz2">AIR SDK</a></li>
<li>Unzip the AIR SDK</li>
<li>Download your <a href="http://funkatron.com/spaz">favorite AIR application</a></li>
<li>Unzip the .AIR file (yes, unzip it)</li>
<li>/path/to/air_sdk/bin/adl -nodebug /path/to/air_application/META-INF/AIR/application.xml /path/to/air_application</li>
</ol>
<p>For example, if you were to unzip the AIR sdk to ~/AIR-SDK and unzip Spaz to ~/spaz, the command for #5 would be </p>
<p>~/AIR-SDK/bin/adl -nodebug ~/spaz/META-INF/AIR/application.xml ~/spaz/</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/106/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Zend_Pdf_Cell Proposal</title>
		<link>http://agoln.net/archives/99</link>
		<comments>http://agoln.net/archives/99#comments</comments>
		<pubDate>Thu, 20 Mar 2008 03:00:15 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/99</guid>
		<description><![CDATA[After a few weeks of downtime, and helpful input and comments from my readers, I have finally submitted my Zend_Framework CLA and authored a Zend_Pdf_Cell proposal! Please feel free to read it and comment on any of the functionality! I really hope that this can get integrated within the Zend Framework, as I have put [...]]]></description>
			<content:encoded><![CDATA[<p>After a few weeks of downtime, and helpful input and comments from my readers, I have finally submitted my Zend_Framework CLA and authored <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Pdf_Cell+-+Logan+Buesching" title="Proposal">a Zend_Pdf_Cell proposal</a>!  Please feel free to read it and comment on any of the functionality!  I really hope that this can get integrated within the Zend Framework, as I have put a lot of time into this and hope that the community can gain as much as possible from it.</p>
<p>I want to give everyone a great big thanks for the valuable feedback and excellent encouragement!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/99/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing An Active Record Class</title>
		<link>http://agoln.net/archives/98</link>
		<comments>http://agoln.net/archives/98#comments</comments>
		<pubDate>Wed, 19 Mar 2008 14:45:27 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[EPICS]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/98</guid>
		<description><![CDATA[As the Active Record class has become increasingly popular due to it&#8217;s wild success in Ruby on Rails, it seems as though every framework has an implementation of it. It is no surprise that inside the covers of the MyEPICS framework lives an active record class that I had created. This class has evolved and [...]]]></description>
			<content:encoded><![CDATA[<p>As the <a href="http://en.wikipedia.org/wiki/Active_record_pattern" title="Wikipedia Active Record Article">Active Record</a> class has become increasingly popular due to it&#8217;s wild success in Ruby on Rails, it seems as though every framework has an implementation of it.  It is no surprise that inside the covers of the <a href="http://ims.ecn.purdue.edu/">MyEPICS framework</a> lives an active record class that I had created.  This class has evolved and changed over time, which I am going to share my experiences writing it.  It is far from finished, but it has been quite a great learning experience along the way.</p>
<h2>2.0 Implementation</h2>
<p>The MyEPICS 2.0 implementation contained one master database class (<acronym title="MyEPICS Database">ME_DB</acronym>) which contained generic <acronym title="Create Read Update Delete">CRUD</acronym> functions, and each table contained its own class which would implement the specific <acronym title="Create Read Update Delete">CRUD</acronym> functions for each table (<acronym title="MyEPICS Database Object">ME_DBO</acronym>).  A sample way to read users with the name &#8216;bob&#8217; would be the following:<br />
<code><br />
$user=new ME_DBO_User();<br />
$user->read(array('name'=>'bob'));<br />
</code><br />
And to update a person&#8217;s last name to &#8220;foobar&#8221;, you would do the following:<br />
<code><br />
$user->lastname="foobar";<br />
$user->update();<br />
</code><br />
About 90% of each of the ME_DBO classes were the same code, and there was even a script to create a DBO class given a SQL create statement.  A major problem with this approach is that for every new table created, you needed to make sure you created a new ME_DBO file, and that the file really only contained such things as which columns were in the table and their default values.  We would have about 2k lines of code between 30 files, of which only about 50 lines were different&#8230; YUCK!  Over Christmas break, I decided that this was a major, major issue that needed to be worked out before MyEPICS 2.1.</p>
<h2>MyEPICS 2.1 Implementation</h2>
<p>With the 2.1 implementation, I took a step back and attempted to create two classes which would fix the pitfalls of the 2.0 implementation.  What I ended up doing was using <a href="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Reverse_Common.html">MBD2&#8242;s reverse engineering module</a> in order to find out which fields were available and what their default values were.  This reduced the need for a separate file for each table and removed about 1500 lines of code from the Active Record implementation.  Now, instead of<br />
<code><br />
$user=new ME_DBO_User();<br />
</code><br />
You would do this instead<br />
<code><br />
$user=ME_Db::factory('User');<br />
</code><br />
This has the main database create a Dbo object with just the right properties that you need.</p>
<p>The only major gripe I have with the current implementation is that I don&#8217;t implement anything for relationships.  If you need information from a relationship, then you have three options.</p>
<ol>
<li>Cry</li>
<li>Write Manual SQL</li>
<li>Write many lines of code which does a lot of extra sql queries and is inefficient and crappy</li>
</ol>
<p>I mainly want to create something so that the relationship table is transparent.  A lot of the time, your relationship table doesn&#8217;t have anything of value in it, and it only exists for a many to many relationship.</p>
<h2>SQL Command Functions</h2>
<h3>About</h3>
<p>One such feature that I see in a lot of Active Record implementations is the ability to use functions named after SQL commands, such as:<br />
<code><br />
$db=new Some_Active_Record_Class();<br />
$db->select('firstname')->from('User')->where('id=5');<br />
</code><br />
Mostly, I had disregarded this need in my Active Record implementation because it seemed like it was a lot of work for very little gain.  Why would you need to allow such functionality when creating a simple sql statement would do?</p>
<p>Well, I think I had just stumbled upon the reason for its need.</p>
<h3>The Problem</h3>
<p>I have a class for a user and contains information pertaining to the user such as first name, last name, e-mail address etc&#8230; It has some very useful functions such as getUserWithRole($role) and getPriviliges($user).  What I need to be able to do, is extend this information through one of the MyEPICS modules.  Such an example is in my Roommate Finder application, which extends the user to give them traits.  The user module does not know about the Roommate Finder application, nor should it have to.  Now, here&#8217;s the problem.  What I need to be able to do, is return a result set of all the users&#8217; traits, where the user has a certain role.  I already have the code to return all users with a certain role in the Users module, now I just need to attach the trait information to the output of it.</p>
<p>I have come up with a few different solutions that would plug this hole, but not fix the problem, with most of them being some variation of typing up a single sql statement to get me the information.  What I don&#8217;t want to do, is getUsersWithRole(), then iterate through all of theses picking out the traits for each individual user.  This would result in at least one sql statement per user, which is <strong>highly</strong> innefficient.  </p>
<p>I want to be able to execute this functionality in one sql query, without having to tightly couple the User module with the Roommate Finder module, and without duplicating functionality already existing in the User module.</p>
<h3>A Solution?</h3>
<p>What I have been thinking about that would solve this problem would end up having me creating something like the database command functions.  Then, what the getUserWithRoel() function would do, is instead of returning the results, it would return a Dbo object with the sql already added.  So that if getUsersWithRole() would normally result in some query like &#8220;select role from roles where role=?&#8221;, then it would now return an object that represents this statement.  What this would allow me to do is chain these functions together, then only execute the query at the end.  For example:<br />
<code><br />
//fetch results in an array<br />
$dbo=$userModule->withRole('Tenant')->join('Traits')->fetchArray();<br />
</code><br />
This has several features which I haven&#8217;t implemented.  Easy relationships, chaining of functions, and the sql commands.</p>
<p>Is it bad that I am never satisfied with what I already have, and always want to refactor to make it better?</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/98/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

