Can Cell Phones Cause Cancer?

July 24th, 2008

Dr. Marc Seigel (Cancer Chief) was on Fox & Friends this morning talking about the potential link between cell phone use and increased chances of cancer. The link actually exists between radio frequencies and cancer, but most people get high levels of radio frequencies from their cell phones. Very interesting to see how this develops.

WPF DataBinding: Refreshing from Source

July 23rd, 2008

WPF DataBinding is terrific and allows for very passive views and easy source object updates. However, triggering updates in the view based on changes in the source object can be a little tricky.

If you want to make sure changes to your source object are reflected in your view, your source object will need to implement INotifyPropertyChanged (see example). Yet just implementing this property will not necessarily update your bindings. If your source object includes collections, and you bind to properties in those collections, you can update the source property but will not get updates from the source property, even if it is of a type that implements INotifyPropertyChanged.

The above scenario is common with Linq to Sql when the entities are generated for you. Even tables with one-to-one mappings will be generated with lists–as SQL doesn’t have a way of representing one-to-one relationships–so be sure to edit your dbml accordingly in order to take advantage of binding to your source object’s properties. (You might also consider removing some relationships to remove issues with DataContext collisions when trying to set properties of one Linq entity to another.)

If you can’t fix the problem this way or want to display the collection and changes to the collection, you can always add an ObservableCollection to your PresentationModel or wrap the source object with another object that does use the ObservableCollection to display your collection.

Godlessness in the Last Days

July 21st, 2008
Godlessness in the Last Days
3 But understand this, that yin the last days there will come times of difficulty. 2 For people will be zlovers of self, alovers of money, bproud, barrogant, abusive, bdisobedient to their parents, ungrateful, unholy, 3 cheartless, unappeasable, slanderous, without self-control, brutal, dnot loving good, 4 treacherous, reckless, eswollen with conceit, flovers of pleasure rather than lovers of God, 5 having the appearance of godliness, but gdenying its power. hAvoid such people. 6 For among them are ithose who creep into households and capture weak women, burdened with sins and led astray by various passions, 7 always learning and never able to jarrive at a knowledge of the truth. 8 Just as kJannes and Jambres lopposed Moses, so these men also oppose the truth, mmen corrupted in mind and ndisqualified regarding the faith. 9 But they will not get very far, for their folly will be plain to all, oas was that of those two men.

y See 1 Tim. 4:1
z [Phil. 2:21]
a Luke 16:14; [1 Tim. 6:10]
b Rom. 1:30
c Rom. 1:31
d [Titus 1:8]
e 1 Tim. 3:6; 6:4
f Phil. 3:19
g See 1 Tim. 5:8
h 1 Tim. 6:20; [Titus 1:14]
i [Titus 1:11]
j 1 Tim. 2:4
k Ex. 7:11
l [Acts 13:8]
m See 1 Tim. 6:5
n Titus 1:16
o Ex. 7:12; 8:18; 9:11
The Holy Bible : English standard version. 2001 (2 Ti 3:1-9). Wheaton: Standard Bible Society.

Composite WPF Patterns

July 19th, 2008

Microsoft’sComposite Application Guidance for WPF (Composite WPF) gives WPF a lightweight yet effective application block with which to build exciting applications. However, the biggest struggle is deciding on a pattern for applying the library. The Model-View-ViewModel (MVVM), mentioned across the web as the perfect pattern for implementing MVC with WPF, was for some reason not specifically mentioned in the Composite WPF documentation. Nevertheless, the MVVM pattern is many times used and alluded to under the name PresentationModel and is arguably the best approach in most cases.

Dan Crevier posted a series of excellent articles defining the pattern and giving examples of the implementation of MVVM in WPF. These were written several years ago, before development of the Composite WPF block, but they are simple to understand and can give added understanding to the objects included in Composite WPF. For example, his post on encapsulating commands is very similar to the DelegateCommand object provided with CompositeWPF, though the latter uses lambdas to define Execute and CanExecute methods, whereas the former uses a base class and inheritance to define the methods. Using Dan’s example, the equivalent DelegateCommand, contained within the DelegateCommand’s definition, would look something like this:

public DelegateCommand<object> MyCommand { get; private set; }

public Window1()
{
    InitializeComponent();
    MyCommand = new DelegateCommand<object>(
        p => {
                 string text = p as string;
                 // Do something with text
             },
        p => !string.IsNullOrEmpty(p as string));
}

