<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Damir's Corner</title>
    <link>http://www.damirscorner.com/</link>
    <description>Notes from Daily Encounters with Technology</description>
    <language>en-us</language>
    <copyright>Damir Arh, M. Sc.</copyright>
    <lastBuildDate>Sun, 09 Aug 2009 17:39:38 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>damir.arh@gmail.com</managingEditor>
    <webMaster>damir.arh@gmail.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/damircorner" /><feedburner:info uri="damircorner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=21209566-9f7f-4939-ace5-d224080bb8b1</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,21209566-9f7f-4939-ace5-d224080bb8b1.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,21209566-9f7f-4939-ace5-d224080bb8b1.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=21209566-9f7f-4939-ace5-d224080bb8b1</wfw:commentRss>
      
      <title>Send E-Mail As and On Behalf Of</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,21209566-9f7f-4939-ace5-d224080bb8b1.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/fsG_8gDyQq8/SendEMailAsAndOnBehalfOf.aspx</link>
      <pubDate>Sun, 09 Aug 2009 17:39:38 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Microsoft Exchange supports Send As and Send On Behalf Of permissions to be granted&#xD;
to users for individual e-mail addresses. Sending e-mail from Outlook for these users&#xD;
is very simple – they just enter the desired address in the From field of a new message&#xD;
(toggled with the Show From command on the Options ribbon) and if they have the required&#xD;
permission it will be sent accordingly – either as if it was actually sent from that&#xD;
address or as sent by the user on behalf of the address in the From field.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
If you want to achieve this from code there is a little more work involved. First&#xD;
of all the user must be authenticated on the server using one of the methods below:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;SmtpClient smtp = new SmtpClient("smtp.domain.com");&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;// use user’s existing credentials&lt;br&gt;&#xD;
smtp.UseDefaultCredentials = true;&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;// pass username and password&lt;br&gt;&#xD;
smtp.Credentials = new NetworkCredentials("username", "password");&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The next step is to set up the correct headers in the message otherwise the server&#xD;
will return error code 5.7.1 describing the permission the user does not have.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To send the e-mail as only the From property has to contain the desired address:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;MailMessage mail = new MailMessage();&lt;br&gt;&#xD;
mail.From = new MailAddress("send.as@domain.com");&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To send the e-mail on behalf of another user the Sender property must additionally&#xD;
contain the user’s e-mail address:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;MailMessage mail = new MailMessage();&lt;br&gt;&#xD;
mail.From = new MailAddress("send.as@domain.com");&lt;br&gt;&#xD;
mail.Sender = new MailAddress("user.address@domain.com");&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
On a related note, the required permissions can be granted using PowerShell.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To grant the Send As permission:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;Add-ADPermission –Identity "user1" –User "user2" –ExtendedRights&#xD;
Send-As&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To grant the Send On Behalf Of permission:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;Set-Mailbox "user1" -GrantSendOnBehalfTo "user2"&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
In both cases the user1 specifies the mailbox to grant the permission for and the&#xD;
user2 specifies the user to grant the permission to.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=21209566-9f7f-4939-ace5-d224080bb8b1"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/G79mPTD843_ldFQLmLt6yWmSHlE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/G79mPTD843_ldFQLmLt6yWmSHlE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/G79mPTD843_ldFQLmLt6yWmSHlE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/G79mPTD843_ldFQLmLt6yWmSHlE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/fsG_8gDyQq8" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,21209566-9f7f-4939-ace5-d224080bb8b1.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
    <feedburner:origLink>http://www.damirscorner.com/SendEMailAsAndOnBehalfOf.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=0db675f9-82f2-4907-933d-9dccc5f07115</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,0db675f9-82f2-4907-933d-9dccc5f07115.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,0db675f9-82f2-4907-933d-9dccc5f07115.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0db675f9-82f2-4907-933d-9dccc5f07115</wfw:commentRss>
      <slash:comments>2</slash:comments>
      
      <title>Identifying unrecognized devices in Device Manager</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,0db675f9-82f2-4907-933d-9dccc5f07115.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/F5LRagEVhSc/IdentifyingUnrecognizedDevicesInDeviceManager.aspx</link>
      <pubDate>Sat, 01 Aug 2009 17:09:49 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Today I decided to get to the bottom of the missing driver issue on my computer running&#xD;
