<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Gabriel Magaña</title>
	
	<link>http://gabrielmagana.com</link>
	<description>Cuz catching up's hard enough...</description>
	<lastBuildDate>Sat, 19 Mar 2011 18:02:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GabrielMaganaCom" /><feedburner:info uri="gabrielmaganacom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Death of the phone call</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/3jHozVzgKdw/</link>
		<comments>http://gabrielmagana.com/2011/03/death-of-the-phone-call/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 18:01:03 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[new york]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[phone call]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=59</guid>
		<description><![CDATA[A couple years ago, I was in New York, visiting a good friend.  As we stepped into his building&#8217;s lobby, my cell phone rang.  It was a good friend I have in Colombia, we communicate by instant message regularly; we talk by phone maybe every one or two years.  This was that phone call. In the [...]]]></description>
			<content:encoded><![CDATA[<p>A couple years ago, I was in New York, visiting a good friend.  As we stepped into his building&#8217;s lobby, my cell phone rang.  It was a good friend I have in Colombia, we communicate by instant message regularly; we talk by phone maybe every one or two years.  This was that phone call.</p>
<p>In the building&#8217;s lobby (or doorman area, for lack of a better term), there was a sign quite sternly prohibiting phone calls.  What the fuck!  What is a waiting area for if not to wait and maybe take a call? I already had the phone in my hand, trying to greet my friend after more than a year of not talking to him via phone&#8230; We were walking toward the elevator, and another tenant took the same elevator as us.  My New York Frind told me to hang up the phone, it was disrespectful to have a phone call in an elevator.  All I could do was to tell my Colombia friend he had called at exactly the wrong time I would call him later, and hung up on him without giving him the chance to say anything.</p>
<p>What the hell had just happened!?  If you are in a building lobby and your phone rings should you scurry out the door like some chain smoker to have your call on the street?</p>
<p>Ok, so I get it that I am a dinosaur.  Being 38 years old feels very old in the age of constant tweets, checkins, instant-everything, and always connectedness.</p>
<p>But what the hell happened to phone calls? When did it become bad manners to call someone?</p>
<p>Occasionally, I do consulting for old-style financial companies, and they want a phone call for everything.  Stuff you could resolve quickly on an email to multiple recipients, they want to delay the resolution until Thursday at 2:45pm so everyone can be on the line when two people agree on a way to solve a problem. Fine.  That&#8217;s my old world, where I grew up professionally.</p>
<p>In the new world, through, there are no phone calls. There was an <a href="http://www.nytimes.com/2011/03/20/fashion/20Cultural.html?_r=1&amp;src=ISMR_HP_LO_MST_FB" target="_blank">interesting article</a> today on the NY Times about the death of the phone call.  Don&#8217;t call me and I won&#8217;t call you.  Yes, I have a cell phone, but how dare you call me?!</p>
<p>I have yet to learn more about phone call etiquette.  Maybe calling in public is s a snooty Park Avenue taboo. Maybe having your phone call is like having your crack: It&#8217;s best to do it in private.</p>
<p>To this day, I still don&#8217;t know what exactly I should have done that day in New York.</p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/3jHozVzgKdw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2011/03/death-of-the-phone-call/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2011/03/death-of-the-phone-call/</feedburner:origLink></item>
		<item>
		<title>Internet Explorer 9 Errors</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/t4B3KDHw4VA/</link>
		<comments>http://gabrielmagana.com/2011/03/internet-explorer-9-errors/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 17:22:47 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=56</guid>
		<description><![CDATA[Note to self: If I&#8217;m getting display errors in IE9 (any sort of display errors), try disabling tracking protecion as the very first thing&#8230;]]></description>
			<content:encoded><![CDATA[<p>Note to self: If I&#8217;m getting display errors in IE9 (any sort of display errors), try disabling tracking protecion as the very first thing&#8230;</p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/t4B3KDHw4VA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2011/03/internet-explorer-9-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2011/03/internet-explorer-9-errors/</feedburner:origLink></item>
		<item>
		<title>Solution to “The OutputPath property is not set for this project.”</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/hT1Ui8gdBaE/</link>
		<comments>http://gabrielmagana.com/2010/04/solution-to-the-outputpath-property-is-not-set-for-this-project/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 14:51:55 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[VS2010 Error]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=52</guid>
		<description><![CDATA[Solving "The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination."]]></description>
			<content:encoded><![CDATA[<p>I spent about a full day solving a strange error in one of my Visual Studio projects.  It is a VS2010 (RC) solution that I upgraded from VS2008.  The thing that started it all was my adding a new configuration to the solution via the configuration manager.  I added the new configuration to enable static source code analysis available in the VS2010 RC.</p>
<p>It should be noted that I wanted to maintain the VS2008 projects at the same time, so what I did in order to be able to open the solution from both VS2008 and VS2010 is the following:</p>
<ul>
<li>Made a copy of the .sln and .vcproj files, naming them [original name]-2010.[extension]</li>
<li>Edited the VS2010 .sln file via a text editor, changing the name of all project files to the newly-created VS2010 file names</li>
<li>Opened the 2010 .sln file in VS2010, allowing VS to upgrade the solution and project files to VS2010 version</li>
</ul>
<p>This worked very well, and all appeared to be running well.  I could open the solution in either VS2008 (using the original solution and project files) and VS2010.  Sometimes the Visual Studio versions would step over each other&#8217;s toes, so it seemed safer to have only one version open of the same solution at one time.  Otherwise, everything worked perfectly.</p>
<p>Trying to enable static source code analysis on the VS2010 solution, I created a new configuration on the VS configuration manager, it is a configuration based on the &#8220;Debug&#8221; configuration, except this one has enabled code analysis.  I made it a separate configuration because 1) It takes longer to compile with code analysis turned on; and 2) There are a ton of warnings that come up when you enable code analysis on a mature project.</p>
<p>What happened is that the solution stopped compiling successfully with the new configuration. I would get the error message of:</p>
<p style="padding-left: 30px;">C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(539,9): error : The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination. Configuration=&#8217;Debug (Source Check)&#8217; Platform=&#8217;x86&#8242;</p>
<p>There would be multiple error messages like this, for several of my projects.</p>
<p>I spent a lot of time trying to solve this, and finally I found a <a title="Microsoft Connect" href="http://connect.microsoft.com/VisualStudio/feedback/details/518181/msbuild-gets-confused-with-build-configuration-and-starts-generating-output-path-errors">post on Microsoft Connect</a> that led me to the right answer: because of how I created the copy of my solution to upgrade, the references between projects in my solution were still referencing the VS2008 versions of the project, not the upgraded VS2010 project files.</p>
<p>This meant that, while I had created the new solution configuration under VS2010, the compilation process was looking in the VS2008 project files for solving the project references.  Not good.</p>
<p>So the solution to this was to remove the VS2008 project references, and re-add the project references within VS2010 using the VS2010 projects.  this fixed the problem instantly.</p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/hT1Ui8gdBaE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2010/04/solution-to-the-outputpath-property-is-not-set-for-this-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2010/04/solution-to-the-outputpath-property-is-not-set-for-this-project/</feedburner:origLink></item>
		<item>
		<title>Open source fails when it most matters</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/cAIiA2leAoM/</link>
		<comments>http://gabrielmagana.com/2009/11/open-source-fails-when-it-most-matters/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 20:12:20 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[mantis]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=46</guid>
		<description><![CDATA[So I was looking for alternatives to the Mantis issue/bug tracking system. I am pretty much fed up with its lackluster usability.  Simple things take several clicks.  There is no ajax anywhere.  You are redirected to pages just to be told that an operation completed (ie, change a user profile), and then you are forced [...]]]></description>
			<content:encoded><![CDATA[<p>So I was looking for alternatives to the <a href="http://mantisbt.org">Mantis </a>issue/bug tracking system. I am pretty much fed up with its lackluster usability.  Simple things take several clicks.  There is no ajax anywhere.  You are redirected to pages just to be told that an operation completed (ie, change a user profile), and then you are forced to click on a link to proceed.  You are then redirected to an irrelevant page (usually).  Very unusable, very amateur design.  Functionally, though, it has what you need in an issue tracker, so I suppose people do not mind clicking like crazy because in the end you can get your job done.</p>
<p>Anyway, I was looking for alternatives to Mantis.  I ran into <a href="http://www.etraxis.org/">eTraxis</a>, and it sure does look good, judging from the <a href="http://www.etraxis.org/screenshots.php">three screenshots</a> their site provides, along with the <a href="http://www.etraxis.org/">vague feature list</a> to go along with it (why the fuck bother to list &#8220;Advanced filters&#8221; as a feature?  That tells me nothing about the filters, other than they are not trivial.  Whood-de-freekin&#8217; do.  Every feature I implement is &#8220;advanced&#8221; too).</p>
<p>Suffice it to say, from the three screenshots (because the feature list was so damn useless) I gathered that this could be a product I could use, and recommend to my clients when they need an issue tracker to have on their own.  I needed to try it out.</p>
<p>There is a &#8220;Demo&#8221; link on the site, which seemed to be exactly what I wanted:  Let me try it out quickly, let me be wowed by the interface and usability.</p>
<p>No dice. For the eTraxis people, it seemed to be a better idea that you download a 50MB package with bynaries for XAMPP so that you can try the thing in your own damned machine.  I&#8217;m sure on paper it seems like a good idea:  Why have an instance running on our site that everyone is messing with?  Why not just have everyone download a copy of the thing, and run it on their own computer?  They could do whatever they want, and it would be lag free on top of it!</p>
<p>Well, of course, the thing does not work.  Here is what I get when I try to run the server on my own Windows 7 x64 development machine:</p>
<p><img class="alignnone size-full wp-image-47" title="Fail under Windows 7" src="http://gabrielmagana.com/wp-content/uploads/2009/11/Capture1.PNG" alt="Fail under Windows 7" width="251" height="88" /></p>
<p>&#8220;xampp&#8221; is not started is the only feedback I get.  All you see above is all the feedback I got.  I am expected to figure out <strong>why</strong> it did not start, since these brainiacs seem to think error descriptions are for pussies.  Where would I start to look for the cause and explanation of the error?  Apache on Windows is an afterthought, so I would not expect debugging this would be as easy as if the error had occurred on Linux.</p>
<p>Ok, so I am a computer programmer, and I have a bunch of virtual machines lying around that I use for testing (hint to the xampp/eTraxis people: You might want to give testing a try one of these days).  What more typical an O/S to run software on is there than a 32-bit US English version of Window XP?  So I restore my last snapshot, on that has absolutely nothing on it than a completely blank, patched up version of XP 32 bit.</p>
<p>Things only improved marginally:</p>
<p><img class="alignnone size-full wp-image-48" title="Capture2" src="http://gabrielmagana.com/wp-content/uploads/2009/11/Capture2.PNG" alt="Capture2" width="500" height="64" /></p>
<p>So it still fails, but now it tells me the name of the executable it tried to run.</p>
<p>By this time I am done with this.  I don&#8217;t care why it did not work. All I know is that the xampp thing sis not run even in the most plain-vanilla, unmodified Windows version you could have.  I wonder if anyone has ever been able to run this demo. Anyway, if this is how the eTraxis demo works, then imagine the quality of the product itself.</p>
<p>Open source people have got to learn to close the sale.  They do all of these thousands of hours of work into a project, and then drop the ball at the 99.99% mark, thinking that&#8217;s enough. A sale is a sale.  Even if your price is $0, you still have to get people to buy into your product.</p>
<p>Bottom line: I did not try out eTraxis.  I did not even consider switching to it. I just wasted some time with it, and I am pissed off, so I am writing an entry about it. Open source is its own worst enemy.</p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/cAIiA2leAoM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2009/11/open-source-fails-when-it-most-matters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2009/11/open-source-fails-when-it-most-matters/</feedburner:origLink></item>
		<item>
		<title>Hotmail POP3 &amp; SMTP connections – Or how to use Outlook with a Hotmail account</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/Jfb-GP06lFs/</link>
		<comments>http://gabrielmagana.com/2009/09/hotmail-pop3-smtp-connections-or-how-to-use-outlook-with-an-hotmail-account/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 01:14:22 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[hotmail]]></category>
		<category><![CDATA[outlook]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=31</guid>
		<description><![CDATA[If you could point to a problem that a great many people have had over the years with different solutions and no clear answers, it is the problem of configuring Outlook (or any other email client) to access your Hotmail account. There are plug-ins, conflicting settings, unclear instructions, and differing requirements (ie, pay versus no-pay [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If you could point to a problem that a great many people have had over the years with different solutions and no clear answers, it is the problem of configuring Outlook (or any other email client) to access your Hotmail account.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">There are plug-ins, conflicting settings, unclear instructions, and differing requirements (ie, pay versus no-pay accounts) have been spread out over the years.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">I aim to end the chaos <img src='http://gabrielmagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">As of this writing (September 2009), you can access all Hotmail accounts, even free accounts. The servers and port numbers to use for Hotmail are the following:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">POP3 Server:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Server: pop3.live.com</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Port: 995</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Encryption: SSL</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">SMTP Server:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Server: smtp.live.com</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Port: 587</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Encryption: TLS</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Server requires authentication</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">For both servers, the login username is your complete email address.</div>
<p>If you could point to a problem that a great many people have had over the years with different solutions and no clear answers, it is the problem of configuring Outlook (or any other email client) to access your Hotmail account.</p>
<p>There are plug-ins, conflicting settings, unclear instructions, and differing requirements (ie, pay versus no-pay accounts) have been spread out over the years.</p>
<p>I aim to end the chaos <img src='http://gabrielmagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>As of this writing (September 2009), you can access all Hotmail accounts, even free accounts. The servers and port numbers to use for Hotmail are the following:</p>
<p>POP3 Server:</p>
<ul>
<li>Server: pop3.live.com</li>
<li>Port: 995</li>
<li>Encryption: SSL</li>
</ul>
<p>SMTP Server:</p>
<ul>
<li>Server: smtp.live.com</li>
<li>Port: 587</li>
<li>Encryption: TLS</li>
<li>Server requires authentication</li>
</ul>
<p>For both servers, the login username is your complete email address.</p>
<h3><strong>Outlook Configuration</strong></h3>
<p>Here is the series of steps you need to follow:</p>
<h4>On the main account configuration window:</h4>
<p><img style="padding: 0px; margin: 0px; border: 0px none initial;" src="http://gabrielmagana.com/wp-content/uploads/2009/09/OutlookMainPage.png" alt="Outlook Main Account Configuration Page" width="634" height="476" /></p>
<p style="padding-left: 30px;">On this screen, enter the server names as shown, and your username (full Hotmail email address) and password.</p>
<p style="padding-left: 30px;">Click on &#8220;More Settings&#8230;&#8221;</p>
<h4>Internet Email Settings Window</h4>
<p><img style="border: 0px initial initial;" title="OutlookOutgoingServer" src="http://gabrielmagana.com/wp-content/uploads/2009/09/OutlookOutgoingServer.png" alt="OutlookOutgoingServer" width="402" height="440" /></p>
<p style="padding-left: 30px;">On this window, go to the &#8220;Outgoing Server&#8221; tab, then change the settings as shown</p>
<p style="padding-left: 30px;">Go to the &#8220;Advanced&#8221; tab next&#8230;</p>
<p><img style="border: 0px initial initial;" title="OutlookAdvanced" src="http://gabrielmagana.com/wp-content/uploads/2009/09/OutlookAdvanced1.png" alt="OutlookAdvanced" width="402" height="440" /></p>
<p style="padding-left: 30px;">&#8230;And put the settings as shown above.</p>
<p style="padding-left: 30px;">You&#8217;re done!  Now to test your changes.  Press &#8220;OK&#8221; and you will go back to the main account configuration window.</p>
<p style="padding-left: 30px;">On that window press &#8220;Test Account Settings&#8230;&#8221; and it will perform a test:</p>
<p><img style="border: 0px initial initial;" title="OutlookTestSuccess" src="http://gabrielmagana.com/wp-content/uploads/2009/09/OutlookTestSuccess.png" alt="OutlookTestSuccess" width="499" height="251" /></p>
<p style="padding-left: 30px;">If you set everything correctly, you will see the two status values as &#8220;Completed&#8221;.  Congratulations, now you have access to your Hotmail account via Outlook!</p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/Jfb-GP06lFs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2009/09/hotmail-pop3-smtp-connections-or-how-to-use-outlook-with-an-hotmail-account/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2009/09/hotmail-pop3-smtp-connections-or-how-to-use-outlook-with-an-hotmail-account/</feedburner:origLink></item>
		<item>
		<title>C#: Working with Images, image files, and PictureBoxes</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/ouss9hqZ-1A/</link>
		<comments>http://gabrielmagana.com/2009/05/c-working-with-images-image-files-and-pictureboxes/#comments</comments>
		<pubDate>Wed, 20 May 2009 18:40:58 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[PictureBox]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=9</guid>
		<description><![CDATA[One of the most frustrating things you run into when working with image files, Images objects, and PictureBoxes is that once you release your application, some users will get “file locked” errors when trying to manipulate files that you have displayed onto the screen via a picturebox. Finding a workaround can be downright maddening: It is sometimes hard to replicate the problem, and it is difficult to open an image and display it without displaying the image you have just opened from a file :smile:.]]></description>
			<content:encoded><![CDATA[<p>One of the most frustrating things you run into when working with image files, Images objects, and PictureBoxes is that once you release your application, some users will get “file locked” errors when trying to manipulate files that you have displayed onto the screen via a picturebox. Finding a workaround can be downright maddening: It is sometimes hard to replicate the problem, and it is difficult to open an image and display it without displaying the image you have just opened from a file <img src='http://gabrielmagana.com/wp-includes/images/smilies/icon_smile.gif' alt=':smile:' class='wp-smiley' />  . </p>
<p>It does not help that on some machines the problem manifests itself as an “unknown GDI+ error,” so you might spend many hours chasing this unknown error only to realize it’s the same as the “file in use by another process” error you get from other machines.</p>
<p>Microsoft makes the problem worse, giving misinformation in Knowledge Base articles such as these: <a href="http://support.microsoft.com/kb/311754">http://support.microsoft.com/kb/311754</a>. This article gives a work around that does not fix the problem everywhere and it goes on to state this behavior is “by design.” Putting aside the issue of how someone could put in bugs such as these “by design,” the fact that the behavior is not consistent makes this a bug anyway.</p>
<p>If you do a search for the problem you might run into these suggested fixes:</p>
<ul>
<li>Dispose of the Image object before saving a file</li>
<li>Dispose of the Image object before saving a file, and then call the garbage collector to make sure the Image really is disposed</li>
<li>Make a copy of the Image before attaching it to the PictureBox <em>(It seems .NET is way too smart to fall for that one and somehow still tracks where the image came from)</em></li>
<li>Use the Image.Clone() method to make a copy of the Image before attaching to the PictureBox</li>
<li>Use a FileStream to open the image</li>
</ul>
<p>There are many, many posts on this issue all over the internet, and believe me, I read all of them, and none gave me a full answer, although all pointed me in the right direction: The less “connected” the image file was to the Image object, the better off everyone would be.</p>
<p>So how do we fix it? This seems to be a bug in Windows since at least the VB6 days, so we might as well work around for it.</p>
<p>After much hair pulling and trial and error, here is what finally worked for me: Open the file containing the image, and, in the most indirect, sneaky way possible, assign the file contents to the Image object which you will use to display the image in a PictureBox. Do the same when saving an Image to a file. Do not mix Image objects and files and everyone will be happy. Here are the general steps:</p>
<ul>
<li>To open an image file:
<ul>
<li>Open the graphic file, but not into an Image object, open the file into a byte array.</li>
<li>Convert the byte array into an Image object (the conversion will figure out which format (PNG, JPG, etc…) the file is using)</li>
<li>Use that Image object to assign to a PictureBox to display to the user</li>
<li>Do NOT call the Image’s .Save() method, as that ties the Image to a file. See below…</li>
</ul>
</li>
<li>To save an image file:
<ul>
<li>Clone the image via the Image.Clone() method</li>
<li>Save the cloned image to a MemoryStream, using your preferred encoding (PNG, JPG, etc…)</li>
<li>Convert the stream to a byte array</li>
<li>Save the byte array to a file</li>
</ul>
</li>
</ul>
<p>Here is some code that might help you:</p>
<p><strong>To read the file:</strong></p>
<pre class="brush: csharp; title: ; notranslate">
public static Image NonLockingOpen(string filename) {
	Image result;

	#region Save file to byte array

	long size = (new FileInfo(filename)).Length;
	FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
	byte[] data = new byte[size];
	try {
		fs.Read(data, 0, (int)size);
	} finally {
		fs.Close();
		fs.Dispose();
	}

	#endregion

	#region Convert bytes to image

	MemoryStream ms = new MemoryStream();
	ms.Write(data, 0, (int)size);
	result = new Bitmap(ms);
	ms.Close();

	#endregion

	return result;
}
</pre>
<p><strong>To write the file:</strong></p>
<pre class="brush: csharp; title: ; notranslate">
public static void NonLockingSave(Image img, string fn, ImageFormat format) {
	// Delete destination file if it already exists
	if (File.Exists(fn))
		File.Delete(fn);

	try {

		#region Convert image to destination format

		MemoryStream ms = new MemoryStream();
		Image img2 = (Image)img.Clone();
		img2.Save(ms, format);
		img2.Dispose();
		byte[] byteArray = ms.ToArray();
		ms.Close();
		ms.Dispose();

		#endregion

		#region Save byte array to file

		FileStream fs = new FileStream(fn, FileMode.CreateNew, FileAccess.Write);
		try {
			fs.Write(byteArray, 0, byteArray.Length);
		} finally {
			fs.Close();
			fs.Dispose();
		}

		#endregion

	} catch {
		// Delete file if it was created
		if (File.Exists(fn))
			File.Delete(fn);

		// Re-throw exception
		throw;
	}
}
</pre>
<p>And finally, here is an extension method that will make your life easier:</p>
<pre class="brush: csharp; title: ; notranslate">
public static void SaveViaStreams(this Image img, string fn, ImageFormat format) {
	NonLockingSave(img, fn, format);
}
</pre>
<p>Once I used these methods to handle file opens/saves all my file locking errors went away, on all computers that used my system. Hope this helps you as well!</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fgabrielmagana.com%2f2009%2f05%2fc-working-with-images-image-files-and-pictureboxes%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fgabrielmagana.com%2f2009%2f05%2fc-working-with-images-image-files-and-pictureboxes%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/ouss9hqZ-1A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2009/05/c-working-with-images-image-files-and-pictureboxes/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2009/05/c-working-with-images-image-files-and-pictureboxes/</feedburner:origLink></item>
		<item>
		<title>Wedding pictures online (finally!)</title>
		<link>http://feedproxy.google.com/~r/GabrielMaganaCom/~3/CO_2E4mpEWA/</link>
		<comments>http://gabrielmagana.com/2009/05/wedding-pictures-online-finally/#comments</comments>
		<pubDate>Mon, 18 May 2009 01:33:44 +0000</pubDate>
		<dc:creator>Gabriel Magaña</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[pics]]></category>
		<category><![CDATA[wedding]]></category>

		<guid isPermaLink="false">http://gabrielmagana.com/?p=3</guid>
		<description><![CDATA[Here are the pictures of our wedding.  The photographer took 925 pics, we still have to select 140 of them (a very difficult task, actually!) so they can be optimized/retouched/etc&#8230;  Click on the picture below for the gallery:]]></description>
			<content:encoded><![CDATA[<p>Here are the pictures of our wedding.  The photographer took 925 pics, we still have to select 140 of them (a very difficult task, actually!) so they can be optimized/retouched/etc&#8230;  Click on the picture below for the gallery:</p>
<div class="wp-caption aligncenter" style="width: 210px"><a href="http://gabrielmagana.smugmug.com/gallery/8208663_XGyF9/1/536458004_3TBDb" target="_blank"><img class="  " title="Gabriel &amp; Mili's Wedding" src="http://gabrielmagana.smugmug.com/photos/536457682_7QSbZ-S.jpg" alt="" width="200" height="300" /></a><p class="wp-caption-text">Gabriel &amp; Mili&#39;s Wedding</p></div>
<img src="http://feeds.feedburner.com/~r/GabrielMaganaCom/~4/CO_2E4mpEWA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gabrielmagana.com/2009/05/wedding-pictures-online-finally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gabrielmagana.com/2009/05/wedding-pictures-online-finally/</feedburner:origLink></item>
	</channel>
</rss>

