I Bless Thy Command Shell My Child: + {az account list --output table}
Wednesday, 26 September 2012
IE7 is already in the History Books
Many modern websites (e.g. force.com) have no support for IE7. IE8 is built from the ground up. It passes the Acid2 browser test (documented on the Web Standards Project website), IE7 fails. This shows IE7 has poor web standards compliance! Acid2 tests support for so-called "data URLs" (RFC 2397).
IE8 also introduces some web security-oriented features. Some of these are MS-specific (e.g. restrictions on ActiveX controls) whilst others are more wide-ranging (e.g. relating to cross-site scripting (XSS)).
To understand web security, a good resource is OWASP (Open Web Application Security Project) whose mission is to "make software security visible".
IE8 also introduces some web security-oriented features. Some of these are MS-specific (e.g. restrictions on ActiveX controls) whilst others are more wide-ranging (e.g. relating to cross-site scripting (XSS)).
To understand web security, a good resource is OWASP (Open Web Application Security Project) whose mission is to "make software security visible".
Sunday, 23 September 2012
The Importance of Managed Debugging Agents (MDAs)
MDAs work with CLR to provide information on runtime state. One of the most famous MDAs is loaderLock MDA.
The idea of MDAs is to isolate hard-to-find app-bugs when transitioned from managed to unmanaged code.
The idea of MDAs is to isolate hard-to-find app-bugs when transitioned from managed to unmanaged code.
Thursday, 13 September 2012
WPF Multibindings
Bind multiple items and return a single value.
Excellent functionality in all kinds of control panel scenarios.
Excellent functionality in all kinds of control panel scenarios.
The WPF DataGrid - Explained
It might seem mysterious how one can populate a WPF DataGrid from System.Windows.Controls, the "Fourth" Incarnation of the DataGrid.
Answer: Create your own ObservableCollection
All lies in setting the ItemsSource property to an ObservableCollection of custom-built ViewModel objects. As we know from MVVM design, the ViewModel is just like a "screen" on top of the Model that keeps the Model up to date and is also responsible for notifications when properties change, to the relevant observers.
From ObservableCollection to NotifiableCollection
ObservableCollection is good for dealing with "macro" changes to the Collection (as when an Item gets added or deleted) but is not good at detecting and propagating changes when properties on individual items change. For that, a custom-built NotifiableCollection is appropriate (see this discussion on forums.silverlight.net (general principle applies to WPF also)) and also this blog post from a software consulting firm specialising in "nearshoring").
Declaring the NotifiableCollection has to be done in "Generic" Style
public class NotifiableCollection<T>: ObservableCollection<T> where T: class, INotifyPropertyChanged {... }
Note that you also need to declare an EventHandler within the Collection definition, which can be simply done: public event EventHandler<MyEventArgsClass> InterestingPropertiesChanged, or some such similar declaration. Conceptually, this is like defining a multicast delegate to hold the function pointers representing methods to be invoked when an "interesting" property is changed.
Conclusions
The main conclusion is this.
It's nice to know what you can do in WPF using System.Windows.Controls. But a knowledge of controls alone is no use without working knowledge of the relevant object model and component model namespaces.
Thes are System.ComponentModel (INotifyPropertyChanged) and System.Collections.ObjectModel (ObservableCollection). Understand the ComponentModel and Collections Object Model in detail.
Answer: Create your own ObservableCollection
All lies in setting the ItemsSource property to an ObservableCollection of custom-built ViewModel objects. As we know from MVVM design, the ViewModel is just like a "screen" on top of the Model that keeps the Model up to date and is also responsible for notifications when properties change, to the relevant observers.
From ObservableCollection to NotifiableCollection
ObservableCollection is good for dealing with "macro" changes to the Collection (as when an Item gets added or deleted) but is not good at detecting and propagating changes when properties on individual items change. For that, a custom-built NotifiableCollection is appropriate (see this discussion on forums.silverlight.net (general principle applies to WPF also)) and also this blog post from a software consulting firm specialising in "nearshoring").
Declaring the NotifiableCollection has to be done in "Generic" Style
public class NotifiableCollection<T>: ObservableCollection<T> where T: class, INotifyPropertyChanged {... }
Note that you also need to declare an EventHandler within the Collection definition, which can be simply done: public event EventHandler<MyEventArgsClass> InterestingPropertiesChanged, or some such similar declaration. Conceptually, this is like defining a multicast delegate to hold the function pointers representing methods to be invoked when an "interesting" property is changed.
Conclusions
The main conclusion is this.
It's nice to know what you can do in WPF using System.Windows.Controls. But a knowledge of controls alone is no use without working knowledge of the relevant object model and component model namespaces.
Thes are System.ComponentModel (INotifyPropertyChanged) and System.Collections.ObjectModel (ObservableCollection). Understand the ComponentModel and Collections Object Model in detail.
Tuesday, 11 September 2012
Respect to System.Windows.Input
For it brings us the RoutedCommand. RoutedCommand is a central pillar to Commanding in WPF and implements the ICommand interface (also part of System.Windows.Input) with which every .NET programmer should be really familiar with. ICommand? Oh yeah, that old thing. That means the RoutedCommand has to implement Execute and CanExecute, is all. And not just RoutedCommands, either. Also RoutedUICommands, which is, like, a special case of a RoutedCommand. I won't explain the differences between the various RoutedCommands. Let experience be your teacher.
Recap: Name three classes in System.Windows.Input related to Commanding. Hint: See Above.
But one thing we must mention.
System.Windows.Input ain't just about Commanding.
Oh no, there's a whole PLETHORA of crazy stuff in there. Everything to do with the WPF input system, including keyboard, mouse and stylus input processing types. One such crazy class would be e.g. StylusButton, that represents a button on a stylus. Much cooler than going pound-include iostream; and all that malarkey in C++. Forget C++. This is the Age of C#.
Recap: Name three classes in System.Windows.Input related to Commanding. Hint: See Above.
But one thing we must mention.
System.Windows.Input ain't just about Commanding.
Oh no, there's a whole PLETHORA of crazy stuff in there. Everything to do with the WPF input system, including keyboard, mouse and stylus input processing types. One such crazy class would be e.g. StylusButton, that represents a button on a stylus. Much cooler than going pound-include iostream; and all that malarkey in C++. Forget C++. This is the Age of C#.
Subscribe to:
Posts (Atom)