Windows 7 RC. It shows up as PCI Simple Communications controller and it really bugged&#xD;
me since I don't have a modem or a similar device on the motherboard.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="PCI Simple Communications Controller" alt="PCI Simple Communications Controller" src="http://www.damirscorner.com/content/binary/IdentifyingunrecognizeddevicesinDeviceMa_F2FE/PCISimpleCommunicationsController.png" border="0" height="36" width="268"&gt;&lt;/img&gt;It&#xD;
turned out that there is a away to identify such a device from the information available&#xD;
in Device Manager. The first step is to open the Properties window for this device&#xD;
and move to the Details tab. After selecting the Hardware Ids in the Property dropdown&#xD;
the device identifiers are displayed.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="HardwareIds" alt="HardwareIds" src="http://www.damirscorner.com/content/binary/IdentifyingunrecognizeddevicesinDeviceMa_F2FE/HardwareIds.png" border="0" height="461" width="414"&gt;&lt;/img&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The important ones are the numbers written after the VEN and DEV keywords. The first&#xD;
one is the Vendor ID and the second one is the Device ID. So in my case the Vendor&#xD;
ID is 8086 (from VEN_8086) and the Device ID is 29A4 (from DEV_29A4).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
All that's left to do know is to go to &lt;a href="http://www.pcidatabase.com" target="_blank"&gt;PCIDatabase.com&lt;/a&gt; and&#xD;
enter the ids into the corresponding search boxes. In my case it turned out that it&#xD;
was a device from Intel - Intel Management Engine Interface (HECI). Unfortunately&#xD;
it doesn't have &lt;a href="http://downloadcenter.intel.com/filter_results.aspx?strTypes=all&amp;amp;ProductID=2374&amp;amp;OSFullName=Windows+7%2C+64-bit*&amp;amp;lang=eng&amp;amp;strOSs=190&amp;amp;submit=Go%21" target="_blank"&gt;a&#xD;
driver for Windows 7&lt;/a&gt; yet and &lt;a href="http://downloadcenter.intel.com/filter_results.aspx?strTypes=all&amp;amp;ProductID=2374&amp;amp;OSFullName=Windows+Vista+64*&amp;amp;lang=eng&amp;amp;strOSs=150&amp;amp;submit=Go%21" target="_blank"&gt;the&#xD;
Vista one&lt;/a&gt; doesn't install. But hey, at least I know which driver is missing.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=0db675f9-82f2-4907-933d-9dccc5f07115"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/d6uo6j2jUJrASzsyY4AaouOWHjI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d6uo6j2jUJrASzsyY4AaouOWHjI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/d6uo6j2jUJrASzsyY4AaouOWHjI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d6uo6j2jUJrASzsyY4AaouOWHjI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/F5LRagEVhSc" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,0db675f9-82f2-4907-933d-9dccc5f07115.aspx</comments>
      <category>Personal</category>
      <category>Personal/Software</category>
    <feedburner:origLink>http://www.damirscorner.com/IdentifyingUnrecognizedDevicesInDeviceManager.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=4e0955bd-674c-4a1f-b657-91a361e2c0eb</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,4e0955bd-674c-4a1f-b657-91a361e2c0eb.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,4e0955bd-674c-4a1f-b657-91a361e2c0eb.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4e0955bd-674c-4a1f-b657-91a361e2c0eb</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Gama System eArchive accredited</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,4e0955bd-674c-4a1f-b657-91a361e2c0eb.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/wsrQUTzBtdw/GamaSystemEArchiveAccredited.aspx</link>
      <pubDate>Sat, 05 Jul 2008 20:37:14 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://gama-system.com/Content.aspx?id=20050200"&gt;Gama System eArchive&lt;/a&gt;,&#xD;
one of the two products in our &lt;a href="http://gama-system.com/Content.aspx?id=20050050"&gt;document&#xD;
product line&lt;/a&gt;, received accreditation from the &lt;a href="http://www.arhiv.gov.si/en/"&gt;Archives&#xD;
of the Republic of Slovenia&lt;/a&gt; last week. This acknowledgement by our national body&#xD;
means that any document stored in Gama System eArchive is automatically legally valid.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This is important for both &lt;a href="http://gama-system.com/NewsItems.aspx"&gt;our company&lt;/a&gt; and&#xD;
other companies looking for a long term electronic document storage solution. Our&#xD;
product is the first service oriented solution to receive the accreditation.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Congratulations to everyone involved in the product. Well done!&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=4e0955bd-674c-4a1f-b657-91a361e2c0eb"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ZhB0dKQNhnKWrIXNkCheLFc7Lhw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZhB0dKQNhnKWrIXNkCheLFc7Lhw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ZhB0dKQNhnKWrIXNkCheLFc7Lhw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ZhB0dKQNhnKWrIXNkCheLFc7Lhw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/wsrQUTzBtdw" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,4e0955bd-674c-4a1f-b657-91a361e2c0eb.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
      <category>Personal</category>
      <category>Personal/Software</category>
    <feedburner:origLink>http://www.damirscorner.com/GamaSystemEArchiveAccredited.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=de988151-8abf-4eef-bdc2-1126b05812b1</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,de988151-8abf-4eef-bdc2-1126b05812b1.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,de988151-8abf-4eef-bdc2-1126b05812b1.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=de988151-8abf-4eef-bdc2-1126b05812b1</wfw:commentRss>
      
      <title>Microsoft Pro Photo Tools decimal separator problem</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,de988151-8abf-4eef-bdc2-1126b05812b1.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/5zDGDN792a4/MicrosoftProPhotoToolsDecimalSeparatorProblem.aspx</link>
      <pubDate>Sun, 15 Jun 2008 20:03:01 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Today I've taken my new &lt;a href="http://buy.garmin.com/shop/shop.do?pID=8703"&gt;handeld&#xD;
