SVN : Utility commands

February 3, 2011 4 comments

List of SVN utility commands that I needed to use frequently apart from commit and update. Feel free to add to the list

  • Know SVN binary path
    which svn
    
  • Know SVN server version installed
    svnadmin --version
    
  • Know SVN Client server version installed
    svn --version
    
  • Create SVN Respository
    svnadmin create path/to/repository/reponame
    

    You can then assign permissions to reponame directory like you do on any other directory
  • Upgrade SVN Respository version
    svnadmin upgrade path/to/repository
    

Related posts

Categories: Linux, SVN

C# Word Automation: Solve “The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)”

December 29, 2010 5 comments

Assignment:
Export data in word 2003 format using COM Interop

Problem:
First time export worked just fine. Second time, I received exception “The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)” for “Microsoft.Office.Interop.Word”

Solution:

  
public class CDocumentExporter
{
        static ApplicationClass _word_application;

        public static ApplicationClass AppClass
        {
            get
            {

                if (_word_application == null)
                {
                    _word_application = new ApplicationClass();
                    _word_application.ApplicationEvents2_Event_Quit += new ApplicationEvents2_QuitEventHandler(_word_application_ApplicationEvents2_Event_Quit);
                }
                return _word_application;
            }
        }

        static void _word_application_ApplicationEvents2_Event_Quit()
        {
            _word_application = null;
        }
}//end of class

And just use the CDocumentExporter.AppClass wherever necessary

Important information

You need to add a COM reference to your favorite word object library which should in turn add

Related Posts
Categories: .NET

C# Word Automation: Inserting Images

December 23, 2010 3 comments

I was looking for a way to insert images at a bookmark in a word document and thought should document these for future reference

CImage class Definition

public class CImage
{
        public string Path
        {
            get;
            set;
        }

        public decimal Id
        {
            get;
            set;
        }

        public string Title
        {
            get;
            set;
        }

        public Image Bitmap
        {
            get;
            set;
        }

        public bool BusyLoading
        {
            get;
            set;
        }

        public void GetImage()
        {
            try
            {
                BusyLoading = true;
                WebRequest req = WebRequest.Create(Path);
                WebResponse response = req.GetResponse();
                Stream stream = response.GetResponseStream();

                Bitmap = Image.FromStream(stream);
                stream.Close();
            }
            catch
            {
                Bitmap = null;
            }
            finally
            {
                BusyLoading = false;
            }
        }
}

Scenario 1:
You have a path of the image file which is to be inserted

public static void SetBookMark(Document p_objWordDocument, string p_strName,
          CImage p_objImage)
        {
            if (p_objWordDocument.Bookmarks.Exists(p_strName))
            {
                object objBookMark = p_strName;
                p_objWordDocument.Bookmarks.get_Item(ref objBookMark).Range.InlineShapes.AddPicture(p_objImage.Path, ... dozons of object params ...);
            }
        }

Scenario 2:
When you have the bitmap in memory

public static void SetBookMark(Document p_objWordDocument, string p_strName,
           CImage p_objImage)
        {
            if (p_objWordDocument.Bookmarks.Exists(p_strName))
            {
                object objBookMark = p_strName;
                Clipboard.SetDataObject(p_objImage.Bitmap);
                p_objWordDocument.Bookmarks.get_Item(ref objBookMark).Range.Paste();
            }
        }

Important information

You need to add a COM reference to your favorite word object library which should in turn add

Related Posts
Categories: .NET

Brain munch: Money

March 5, 2010 Leave a comment

Money is a toy introduced by mankind for mankind to be engaged for lifetime.

Categories: Brain Munch

IIS: How to map a domain name to a web site

January 2, 2010 9 comments

This post explains how to map domain names with IIS web site

Assumptions:

  • We have IIS hosted on a server with static IP and internet access (:|)
  • We own a public domain name (:|) which is to be mapped (:|)

For demo, I am assuming following values

  • server IP address : 222.222.222.222
  • public domain name to be mapped: map.jyotsna.com

Please note that these values are for demostration purpose only. I, in no way, own these.

To do: For IIS version 7

  1. Add and ‘A’ record to your DNS settings with value = IP of server. So my “A” record for jyotsna.com has value = 222.222.222.222
  2. Create a web site in IIS – if needed. For demostration, I am going to use “Default Web Site”
  3. Select the web site and choose bindings in Actions pane.
  4. In the Site Bindings dialog box, select the binding for which you want to add a host header and then click Edit or click Add to add a new binding with a host header.
  5. In the Host name box, type a host header for the site, which in my case is map.jyotsna.com
    IIS 7 edit website binding

    IIS 7 edit website binding

  6. Click on OK/ Apply to close all windows. There is NO NEED to restart IIS to reflect the changes.

To do: For IIS version 5.1 till 6

  1. Add and ‘A’ record to your DNS settings with value = IP of server. So my “A” record for jyotsna.com has value = 222.222.222.222
  2. Create a web site in IIS – if needed. For demostration, I am going to use “Default Web Site”
  3. Right click the concerned web site -> properties. In the “Web Site” tab, click on “Advanced” button.

    website

  4. In “Multiple identities for this Web Site” section, click “Add” button.

    Advanced

  5. You now need to mention three values
    Add
    • IP Address – this is IP address of the server. In my case it will be 222.222.222.222
    • TCP port – I want this website to be available on map.jyotsna.com irrespective of the actual IIS port assigned to “Default web site”. Hence I am going to specify 80. If I wanted the site to be available on map.jyotsna.com:666, I would have specified 666 as this value.
    • Host Header Name – map.jyotsna.com
  6. Click on OK/ Apply to close all windows. There is NO NEED to restart IIS to reflect the changes.

Related articles:

  1. Setting default virtual directory for your website
Categories: IIS

tortoise SVN: Copy a SVN bound directory to another repository

November 30, 2009 1 comment

Task at hand:
Copy a directory from within one SVN repository to another

Assumptions:
- Tortoise SVN as SVN client
- The two SVN repositories – being copied from and being copied to already exist

Steps:
1. Right click SVN bound directory that you with to copy. Choose tortoise SVN -> Export.
2. Specify path to an empty folder e.g. “c:\to_add”. Click on OK.
3. Now you have the SVN bound directory contents in this new directory “to_add”.
4. Right click on “to_add” and choose tortoise svn -> add
5. Specify path to the new repository and location inside it.
6. Right click on “to_add” and choose SVN Commit to make your changes permanent.

Voila !! You are done.

Categories: SVN

Brain munch: Crowd

July 8, 2009 3 comments

Crowd is gathering of people who think feeling lonely with other people is better than feeling lonely alone !

Categories: Brain Munch
Follow

Get every new post delivered to your Inbox.

Join 400 other followers