Saturday, October 27, 2007

WPF: A fast font drop down list

Writing a drop down list for fonts is easy in WPF. Just create a data template that binds the text and the font, and bind the ComboBox against Fonts.SystemFontFamilies:

        <ComboBox x:Name="fontComboSlow">

            <ComboBox.ItemTemplate>

                <DataTemplate>

                    <TextBlock Text="{Binding}" FontFamily="{Binding}" FontSize="15" Height="20"/>

                </DataTemplate>

            </ComboBox.ItemTemplate>

        </ComboBox>

 

and

fontComboSlow.ItemsSource = Fonts.SystemFontFamilies;

gives you a nice drop down list with font preview:

image_thumb6

However there is one caveat: The first time you run this and click on the drop down arrow, you will have to wait for some annoying time. The exact time depends on your hardware, and on how many fonts you have installed. If you click on the drop down arrow again, it is fast. If you close the program, and run the program again, it is still fast.

Why is it still fast if you run the program the second time? If you go to the task manager, and show the processes of all users, you can find that WPF is running its own process, called the "Windows Presentation Foundation Font Cache Service":

image_thumb5 

If you kill this process, and run the software again, the first click on the drop down arrow is slow again. I have been looking for a solution to this for some time. Recently, the WPF SDK blog had a post about improving the performance of the ComboBox, recommending a VirtualizingStackPanel as ItemsPanel for the ComboBox in such cases. They also explain the delay:

This reason for the delay is that by default, the ComboBox uses a StackPanel, and a visual that represents each item is created at the same time, which is processor-intensive and memory-intensive.

Sure enough, if you change the XAML for the font drop down list to utilize the VirtualStackPanel as recommended:

        <ComboBox x:Name="fontComboFast">

            <ComboBox.ItemsPanel>

                <ItemsPanelTemplate>

                    <VirtualizingStackPanel />

                </ItemsPanelTemplate>

            </ComboBox.ItemsPanel>

            <ComboBox.ItemTemplate>

                <DataTemplate>

                    <TextBlock Text="{Binding}" FontFamily="{Binding}" FontSize="15" Height="20"/>

                </DataTemplate>

            </ComboBox.ItemTemplate>

        </ComboBox>

the annoying delay is gone. If you scroll fast through the list of fonts, you can instead notice sometimes a very brief delay for a fraction of a second, when the system is loading a new font that was not shown so far.

You can download a sample program, where you can compare the two approaches.

Wednesday, June 27, 2007

The Marshall of Dortmund

Last weekend I visited Dortmund to see some top level chess.

Dortmund-1 Dortmund-7

In Dortmund they present the chess tournament in a theater (above, left). The chess boards are visualized to the spectators with a huge display above the stage (above, right). The moves are also automatically transmitted from the electronic boards to the Internet. This year the Internet transmission has a 15-minutes delay (the idea is that this should prevent cheating with a computer, but I doubt both that any cheating happens at the top level, and that this measure would be effective).

Dortmund-2 Dortmund-3

The first round saw the clash between the current world champion and the world number one. Vishy is now using the Slav regurlarly and achieved a draw with Black. In the second round Kramnik scored his first win - no presents for Gelfand on his birthday.

Dortmund-4 Dortmund-5

 The tournament combines four players that will play in the world championship tournament later this year in Mexico (Kramnik, Anand, Gelfand, and Leko) with one player from Germany (Naiditsch), and three young players (Carlsen, Alexeev, and Mamedyarov). Carlsen already has regular invitations to top events this year. Alexeev won the Russian championship and qualified via the Aeroflot open. Mamedyarov has established himself in the top ten.

Dortmund-6

I was very glad to see a real Marshall at top level, as I am getting a bit bored by the Mostly Harmless Anti Marshalls. So I was excited to be able to stand next to the game when they played the opening moves and take a photo of it.

I am not so sure about the move order they played in the game. Leko played the Adams-Variation move order with 17..Qh5, when 18.a4 Bf5 would lead into the Adams variation, or 18.a4 Re6 would transpose to the Spassky variation, which is the main line these days. Vishy played 18.Qf1 (see diagram on the left).

image   image

This allows Black to play 18..Bh3 and if White wants to avoid a repetition he would have to go into the Adams variation with 19.Bd1 Qf5 20.Qe2 a tempo down (he has not played a4).

However Peter played the game in Kramnik's I-am-the-wall (TM) style, accepting a slightly inferior endgame where White cannot win. In fact the position in the end (see diagram on the right) is still given as superior for White by all the silicon chess players, as White is a pawn up. But if you play out the position you realize that White cannot easily make any progress. Black's bishop pair seems to deny White the chances to activate his pieces or push his pawn.

Being confident with this plan, Peter didn't bother about Adams or Spassky variation, and introduced the move 18..Re7.

image

During the game I thought that after 19.a4 Rfe8 20.Bxd5 Qxd5 22.axb5 axb5 (see diagram) White should use the fact that there is no rook on the sixth rank by playing 22.Qg2 - if Black's queen moves away White can take on c6 and does not have to fear moves like Bxg3. After seeing the game I think that Black would just exchange queens after 22.Qg2 and try a similar endgame.

Can White find some ways to play this or is the Marshall just a draw? Food for thought.

Saturday, June 09, 2007

FIDE candidates final matches: round four preview

Shirov - Aronian

Shirov had prepared a very interesting new idea in the trendy Queen's Indian line that we already saw in the candidates in the Bareev - Polgar game.

Aronian found an interesting way to play for Black over the board. He sacrificed the Queen for Rook, Bishop, and Pawn, getting enough practical chances. Theoretically however, the situation is far from clear, and there should be improvements possible (for example 21.Bf4 is recommended by my Fritz).

Also while Aronian is to be praised for finding this line over the board, this doesn't mean that it is already the best possible. If after 12.Nc3 Black delays castling for a move, and plays 12..Nb4 immediately, or even 12..a6, the whole idea with 13.g4 does not seem to work at all.

Therefore I think Shirov will continue his hit-and-run tactic and test Aronian in another line.

Bareev - Leko

Leko played the Slav in game two. This must have been a minor surprise to Bareev, as Leko has played the Slav only on a few occasions before. Indeed Bareev used a lot of time and then suddenly offered a draw in a position that Peter still knew from his preparation.

I don't know if Leko has prepared the Slav especially for this match. He could not have known that Bareev would be his opponent - but maybe he prepared for all three possible opponents, including Polgar. Or he has generally prepared the Slav as a second defence against 1.d4.

In any case I think he wanted to avoid the Queen's Indian that Bareev played against Polgar, and that Shirov also played against Aronian (see above). The line is very new, White has a nice initiative, and it is not easy to avoid with Black. Many unexplored ways to play this line with White probably still exist, making it not easy for the Black player to prepare against it.

