templates

Django: overriding 'unoverridable' admin templates per app instead of per project?

The Django documentation states the following clearly: Not every template in contrib\admin\templates\admin may be overridden per app or per model. It then lists the ones that can, and base.html, base_site.html and index.html – the ones I'm interested in – are not among those listed. They can be overridden per-project, but not per-a...

How to create a template function within a class? (C++)

I know it's possible to make a template function: template<typename T> void DoSomeThing(T x){} and it's possible to make a template class: template<typename T> class Object { public: int x; }; but is it possible to make a class not within a template, and then make a function in that class a template? Ie: //I have no idea if th...

CArray and const template parameter

Is it possible to use const parameter to CArray I am currently using CArray like this but it won't compile: typedef CArray<const CString, const CString&> data_container; And I always get this compile error : error C2664: 'ATL::Checked::memcpy_s' : cannot convert parameter 1 from 'const CString *' to 'void *' ...

.NET template files

I have a application that generates a couple of different mails. These mails are currently build up using a string builder that generates a HTML based string that is the mail content. This approach is getting messy. The code is objects mixed with HTML, etc, etc. What I'd like is to have a template similar to the one used in for example ...

Command pattern without virtual functions (C++)

For performance reasons, I am using the the Curiously Reoccuring Template Pattern to avoid virtual functions. I have lots of small commands which execute millions of times. I am trying to fit this into the Command Pattern. I want to add tons of commands to a queue, and then iterate through them executing each one by one. Each Command...

Help with c++ template templates.

Ok, so I wrote an stl-like algorithm called cartesian_product. For those who don't know, the cartesian product is every possible pair of elements from two sets. So the cartesian product of {1, 2, 3} and {10, 20, 30} is {(1,10), (1,20), (1,30), (2,10), (2,20), (2,30), (3,10), (3,20), (3,30)} So the function looks like template <typenam...

Adjust a Control Template and still respect the Theme of the OS?

In WPF how do I modifiy the template for a standard control in a way that it will respect the current Theme of the Operating System later on? If I just "edit a copy" of the template in blend, it will just give me the template of the currently running theme. Is this correct? So when I apply the modified template and run the app on differe...

When/Why ( if ever ) should i think about doing Generic Programming/Meta Programming

Hi there IMHO to me OOPS, design patterns make sense and i have been able to apply them practically. But when it comes to "generic programming /meta programming" of the Modern C++ kind, i am left confused. -- Is it a new programming/design paradigm ? -- Is it just limited to "library development"? If not, What design/coding situatio...

Same function, different return types for class hierarchy

We have a class hierarchy which looks something like this: class base { }; class derived1 : protected base { private: float m_price; int m_quantity; float m_value; public: // float calculateValue(); }; class derived2 : protected base { private: double m_price; long m_quantity; double m_value; public: // doubl...

get template checkbox names

How to get the checkbox names when that form is loaded by html template. in Java Script? ...

C++ SFINAE examples?

I want to get into more template meta-programming. I know that SFINAE stands for "substitution failure is not an error." But can someone show me a good use for SFINAE? ...

clean links to PHP-generated javascript and css

Background: When generating HTML content with PHP or any such thing, it is possible to encapsulate links to javascript and css inside tags without actually having to include the CSS and JS "in-line" with the rest of the content. All you have to do is create a link to the file. Example: {script type="text/javascript" src="./js/fooscr...

Why not infer template parameter from constructor?

Hi all, my question today is pretty simple: why can't the compiler infer template parameters from class constructors, much as it can do from function parameters? For example, why couldn't the following code be valid: template<typename obj> class Variable { obj data; public: Variable(obj d) { ...

Visual Studio 2010 Make and Install Templates

I am using F# and i found that the available templates were a bit to sparse for my liking, and i want to make more. How would i go about doing that? also, how would i install these templates after I've made them? ...

SliverLight AG_E_UNKOWN_ERROR UserControl Apps.xml Template

Ive created a simple usercontrol and even though the app runs ok applying the template to Im defining the Control Template here App.xaml <ControlTemplate x:Key="myWindowTemplate"> <Grid x:Name="myGrid" Background="Black" Width="50" Height="50"> <ContentPresenter Name="Content"></ContentPresenter> ...

How can I use templates to generate static web pages?

I want to add one HTML file into another. For example: I have header.html and footer.html Now I am trying to create aboutus.html where I want to add these two HTML files there is no dynamic code in these file except JavaScript. How can I do this without using any scripting language except JavaScript and CSS? ...

ASP.Net - Two way databinding of a single entity - Options, best way...roll your own??

I have been searching around to find the best option of doing this. Basically, I want to do two way databinding of multiple controls (textbox, dropdownlist, checkbox, etc) to a single instance of custom class/entity, ie: Person. It seems, the (only?) way to do this is using an like so: <asp:FormView ID="FormView1" runat="server" Data...

c++: how do i call a friend template function defined inside a class?

hi guys please help me with this function i got this example from my book, but i have no idea how to actually call the ticket function this is the code: #include <iostream> class Manager { public: template<typename T> friend int ticket() { return ++Manager::counter; } ...

Where can I find, or how can I create an elegant C++ member function template wrapper mechanism without resporting to boost?

I want to be able to templatize a class on a member function without needing to repeat the arguments of the member function -- i e, derive them automatically. I know how to do this if I name the class based on how many arguments the function takes, but I want to derive that as well. Something like this, although this doesn't work (at le...

using a template class as an argument

Is there any way of creating a function that accepts any version of a given template class? e.g. this works: ostream& operator << (ostream &out,const Vector<int>& vec); but this doesn't: ostream& operator << (ostream &out,const Vector& vec); Is it possible to get the second line to work somehow for any version of vector? e.g. vec...