GPS device&lt;/a&gt; for a test run. It did its job pretty well but the real challenge started&#xD;
afterwards when I tried geotagging the photos I've taken. I decided to use &lt;a href="http://www.microsoft.com/prophoto/downloads/tools.aspx"&gt;Microsoft&#xD;
Pro Photo Tools&lt;/a&gt; which have just been released with geotagging as its main feature.&#xD;
Downloading the track data from the GPS device with Garmin MapSource software was&#xD;
quick and simple. But the problems started soon afterwards. MapSource can only export&#xD;
track data in its proprietary format GDB which can't be used in Microsoft Pro Photo&#xD;
Tools.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://www.gpsbabel.org/"&gt;GPSBabel&lt;/a&gt; came to the rescue. This free tool&#xD;
can probably convert files between any two existing GPS formats, at least judging&#xD;
from its &lt;a href="http://www.gpsbabel.org/capabilities.html"&gt;list of supported formats&lt;/a&gt;.&#xD;
I used it to convert my data to the GPX XML format only to find out that Microsoft&#xD;
Pro Photo Tools have problems with it. Converting to NMEA or KML instead didn't help&#xD;
either. Fortunately the latter returned a strange error (Degrees must be between 0&#xD;
and 90, found degree 46298501) which put me on the right track. Of course there was&#xD;
no such value in the KML file so I correctly deduced that the decimal separator was&#xD;
to blame.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The value in the file was 46.298501 but the Slovenian regional settings have comma&#xD;
as the decimal separator therefore the value was misinterpreted. Temporarily changing&#xD;
the decimal separator to dot solved the problem - the track was successfully imported&#xD;
immediately afterwards. This issue won't keep me from using this otherwise very useful&#xD;
tool with a really nice feature set. It could even fix the mismatching time settings&#xD;
between my GPS unit and the camera with a single setting. I just hope they address&#xD;
this bug soon so that I won't have to change my regional settings every time I use&#xD;
the program.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The only thing I still have to figure out is why the geotags somehow lost resolution&#xD;
when I uploaded the photos from &lt;a href="http://picasa.google.com/"&gt;Picasa&lt;/a&gt; to &lt;a href="http://picasaweb.google.com/"&gt;Picasa&#xD;
Web Albums&lt;/a&gt;. I just fixed them manually and decided to address the issue next time.&#xD;
Any tips are welcome.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=de988151-8abf-4eef-bdc2-1126b05812b1"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CMzWU4a6aedgiYt7VfmNLP4PJYA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CMzWU4a6aedgiYt7VfmNLP4PJYA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CMzWU4a6aedgiYt7VfmNLP4PJYA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CMzWU4a6aedgiYt7VfmNLP4PJYA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/5zDGDN792a4" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,de988151-8abf-4eef-bdc2-1126b05812b1.aspx</comments>
      <category>Personal</category>
      <category>Personal/Software</category>
    <feedburner:origLink>http://www.damirscorner.com/MicrosoftProPhotoToolsDecimalSeparatorProblem.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=84c751f7-f67e-47f0-9def-3035b5333cf5</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,84c751f7-f67e-47f0-9def-3035b5333cf5.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,84c751f7-f67e-47f0-9def-3035b5333cf5.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=84c751f7-f67e-47f0-9def-3035b5333cf5</wfw:commentRss>
      <slash:comments>2</slash:comments>
      
      <title>Old ActiveX controls under .NET 2.0 SP1</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,84c751f7-f67e-47f0-9def-3035b5333cf5.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/WGiZZhe5fM8/OldActiveXControlsUnderNET20SP1.aspx</link>
      <pubDate>Tue, 29 Apr 2008 13:29:08 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
