templates

Choosing the right template engine

Hi there, since today - I always used simple JSP Tags and JSTL which works but now I'm looking for a little bit more features and maybe more usability. With googling I've found Freemaker, Velocity and Tiles which seem to be very famous. Does someone of you has some further experiences with some of these and can give me a short brief ab...

How to create a Joomla template?

I am working on my first joomla template but there are certain things that are confusing me. I want the template to work as having three column layout in the home page and then there are two column layout pages in the website. Another page also has three column layout. So i was wondering how would I implement this runtime layout switchin...

Force template parameter to be a structure

Hello. I'm trying to do a base template class which parameter T must be a structure. When I use a variable declared as being of type T (both in the template class as in a class that extends it defining T) GCC fails to compile it: GCC error: invalid use of incomplete type ‘struct x' Despite it working on VC I understand that it d...

In Rails, how do you render JSON using a view?

Suppose you're in your users controller and you want to get a json response for a show request, it'd be nice if you could create a file in your views/users/ dir, named show.json and after your users#show action is completed, it renders the file. Currently you need to do something along the lines of: def show @user = User.find( params...

Overriding a templated Button's Command in WPF

I have a ControlTemplate that I'm using to change the appearance and behavior of several Buttons. I only want part of the Button to be clickable and to execute the bound Command, so I added a Button within the ControlTemplate and bound it to the template's Command property. The problem I'm having is that since I am defining the Command ...

What is correct way to initialize a static member of type 'T &' in a templated class?

I'm playing around with an eager-initializing generic singleton class. The idea is that you inherit publicly from the class like so: class foo : public singleton<foo> { }; I've learned a lot in the process but I'm stuck right now because it's breaking my Visual Studio 2008 linker. The problem is with the static instance member and/or ...

C++ syntax to call templated inner class static member function?

I have some template code which compiles fine in VC9 (Microsoft Visual C++ 2008) but won't compile in GCC 4.2 (on Mac). I'm wondering if there's some syntactical magic that I'm missing. Below I have a stripped-down example which demonstrates my error. Sorry if this example seems meaningless, I removed as much as I could to isolate thi...

How would I iterate through a list of [[tokens]] and replace them with textbox input?

Here is the basic code i'm trying to make work: Field fields[] = SalesLetter.class.getDeclaredFields(); String fieldName; for (int j = 0, m = fields.length; j < m; j++) { fieldName = fields[j].getName(); //example fieldname [[headline]] templateHTML = templateHTML.replace(fieldName, Letter.fieldName()); } I believe I'm ...

custom VC++ template not working, already gone thru MSDN

I am trying to create a C++ template for Visual Studio 2008 (Professional not Express), but all in vain. The template is really simple with only 2 files and no wizard. I've gone through the documentation over MSDN and various forums and I understand the semantics while creating a template, but don't know why this does not work. These are...

Using templates to make items of varying length stay on stack?

The situation is that I have an array of items, and the items have an array inside. However, I want to make the array inside of variable length at declaration time, yet resizable at compile time. So I would want something like: class2<16>[] = new class2<16>[2048*1024]; Or whatever. Hopefully you get the idea. Obviously making it hav...

UINavigationController template

When I open the new file dialog I see only 3 Cocoa Touch Classes: Objective-C class, Objective-C test case class, UIViewController subclass. When I last worked with Xcode, before I updated it, I remember there were more than 3 options, which included what I'm looking for: UINavigationController. So where can I find this template to crea...

Better C++ syntax for template base class typedefs and functions?

I have code that compiles fine with VC9 (Microsoft Visual C++ 2008 SP1) but not with GCC 4.2 (on Mac, if that matters). If I pile on enough qualifiers and keywords I can force it to work in GCC but this doesn't seem right. Here's a minimal code sample exhibiting my problems: template< typename N > struct B { typedef N n_type; ...

C++ syntax for explicit specialization of a template function in a template class?

I have code which works in VC9 (Microsoft Visual C++ 2008 SP1) but not in GCC 4.2 (on Mac): struct tag {}; template< typename T > struct C { template< typename Tag > void f( T ); // declaration only template<> inline void f< tag >( T ) {} // ERROR: explicit specialization in }; ...

Java Expression Language : Interpolation?

Greetings, In the webapplication I am developing , I want to do something like follows: I Have a Bean like class Gene{ String geneid; String sequence; .. } // EL expression (sometimes should be simple as "${geneid}" without URL pattern) String exp="<a> href='http://www.ncbi.nlm.nih.gov/pubmed?term=${geneid}' />"; String outputString=...

Defining custom hash function and equality function for unordered_map

I am trying to define a type of unordered_map that has a custom hash function and equality comparison function. The function prototypes of these functions are as follows: //set<Vertex3DXT*> is the type of the key; Cell3DXT* is the type of the value size_t VertexSetHashFunction(set<Vertex3DXT*> vertexSet); //hash function bool SetEqual(s...

Putting a ContentControl *inside* a WPF DataTemplate?

I have a custom Expander control called SpecialExpander. It is basically just a standard Expander with a fancy header and a couple properties (HeaderText and IsMarkedRead). I began by creating a simple class: public class SpecialExpander : Expander { public string HeaderText { get; set; } public bool IsMarkedRead { get; set; } ...

Object creation wrapper for a template class

Given a template class as such: template <typename TYPE> class SomeClass { public: typedef boost::intrusive_ptr<SomeClass<TYPE> > Client_t; inline Client_t GetClient() { return Client_t(this); } }; SomeClass is intended only to be used via pointer references returned by SomeClass::GetClient(). Which makes it natural to write a wr...

Magento Theming

Hello Experts, I am trying to develop a Megento theme and i am stuck at place. I am trying to put the Left side bar,in which I want to show category list in it. I am not getting the desired stuff in the left side bar in it. Please help me out.Guide me how can I get the desired thing in the left side bar! Treat me as a NewBee in megento...

Installing a custom project template with Visual Studio Installer project

Hi! I've created a custom project template, and now I need to deploy it together with my product (i.e., it should be installed by the same msi I use for the main installation). I'm using a Visual Studio Installer project. One option is to use a custom action and manually copy a template file included in the installation. Another is to c...

Vb.net print templates for printing strings

Are there any templates out there for formatting strings for printing like as in the following: Private Sub PrintDoc_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDoc.PrintPage e.Graphics.DrawString("String to be printed", New Font("arial", 10), Brushes.Black, 1, 200) ...