<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Puresoto's Weblog</title>
	<atom:link href="http://puresoto.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://puresoto.wordpress.com</link>
	<description>I'd rather be coding...</description>
	<lastBuildDate>Tue, 27 May 2008 11:47:39 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='puresoto.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/c72a1338a9b8c483eca346f440f7b3b5?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Puresoto's Weblog</title>
		<link>http://puresoto.wordpress.com</link>
	</image>
			<item>
		<title>Embedding Binaries in Your Application</title>
		<link>http://puresoto.wordpress.com/2008/05/27/embedding-binaries-in-your-application/</link>
		<comments>http://puresoto.wordpress.com/2008/05/27/embedding-binaries-in-your-application/#comments</comments>
		<pubDate>Tue, 27 May 2008 11:19:52 +0000</pubDate>
		<dc:creator>puresoto</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://puresoto.wordpress.com/?p=5</guid>
		<description><![CDATA[ 
While working on a side project (Serial Key Maker) I explored the ability to embed a DLL within my executable.  I didn’t want to deploy multiple DLL’s – I was trying to keep the number of dependencies down, but still centralize the common routines in my logging object.  I found how to embed the logging [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=5&subd=puresoto&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p> </p>
<p>While working on a side project (<a title="Serial Key Maker" href="http://www.serialkeymaker.com" target="_blank">Serial Key Maker</a>) I explored the ability to embed a DLL within my executable.  I didn’t want to deploy multiple DLL’s – I was trying to keep the number of dependencies down, but still centralize the common routines in my logging object.  I found how to embed the logging DLL within my application’s components, and how to call its methods from the application. I wrote about the process on my application’s <a title="Serial Key Maker Embedding Blog Post" href="http://www.serialkeymaker.com/blog_05_2008_Embedding.htm" target="_blank">blog</a>.</p>
<p>I figured out that there may be a case for doing the same with an executable. I have not had a reason to do it at Passport, but I am writing about it anyway&#8230;and <em>looking</em> for an opportunity to use it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>To recap, the point of this exercise is to embed an executable within our application, and then make a call to it while our application is running.  To set this up, we need to pull the EXE into our application and then mark it to be placed in the resource list.  Once there we can reference it using reflection, and then use it.  In the case of the DLL, we created an instance of it, and then called its methods. For an EXE it is a little simpler. We just get the EXE from the application’s resource store, stream it to a file, and the start it using “Process.Start”.</p>
<p>This article uses the following demo application as reference for explaining how to do this: [<a title="Demo prokect to show EXE Embedding" href="http://www.serialkeymaker.com/downloads/samples/vs2008/GP_Embedded_Resource_Demo.zip" target="_blank">Download the DEMO here</a>]</p>
<p>To add the EXE to the resource store of your application, do the following:<br />
Right-click on your application in the solution explorer, and select “add existing”.</p>
<blockquote><p>Note: Do NOT use the Add reference option.</p></blockquote>
<p>Navigate to, and select, the EXE you want to embed.<br />
Now, Select the EXE, and open the properties window. The first property is “Build Action”. Change the option to be “Embed Resource”.</p>
<p> </p>
<p style="text-align:center;"><img class="codeimageborder" style="border:thin dotted #0000CC;" src="http://www.serialkeymaker.com/images/PuresotoBlogImages/referenceembed.jpg" alt="Set Build Action to Embed" width="343" height="250" /></p>
<p> </p>
<blockquote><p>When you compile the project, the exe will be drawn in to your executable and will be available as a resource.</p></blockquote>
<p>Now, to use the embedded EXE, you need to:</p>
<p>- pull the referenced EXE into a stream from the resource list</p>
<p><img style="border:thin dotted #0000CC;" src="http://www.serialkeymaker.com/images/PuresotoBlogImages/GetStream.jpg" alt="Get Embedded EXE from the Resource Stream" width="818" height="97" /></p>
<p>- read the stream into a buffer</p>
<p><img style="border:thin dotted #0000CC;" src="http://www.serialkeymaker.com/images/PuresotoBlogImages/readintobuffer.jpg" alt="Read EXE stream into a buffer" width="488" height="98" /></p>
<p>- write it to a file</p>
<p> <img style="border:thin dotted #0000CC;" src="http://www.serialkeymaker.com/images/PuresotoBlogImages/writetofile.jpg" alt="Write Embedded Stream to File" width="543" height="269" /></p>
<p>- start it as you would for any executable.</p>
<blockquote><p>You can even pass in command line parameters just as you would for any other EXE</p></blockquote>
<p><img style="border:thin dotted #0000CC;" src="http://www.serialkeymaker.com/images/PuresotoBlogImages/startapp.jpg" alt="Start Embedded EXE as a process." width="676" height="126" /></p>
<p>To make this easier, I created a helper class (<a title="Embedded Assembly Helper" href="http://www.serialkeymaker.com/downloads/samples/EmbeddedAssemblyHelper.rename_to_vb.txt" target="_blank">EmbeddedAssemblyHelper.vb</a>) to take care of reading the resources and working with them.  There is a shared function “LoadExecutable” which reads the EXE from the resource stream, saves it to a unique file and then returns the file name. The calling application can then start the executable by calling Process.Start.</p>
<p>For simplicity, I have the method accepting the EXE’s name. It might be desirable to have the “LoadExecutable” method discover the EXE’s name.</p>
<p>The downside to this is that is it much slower than simply executing the EXE.  So, there needs to be a very good reason to embed your EXE within another (besides the coolness factor, that is <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )  I can see a use for it in simplifying distribution.  It would also make dealing with obfuscation much easier.</p>
<p>I love to hear of any real world uses for this technique.  Email me at <a href="mailto:grant.porteous@passporthealth.com">grant.porteous@passporthealth.com</a></p>
<p>Thanks for reading,</p>
<p>Grant</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/puresoto.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/puresoto.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/puresoto.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/puresoto.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/puresoto.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/puresoto.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/puresoto.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/puresoto.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/puresoto.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/puresoto.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/puresoto.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/puresoto.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=5&subd=puresoto&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://puresoto.wordpress.com/2008/05/27/embedding-binaries-in-your-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bd8b6aa7ebd72e14db562263e5f47782?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">puresoto</media:title>
		</media:content>

		<media:content url="http://www.serialkeymaker.com/images/PuresotoBlogImages/referenceembed.jpg" medium="image">
			<media:title type="html">Set Build Action to Embed</media:title>
		</media:content>

		<media:content url="http://www.serialkeymaker.com/images/PuresotoBlogImages/GetStream.jpg" medium="image">
			<media:title type="html">Get Embedded EXE from the Resource Stream</media:title>
		</media:content>

		<media:content url="http://www.serialkeymaker.com/images/PuresotoBlogImages/readintobuffer.jpg" medium="image">
			<media:title type="html">Read EXE stream into a buffer</media:title>
		</media:content>

		<media:content url="http://www.serialkeymaker.com/images/PuresotoBlogImages/writetofile.jpg" medium="image">
			<media:title type="html">Write Embedded Stream to File</media:title>
		</media:content>

		<media:content url="http://www.serialkeymaker.com/images/PuresotoBlogImages/startapp.jpg" medium="image">
			<media:title type="html">Start Embedded EXE as a process.</media:title>
		</media:content>
	</item>
		<item>
		<title>Naming Conventions</title>
		<link>http://puresoto.wordpress.com/2008/05/20/naming-conventions/</link>
		<comments>http://puresoto.wordpress.com/2008/05/20/naming-conventions/#comments</comments>
		<pubDate>Tue, 20 May 2008 19:19:53 +0000</pubDate>
		<dc:creator>puresoto</dc:creator>
				<category><![CDATA[Passporthealth]]></category>
		<category><![CDATA[code practices]]></category>

		<guid isPermaLink="false">http://puresoto.wordpress.com/?p=4</guid>
		<description><![CDATA[Back in the pre-dawn of time (around 1999/2000), in the time of COM, we had an in-house utility DLL that was used to determine if a user had permission to a particular resource within our application.  It is literally 15 lines of code and is used in many other objects.
The DLL was named “security.dll”.  To [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=4&subd=puresoto&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Back in the pre-dawn of time (around 1999/2000), in the time of COM, we had an in-house utility DLL that was used to determine if a user had permission to a particular resource within our application.  It is literally 15 lines of code and is used in many other objects.</p>
<p>The DLL was named “security.dll”.  To repeat, it was a <em><strong>COM DLL</strong></em>.</p>
<p>Occasionally, nay, randomly, our applications started crashing in horrible ways.  Do you see the problem?  We didn’t for a long time.</p>
<p>It turns out that Windows NT had a “security.dll” for “<a title="SSPI" href="http://technet.microsoft.com/en-us/library/bb742535.aspx" target="_blank">Security Support Provider Interface</a>” functions.</p>
<p>When we registered our “security.dll” lots of interesting things happened – especially when trying to access network resources…like the database, for example – which we do a million or more times a day. </p>
<p>That was the birth of our Naming Convention Standards Document which later evolved into our Coding Standards Document.  We agreed to use <a title="Hungarian Notation" href="http://en.wikipedia.org/wiki/Hungarian_notation" target="_blank">Hungarian Notation</a>.  Trivia: I noticed in that linked article that it’s called “Hungarian” because of the way Hungarians use the reversed form of their names (Last Name, First Name, as in Data Type, Descriptive Name)).</p>
<p>All applications are now named with a “PHC_” prefix.  “security.dll” became “PHC_Security.dll”.  Our variable declarations start with a 3-letter data type prefix.  (strPayerName, blnFinished, intClaimCounter etc).  We do not, however, prefix our method names – not quite sure how it came about that we skipped that part of naming convention “theory”.  Perhaps it was an intuitive agreement with <a href="http://lxr.linux.no/linux/Documentation/CodingStyle" target="_blank">Linus Torvalds</a>:</p>
<blockquote><p>Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged &#8211; the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft makes buggy programs.</p></blockquote>
<p>(lol!)</p>
<p>Perhaps, if Microsoft had used the convention of prefix naming their objects, they’d have named their DLL “MS_Security.dll” and we’d not have wasted a week crashing our production servers with a poorly named 15 lines of code.</p>
<p>Now that we are on .Net and the VS IDE does so much to make code readable, it could be argued that it is no longer required to use a specific naming convention.</p>
<p>I argue otherwise.  Having this standard (and others like it) in place encourages (enforces?) a kind of coding discipline, in my opinion.</p>
<p>I am very particular about code readability.  I <em>do</em> care about code that works – don’t get me wrong – but I care <em>deeply</em> about code that looks good.  I am obsessive about how the code looks. It must be pretty!  My eyes bleed when I see this type of code:</p>
<blockquote><p><code><br />
&lt;snip&gt;....some while loop code up here<br />
If i = Len(name) Then<br />
If Quit = False Then<br />
If ins + 1 = 200 Then<br />
previous = i<br />
i = Len(name) + 1<br />
Else<br />
GetParms = ""<br />
Exit Function<br />
End If<br />
End If<br />
End If<br />
&lt;/snip&gt;....end of the while loop down here somewhere</code></p></blockquote>
<p>&#8230;.somewhere, someone just killed a kitten because I posted that snippet.</p>
<p>The impression badly named and badly formatted code leaves me with is: “this developer has a cluttered mind, and is most likely writing code that breaks very easily.  I am with illogical”. </p>
<p>This prejudice I have proves itself often enough to reinforce it for me (prejudices are funny that way).  Sloppy code would kill our company with the number of times we refactor production code.</p>
<p>We have retained the tradition of specific naming standards in our .Net code.  As we have grown, and have more developers interacting with each others code, the coding standards that were created from the “security.dll” incident has made a definite improvement in our productivity and in the quality of our product.</p>
<p>Read:  <a href="http://www.soberit.hut.fi/mmantyla/badcodesmellstaxonomy.htm" target="_blank">A Taxonomy for &#8220;Bad Code Smells&#8221;</a></p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/puresoto.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/puresoto.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/puresoto.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/puresoto.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/puresoto.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/puresoto.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/puresoto.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/puresoto.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/puresoto.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/puresoto.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/puresoto.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/puresoto.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=4&subd=puresoto&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://puresoto.wordpress.com/2008/05/20/naming-conventions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bd8b6aa7ebd72e14db562263e5f47782?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">puresoto</media:title>
		</media:content>
	</item>
		<item>
		<title>Moved to here&#8230;</title>
		<link>http://puresoto.wordpress.com/2008/05/16/moved/</link>
		<comments>http://puresoto.wordpress.com/2008/05/16/moved/#comments</comments>
		<pubDate>Fri, 16 May 2008 18:31:04 +0000</pubDate>
		<dc:creator>puresoto</dc:creator>
				<category><![CDATA[Passporthealth]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://puresoto.wordpress.com/?p=3</guid>
		<description><![CDATA[A little about the development environment at Passporthealth:
The company was founded in 1996 &#8211; around the time Mr Gore invented the internet.  I believe I was the 9th developer hired, 7 of us still work here.  It started off as a Microsoft, VB6 shop and has remained on the MS, VB path ever since.
Our users connect [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=3&subd=puresoto&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A little about the development environment at Passporthealth:</p>
<p>The company was founded in 1996 &#8211; around the time Mr Gore invented the internet.  I believe I was the 9th developer hired, 7 of us still work here.  It started off as a Microsoft, VB6 shop and has remained on the MS, VB path ever since.</p>
<p>Our users connect to us via our <a title="Passporthealth Communications" href="http://www.passporthealth.com" target="_blank">website portal</a> to verify patient data and eligibility for services via a number of our products.  We have products that allow single web based interactions, file batch transactions and EDI socket transactions.  Each of these various types of requests usually result in a connection to a 3rd party to lookup or validate various patient information.  We store, analyze and embellish all this data and serve it back to the requesting users.  Sometimes this is an immediate response via the web browser, and sometimes we script or post the data back directly into the client&#8217;s HIS systems.</p>
<p>Last year we processed over a 100 million such transactions.  This transaction volume and workflow creates tremendous architectural challenges for our IT team.  We have vast quantities of data that are written to, searched, and re-written to.  Our array of products crosses over from data-warehouse driven type applicaitons, to real time transaction processing functions. </p>
<p>We have tight relationships with our clients where we are intimately involved in their daily work flow;  they depend on our availability and performance to effectively do their jobs.  Delays, or errors caused by our vendors and partners, are our errors.  We&#8217;ve successfully (imo) coded and architected around these challenges and this has allowed us to become a dependable supplier of information and utiltiy to our clients.</p>
<p>We have some extremely bright, dedicated and devoted developers.  We solve these complex problems in unique and interesting ways every day, and our company rewards us with a great environment to work in.</p>
<p>My plan for this blog is to talk about those challenges and explore some of the specific solutions.  Perhaps you&#8217;d like to read and comment&#8230;</p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/puresoto.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/puresoto.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/puresoto.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/puresoto.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/puresoto.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/puresoto.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/puresoto.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/puresoto.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/puresoto.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/puresoto.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/puresoto.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/puresoto.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=puresoto.wordpress.com&blog=3744993&post=3&subd=puresoto&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://puresoto.wordpress.com/2008/05/16/moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bd8b6aa7ebd72e14db562263e5f47782?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">puresoto</media:title>
		</media:content>
	</item>
	</channel>
</rss>