Blogging Tip #2

People who are used to Visual Studio IDE 2005 / 2008 are accustomed to seeing code snippets with colors to identify different constructs like class, interface, access specifiers, keywords etc etc. Sites like MSDN, code project, code plex etc show similar code snippets which are identical to that of visual studio color schemes.

This feature of visual studio makes it easier to understand different code constructs. The problem arises when some one like me tries to insert code snippets in the blog entries that I write. The blog service I use for my blogs is Blogger. If I copy the code from Visual Studio and paste it in my blog editor, all the formatting is gone for a toss. You see multiple line breaks when you are expecting a single line break between two lines. The indentation is not proper. The braces don't match properly etc. etc.

Ideally I would like to retain the visual studio formatting so that when I paste text blocks from source code window to the blog editor, it resembles the same. Fortunately there are few addins available on the net which can be used to copy source code from visual studio code editor as a HTML text rather than plain text. My sincere thanks to the people who developed such addin to help others.

Following are some of the source code addins available on the net.

Copy Source As HTML (CSAH)

Paste from Visual Studio

 

Here is an example of source code copied with the help of Copy Source As HTML Addin.

public class TestClass

    {

        /// <summary>

        /// Constructor

        /// </summary>

        public TestClass()

        {

            Console.WriteLine("Hello World");

        }

    }

 

 

Hope this helps.

spacer

Blogging Tip #1

One of the problem I found while blogging technical articles was that I could not attach source code or solution files to the blog entry. Since I am using the free blog service provided by Blogger, there is restriction on the type of files those can be uploaded from the local machine to the server where blog is hosted. I can upload only photos or image files. If I wanted to upload a zip file I had to look for some other blog service (most of the free blog servers have these restrictions).

I was looking for a simple solution to this problem. I came across a free file sharing software called DropBox. This software allows you to share files on your local system with others. you can put files in public folders and share the link with other users.

I am planning to use this facility to upload code snippets and related solution files to my blog. If you are interested in doing the same please refer to this link.

This software can be used to share other files which can be accessed using a web URL. This is secured and you can restrict the other users from accessing the personal files. it also provides a mechanism for sharing files with specific users.

Last but not the least, if you click on the above link it might help me increase my storage capacity by few MBs. By default 2 GB of space is allocated for free users. In my opinion its quite a bit, but if you benefit from this there is no harm in me earning few extra bytes to store :)

Apart from the DropBox file sharing that I mentioned there are other free alternatives like

4shared which gives about 5 GB storage space

KeepAndShare 

Mediafire

Sendspace - allows uploads upto 300 MB at a time.

Box - has multiple flavors. the free account is called Lite and supports upto 1 GB storage with maximum of 25 MB at a time.

Badongo

You can choose the right file sharing software as per your needs.

Hope this helps!!!

spacer