templates

Django can't find HTML file.

I have a html file ('search.html') with a form on it. I have saved it to ~/Django/Templates just for the sake of argument. The Django book said it doesn't matter where I save it, because the framework will find it. Anyway, I have set up a function in the views.py file to render this file. Here it is: from django.http import HttpResponse...

Struct with the function parameters

Can I suppose that, from the call stack point view, it's the same to call a function like function1 int function1(T1 t1, T2 t2); than to another like function2? struct parameters_t { Wide<T1>::type t1; Wide<T2>::type t2; } int function2(parameters_t p); Where, Wide template wide T to the processor word length. For example...

Using STL algorithms (specifically std::sort) from within a templated class

I've declared a template class MyContainer as bellow, then created an instance of it of type DataType1. The DataType1 class provides a friend function "DataSpecificComparison" which is used by std::sort to compare DataType1 objects. The program compiled and sorted correctly. I then defined a class called DataType2, gave it a friend imp...

TreeView using Hierarchical Data Templates binding to different collections

I'm using a TreeView with a Hierarchical Data Template to bind to a View Model hierarchy, my problem is i have multiple child collections of different types (same base class though). Seems relatively simple to use the template to bind one of the collections but i'm struggling to work out how to do both. class ParentViewModel { List<...

Custom template in joomla. Install Joomla to an existing site.

I need some help with integrating Joomla to an existing site. The existing site is made of several .php files which shows static text. I have copied all css and js files to a new template in Joomla and the design seems to work pretty well. I want to make an article in Joomla for each .php file in the old site containing their 'news'. ...

Rendering HTML files in Grails

Hi all, I've looked around but could not find a way of simply including or rendering *.html files in Grails. My application needs to g.render or <g:render> templates which are delivered as html files. For this, as we know, html files have to be converted to _foo.gsp files in order to get rendered. I am totally surprised as to why isn't ...

Django ModelForm Template?

I want to learn how can I add to template to my ModelForm i'm newbie. Below you can see my models.py, url.py and views.py: My model.py looks like that: from django.db import models from django.forms import ModelForm from django.contrib.auth.models import User class Yazilar(models.Model): yazi = models.CharField(max_length=200)...

Accessing user profile variables

Using the profile module I've created a textfield called profile_real_name which the user fills out when registering. How do I access this variable in the node.tpl.php? I used the dsm($user) function to output the user variables and it contained everything except the data for the profile_real_name I also ran dsm($vars) on the phptempl...

c++ templates in an iPhone project

Hello, I am porting a project to the iPhone system and I am facing the following problem: I have an header containing c++ templates If I rename it to .mm, it does not compile (because it should be an header) and if I keep it as .h, it is interpreted as an objective C header Do you have a workaround to fix this issue? Thanks in advance...

Django extends/include - bug?

Hello, I'm trying to use both extends and include tags in one template, just like: {% extends "layout.html" %} {% block content %} <div id="content"> <nav class="mainMenu"> {% include "list.html" %} </nav> </div> {% endblock %} Unfortunately what is displayed is only list.html without contents from layout.html and file that...

DLL and fully-specialized template class

Hello, Environment: Visual Studio 9, C++ without managed extensions. I've got a third-party library which exports a fully-specialized template class MyClass<42> defined in MyClass.h. It gets compiled into a helper loader .lib and a .dll file. The .lib file contains compiled code for this specialization, and necessary symbols. The MyCla...

How do we typedef or redefine a templated nested class in the subclass?

Consider the following: template <typename T> class Base { public: template <typename U> class Nested { }; }; template <typename T> class Derived : public Base<T> { public: //How do we typedef of redefine Base<T>::Nested? using Base<T>::Nested; //This does not work using Base<T>::template<typename U> Nested; //C...

Clip borders/ rounded corner of webpage like twitter?

I want to build a webpage like twitter or microsoft hohm. Like clipping borders, buttons, clipped text box. How can I do this in Dreamweaver? Is these things are done by photoshop? Any tutorial or links will be very helpful. If there are any webdesign template of twitter of something like twitter please let me know. ...

Templates vs. Action Hierarchy

I'm creating a button class and am having a hard time deciding between 2 solutions. 1) Templatize the Button class and have it take a function object in its constructor to call when the button is pressed. The guy I'm coding with is worried that this will lead to code bloat/thrashing. 2) Create a ButtonAction base class, and there will ...

How to test if template parameter is a pair associative container ?

Let's imagine I want to make a templated function that returns the first element of any stl container. The general way would be : template<typename Container> Container::value_type first(Container c){ return *(c.begin()); } This works for vectors, lists, deques, sets and so on. However, for pair associative containers (std::map),...

Calling a member function from a member function templated argument

Given the following code which I can't get to compile. template < typename OT, typename KT, KT (OT::* KM)() const > class X { public: KT mfn( const OT & obj ) { return obj.*(KM)(); // Error here. } }; class O { public: int func() const { ...

Converting from "foo<T>" to "const foo<const T>" - C++

I have a function like (please don't care about returning temporary by reference. This is just an example to explain the problem), const foo<const int>& get_const() { foo<int> f; return f; } This obviously won't compile. I am looking for a way to ensure callers won't change the T of foo. How can I ensure that? I have seen the...

Can C++'s value_type be extended from iterator_traits to all types?

I would like to create a construct similar to std::iterator_traits::value_type that can work seamlessly for all types using the same syntax. Imagine we have the following: template <typename T> struct value_type { typedef T type; }; #define VALUE_TYPE(T) typename value_type<T >::type This will work for POD types. I can specialize...

How to set a template for a new issue in Redmine?

The goal is to make users be more specific when reporting a bug. Ususally I get a messy report "It doesn't work, please help ASAP!" from a user, so I keep asking the same questions each time -- "The why, the who-what-when, the where, and the how..." Instead, I want to set a template for a new issue, something like this: What pag...

sizeof(...) = 0 or conditional variable declaration in c++ templates

Suppose I have something like this: struct EmptyClass{}; template<typename T1, typename T2 = EmptyClass, typename T3 = EmptyClass, typename T4 = EmptyClass, ..., typename T20> class PoorMansTuple { T1 t1; T2 t2; ... T20 t20; }; Now, I may waste up to 19bytes per PoorMansTuple. Question is: 1) Is there a way...