A .NET application in the company I work for recently started crashing under Windows&#xD;
Vista when trying to open a window implemented in an ActiveX DLL. Investigations showed&#xD;
that they were caused by an &lt;font face="Courier New"&gt;AccessViolationException "Attempted&#xD;
to read or write protected memory. This is often an indication that other memory is&#xD;
corrupt."&lt;/font&gt;. The cause was one of the ActiveX controls in the window. When instantited&#xD;
directly in a .NET Form the exception above was contained in a &lt;font face="Courier New"&gt;TargetInvocationException&#xD;
"Unable to get the window handle for the '&amp;lt;control name&amp;gt;' control. Windowless&#xD;
ActiveX controls are not supported."&lt;/font&gt;. Knowing that the control didn't suddenly&#xD;
turn windowless we dug deeper.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
It turned out that the problem appeared with .NET Framework 2.0 Service Pack 1. &lt;a href="http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx"&gt;Apparently&lt;/a&gt; it&#xD;
caused the C# compiler in Visual Studio 2005 and later to set the &lt;font face="Courier New"&gt;NXCOMPAT&lt;/font&gt; bit&#xD;
for all build targets without an option to turn this new behavior off. For those who&#xD;
don't know, this means that DEP (data execution prevention) will kick in unless it&#xD;
is turned off completely in the operating system. This wouldn't be a big deal unless&#xD;
ATL before Visual Studio 2005 didn't have a &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=299397"&gt;bug&lt;/a&gt; which&#xD;
caused the heap allocated memory not to be flagged as executable, which under the&#xD;
new circumstances results as the already mentioned exception. Windows XP has DEP turned&#xD;
off by default therefore everything still works but in Windows Vista it is turned&#xD;
on and prevents such application from functioning properly.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The best solution would of course be to recompile the ActiveX controls in Visual Studio&#xD;
2005 or later but this might not be possible if they are supplied by a third party.&#xD;
In this case the most obvious approach to dealing with the situation is to disable&#xD;
DEP in Vista. There is a &lt;font face="Courier New"&gt;Data Execution Prevention&lt;/font&gt; tab&#xD;
in the &lt;font face="Courier New"&gt;Performance Options&lt;/font&gt; which open when you click&#xD;
the &lt;font face="Courier New"&gt;Settings&lt;/font&gt; button in the &lt;font face="Courier New"&gt;Performance&lt;/font&gt; frame&#xD;
of the &lt;font face="Courier New"&gt;Advanced&lt;/font&gt; tab in the &lt;font face="Courier New"&gt;System&#xD;
Properties&lt;/font&gt; dialog but it only allows switching between DEP for all processes&#xD;
with defined exceptions and DEP for essential Windows programs and services, i.e.&#xD;
executables flagged with the &lt;font face="Courier New"&gt;NXCOMPAT&lt;/font&gt; bit. The only&#xD;
way to turn DEP completely off is executing the following command with administrative&#xD;
privileges:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;bcdedit.exe /set {current} nx AlwaysOff&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
After restart DEP will be turned off and problematic binaries will work once again.&#xD;
To restore the previous (default) state replace &lt;font face="Courier New"&gt;AlwaysOff&lt;/font&gt; with &lt;font face="Courier New"&gt;OptIn&lt;/font&gt;.&#xD;
The &lt;font face="Courier New"&gt;AlwaysOn&lt;/font&gt; option enables DEP for all processes&#xD;
and might cause additional problems (e.g. Google Calendar Sync in its current version&#xD;
0.9.3.2 doesn't work in this mode).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Unfortunately, this solution would require all your Vista using customers to disable&#xD;
DEP as well which really isn't an option for commercial software. Fortunately, there&#xD;
is another solution. Although there is no compiler option to turn keep the &lt;font face="Courier New"&gt;NXCOMPAT&lt;/font&gt; bit&#xD;
unset, you can still do this after compilation using the &lt;font face="Courier New"&gt;editbin.exe&lt;/font&gt; which&#xD;
comes with C++ compiler for Visual Studio 2005 and later:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;editbin.exe /NXCOMPAT:NO &amp;lt;filename.exe&amp;gt;&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This command removes the &lt;font face="Courier New"&gt;NXCOMPAT&lt;/font&gt; bit and restores&#xD;
the behavior before .NET 2.0 SP1. If your assembly was signed it also invalidates&#xD;
the signature so you'll have to resign it:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;sn.exe -R &amp;lt;filename.exe&amp;gt; &amp;lt;keyfile.snk&amp;gt;&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You can automate this by putting the two commands in the &lt;font face="Courier New"&gt;Post-build&#xD;
event command line&lt;/font&gt; for the project:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;editbin.exe /NXCOMPAT:NO "$(TargetPath)"&lt;br&gt;&#xD;
sn.exe -R "$(TargetPath)" "$(ProjectDir)&amp;lt;keyfile.snk&amp;gt;"&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You might need to call &lt;font face="Courier New"&gt;vcvars32.bat&lt;/font&gt; before that to&#xD;
put the required executables in path and enable &lt;font face="Courier New"&gt;editbin.exe&lt;/font&gt; dependencies&#xD;
to be resolved. Note that in a completely automated build scenario using &lt;font face="Courier New"&gt;MSBuild&lt;/font&gt; you'll&#xD;
have to specify full path for the &lt;font face="Courier New"&gt;vcvars32.bat&lt;/font&gt; because &lt;font face="Courier New"&gt;$(DevEnvDir)&lt;/font&gt; resolves&#xD;
to &lt;font face="Courier New"&gt;*Undefined*&lt;/font&gt; outside Visual Studio 2005. Also your&#xD;
strong name key should be in a &lt;font face="Courier New"&gt;snk&lt;/font&gt; file instead of&#xD;
a password protected &lt;font face="Courier New"&gt;pfx&lt;/font&gt; file because &lt;font face="Courier New"&gt;sn.exe&lt;/font&gt;&lt;a href="http://blogs.msdn.com/shawnfa/archive/2006/02/14/531921.aspx"&gt;doesn't&#xD;
allow&lt;/a&gt; the password to be read from a redirected standard input.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=84c751f7-f67e-47f0-9def-3035b5333cf5"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Wn6KrO9DAwYypo3spbkmc9erRnU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Wn6KrO9DAwYypo3spbkmc9erRnU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Wn6KrO9DAwYypo3spbkmc9erRnU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Wn6KrO9DAwYypo3spbkmc9erRnU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/WGiZZhe5fM8" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,84c751f7-f67e-47f0-9def-3035b5333cf5.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
      <category>Development/Vista</category>
    <feedburner:origLink>http://www.damirscorner.com/OldActiveXControlsUnderNET20SP1.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=ec1b3869-796e-4d12-8d41-614bcb51aad5</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,ec1b3869-796e-4d12-8d41-614bcb51aad5.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,ec1b3869-796e-4d12-8d41-614bcb51aad5.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ec1b3869-796e-4d12-8d41-614bcb51aad5</wfw:commentRss>
      
      <title>MonthCalendar BoldedDates in Windows Vista</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,ec1b3869-796e-4d12-8d41-614bcb51aad5.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/BI1J1_r5LIk/MonthCalendarBoldedDatesInWindowsVista.aspx</link>
      <pubDate>Mon, 14 Apr 2008 19:54:58 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
The &lt;font face="Courier New"&gt;MonthCalendar&lt;/font&gt; control's &lt;font face="Courier New"&gt;BoldedDates&lt;/font&gt; functionality&#xD;
doesn't appear to work properly on Windows Vista. The dates added to any of the &lt;font face="Courier New"&gt;BoldedDates&lt;/font&gt;, &lt;font face="Courier New"&gt;MonthlyBoldedDates&lt;/font&gt; and &lt;font face="Courier New"&gt;AnnuallyBoldedDates&lt;/font&gt; collections&#xD;
are rendered just the same as those not added to any of the collections. The same&#xD;
code works just fine on Windows XP and causes those dates to be rendered bold. The&#xD;
only workaround i've managed to &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2296827&amp;amp;SiteID=1"&gt;find&lt;/a&gt; is&#xD;
disabling visual styles in the application, i.e. commenting out the first line in&#xD;
the &lt;font face="Courier New"&gt;Program.Main()&lt;/font&gt; method of a new Windows Application:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;font face="Courier New"&gt;Application.EnableVisualStyles();&lt;/font&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=ec1b3869-796e-4d12-8d41-614bcb51aad5"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SXT_MSpMRY5FXHLCzDiijpaLDBU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SXT_MSpMRY5FXHLCzDiijpaLDBU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SXT_MSpMRY5FXHLCzDiijpaLDBU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SXT_MSpMRY5FXHLCzDiijpaLDBU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/BI1J1_r5LIk" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,ec1b3869-796e-4d12-8d41-614bcb51aad5.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
      <category>Development/Vista</category>
    <feedburner:origLink>http://www.damirscorner.com/MonthCalendarBoldedDatesInWindowsVista.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=fcd08df4-c6f8-4a1f-ae1f-c5ed70431510</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,fcd08df4-c6f8-4a1f-ae1f-c5ed70431510.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,fcd08df4-c6f8-4a1f-ae1f-c5ed70431510.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fcd08df4-c6f8-4a1f-ae1f-c5ed70431510</wfw:commentRss>
      
      <title>Playing DivX and XviD videos natively on Xbox 360</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,fcd08df4-c6f8-4a1f-ae1f-c5ed70431510.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/t2q61WrSgF8/PlayingDivXAndXviDVideosNativelyOnXbox360.aspx</link>
      <pubDate>Mon, 31 Dec 2007 11:34:14 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
The Xbox 360 Dashboard update released on 4th December 2007 added support for playing&#xD;
DivX and XviD videos natively, i.e. without installing &lt;a href="http://www.runtime360.com/projects/transcode-360/"&gt;Transcode&#xD;
360&lt;/a&gt; for Windows Media Center. Unfortunatelly this only works for media played&#xD;
directly from the dashboard and not within Media Center Extender. Since I didn't want&#xD;
to copy my videos to CDs, DVDs or other external devices, the only thing left to do&#xD;
was to setup Windows Media Player media sharing which I never had to use before.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This turned out to be more difficult than I expected - the reason being that the media&#xD;
I wanted to share wasn't stored locally but on a separate file server. By default&#xD;
such media is not shared and there are few steps one has to follow to make this work,&#xD;
as thoroughly explained &lt;a href="http://www.microsoft.com/windows/windowsmedia/player/faq/sharing.mspx#q20_17"&gt;here&lt;/a&gt;:&#xD;
&lt;/p&gt;&#xD;
        &lt;ul&gt;&#xD;
          &lt;li&gt;&#xD;
Enable remote content sharing by adding the following entry into the registry:&lt;br&gt;&lt;font face="Courier New"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer\Preferences\HME]&lt;br&gt;&#xD;
"EnableRemoteContentSharing"=dword:00000001&lt;/font&gt;&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
Grant anonymous users access to the shared folders on the file server by adding the&#xD;
read permission on the folder and on the share to the &lt;font face="Courier New"&gt;ANONYMOUS&#xD;
LOGON&lt;/font&gt; user &#xD;
&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
Modify the file server's group policy to allow anonymous access to the selected shares&#xD;
by listing them in the &lt;font face="Courier New"&gt;Network access: Shares that can be&#xD;
accessed anonymously&lt;/font&gt; policy in the &lt;font face="Courier New"&gt;Computer Configuration,&#xD;
Windows Settings, Security Settings, Local Policies, Security Options&lt;/font&gt; branch&#xD;
of the group policy tree (just run &lt;font face="Courier New"&gt;gpedit.msc&lt;/font&gt; to start&#xD;
the Group Policy Object Editor)&lt;/li&gt;&#xD;
        &lt;/ul&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=fcd08df4-c6f8-4a1f-ae1f-c5ed70431510"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/w9ouKgJ_14_zwqylTXHv2EcdGEA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w9ouKgJ_14_zwqylTXHv2EcdGEA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/w9ouKgJ_14_zwqylTXHv2EcdGEA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/w9ouKgJ_14_zwqylTXHv2EcdGEA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/t2q61WrSgF8" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,fcd08df4-c6f8-4a1f-ae1f-c5ed70431510.aspx</comments>
      <category>Personal</category>
      <category>Personal/Software</category>
    <feedburner:origLink>http://www.damirscorner.com/PlayingDivXAndXviDVideosNativelyOnXbox360.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18</wfw:commentRss>
      
      <title>Notes about RSACryptoServiceProvider</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/YseYPVXzWPc/NotesAboutRSACryptoServiceProvider.aspx</link>
      <pubDate>Sat, 24 Nov 2007 16:31:53 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
