templates

C++ inheritance/template question

I have two classes, point and pixel: class point { public: point(int x, int y) : x(x), y(y) { }; private: int x, y; } template <class T> class pixel : public point { public: pixel(int x, int y, T val) : point(x, y), val(val) { }; private: T val; } Now here's my problem. I want to make ...

Static member initialization in a template class

I'd like to do this: template <typename T> struct S { ... static double something_relevant = 1.5; }; but I can't since something_relevant is not of integral type. It doesn't depend on T, but existing code depends on it being a static member of S. Since S is template, I cannot put the definition inside a compiled file. How do ...

Grails Tomcat Render GSP template

In a controller i have ,, render(template: 'bookingHeader', model: [memberInstance:memberInstance,bookingInstance: bookingInstance, eventInstance: eventInstance]) render(template: 'bookingAccounts', model: [memberAccountInstanceList:memberInstance.memberAccounts]) which correctly renders info to the screen .. In a gsp I have ...

Return a list of lists to template and render it

In my project I deal with various sorts of events taking places in different cities. I'd like to present list of events per city in a template, but how to do that ? My view now looks like this : def events_by_state(request, state): cities = City.objects.filter(state_slug=state) For each city I'd like do a query : for c in cities...

How to change state of container items based on container state (WPF/XAML)

I have a Listbox with items created through databinding. The item template creates a custom view for each generated item. Each generated item view is its own user control. I'd like to change the state of the listbox to something like "Details" vs. "Compact" and have each item have its own state changed automatically. The view item kn...

What is the best way to add content to a template?

I am trying to find a way to add content to a div that is defined in my application.html.haml file from individual view files. The reason I want to do this is because I have a sidebar that is always present and is defined in the template, but I would like to have content specific to each page included in the sidebar. Would this be done b...

How to include a template member in a class?

I am attempting to make a class that has a template object member inside of it. For example mt_queue_c<int> m_serial_q("string"); However, when I do this it fails to compile. If I move this line outside of the class definition so that it becomes a global object, it compiles fine. I condensed the code into the smallest possible fai...

how to insert image into email template

Hi guys, I'm trying to use the PasswordRecovery of ASP.NET. Everything works fine, however I am using Email template. Within this email I'm trying to insert an image as follows: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <body> <img alt="blabla" src="/Images/blabla-logo.png" align="middle"/><br/><br/> bla bla:<%Password%><br /><...

VS2010 C++ member template function specialization error

I have the following (minimized) code, which worked in VC2005, but no longer works in 2010. template <typename TDataType> class TSpecWrapper { public: typedef typename TDataType::parent_type index_type; public: template <bool THasTriangles> void Spec(index_type& io_index) { std::cout << "False version" << s...

Class type from pointer used as template argument

If a pointer to an user defined type is passed as template argument to a template class, is it possible to get the class type of the argument? template <class T> struct UserType { typedef T value_type; ... }; int main () { typedef std::vector<UserType<double>*> vecType vecType vec; vecType::value_type::value_type m...

Templated usercontrol with template properties

In C#, I'm trying to figure out a way to use properties inside a templated usercontrol. Let me try to explain what I mean through an exmaple: <example:myTreeOfItems runat="server"> <HeaderTemplate> <div> </HeaderTemplate> <IndentStartTemplate> <ul> </IndentStartTemplate> <ItemHeaderDefaultTemplate> ...

Frameworks/templates for web developer

Hi, I'm C/C++, Java developer and now in order to put some variety into my work, I decided to start playing with web development - i'm using django. However, I'm hopeless with graphics and advanced css. I would like to build and ship some apps with elegant and simple design. Are there any frameworks/templates which let me build somethin...

How to get the return type of a boost::signal?

I use boost::signal with different function signatures and different combiners. In a class that looks like the one beyond I want to get the return of a certain signal declaration. template<typename signal_type> class MyClass { signal_type mSignal; signal_type::result_type getResult() { return mSignal(); } } But signal_type:...

Using JSON in XUL <template>s

As far as I can tell, the template feature in XUL doesn't allow you to load JSON data into your listbox/tree/etc. element. -- it only supports XML and RDF. The closest thing I found to an indication that it might someday support JSON, is the comments on this blog post from 2007, saying that there was a bug filed. But the bug in question ...

Using C++ templates or macros for compile time function generation

Hi all, I have a code that runs on an embedded system and it has to run really fast. I know C and macros, and this particular project is coded mostly in C but it also uses C++ templates [increasingly more]. There is an inline function: inline my_t read_memory(uint32 addr) { #if (CURRENT_STATE & OPTIMIZE_BITMAP) return readOptimiz...

jquery delegate problem with jquery templates

Hi all, I've been using the jQuery templates code (jquery.tmpl.js on github) and it's been working very well for me. However, I'm trying to attach events to the content using delegate and it's not working. Here is my simplified HTML structure after the templates are inserted: <!-- static in the html file --> <div id="container"> <!--...

What do you feel is over-generalization?

Having spent some time playing around in Haskell and other functional languages, I've come to appreciate the simplicity of design that comes from describing problems in general terms. While many aspects of template programming can be far from simple, some uses are common enough that I don't think they're an impediment to clarity (especia...

Generating Reports - What works for you?

I'm looking for a templating tool that allows powerful manipulation of data and report building. JasperReports is powerful, but is it the best out there? I generally don't need the ability for fancy colors or gradients, but I do need the ability to position data accurately and produce reliable, quick results. Ideally, generating a report...

.net template 'if null' check in vb - syntax?

I am new to .net completely and I just need to know the syntax, or possible functions to put in my if statement to check if <% If Model.contacts Is Null Then%> which isn't correct. Where Model.contacts comes from my ClientViewModel, and Model.contacts is of type System.Linq.IQueryable(Of Contact) Here is the code for addresses... <% ...

Member function cannot access private member

I have got the following code #include <iostream> #include <string> template <typename T> class demo { T data; public: demo(); demo(demo const&k ); demo(const T&k); demo& operator=(const demo &k); template<typename T1> demo(const demo<T1>&k); template<typename T1> demo<T>& operator=(const demo<T...