Sep 122012
 

For the second time this year I have the great opportunity to be one of the judges for the INETA Component Code Challenge.  Here are the details:

Have you ever thought “I have a good idea for an application, however what can I get for it?” and/or “I would love to go to DevConnections, but I am not sure how to pay for it?”. Well, you are in luck. With the INETA Component Code Challenge for 2012, all you need to do is create an application using 2 approved controls from 2 approved vendors, create a video talking about your application, and submit it to our judging panel. Our judging panel, consisting of Bill Reiss, Nikita Polyakov, Matt Hidinger, and Greg Leonardo, will be looking for innovation and creativity in the use of approved controls. To read official rules click here.

So grab your computer and Visual Studio and GET YOUR CODE ON!

Disclaimer: INETA covers one conference ticket, hotel, and travel to the conference as is outlined in INETA’s travel policy. Please visit the site for additional rules.

Apr 062011
 

I registered for ROCKPAPERAZURE, downloaded the Bits, after installing the pre-reqs, click F5 and got a 404/blank page.

After some troubleshooting I found that install the following applications through the Microsoft Web Platform Installer, the issue was corrected.  I also verified this with Kevin D. Wolfe - as he had the same issue – thanks Kevin:

  1. IIS 7 Recommended Configuration (Good to clean up IIS installs)
  2. Application Request Routing 2.5

Anyway happy Rock, Paper, Azure!, follow the link for more info or to compete.

Jun 202010
 

Databinding in Silverlight is based on any object that is inherites from the DependencyObject class.  Now, with new versions of Silverlight may new features (keywords) had been added.  Let’s look at a couple of new ones.

StringFormat:
Allows the ability to do string formatting directly in the databinding, example:

<TextBox Text=”{Binding paymentDate, StringFormat=’MM/dd/yy’}“/>

TargetNullValue:
Allows you to define what to show if value is null.

<TextBlock Text=”{Binding Path=pageContent, TargetNullValue=’No Page Content is Currently Available’}” />

FallBackValue:
Is used to define a value when the value can not be loaded through the data binding.

<TextBlock Text=”{Binding Path=pageContent, FallbackValue=’There was an Error Retreiving the Data, Please try Again Later.’}”  />

As you can see by the above examples, there are a few helpful keywords with databindings – that deal with formatting, nulls, and when things don’t go right.

Feb 262010
 

This was a little function that I had forgot about in my development experiences.  In my never ending quest to cut code (using LINQ instead of iterations)  i had misplaced my knowledge around the use of YIELD.

So it was my goal to rediscover this lost knowledge.  The official definition is “Used in an iterator block to provide a value to the enumerator object or to signal an end of an iteration.”

Now with that mouthful there are rules:

  • Can only appear inside an iterator block, which may be used as a body of a method, operator, or accessor.
  • The body of a method, operator, or accessor has the following restrictions:
    • Unsafe blocks are not allowed.
    • Parameter can be ref or out
  • Cannot appear in an anonymous method.
  • When used with an expression, a YIELD return cannot appear in a catch block or try block have have one or more catch clauses.

// example from Microsoft
using System;
using System.Collections;
public class List
{
public static IEnumerable Power(int number, into exponent)
{
int counter = 0;
int result = 1;
while (counter++ < exponent)
{
result = result * number;
yield return result;
}
}

static void Main()
{
foreach(int i in Power(2,8))
{
Console.Write(“{0} “, i);
}
} // output is 2 4 8 16 32 64 128 256 }

Feb 272009
 

LINQ is a new type-safe query structure available in C# 3.0 and .NET 3.5 Microsoft framework.  With LINQ you can query against any collection that implements IEnumerable<> or remote data sources.  With this, LINQ benefits from compile-time checking and dymanic query composition.  To use LINQ include the following namespaces from System.Core assembly:

System.Linq
System.Linq.Expressions

LINQ consists of 2 basic data units, sequences and elements.  A sequence is defined as any object implementing the IEnumerable and elements are any item within the sequence.

To transform a sequence you use a method called query operator, which typical accept an input sequence and produce an output sequence.  The IEnumerable class in LINQ has around 40 or so query operators that are refered to as standard query operators.

A standard query expression would look as follows:

C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQSample
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] query = { "I", "Was", "Here" };  //String collection to query
            IEnumerable<string> filteredQuery = query.Where(n => n.Length >= 1);  //query with lambda expression.
            foreach (string q in filteredQuery)
                Console.Write(q + " ");
        }
    }
} //Console output: I Was Here

Jul 142008
 

Through inheritence a class can be more then one type and this is referred to as polymorphism. Within C# all types are polymorphic, because it treats every type as an Object.

The Microsoft definition is as follows:
“Through inheritance, a class can be used as more than one type; it can be used as its own type, any base types, or any interface type if it implements interfaces. This is called polymorphism. In C#, every type is polymorphic. Types can be used as their own type or as a Object instance, because any type automatically treats Object as a base type.

Polymorphism is important not only to the derived classes, but to the base classes as well. Anyone using the base class could, in fact, be using an object of the derived class that has been cast to the base class type. Designers of a base class can anticipate the aspects of their base class that are likely to change for a derived type. For example, a base class for cars might contain behavior that is subject to change when the car in question is a minivan or a convertible. A base class can mark those class members as virtual, allowing derived classes representing convertibles and minivans to override that behavior.”

The basic “meaning” by the above statement is all C# types are derived from System.Object which allows them to be “morphed” into any type.