Thursday, 21 March 2013

Install NuGet package manually

I accidentally (without checking the description) installed a new version of a package which is not compatible to the project and I cannot find the correct version from the NuGet Installer anymore.  I have a test project which contain the package.  Since I cannot install the package from the UI, I need to install it manually.

Open the Pack Manager Console (View, Other Windows) and type the following:
  • Install-Package <package name> -Source C:\Projects\<project name>\packages\
The package name will be the first part of the folder name before the version number.  For example, the package folder name is "MvcMailer.4.0" and the package name is "MvcMailer".

Web Application targets IE 9 and above...

Add this to the master page or the shard layout file, and IE will not go into the compatibility mode (IE 8)
  • <meta http-equiv="X-UA-Compatible" content="IE=9" />

A helping hand

"Do all the good you can, by all the means you can, in all the ways you can, in all the places you can, at all the times you can, to all the people you can, as long as you ever can."

John Wesley

Monday, 18 March 2013

Android download won't go away

Issue:
  • I have the Facebook download for a few days and even I uninstalled Facebook it won't go away.
Solution:
  • Go to Application and find Downloads
  • Click "Other Downloads", select the item, and click "Cancel"




Keurig problem - water flow back into reservoir

Press the hole and not stopping the water to come out. The water is not hot, check it, just in case.

Planning

If you fail to plan, you're planning to fail.

Friday, 15 March 2013

LINQ Zip and join

Add two list sequentially together according to it order... stop when end of one list.

Fast but limited compare with join.

(roleList).Zip(roleDescriptionList, (r, rd) => new RoleDescription() { roleID = r.dataID, role = r.dataValue, description = rd.dataValue }).ToList();

roleList and roleDescriptionList are two separate lists.  They can be unrelated at all.
Using Zip() to join them together to create a new list of object "RoleDescription" one by one.

To have better control, you should use join instead.


IList<RoleDescription> result = (from r in roleList
                         join rd in roleDescriptionList
                         on r.dataID equals rd.dataID
                         select new RoleDescription { 
                             roleID = r.dataID, 
                             role = r.dataValue, 
                             description = rd.dataValue }).ToList();

Wednesday, 13 March 2013

MVC Partial View

When having <script></script> in a partial view, remember don't use the @section Scripts {
} since the partial view has no Layout (i.e. you have this @{ Layout = null} on the top of the partial view.

Friday, 8 March 2013

Idempotent

Calling the function a million times has the same effect as one request.

Example:
WebAPI Uniform Interface:
  • GET, PUT and DELETE