How to open Chm file on Windows 8 as temp solution for now?


******** Update 11th January 2013 *********

It’s working now on Windows 8 RTM no need for any third party application.

******** End of Update *******************

I was stacked in how to open chm file on Windows 8, I read many posts about some registery option and disable UAC but nothing work :-(

So I start search for winhelp for Windows 8, but I couldn’t found it too :-(

This maybe because I am working on Windows 8 CP and the other HDD has Windows 8 RP but it’s not stable on my Laptop (Dell XPS) specially with touch screen driver that still a beta with some error of course, so the following solution is just a temp for now, by the way if you want to have a look on Windows 8 on touch screen, see the this post

So finally I search for Ubuntu chm file so I found this wonderful application that makes me able to view chm file :-)

xCHM

Download it form here

Virtualization detection tools



Some people ask me before, how to know that PC support Virtualization, of course it’s depend on the hardware and it’s different from PC to another and depend on the CPU (Intel VT, VT-x, vmx and AMD-V, SVM)

So here the link for 2 tools to detect this feature

 

  • Microsoft® Hardware-Assisted Virtualization Detection Tool

Microsoft Hardware detection tool

 

  • Intel® Processor Identification Utility

Intel Process identification utility

Lambda Expression, Func and Action delegates



Finally I decide to post this topic, every time I said it’s not needed because it’s very simple topic, but I always take time to remember all it’s details specially when i get busy with TFS workflow, build automation, deployment automation and all other process automation stuff, when I get back to C# code I take time to remember these small things, so I decide to post it to be remembered quickly

  • Func<>

I will start by talking about Func<> so what is it?

Built-in delegates that take none or one or many parameters and return one result, as we can see we have 16 overloading start from the first one that didn’t take any parameters and return one result and ending with the final one that take 15 parameters and return one result too

Func Delegates

Func Delegates

Remember that always the last parameter is the return parameter

Why these delegates exist? because .NET Framework use them in LINQ and Extension method so Microsoft makes them public so that we as developers can use them instead of creating new delegates with the same signature

  •   Action<>

The same as Func but it doesn’t return value (void)

Action Delegates

Action Delegates

  • Lambda Expression

So let’s see the following example:

public static int MyMethod (Func<int,int> del)
 {
     return del(4);
 }

So we can see that this method takes a parameter as delegate, that’s mean we will pass a method as a parameter with the same signature of the delegate

So we can make method that take one int and return int as the signature of the Func (parameter) as the following method

public static int MethodParameter(int x)
{
   return  x += 5;
}

And then we will path it to our method (MyMethod)

MyMethod(MethodParameter))

But why we create method that we will not use it anymore??? And here the anonymous method will take place, so instead of creating method and pass it to MyMethod we will pass anonymous method with the same signature

So how to write anonymous method with the same signature? it’s very simple, we just write the method and remove the first part until the parameter and write delegate instead of the first part as the following:

Anonymous Method

Anonymous Method

 So it will become as the following: 
delegate(int x) { return x += 5; })

So now we can pass the anonymous method to MyMethod as the following:

MyMethod (delegate(int x) { return x += 5; }));

So now we will convert the anonymous method to lambda expression and pass it to MyMethod but first how we can convert anonymous method to lambda expression? It’s very simple

(delegate(int x) { return x += 5; }  // anonymous method

(x)=> { return x += 5; } // remove delegate and int

x=> { return x += 5; } // remove Parentheses because one variable

x=>  x += 5 // remove return and curly brackets it's one statement like if

So now instead of pass anonymous method to MyMethod we will pass the lambda expression of the anonymous method as the following:

MyMethod (x=> x += 5));

We don’t need to express the logic of our delegate in the lambda expression. We can as easily call a method, like this:

prod => EvaluateProduct(prod)

If we need a lambda expression for a delegate that has multiple parameters, we must wrap the parameters in parentheses, like this:

(prod, count) => prod.Price > 20 && count > 0

And finally, if we need logic in the lambda expression that requires more than one statement, we can do so by using braces ({}) and finishing with a return statement, like this:

(prod, count) => {

//...multiple code statements

return result;
// notice here because multiple parameters we have  Parentheses
// and also because we have many statements we have curly brackets

}


