templates

Setting up Subsonic 3.0 on a ASP.NET web application on Visual Studio 2008

I followed the steps on this tutorial video by at subsonic website. Everything seems to be self explanatory but when I copy the .tt files into my Visual Studio nothing happens. I have read other question relating to this problem on this website but they don't seem to fix this problem. I also went into the regedit to find out the gener...

How to understand the result of output with C++ templates.

I wrote a judgment code of even/odd numbers with C++ templates. #include <iostream> template <int N, int Mod2=N%2> struct Print { Print() { std::cout << N << std::endl; } }; template <int N> struct Print<N, 0> { Print() { std::cout << "Even!" << std::endl; } }; template <int N> struct Print<N, 1> { Print() { std...

STL iterator - why is the code analysis tool complaining?

I'm checking the results from the static code analysis tool Klocwork. It complains about the following code: 293 for( my_vector_typedef::iterator it( start_pos ); it != end_pos ; ++it ){ 294 delete *it; 295 } With the following message: Object 'it._M_current' is used after it was freed. Object 'it._M_current' was used at line 293 ...

c++ templated container scanner.

Hello, here's today's dilemma: suppose I've class A{ public: virtual void doit() = 0; } then various subclasses of A, all implementing their good doit method. Now suppose I want to write a function that takes two iterators (one at the beginning of a sequence, the other at the end). The sequence is a sequence of A subclasses lik...

How can a template function 'know' the size of the array given as template argument?

Hi all, In the C++ code below, the templated Check function gives an output that is not what I would like: it's 1 instead of 3. I suspect that K is mapped to int*, not to int[3] (is that a type?). I would like it to give me the same output than the second (non templated) function, to which I explicitly give the size of the array... Sh...

template class with overridden operators

I want to add a operator override to perform assignments/__set__s inline. Template :- class CBase { public : static void SetupVmeInterface(CVmeInterface *in); protected : static CVmeInterface *pVmeInterface; }; template <class T> class TCVmeAccess : public CBase { public: TCVmeAccess(int address);...

How to add asyncPostBackTrigger to Template column, Item Template, Button in DataGrid

I need to add a trigger for two buttons in DataGrid Template columns. I have found a couple postings saying to put the code in the code-behind using the UniqueID. Something isn't right with my logic (or maybe it isn't in the right place). I am getting "Object reference not set to an instance of an object" error when I run it. I am g...

C++ template gotchas

just now I had to dig through the website to find out why template class template member function was giving syntax errors: template<class C> class F00 { template<typename T> bar(); }; ... Foo<C> f; f.bar<T>(); // syntax error here I now realize that template brackets are treated as relational operators. To do what was intended th...

Template class method collides with overloaded method.

Hi, I have a template class in C++ (somewhat simplified): template<typename T> struct C { T member; void set(const &T x) { member = x; } void set(int x) { member = x; } }; As you can see the set() function can be called either with the type T, or with an int. This works fine unless T is an int, in which case I get an ambiguous c...

What's the best way to resize an FLV without lowering the video quality?

I'm making a flash site. And there's a video playing, and it moves around and changes size as the user navigates around the page. I notice when it gets small, the video quality gets bad on it. Any ideas on how to retain its quality, and resize it in a different way? To note: The video quality was bad when the css for the flash video was...

JSP template implementation (Composite View Pattern)

What is the best way to implement the Composite View Pattern for a Java website? My idea was to take one jsp and include multiple pages like: <h1>Layout Start</h1> <% Values values = DataHandler.getValues(request); LayoutHelper layout = values.getLayout(); out.println("Layout.getContent(): " + layout.getContent()); %> <jsp:include pag...

Issues with C++ template arguments for inheritance

Dear developers, I have a questions about C++ templates. More specifally, by using template arguments for inheritance. I am facing strange behaviour in a closed-source 3rd party library. There is a C method factoryReg(const char*, ICallback*) which allows to register a subclass of ICallback and overwrite the (simplified) methods: cl...

Passing a pointer to a member function as a template argument. Why does this work?

I have some code that 100% works for the use case I have. I'm just wondering if anyone can explain how and why it works. I have a template class that sits between some code that handles threading and network communication and the library user to pass data received from the server to the user. template <class Bar, class Baz...

Parse PHP code on the fly and store it in a temp var

Hello all, I'm creating my own templatesystem because I only need a few little operations to be supported. One of them is loading widgets with dynamic data generated from a database in my template. Is there a way to parse PHP code, don't display the result but store it in a variable and then use the generated source from that variable...

T4 Templates and TextTemplatingFileGenerator

All the sudded T4 Templates stopped working on my machine. I get this error The custom tool 'TextTemplatingFileGenerator' failed. Specified cast is not valid. I tried to repair Visual Studio but no luck. Note I am running 64bit machine but 32bit Visual Studio 2008. What is odd is it worked great for some time then all the sudden s...

Inherit from a template parameter and upcasting back in c++

Hello, I have tried to use this code in VS2008 (and may have included too much context in the sample...): class Base { public: void Prepare() { Init(); CreateSelectStatement(); // then open a recordset } void GetNext() { /* retrieve next record */ } private: virtual void Init() = 0; virtu...

WPF - Catch a CLR event in A Style template

I have a style for a ListBox. In the listbox style I have a style for the ListBoxItems. All of this is in the section. I want to catch the IsEnabledChanged event for the Listbox Items (see this question for why). I tried setting up an EventSetter, but it can't see the event because it is not a "routed event". How can I attach an ev...

Conditional statements in Eclipse templates

Eclipse templates can automatically insert text and variables as you are coding. When variables are used with the ${variable} form, the value is inserted automatically. My question is whether you can add sections to these templates conditionally. Can you have a method definition template that will fill in multiple variables and add loca...

SharePoint ASP.NET Mock Site

Does any one know if there is a ASP.NET website available that is a pretty good clone of the style and layout of a SharePoint site? I don't need the functionality of SharePoint, I would like to be able to quickly mock up some controls for SharePoint, with out having to actually deploy stuff to the server, and want to be able to see what...

[PHP] Functions returning strings from other files

I want to make a really simple template engine for my site, to make it easier to add new pages and edit other ones. I have a template.php file and a variable of $pageHeader. Then in my functions.php file I have a function called CallHeader() with this code: function CallHeader() { echo $pageHeader; } The problem is this does not...