templates

Binding a slider value on the height of its thumb in WPF

Hi, I have a databinding problem in WPF. I would like to "customise" a slider in a way that the thumb grows when you move the slider to the right and the thumb shrinks when you move the slider to the left. So I edited the template for the slider and changed the look of the slider so the slider looks like I want it to. But now I have ...

Why can I derived from a templated/generic class based on that type in C# / C++

Title probably doesn't make a lot of sense, so I'll start with some code: class Foo : public std::vector<Foo> { }; ... Foo f; f.push_back( Foo() ); Why is this allowed by the compiler? My brain is melting at this stage, so can anyone explain whether there are any reasons you would want to do this? Unfortunately I've just seen a sim...

c++ templates and inheritance

Hey, I'm experiencing some problems with breaking my code to reusable parts using templates and inheritance. I'd like to achieve that my tree class and avltree class use the same node class and that avltree class inherits some methods from the tree class and adds some specific ones. So I came up with the code below. Compiler throws an e...

Get Generated Code's File Path in Visual Studio?

When using code generation templates in visual studio, is it possible to get the current location of the .tt file when the 'custom tool' runs? Suppose my custom template lives in c:\projects\something\template.tt When it does its magic, is there a way to return the path above? <#=PathOfCurrentTTFile #> (so that PathOfCurrentTTFile =...

how to template a listview item / wpf

I am trying to achieve this using Expression Blend 3. I need that every listview item to contain an image, followed by a text. ItemTemplate doesn't seem to work. Thanks ...

Template debugging in C++

Hi All, I have a template class that is: template <class identifier,class registeredObject> class FxPairRegistry : public FxRegistry<pair<identifier,registeredObject> > { public: registeredObject GetEntry(identifier, FxBool assertValue = true); void RegisterInOrder(const pair<identifier,registeredObject> &ob); typedef typename ...

What's the difference between CArray<int, int> and CArray<int, int&> ?

Same for CMap, CList, and pretty much everything that uses templates (I guess). I find it a bit hard to understand when to use which. It's true that for classes and such, the <class, class&> form is usually what you want, but for basic types like int, float, etc., which form is preferred? ...

asp.net Web Template

I am trying to build a web site using asp.net, so since i an not very good on the design part. I am wondering where is the best site to get a good template for my web site. ...

'javadoc' look-a-like, using parser generator?

Hello all, I'm going to create a javadoc look-a-like for the language I'm mainly using, but I was wondering - is it worth to use a parser generator for this? The main idea to use a parser generator was because I could use templates for the HTML code which could be exported then. Also I could also use PDF templates if I need it. Thanks,...

dynamically set the control template

hi, i am using dictionaries in WPF. i have two bitmap image in it with name something like image1 and image2 now in forms, i like to set them to single image control depending on condition, some times image1 and sometimes image2. so how i set the source dynamically, in dictonary i have UriSource="/wpf1;component/images...

Can C++ Constructors be templates?

Hi, I have non-template class with a templatized constructor. This code compiles for me. But i remember that somewhere i have referred that constructors cannot be templates. Can someone explain whether this is a valid usage? typedef double Vector; //enum Method {A, B, C, D, E, F}; struct A {}; class Butcher { public: template <cla...

How to get MS Word templates directory for another user?

I'm using the following code to get the path where Word stores its templates: WordTemplatePath:=WordApp.Options.DefaultFilePath[$00000002]; The problem is that this returns the path for the actual, logged-in user. Is there a way to get the path for another user of the same Windows instance? I need it so my installer program can inst...

Alias for a C++ template?

typedef boost::interprocess::managed_shared_memory::segment_manager segment_manager_t; // Works fine, segment_manager is a class typedef boost::interprocess::adaptive_pool allocator_t; // Can't do this, adaptive_pool is a template The idea is that if I want to switch between boost interprocess' several different options for sh...

Adding meeting action points in MediaWiki and viewing them in another page

In the minutes of a meeting we want to be able to place action points in the text. Then we want easily to be able to print a list of action points, e.g. via another page. So the minutes will be: blah blah blah #AP1 ... blah blah blah #AP2... blah And then we want a list like this: #AP1 #AP2 How would we do this? Is there e.g. a s...

Binder and variadic template ends up in a segmentation fault

I wrote the following program #include <iostream> template<typename C, typename Res, typename... Args> class bind_class_t { private: Res (C::*f)(Args...); C *c; public: bind_class_t(Res (C::*f)(Args...), C* c) : f(f), c(c) { } Res operator() (Args... args) { return (c->*f)(args...); } }; template<typename C, typename Res,...

Function template overloading: link error

I'm trying to overload a "display" method as follows: template <typename T> void imShow(T* img, int ImgW, int ImgH); template <typename T1, typename T2> void imShow(T1* img1, T2* img2, int ImgW, int ImgH); I am then calling the template with unsigned char* im1 and char* im2: imShow(im1, im2, ImgW, ImgH); This compiles fine, but i g...

Trouble passing a template function as an argument to another function in C++

Source of the problem -Accelerated C++, problem 8-5 I've written a small program that examines lines of string input, and tallies the number of times a word appears on a given line. The following code accomplishes this: #include <map> #include <iostream> #include <string> #include <vector> #include <list> #include <cctype> #include <i...

HibernateTemplate alwaysUseNewSession

Hi, I had a problem where I was using the hibernate template to do most of my DB work but I had a part of the system that directly accessed the session to do batch persisting. I noticed that the hibernate template session was old and would be storing cached values which didnt take into account the objects save with the session directly. ...

std::basic_string full specialization (g++ conflict)

I am trying to define a full specialization of std::basic_string< char, char_traits<char>, allocator<char> > which is typedef'd (in g++) by the <string> header. The problem is, if I include <string> first, g++ sees the typedef as an instantiation of basic_string and gives me errors. If I do my specialization first then I have no issues...

How to execute LINQ TO SQL within a T4 Template?

Is it possible to execute a SQL (TSQL or Linq To SQL) from within a T4 Template so that the schema information from a table can be used to customized the code generation? Thanks ...