templates

ASP.NET Site Templates

Are there any good ASP.NET site templates out there? I am looking for something with some very basic features: Reusable layout Navigation already built in Admin Section Login Page I was going to build a template that meets my needs exactly, but thought I would scour around a bit first. If I don't find something that does what I ne...

is there a better way to select correct method overload?

Is this really the only way to get the correct address for an instance function: typedef CBitmap * (CDC::* SelectObjectBitmap)(CBitmap*); SelectObjectBitmap pmf = (SelectObjectBitmap)&CDC::SelectObject; First, one has to create a typedef, and then one has to use that to force the compiler to select the correct overloaded method when t...

Dynamic form field generation in Django templates

I am having a problem figuring out how to solve this problem the Django and (probably) the Python way. I am sending a hash to a template that contains the following values {'date': '2009-12-30', 'locations': [{u'lat': 43.514000000000003, u'lng': -79.844032999999996, u'place': u'1053 Bowring Cres, Milton, ON L9T, CA', u'description': u'...

Template deduction and function pointers

How does the compiler know the correct type for this code: class Base { protected: typedef View * ViewType; typedef boost::function<ViewType ()> ActionType; typedef boost::unordered_map<std::string, ActionType> ActionMapType; ActionMapType actions; template <class ControllerType> inline void addAction(std::st...

SFINAE canAdd template problem

I'm trying tow write a SFINAE template to determine whether two classes can be added together. This is mostly to better understand how SFINAE works, rather than for any particular "real world" reason. So what I've come up with is #include <assert.h> struct Vec { Vec operator+(Vec v ); }; template<typename T1, typename T2> struct Ca...

Anybody know how to customise some ilance template?

I Need some tutorial how to customize a ilance template. I found some pdf tutorial : http://www.ilance.com/forum/showthread.php?t=6782 (but my account has disabled) Somebody can help me? ...

Change wordpress navbar to link straight to post or page

The template I am using is techified and I would like to change the navbar to link directly to the post, not the category as it does now. Here is the code for header.php. I'm assuming this would be where the change would be made. <div id="navigation_area"> <ul id="nav"> <?php wp_list_categories('exclude=1&hide_empty=0&orderby=name&show...

accessing Spring MVC DI beans from jsp

Im bit confused so be patient if im trying to do something wrong : -) In some MVC frameworks you can call controller action from the view if you whish to execute some code and render some partial view. Im not sure what is the correct way to do it in Spring MV I want to have set of JSP templates. Some of them will be page layouts some o...

How do I edit the Visual Studio templates for new C# class/interface?

I find myself removing the following import statements in nearly every C# file I create Visual Studio: using System.Collections.Generic; using System.Linq; using System.Text; Of course its really easy to do this with Resharper, but I really should not have to. There must be a few template (class, interface) somewhere in the VS direct...

C# Dynamic template implicit conversion error from System.EventHandler to System.EventHandler<TEventArgs>

Code: public void InstantiateIn(System.Web.UI.Control container) { PlaceHolder ph = new PlaceHolder(); SectionArgs e = new SectionArgs(); ph.DataBinding += new EventHandler<SectionArgs>(ItemTemplate_DataBinding); container.Controls.Add(ph); } static void ItemTemplate_DataBinding(object s...

How to tell Wordpress category page to call specific sidebar

I am trying to pull in a styled sidebar specific to the category. I have the following code which works, but it is pulling in BOTH my new sidebar and the default. What am I doing wrong here? From category.php <?php get_sidebar(); if ( in_category('39') ) { include(TEMPLATEPATH . '/sidebar2.php'); } else { include(TEMPLATEPATH . '/side...

Controlling Display of Methods In Template

I have the following in a view (foreign key relationships via _set): srvr = Server.objects.get(name=q) return render_to_response('search_results.html', {'drv': srvr.drive_set.all(), 'memry': srvr.memory_set.all(), 'query': q}) The results template includes: {% if drv %} <table> <tr> <td>{{ drv }}</td> </tr> </tabl...

Semantic checking of default template parameters

On page 340 of the C++ Programming Language: Special Edition, Stroustrup writes... The semantic checking of a default argument for a template parameter is done if and (only) when that default argument is actually used. In particular, as long as we refrain from using the default template argument Cmp<T> we can compare() strings of a type...

friend function in template definition

My question ist related a bit to this one. I want to overload the operator << for some class and I found two different notations that both work: template <class T> class A{ T t; public: A(T init) : t(init){} friend ostream& operator<< <> (ostream &os, const A<T> &a); //need forward declaration //template <class U> friend ostrea...

When to use JavaScript template engines?

Here is an example of JavaScript template from Ben Nadel's demo single page long-lived AJAX application taken from: [source] <script id="contact-list-item-template" type="application/template"> <li class="contact clear-fix"> <div class="summary"> <a class="name">${name}</a> </div> ...

C++ Templates - LinkedList

Hello, EDIT -- Answered below, missed the angled braces. Thanks all. I have been attempting to write a rudimentary singly linked list, which I can use in other programs. I wish it to be able to work with built-in and user defined types, meaning it must be templated. Due to this my node must also be templated, as I do not know the info...

Looking for a good technique for storing email templates

Hello, I am building a site in which we are making moderate use of email templates. As in, HTML templates which we pass tokens into like {UserName}, {Email}, {NameFirst}, etc. I am struggling with where to store these, as far as best practice goes. I'll first show the approach I took, and I'd be really excited to hear some expert persp...

In a C++ template function can I return a dereferenced argument type ?

What I mean is the following. I want a template function that takes two vector iterators (or two pointers to array of double) and returns a double that is somehow related to the vector iterators or array pointers that I pass. However, I want this to work for double or int, or any arithmetic type. I think I'm not allowed to say: templat...

Template parameters dilemma

I have a dilemma. Suppose I have a template class: template <typename ValueT> class Array { public: typedef ValueT ValueType; ValueType& GetValue() { ... } }; Now I want to define a function that receives a reference to the class and calls the function GetValue(). I usually consider the following two ways: Met...

Django template tag + template with user.is_authenticated doesn't work

Hi all, I have a strange problem, in my settings file everything is enabled that needs to be enabled for user.is_authenticated use in a template. I have the following template tag code: from django import template from progmatic.cms.models import navigation, navigation_item from django.template.defaultfilters import slugify from djang...