templates

Regular expression for String.Format-like utility

Hi, I'm writing a class called StringTemplate, which allows to format objects like with String.Format, but with names instead of indexes for placeholders. Here's an example : string s = StringTemplate.Format("Hello {Name}. Today is {Date:D}, and it is {Date:T}.", new { Name = "World", Date = DateTime.No...

Universal template/config syntax

I have a number of applications written in different languages (Java, JavaScript, PHP, etc.). Their view/presentation layers display things in various formats: HTML, plain text, etc. I want to display some textual/numeric data in roughly the same way in each application. Of course, the result would be slightly different depending on the...

[C++/Templates] How to use a template parameter in another template parameter declared before

Hello, a template parameter can be used in another template parameter that follows it this way : template<typename T, T N> struct s { }; But is it possible to reference "T" if it is declared after "N" ? This does not work : template<T N, typename T> struct s { }; Can we help the compiler by pre-declaring "T" or doing anything els...

Class constructor with non-argument template type

For a normal C++ function, it's possible to have template parameters not appearing in the argument list: template<typename T> T default_construct() { return T(); } and call this with some_type x = default_construct<some_type>(); Even though the type I'm using is not in the argument list, I can still pass it to the function. Now...

C++ Template abuse question - Augmenting floats with additional type information

I had an idea motivated by some of the documentation I read in the tutorial of the boost MTL library. The basic premise is that I would like to use templates to give me compile time type checking errors for things that are otherwise the same. Namely, lets say I have two units of measurement, Radians and Degrees. The most obvious way to...

What happens if the meta tags are present in the document body?

I am working on a ASP application and the code, template and files are organized in a way that does not allow me to alter anything outside the body tag. So I am thinking about inserting the meta tags inside the body -- like this: <!-- FEW ASP INCLUDES --> <html> <head> <!-- FALLBACK TITLE AND DESCRIPTION --> <title>Default T...

how to extend the "Application Templates" of MOSS

For example, MOSS provides "Inventory Tracking Template" To add workflow capability should we create another custom webpart using the classes? Hope we can add columns to the List Provided. in order to add additional logic (like validation, kicking notification,etc) Visit this link to understand more about the 2nd point: http://www.ex...

WPF making templates for editing

Hi, Im building a small digital signage system to run on internal machines. I would like to provide the editors (non tech people) with some template to choose the layout from. Something in the line of: It should be easy for me to maintain the templates and to create a new template i.e. just create the XAMl markup. Any ideas on how t...

C++ Templates Error

I'm trying to write a simple vector class with templates, but when I split it into a .h and a .cpp file, I get these errors: undefined reference to vector<int>::vector()' undefined reference to vector::add(int)' undefined reference to vector<int>::add(int)' undefined reference to vector::remove(int)' the code: http://pastie.org/623584 ...

C++ Templates and Inheritance

Let's say I have a simple Server with a template which accepts a Client as it's template argument: template<class T> class Server<T>{ Server(int port); } and a Client is defined something like this: class Client{ Client(Server<Client> *server, // <-- int socket); }; But I also want say, have the class User inheri...

Adding defaults and indexes to a script/generate command in a Rails Template?

I'm trying to set up a Rails Template that would allow for comprehensive set-up of a specific Rails app. Using Pratik Naik's overview (http://m.onkey.org/2008/12/4/rails-templates), I was able to set up a couple of scaffolds and models, with a line that looks something like this ... generate("scaffold", "post", "title:string", "body:str...

Getting Row's Name in a DataList

I have a datalist and would like to pull the row names from the table that I am getting my values from for the datalist. Heres an example of what I would like to do. <HeaderTemplate> 'Get data row names 'Maybe something like Container.DataItem(row)? </HeaderTemplate> ...

Multiple type of controls in the same header in the datagrid in Silverlight

I want to design the property window in Silverlight by using DataGrid. It will have two header columns. The value header can have the different types of controls. It might have combobox, textbox and other controls. Here is the view for the datagrid. Name--------------Type of the control(Control to display) DisplayText-------TextBox Typ...

HTML/CSS Template for Form-Based Apps

I do a lot of web apps that mainly rely on forms and I'm wondering of there is some nice HTML/CSS template I could use, at least for my demos. ...

Another curiously recurring template pattern.

template <class Data, class Allocator = std::allocator<Node> > class Node : public Data { // ... }; The question is simple, how to make the above code compile? The intention is to give Node a possibility to allocate other Nodes (and to provide a default allocator). ...

SharePoint template option missing

I believe I have read this somewhere, but I can't find it nomatter how I search. I need to create a site collection using the "Publishing Site with Workflow" template. Unfortunately, that template is not available as an option. The SharePoint installation is an Enterprise license and all enterprise features are enabled. Any idea what I'm...

Best way to reuse a dialog in WPF?

I have a WPF dialog with a couple user controls and some other standard controls. We have many uses for this dialog with specific tweaks. Right now this dialog manages all of the logic to tweak itself. I can't help but think there's gotta be a better way. I wish I could do something like this: Original dialog <dialog> <Control1> ...

Template friendship

I'm trying to access protected variables of a template class with different template parameters. A friend declaration with template parameters is giving the following error: multiple template parameter lists are not allowed My code is template<class O_, class P_> class MyClass { //multiple template parameter lists are not allowed...

HTML editor with fixed (uneditable) regions and ability to add/remove and reorder editable regions

Before I start to develop an online WYSIWYG HTML editing solution which can take templates that have locked regions, regions where sections of predefined HTML can be added, removed and re-ordered (much like DreamWeaver template functionality), the editable regions will be edited with an out of the box solution such as the CK Editor or th...

determine value range of template type in C++

Hi, In a template function, I like to determine the range for the value of its template type. For specific type, like int, INT_MAX and INT_MIN are what I want. But how to do the same for a template type? Thanks and regards! ...