I expect Bareev to prepare something against the Slav or switch to 1.c4.

Rublevsky - Grischuk

In game two Grischuk made Rublevsky's Scottish opening look very harmless.

In game three Rublevsky followed my suggestion and switched to the Paulsen. Actually he followed both of my suggestions at once, and later transposed to the Scheveningen, but used a different setup from the first game. Grischuk then proceeded to play another great game, only to miss the win just before the time control.

So far Grischuk seems to refute Rublevsky's openings for breakfast - and they looked so solid against Ponomariov. Rublevsky should better come up with something soon, but it looks difficult.

Gelfand - Kamsky

Kamsky played a (very!) terrible game three. I guess Gata has shown that you can play without openings on this level. But playing without openings and then spending ages of time on the first few moves was really too much.

Kamsky now faces the second half of the match with a point and a White game down. I am afraid another Slav won't help here. Did I mention I was still waiting for the KID?

Thursday, June 07, 2007

FIDE candidates final matches: round three preview

In the first round three very interesting games and one quick draw were played. For round three it will be important to draw the right conclusions from the first round games. I would like to recommend the round one commentary on the official site. Here the analysis is very good. For example in the game Leko-Bareev Black had a chance to win at move 28:

image

Here 28..Ne4! was winning for Black. Instead, being in time trouble he played 28..g5? and lost a few moves later. The analysis from Chessbase doesn't mention this move, and in TWIC it is mentioned as interesting only.

Armed with this excellent analysis, we can make some thoughts about the round three games:

Aronian - Shirov

Shirov surprised (again) with the Queen's gambit accepted, which he hasn't played much recently, and then never the line played in the game with 1.d4 d5 2.c4 dx4 3.e4 e5.

Shirov later made an interesting exchange sacrifice with 15..Nxe4. Again I would like to recommend the analysis from the official site. They show some important improvements for Black, including 18..Ne5!? and 19..Bc3!? Shirov however didn't follow up correctly and later lost the game.

I think Aronian, being in the lead would switch to a safer line against the Queen's gambit accepted, should Shirov repeat it in game three, for example 3.Nf3 Nf6 4.e3.

