Ignore whitespace in Beyond Compare

When you compare code using Beyond Compare and see a big red block of difference, many times the difference is actually just of tabs or space. It can be set as not-important text and then Beyond Compare can hide these differences.

Here is how you can ignore the leading and trailing whitespace:

Beyond Compare 3

Start with comparing two file. In the window that comes up, go to Session menu, and click Session Settings. Switch to Importance tab, and there you go! Things are a bit differently organized, but it’s here.

Important Note: Do not forget to change the value of the bottom dropdown to  “Also update session defaults”.


Beyond Compare 2

Go to Tools > Options > Rules. Select  “Everything Else ” at the bottom. Click Edit. Go to Importance tab and check Leading Whitespace and Trailing Whitespace. Finally, close all boxes. That”s it!

Here I have assumed that you are comparing aspx or .vb/.cs files. If you are comparing file types which are defined in Beyond Compare, you need to select the appropriate rule instead of everything else.


Rename Repository in SVN

If you ever need to rename a folder inside a repository, it is straightforward. However, renaming the repository and maintaining all the history is something not directly available.

Thankfully, it is a matter of two minutes. Here is a quick walk-through on a Windows server, but same applies to any other OS hosting SVN server.

Start command prompt and navigate to your the root folder of your repositories. (You can right click on Visual SVN server, point to All Tasks, and click Start Command Prompt)

  • Rename the directory using REN

D:\Repositories>ren old_repo_name new_repo_name

  • Once it is done, generate a new UUID using svnadmin

D:\Repositories>svnadmin setuuid new_repo_name

That’s it! Simple, fast, and efficient!

Run Everything as Administrator in Windows 7 and Windows 8

12-May-2014: Updated for Windows 8

I will talk quickly about running apps as administrator.

This article assumes that you have the admin rights and you know exactly why you want to do this.

Run app once as admin (Windows 7 and 8)

Right click the app name on start menu or desktop, and click Run as administrator. Or, type the name in start menu search, and press  Shift + Enter

Run one App always as admin (Windows 7 and 8)

If you want to always run a program as administrator, right click the program name, click Properties, go to Compatibility tab, and in the bottom down, click on Run this program as administrator. After this, every time you run that app, it will be as administrator.

Run everything as admin (Windows 7 only)

If you always want to run everything as administrator, and running Windows 7, simply turn off the User Account Access (UAC) by dragging the slider all the way down and restart. (Hit start button and start typing User Account Access, you will find it.)

Run everything as admin (Windows 8 and 8.1 )

If you are running Windows 8, turning off the UAC will not work. You will have to edit a Registry entry.

Open regedit and navigate to:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System

Edit ConsentPromptBehaviorAdmin to set it to 0.
Also set  EnableUIADesktopToggle to 0 in the same path.

No restart is needed.

EverythingAdminWin8

Enjoy the administratorship !

Why Hard Drive Show Lesser Available Space

The Mystery of Stolen Disk Space

It all started with my new laptop. I had bought my laptop customized, with every part chosen carefully. When it came to the hard drive, I settled with a lesser capacity drive, only because I wanted a 7200 RPM drive. I chose the one with highest capacity 7200 RPM drive, which of course was considerably “smaller” when compared to the “regular” 5400 or 4200 RPM drives.

With a big smile on my face, I booted my laptop for the first time. The smile went away quickly, when I noticed that Windows reported the total disk space lesser than what I had ordered. My first thought was it must be the System Reserved space. I opened the Disk Management, and was frustrated further to find that System Reserved space was only 100MB, while I was short of few GBs.

I started digging deep. The truth that came out was shocking and irritating. The root of all this different interpretation of the “kilo”. Most of us know that a kilo means a 1000. For example, a kilogram has 1000 grams. When it comes to the “computer stuff”, a kilo is 1024. So a kilobyte would mean 1024 bytes. Right?

Now this different interpretation of kilo is used by the hard drive makers very intelligently to fool people like us. If you read carefully on the box of a hard drive, they do mention that 1kb=1000b. As expected, no one bothers to read the fine print. So, Windows calculates a kilobyte as 1024 bytes, while hard drive makers calculate a kilobyte as 1000 bytes. Confused? Here is a proof:

Hard drive makers sell a 500GB drive. With the calculation factor of 1000, the number of bytes would be:

500GB x 1000 X 1000 X 1000 = 500,000,000,000 Bytes

When Windows calculates the space, it used 1024. So the same disk space is calculated as:

500,000,000,000 / 1024 / 1024 /1024 = 465 GB

