templates

ASP.NET MVC 2: CheckBoxList multiple selections: how to model bind back and get all selections?

This code: Html.CheckBoxList(ViewData.TemplateInfo.HtmlFieldPrefix, myList) Produces this mark-up: <ul><li><input name="Header.h_dist_cd" type="checkbox" value="BD" /> <span>BD - Dist BD Name</span></li> <li><input name="Header.h_dist_cd" type="checkbox" value="SS" /> <span>SS - Dist SS Name</span></li> <li><...

Ext.form.ComboBox: Use template for displayField

Is there any way to apply a template to the selected value of a ComboBox? I'm using a template to display the drop down values of the ComboBox, but as soon as i select one, the plain value from the datastore is shown. { id: 'requestStatusCombo', hiddenName: 'requestStatus', tpl: '<tpl for="."><div c...

How to put textboxes into a datagrid?

VS 2010, WPF project. I have a datagrid with text in all cells (data are from an array of custom objects). However I am unable to copy (ctrl+c) content of any cell. So I would like to use textboxes to display content of each cell. The real problem is I cannot do this in XAML but I have to do it dynamically in the code, because entire gr...

Inline code when counting data items (using templates)

There is a simple POD data type like struct Item { int value1; double value2; bool value3; } Now I would like to write different count functions like it could be done with the following code (or some std method): typedef bool Selector(const Item& i); int count(const vector<Item>& items, Selector f) { int sum = 0; BOOST_...

Accessing members of templated class instantiated with different template arguments

My main project class is templated class, declared with: template<int dim, typename typ> where dim is number of dimensions (2 or 3), and typ is floating point data type (float or double). Based on these parameters, instances of this class have their members of specific type and vectors (math) have dim number of components. So instanc...

Is there a JQuery plugin for the iPhone that will notify the user to "Bookmark" their app?

Because it is not possible to force the iPhone to bookmark a webpage, I want a little arrow/bow to drop down to notify people to bookmark my mobile web page. ...

Template argument missing for boolean operator?

I'm currently creating a circular doubly-linked list as exercise. The exercise is templating the damn thing, which is proving to be quite a pain. After many, many, many error-removals I get more errors. I'd laugh at that, but I'm quite tired and exhausted now. Node.h template<class T> class Node { public: Node(T val) : data(val), n...

Storing struct instances in a std::map

I'm trying to map some structs to some other instances, like this: template <typename T> class Component { public: typedef std::map<EntityID, T> instances_map; instances_map instances; Component() {}; T add(EntityID id) { T* t = new T(); instances[id] = *t; return *t; }; }; Then I use ...

How can I use html based template with smartgwt

I am using smartgwt for our application. I have to define a template which our application uses. The template is complex enough that I have to use div or table base structure to build that template. There are two main sections of website. (1) public view (2) logged in view. The public view of website uses template and when user logs in...

Using JAX-RS / Jersey with Freemarker templates

There are examples on the web showing how to use the JAX-RS implementation Jersey with custom template engines like FreeMarker. But these examples are looking a bit improvised or dated. There is also one example relying only on JAX-RS and not Jersy specific classes. Is there a mature ViewProcessor implementation for FreeMarker or do I ha...

Variadic templates for lambda expressions

What's the correct way to do this with g++: template < typename F > void g (F f); template < typename ... A > void h (A ... a); template < typename ... A > void f (A ... a) { g ([&a] () { h (a...); }); // g++-4.6: error: parameter packs not expanded with »...« } ...

How to make boost::make_shared a friend of my class.

I have written a class with protected constructor, so that new instances can only be produced with a static create() function which returns shared_ptr's to my class. To provide efficient allocation I'd like to use boost::make_shared inside the create function, however the compiler complains that my class constructor is protected inside b...

Solving the mixin constructor problem in C++ using variadic templates

I've recently tackled the constructor problem, where various mixins classes that decorate each other (and a topmost host class) have different constructor signatures. To maintain a single constructor in the resulting decorated class, and without adding init functions, I've found the following solution. The only restriction it places on a...

Testing function signatures with ParameterTypeTuple

I'm writing a module with mixin templates to supply a main function for unit-testing purposes. Usage is as follows: /* For modules without their own main, e.g. libraries. * main is conditionally supplied using version(unittest). */ mixin Main; /* For executable modules defining function "realMain". * Generated main has the same sig...

Tempate not displayed on the page attribute section while adding or editing the pages.

Hi, I have used wordpress and there is a section page attributes which includes Parent, Template and order. What my problem is i am not being able to see the templates to select while adding the pages. One problem is that the current theme is not displayed and it shows nothing on Current theme. I have two themes and both listed as not u...

Using templates to manage glUniform functions

Hi again and welcome to another 'wouldn't it be great if we'd combine two things that i really don't understand anything about'-question ;) This Episode: OpenGL Uniforms and c++ Templates The Idea: Wouldn't it be great if you could write a single template function to set uniforms in an OpenGL shader? The Problem: Uniforms in shaders a...

C++ Templates compilation

I am failing to answer questions related to templates. Basically how templates are compiled by the compiler. I googled but did not find answers. Can somebody help me ...

C++ Boost serialization Serializing templated derived classes

Hi, i would like to serialize a class with an attribute as a list of pointers on a generic class This is the parent class from which the generic class derives : class Base{ public : friend class boost::serialization::access; virtual ~Base(){} template<class Archive> void serialize(Archive & ar, ...

arbitrary datatype ratio converter

I have following code: template<typename I,typename O> O convertRatio(I input, I inpMinLevel = std::numeric_limits<I>::min(), I inpMaxLevel = std::numeric_limits<I>::max(), O outMinLevel = std::numeric_limits<O>::min(), O outMaxLevel = std::numeric_limits<O>::max() ) { double inpRange = abs(double(inpMaxLevel - inpMi...

Django: one template for different lists of objects

hi, my model is basically a chain of objects linked by a foreign key: class Object1(object): object1_id = models.AutoField() object1_name = models.CharField() class Object2(object): object2_id = models.AutoField() object2_name = models.CharField() object1 = models.ForeignKey(Object1) class Object3(object): obje...