templates

CSS Documentation Template

Does anyone know if there are CSS templates purely for documentation purposes? I haven't been able to find any. Edit: Looks like I will have to write my own. Basically it would have been nice to have a little css template that has pre-styled notice boxes and lists purely for the use of user guides or documentation but not too hard to se...

Why can't I do a hyphen in Django template view?

{{profile.first-name.value}} My variable is hypeh only...I wish I could do first_name, but many variables are hyphens. However, due to this problem, I can't display my variables in the template. Why? ...

In the generic programming/TMP world what exactly is a model / a policy and a "concept" ?

I'd like to know the precise yet succinct definitions of these three concepts in one place. The quality of the answer should depend on the following two points. Show a simple code snippet to show how and what the concept/technique is used for. Be simple enough to understand so that a programmer without any exposure to this area can gra...

Django debug display all variables of a page

Is there a template tag (or any other trick) I can use to display all the variables available in a page? ...

Repository pattern: Dynamic class generation

I would like to implement the repository pattern, having my domain classes being independent from my repository implementation. but maintain my domain classes -on schema updates using EF for example- is really expensive. Do you know someway to automatize domain classes updates based on the ORM classes? -using T4 templates or something ...

WPF: How to customize SelectionBoxItem in ComboBox

I want to display a custom template/item as selected item in ComboBox (this item does not actually exist in the list of items and is updated differently). This does not even needs to be an item, just providing a custom view would work. How can I do this while staying within current ComboBox theme (so no ControlTemplate replacement poss...

adding a logo in cake framework by editing default.ctp

where do i put the code for the image, then where would i put the actual image file itself <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <?php echo $html->charset(); ?> <title> <?php __...

Prevent unnecessary copies of C++ functor objects

I have a class which accumulates information about a set of objects, and can act as either a functor or an output iterator. This allows me to do things like: std::vector<Foo> v; Foo const x = std::for_each(v.begin(), v.end(), Joiner<Foo>()); and Foo const x = std::copy(v.begin(), v.end(), Joiner<Foo>()); Now, in theory, the compil...

How can my Django views know which template to render, or whether to return JSON?

Our site can be accessed from a full browser, from mobile browsers, and from a custom iPhone app. Since the logic is mostly the same regardless of the client, we're using the same views to process all types of requests. But at the bottom of every one of our views, we have something like: if request.is_mobile(): return render_to_resp...

Templating Html.DisplayFor() in ASP.NET MVC 2

It appears that if you just use Html.DisplayFor(model => model) with no templates for a Details view, the resulting markup will look something like this: <div class="display-label">first name</div> <div class="display-field">Dan</div> <div class="display-label">last name</div> <div class="display-field">M</div> <div class="display-label...

Are there any Python template engine that supports Python 3.x

It seems they all on Python 2.x. (Actually I want a more widely-used engine that has Python 3.x support.) ...

C++ functor to output iterator adapter

Given a functor appropriate for use with std::for_each and friends: template <typename T> struct Foo { void operator()(T const& t) { ... } }; std::for_each(v.begin(), v.end(), Foo<Bar>()); Is there some standard way to convert this into an output iterator appropriate for use with std::copy and friends? (or the opposite adaptatio...

In Android Webview, am I able to modify a webpage's DOM?

Suppose I load a 3rd party URL through webview. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); webview.setWebViewClient(new HelloWebViewClient()); webview.getSettings().setJavaScri...

What should the iterator type be in this C++ template?

While working on some graphics code a while back, I wrote Rect and Region classes using ints as the underlying coordinate holder, and that worked fine. The Region was implemented as a simple class extension to an STL list, and just contains a list of Rects. Now I also need the same kinds of classes using doubles as the underlying coordi...

Is it possible to specialize on some (not all) class template parameters?

For example: template <typename T, typename U> class TC { public: void Foo(); }; template <typename T, typename U> void TC<T, U>::Foo() { } template <???, typename U> void TC<int, U>::Foo() { //Want this defined for all U but only when T is int. } int main(int argv, char * args []) { TC<int, char> tc; return 0; } Thanks very ...

build website for mobile and pc with django

I am trying to develop a website for mobile and pc browser with django. and I am trying to figure out a best structure of the views and templates. there is what I have tried: 1) use different url ( like http://example.com/mobile/ and http://example.com/ OR http://example.com/?c=mobile ) to distinguish mobile and pc, and map them to d...

C++ static template member, one instance for each template type?

Hi, Usually static members/objects of one class are the same for each instance of the class having the static member/object. Anyways what about if the static object is part of a template class and also depends on the template argument? For example, like this: template<class T> class A{ public: static myObject<T> obj; } If I would c...

get first related object in template

Hay all, I'm having difficulty accessing the first related object within a template. I'm using {{ course.student_set.all[0].get() }} but its throwing loads of errors. How do i get the first related object? Thanks ...

C++ Templates queries

HI, I started learning C++ STL's i am just trying some small programs.one of them is below: inline int const& max (int const& a, int const& b) { return a < b ? b : a; } template <typename T> inline T const& max (T const& a, T const& b) { return a < b ? b : a; } int main() { ::max(7, 42); // calls the nontemplate...

${'foo %(a)s bar %(b)s' % {'a': '1', 'b': '2'}} syntax don't work in mako template

In mako template, I need to do something like that : ${'foo %(a)s bar %(b)s' % {'a': '1', 'b': '2'}} When A do that, I've this error : SyntaxException: (SyntaxError) unexpected EOF while parsing (, line 1) ("'foo %(a)s bar %(b)s' % {'a': '1', 'b': '2'") in file… Do you know a tip to fix this issue ? I need to use this syntax in t...