In my opinion RSACryptoServiceProvider class is seriously under-documented in MSDN.&#xD;
Since there is also no abundance of examples on the web, I spent more time than I&#xD;
should figuring out how to use it correctly. For future reference I'm listing below&#xD;
the solution to two problems I had.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The maximum byte array length for encrypting without OAEP padding is Modulus size&#xD;
- 11 which is written somewhere in the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.encrypt.aspx"&gt;Encrypt()&#xD;
method documentation&lt;/a&gt;. If you pass it a larger array it will return a not so informative&#xD;
Unspecified error. To encrypt a larger chunk of data you have to split it in smaller&#xD;
parts, encrypt them individually and concatenate them back together. You have to do&#xD;
the same when decrypting the data, with the only difference that each part has the&#xD;
size of Modulus in stead of Modulus - 11. To get the modulus size you can use the&#xD;
following piece of code (rsa is an instance of RSACryptoServiceProvider):&#xD;
&lt;/p&gt;&#xD;
        &lt;div class="CodeFormatContainer"&gt;&#xD;
          &lt;pre class="csharpcode"&gt;RSAParameters rsaParams = rsa.ExportParameters(&lt;span class="kwrd"&gt;false&lt;/span&gt;); &lt;span class="kwrd"&gt;int&lt;/span&gt; modulusSize&#xD;