Being a point down, Shirov could decide to play something more aggresive, for example his usual Slav, or spring another surprise (I am still waiting for a King's Indian). Or he could play the Queen's gambit accepted again, with two remaining White games in the second half of the match.

Leko - Bareev

Bareev played again the Caro-Kann, as he did against Polgar. Leko apparently does not fear Bareev's 17..Rd5 and played the main line with 1.e4 c6 2.d4 d5 3.Nc3 dxe4 4.Nxe4. Bareev however switched to 4..Nd7 here.

I think Leko will play the main line Caro-Kann again. As I said above, his position in the game apparently wasn't too great - but there are enough alternatives, including the common 13.b3 instead of 13.Re1. There are also many alternatives for Black available, giving Bareev the opportunity to play different from game one.

Grischuk - Rublevsky

Grischuk played an absolutely brilliant game in round one. Even the end position is fantastic and worth a picture:

image

White wins because of his pawn on b6. An instant classic.

What is worse for Rublevsky, White's play looked so strong that the setup chosen in the Scheveningen may very well be refuted by Grischuk's preparation.

I think Rublevsky should choose a different setup in the Scheveningen, or not transpose to the Scheveningen at all. After 1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 5.Nc3 a6 6.Be2 Black does not have to play 6..d6 (Scheveningen), he can also play 6..Qc7 (Paulsen), or 6..Nge7 (Taimanov).

Kamsky - Gelfand

In game one Kamsky tried 6.a4 against Gelfand's Najdorf, but didn't pose any problems and the game was drawn after only 23 moves. I think Kamsky will play another surprise, not a main line, but I cannot possibly guess what.

Monday, June 04, 2007

FIDE candidates matches: Rublevsky - Grischuk

Rublevsky - Grischuk

Grischuk could play the Najdorf, because Rublevsky's 6.Bc4 looked a bit harmless.

But was it? In the fourth game against Ponomariov, after

1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 Nf6 5.Nc3 a6 5.Bc4 e6 6.Bb3 b5 8.O-O Be7 9.Qf3 Qb6 10.Be3 Qb7 11.Qg3 b4 12.Na4 Nbd7 13.f3 O-O 14.Rac1 Rb8 15.c3 bxc3 16.Rxc3 Ne5 17.Rfc1 Bd7

the following position was reached:

image

I had once the same position with White against Floyd Halwick (email, 1998), but my rook was on d1, not on c1. Rublevsky played 18.Qe1, but much more interesting was 18.Nb6. After 18..Qxb6 19.Nxe6 Qxe3+ 20.Rxe3 fxe6 an interesting material imbalance could have been created. That is what happened in my correspondence game, which ended in a draw. However with the rook on c1 it looks a bit stronger.

On the other hand you can't force this position either, as Black has so many alternatives, not the least of which would be 9..Qc7.

Grischuk can also decide to play 1..e5 and try Rublevsky's Scottish opening.

Grischuk - Rublevsky

I hope Grischuk has read my recommendation to Ponomariov, and will use Khalifman's line against Rubelvsky's Paulsen Sicilian.

After 1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 5.Nc3 a6 Grischuk also has played the rare move 6.f3, also once against Rublevsky. This move is so rare that it isn't even mentioned in the books, and I don't know if it is any good.

Certainly Grischuk should not play 1.d4 and loose all his teeth against Kramnik's Slav version of the Berlin wall (I think this line should be called the iron curtain). Ponomariov knows why.

FIDE candidates matches: Aronian - Shirov preview

Carlsen's openings with Black weren't as solid as I thought. He put up a fantastic fight though, and what a great match it was. Magnus Carlsen lost, but he should be proud anyway. He is improving very fast still. On the 23rd of June we can look forward to see him in Dortmund (with Kramnik, Anand, Leko, Mamedyarov, Gelfand, Naiditsch and Alexejew).

It is really sad that we won't see any more candidates matches in the next cycle of the world championship. I think the matchplay is making the candidates very exciting. The FIDE president says that there weren't any sponsors, but why not give Global Chess a shot at finding a sponsor?

But lets enjoy the next four matches as long as we have the chance.

Aronian - Shirov

Against Aronian's 1.d4 Shirov is much more consistent in his openings than against 1.e4. He plays the Slav, and sometimes the Grunfeld. He has abandoned the King's Indian for several years now, as most top players have.

After 1.d4 d5 2.c4 c6 3.Nf3 Nf6 4.Nc3 Shirov has played all the moves 4..e6, 4..a6, and 4..dxc4.

I expect we will see a theoretical duel in the Slav, unless Shirov has prepared more surprises.

Shirov - Aronian

Adams did play the Marshall only once in his match against Shirov, and that was in the very last game of the match in the tiebreak, when Adams needed a win with Black. Adams played two other Spanish lines, and one Petroff, and once Shirov played 1.d4. I still think Adams should have played the Marshall in all the games.  Maybe Shirov has prepared something, but maybe that was not so dangerous. Then Adams would have been able to stand still like a wall and let Shirov become frustrated and try some other openings.

That is what Aronian did in his match against Carlsen, and what I expect him to do again.

Carlsen of course played 1.e4 only once and then tried 1.d4 and 1.Nf3 for the rest of the match, with more success.

Shirov played the Anti-Marshall in the last game against Adams, but there he only needed a draw to win the match. So I guess Shirov will try 1.e4 only if he has really prepared something against the Marshall, otherwise he will play 1.d4.

Saturday, June 02, 2007

FIDE candidates matches: Leko - Bareev preview

Bareev today qualified by drawing the last game against Judith Polgar. I was a bit disappointed that Judith didn't try the King's Indian, but the line she played also created some chances.

For Peter Leko it is interesting that Bareev plays some of the same openings that Leko's first round opponent Gurevich does. This has the advantage that Peter is well prepared against those openings. It also has the disadvantage that Bareev can take a look at the games between Leko and Gurevich and use that information.

Leko - Bareev

The last couple of games between the two always saw the same French that Gurevich plays with 1.e4 e6 2.d4 d5 3.Nc3 Nf6 4.Bg5 dxe4. It is good that Peter indeed has prepared the other important line against the classical French with 4.e5, as we could see in game three against Gurevich.

Of course Bareev may continue to play the Caro-Kann, as he did against Judith Polgar. Against the Caro-Kann Peter usually plays the main line, as Polgar did in the first game against Bareev.

Apparently Polgar wasn't able to prepare something good against Bareev's 17..Rd5 (see my analysis in the game three preview).  Leko must have something ready against this, if he plays 1.e4, or play some other line against the Caro-Kann.

Of course Peter also has the option of playing 1.d4, against which Bareev uses the Slav most of the time. Peter won one nice game against Gelfand last November in the Slav, but Bareev will have much more experience with this opening than Peter.

Bareev - Leko

Bareev has played the Queen's Indian against Polgar.

He has also frequently played the classical Nimzo-Indian. Interestingly, this is another line that was discussed in the Gurevich - Leko games, and Peter's preparation looked very strong there. Bareev has even played a couple of games with the same endgame that was discussed in the Gurevich - Leko games, specifically with the line played in game four. Unless Bareev finds something good against the 16..f5 Peter used there, I expect Bareev will continue to use the Queen's Indian.

In game two, after

1.d4 Nf6 2.c4 e6 3.Nf3 b6 4.g3

Polgar played the same

4..Ba6

that Leko plays. Bareev replied with the interesting

5.Qc2 c5 6.d5

that only last year found its way into top-level chess, after the introduction of the gambit

6..exd5 7.cxd5 Bb7 8.Bg2

It would be interesting to see this line discussed in the match. As the line is still very new, there should be room for improvements on both sides.

Thursday, May 31, 2007

FIDE candidates: No KIDchen sink, and game five preview

Congratulations to Gata Kamsky and Peter Leko, who already won their matches.

Gurevich repeated the endgame from the classical Nimzo main line that was played in game two. He tried the same line that Kramnik used last year to beat Leko, but Peter had prepared the interesting move 16..f5.

Kamsky and Leko now have a few extra days to prepare for their next match.

1. Carlsen - Aronian

The same situation of game three, again, with Carlsen being one point behind. This is Carlsen's last game with White, so it will be very important for him to win. He won't be able to surprise Aronian with the same line again, though. Maybe 1.d4, this time?

3. Ponomariov - Rublevsky

In game three Ponomariov played 1.e4. In the Paulsen Sicilian, after

1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 5.Nc3 a6 6.Nxc6 bxc6 7.Bd3 d5 8.O-O Nf6

This position had already occured last year in a game between the same players. Last year Ponomariov played the main line, 9.Re1 and won. In game three he preferred 9.Qe2, and lost. The obvious question is, why did Ponomariov not play the main line again?

The comments on the official site mention that after

9.Re1 Be7 10.e5 Nd7 11.Qg4 g6 12.Na4 Qa5 13.Bh6

where Rublevsky played 13..Qb4 last year, the move 13..c5 is better.

In Khalifman's excellent book "Opening for White according to Anand, part 9", last year's game is also analysed. He analyses that Black was not worse in that game as late as move 28, and recommends for White to play 12.b3 instead of 12.Na4. Khalifman also mentions improvements to the game Carsen - Mamedyarov cited mentioned on the official site.

I think Ponomariov should have a look at Khalifman's analysis - it wouldn't be the first time that even on the highest level these books can be used with success.

4. Gelfand - Kasimdzhanov

In game three Gelfand tried the ultra-sharp and highly theoretical Moscow gambit, but Kasimdzhanov was very well prepared. Gelfand is a bit in Zugzwang in his last game with White. Should he play this risky line again, trying to use his advantage of the White pieces with sharp play, but risking a fatal loss? Or should he play something safe, but then face the final game with Black? I think his decision will depend on concrete analysis.

6. Grischuk - Malakhov

Grischuk is almost home, Malakhov has to win with Black. I am again betting on 1.e4 c5 2.Nf3 g6.

7. Polgar - Bareev

Judith Polgar lost the fourth game without throwing the King's Indian KIDchen-sink at Bareev.

Bareev only needs a draw from this game to win the match. Polgar must prepare something in the Caro-Kann lines that were already discussed, or play a different line (maybe 3.e5, or 3.f3).

8. Adams - Shirov

Shirov lost game four with White. He is now one point behind. Since he wasn't able to win a game with White yet, it may not be the best plan to play for a draw in game five. Najdorf, anyone?

Wednesday, May 30, 2007

FIDE candidates: Game four preview

The official website has now comments to all games from the first three rounds.

1. Aronian - Carlsen

In the second game Carlsen, being behind in the score played the Volga gambit, as expected. In game four, since he has equalised, I think he is not going to repeat this experiment, but return to his usual Nimzo or Queen's Indian.

2. Gurevich - Leko

Leko played a nice game in the Classical Nimzo-Indian and won with Black. Since Gurevich is already two points behind, I think he is going to play 1.c4 in game four, to avoid Leko's excellent preparation.

3. Rublevsky - Ponomariov

In game two, Rublevsky played 6.Bc4 against Ponomariov's Najdorf. Ponomariov had no problems and even had the better chances in the game, which ended in a draw. Since Rublevsky won game three and is in the lead, I think he will return to his usual 3.Bb5+. Ponomariov will repeat the Najdorf, because he needs a win.

4. Kasimdzhanov - Gelfand

In game two Kasimdzhanov tried Gelfand's Queen's Indian, but it was a draw after only 23 moves. I think in game four Kasimdzhanov will test Gelfand's Petroff.

5. Bacrot - Kamsky

Kamsky surprised Bacrot with the Dutch. His strategy to surprise Bacrot in the opening while avoiding theoretical discussions has worked very well so far. Being to points in the lead I think he will play another surprise opening instead of his usual Slav, but something more solid. Maybe the Queen's gambit accepted?

6. Malakhov - Grischuk

Malakhov came close to defeating Grischuk in game two with 1.c4, so I think that is what he will try again.

7. Bareev - Polgar

Bareev beat Polgar in the topical Queen's Indian line with 1.d4 Nf6 2.c4 e6 3.Nf3 b6 4.g3 Ba6 5.Qc2 c5 6.d5. Polgar is one point behind, and has two Black games remaining, with only one White, so may it already be time to bring back the King's Indian?

Bareev likes to play the Averbakh system against the King's Indian (1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.e4 d6 5.Be2 O-O 6.Bg5).

They have played already a few games in this line against each other, but that was a decade ago or more, when the King's Indian was at the height of its popularity.

8. Shirov - Adams

In games two and three a theoretical discussion about the New Archangel line of the Spanish took place: 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O b5 6.Bb3 Bc5. After 7.a4 Rb8 8.c3, Adams with Black in game two played 8..O-O, and Shirov with Black in game three chose the main line with 8..d6. I don't know if Adams is going to continue this discussion, or play the Marshall instead.

Tuesday, May 29, 2007

FIDE candidates matches: Anti Marshalls

Kamsky-Bacrot

In game three, Kamsky played the following Anti-Marshall:

1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O b5 6.Bb3 Be7 7.Te1 O-O 8.h3 Bb7 9.c3

9.d3 is the usual continuation nowadays, but 9.c3 has of course been known for a long time, too. The reason nobody is playing 9.c3 anymore, is that Black can now play his intended gambit anyway:

9..d5 10.exd5 Nxd5 11.d3

Accepting the gambit here with 11.Nxe5 seems too risky, because of 11..Nxe5 12.Rxe5 Nf4. However, this system is completely harmless anyway, Black should have already achieved equality at this point.

11..Qd6

In fact Black doesn't even have to defend his pawn. He could just play 11..Qd7, because after 12.Nxe5 Nxe5 13.Rxe5 Bf6 he has excellent compensation. But 11..Qd6 is fine, too.

12.Nbd2 Rad8 13.Ne4 Qd7

The queen could also go to g6, here, and Black should have nothing to worry.

14.a4 Kh8

Now Bacrot rapidly lost the thread of the game. After 14..b4 I don't see any problems for Black.

15.axb5 axb5 16.d4

Now Black could try 16..f5, with the idea of playing ..e4. White's knights do look a bit dangerous after 17.Neg5 e4 18.Nh4, but after 18..g6 they cannot be supported by the white queen, and Black should be fine.

16..exd4 17.cxd4 f6?

But this move is really bad. 17..Nf6 was probably still ok for Black. After

18.Nc3 Ncb4 19.Qe2

Kamsky won a pawn and later the game.

Monday, May 28, 2007

FIDE candidates matches: Game three preview

1. Carlsen - Aronian

In the first game, Carlsen played the Anti Marshall already on move five (5.d3). As I said in my preview of this match: "In fact Aronian seems to be very comfortable in these positions with Black and scores very well there." In fact Aronian had no problems with the opening and won a nice game.

If Carlsen has prepared something against the Marshall I see no reason not to play it in the first game. I think Carlsen will play 1.d4 tomorrow.

2. Leko - Gurevich

As expected, in the first game we saw the French with 1.e4 e6 2.d4 d5 3.Nc3 Nf6 4.Bg5 dxe4. In the line played, in the following position

Gurevich was no longer able to castle, but found a nice way to bring his rook into play with 19..h5 followed by ..h4 and ..Rh5. Is is not easy to see how White should get an advantage then, and the game ended in a draw.

I think Leko will have prepared more than one line against this French, and would choose another one. However, since Gurevich lost the second game with White and is behind in the match, he may also play 1..d6.

3. Ponomariov - Rublevsky

Ponomariov played 1.d4 and Rublevsky chose the same line in the Slav that Kramnik used against Topalov in their world championship match last year. Of course Rublevsky was a second for Kramnik during that match and must have participated in the analysis of this line during preparation with Kramnik.

On move 13 Rublevsky played 13..Rc8 14.Ba2 a5, where Kramnik had played 13..a6. I don't know if a recent loss in this line by Kramnik against Aronian in their rapid match was so frightening for Black, or if this is just an alternative, in any case Rublevsky didn't look in any danger in this game.

I think Ponomariov is going to play 1.e4 in game three, as reasoned in my preview of this match.

4. Gelfand - Kasimdzhanov

Kasimdzhanov surprisingly played the Slav in the first game. Gelfand was pressing throughout the game but wasn't able to win. I am sure White's play can be improved - Kasimdzhanov should play different early in the game.

5. Kamsky - Bacrot

I was a bit surprised that Kamsky played 1.d4, but because he managed to take the lead in game 2 with Black, there is no reason for him to change strategy.

I don't know if Bacrot has prepared a riskier opening against 1.d4 for this match. Kamsky playing the Dutch in the second game makes you wonder if he has prepared more surprises for Bacrot.

6. Grischuk - Malakhov

I don't know why Malakhov avoided his usual Gurgenidze drawing weapon in the first game - Malakhov was probably wondering too, after the ugly position he got out of the opening.

Because he didn't manage to win the second game I am not sure going back to the drawing weapon would be the right choice in such a short match.

Maybe we will see 1.e4 c5 2.Nf3 g6 which Malakhov played a few times with success - albeit against much weaker opposition.

7. Polgar - Bareev

In the Caro-Kann main line after

1.e4 c6 2.d4 d5 3.Nc3 dxe4 4.Nxe4 Bf5 5.Ng3 Bg6 6.h4 h6 7.Nf3 Nd7 8.h5 Bh7 9.Bd3 Bxd3 10.Qxd3 e6 11.Bf4 Qa5+ 12.Bd2 Qc7 13.O-O-O O-O-O 14.Ne4 Ngf6 15.g3 Nxe4 16.Qxe4 Nf6 17.Qe2

Bareev played the interesting side line 17..Rd5.

I am sure Judith Polgar didn't know this move. She spent a very long time considering her next move and then played the inferior

18.Ne5? Rxd4 19.Bf4 Re4 20.Qd3 Bc5 21.Ng6 Rxf4 22.Nxf4

when Black was already slightly better.

There are two better moves for White here:

A) 18.Bf4

Khalifman analyses this move on two densely filled pages of his excellent book "Opening for White according to Anand, part 3".

A1) 18..Qa5 19.c4 Rxh5 20.Ne5

Khalifman analyses 20.Rxh5 to an advantage, but this seems simpler.

20..Rxh1 21.Rxh1 Bd6 22.Nxf7 Bxf4+ 23.gxf4 Qxa2

Here Khalifman cites a game between two computers that ended in a draw after 24.Qxe6+ and says "it is amazing, but we failed to find an improvement for White". However, my Fritz gives

24.Rh3 as winning.

A2) 18..Bd6

This seems to be the only move, then. Here Khalifman suggests 19.Be5 with a small advantage for White.

B) 18.c4

Now after 18..Rxh5 there are two ideas for White:

B1) 19.Bf4

After 19..Qa5 20.Bf4 we would transpose to line A1 above, therefore Black has to play 19..Qe7. Black's pieces are a bit in a tangle now, but I don't see how White can exploit this.

B2)

19.Rxh5 Nxh5 20.Qe5 Qxe5 21.dxe5

Now White threatens to win the "knight on the rim" with g4, and Black has to make some concessions. It looks as if White can regain the pawn, but I am not sure if there is much more.

8. Adams - Shirov

Shirov surprised with the French. Maybe he thought Adams' 3.Nd2 not so dangerous for Black. Indeed he seemed to equalize completely - I think the complications later were unrelated to the opening. Adams' 12.g3 is a rare line, but Shirov was apparently well prepared with 14..Ne4. Maybe Adams will try the main line 12.Bg5 in the next game? Or Shirov will surprise us again with another opening.

Sunday, May 27, 2007

Preview of FIDE candidates matches, part 8: Shirov-Adams

Wow, what a pairing for a quarter-final. Both players have played in finals. Shirov lost against Anand in 2000, Adams against Kasimdzhanov in 2004. And Shirov of course famously beat Kramnik in a supposed candidates final 1998, only to see Kramnik play the world championship match two years later. But this is just to show that both of the players have a lot of experince in matches, not to start talking about chess politics here.

Shirov - Adams

Shirov plays 1.e4 most of the time, but also has a great deal of experience with 1.d4.

Against 1.e4 Adams plays the closed Ruy Lopez, which Shirov allows with White. Adams most of the time plays the Marshall, which Shirov allows only sometimes.

As I said in my preview of the Carlsen-Aronian match, I am not convinced of the various Anti-Marshalls, at least from a theoretical point of view. On top of that, Adams also sometimes plays the Petroff, which may just be what he is going to do in a match.

Therefore I think Shirov - unless he has some excellent preparation against the Marshall proper - should actually look at playing 1.d4. Here Adams likes to play 1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 O-O 5.a3 Bxc3 6.Qxc3 Ne4, which looks a bit cheesy to me. In NIC yearbook 62, Adams is quoted: "It isn't very good, but my results are reasonable and I keep playing it". Maybe Shirov can prepare something here.

Adams-Shirov

Adams is a 1.e4 player and almost never plays anything else.

Against 1.e4 Shirov in his career has probably tried almost every decent opening, and even some not so decent ones. In recent years he has limited himself to various closed Spanish systems, a few Petroffs, some Najdorfs, and a lot of Sveshnikov Sicilians.

Adams seems to allow the Petroffs and the Najdorfs. He goes for the closed Spanish unless it is a Marshall, but never allows the Sveshnikovs recently. Instead of a Sveshnikov Adams plays 1.e4 c5 2.Nf3 Nc6 3.Nc3 or 3.Bb5.

I think Shirov should play the Marshall move order of the closed Spanish with Black. Adams then has to either play some Anti-Marshall, where he hasn't won a single game recently, or show his hand against the Marshall proper, which he probably intends to use in this match himself with Black.

This match promises to be very exciting - I only hope we don't see too many boring Anti-Marshalls.

Preview of FIDE candidates matches, part 7: Polgar - Bareev

Polgar - Bareev

Judith Polgar always plays 1.e4. Bareev plays the French or the Caro-Kann.

Against the French Polgar always plays the main line with 1.e4 e6 2.d4 d5 3.Nc3. Here Bareev usually plays the Classical French with 3..Nf6, and sometimes 3..dxe4. After 3..Nf6 Polgar plays 4.Bg5, which Bareev answers with 4..dxe4 anyway.

Both player's opening repertoire here is quite fixed, and hence they have already played quite a number of games with this line.

Against the Caro-Kann Polgar plays both the Panov attack with 3.cxd5 and the main line with 3.Nc3.

Against the main line Bareev usually replies 3..dxe4 4.Nxe4 Bf5. This line was considered so super solid a decade ago or so, that many top players played the advance variation (3.e5), but since then there have been found many interesting ways to play the main line.

My guess is that while Polgar has played the Panov attack recently, she will actually prepare the main line Caro-Kann for this match, but that we won't find out because Bareev will stick to his French.

Bareev - Polgar

Bareev is a 1.d4 player. He sometimes plays 1.c4 or 1.Nf3, but to see him playing 1.e4 would be a huge surprise.

Judith Polgar traditionally played the King's Indian, but recently has relied more on the solid Nimzo/Queen's Indian, as so many other top players. I think in a match she will use the King's Indian only if she is behind in the score.

Bareev is playing the Nimzo Indian with 4.Qc2 a lot, where we could expect to see the main line with 4..O-O 5.a3 Bxc3 6.Qxc3 b6 7.Bg5. Here 7..Bb7 is the main line, but 7..Ba6 is also interesting.

Of course I would like to see Judith Polgar in a world championship final again, hoping she would do better than the last time. But Bareev is a very good player, too - I think this match can see a lot of decided games but still go to the tie breaks. I sure am looking forward to this one.

Friday, May 25, 2007

Preview of FIDE candidates matches, part 6: Grischuk - Malakhov

Grischuk - Malakhov

Grischuk is an 1.e4 player, but has started playing 1.d4 in some of his games a few years ago.

Against 1.e4 Malakhov plays the Gurgenidze variation of the accelerated dragon as a drawing weapon (1.e4 c5 2.Nf3 Nc6 3.d4 cxd4 4.Nxd4 g6 5.c4 Nf6 6.Nc3 d6 7.Be2 Nxd4). And a drawing weapon this line is in the hands of Malakhov - other results are very rare if he gets to play it. Grischuk would need to have some excellent preparation to beat Malakhov in this line.

Grischuk has been playing 3.Bb5 against the 2..Nc6 Sicilian's for some time now, and this may well be what we will see in the match.

Or Grischuk may prefer 1.d4, which Malakhov usually counters with the Slav with an early ..a6.

Malakhov - Grischuk

With White Malakhov is not nearly as predictable in his openings as with Black. He plays all the major opening moves 1.e4, 1.d4, 1.Nf3, and 1.c4 regularly.

Against 1.e4 Grischuk plays the Marshall, which has completely replaced any other closed Spanish lines he played earlier. He recently made the Najdorf another main part of his Black repertoire. He previously called the Najdorf losing by force after some of his nice wins with the English attack against it, but apparently changed his opinion.

Malakhov rarely plays into these main lines, though. Against 1..e5 he has played the Scottish four knights game (1.e4 e5 2.Nf3 Nc6 3.Nc3 Nf6 4.d4) and recently 3.Bc4, where we could expect the game to continue with 3..Bc5 4.c3 Nf6 5.d3.

Against the Najdorf, Malakhov has tried almost every system known to man, including sidelines such as 2.Na3.

Against 1.d4 Grischuk has played the Slav or the Nimzo/Queen's Indian recently.

A tough opponent for Grischuk. Malakhov's super-solid play with Black should be useful in a match, while he is unpredictable with White. If Grischuk manages to take the lead in the match though, it will be interesting to see if Malakhov avoids the Gurgenidze and plays something sharper.

Preview of FIDE candidates matches, part 5: Bacrot - Kamsky

Bacrot-Kamsky

Bacrot is a 1.d4 player, but sometimes plays 1.e4, too.

Against 1.d4 Kamsky has been playing the Slav, and the Nimzo or Queen's Indian since his comeback. In the Slav he likes to play modern systems with an early ..a6 or ..Qb6.

Back in the nineties, he played the Grunfeld and King's Indian, however.

I think in a match situation Kamsky is going to play it safe and rely on his most solid opening against 1.d4, the Nimzo or Queen's Indian. If he is behind in the score, he could bring back his King's Indian.

I don't think Bacrot is going to play 1.e4 unless he has cooked up something against Kamsky's super solid Marshall.

Kamsky-Bacrot

Kamsky most of the time plays 1.e4, but sometimes 1.d4. He generally plays main lines after 1.e4, but never after 1.d4, where he likes to play systems with an early Bf4 or Bg5.

Against 1.e4 Bacrot plays the closed Spanish, usually the Zaitsev variation, which would be very interesting to see in the match.

Kamsky has been avoiding the main line of the closed Spanish since his comeback, though. He nowadays plays like

1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 d6 8.c3 O-O 9.d4 instead of the main line 9.h3.

He also plays like this against the Marshall move order, that Bacrot sometimes uses (7..O-O 8.d4 d6 9.c3).

Of course one reason for Kamsky to play lines like this and the Slav with an early ..a6 is that there is less theory than in other lines. He probably preferred these lines after his absence in order to concentrate on getting his practical part of his game back to where it was in the nineties - and even then he was much more a practical player known more for his toughness than for constant delivery of opening novelties.

It will be very interesting to see Kamsky in a match again, some of his matches in the nineties are classics.

Thursday, May 24, 2007

Preview of FIDE candidates matches, part 4: Gelfand - Kasimdzhanov

Gelfand-Kasimdzhanov

Gelfand is a 1.d4 player.

Kasimdzhanov plays the King's Indian, the Queen's gambit declined, and the Nimzo Indian against 1.d4.

Against the King's Indian, Gelfand likes to play the main line, sometimes with 7.Be3.

Both players have a very good record with their side of the Kings's Indian, and I hope we are in for a treat. After the damage Radjabov did in Wijk, I am eager to see more.

But maybe Kasimdzhanov is going to play more solid. After 1.d4 Nf6 2.c4 e6 Gelfand usually plays 3.Nf3. Kasimdzhanov never plays the Queen's Indian, but continues with 3..d5, transposing to the Queen's gambit declined.

Gelfand then usually plays the Queen's gambit declined with Bf4, or the Catalan.

Kasimdzhanov-Gelfand

Kasimdzhanov usually plays 1.e4, but sometimes mixes in 1.d4.

Against 1.e4 Gelfand plays the Najdorf, and sometimes the Petroff.

Against the Najdorf, Kasimdzhanov most often uses the English attack with 6.Be3. Gelfand has played all main moves 6..e5, 6..e6, and 6..Ng4 here.

Kasimdzhanov has an excellent record with the English attack. Therefore, and especially in a match situation, I expect Gelfand to play the Petroff, unless he is behind in the score.

In the Petroff, Gelfand plays the line with 1.e4 e5 2.Nf3 Nf6 3.Nxe5 d6 4.Nf3 Nxe4 5.d4 d5 6.Bd3 Nc6 7.O-O Be7 8.c4 Nb4 9.Be2 O-O 10.Nc3 Bf5, which is very solid and a good drawing weapon.

Kasimdzhanov will need an excellent preparation to generate winning chances with White against Gelfand.

Preview of FIDE candidates matches, part 3: Ponomariov - Rublevsky

Rublevsky - Ponomariov

Rublevsky always plays 1.e4. Ponomariov usually answers 1.e4 with the Najdorf, or some form of the closed Ruy Lopez, but he has also tried many other openings.

Rublevsky has quite an original opening repertoire with White, though. Against the Najdorf he likes to play 1.e4 c5 2.Nf3 d6 3.Bb5+, or 1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 Nf6 5.f3. Ponomariov wouldn't be likely to get a closed Ruy Lopez either, as Rublevsky prefers the Scottish. While these lines aren't the absolute main lines, they still can be dangerous, and Rublevsky is playing them with great success.

Ponomariov - Rublevsky

Ponomariov started as an 1.e4 player, but has been using 1.d4 also quite regularly for some time now.

Against 1.d4 Rublevsky plays the Queen's gambit accepted, or the Slav.

Against 1.e4 Rublevsky plays the Taimanov or Kan Sicilian (1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 or 4..a6).

In the Taimanov and Kan, a lot depends on move order and transpositions. After 1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nc6 Ponomariov always plays 5.Nc3. Now Black can play many different moves, and Rublevsky has tried 5..a6, 5..Qc7, and 5..d6.

I think Ponomariov feels very home against these systems, and has had great success against them. So I expect we will see Ponomariov playing 1.e4, and 1.d4 maybe only if he is in the lead and wants to take less risk with White.

I think this match will see interesting games. Ponomariov should be considered the favourite. Rublevsky has to try to surprise him.

Wednesday, May 23, 2007

Preview of FIDE candidates matches, part 2: Leko - Gurevich

Leko - Gurevich

Peter Leko is primarily a 1.e4 player, but has been using 1.d4 for variety, depending on the tournament situation and opponent, since his match against Kramnik.

Gurevich has a very consistent opening repertoire against 1.e4. He normally plays the French, but if he wants to play more risky, he plays 1..d6. In the candidates match I expect him to play the French unless he is behind in the score and getting desperate, as Peter has an excellent score against 1..d6 systems.

After 1.e4 e6 2.d4 d5 Peter Leko always plays 3.Nc3, and Gurevich always counters that with the classical French, 3..Nf6, after which Leko has always relied on 3.Bg5. For an important match such as this, he may also prepare the important alternative 3.e5. After 3.Bg5 Gurevich usually plays 3..dxe4.

Gurevich has a lot of experience with the French, and it will be important for Peter to prepare some good lines against it.

Gurevich - Leko

Gurevich is primarily a 1.d4 player, but he also uses 1.c4 regularly.

Against 1.d4 Leko plays the Nimzo or Queen's Indian.

Gurevich plays three different systems here, the Petrosian system against the Queen's Indian (1.d4 Nf6 2.c4 e6 3.Nf3 b6 4.a3),  and the Classical or Rubinstein variation against the Nimzo Indian (1.d4 Nf6 2.c4 e6 3.Nc3 Bb4 4.Qc2 or 4.e3).

I expect Gurevich to play 1.d4 unless he is behind in the score, when he will switch to 1.c4.

Leko must be considered favourite in this match, but Gurevich is very experienced - a successfull opening preparation should be a key for Peter to win this match.

Sunday, May 20, 2007

Preview of FIDE candidates matches, part 1: Aronian - Carlsen

The FIDE candidates matches will begin on the 26th of May in Elista. The first round will consist of eight matches over a distance of six games. You can see the original FIDE news item here. The most important facts about the match between Aronian and Carlsen can be found on the official site of the Mexico tournament here.

I will resume my previews of the Kramnik-Topalov match and have a look at the openings that we may see in the forthcoming candidate matches. These matches are played over a shorter distance - if one player is behind in the match he may have to risk something immediately. On the other hand they would not want to risk much as long as the score is even.

Carlsen-Aronian

It is remarkable that Magnus Carlsen plays both 1.e4 and 1.d4 regularly at his young age. The ability to play both of these major opening moves has been regarded as important for match play at the highest level, but many world champion candidates started out their international carreer playing only one of those moves and learned the other later. For example Peter Leko had played 1.e4 in almost all of his games, but had prepared 1.d4 for his match against Kramnik.

Against 1.e4 Aronian plays the Marshall. The Anti-Marshall variations with 8.h3 are currently en-vogue on the top level, but personally I feel that while these systems are not so easy to play, they don't pose any theoretical danger for Black. In fact Aronian seems to be very comfortable in these positions with Black and scores very well there.

Carlsen must have noticed that and has started all his White games against Aronian with 1.d4 so far.

Against 1.d4 Aronian usually plays 1..Nf6 2.c4 e6, answering 3.Nc3 with the Nimzo, and 3.Nf3 with the Queens Indian or 3..d5. Carlsen has tried all of these systems with White, and sometimes the Catalan, and both have played different sub-variations of all of these openings, so it is a bit hard to guess what we will see - but unless Carlsen has some excellent preparation against the Marshall, I expect to see 1.d4 from Carlsen unless he is in the lead (because it is not so easy for Black to win with the Marshall either, especially if White plays one of the known forced drawing lines).

Aronian-Carlsen

Aronian is a 1.d4 player and seems to play something else only in the Monaco event. Again, Carlsen plays the same openings after 1..Nf6 2.c4 e6 we just discussed with colours reversed, and Aronian also plays different systems against the Nimzo, Queens Indian, and has also tried the Catalan a couple of times recently.

Aronian sometimes finds amazing ways to play on in positions that look harmless for Black, so Carlsen has to be very careful. If Carlsen is behind in the match, expect him to play something sharper, like the King's Indian or the Volga gambit.

Both players have a very solid opening repertoire with Black. Unless we see some good novelties or some bad blunders, this match may well be decided in the tie breaks.

Tuesday, May 01, 2007

Update of the WPF integration for the validation application block

In WPF databinding you can bind not only to a property of an object, but also to a path. For example, in the quickstart of the validation application block, the customer object contains an address object. You can now databind a textbox to the city with the expression Address.City, using the common dot notation:

<TextBox Text="{Binding Path=Address.City}"/>

I have now updated the ErrorProvider of the WPF integration for the validation application block to support these data bindings. You can now conveniently nest all the databound controls into a single ErrorProvider, and get automatic validation of the customer and address fields.

You can download the update here.

Here are some answers to questions I received about the WPF integration:

Question: How do I compile the sample application that is contained in your zip archive?

Answer: First, make sure you have the source code of the Enterprise Library 3.0 installed. You can find the business entities in the Quick Starts/Validation/CS directory. You can also extract the zip archive of the WPF integration into that directory and add the projects to the ValidationQuickStart project, and all references should be set.

Question: Can I use the EnterpriseValidationRule directly in my XAML, without using the ErrorProvider?

Answer: Yes, for example:

    <TextBox>

      <TextBox.Text>

        <Binding Path="LastName">

          <Binding.ValidationRules>

            <my:EnterpriseValidationRule SourceTypeName="ValidationQuickStart.BusinessEntities.Customer, ValidationQuickStart.BusinessEntities" PropertyName="LastName" RulesetName="RuleSetA"/>

          </Binding.ValidationRules>

        </Binding>

      </TextBox.Text>

    </TextBox>

Tuesday, April 24, 2007

WPF integration for validation application block

You can now download the code for the WPF intergration for the validation application block of Enterprise Library 3.0.

Please refer to my previous post for an explanation of what this integration does. The zip archive you can download contains two projects:

The Validation.Integration.WPF project contains the two classes EnterpriseValidationRule and ErrorProvider that you can use in your own projects (under BSD license).

The WPFValidation project can be compiled together with the validation quickstart from the Enterprise Library 3.0. It is the same quickstart sample rewritten for the WPF integration.

Download the code here.

I would like to thank Tom Hollander from Microsoft Patterns and Practices for his encouragement to publish this code.

Let me know if you have any questions or feedback.

Update: I have published an update and answered some questions here.

Tuesday, March 20, 2007

Enterprise WPF: Validation

I am developing an enterprise application with WPF.

WPF is great, but it is very new and not many enterprise applications have been developed with WPF so far. Several things that are part of most enterprise applications are not very well supported with WPF, and you need to put in some extra effort.

One example is validation. Validation happens when the user is entering data into a form, and the application has to validate the user input before accepting it. Some text fields can have only a certain length, a date field has to contain a valid date, the start date cannot be later than the end date, and so forth.

How are developers implementing validation? For example in ASP.NET, there are several validation controls. The ASP.NET developer puts these validation controls on the page together with the textboxes and other controls for the data input. A CompareValidator to check that the start date is before the end date, a RegularExpressionValidator to check for a valid email address, etc.

Is this a good technology? Yes, because many enterprise applications are implemented that way, and they work well. But no, because your validation code is mixed into your user interface layer. In an enterprise application you would like to have your validation logic in your business layer. This is the better place for several reasons:

  • In a distributed application (web, smart client, or client server), you cannot trust your user interface layer and have to perform the validation again on the server, duplicating your validation logic.
  • You may have to support more than one user interface, e.g. a web and a smart client interface. While you can reuse the validation logic in the business layer, you have to develop another validation for each UI.
  • You may have to provide different forms for entering the same type of data, e.g. a customer address and an employee address. Again more versions of the same validation.

With potentially many versions of the validation logic, every change in requirements would become a maintenance challenge.

In comes Enterprise Library 3.0 and the Validation Application Block (VAB), to the rescue. The VAB lets you define validation rules on your business objects using configuration and attributes.

Here is a simple example from the VAB quick start, that shows how to define a simple validation rule on a FirstName property, that validates the length of the string:

        [StringLengthValidator(1, 50, Ruleset = "RuleSetA", MessageTemplate = "Last Name must be between 1 and 50 characters")]

        public string LastName

        {

            get { return lastName; }

            set { lastName = value; }

        }

VAB includes a whole range of validators. To avoid duplication of the validation logic, VAB comes with integrations into Windows Forms, ASP.NET, and WCF. Unfortunately, WPF integration is missing. I also do not like the ASP.NET integration, but that would be another blog post.

It is rather unfortunate that WPF integration is missing from the VAB, because WPF's validation support is limited. The basis for a validation framework exists in WPF, and it is actually very flexible. WPF validation is based on DataBinding - a Binding can have ValidationRules associated with it. Unfortunately there is only one ValidationRule included with WPF at this time. This is illustrated in a great article on CodeProject by Paul Stovell.

In this article Paul builds a WPF validation framework on top of the IDataErrorInfo interface. This interface lets you define validation logic on your business objects. The validation logic is defined procedural, though, not declarative. You can see an example for this in Paul's article.

I have now implemented a WPF integration of the VAB based on a modification of Paul's ErrorProvider. The ErrorProvider lets you wrap a part of the user interface that is based on the same DataContext. The ErrorProvider automatically adds an EnterpriseValidationRule to all data bindings. The EnterpriseValidationRule uses the validation rules defined using VAB on the property that is bound to.

Here is a XAML version of the VAB quickstart:

    <my:ErrorProvider x:Name="epCustomer" RulesetName="RuleSetA">

      <Grid Margin="5">

        <Grid.ColumnDefinitions>

          <ColumnDefinition />

          <ColumnDefinition />

        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>

          <RowDefinition />

          <RowDefinition />

          <RowDefinition />

          <RowDefinition />

          <RowDefinition />

        </Grid.RowDefinitions>

        <Label>First Name:</Label>

        <TextBox Grid.Column="1" Text="{Binding Path=FirstName}"/>

        <Label Grid.Row="1">Last Name:</Label>

        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=LastName}"/>

        <Label Grid.Row="2">Date Of Birth:</Label>

        <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=DateOfBirth}"/>

        <Label Grid.Row="3">Email:</Label>

        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=Email}"/>

        <Label Grid.Row="4">Rewards Points:</Label>

        <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=RewardPoints}"/>

      </Grid>

    </my:ErrorProvider>

Note that all that is added to the XAML code is the ErrorProvider, and we are getting automatic validation based on the validation rules of the bound business objects.

Friday, February 16, 2007

WPF on the 38th floor

In my latest project I am working on a WPF prototype. I cannot show you anything of the WPF yet, but here are two pictures from the 38th floor (Frankfurt Hauptbahnhof, Frankfurt Messeturm):

Saturday, January 27, 2007

The King's Indian is back

Radjabov played two more King's Indians. Yesterday a draw against Kramnik, today a win against Motylev. That is 4.5 out of 5 with the King's Indian for Radjabov in Wijk aan Zee. The King's Indian is back in top level chess.

The King's Indian had rarely been seen in the elite events since Kasparov abandoned it after loosing two games against Kramnik in the 9.b4 "Bayonet" attack. But that was in 1997 and 1998, almost a decade ago, and one of the games was a Blitz game. Kramnik did not even dare to play the Bayonet against Radjabov, after Radjabov made things look easy for Black against van Wely and Shirov.

After today's win, Radjabov has catched up with Topalov. Tomorrow sees them in a last round show down. Lets hope they play a real game, and no early draw to split the point and 1st place. Radjabov has White. He was not very impressive with White so far, his first place is entirely because of the points collected with the King's Indian.

If both players want a fight, we could see another poisoned pawn. The line discussed in the games Motylev-Anand and Anand-van Wely was also invented by Radjabov. Anand repeating the line with White shows that it is not so easy for Black as it seemed against Motylev.

After

1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6 6. Bg5 e6 7. f4 Qb6 8. Qd2 Qxb2 9. Rb1 Qa3 10. e5 h6 11. Bh4 dxe5 12. fxe5 Nfd7 13. Ne4 Qxa2 14. Rd1

This is the move that Radjabov invented.

14..Qd5 15. Qe3 Qxe5 16. Be2 Bc5 17. Bg3 Bxd4 18. Rxd4 Qa5+ 19. Rd2 O-O 20. Bd6 Rd8

Motylev played

 21. Qg3 Qf5

and White's attack did not really take off, as Black was always threatening to exchange queens.

I think a possible improvement for White could be

21.c4

with the idea of playing c5, and Black's queen can no longer get to the kingside. One funny sample line I found against my Fritz:

21..Nc6 22.O-O b5 23.Qg3 e5 24.Bh5 f6 25.Rdf2

threatening Rxf6

25..Kh8 26.Qg6 Qb6 27.c5 Qa7 28.Bd1

and White wins.

Saturday, January 20, 2007

Openings of the world championship revisited in Wijk aan Zee

Both Topalov and Kramnik are playing in the tournament in Wijk aan Zee. Since the world championship, Kramnik has played only his match against Deep Fritz. Topalov did play directly after the world championship match in the Essent tournament, where he probably was very tired.

Yesterday Kramnik played a fantastic game against Anand in the Catalan line that I recommended to Topalov in my game three and game five previews, but which Topalov never tried. Don't miss the video of Kramnik analysing the game for the public.

Today Kramnik repeated the Slav line from game six of the world championship against Aronian. Aronian went into the same endgame, but did not achieve anything, and a quick draw followed.

Topalov seems to be back in form and got his third win today. Against Ponomariov he played a King's Indian, which later transposed into a Benoni structure. He was probably inspired by Radjabov's example, who is the only top player using the King's Indian on a regular basis. Radjabov managed three points out of three games with the King's Indian so far (two impressive, one lucky) and he leads the tournament.

Round eleven will see Kramnik-Radjabov, and I hope this will be a King's Indian, too. In round twelve there is Topalov-Kramnik, which should be very interesting. And in the last round thirteen we have Radjabov-Topalov - lets hope none of these games will see a quick draw.