How to convert a lambda to an std::function using templates

You can’t pass a lambda function object as an argument of type std::function<T> without explicitly specifying the template argument T. Template type deduction tries to match the type of your lambda function to the std::function<T> which it just can’t do in this case – these types are not the same. Template type deduction doesn’t consider … Read more

Can I use a different Template for the selected item in a WPF ComboBox than for the items in the dropdown part?

The issue with using the DataTrigger/Binding solution mentioned above are two-fold. The first is you actually end up with a binding warning that you can’t find the relative source for the selected item. The bigger issue however is that you’ve cluttered up your data templates and made them specific to a ComboBox. The solution I … Read more

Why don’t I need to specify “typename” before a dependent type in C++20?

One of the new features in C++20 is Down with typename. In C++17, you had to provide the typename keyword in nearly all† dependent contexts to disambiguate a type from a value. But in C++20, this rule is relaxed a lot. In all contexts where you need to have a type, the typename keyword is … Read more

django include template from another app

As long as the apps are in INSTALLED_APPS and the template loader for apps dirs is enabled, you can include any template from another app, i.e.: {% include “header.html” %} … since your templates are located directly in the templates dir of your app. Generally, in order to avoid name clashes it is better to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)