Dan’s definitions of the Model, which he calls DataModel, View and ViewModel match very closely with Composite WPF’s PresentationModel pattern. In this case, the DataModel is a representative object that is fit for display within the View. Using the entities generated for Linq to SQL, you might add properties to the partial classes create the necessary properties to which to bind. These classes should also implement INotifyPropertyChanged so that other DataModels can respond to changes from another, related View and update their data accordingly.

The View should use bindings for everything. The beauty of WPF is truly in its DataBinding functionality. The observer pattern is built right into the Binding, so that whenever one view changes, other views are notified by their bindings to their DataModels. Even the actions to be performed on a user interaction with the UI can be removed to the ViewModel, DataModel, or in the case of Composite WPF, a controller, Shell, or App level, as appropriate. This leaves the View looking very passive, indeed, which greatly helps when unit testing.

The ViewModel is the actual PresentationModel. It hosts the DataModel, as well as the View’s commands. ViewModel should be the object used to bind to the View’s DataContext and should implement INotifyPropertyChanged if any of the properties could change. The QuickStarts and RIStockTrader examples provide excellent samples of the PresentationModel, though be warned that the examples often use different patterns, if for no other reason than to show other pattern implementations.

That covers the MVVM pattern. However, there’s one more aspect that needs to be covered: composite regions. Composite WPF provides regions for managing the display of different modules in the Shell, but what if you need to display multiple modules or views within a “summary” view that is already on the Shell? In this case, you can use a Controller to manage the child use cases. The UIComposition QuickStart shows a terrific example of creating a controller in a ViewModel for the purposes of managing child use cases. This removes the dependencies and depth of a View that includes a tab control containing a large number of child use cases. (The UIComposition QuickStart uses a Supervising Controller pattern instead of the PresentationModel/MVVM pattern, so you’ll have to adjust it accordingly, but it works beautifully.)

The MVVM pattern is a great solution for WPF applications by allowing WPF’s DataBinding and Commanding to remove much of the logic formerly found in the View layer out to a unit testable ViewModel. The architecture stays clean and also fairly shallow in that an additional Presenter class is unnecessary (as opposed to the Supervising Controller pattern.)

Additional Resources:

Too Much “Semantic” in the Semantic Web?

June 6th, 2008

Bent Rasmussen started a terrific discussion on Twine today regarding an article titled “Never Mind the Semantic Web.” After reading Bent’s comment and the article, I started thinking again about adding “semantic” markup in (X)HTML. My comment follows: Read the rest of this entry »

The Semantic Web, Blogging and WordPress

May 21st, 2008

W3C Semantic Web logoAs any loyal reader of this blog can attest, I continually mull over whether or not maintaining a blog is a worthy pursuit. I’ve gone on hiatus three times for several months to a year and even posted that said post was my last. I don’t do this because I have nothing to say; I rather find myself posting elsewhere in a forum or commenting on other blogs. The real battle is whether or not I should post my thoughts and contributions on my own site or on others’. Read the rest of this entry »

The Real Obama?

May 3rd, 2008

Interesting propaganda video. While a lot of this is likely taken out of context, there’s enough that appears to not be taken out of context to make a case against him. Just my two cents… but seriously?

Review: Expelled

April 28th, 2008

Ben Stein\'s ExpelledJulie and I went to see Ben Stein’s Expelled tonight, and we both loved it. Expelled is perhaps the most entertaining film on science ever made. It was also very well balanced and thought provoking. Most interesting and entertaining of all was Richard Dawkins‘ (author of The God Delusion) admission towards the end of the film that a form of intelligent design (possibly aliens or Luke Skywalker’s great-great-grandchild) could be possible and that they really don’t know where life could have come from. (Another “scientist”’s assertion that life formed on the backs of crystals was a bit more ridiculous and entertaining.) Read the rest of this entry »

Review: Pan’s Labyrinth

April 25th, 2008

Pan\'s LabyrinthJulie and I watched Pan’s Labyrinth this past weekend, and we both really enjoyed it. We really enjoyed the parallel plots between the real and mythological worlds and the way in which they intertwined. At the ending, I thought immediately of C.S. Lewis’s comment that all myths point to the true myth of Christianity. Give it a try. (You’ll need to look in the Foreign films section of your local video store.)

Christian Motivation… or Something

April 23rd, 2008

My verdict is still out, but these “Emergent-See Po-motivators” from Pyromaniacs are interesting for sure.


Panes of Glass is using WP-Gravatar

Panes of Glass is Digg proof thanks to caching by WP Super Cache!