templates

Template Return Types / Cast as function of Template

I'm working with some generated classes with broken polymorphism. For every generated class T, there are a handful of T_type_info, T_writer, T_reader classes which are only related to T conceptually. What I'm trying to do is something like this: template <class T> class Wrapper { public: template <class W> W topic_cast(BrokenBaseC...

Free CSS UI Templates

Hi, Could someone show me some css ui framework/template for consistent web application, something like: http://www.webguitemplates.com/templates/futurism/futurism-blue http://www.webguitemplates.com/templates/simplus/simplus-silver http://www.adminizio.com/ http://gooeytemplates.myshopify.com/products/blue-atom http://gooeytemplates....

Static template field of template class?

Hello! I've got this code to port from windows to linux. template<class T, int Size> class CVector { /* ... */ }; template<int n, int m> class CTestClass { public: enum { Size = 1 << n }; private: static CVector<int, Size> a; // main.cpp:19 }; template<int n, int m> CVector<int, CTestClass<n, m>::Size> CTestClass<n, m>::a; // mai...

Best way to create template-based messages in C#

On a project I'm working on, there is an existing messaging system that sends in-app messages and emails. All the messages are currently hard-coded, with placeholders for specific variables (name, date, stuff like that). An upcoming requirement for the project is to make all these messages configurable. The details aren't hugely importa...

Rails XML builder templates / group data

My SQL result @products=Product.find_by_sql() gives me this ( ID title, user_name 1 Product1 Xpeper 1 Product1 John 2 Product2 Xpeper How can I build XML in my xml.builder view file so the source bould be like this <products> <product> <id>1</id> <title>Product1</title> <users> <user>Xpe...

Ant-Ivy-Scala Template: any suggestions on improvements?

I just created a template project for Scala using Ant and Apache Ivy. I want to get the communitie's input on any improvements to the Template so it can be improved. The Environment effectively consists of 3 files: build.xml ivy.xml ivysettings.xml running ant init will create all needed directories. I was wondering if there are an...

GCC error with variadic templates: "Sorry, unimplemented: cannot expand 'Identifier...' into a fixed-length arugment list"

While doing variadic template programming in C++0x on GCC, once in a while I get an error that says "Sorry, unimplemented: cannot expand 'Identifier...' into a fixed-length arugment list." If I remove the "..." in the code then I get a different error: "error: parameter packs not expanded with '...'". So if I have the "..." in, GCC c...

WPF: dependency property with type of Template - where to get default template (to set as default value)?

Hi, I am subclassing an ItemsControl (let's call it EnhancedItemsControl), and I would like to expose ScrollViewerTemplate dependency property, which would allow the user to optionally specify his own template for used ScrollViewer. I am doing it like this: public ControlTemplate ScrollViewerTemplate { get { return (ControlTemplate)G...

Set silverlight Template from code?

How can i set the control.Template from code if my template is placed in an ResourceDictionary? ...

Compiler error in declaring template friend class within a template class

Hello everybody. I have been trying to implement my own linked list class for didactic purposes. I specified the "List" class as friend inside the Iterator declaration, but it doesn't seem to compile. These are the interfaces of the 3 classes I've used: Node.h: #define null (Node<T> *) 0 template <class T> class Node { public: ...

C++ creating variations of classes with different combinations of fields

hi! templates allow in c++ to automatically create a lot of classes with the same interface, but different data stored. i'm looking for something similar (i don't know whether it exists, that's why I ask here) that automatically creates for me variations of an object storing only a subset of the datamembers. let's say i have a class ...

Should I make my functions as general as possible?

template<class T> void swap(T &a, T &b) { T t; t = a; a = b; b = t; } replace void swap(int &a, int &b) { int t; t = a; a = b; b = t; } This is the simplest example I could come up with,but there should be many other complicated functions.Should I make all methods I write templated if possible? An...

Specializing a template by a template base class

I'm writing a template for which I'm trying to provide a specialization on a class which itself is a template class. When using it I'm actually instanciating it with derivitives of the templated class, so I have something like this: template<typename T> struct Arg { static inline const size_t Size(const T* arg) { return sizeof(T); }...

View function template instantiations

I have a simple function template: #include <iostream> using namespace std; template <class T> T GetMax (T a, T b) { T result; result = (a > b) ? a : b; return (result); } int main () { cout << GetMax<int>(5, 6) << endl; cout << GetMax<long>(10, 5) << endl; return 0; } The above example will generate 2 function template ...

Difference between Template Method (separation) and Strategy pattern?

Hi all. My teacher is a really good one and I tend to understand his points, but this one just goes over my head. He explains Template Method in two variants; - Unification: the standard variant, that is composed of an abstract class with some abstract methods defining the variant parts of the otherwise fixed algorithm. - Separation: his...

Wrong encoding of text, in Django?

"query" = джазовыми For some reason...when I display it via: {{ query|safe }} I get this: %u0434%u0436%u0430%u0437%u043E%u0432%u044B%u043C%u0438 ...

How to Create a word .doc file from a .doc template in php

Hi, I need to create a word document from a word template, its something like, we need to replace the few strings (say variables) in the template with the values. Please tell how we can do this in PHP ( or cakePHP). Thanks ...

Reassign parent variable in included Dwoo template

Hello ! I have a Dwoo template - in example base.html and there is an array $data. {assign '' 'globalVar'} {* $globalVar empty right now *} {foreach $data element} {include '_partial.html'} {/foreach} ... <b>{$globalVar}</b> And here is _partial.html <p> {$element.someText} </p> {assign "$globalVar $element.someVar" 'gl...

Extract the return type of a function without calling it (using templates?)

I'm looking for a way in C++ to extract the return type of a function (without calling it). I presume this will require some template magic. float Foo(); int Bar(); magic_template<Foo>::type var1; // Here 'var1' should be of type 'float' magic_template<Bar>::type var2; // and 'var2' should be of type 'int' I am currently investigati...

Best way to place data in the view (MVC)

In the framework I am working with, if I want to present data in a view I do this: <h1><?php echo $this->header ?></h1> Recently I discovered xTemplate and noticed it uses string placeholders, so the above code in a xTemplate would be: <h1>{HEADER}</h1> I always thought that a little php in the view was ok and was also faster than ...