See? 35GB gone! See the screen print if you still don’t believe. (And yes, you can read more about this 1000 vs 1024 calculation at https://en.wikipedia.org/wiki/Kilobyte)

Stolen Disk Space

Confessions by Oracle

Even Oracle admits it 🙂

 

Source: docs.oracle.com

Delete old Windows installation folders

If you have old windows installation folder, deleting it can be a pain because of all those folder permissions. You can try taking the ownership of the folders but that usually doesn’t work smoothly.

Here is the solution that always works smoothly, and it is fast – excluding the time to download 800MB file.

  1. Download Ubuntu ISO.
  2. Create bootable USB or DVD.
  3. Boot and select “Try” to run as a live CD without installing it – Instructions Here.
  4. Delete all the files that you want to delete.
  5. Enjoy 🙂

You can find create the bootable drive using Pen Drive Linux.

Funny Linux Commands to bring a smile

I found these commands quite funny, haven’t tried them yet. Downloading Ubuntu, will try soon 🙂

 

Format Decimal Datatype with Commas in T-SQL

Note: This is approach is actually NOT recommended. Better idea would be to do all the formatting on UI.

Ever fall into a situation where a column is a Decimal, and you want the output to have a comma after every three digits?
T-SQL’s CONVERT function can do it for you. The syntax of the function is:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

Here, we will be utilizing the power of the last parameter style. The style can be set to the following three values, when converting money datatype into a character datatype:

0 – No commas and only 2 decimal points
1 – Commas every 3 digits, and only 2 decimal points
2 – No command, and 4 decimal points.

Now since, the datatype stored in the table is actually decimal, we first need to convert it into money, and then convert it into varchar or char.

select convert(varchar(50),convert(money,'54120000.2154'),1)

The result would be:

-------------------- 54,120,000.22 (1 row(s) affected) Simple. Isn’t it?

Why I Love and Why I Hate Google Crome

First things first. This blog was Posted on: 04 Sep, 2008
Everything has changed since then.

After Google launched the beta of its browser Chrome, I started exploring it. I was in love with it within minutes. Gmail was opening faster than Outlook, and so were other site. However, by the evening, I started disliking it as well. Its become a kind of love-hate relationship.

Here I am trying to put rationally why I love it and why I hate it.

Why I am in love with Chrome

Its Fast

The first thing, it is blazingly fast. The difference is visible. Working with JavaScript intensive sites like Gmail is especially a great experience. As I mentioned earlier, the time to open emails and going back to inbox seems actually faster than Outlook. (I do not want to talk about Lotus Notes, that I HAVE to use at work. Anyone who has worked with it, know how painfully resource hungry Lotus Notes is.)

Other sites open fast too. Moreover, the difference is visible. You do not need a specialized test to see it. If you think a proper test is needed, see this page, which has run a early performance test and is wayyyyyy better than IE7 and much better than any competition.

Dragging dropping tabs

Dragging out a tab to form a new window, and then draggin it back to the orginal window is so much fun. I don’t know if I will ever use this feature. But its definitely good 🙂

Keyboard shortcuts

Chrome has some interesting Keyboard Shortcuts. Below is few of my favorite. The one I like most is CTRL + K. It puts a ? in the address bar and then you just start type what you want to search using your default search engine.

You can get a full list here.

  • Ctrl+N — Open a new window
  • Ctrl+Shift+N — Open a new window in incognito mode
  • Ctrl+T — Open a new tab
  • Ctrl+Shift+T — Reopen the last tab you’‘ve closed. Google Chrome remembers the last 10 tabs you’‘ve closed.
  • Ctrl+1 through Ctrl+8 — Switch to the tab at the specified position number. The number you press represents a position on the tab strip.
  • Ctrl+9 — Switch to the last tab
  • Ctrl+Tab or Ctrl+PgDown — Switch to the next tab
  • Ctrl+Shift+Tab orCtrl+PgUp — Switch to the previous tab
  • Alt+Home — Open your homepage
  • Type a web address, then pressAlt+Enter — Open your web address in a new tab
  • Shift+Escape — View the Task manager
  • Ctrl+G or F3 — Find next match for your input in the find-in-page box
  • Ctrl+Shift+G or Shift+F3 — Find previous match for your input in the find-in-page box
  • Ctrl+U — View source

Task Manager

I have a bad (?) habit of keeping 20-30 tabs open at once in FireFox. (I cant think of doing this in IE for the obvious reasons.) It does happen sometimes that because of one bad performing page, my whole session is gone. The Session Restore works most of times, but sometimes it does not.

With Chrome, you have process isolation for each tab. Therefore, if one tab dies, only that tab dies. The other tabs are safe. Really a welcoming feature!

Another useful thing that comes with it, is the Task Manager. Chrome has its own task manager so you can see how each tab and each plug-in is working. Cool!

Bookmarklets

Bookmarklets is one interesting thing, that you should give it a try. These small JavaScript, saved as favorites, do things like changing page color, resizing window to a specified size, searching the selected word in dictionary, and may other interesting things.

Something off topic, the web application I work on has a page with lots of question, where you have to answer No to all the question before you can proceed further. It would of use practically, but during the development, I just need to say No to all. I wrote a simple script to answer No to all these question and saved it as a bookmarklet. Works great for my whole team.

Coming back to the point, these Bookmarklets are IE specific, and do not work in FireFox. However, they do work in Chrome. Means one thing to mean, Chrome has better support for the Javascript.

Why I hate Chrome

Organizing Bookmarks

The fist bad thing is no easy way to organize bookmarks. It imported my FireFox and IE bookmarks very easily, but it put all FireFox bookmarks in one ugly folder. The only way to organize is to drag and drop.

No RSS Feeds

It has no support for RSS feeds. Firefox and even IE handle RSS feeds. When RSS feeds are becoming so popular, I do not believe how Google could ignore handling RSS feeds. If you click on RSS link, all you will see the content XML, without formatting, filling your screen. Ugly!

As expected after experiencing the RSS torture, XML files do not open. IE and FireFox handle them so well.

Bad RAM management

If you leave Chrome open for while, go to some other application, and come back, the tabs have been erased from the RAM. The result is that when you go to a tab, you see a blank screen and then the content starts to appear. This happens when my Laptop has 2 GB of RAM.

Missing Keyboard Shortcuts

There is no keyboard shortcut to append .org or .net. Opera and FireFox have it since long.

I am sure that there will be more things showing themselves as I continue using it. Until then, I am going back to use it. Post in the comments what you think.