Tuesday, August 29, 2006

Disneyland Engraved Leather Bracelts

WCF Error - Service ... has zero application (non-infrastructure) endpoints

In the book! "Microsoft Windows Communication Foundation Hands-on Beta Edition By Craig McMurtry, Marc Mercuri, Nigel Watling," formed in the first example, the following error (tested with Beta 2 ).

Service 'DerivativesCalculator.DerivativesCalculatorServiceType' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

need to resolve this error is only in the app.config, in the name of the Service Contract and remove the assembly name.

before: contract = "Namespace.Type, assembly name"
after: contract = "Namespace.Type"

Friday, August 11, 2006

Big Lollipop Centerpieces

Visual Studio Remote Debugging

Here you will find an explanation of how to create the conditions for remote debugging.

Thursday, June 15, 2006

South Florida Gated Community For Sale

ASP.NET GridView with Row Highlighting

order in a GridView row highlight color when you move the mouse over it, only a small effort is required.

First we create a control that is derived from GridView. Now we implement a property that determines whether RowHighlighting is desired and another property that specifies the color of highlighting.
 [ToolboxData ( "\u0026lt;{0}: HighlightedGridView runat = server ID = 
HighlightedGridView1> \u0026lt;/ {0}: HighlightedGridView>
)] public
class HighlightedGridView: GridView {

[Category ( "Behavior" )]
[DefaultValue ( "false" )]
public bool HighlightRowOnMouseOver
{
get { return ViewState[ "rHighlight" ] == null ?
false : ( bool )ViewState[ "rHighlight" ]; }
set { ViewState[ "rHighlight" ] = value ; }
}

[Category( "Appearance" )]
[Description( "---RowHighlightColor---" )]
public Color RowHighlightColor
{
get {return ViewState [ "hlColor" ] == null ?
Color.White: (Color) ViewState [ "hlColor" ]; set}
{ViewState [ "hlColor" ] = value ;}
}
}
Next, we override OnRowCreated and set the RowHighlightColor.
    protected override void    OnRowCreated 
(GridViewRowEventArgs e) {

base OnRowCreated (s).

if ( this HighlightRowOnMouseOver. & & E.Row.RowType == DataControlRowType.DataRow
)
SetRowHighlightColor (e.Row);}
Now we have to just create the method that handles the highlighting. I know here with BackColor always the background color. This can lead to undesirable effects when an alternating rowcolor has been set. But I leave the attentive reader.
 
private void SetRowHighlightColor (GridViewRow row) {

row.Attributes.Add ( "onmouseover" ,
"this.style.backgroundColor = '" +
Utils.ColorToHexString (RowHighlightColor) + "'" );
row.Attributes.Add ( "onmouseout" ,
"this.style.backgroundColor ='" +
Utils.ColorToHexString (BackColor) + "'" );
}

Thursday, June 8, 2006

How To Cook Valerian Root

list view with databinding

With the new BindingSource component is relatively easy to create a list view with data binding support. First we create a control that inherits from ListView.
    public partial class    ListViewEx: ListView {

BindingSource BindingSource;
public ListViewEx () {

BindingSource source = new BindingSource ();
this View = View.Details;..
this FullRowSelect true = ;.
this gridlines = true ;
bindingSource.ListChanged + = OnListChanged;
}}

Next, the features implemented DataSource and DataMember. The attribute [attribute provider (typeof (IListSource))] provides that in the PropertyGrid
a Data Source window appears.

 [attribute provider (typeof   (IListSource))] public 
DataSource object
{
get {return bindingSource.DataSource;}
set bindingSource.DataSource = { value;}}


[Editor ( "System.Windows.Forms.Design.DataMemberListEditor,
system. string design, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a
"
, typeof (UITypeEditor))] public
DataMember

{get { bindingSource.DataMember return;}
set bindingSource.DataMember = { value;}}

implement Next we list changed event. In this we can fill the list view again, once the internal list of the BindingSource component changes.

  void  OnListChanged ( object  sender, ListChangedEventArgs e) 
{
this SetColumnHeaders ();.
this setValue ().
}

Next, we create the columns based on the type information. We get the first Item from the list and read from its properties. If a property is an IList is implemented, it be a parent-child relationship, we'll show it with Deshlab not. If there is a string, we create the column itself, otherwise the property Length as a column heading will be displayed. Otherwise, we simply assign the name to display the respective property. In my own classes, the display name be set by the respective property zuweißt the displayName attribute.

  private void    SetColumnHeaders () {

if (> bindingSource.List.Count 0) {

this Columns.Clear ();.
object DataItem = BindingSource.List [0];
foreach (PropertyDescriptor prop in
TypeDescriptor.GetProperties (DataItem)) {

if (prop.PropertyType.GetInterface ( "IList" ) ==
null) {

if (prop.ComponentType == typeof (string ))
this . Columns . Add ( "Value" );
else
this Columns.Add (prop.DisplayName).
}}

}}

Finally, we fill the list view with the values. For this, we iterate on the internal list of the BindingSource component. We now consider whether it is a string or a value type. With TypeDescriptor.GetProperties (DataItem). Count == 0, I make sure that a structure is behnadelt with their properties in the else branch. .
  private    void setValue () {

this Items.Clear ();
foreach (object DataItem BindingSource.List in ) {

if (DataItem is string )
this Items.Add ((string ) DataItem).
else if
(TypeDescriptor.GetProperties (DataItem) Count == 0.

&& dataItem is System.ValueType)
{
if ( this .Columns.Count == 0)
this .Columns.Add( "Value" );
this .Items.Add(dataItem.ToString());
}
else
{
PropertyDescriptorCollection props =

TypeDescriptor.GetProperties(dataItem);
List< string > valueList = new List< string >();
foreach (PropertyDescriptor propDesc in props)
{
string value =
propDesc.GetValue(dataItem) == null ?
string .Empty :
propDesc.GetValue(dataItem).ToString();
valueList.Add(value);
}
this .Items.Add
( new ListViewItem(valueList.ToArray()));
}
}
}

99 Ford Taurus Rear Deck

Generic Singleton Implementation

   public      static     class   Singleton<T>   where   T :   new  () 
{
private static T instance = new T();
public static T Instance
{
get { return instance; }
}
}