templates

Silverlight 3: How to support templating/styling of dynamically added controls?

I'm creating a reusable control that dynamically adds another templated control to its visual tree: DashboardContainer (top-level "container" control) - DashboardItem (control that is dynamically added to a StackPanel in container) DashboardContainer is already a templated control so its easy to copy/customize its template in Blend....

How do I create the text like this website? (css/javascript)

http://posterous.com/ If you look on the very bottom/right there is "API, Privacy, Terms" They are "shadowed" text. And they have this indentation in them. Is there an easy open-source way to do this? ...

How can i take control of an element inside a template from outer template

Hi folks, Am facing hard time finding solution for this problem. I've a control template in which i've a content presenter and a Custom visual state manager with visual state Selected and UnSelected under SelectionStates group. Inside the content presenter's content template i've an ellipse whose Fill property i want to animate accordin...

Visual Studio 2008 custom class item template, $safeprojectname$ not reconciling

Just setting up some quick class and object item templates and all is working great so far, but one thing I'm stuck on is the $safeprojectname$ template parameter. I've added this as part of the namespace portion and the $registeredorganization$ is working fine namespace $registeredorganization$.$safeprojectname$ { public class $sa...

How do I require const_iterator semantics in a template function signature?

I am creating a constructor that will take a pair of input iterators. I want the method signature to have compile-time const semantics similar to: DataObject::DataObject(const char *begin, const char *end) However, I can't find any examples of this. For example, my STL implementation's range constructor for vector is defined as: tem...

Error with using a function as a non-type template parameter

I have this template : template <class SourceFormat, class DestFormat, void (*convert)(DestFormat, SourceFormat)> static void _draw(...); And these functions : template <class Class1, class Class2> inline static void convertNone(Class1& dest, Class2& source) { dest = source; }; inline static void c...

A destructor - should I use delete or delete[]?

I am writing a template class that takes as an input a pointer and stores it. The pointer is meant to point to an object allocated by another class, and handed to the this containing class. Now I want to create a destructor for this container. How should I free the memory pointed to by this pointer? I have no way of knowing a priori wh...

How do I write a Django template custom tag that adds a slash before a single quote?

Am I doing this right? (probably not...someone correct? thanks) @register.filter('addslashes') @stringfilter def addslashes(text, arg): return text.replace('\'','\\'') {{ query|addslashes }} ...

Templates specialization

I have the following set of templates: //1 template< typename T > void funcT( T arg ) { std::cout<<"1: template< typename T > void funcT( T arg )"; } //2 template< typename T > void funcT( T * arg ) { std::cout<<"2: template< typename T > void funcT( T * arg )"; } //3 template<> void funcT< int >( int arg ) ...

How can I extend std::basic_streambuf to treat any iterable sequence as a stream?

Note: Edited based on responses to receive more appropriate answers. I have a collection of C++ templates that I've made over the years, which I call Joop. It comprises mainly libraries that don't quite fall into the "general-purpose" category but are just useful enough that I keep slapping them into different projects, so most of them ...

Ancillary files for view templates in a Rails application

Dear colleagues, A very basic question on Rails. I would like to create a Rails application that, besides the "regular" html view, it can generate a set of XML files. I am aware that I can tailor the templating using the "respond_to" command and using ERB with the templates ???.xml.erb. My question is: suppose that the final document co...

C++ How to store collection of templates objects regardless of tempate

I have a problem with implementing database table library. I have a class Column storing different types. template <class T> class Column : iColumn<T> { ... } Table is composed of columns, so I need a collection of them (map with string name as a key and column as value). How shall I implement one collection of all table's columns r...

Using OleDB to update cells in preformatted Excel Template file

StringBuilder sbExcelFileConnStr = new StringBuilder(); sbExcelFileConnStr.Append("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="); sbExcelFileConnStr.Append(sFile); sbExcelFileConnStr.Append(";Extended Properties=\"Excel 8.0;HDR=No;\""); OleDbConnection xlConn = new OleDbConnection(sbExcelFileConnStr...

Bind a chunk of preformatted XML to an external variable in xquery in QtXmlPattern.

I use QT xmlpatterns in XQuery mode to implement templates. The template is an QXmlQuery object and the variables are filled-in using bindVariable(). So far the variables were strings and everything worked fine. Now, I want to inser preformated chunks of XML into the template. I would like to create a piece of xml in C++ using QXmlStr...

C++ Templates polymorphism

Hello. I have this structure of classes. class Interface{ ... } class Foo : public Interface{ ... } template <class T> class Container{ ... } And I have this constructor of some other class Bar. Bar(const Container<Interface> & bar){ ... } When I call the constructor this way I get "no matching function" error. Container<Foo> c...

Offline HTML templating

I'm designing a simple website with no dynamic content that I want to be light and portable — no PHP or other server-side scripting needed, or wanted. I'm running into a question that I've had a few times before. I'd love to be able to write common elements (head, foot, navigation) once and write the individual pages on the site with co...

C++ Template Portability

I am updating a code base that is 10 years old and used Metrowerks Code Warrior on Mac and Windows. I am updating to OS X, XCode 3.2, Universal Binary. I seem to be getting a lot of template related errors and not being a genius on templates (and forgetting to eat a healthy dose of frosted templates for breakfast), I find myself wonde...

Alternative to Factory Pattern when creating templated objects - C++

Hi, I want to implement a Mesh class for a CG project, but have run into some problems. What I want to do is a Mesh class that hides implementation details (like loading to a specific API: OpenGL, DirectX, CUDA, ...) from the user. Additionally, since the Mesh class will be used in research projects, this Mesh class has to be very flexi...

C++: Is there a way to define a static array inline?

I would like to define a simple template function which takes a runtime value and determines if it is a member of some set of possible values. Usage: int x; // <- pretend this came from elsewhere... if (isoneof(x, {5,3,9,25}) ... Something like: template <typename T, size_t size> bool isoneof(T value, T (&arr)[size]) { for (siz...

How to use Django templatetags in static media files?

Hi, Im using a flash gallery and the settings xml file is stored in /media/xml/gallery.xml In the gallery.xml file I want to add this snippet of code: <items> {% for image in images %} <item source="{{ MEDIA_URL }}{{ image.image }}" thumb="" description="{{ image.title }}" /> {% endfor %} </item> But the source="... rend...