= rsaParams.Modulus.Length; &lt;/pre&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Each time you instantiate RSACryptoServiceProvider it generates a new pair of keys.&#xD;
If you want to use existing ones, you can import them by calling:&#xD;
&lt;/p&gt;&#xD;
        &lt;div class="CodeFormatContainer"&gt;&#xD;
          &lt;pre class="csharpcode"&gt;rsa.FromXmlString(key);&lt;/pre&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
The key parameter is a string with the XML representation of the keys. You can get&#xD;
it by calling the ToXmlString() method once and storing its results. It's only parameter&#xD;
specifies whether to also export the private key. I guess I don't have to remind you&#xD;
that you need the private key only for decryption and that you should always keep&#xD;
it private for the encryption to make any sense at all. &#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4wz3bvY_quvhYTWbGHn_Od017oY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4wz3bvY_quvhYTWbGHn_Od017oY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4wz3bvY_quvhYTWbGHn_Od017oY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4wz3bvY_quvhYTWbGHn_Od017oY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/YseYPVXzWPc" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,eeb23ba8-38df-4a7b-8b2e-3fd5132e8a18.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
    <feedburner:origLink>http://www.damirscorner.com/NotesAboutRSACryptoServiceProvider.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=52003afd-e963-49d3-a950-388855fed432</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,52003afd-e963-49d3-a950-388855fed432.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,52003afd-e963-49d3-a950-388855fed432.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=52003afd-e963-49d3-a950-388855fed432</wfw:commentRss>
      
      <title>Always close DeflateStream before reading results</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,52003afd-e963-49d3-a950-388855fed432.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/o9rQXZpDsWU/AlwaysCloseDeflateStreamBeforeReadingResults.aspx</link>
      <pubDate>Sat, 24 Nov 2007 15:44:37 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Is the code below correct? Will inputString and outputString be equal?&#xD;