I hope it helps :-)

Solve the MVC 3 Shortcut conflict with MVC 2 on Visual Studio 2010



When we install MVC 3 on Visual Studio 2010, the shortcut for MVC 3 didn’t work and this because all shortcut are associated with MVC 2, we can solve this issue by many ways,

We can open–>Tool–>Option–>Enviroment–>Keyboard

Start search for the following items, and we will found each one has 2 items, so we will associate shortcut to the item that didn’t has:

  • ProjectandSolutionContextMenus.Project.Add.Controller Ctrl+M, Ctrl+C
  • ProjectandSolutionContextMenus.Project.Add.Area     Ctrl+M, Ctrl+A
  • EditorContextMenus.CodeWindow.AddView     Ctrl+M, Ctrl+V
  • OtherContextMenus.ASPXcontext.GoToController    Ctrl+M, Ctrl+G
  • Project.AddClass     SHIFT+ALT+C

We can also make another solution by removing MVC 2 Tool from Add Remove Program but this will make any existing MVC 2 application not be able to work, if you remove it by mistake you can install this tool again from VS2010 DVD, the tool name is VS2010ToolsMVC2.msi and can be fond  under WCU\ASPNETMVC

Remove MVC 2

Create a shortcut in Visual Studio to add interface video



When I try to find a shortcut to add interface to my project, I didn’t find, this was very weird to me because I thought sure I can’t find it but it’s there, but when I deeply search I find there is not, so I decide to post an article on how to do it?

See the video

The code for the Add interface Module as the following:

Public Module AddInterfaceModule

    Sub AddInterface()
        Dim interfaceName As String = Microsoft.VisualBasic.Interaction.InputBox("Name", "Add Interface")
        If Not interfaceName.ToLower.EndsWith(".cs") Then
            interfaceName &= ".cs"
        End If

        DTE.ItemOperations.AddNewItem("Visual C#\Code\Interface", interfaceName)
    End Sub
End Module</pre>

Working with Daynamic memrory in Hyper-V



First this feature included in the Windows 2008 R2 SP1

We have to install integration service for each VM on the Hyper-V after we install Win 2008 R2 SP1, just click any machine on action menu and choose insert integration disk setup, and start setup it, if you install the old integration service you will prompt with upgrade from old integration service to the new one

After that you can use dynamic memory in the Hyper-v settings for each VM give the start up the minimum and the max the maximum

review the memory demand that appear now in the hyper-v console administration

enjoy :-)

For more information see the following link

http://blogs.technet.com/b/kevinholman/archive/2011/02/22/using-dynamic-memory-on-hyper-v-2008-r2-sp1.aspx

Installing Office web app 2010 to work with TFS 2010



I install the office web app 2010 and configure it so anyone can open word and excel file from the browser

I follow this guid and test it on a team project and everything was very good except I don’t need to active the office web app on the team project because it’s already activated

http://sharepointgeorge.com/2010/installing-office-web-apps-for-sharepoint-2010/

 

Converting My Physical Domain controller to a Virtual machine P2V



One of the strongest feature in SCVMM is the ability to convert from physical machine to virtual machine and this what they called P2V.

When I try to use this feature I have an error that said “Boot and\or System volume C was not selected or is not found on source machine

So after some research I do the following:

Open the CMD on the physical machine after I put the win 2008 DVD on the DVD drive

enter the following command

  • [The drive letter for your DVD drive]:
  • cd boot
  • bootsect /nt52 c: /force

For more information click the following link

http://support.microsoft.com/kb/942986

But after the machine restarted there was another error that said ” NTLDR is missing  ”

So I restart the machine with Win DVD on the DVD drive and start repair it with command line tool and enter the following values

  • bootrec.exe /FixMbr
  • bootrec.exe /FixBoot
  • bootrec.exe /RebuildBcd

For more information click the following link

http://www.networknet.nl/apps/wp/archives/671

After that I  restart the machine and try the convert again and everything was very good

How to enhance Visual Studio 2010 performance?



There is a very good post on how to improve Visual studio 2010 performance, this post try to help you to enhance the performance of visual studio

http://msdn.microsoft.com/en-us/vstudio/ff716700