Tuesday, September 20, 2011

How special var is in C#, var can't be the type of property of class C#


var is static typed - the compiler and runtime know the type - they just save you some typing... the following are 100% identical:
var s = "abc";
Console.WriteLine(s.Length);
and
string s = "abc";
Console.WriteLine(s.Length);

Finding an ancestor and children of a WPF dependency object

Below are from : http://www.hardcodet.net/2008/02/find-wpf-parent


This is a simple snippet which helps you to find a specified parent of a given WPF dependency object somewhere in its visual tree:
(Snippet updated 2009.09.14)

/// <summary>
/// Finds a parent of a given item on the visual tree.
/// </summary>
/// <typeparam name="T">The type of the queried item.</typeparam>
/// <param name="child">A direct or indirect child of the
/// queried item.</param>
/// <returns>The first parent item that matches the submitted
/// type parameter. If not matching item can be found, a null
/// reference is being returned.</returns>
public static T TryFindParent<T>(this DependencyObject child)
    where T : DependencyObject
{

Saturday, September 10, 2011

Mercurial .hgrc

[ui]
username = Steven You <email>
[hostfingerprints]
bitbucket.org = 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe
[extensions]
color =

Monday, September 5, 2011

Read binary in Hex

$ hexdump dog

or

$ cat dog | xxd

od -x can be used in mac, but the hight byte and low byte position is different

Thursday, September 1, 2011

Mac Dev Utilities

/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS