Posts

Showing posts from July, 2011

Exclude files with a certain extension from list

string invalidExtension = (from p in new List<string>  { ".dll", ".pdb", ".suo", ".docstates", ".ico", ".bmp", ".vs10x", ".vspscc", ".vssscc", ".vsp", ".scc", ".user", ".ctl", ".datasource", ".vsmdi", ".testsettings", ".trx", ".dat" }                             where p == files[i].Extension.ToLower()                            select p).FirstOrDefault(); if (string.IsNullOrEmpty(invalidExtension)) { //Means it has an invalid extension }

The new awesome search engine

Nowadays, I am finding myself using Wolfram Alpha more and more especially in my work day because it can do some really intelligent things like finding the exact number of days between two days or the number of seconds between 2 times. http://www.wolframalpha.com/ This can be really useful!

Pondering over the weird behaviour of w3wp.exe

When my laptop only had 4GB RAM, the process was consuming upto 512MB RAM and also being very slow. Now, when RAM is 8GB, it is fast, but consumes around 155MB RAM. Interesting... Win 2008 r2 x64

When Vista asks you to install search on your 2008 r2 box

Use this link: http://www.nitrix-reloaded.com/2011/03/02/windows-search-4-0-on-windows-server-2008-r2/

Executing a remote process via command line

http://technet.microsoft.com/en-us/sysinternals/bb897553 Such things are useful during the daily life of a developer.

Viewing the debug.writeline output for a windows service

Use this utility:  http://technet.microsoft.com/en-us/sysinternals/bb896647

Best way of finding mac address of local machine

http://www.websofia.com/2011/03/get-local-machines-mac-address-in-c/ I have used a similar technique to iterate through all the network info for the local machine.

Essential Batch File Commands

To stop a windows service: net stop <service name> To kill a process: taskkill /im "<exe name>" To kill a remote process: taskkill /s <server name> /u "<domain>\<user>" /p "<password>" /im "<exe name>" Change Directory: cd "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\" Build a Visual Studio Solution: devenv %devdir%<solution file name> /build Debug Build a solution using MSBUILD: msbuild %devdir%<solution name> /property:WarningLevel=0 /p:Configuration=Debug Copying files to another folder: xcopy %devdir%<project folder>\bin\Debug\*.dll "C:\Program Files (x86)\<folder>\" /y /s /q Starting a Windows Service: net start <service name> Showing "press enter to exit": pause

Error: System.ServiceModel.CommunicationException: The maximum retry count has been exceeded with no response from the remote endpoint. The reliable session was faulted

Found a few references: http://stackoverflow.com/questions/2394084/wcf-the-user-specified-maximum-retry-count-for-a-particular-message-has-been-exc http://consultingblogs.emc.com/pauloreichert/archive/2007/12/14/6081.aspx#9331 http://social.msdn.microsoft.com/Forums/en/wcf/thread/555b47a1-158a-4a42-9b73-d748a4e83b15 http://www.smartasses.be/2009/01/26/wcf-reliable-session-and-keep-alives/ Interesting because I have implemented keep alives for duplex communication earlier. In this case, I tried doing this: <reliableSession inactivityTimeout="23:00:00" maxRetryCount="8192"             ordered="true" />

Having 2 websites share port 80 on IIS

It is fairly easy to do this - while creating the website, specify a different host name. In a dev environment, you can point this host name to 127.0.0.1 in the windows hosts file. Interestingly the mac also has a hosts file which looks similar to the windows hosts file.

Frustrating - selected tab not viewable in VS2010

http://blog.gfader.com/2010/06/vs2010-highlight-selected-tab-in.html - The registry hack is no longer needed. - See the comments in the link to reset the color back.

Windows Form resizing when you change font size for a control at runtime

This seems to be new behavior in .NET 4.0. I found a solution for it, below: http://social.msdn.microsoft.com/Forums/en/vssetup/thread/5a8d1501-1adb-4010-b6d2-c70d69b905f8 In the end, I changed the color of the label to get the effect I wanted.