Sunday, September 13, 2009

Silverlight chess board 1.4

I released version 1.4 of the Silverlight chess board with the following updates:

  • Added support for international characters in PGN files (according to the PGN standard section 4.1, a subset of ISO 8859/1 Latin 1 is used).
  • Added a new parameter "piece" to allow customized piece characters used in the notation, instead of the English ones used by default.
  • Better error message when a PGN file was not found.
  • Put in a work around for an IE8 standard modes bug, which caused the notation not to wrap lines correctly in some cases.
  • You can find the updated documentation at the Silverlight chess board home page.

    Tuesday, September 01, 2009

    Validation and the ModalPopupExtender

    Two quick tips if you are using the ModalPopupExtender from the ASP.NET Ajax control toolkit:

    • If you need to do a postback from inside the panel set as your popup control, wrap the contents of the panel into an UpdatePanel.
    • If you add validation controls inside the panel set as your popup control, make sure the button used as the target control has CausesValidation set to false.

    Monday, August 17, 2009

    Surface development

    In the last couple of months I have been contracting with syzygy and developed some applications for Microsoft Surface. The first Surface unit with these applications was deployed last week at the opening of the new O2 flagship store in Cologne.

    According to Microsoft, this was the first Surface deployment as a point of sales system in Germany.

    I developed the mobile phone advisor and lottery applications, and co-developed the custom application launcher and media player applications.

    surface2surface3

     surface1 surface4

    Syzygy has more information about the project at a special site (in German), and in a PDF (in English).

    Thursday, August 13, 2009

    Surface teaser

    Here is a teaser image of what I have been up to the last couple of months. Stay tuned for more.

    IMG_0057

    Thursday, May 07, 2009

    Silverlight chess board 1.3 with full support for variations

    Today I released version 1.3 of the Silverlight chess board with the following changes:

  • Added full support for variations. Variations can be replayed by clicking with the mouse on a variation in the notation div.
  • An additional CSS class ".variation" can be used to format variations.
  • Added keyboard support for replaying when the focus is on the notation div. Available keys depend on the browser being used. I have found that the left and right cursor keys work fine in Internet Explorer and Firefox, but not in Google Chrome.
  • You can find an updated sample and documentation at the Silverlight chess board home page.

    Tuesday, May 05, 2009

    Back in LA

    I am back in LA. This time I took my car.

    ConventionCenter2978997267_ed188ca368_b

    No PDC.

    Hotel2DSCF0823

    Rebranded hotel.

    Hotel1DSCF0822

    The advertising is gone.

    CityHall2DSCF0872

    City hall.

    ConcertHallDSCF0868

    Walt Disney Concert Hall.

    PoliceCarDSCF0873

    LAPD police car.

    Bus     DSCF0874 

    Bus.

    SportCenterDSCF0922

    Staples Center (rebranded).

    UnionStation2       DSCF0898

    Union station.

    Wednesday, April 22, 2009

    Silverlight chess board 1.2

    Today I released version 1.2 of the Silverlight chess board with the following changes:

  • Added optional game header to appear in a div specified with the "header" parameter.
  • PGN comments in curly braces are now supported and appear in the notation div.
  • PGN variations are now partly supported and appear as comments. Full support for PGN variations is planned for a future release.
  • CSS classes ".move" and ".comment" are now used for moves and comments and allow formatting.
  • Fixed an issue where the current move was not highlighted in the notation.
  • You can find an updated sample and documentation at the Silverlight chess board home page.

    Wednesday, April 08, 2009

    Internet Explorer 8 and the ASP.NET menu control

    I participated in the beta test of Internet Explorer 8.  I am also running a site built with ASP.NET. So one thing I did during the beta test was to test the site with the various Internet Explorer 8 beta versions.

    The site was already updated some time ago to use standards mode instead of quirks mode, and renders fine on all other major browsers, including Firefox, Opera, Safari, and Chrome. Internet Explorer 8 is the first version of Internet Explorer to render in standards mode by default, so everything should be fine, at least in theory.

    Beta 1 of Internet Explorer 8 had so many rendering issues that I quickly stopped the test and decided to wait for beta 2. In beta 2 there were much less issues, but some remained. Microsoft at the time recommended to use some meta tags on the site to ensure proper rendering in IE 8. However, these meta tags basically put IE 8 in compatibility mode, which is like running the IE 7 rendering engine in quirks mode – clearly not the right solution for a standards mode based site and an IE 8 trying to render in standards mode.

    Therefore I decided that the remaining issues must be genuine bugs in IE 8 and reported those via Connect. One of the major issues I found was that the ASP.NET menu control doesn’t render correctly in IE 8.

    The IE 8 team analysed the issue and found that this is actually caused by ASP.NET. The menu control analyzes the user agent and renders differently for IE, expecting that IE is rendering in quirks mode.

    Therefore the ASP.NET team has now built a fix for the .NET framework, correcting the ASP.NET menu control so that it renders correctly for IE 8. As part of the fix process I had to test a pre-release version of the fixed .NET framework.

    You can find this now described in the Microsoft knowledge base KB 962351, where you can also download a hotfix that you can install on your server to make sure that the menu is rendered correctly in IE 8.

    Tuesday, February 10, 2009

    Validation with hidden TabPanels in the ASP.NET Ajax Control Toolkit TabContainer

    This one is a bit of a never ending story, unfortunately. After having found out how to hide tabs, I added validation logic to my TabContainer, only to find another bug:

    When hiding a TabPanel by setting the Enabled property to false, any validation controls on that panel are still enabled. This is not what I expected, as with other types of panels, the Enabled property usually cascades down. Of course this results in validation errors displayed for hidden tabs.

    I am now using the following (clumsy) work around to disable tabs:

     

        public static void DisableTab(TabPanel panel)

        {

            panel.Enabled = false;

     

            //work around TabPanel bug and disable the validation controls

            DisableValidationControls(panel);

        }

     

        private static void DisableValidationControls(Control c)

        {

            foreach (Control child in c.Controls)

            {

                if (child is BaseValidator)

                    ((BaseValidator)child).Enabled = false;

                else

                    DisableValidationControls(child);

            }

        }

    Lets hope that the quality of the control toolkit gets improved soon.

    Thursday, February 05, 2009

    How to hide TabPanels of the ASP.NET Ajax control toolkit’s TabContainer

    When developing a user interface with tabs, sometimes you want to hide individual tabs from the user. For example a tab may be shown only to some users, or for some objects with extra properties. When I was implementing this recently with the ASP.NET Ajax control toolkit implementation of tabs, I ran into several issues. Here is how I got it to work:

    When hiding a TabPanel from the server side code, I considered two options: Remove the TabPanel from the TabContainers collection of TabPanels, or set the Visible property of the TabPanel to false. Both these options follow common conventions of the .NET framework, but it turns out that both are wrong here.

    First I removed the TabPanel from the TabContainer. However after a postback the server always complained about the view state (I am not sure about the cause of this – if you have any idea, please let me know).

    Next I tried to set the Visible property of the TabPanel to false. This worked fine with a postback at first. However, the tabs implementation has another issue with postbacks: after each postback it forgets the currently active panel, and sets this back to the first panel. There are two ways to solve this issue: Use an UpdatePanel inside each TabPanel that does postbacks, or in the event handler of the postback (or auto postback), reset the currently active tab panel.

    In my case, I had some controls on the TabPanels that would not work inside an UpdatePanel, so I had to use the work around of resetting the currently active tab panel. However, it turns out that setting the active tab panel does not work if you have set some tab panel’s visible property to false. As ASP.NET is not rendering invisible controls to the client, the tab’s Javascript implementation is not aware of them. This Javascript however seems to be implemented in a naive way, and just counts through the panels. For example if panel 2 is hidden, and you set the active panel to 3, the Javascript is actually going to show panel 4, as it is not aware of the 2nd hidden panel.

    I inspected the Javascript code a little bit and found that the code is actually aware of the Enabled property of the panels. I would have expected setting the Enabled property to false would result in a grayed out panel, as is the convention. However, the panels are really not shown at all. In my case the following work around was possible:

    1. Set the Enabled property of a TabPanel to false to hide it.
    2. Wrap every TabPanel with postback or auto postbacks into an UpdatePanel.
    3. Where UpdatePanel is not possible, in the event handler of the (auto) postback, reset the TabContainer’s active tab panel.

    WARNING: This work around comes at a price. Because you are setting the Enabled property to false, and not the Visible property, the “hidden” tabs are actually send to the client. While they are not rendered, the user can still access the contents with a simple “view source” in his browser. Therefore this work around should not be used, if the content of the hidden tabs is secret or contains other sensitive information. END OF WARNING

    I hope that the quality of the tabs implementation is increased in the next version, specifically:

    • Fix the issue of the TabContainer forgetting the active tab on postbacks (issue 8255 and 12838).
    • Handle the Visible property of the TabPanel correctly, avoiding the security issue with the Enabled property.
    • Handle the Enabled property of the TabPanel as by convention, i.e. show the panels grayed out (issue 9171).

    I have added links to the control toolkit issue tracker at Codeplex, please consider voting for the issues.

    Update: There is also an issue with validation, see my separate post.

    Sunday, January 18, 2009

    An update to the Silverlight chess board

    I recently published version 1.1 of my Silverlight chess board with the following new features:

  • Added flip button to show the board from Black's point of view.
  • Added animation when flipping the board.
  • Support keyboard shortcuts page up and page down to switch between games.
  • Added arrows parameter to turn off arrows.
  • Added light and dark parameters to customize board colors.
  • Added a small help screen showing the copyright and keyboard short cuts.
  • Support PGN files with embedded FEN tag for specifying the starting position used for game fragments and solutions to problems or studies.
  • Added flip parameter to flip the board.
  • Here is a sample for the new game fragment support, a little Zugzwang master piece played by an old friend:

    Get Microsoft Silverlight