&lt;/p&gt;&#xD;
        &lt;div class="CodeFormatContainer"&gt;&#xD;
          &lt;div class="CodeFormatContainer"&gt;&#xD;
            &lt;pre class="csharpcode"&gt;&#xD;
              &lt;span class="kwrd"&gt;string&lt;/span&gt; inputString&#xD;
= &lt;span class="str"&gt;"The text to compress and decompress"&lt;/span&gt;; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[]&#xD;
inputArray = Encoding.UTF8.GetBytes(inputString); MemoryStream stream = &lt;span class="kwrd"&gt;new&lt;/span&gt; MemoryStream();&#xD;
DeflateStream compressionStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; DeflateStream(stream,&#xD;
CompressionMode.Compress); compressionStream.Write(inputArray, 0, inputArray.Length);&#xD;
compressionStream.Flush(); stream.Position = 0; DeflateStream decompressionStream&#xD;
= &lt;span class="kwrd"&gt;new&lt;/span&gt; DeflateStream(stream, CompressionMode.Decompress); &lt;span class="kwrd"&gt;byte&lt;/span&gt;[]&#xD;
outputArray = &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;byte&lt;/span&gt;[inputArray.Length];&#xD;
decompressionStream.Read(outputArray, 0, outputArray.Length); &lt;span class="kwrd"&gt;string&lt;/span&gt; outputString&#xD;
= Encoding.UTF8.GetString(outputArray); Console.WriteLine(outputString == inputString);&#xD;
Console.ReadLine(); &lt;/pre&gt;&#xD;
          &lt;/div&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
As it turns out, they won't. The reason for it being that compressionStream.Close()&#xD;
was not called before reading from stream started. Calling compressionStream.Flush()&#xD;
is not enough in this case. I haven't managed to find this documented anywhere but&#xD;
the example in the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.io.compression.deflatestream.aspx"&gt;DeflateStream&#xD;
documentation&lt;/a&gt; does it correctly. You can find the fixed code below. Notice the&#xD;
additional last parameter in the first call to the DeflateStream constructor. Without&#xD;
it stream will also be closed when compressionStream gets closed.&#xD;
&lt;/p&gt;&#xD;
        &lt;div class="CodeFormatContainer"&gt;&#xD;
          &lt;div class="CodeFormatContainer"&gt;&#xD;
            &lt;pre class="csharpcode"&gt;&#xD;
              &lt;span class="kwrd"&gt;string&lt;/span&gt; inputString&#xD;
