templates

Declare module name of classes for logging

I currently am adding some features to our logging-library. One of these is the possibility to declare a module-name for a class that automatically gets preprended to any log-messages writing from within that class. However, if no module-name is provided, nothing is prepended. Currently I am using a trait-class that has a static function...

avoiding enums as interface identifiers c++ OOP

Hi I'm working on a plugin framework using dynamic loaded shared libraries which is based on Eclipse's (and probally other's) extension-point model. All plugins share similar properties (name, id, version etc) and each plugin could in theory satisfy any extension-point. The actual plugin (ie Dll) handling is managed by another library, ...

Custom template for Django's comments application does not display fields

Hi, I want to use django.contrib.comments in a blogging application and customize the way the form is displayed. My problem is that I can't get the fields to display although displaying the hidden fields works just fine. I had a look at the docs and compared it with the regular way of displaying forms but honestly I don't know why the ...

Selecting a UserControl from XAML

I'm working on a problem right now where I need to embed a UserControl inside another UserControl. But, I need to determine at runtime which embedded UserControl to instantiate. This implies to me that some form of data binding and/or template selection mechanism has to be invoked, but I'm not sure how to proceed with the pure XAML appr...

Subrows into a row in GridView using WPF & C#

hi! In my gridview I need to aggregate subrows into each row, something like in p2p emule/amule application where you can do double click to each file you are downloading and then under it you can see the parts of the file from where you are downloading. Is it possible in WPF? Thanks. ...

question regarding templatization of virtual function

I know that you cannot templatize a virtual function and I do understand the concept behind it. But I still need a way to get past some errors I am getting. I am able to make my stuff work, but it doesn't look right to me. I have class called System: #include "Vector.h" class System { virtual void VectorToLocal(Vector<T>& global_d...

Why are structs not allowed in template definitions?

The following code yields an error error: ‘struct Foo’ is not a valid type for a template constant parameter: template <struct Foo> struct Bar { }; Why is that so? template <class Foo> struct Bar { }; works perfectly fine and even accepts an struct as argument. ...

Constant expression with custom object

I'm trying to use an instant of a custom class as a template parameter. class X { public: X() {}; }; template <class Foo, Foo foo> struct Bar { }; const X x; Bar<X, x> foo; The compiler states that x cannot appear in a constant expression. Why that? There is everything given to construct that object at compile time. ...

boost smart pointers and BOOST_NO_MEMBER_TEMPLATES

After some struggling I managed to get boost smart pointers to build for Windows CE/Mobile at warning level 4. I found the least-resistance-way to get rid of compile errors and warnings to be #define BOOST_NO_MEMBER_TEMPLATES What does it actually mean? Did I sell my soul to the devil? Will all hell break loose when I actually use th...

class T in c++ (your definition)

The one advantage of using class T in c++ is to reduce the time to redefine data types in a function, if those data types are defined in other function, for example, in int main. template <class T> void showabs(T number) { if (number < 0 ) number = -number; cout << number << endl; return 0; } int main() { int num1 = -4; ...

Django template tag basic question

It looks like this template tag works like a charm for most people: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/ For some reason I get this error: Caught an exception while rendering: 'is_paginated' I use this template tag in my template like so: {% load digg_paginator %} {% digg_paginator %} Where di...

c++ templates: problem with member specialization

I am attempting to create a template "AutoClass" that create an arbitrary class with an arbitrary set of members, such as: AutoClass<int,int,double,double> a; a.set(1,1); a.set(0,2); a.set(3,99.7); std::cout << "Hello world! " << a.get(0) << " " << a.get(1) << " " << a.get(3) << std::endl; By now I have an AutoClass with a working "se...

Webpage - Wordpress,Joomla or any other tempalates for my custom site

Dear All, I am working for a university project and for this project I have the following custom scenario Could some body point me to right resource( any template or framework) ? 1) Registered student can create a topic , Once he creates a topic I have to generate dynamically a web page for this topic with 4 main areas ( some what l...

Implement the Combine function using templates

any idea on how to do it for template? thanks For example, Combine(<list containing 6,3,1,9,7>, std::plus<int>()) should calculate ((((6+3)+1)+9)+7). Combine(const Container& c, Function fn) throw (NotEnoughElements) { your code goes here } ...

Template access of symbol in unnamed namespace

We are upgrading our XL C/C++ compiler from V8.0 to V10.1 and found some code that is now giving us an error, even though it compiled under V8.0. Here's a minimal example: test.h: #include <iostream> #include <string> template <class T> void f() { std::cout << TEST << std::endl; } test.cpp: #include <string> #include "test.h" n...

I have a standard table with text inside. How do I vertical align this?

Right now, the text seems not to be exactly vertical centered. It seems that there is more top-padding than bottom-padding. Although of course, there is no padding in the CSS. How do I make this completely vertical aligned? ...

How do I do this <a href>?

http://www.twitter.com/home?status=Check out my page! However, when it goes to the twitter page, it has %20 symbols replacing the spaces. Why? ...

How can I create a <a href=> to facebook and share a message?

I don't want to share my PAGE, but I want to share a message with a short URL link to something. ...

Tutorials and Introductions to C++ Expression Templates

What are good introductions to the creation of C++ expression template systems? I would like to express arithmetic on user defined types while avoiding temporary values (which may be large), and to learn how to do this directly rather than applying an existing library. I have found Todd Veldhuizen's original paper and an example from th...

Convert template from "rounded corners" to "square"

I've downloaded the following template: http://www.styleshout.com/templates/preview/Refresh11/index.html But unfortunately, it has rounded corners and shades. I want it to have square corners and the shades should be removed, too. It should look like this: But I'm not good enough at (X)HTML and CSS so I didn't manage to achieve this...