templates

Extract a WPF content template of a running WPF application

Hey guys, is there a way of extracting a content template of a WPF control which is hosted in a running WPF application? Just the same way as I am able to dig through the visual tree of any WPF application with tools like Snoop I'd like to be able to extract the Content Template. I have asked Google already. But either my keywords wer...

C++ restrict implicit construct to specific value

hello Suppose: struct P { P(int v); }; int v; P p = 0; // allow P q = v; // Fail at compile time How can achieve that? any template trick? I am trying to write allocator which has special pointer properties. unfortunately std implementation uses implicit conversion from int to NULL pointer: { return __n != 0 ? _M_impl.allocat...

Embed a music player on email

Hi, I'm creating html to send by email, and i want to put a music player like SoundCloud, I recieve an email who include that. <object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1627309%3Fsecret_token%3Ds-B1hMj&amp;secret_url=false"&gt;&lt;...

C++0x template function object inference

I'm a Scala/Java programmer looking to reintroduce myself to C++ and learn some of the exciting features in C++0x. I wanted to start by designing my own slightly functional collections library, based on Scala's collections, so that I could get a solid understanding of templates. The problem I'm running into is that the compiler doesn't s...

Templates :Name resolution:Point of instantiation: -->can any one tell some more examples for this statement?

This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template, if the specialization is implicitly instantiated because it is referenced...

Templates :Name resolution:Point of instantiation: -->can any one tell some more examples for this statement?

This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation 4.If a virtual function is implicitly instantiated, its point of instantiation is immediately following the point of instantiation of its enclosing class template specialization. 5.An explicit instantiation directive is an instantiation point for the ...

How to use a lambda expression as a template parameter?

How to use lambda expression as a template parameter? E.g. as a comparison class initializing a std::set. The following solution should work, as lambda expression merely creates an anonymous struct, which should be appropriate as a template parameter. However, a lot of errors are spawned. Code example: struct A {int x; int y;}; std::s...

How do I reset MS Word toolbar button state on new document

I have a request from a User Group to implement the following: Introduce a set of templates that have some Hidden Text on the page as instructions Display the Hidden Text the first time a document is created using the templates Introduce a custom button to toggle the Hidden Text display 1) The templates are now created. Manual t...

How to insert a pair of std::pair inside another std::pair?

I'm declaring a map of string to a pair of pairs as follow: std::map<std::wstring, std::pair<std::pair<long, long>, std::pair<long, long>>> reference; And I initialize it as: reference.insert(L"First", std::pair<std::pair<long, long>, std::pair<long, long>>(s...

(C++) Extending vector iterator to fill my needs.

Hi everoby, I have the following design in one of my projects: template<typename C> class B { int numValue; C inner; } template<typename C> class A { vector<B<C>> container; ... Iterator InsertItem(C item) {...} } What I want is a way to modify the existing vector iterator to return an Iterator which will retu...

Templated method with overloaded name

To be consistent with other classes in a library, my array class below has two read() methods. The first reads the entire array to an output iterator and returns an error code, the second reads a single value and returns that (using exceptions for errors). The problem I have is that if I call the second read(size_t idx) method with an ...

Default type parameter error in template code

1)template <class T = int, class U = double> //compiles 2)template <class T, class U =double> //compiles 3)template <class T = int, class U> //fails Why does 1 and 2 compile whereas 3 does not? ...

How do you access the menu model from a Zotonic template?

I want to write my own style of menu, but I would prefer to do it in the templates rather than making my own menu scomp. I basically want to be able to do something like: {% if m.menu %} <ul> {% for top_level_id in m.menu %} {% with m.rsc[top_level_id] as top_level %} <li><a href="{{ top_level.page_url }}">{{ top_level.ti...

How to deal with Camel Case for Eclipse Templates?

I'm trying to write an Eclipse template which will create getters and setters when I create an attribute. My current template works, except for the camel casing for the getters and setters. private ${type} ${field}; private ${type} get${field}() {return ${field};} private void set${field}(${type} ${field}) {this.${field} =...

C++ metaprogramming question

Hello! I have the following problem: Suppose I have some basic counter class Counter. And suppose we also have some sets of classes, that can be counted. Let's name some of them class CountedA and class CountedB. Now, every class, which can be counted (such as CountedA and CountedB) has the following statically declared parts: one enu...

Can't complie Three20 template on iOS4

I pulled the latest version of three20 from github, and installed their template. I opened it up in XCode, build and run, then I realize the template isn't iOS4 ready. The first issue I found was "Base SDK not found", I solve it Edit Project Setting , changed the Base SDK to "iOS Device 4.1" Then I run it again, I got tons of errors r...

What does it take to make a CMS template work on a normal website

A PHP content management system usually has its own template engine be it smarty or some other custom template engine specific for that CMS. How might I possibly get a CMS theme to work on a normal PHP website without converting the website to a website powered by that CMS? Can I "teach" the website to use the template engine of a cont...

Magento: Adding filterable attribute list to template file

I have a Men and Women store setup under the same website in Magento. The Men website runs off of the Men category and the Women site off of the Women category. I have a filterable custom attribute setup entitled 'designer'. Currently, the layered navigation on a category page shows the Designer attribute for the products in that store a...

Modify or 'tweak' an existing TreeViewItem control template?

Ok... this is sort of a two-parter here. (Sort of. May actually just be one. That's what I'm hoping anyway.) First, more generally, is it possible to target, via XAML only, a named item in a control's template? For instance, if a control's template has a ContentPresenter named 'PART_Foo' and we want to specifically set the Horizonta...

Operator error in template

I am trying to create a "value" template class, where additional properties can be assign to it easily. Properties are stored in std::map<std::string, std::string>, and operator[] has been overloaded to provide quick access to them. #if ! defined __VALUE_H__ #define __VALUE_H__ #include <string> #include <map> namespace Algorithm { ...