# Tuesday, March 03, 2009

Today I got confirmed I passed :-)

MCPD_EA(rgb)_1259

Tuesday, March 03, 2009 8:25:36 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

Until then this Visual Studio macro helps to comment and uncomment in CSS files.

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module StyleSheets

    Public Sub CommentCss()
        Dim ts As TextSelection = DTE.ActiveDocument.Selection
        Dim text As String = ts.Text.Trim(" ")

        Dim fileName = DTE.ActiveDocument.FullName

        If Not fileName.EndsWith(".css") Then
            DTE.ExecuteCommand("Edit.CommentSelection")
            Return
        End If

        If String.IsNullOrEmpty(text) Then
            Return
        End If

        ts.Text = "/*" + text + "*/"
    End Sub

    Public Sub UncommentCss()
        Dim ts As TextSelection = DTE.ActiveDocument.Selection
        Dim text As String = ts.Text.Trim(" ")

        Dim fileName = DTE.ActiveDocument.FullName

        If Not fileName.EndsWith(".css") Then
            Return
        End If

        If Not text.StartsWith("/*") And text.EndsWith("*/") Then
            Return
        End If

        ts.Text = text.Substring(2, text.Length - 4)
    End Sub

End Module

Tuesday, March 03, 2009 8:14:05 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

I just stumbled over Richards initiative on killing IE6… I extended the message to display and added it to my blog and our companies web site:

image

Here is the mark up:

<!--[if lte IE 6]>
  <div style="background-color: #f9f4ad; border: solid 1px #e0d200; padding: 8px; margin-top: 10px; text-align: center;">
    <p>You are using an <strong>old and unsupported version of Internet Explorer.</strong></p>
    <p>In order to get the most out of the web, you should get a <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" style="color: #000; text-decoration: underline;" target="_blank">free update for Internet Explorer</a>,
       or consider trying <a href="http://mozilla.com/firefox/" style="color: #000; text-decoration: underline;" target="_blank">Mozilla Firefox</a>,
       <a href="http://www.opera.com/" style="color: #000; text-decoration: underline;" target="_blank">Opera</a> or
       <a href="http://www.google.com/chrome" style="color: #000; text-decoration: underline;" target="_blank">Google Chrome</a> instead. If you're using a work computer, you should contact your IT
       administrator. Check out <a href="http://www.quirksmode.org/upgrade.html" style="color: #000; text-decoration: underline;" target="_blank">this article</a> for more reasons why you should upgrade.</p>
  </div>
<![endif]-->

Help and drop it to your site today!

Tuesday, March 03, 2009 3:43:51 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Monday, March 02, 2009

Die IX veranstaltet zusammen mit IT-Visions (Dr. Holger Schwichtenberg) ein .NET Seminar, das wahlweise in verschiedenen, zum Teil aufeinander aufbauenden Blöcken gebucht werden kann. Dabei werden die Grundkonzepte von .Net, die Sprachsyntax von C#, die Handhabung der Entwicklungsumgebung Visual Studio, die wichtigsten Funktionen der .Net-Klassenbibliothek geschult. Neben allgemeinen .Net-Seminaren gibt es spezielle Kurse zu Desktop-Anwendungen mit Windows Forms und WPF sowie Web-Anwendungen mit ASP.NET und AJAX.

Anmeldung per Mail an mich oder die IX-Konferenzseite

Monday, March 02, 2009 10:36:24 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, February 16, 2009

A colleague (Daniel Wessels) just asked me how I would sort a generic Dictionary because it has no build in Sort method. A solution that uses functionality that is built in would be to (ab)use a generic list:

var dictionary =
    new Dictionary<string, int>()
        {
            {"George",42},
            {"Mike",28},
            {"Pete", 56},
            {"Sam", 33},
        };

var list = dictionary.ToList();

list.Sort((a, b) => a.Value.CompareTo(b.Value));

foreach (var keyValuePair in list)
{
    Console.WriteLine(
        string.Concat(
            keyValuePair.Key,
            " ",
            keyValuePair.Value));
}

Monday, February 16, 2009 7:45:03 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, February 15, 2009

I just received the confirmation to the exam i did a few weeks ago:

MCPD(rgb)_1259

Sunday, February 15, 2009 2:02:06 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, February 04, 2009

I’m currently at a customer in Hannover and was asked how to change the background color of a textbox from the client side validation method called by a CustomValidator control.

Here is a sample how to access the pages validation properties including the one from the custom validator:

function validateRequired(sender, args)
{
    if (args.Value == null) return;
    if (args.Value.length > 0) return;

    args.IsValid = false;

    var txt = $get(sender.controltovalidate);
    if (txt)
    {
        txt.style.backgroundColor = '#ff0000';
    }
}

I wrapped the stuff in a server control derived from the custom validator control:

public class RequiredValidator
    : CustomValidator
{
    protected override void OnInit(EventArgs e)
    {
        var ctrl = Parent.FindControl(ControlToValidate);
        if (ctrl == null)
        {
            throw new InvalidOperationException(
                "ControlToValidate not found.");
        }
        var txt = ctrl as TextBox;

        if (txt == null)
        {
            throw new InvalidOperationException(
                "ControlToValidate is not a textbox.");
        }

        if (!Page.ClientScript.IsClientScriptBlockRegistered(
            typeof(CustomValidator), "RequiredValidator"))
        {

            Page.ClientScript.RegisterClientScriptBlock(
                typeof(CustomValidator),
                "RequiredValidator",
                string.Concat(
                    "<script type=\"text/javascript\">\n//<![CDATA[\n",
                    Resources.RequiredValidator,
                    "\n//]]>\n</script>"));
        }
        base.OnInit(e);
        ClientValidationFunction =
            string.Concat(
                "validateRequired");
        ServerValidate += RequiredValidator_ServerValidate;

        EnableClientScript = true;
        ValidateEmptyText = true;
    }

    private void RequiredValidator_ServerValidate(
        object source,
        ServerValidateEventArgs args)
    {

        var ctrl = Parent.FindControl(ControlToValidate);
        if (ctrl == null)
        {
            throw new InvalidOperationException(
                "ControlToValidate not found.");
        }
        var txt = ctrl as TextBox;

        if (txt == null)
        {
            throw new InvalidOperationException(
                "ControlToValidate is not a textbox.");
        }

        if (!string.IsNullOrEmpty(txt.Text)) return;

        txt.BackColor = Color.Red;
        args.IsValid = false;
    }
}

Wednesday, February 04, 2009 9:42:52 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, January 28, 2009

Nicolas.Goetz 
clip_image001

My good friend Nicolas Goetz has just started to work as International Account Manager (DE, AT … up to Asia) for famous and well known telligent. The guys around Rob Howard are the creators of “Community Server” (the stuff that runs e.g. www.asp.net and loads of other community sites).

Nice move, Nic. Wish you all the best.

Wednesday, January 28, 2009 9:55:19 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, January 08, 2009
Thursday, January 08, 2009 8:38:34 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, January 05, 2009

image
The best time to produce loads of code is when It’s cold outside …

Life | Misc
Monday, January 05, 2009 11:44:42 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |