WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.149' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715299563.7448959350585937500000', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":407,"date":"2011-09-21T18:54:07","date_gmt":"2011-09-21T17:54:07","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=407"},"modified":"2011-09-21T18:57:12","modified_gmt":"2011-09-21T17:57:12","slug":"wpf-4-5-part-4-the-new-bindings-delay-property","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2011\/09\/21\/wpf-4-5-part-4-the-new-bindings-delay-property\/","title":{"rendered":"WPF 4.5 – Part 4 : the new Binding’s ‘Delay’ property"},"content":{"rendered":"

\"\"If you read the MSDN page on the new WPF 4.5 features, you’ll find it under the label “Automatically updating the source of a data binding<\/em>“. This is more precise and understandable to me to say that a ‘Delay’ property has been added to the Binding markup extension !<\/strong><\/p>\n

This post is a part of the serie on WPF 4.5 new features<\/a>. By reading it you’ll discover what is the goal of this property, how to use it and some scenario where it is really useful and smart to use it.<\/p>\n

<\/p>\n

What is it ?<\/h3>\n

A binding is done between two objects : the source (where the data comes from) and the target (where the data go to). For example if you bind the Text property of a TextBlock to a property “Name” of your ViewModel, the TextBlock is the target and the source is your ViewModel.<\/p>\n

A Binding performs synchronisation between two properties. If and only if the binding is done in TwoWay mode then the target is able to update the source value (the TextBlock is able to update the ViewModel).<\/p>\n

This synchronisation is done immediately : each change of the target value, even a tiny tiny one update the source.<\/p>\n

Since WPF 4.5, the Binding has a new property named ‘Delay’ which defines a timespan after which the source is updated.<\/strong> Each update of the target value will be done only after this delay and only if none has been done since. MSDN defines it as “The amount of time to wait before updating the binding source<\/em>“.<\/p>\n

We will see later when it can be useful.<\/p>\n

How to use it ?<\/h3>\n

As this is an added property on the Binding, you only have to define it on each Binding you create.
\nThe delay is defined in milliseconds and the default value of ‘0’ reproduce the classic behavior of a Binding.<\/p>\n

Here is an example of a binding which sets a delay of 500 milliseconds:
\n[xml]<TextBlock Text="{Binding Name, Delay=500}"\/>[\/xml]<\/p>\n

The delay is only applied on only one direction : from the target to the source.<\/span><\/p>\n

When to use it ?<\/h3>\n

My first though was that it is not a really useful feature but after a certain amount of time I found some scenario in which this is very useful. Yes, my brain has a Delay too !<\/p>\n

    \n
  1. As pointed out by MSDN<\/a>, there is some controls like the Slider for which there is no need to update a source value for each pixel that the Slider moves;<\/li>\n
  2. Refering to MSDN too<\/a>, you can use this on TextBox to get the typed text by “block” instead of one letter at a time;<\/li>\n
  3. It can be useful in master\/details scenarii when the change of a selection trigger some time-consuming processing on the UI thread;<\/li>\n
  4. In the same scenario, if you launch an async works on each change, it can strt a lot of them a saturation of the thread pool (or cause too much network use, etc.);<\/li>\n
  5. Sometime in master\/details scenarii, the details view is quite complex and it takes time to render it. Then the delay can trigger this rendering only when it’s useful.<\/li>\n<\/ol>\n

    A full example<\/h3>\n

    The master\/detail scenarii are the one where it can be the most useful for me so I have create a demo project to reproduce it. Let’s say that we a have a list of person and the selected one’s details are displayed. We will then have an interface which looks like this :
    \n
    \"\"<\/a><\/p>\n

    On each change of the Selected Person, a time-consuming process is triggered on the UI thread in the setter. I simulated this by a call of Thread.Sleep :
    \n[csharp]public Person SelectedPerson
    \n{
    \n get { return _selectedPerson; }
    \n set
    \n {
    \n _selectedPerson = value;
    \n \/\/Simulate time consuming operation
    \n Thread.Sleep(500);
    \n RaisePropertyChanged("SelectedPerson");
    \n }
    \n}
    \n[\/csharp]<\/p>\n

    When the delay is not set, navigation in the list is just slow and freeze the UI on each changes. Just letting the ‘arrow down’ key makes the UI freeze too much for me.<\/p>\n

    With the delay property set to a value of 500 milliseconds, I can easily navigate in the list with the keyboard.
    \n[xml]<ListBox ItemsSource="{Binding Persons}" SelectedItem="{Binding SelectedPerson,Delay=500}" \/>[\/xml]<\/p>\n

    Finally, I added a button to trigger a change from the source object just to prove that the Delay works in only one direction.<\/p>\n

    The complete code source of the Demo can be found on my dropbox folder after registration<\/a>.<\/p>\n

    Again, it’s a discrete addition to the WPF framework but it’s a useful one !<\/p>\n

    If you want more info on it, you can read the MSDN page of this new property<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"

    If you read the MSDN page on the new WPF 4.5 features, you’ll find it under the label “Automatically updating the source of a data binding“. This is more precise and understandable to me to…<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[14],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/407"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":17,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":439,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/407\/revisions\/439"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}