IBlog

July 20, 2011

Word documents and merging two branches

Filed under: Uncategorized — Himanshu @ 11:46 pm

Do you create word documents? Do you send them for review to your boss? I think, answers of both of these questions will be “yes” for most people, and I’m not exception! MS Word have a good feature – Track Changes. As it’s name suggests, it  tracks the changes while document is being edited, and can show final (edited version) of the document or can show final document with highlighting changes . While changes are highlighted, they are easy to notice and can also navigation across changes easily.

But, if your boss forgot to start the change tracking, then? Well, not to worry, word can do merging of two different branches like a version control. Steps:

  1. Very important! Make sure you are having extra copy (backup) of both the documents (your copy and boss’s copy). Just in case we create mess in the process, you don’t loose your valuable information in these documents.
  2. After making sure both documents (e.g. “My Copy” and “Boss’s Copy”) are closed, open “Boss’s Copy” document in MS Word.
  3. Invoke “Save as“ operation and try and save it over “My Copy” of the document. (Notice already open document name and Save as name in the image)
  4. Word should prompt you for different available option, having one of them to be “Merge changes into existing files” (for example, as  depicted in image), select it and continue with “Save as” operation.

In the result of above, “My Copy” document will be updated as if Boss have changed the document while having “Change Track” on.

SaveAs-And-Overwrite-Me

June 2, 2011

JavaScript, and var

Filed under: Uncategorized — Himanshu @ 2:16 pm

While working in my current project, I re-learned this hard way.  And I don’t want to make same mistake again, hence noting it here. Many a times you remember something better when noted somewhere.

I had created a javascript that was similar as below:

   1:  function Type1(){
   2:      _type = "type1";
   3:      this.show = function() { alert(_type); }
   4:  }
   5:  function Type2(){
   6:      _type = "type2";
   7:      this.show = function() { alert(_type); }
   8:  }
   9:  o1 = new Type1();
  10:  o2 = new Type2();
  11:  o1.show();
  12:  o2.show();

And me being ignorant about what I have written, was expecting to see two alerts once with “type1” and another with “type2”.

Case that I had was more complex , hence I took more time to understand the problem, and then note that I haven’t have “var”! The code should be as:

   1:  function Type1(){
   2:      var _type = "type1";
   3:      this.show = function() { alert(_type); }
   4:  }
   5:  function Type2(){
   6:      var _type = "type2";
   7:      this.show = function() { alert(_type); }
   8:  }
   9:  o1 = new Type1();
  10:  o2 = new Type2();
  11:  o1.show();
  12:  o2.show();

Note and Remember, “var” defines the scope of variable as local!

Powered by WordPress