<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1433316563994716974</id><updated>2024-09-27T05:27:51.541+05:00</updated><category term="code"/><category term="competition"/><category term="configuration"/><category term="topcoder"/><title type='text'>Everything is possible</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1433316563994716974.post-4146659472888464606</id><published>2011-10-07T18:19:00.001+06:00</published><updated>2011-10-07T18:21:41.364+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><title type='text'>Python script to backup/restore Azure Storage blobs</title><content type='html'>Recently I wrote python script to backup/restore all blobs from Windows Azure Storage account.&lt;br /&gt;
You can find it on github&lt;br /&gt;
&lt;a href=&quot;https://github.com/vsevolodp/azure-storage-backup&quot;&gt;https://github.com/vsevolodp/azure-storage-backup&lt;/a&gt;&lt;br /&gt;
or download as a &lt;a href=&quot;https://github.com/vsevolodp/azure-storage-backup/zipball/master&quot;&gt;zip archive&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
To see how to use it run:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; $ python as-backup.py&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
See README file for more info about supported fatures</content><link rel='replies' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/4146659472888464606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vsevolodp.blogspot.com/2011/10/python-script-to-backup-azure-storage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/4146659472888464606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/4146659472888464606'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/2011/10/python-script-to-backup-azure-storage.html' title='Python script to backup/restore Azure Storage blobs'/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1433316563994716974.post-7337015839773649082</id><published>2011-09-19T17:07:00.001+06:00</published><updated>2011-09-19T17:20:56.173+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><title type='text'>How to migrate Azure Storage data after upgrade to Azure SDK 1.5</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;After Azure SDK 1.5 installation complete you will see that all your data disappeared from Storage. This is because installation will create new database in your SQL Express instance. But all your data still there. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijtc3VmS-vfsvO-kEI8fiTxjbEps4FJlvPdpKZBl-Ls9s2yhOvOX9rKC70sH7ClgAfYepVd8m2SiyoFEhVor3AArvFdpTwOHn_X2kqQMjpYkdCVzQ3TL0FtzspMXLAmHtSoOl9clw3zqg/s1600/storage-data-migr-1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijtc3VmS-vfsvO-kEI8fiTxjbEps4FJlvPdpKZBl-Ls9s2yhOvOX9rKC70sH7ClgAfYepVd8m2SiyoFEhVor3AArvFdpTwOHn_X2kqQMjpYkdCVzQ3TL0FtzspMXLAmHtSoOl9clw3zqg/s320/storage-data-migr-1.png&quot; width=&quot;308&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;Microsoft SQL Server Management Studio&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;As you can see I had previous database created 2009-09-19.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;So you need to move your data into new database. To do it open new query editing window and copy/paste/run the script below (double-click to Select all).&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;And don&#39;t forget to change names of the databases!&lt;/div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;BEGIN TRANSACTION
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[BlobContainer]
 ([AccountName]
 ,[ContainerName]
 ,[LastModificationTime]
 ,[ServiceMetadata]
 ,[Metadata])
SELECT [AccountName]
      ,[ContainerName]
      ,[LastModificationTime]
      ,[ServiceMetadata]
      ,[Metadata]
  FROM [DevelopmentStorageDb20090919].[dbo].[BlobContainer]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[BlockData]
 ([AccountName]
 ,[ContainerName]
 ,[BlobName]
 ,[VersionTimestamp]
 ,[IsCommitted]
 ,[BlockId]
 ,[Length]
 ,[Data])
