templates

winform - login form template

Hi folks, new to winform development. I am trying to add a 'login form' to my project in vs2008 but the template is missing. When i do 'add new item', i don't see 'login form'. However i do see mainform, aboutbox form templates. TIA ...

Why size_t arguments in template declaration need to be const?

I can have std::bitset< 10 > bitsetA; or const size_t LengthB = 20; std::bitset< LengthB > bitsetB; without any problem. But, if the length is not const size_t LengthC = 30; std::bitset< LengthC > bitsetC; // Line 30, say I face the following compilation error 'LengthC' cannot appear in a constant-expression template arg...

[C++] My First Go With Function Templates

Thought it was pretty straight forward. But I get a "iterator not dereferencable" errro when running the below code. What's wrong? template<typename T> struct SumsTo : public std::binary_function<T, T, bool> { int myInt; SumsTo(int a) { myInt = a; } bool operator()(const T& l, const T& r) { c...

Looking for an email/report templating engine with database backend - for end-users ...

We have a number of customers that we have to send monthly invoices too. Right now, I'm managing a codebase that does SQL queries against our customer database and billing database and places that data into emails - and sends it. I grow weary of maintaining this every time we want to include a new promotion or change our customer servic...

Where can I find the xcode template for opencv on iPhone ?

I want to use opencv frequently for iPhone development, so if there is existing xcode template , that will save me a lot time. Also for others who have same purpose. If not, I need to do it myself. Thanks for let me know if you know. ...

Rails - How can I detect if the content_for content was provided?

Hi - I want to detect if content was provided for content_for tag in my template, and if not fall back to default value: <title> <% if content_is_provided -%> <%= yield :title -%> <% else -%> 404 - Page Unknown <% end -%> </title> Any easy way to detect this? I tried <% if :title -%> but that didn't do much. thanks. ...

Using Subsonic 3.0 Advanced Templates

Hi all, I've been trying to use Subsonic Advanced Templates in a project for a while but most of the time I find myself writing a Stored Procedure as I can't find a proper way of doing it in code. Subsonic created corresponding objects for my DB tables and for foreign keys it created IQueryable fields inside each object. These fields a...

C++, generic programming and virtual functions. How do I get what I want?

This is what I would like to do using templates: struct op1 { virtual void Method1() = 0; } ... struct opN { virtual void MethodN() = 0; } struct test : op1, op2, op3, op4 { virtual void Method1(){/*do work1*/}; virtual void Method2(){/*do work2*/}; virtual void Method3(){/*do work3*/}; virtual void Method4(){/*...

How does the OpenGL ES template work for the iPhone?

So, I've been trying to figure out why the square is moving up and down the iPhone simulator when I Build and Run the template that Apple provides for OpenGL ES. I don't understand why for example they have ES1Render.m, and ES2Render.m instead of just one ESRender.m. Also, where is the equivalent of the glutDisplayFunc, and glutTimerFunc...

Using a type parameter and a pointer to the same type parameter in a function template

Hello, I've written a template function to determine the median of any vector or array of any type that can be sorted with sort. The function and a small test program are below: #include <algorithm> #include <vector> #include <iostream> using namespace::std; template <class T, class X> void median(T vec, size_t size, X& ret) { so...

Ambiguous access to base class template member function

In Visual Studio 2008, the compiler cannot resolve the call to SetCustomer in _tmain below and make it unambiguous: template <typename TConsumer> struct Producer { void SetConsumer(TConsumer* consumer) { consumer_ = consumer; } TConsumer* consumer_; }; struct AppleConsumer { }; struct MeatConsumer { }; struct ShillyShallyPro...

C++: how to declare template array as function parameter

Very similar to this post How can I declare template array as a parameter in templated function? Something like this code: template <unsigned i> void my_func (char (&a)[i]); //yes, I do need that reference ...

Remove never-run call to templated function, get allocation error on run-time

I have a piece of templated code that is never run, but is compiled. When I remove it, another part of my program breaks. First off, I'm a bit at a loss as to how to ask this question. So I'm going to try throwing lots of information at the problem. Ok, so, I went to completely redesign my test project for my experimental core librar...

Multiple SFINAE rules

Hi everyone, After reading the answer to this question, I learned that SFINAE can be used to choose between two functions based on whether the class has a certain member function. It's the equivalent of the following, just that each branch in the if statement is split into an overloaded function: template<typename T> void Func(T& arg)...

setting up 301 redirects: dynamic urls to static urls

We are currently using a template-based website and are hoping to move to a site with static urls. Our domain will stay the same. I understand that using 301 redirects in a .htaccess file is the preferred method -- and the one that has the highest chance of preserving our google rankings. I am still new at all this and am having a ha...

Display content in folder like Wordpress displays Themes

Hi, I’ve throughout the last couple of years downloaded a lot of templates for websites and these are now starting to become chaotic in the different folders so I’m starting to get a overview of the different templates. Regarding to this I was thinking about the way that WordPress displays the different themes installed in the themes f...

How to get Site Template Back?

Hi Everybody, I have saved a site as tempalte (i.e. MyMarketing.stp) and added to sharepoint server using stsadm addtemplate command and after few days lost MyMarketing.stp file. Now it is available for creating top level sites as well. I want to get this site template back as MyMarketing.stp file. Is it possible to extract it from the...

Comparison of web template engines

Post a snippet of code from your favorite templating engine, with the name of the engine and a link to its homepage; show off its basic syntax and maybe some neat features about it that makes it unique. Hopefully this will give people an idea of what's out there and make it easier for them to decide on an engine. ...

Accessing WPF Template for Custom Control from Code behind

Hi, i am trying to access a named grid inside a default template for a custom control from code behind. But it seems that the template for the control is null, even after calling ApplyTemplate(). Is that impossible inside the controls constuctor? Here's the code: Generic.xaml: ... <ControlTemplate TargetType="{x:Type local:TimeTableCon...

templates of functions

I'm told to create template of function , that will take 4 arguments : pointer reference pointer to array pointer to function How to perform this task ? I was trying : #include <iostream> using namespace std; int nothing(int a) { return a; } template<typename T> T func(int *L, int &M, char *K, int (*P)(int)) { cout << L <<...