Friday, March 15, 2013

New website

All the latest posts have been moved to my website:
www.vaibhavchugh.com

Thanks
Vaibhav

Tuesday, October 11, 2011

Find your OS is 64 bit or 32 bit C#

Difficult to search on the web.. There are 100s of tricks being talked about..

In C# its simple

Environment.Is64BitOperatingSystem.ToString();

Thanks

Sunday, March 6, 2011

XAMPP 1.7 - Apache not working on windows7 64 bit.

I tried installing XAMPP with xampp-win32-1.7.4-VC6-installer . I was not able to get apache working. The apache started and then stopped after 3-4 seconds.

I tried various things like running the setup with vista compatibility and as administrator. But nothing worked..

So the best way i found was to fix the issue using old version of xampp i.e 1.6 .
The old versions of xampp can be found at:

http://cdnetworks-us-1.dl.sourceforge.net/project/xampp/XAMPP%20Windows/1.6.8/xampp-win32-1.6.8-installer.exe

now it works just fine :)

Thursday, September 30, 2010

Find the time elapsed between two statements C#

This was some thing i got to learn yesterday. I was using some profiler and some random ways to get the time. but this was a quick one. I knew something like this existed but never bothered until I had to use it

There is a Stopwatch class in c# that does that for you.

all you need to do is

Stopwatch sw = new Stopwatch();
sw.Start();
Debug.WriteLine(sw.ElapsedMilliseconds.ToString());
sw.Stop();


Thursday, March 25, 2010

Visual studio 2008 shortcuts

Visual studio 2008 shortcuts

CTRL + ".": same as CTRL + SHIFT + F10 opens the smart tag window and allows you to add Using statements Or implement interfaces

ALT + CTRL + "e": open the Exceptions window

CTRL + "k" + "f" and CRTL + "k" + "d": these two will format the code in the window to be nicely indented. Using "d" will format all the document while using "f" will format only selected text. The formatting is for all types of documents, HTML, Xaml, XML, C#… This one is my favorite.

SHIFT + Del: cut the entire row from the document and past it to the clipboard.

CTRL + "k" + "c" and CTRL + "k" + "u": These two are for commenting selected text (the "c" options) and uncommenting selected text (the "u" option).

ALT + ENTER: this little shortcut will open up the Properties window

CTRL + "k" + "s": opens up the code snippets dialogue within the code

F12: I think you all know this but still F12 is the shortcut for the "Go to definition" command which will take you to the definition of the object your marker is currently on.

F9: add a breakpoint to the code line your marker is currently at. Clicking F9 again will remove this breakpoint from that line.

CTRL + ALT + "q": This one will open the Quick watch window

Ctrl+K, Ctrl+F - Format selected block of code

Ctrl+Shift+B -Build solution


References

http://www.dev102.com/2008/04/17/10-visual-studio-shortcuts-you-must-know/

http://www.85turns.com/2008/07/03/favorite-visual-studio-2008-keyboard-shortcuts-2/

Friday, March 5, 2010

Get an alert from TFS when a work item is assigned to you(me)


Thanks to :Jan Tanis (http://blog.jantanis.net/2009/09/work-item-email-notification-with-team.html)


How to setup email notification on having assigned a Work Item to you?

1. Download and install Team Foundation Power Tool for Visual Studio @ http://www.microsoft.com/downloads/details.aspx?FamilyId=FBD14EEA-781F-45A1-8C46-9F6BA2F68BF0&displaylang=en#filelist

2. Start Visual Studio and open the Alert Editor

3. Add new Alert -> Work Item alert -> A Work Item was assigned to me

4. Change your name in “Send To” to your current email address

5. Collapse Work Items Alerts to ensure saving (workaround to start saving procedure)

6. DONE!

Friday, February 12, 2010

Executing C# WinForms application in Partial trust mode

Its pretty easy to do in VS 2010
->Open solution explorer for a solution
->Right click the project you wish to run in partial trust mode
->select properties
->select the security tab
->check "Enable ClickOnce security"
-> select "This is a partial trust application"

and your application will run in partial trust mode from now on...

Vaibhav