SELECT [AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[IsCommitted]
      ,[BlockId]
      ,[Length]
      ,[Data]
  FROM [DevelopmentStorageDb20090919].[dbo].[BlockData]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[Blob]
 ([AccountName]
 ,[ContainerName]
 ,[BlobName]
 ,[VersionTimestamp]
 ,[BlobType]
 ,[CreationTime]
 ,[LastModificationTime]
 ,[ContentLength]
 ,[ContentType]
 ,[ContentMD5]
 ,[ServiceMetadata]
 ,[Metadata]
 ,[LeaseId]
 ,[LeaseTypeInt]
 ,[LeaseDuration]
 ,[LeaseEndTime]
 ,[SequenceNumber]
 ,[IsCommitted]
 ,[HasBlock]
 ,[UncommittedBlockIdLength]
 ,[MaxSize]
 ,[FileName])
SELECT [AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[BlobType]
      ,[CreationTime]
      ,[LastModificationTime]
      ,[ContentLength]
      ,[ContentType]
      ,[ContentMD5]
      ,[ServiceMetadata]
      ,[Metadata]
      ,[LeaseId]
      ,[LeaseTypeInt]
      ,[LeaseDuration]
      ,[LeaseEndTime]
      ,[SequenceNumber]
      ,[IsCommitted]
      ,[HasBlock]
      ,[UncommittedBlockIdLength]
      ,[MaxSize]
      ,[FileName]
  FROM [DevelopmentStorageDb20090919].[dbo].[Blob]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[CommittedBlock] 
 ([AccountName]
 ,[ContainerName]
 ,[BlobName]
 ,[VersionTimestamp]
 ,[Offset]
 ,[BlockId]
 ,[Length]
 ,[BlockVersion])
SELECT [AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[Offset]
      ,[BlockId]
      ,[Length]
      ,[BlockVersion]
  FROM [DevelopmentStorageDb20090919].[dbo].[CommittedBlock]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[Page]  
 ([AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[StartOffset]
      ,[EndOffset]
      ,[FileOffset])
SELECT [AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[StartOffset]
      ,[EndOffset]
      ,[FileOffset]
  FROM [DevelopmentStorageDb20090919].[dbo].[Page]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[CurrentPage]  
 ([AccountName]
 ,[ContainerName]
 ,[BlobName]
 ,[VersionTimestamp]
 ,[StartOffset]
 ,[EndOffset])
SELECT [AccountName]
      ,[ContainerName]
      ,[BlobName]
      ,[VersionTimestamp]
      ,[StartOffset]
      ,[EndOffset]
  FROM [DevelopmentStorageDb20090919].[dbo].[CurrentPage]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[QueueContainer]
 ([AccountName]
 ,[QueueName]
 ,[LastModificationTime]
 ,[ServiceMetadata]
 ,[Metadata])
SELECT [AccountName]
      ,[QueueName]
      ,[LastModificationTime]
      ,[ServiceMetadata]
      ,[Metadata]
  FROM [DevelopmentStorageDb20090919].[dbo].[QueueContainer]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[QueueMessage]  
 ([AccountName]
 ,[QueueName]
 ,[VisibilityStartTime]
 ,[MessageId]
 ,[ExpiryTime]
 ,[InsertionTime]
 ,[DequeueCount]
 ,[Data])
SELECT [AccountName]
      ,[QueueName]
      ,[VisibilityStartTime]
      ,[MessageId]
      ,[ExpiryTime]
      ,[InsertionTime]
      ,[DequeueCount]
      ,[Data]
  FROM [DevelopmentStorageDb20090919].[dbo].[QueueMessage]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[TableContainer]
 ([AccountName]
 ,[TableName]
 ,[LastModificationTime]
 ,[ServiceMetadata]
 ,[Metadata]
 ,[SchemaXml])
SELECT [AccountName]
      ,[TableName]
      ,[LastModificationTime]
      ,[ServiceMetadata]
      ,[Metadata]
      ,[SchemaXml]
  FROM [DevelopmentStorageDb20090919].[dbo].[TableContainer]
GO

INSERT INTO [DevelopmentStorageDb20110816].[dbo].[TableRow]  
 ([AccountName]
 ,[TableName]
 ,[PartitionKey]
 ,[RowKey]
 ,[Timestamp]
 ,[Data])
SELECT [AccountName]
      ,[TableName]
      ,[PartitionKey]
      ,[RowKey]
      ,[Timestamp]
      ,[Data]
  FROM [DevelopmentStorageDb20090919].[dbo].[TableRow]
GO

COMMIT TRANSACTION
GO
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/7337015839773649082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vsevolodp.blogspot.com/2011/09/how-to-migrate-azure-storage-data-after.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/7337015839773649082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/7337015839773649082'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/2011/09/how-to-migrate-azure-storage-data-after.html' title='How to migrate Azure Storage data after upgrade to Azure SDK 1.5'/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijtc3VmS-vfsvO-kEI8fiTxjbEps4FJlvPdpKZBl-Ls9s2yhOvOX9rKC70sH7ClgAfYepVd8m2SiyoFEhVor3AArvFdpTwOHn_X2kqQMjpYkdCVzQ3TL0FtzspMXLAmHtSoOl9clw3zqg/s72-c/storage-data-migr-1.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1433316563994716974.post-92710302392962259</id><published>2011-04-26T23:04:00.003+06:00</published><updated>2011-04-27T01:41:28.046+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><category scheme="http://www.blogger.com/atom/ns#" term="competition"/><category scheme="http://www.blogger.com/atom/ns#" term="topcoder"/><title type='text'></title><content type='html'>Just finished TOPCODER SRM 504 DIVISION 2 competition. Solved 250 and 500 point problems.&lt;br /&gt;
&lt;br /&gt;
Here are my solutions in C#&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;using System;

public class ComparerInator
{
    public delegate TResult Func&amp;lt;T1, T2, TResult&amp;gt;(T1 arg1, T2 arg2);
    
    public int makeProgram(int[] A, int[] B, int[] wanted)
    {
        if (test(A, B, wanted, f_a) || test(A, B, wanted, f_b))
            return 1;
        if (test(A, B, wanted, f_ab) || test(A, B, wanted, f_ba))
            return 7;
            
        return -1;
    }
    
    bool test(int[] A, int[] B, int[] wanted, Func&amp;lt;int, int, int&amp;gt; f)
    {
        for (int i=0; i &amp;lt; A.Length; i++)
        {
            if (f(A[i], B[i]) == wanted[i])
                continue;
                
            return false;
        }
        
        return true;
    }
    
    int f_a(int a, int b)
    {
        return a;
    }
    
    int f_b(int a, int b)
    {
        return b;
    }
    
    int f_ab(int a, int b)
    {
        return a&amp;lt;b?a:b;
    }
    
    int f_ba(int a, int b)
    {
        return a&amp;lt;b?b:a;
    }
}&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;using System;
using System.Text;

public class MathContest
{
    public int countBlack(String ballSequence, int repetitions)
    {
        StringBuilder sb = new StringBuilder(ballSequence.Length * repetitions);
        for (int i = 0; i &lt; repetitions; i++)
            sb.Append(ballSequence);
            
        s = sb.ToString();
        
        pos = -1;
        invert = false;
        direction = 1;
        end = s.Length - 1;
        
        int count = 0;
        
        char ball = get_next();
        while (ball != (Char)0)
        {
            if (ball == &#39;B&#39;)
                count++;
            ball = get_next();
        }
        
        return count;
    }

    string s;
    int pos;
    bool invert;
    int direction;
    int end;

    char get_next()
    {
        if (pos == end)
            return (Char)0;    
            
        pos += direction;
        char ch = s[pos];
        
        if (invert)
        {
            if (ch == &#39;B&#39;)
                ch = &#39;W&#39;;
            else
                ch = &#39;B&#39;;
        }
        
        if (ch == &#39;B&#39;)
            invert = invert ? false : true;
        else
        {
            int t = end;
            end = pos + direction;
            pos = t + direction;
            direction = direction == 1 ? -1 : 1;
        }
        
        return ch;
    }
}&lt;/pre&gt;
Unfortunately I&#39;ve made a mistake in 500-point problem. Instead of
&lt;pre class=&quot;brush:csharp&quot;&gt;end = pos + direction;
            pos = t + direction;
&lt;/pre&gt;I wrote
&lt;pre class=&quot;brush:csharp&quot;&gt;end = pos;
            pos = t;
&lt;/pre&gt;so my solution was successfully challenged and gave me zero points.&lt;br /&gt;
&lt;br /&gt;
More then it - it was my first competition on TopCoder and there was a problem running the engine. So results are not go to rating. Well... next time.</content><link rel='replies' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/92710302392962259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vsevolodp.blogspot.com/2011/04/just-finished-topcoder-srm-504-division.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/92710302392962259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/92710302392962259'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/2011/04/just-finished-topcoder-srm-504-division.html' title=''/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1433316563994716974.post-1745150452582610534</id><published>2010-11-14T03:58:00.010+05:00</published><updated>2011-01-31T03:53:01.464+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="code"/><title type='text'>How to decode Encoded-Word header values in emails</title><content type='html'>Here is C# code to decode &lt;a href=&quot;http://en.wikipedia.org/wiki/MIME#Encoded-Word&quot;&gt;Encoded-Word&lt;/a&gt; header values in emails.&lt;br /&gt;
Features:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;supports encoding of multi-line values&lt;/li&gt;
&lt;li&gt;supports both Q- and base64 encoding&lt;/li&gt;
&lt;li&gt;passes all samples in&amp;nbsp;&lt;a href=&quot;http://www.faqs.org/rfcs/rfc2047.html&quot;&gt;RFC 2047&lt;/a&gt;, section &quot;8. Examples&quot;&lt;/li&gt;
&lt;/ul&gt;&lt;pre class=&quot;brush:csharp&quot;&gt;public class EncodedWordEncoding
    {
        public static string Decode(string encodedText)
        {
            if (encodedText == null)
                return null;

            var regex = new Regex(@&quot;=\?(?&amp;lt;charset&amp;gt;.*?)\?(?&amp;lt;encoding&amp;gt;[qQbB])\?(?&amp;lt;value&amp;gt;.*?)\?=&quot;);
            var encodedString = encodedText;
            var decodedString = string.Empty;
            var encodedWordBefore = false;

            while (encodedString.Length &amp;gt; 0)
            {
                var match = regex.Match(encodedString);
                if (match.Success)
                {

                    // If the match isn&#39;t at the start of the string, copy the initial few chars to the output
                    var beforeMatch = encodedString.Substring(0, match.Index);

                    // Filter out space chars between encoded words
                    if (encodedWordBefore)
                    {
                        var regex2 = new Regex(@&quot;(\r?\n|\r)*[ \t]+&quot;);
                        var match2 = regex2.Match(beforeMatch);
                        if (match2.Success &amp;amp;&amp;amp; match2.Value == beforeMatch)
                            beforeMatch = &quot;&quot;;
                    }

                    decodedString += beforeMatch;

                    var charset = match.Groups[&quot;charset&quot;].Value;
                    var encoding = match.Groups[&quot;encoding&quot;].Value.ToUpper();
                    var value = match.Groups[&quot;value&quot;].Value;

                    var contentEncoding = Encoding.GetEncoding(charset);

                    if (encoding.Equals(&quot;B&quot;))
                    {
                        // Encoded value is Base-64
                        var bytes = Convert.FromBase64String(value);
                        decodedString += contentEncoding.GetString(bytes);
                    }
                    else if (encoding.Equals(&quot;Q&quot;))
                    {
                        decodedString +=
                           QuotedPrintableEncoding.Decode(value, contentEncoding).Replace(&quot;_&quot;, &quot; &quot;);
                    }
                    else
                    {
                        // Encoded value not known, return original string
                        // (Match should not be successful in this case, so this code may never get hit)
                        decodedString += encodedString;
                        break;
                    }

                    // Trim off up to and including the match, then we&#39;ll loop and try matching again.
                    encodedString = encodedString.Substring(match.Index + match.Length);

                    encodedWordBefore = true;
                }
                else
                {
                    // No match, not encoded, return original string
                    decodedString += encodedString;
                    break;
                }
            }

            return decodedString;
        }
    }

    public static class QuotedPrintableEncoding
    {
        public static string Decode(string text, Encoding encoding)
        {
            if (text == null)
                throw new ArgumentNullException(&quot;text&quot;);
            if (encoding == null)
                throw new ArgumentNullException(&quot;encoding&quot;);

            if (text.Length == 0)
                return text;

            text = text.Replace(&quot;=\r\n&quot;, &quot;&quot;);

            var regex = new Regex(@&quot;(=[0-9A-F][0-9A-F])+&quot;, RegexOptions.Multiline | RegexOptions.IgnoreCase);

            return regex.Replace(text, m =&amp;gt;
                {
                    if (m.Value.Length % 3 != 0)
                        throw new InvalidOperationException(&quot;Unexpected match length.&quot;);

                    var bytes = m.Value.Split(new[] { &#39;=&#39; }, StringSplitOptions.RemoveEmptyEntries)
                        .Select(v =&amp;gt; byte.Parse(v, NumberStyles.HexNumber));

                    return encoding.GetString(bytes.ToArray());
                });
        }
    }
&lt;/pre&gt;&lt;br /&gt;
Code used from&amp;nbsp;klaas114&#39;s&amp;nbsp;&lt;a href=&quot;http://www.dreamincode.net/forums/topic/48017-how-to-decode-quoted-printable-encoded-string/page__view__findpost__p__695902&quot;&gt;post&lt;/a&gt;&amp;nbsp;and&amp;nbsp;Dave&#39;s&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/2226554/c-class-for-decoding-quoted-printable-encoding/2236192#2236192&quot;&gt;post&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
UPDATE 31 Jan 2010: implemented my own quoted-printable decoder.</content><link rel='replies' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/1745150452582610534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vsevolodp.blogspot.com/2010/11/how-to-decode-encoded-word-header.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/1745150452582610534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/1745150452582610534'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/2010/11/how-to-decode-encoded-word-header.html' title='How to decode Encoded-Word header values in emails'/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1433316563994716974.post-5763826487700686705</id><published>2010-10-04T00:59:00.014+06:00</published><updated>2010-11-14T04:09:39.750+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="configuration"/><title type='text'>How to move Microsoft Help Library (Visual Studio 2010)</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;On the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd264831.aspx&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Help Library Manager&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;page you can read that you can not move the content of the&amp;nbsp;library.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I&#39;ve found a couple of ways to do this actually.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;Hacking windows registry&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You can change this setting in the registry key:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v1.0\LocalStore&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;This is a general direction and may change in next versions of the&amp;nbsp;Microsoft Help Library.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Copy your files to new location&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Change the key value&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Start the Help Library Manager, go to Settings and check the path is correct&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Click the &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Check for updates online&lt;/span&gt;&lt;/i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; link to check your content&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;First time run... Again&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Also you can tell the Help Library Manager to start as first time and then set a new location.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Start notepad or your favorite editor with administrator&amp;nbsp;privileges&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Open the file&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&quot;C:\Program Files\Microsoft Help Viewer\v1.0\HelpLibManager.exe.config&quot;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;and change&amp;nbsp;&lt;i&gt;FirstTimeRun &lt;/i&gt;key value to True&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Start the Help Library Manager and set new location&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;b&gt;Finally&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Open file &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&quot;HelpLibrary\manifest\queryManifest.N.xml&quot;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt; (mine is queryManifest.4.xml) and correct &lt;i&gt;catalogPath&lt;/i&gt; and &lt;i&gt;contentPath&lt;/i&gt; values.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Close the Help Library Agent if it&#39;s running (look at the tray area). &lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vsevolodp.blogspot.com/feeds/5763826487700686705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vsevolodp.blogspot.com/2010/10/how-to-move-microsoft-help-library.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/5763826487700686705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1433316563994716974/posts/default/5763826487700686705'/><link rel='alternate' type='text/html' href='http://vsevolodp.blogspot.com/2010/10/how-to-move-microsoft-help-library.html' title='How to move Microsoft Help Library (Visual Studio 2010)'/><author><name>Vsevolod Parfenov</name><uri>http://www.blogger.com/profile/00095603711829041773</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/-_0PdTUL4HIc/T8NSI0u79yI/AAAAAAAAA5U/4fut_Se8GEk/s220/avatar.jpg'/></author><thr:total>6</thr:total></entry></feed>