templates

typeid result across different dll's

Hello, I have two dlls which both declare a templated type, let's call A. If the declaration of A is sufficiently intricate, it happens that the result of typeid(A).name() is different when called in functions in two different dll's. example: DLL1: struct MyType: public A< TEMPLATE_LIST_OF_A >{} void f(){ std::string name1 = typeid(...

Django templates: testing if variable is in list or dict

Hi, was wondering if there is a way to test if a variable is inside of a list or dict in django using the built in tags and filters. Ie: {% if var|in:the_list %} I don't see it in the docs, and will attempt something custom if not, but I don't want to do something that has already been done. Thanks ...

Detect which WordPress template is being used

In header.php, is there some way to detect and alert which template is displaying the current page? For example, I attempted something like: <script type="text/javascript"> alert("<?php echo is_page_template(); ?>"); </script> I would prefer an answer that doesn't require me to explicitly state and test each filename in that alert. Bu...

Forwarding all constructors in C++0x

What is the correct way to forward all of the parent's constructors in C++0x? I have been doing this: class X: public Super { template<typename... Args> X(Args&&... args): Super(args...) {} }; ...

Make *ALL* Wordpress Categories use their Parent Category Template

I want to change the default template hierarchy behavior, and force all subcategory level pages that don't have their own category template file to refer to their parent category template file. In my other post, Richard M. gave an excellent answer that solved the problem for an individual subcategory. Does anyone know how to abstract it?...

g++ template problem

Hello everybody. I'm porting my c++ windows code (msvc & intel) to Linux (g++). The code uses lots of templates (I like metaprogramming ;-). But I can't compile this code: template <class TA> struct A { template <class TAB> struct B; }; template <class TC> struct C {}; template <class TD> struct D { template <class TTD> clas...

Is it possible dynamically to create a MediaWiki list of pages based on template date?

We have a MediaWiki wiki in which we make extensive use of templates. These templates often include a future date. For example, when a page should be deleted, we use a deletion template with a date one week in the future. (This then produces a message on the page showing that the page will be subject to deletion at that date.) Is ther...

C++ template argument inference and string literals

I have a "set" data type: template <class V> struct Set { void add(const V& value) {} }; I want to write a top-level function version of Set::add. template <class V> void add(const Set<V>& set, const V& value) {} This doesn't quite work with string literals: Set<const char*> set; const char* val = "a"; set.add(val); // ok set.a...

Custom Wordpress Template For Category

I have two categories that need a special template. Each has one post and will display differently. So I read that if the category is named, for example, 'testing' and the template name is 'testing.php' then it should use that correct? Why would it not? I keep previewing the post and it just redirects to the home page. ...

Process for working with a remote Web Designer on an ASP.NET MVC project

I have a side project done in ASP.NET MVC. So far the presentation is just very basic functionality. If I were to hire a designer online and work with them to produce the final website design what process should I follow to make it as easy as possible to take their HTML and CSS and translate that into ASP.NET MVC controls etc? I am un...

sparse_vector template class: How do I clean it up?

I'm not sure if this is a good question or not — please close it if not. I set out to write (using boost::coordinate_vector as a starting point) a sparse_vector template class that efficiently implements a vector-like interface, but is sparse. It implements all the usual vector operations and a fast sparse iterator that iterates over t...

What's the best way to have a variable number of template parameters ?

Please consider this -probably poorly written- example : class Command; class Command : public boost::enable_shared_from_this<Command> { public : void execute() { executeImpl(); // then do some stuff which is common to all commands ... } // Much more stuff ... private: virtual void e...

concat multiple block in jinja2 ?

I use jinja2 for my template engine in python. i would like to join content of multiple block and would like to render it at the end of the template, just before tag. { they are various JavaScript snippets throughout the code in multiple template which i would like to move to the end of the file, how do i do it ? } edit : I would l...

c++ template seems to break access specifiers

The following code doesn't compile for obvious reasons, namely that Foo is trying to access a private member of Bar. However if you uncomment/comment the lines marked, making Foo a template, it does compile and outputs 42. What am I missing here? Why does this work? Seems to me it shouldn't. Thanks for your help. #include <iostream> c...

Templating and form processing toolkits to use with twisted.web

As the title states, I am looking for something, that will help me automate form processing (validation/rendering/etc) in twisted.web. I am also looking for a suitable templating toolkit to use with it. As for templating, it is not so much of an issue as there are a lot of libraries in python, that do it. I was considering the following...

C++ tree of pointers template question

I've just come across a nice STL-like tree container class written by Kasper Peeters: http://tree.phi-sci.com/ However, because it's STL-like, it's geared towards having a single class type in the tree; i.e. template <class T>. The trouble is, like STL-lists, if it suffers from the polymorphic class problem, in that the objects in the...

Understanding template classes in c++ - problem with new-operator

Dear all, I've been stuck with this problem now for a few days and my searches were not successful. What I am trying to do: I want a template reader class (VariableReader) to handle different types of variables (usually unsigned int and pointers to vector). I started with #ifndef READER_H_ #define READER_H_ #include <string> namespa...

Creating Dynamic Articles in Joomla

On a site that I am helping build, the main dev has set up a joomla installation to act as a portal for a business listing of a small town. On the home page is a list of the businesses. If the business has signed up to be on the portal, it is clickable. For each business page, there are a couple of variables: name, location, hours, pho...

Why does this template class in a library generate linker errors when used?

I've got the following setup. RectangleT class defined in a header file in a library. Attempted to use the class in my main application. When linking I get an error for every function I try to call - except constructor and the GetLeft/GetTop/GetRight/GetBottom - BUT - I do get the error when calling GetWidth / GetHeight. Here's the code...

drupal theming a view for Customfield: PHP code

I have a view called "contests_slider" with a block display. I'm hiding all fields and using a "Customfield: PHP code" field instead which calls a function called display_front_contests(). In that function, querying the database and building some html and returning it. I'm displaying the output in a block. The problem is Drupal is adding...