Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

RuneSpyder

RuneSpyder RuneSpyder

Niner since 2005

  • Anders Hejlsberg - What brought about the birth of the CLR?

    It would make me really happy if Anders was still playing with Delphi!

    http://www.blong.com/images/Eggs/Delphi1d.gif
  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    Not very efficient, and not even a MS product, but here is my interpretation.  I'm not horribly efficient, but oh well.

    ......

    type
      TPalindromeResult = (prTrue, prFalse, prLengthMismatch, prException);

    ......

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Case IsPalindrome(edit1.Text, edit2.Text) of
        prTrue:
          MessageDlg('You the man',mtInformation,[mbOk],0);
        prFalse:
          MessageDlg('You not the man', mtInformation, [mbOk],0);
        prLengthMismatch:
          MessageDlg('Can''t compare, length mismatch', mtInformation, [mbOk],0);
      End;
    end;

    ......

    function TForm1.IsPalindrome(Str1, Str2: String): TPalindromeResult;
    Var
      WorkStr : String;
      X : Integer;
    begin
      Try
        Try
          //Perform basic checks before iteration.
          If (Length(Str1) <> Length(Str2)) Then Begin
            Result := prLengthMismatch;
            Exit;
          End;

          For X := 1 to Length(Str1) do
            Insert(Copy(Str2,X,1),WorkStr,0);

          If (WorkStr = Str1) Then
            Result := prTrue
          Else
            Result := prFalse;

        Except
          On Exception do Result := prException;

        End;
      Finally
        //Perform any necessary cleanup
      End;