= &lt;span class="str"&gt;"The text to compress and decompress"&lt;/span&gt;; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[]&#xD;
inputArray = Encoding.UTF8.GetBytes(inputString); MemoryStream stream = &lt;span class="kwrd"&gt;new&lt;/span&gt; MemoryStream();&#xD;
DeflateStream compressionStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; DeflateStream(stream,&#xD;
CompressionMode.Compress, &lt;span class="kwrd"&gt;true&lt;/span&gt;); compressionStream.Write(inputArray,&#xD;
0, inputArray.Length); compressionStream.Close(); stream.Position = 0; DeflateStream&#xD;
decompressionStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; DeflateStream(stream, CompressionMode.Decompress); &lt;span class="kwrd"&gt;byte&lt;/span&gt;[]&#xD;
outputArray = &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;byte&lt;/span&gt;[inputArray.Length];&#xD;
decompressionStream.Read(outputArray, 0, outputArray.Length); &lt;span class="kwrd"&gt;string&lt;/span&gt; outputString&#xD;
= Encoding.UTF8.GetString(outputArray); Console.WriteLine(outputString == inputString);&#xD;
Console.ReadLine(); &lt;/pre&gt;&#xD;
          &lt;/div&gt;&#xD;
        &lt;/div&gt;&#xD;
        &lt;p&gt;&#xD;
Thanks once again to my coworker for suggesting this when I was already running out&#xD;
of ideas.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=52003afd-e963-49d3-a950-388855fed432"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OzIvBxVD8QIN0tgx8x_mqq8IoDo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OzIvBxVD8QIN0tgx8x_mqq8IoDo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OzIvBxVD8QIN0tgx8x_mqq8IoDo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OzIvBxVD8QIN0tgx8x_mqq8IoDo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/o9rQXZpDsWU" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,52003afd-e963-49d3-a950-388855fed432.aspx</comments>
      <category>Development</category>
      <category>Development/.NET</category>
    <feedburner:origLink>http://www.damirscorner.com/AlwaysCloseDeflateStreamBeforeReadingResults.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.damirscorner.com/Trackback.aspx?guid=90fc52c2-c73a-4709-900b-6f96fb4c9f1e</trackback:ping>
      <pingback:server>http://www.damirscorner.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.damirscorner.com/PermaLink,guid,90fc52c2-c73a-4709-900b-6f96fb4c9f1e.aspx</pingback:target>
      <dc:creator>Damir Arh</dc:creator>
      <wfw:comment>http://www.damirscorner.com/CommentView,guid,90fc52c2-c73a-4709-900b-6f96fb4c9f1e.aspx</wfw:comment>
      <wfw:commentRss>http://www.damirscorner.com/SyndicationService.asmx/GetEntryCommentsRss?guid=90fc52c2-c73a-4709-900b-6f96fb4c9f1e</wfw:commentRss>
      
      <title>Location of PowerPoint AutoRecover files</title>
      <guid isPermaLink="false">http://www.damirscorner.com/PermaLink,guid,90fc52c2-c73a-4709-900b-6f96fb4c9f1e.aspx</guid>
      <link>http://feedproxy.google.com/~r/damircorner/~3/bSMvAAqyknI/LocationOfPowerPointAutoRecoverFiles.aspx</link>
      <pubDate>Sat, 24 Nov 2007 14:11:03 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Not so long ago I've been called to my boss's office to prevent him losing unsaved&#xD;
work in a PowerPoint presentation. It turned out that when he tried to save the file&#xD;
to a new location the message box with the overwrite warning for some reason didn't&#xD;
render completely and it was impossible to close it. As it turned out at the end I&#xD;
could have just killed the application and restart it, since the AutoRecover feature&#xD;
kicked in and offered a version of the file with all changes applied.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
But just to be on the save side I wanted to copy the AutoRecover files to a save location&#xD;
before actually killing the application. But unlike Word or Excel where the location&#xD;
of these files is set in the options, PowerPoint does not have such an option. After&#xD;
some googling I finally stumbled across &lt;a href="http://office.microsoft.com/en-us/help/HA101578851033.aspx"&gt;a&#xD;
page&lt;/a&gt;, correctly stating that the files are stored in the %temp% folder and named&#xD;
ppt*.tmp. I decided to publish this info here just in case I need it again.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://www.damirscorner.com/aggbug.ashx?id=90fc52c2-c73a-4709-900b-6f96fb4c9f1e"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3z7FNOvVth8o6ves5QkdjuRKXgE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3z7FNOvVth8o6ves5QkdjuRKXgE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3z7FNOvVth8o6ves5QkdjuRKXgE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3z7FNOvVth8o6ves5QkdjuRKXgE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/damircorner/~4/bSMvAAqyknI" height="1" width="1"/&gt;</description>
      <comments>http://www.damirscorner.com/CommentView,guid,90fc52c2-c73a-4709-900b-6f96fb4c9f1e.aspx</comments>
      <category>Personal</category>
      <category>Personal/Software</category>
    <feedburner:origLink>http://www.damirscorner.com/LocationOfPowerPointAutoRecoverFiles.aspx</feedburner:origLink></item>
  </channel>
</rss>
