templates

How to remove templates in Eclipse

I am learning Java servlets technology. In a bookt that I am reading, they have asked me to work in a notepad for time being. When i Create a servlet in eclipse, it just auto fills some content to that servlet class which I want to write on my own to learn stuff. For example, the doGet and doPost methods and their signatures. I want t...

C++ template macro shortcut

Often when working with templates, you end up with something like: template <T> class the_class { public: // types typedef T value_type; typedef const value_type const_value_type; typedef value_type& reference; typedef const_value_type& const_reference; typedef value_type* pointer; typedef const_value_type* const_...

In a header file for other programm to use, can I only declare the templates?

I was wondering about using or not templates, in other thread I found out that templates must be implement in the header file because of some reasons. Thats ok, my question is if the source will be need if other programm use it? from the logic of the other thread's answer, it seems that even other programm would need the full implementat...

wpf know when template has changed

Maybe this has been asked before, but I can't seem to find the answer through searching and googling it. What I need is a way to tell when a template of a control has changed. Meaning I'm looking for an event to fire when a template has changed on a control. Something along the lines of an event called TemplateChanged. I don't see a...

C++ partial method specialization

Is there a partial specialization for template class method? template <class A, class B> class C { void foo(); } it doesn't work to specialize it like this: template <class A> void C<A, CObject>::foo() {}; Any help? ...

Letting a template and multiple partials add to the layout

First off, let me say that I am familiar with content_for. It's not really what I'm looking for here. I want to allow a template and any number of partials to build up, say, a list of JavaScript files I want to load, and pass them up to the layout for it to process and add to the <head> area. I only want to load the files if the page ac...

simple template engine help

I've build a simple templating engine for a friend, however i have a problem which i think is a simple one the script looks for these values in a template $find = array("{$body}", "{$page_title}"); and replaces them with some other values. However because they look like php variables I'm getting all sorts of errors and them being un...

How can I theme the template for edit or add a node for a specific content type?

I want to theme the template for edit or add a node for a specific content type. For example, to theme all the content type forms I use the file page-node-{add|edit}.tpl.php (depending what I need to do add or edit). But I didn't found the template name for a custom node type, for example Products. I need to theme only for Products, bu...

Excluding boost signal calling

There is a signal and several objects with slots. I want to implement the behavior when one object calls signal and blocks its own connection. I guess a small snippet will be more informative: typedef boost::signal<void()> TSignal; template<class TSignal> class SlotObject { public: void Connect(boost::shared_ptr<TSignal> pSignal...

Magento eCommerce Templates

I am trying to port a site design from OSCommerce to Magento and I am finding it quite difficult. The documentation is quite poor tbh. Has anyone done this or used Magento in anyway? Any good tutorials/guides out there, if not for porting then just for building a template from scratch? Any help would be great, I've already been looking ...

Why am I getting unresolved externals?

I am writing an immutable binary search tree in c++. My terminating nodes are represented by a singleton empty node. My compiler (visual c++) seems to be having trouble resolving the protected static member that holds my singleton. I get the following error: error LNK2001: unresolved external symbol "protected: static class boost::sh...

functor generation from member function pointer type

I am trying to simplify (via make_fn()) the generation of functors that preprocess parameters (via wrap()) for member functions of arity n. Generating the functors is basically working, but until now only by explicitly specifying the parameter types for the member function. Now i'd like to generate the correct functor from the member fun...

C++ - Import of explicitly specialised templates on Windows

I am having some trouble getting a program to link on Windows with VC2008 SP1. I am explicitly specialising a template member function in a DLL, which appears correctly as an exported symbol in dependency walker, for the correct type, and with the correct arguments. When I try to call the symbol from an .exe, the linker complains that i...

C++: Polymorphic class template

Consider a class Calendar that stores a bunch of Date objects. The calendar is designed to hold a collection of any type of objects that inherit from Date. I thought the best way to do it is to have a class template such as template<typename D> class Calendar{ ... } But it struck me that D can now in fact be any class. My questio...

template which enforces interface

Is it possible to create a template accepting types which implement certain interface? For example, I want to say to template user: you can store anything in my container as long as it implements Init() and Destroy() methods. Thanks ...

Customize the theme output for the search box in Drupal

I am trying to change the HTML that is output when I print $search_box in my page.tpl.php file. I understand the process of overriding something in drupal but I have no idea how to do it for the search box. This is the only bit of information that I have found that seems related but I don't known how to apply it to solving my problem: h...

What is the preferred design of a template function that requires a default parameter value?

I'm currently working on cleaning up an API full of function templates, and had a strong desire to write the following code. template <typename T, typename U, typename V> void doWork(const T& arg1, const U& arg2, V* optionalArg = 0); When I invoke this template, I would like to do so as follows. std::string text("hello"); doWork(100,...

Looking for full-featured Web-Application theme sets similar to Pilu's web-app-theme

Hi there, We develop a fair number of web-based applications, most of which are hosted on enterprise servers, and not accessible via the internet. We haven't yet adapted a standard template for our web apps, and we waste a lot of time doing design work when we release an app that is consumed via a browser. I say waste because most of o...

Template static variable

Hi folks! I can't understand, why if we define static variable of usual (non-template) class in header, we have linker error, but in case of templates all works fine and moreover we will have single instance of static variable among all translation units: It's template header (template.h): // template.h template<typename T> class Templ...

How can I define operations on a template without caring what type it's instantiated with?

I have inherited a bunch of networking code that defined numerous packet types. I have to write a bunch of conversion functions that take structs of a certain type, and copy the values into other structs that have the same fields, but in a different order (as part of a convoluted partial platform bit order conversion thing -- don't ask)...