Search Results

Search found 6937 results on 278 pages for 'template'.

Page 4/278 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • WPF Template: AdornedElement not showing!

    - by Tau Sick
    I want to add some elements to a TextBox by using a Template with the extra elements and the original TextBox inserted in the right spot. I'm trying to use the AdornedElementPlaceholder just like you would do when making a Validation.ErrorTemplate But the AdornedElement is not showing up. I have simplified the example as much as possible: <TextBox Text="Border me with my Template"> <TextBox.Template> <ControlTemplate TargetType="{x:Type TextBox}"> <Border BorderBrush="Green" BorderThickness="1"> <AdornedElementPlaceholder/> </Border> </ControlTemplate> </TextBox.Template> </TextBox> The result is just a green box around the space that should be my textbox!

    Read the article

  • Strange Template error : error C2783: could not deduce template argument

    - by osum
    Hi, I have created a simple function with 2 diffrernt template arguments t1, t2 and return type t3. So far no compilation error. But when Itry to call the function from main, I encounter error C2783. I needed to know If the following code is legally ok? If not how is it fixed? please help! template <typename t1, typename t2, typename t3> t3 adder1 (t1 a , t2 b) { return int(a + b); }; int main() { int sum = adder1(1,6.0); // error C2783 could not deduce template argument for t3 return 0; }

    Read the article

  • Django template tag basic question

    - by ninja123
    It looks like this template tag works like a charm for most people: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/ For some reason I get this error: Caught an exception while rendering: 'is_paginated' I use this template tag in my template like so: {% load digg_paginator %} {% digg_paginator %} Where digg_paginator.py is in my app/templatetags folder and the included template context digg_paginator.html is in my app/templates folder. The queryset that needs pagination is called 'destinations'. If i just specify {% digg_paginator %}, how does it know what variable to paginate?? I feel I am missing something important here or just plain stupid :P Someone please help, or explain to me how this should be done. Thanks

    Read the article

  • AppEngine and Django: including a template file

    - by PythonPower
    As the title suggests, I'm using Google App Engine and Django. I have quite a bit of identical code across my templates and would like to reduce this by including template files. So, in my main application directory I have the python handler file, the main template, and the template I want to include in my main template. I would have thought that including {% include "fileToInclude.html" %} would work on its own but that simply doesn't include anything. I assume I have to set something up, maybe using TEMPLATE_DIRS, but can't figure it out on my own. EDIT: I've tried: TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'), ) But to no avail. I'll try some other possibilities too.

    Read the article

  • Passing template into boost function

    - by Ockonal
    template <class EventType> class IEvent; class IEventable; typedef boost::function<void (IEventable&, IEvent&)> behaviorRef; What is the right way for passing template class IEvent into boost function? With this code I get: error: functional cast expression list treated as compound expression error: template argument 1 is invalid error: invalid type in declaration before ‘;’ token

    Read the article

  • Using a site page to find out the web Template Name used in a SharePoint Site

    - by ybbest
    Today, I have created a SharePoint solution. It deploys a site page with code behind to show the web template name used in a SharePoint site. You can download the project from here. After you have deployed the project, you can see your template name from http://[site collection Name]/sitepage/WebTemplateInfo.aspx References: http://blogs.msdn.com/b/kaevans/archive/2010/06/28/creating-a-sharepoint-site-page-with-code-behind-using-visual-studio-2010.aspx http://www.devexpertise.com/2009/02/06/sharepoint-list-template-ids-and-site-template-ids/ http://blog.rafelo.com/2008/05/determining-site-template-used-on.html

    Read the article

  • Architecture for a template-building, WYSIWIG application

    - by Sam Selikoff
    I'm building a WYSIWYG designer in Ember.js. The designer will allow users to create campaigns - think MailChimp. To build a campaign, users will choose an existing template. The template will have a defined layout. The user will then be taken to the designer, where he will be able to edit the text and style, and additionally change some layout options. I've been thinking about how best to go about structuring this app, and there are a few hurdles. Specifically, the output of the campaign will be dynamic: eventually, it will be published somewhere, and when the consumers (not my users, but the people clicking on the campaign that my user created) visit the campaign, certain pieces of data will change, depending on the type of consumer viewing the campaign. That means the ultimate output of the designer will be a dynamic site. The data that is dynamic for this site - the end product - will not be manipulated by the user in the designer. However, the data that will be manipulated by the user in the designer are things like copy, styles, layout options, etc. I'll call the first set of variables server-side data, and the second client-side data. It seems, then, that the process will go something like this: I'll need to create templates for this designer that have two dynamic segments. For instance, the server-side data could be Liquid expressions, and the client-side data Handlebars expressions. When the user creates a campaign, I would compile the template on the back end using some dummy data for the server-side variables, and serve up a handlebars template to the Ember app. The user would then edit the template, and the Ember app would save all his edits to the JS variables that were powering the template. This way he'd be able to preview the template. When he saves, he'll send back the selected template, along with all the data and options he's made. When it comes time to publish, the back-end system will have to do two things: compile the template with Handlebars using the campaign data, and then compile the template with Liquid using the server-side data Is my thinking roughly accurate about this, or is there a simpler way?

    Read the article

  • Linking a template class using another template class (error LNK2001)

    - by Luís Guilherme
    I implemented the "Strategy" design pattern using an Abstract template class, and two subclasses. Goes like this: template <class T> class Neighbourhood { public: virtual void alter(std::vector<T>& array, int i1, int i2) = 0; }; and template <class T> class Swap : public Neighbourhood<T> { public: virtual void alter(std::vector<T>& array, int i1, int i2); }; There's another subclass, just like this one, and alter is implemented in the cpp file. Ok, fine! Now I declare another method, in another class (including neighbourhood header file, of course), like this: void lSearch(/*parameters*/, Neighbourhood<LotSolutionInformation> nhood); It compiles fine and cleanly. When starting to link, I get the following error: 1>SolverFV.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall lsc::Neighbourhood<class LotSolutionInformation>::alter(class std::vector<class LotSolutionInformation,class std::allocator<class LotSolutionInformation> > &,int,int)" (?alter@?$Neighbourhood@VLotSolutionInformation@@@lsc@@UAEXAAV?$vector@VLotSolutionInformation@@V?$allocator@VLotSolutionInformation@@@std@@@std@@HH@Z)

    Read the article

  • Specializating a template function that takes a universal reference parameter

    - by David Stone
    How do I specialize a template function that takes a universal reference parameter? foo.hpp: template<typename T> void foo(T && t) // universal reference parameter foo.cpp template<> void foo<Class>(Class && class) { // do something complicated } Here, Class is no longer a deduced type and thus is Class exactly; it cannot possibly be Class &, so reference collapsing rules will not help me here. I could perhaps create another specialization that takes a Class & parameter (I'm not sure), but that implies duplicating all of the code contained within foo for every possible combination of rvalue / lvalue references for all parameters, which is what universal references are supposed to avoid. Is there some way to accomplish this? To be more specific about my problem in case there is a better way to solve it: I have a program that can connect to multiple game servers, and each server, for the most part, calls everything by the same name. However, they have slightly different versions for a few things. There are a few different categories that these things can be: a move, an item, etc. I have written a generic sort of "move string to move enum" set of functions for internal code to call, and my server interface code has similar functions. However, some servers have their own internal ID that they communicate with, some use strings, and some use both in different situations. Now what I want to do is make this a little more generic. I want to be able to call something like ServerNamespace::server_cast<Destination>(source). This would allow me to cast from a Move to a std::string or ServerMoveID. Internally, I may need to make a copy (or move from) because some servers require that I keep a history of messages sent. Universal references seem to be the obvious solution to this problem. The header file I'm thinking of right now would expose simply this: namespace ServerNamespace { template<typename Destination, typename Source> Destination server_cast(Source && source); } And the implementation file would define all legal conversions as template specializations.

    Read the article

  • entity framework POCO template in a n-tiers design question

    - by bryan
    HI all I was trying to follow the POCO Template walkthrough . And now I am having problems using it in n-tiers design. By following the article, I put my edmx model, and the template generated context.tt in my DAL project, and moved the generated model.tt entity classes to my Business Logic layer (BLL) project. By doing this, I could use those entities inside my BLL without referencing the DAL, I guess that is the idea of PI; without knowing anything about the data source. Now, I want to extend the entities (inside the model.tt) to perform some CUD action in the BLL project,so I added a new partial class same name as the one generated from template, public partial class Company { public static IEnumerable AllCompanies() { using(var context = new Entities()){ var q = from p in context.Companies select p; return q.ToList(); } } } however visual studio won't let me do that, and I think it was because the context.tt is in the DAL project, and the BLL project could not add a reference to the DAL project as DAL has already reference to the BLL. So I tried to added this class to the DAL and it compiled, but intelisense won't show up the BLL.Company.AllCompanies() in my web service method from my webservice project which has reference to my BLL project. What should I do now? I want to add CUD methods to the template generated entities in my BLL project, and call them in my web services from another project. I have been looking for this answer a few days already, and I really need some guides from here please. Bryan

    Read the article

  • Loading velocity template inside a jar file

    - by Rafael
    I have a project where I want to load a velocity template to complete it with parameters. The whole application is packaged as a jar file. What I initially thought of doing was this: VelocityEngine ve = new VelocityEngine(); URL url = this.getClass().getResource("/templates/"); File file = new File(url.getFile()); ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, file.getAbsolutePath()); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, "true"); ve.init(); VelocityContext context = new VelocityContext(); if (properties != null) { stringfyNulls(properties); for (Map.Entry<String, Object> property : properties.entrySet()) { context.put(property.getKey(), property.getValue()); } } final String templatePath = templateName + ".vm"; Template template = ve.getTemplate(templatePath, "UTF-8"); String outFileName = File.createTempFile("p2d_report", ".html").getAbsolutePath(); BufferedWriter writer = new BufferedWriter(new FileWriter(new File(outFileName))); template.merge(context, writer); writer.flush(); writer.close(); And this works fine when I run it in eclipse. However, once I package the program and try to run it using the command line I get an error because the file could not be found. I imagine the problem is in this line: ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, file.getAbsolutePath()); Because in a jar the absolute file does not exist, since it's inside a zip, but I couldn't yet find a better way to do it. Anyone has any ideas?

    Read the article

  • Partial template specialization for more than one typename

    - by Matt Joiner
    In the following code, I want to consider functions (Ops) that have void return to instead be considered to return true. The type Retval, and the return value of Op are always matching. I'm not able to discriminate using the type traits shown here, and attempts to create a partial template specialization based on Retval have failed due the presence of the other template variables, Op and Args. How do I specialize only some variables in a template specialization without getting errors? Is there any other way to alter behaviour based on the return type of Op? template <typename Retval, typename Op, typename... Args> Retval single_op_wrapper( Retval const failval, char const *const opname, Op const op, Cpfs &cpfs, Args... args) { try { CallContext callctx(cpfs, opname); Retval retval; if (std::is_same<bool, Retval>::value) { (callctx.*op)(args...); retval = true; } else { retval = (callctx.*op)(args...); } assert(retval != failval); callctx.commit(cpfs); return retval; } catch (CpfsError const &exc) { cpfs_errno_set(exc.fserrno); LOGF(Info, "Failed with %s", cpfs_errno_str(exc.fserrno)); } return failval; }

    Read the article

  • virtual methods and template classes

    - by soxs060389
    Hi I got over a problem, I think a very specific one. I've got 2 classes, a B aseclass and a D erived class (from B aseclass). B is a template class ( or class template) and has a pure virtual method virutal void work(const T &dummy) = 0; The D erived class is supposed to reimplement this, but as D is Derived from B rather than D being another template class, the compiler spits at me that virtual functions and templates don't work at once. Any ideas how to acomplish what I want? I am thankfull for any thoughts and Ideas, especially if you allready worked out that problem this class is fixed aka AS IS, I can not edit this without breaking existing code base template <typename T> class B { public: ... virtual void work(const T &dummy) = 0; .. }; take int* as an example class D : public B<int*>{ ... virtual void work(const int* &dummy){ /* put work code here */ } .. }; Edit: The compiler tells me, that void B<T>::work(const T&) [with T = int*] is pure virtual within D

    Read the article

  • C++ creating generic template function specialisations

    - by Fire Lancer
    I know how to specialise a template function, however what I want to do here is specialise a function for all types which have a given method, eg: template<typename T> void foo(){...} template<typename T, if_exists(T::bar)>void foo(){...}//always use this one if the method T::bar exists T::bar in my classes is static and has different return types. I tried doing this by having an empty base class ("class HasBar{};") for my classes to derive from and using boost::enable_if with boost::is_base_of on my "specialised" version. However the problem then is that for classes that do have bar, the compiler cant resolve which one to use :(. template<typename T> typename boost::enable_if<boost::is_base_of(HasBar, T>, void>::type f() {...} I know that I could use boost::disable_if on the "normal" version, however I do not control the normal version (its provided by a third party library and its expected for specialisations to be made, I just don't really want to make explicit specialisations for my 20 or so classes), nor do I have that much control over the code using these functions, just the classes implementing T::bar and the function that uses it. Is there some way to tell the compiler to "always use this version if possible no matter what" without altering the other versions?

    Read the article

  • typedef of a template with a template type as its parameter

    - by bryan sammon
    Im having a problem with a typedef below, I can seem to get it right: template <typename T> struct myclass1 { static const int member1 = T::GetSomeInt(); }; template <int I> struct myclass2 { typedef myclass1< myclass2<I> > anotherclass; static int GetSomeInt(); }; anotherclass MyObj1; // ERROR here not instantiating the class When I try and initialize a anotherclass object, it gives me an error. Any idea what I am doing wrong? There seems to be a problem with my typedef. Any help is appreciated, Thanks Bryan

    Read the article

  • Django Custom Template Tages: Inclusion Tags

    - by Harry
    Hello world! Im trieng to build my own template tags Im have no idea why I get the errors I get, im following the django doc's. this is my file structure of my app: pollquiz/ __init__.py show_pollquiz.html showpollquiz.py This is showpollquiz.py: from django import template from pollquiz.models import PollQuiz, Choice register = template.Library() @register.inclusion_tag('show_pollquiz.html') def show_poll(): poll = Choice.objects.all() return { 'poll' : poll } html file: <ul> {% for poll in poll <li>{{ poll.pollquiz }}</li> {% endfor </ul> in my base.html file im am including like this {% load showpollquiz %} and {% poll_quiz %} Bu then I get the the error: Exception Value: Caught an exception while rendering: show_pollquiz.html I have no idea why this happens. Any ideas? Please keep in mind Im still new to Django

    Read the article

  • C++ template partial specialization error

    - by JP19
    Hi, The following code is giving me a compilation error: class Q64 is not a valid type for a template constant parameter template<int GRIDD, class T> INLINE T grid_residue(T amount) { T rem = amount%(GRIDD); if (rem > GRIDD/2) rem -= GRIDD; return rem; } template<int GRIDD, Q64> INLINE Q64 grid_residue(Q64 amount) { return Q64(grid_residue<GRIDD, int64_t>(to_int(amount))); } Whats wrong? I am trying to specialize grid_residue for class Q64. thanks

    Read the article

  • Symfony/Doctrine: Unserialize in action vs template

    - by Tom
    Hi, Can anyone tell me why calling "unserialize" works fine in an action but gives an offset error in a template? It's basically possible to unserialize a database text result into a variable in an action and pass it to template, in which case it displays fine: $this->clean = unserialize($this->raw); <?php echo $clean ?> But not if called directly in a template: <?php echo unserialize($raw) ?> Would be interested in knowing why this is so and whether there's some workaround. Thanks.

    Read the article

  • const return value and template instantiation

    - by Rimo
    From Herb Sutter's GotW #6 Return-by-value should normally be const for non-builtin return types. .... Note: Lakos (pg. 618) argues against returning const value, and notes that it is redundant for builtins anyway (for example, returning "const int"), which he notes may interfere with template instantiation. .... While Sutter seems to disagree on whether to return a const value or non-const value when returning an object of a non-built type by value with Lakos, he generally agrees that returning a const value of a built-in type (e.g const int) is not a good idea. While I understand why that is useless because the return value cannot be modified as it is an rvalue, I cannot find an example of how that might interfere with template instantiation. Please give me an example of how having a const qualifier for a return type might interfere with template instantiation.

    Read the article

  • Accessing WPF Template for Custom Control from Code behind

    - by Ashwani Mehlem
    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:TimeTableControl}"> <Grid Name="ContentGrid"> </Grid> </ControlTemplate> ... TimeTableControl.cs: public TimeTableControl() { ApplyTemplate(); contentGrid = (Grid)(Template.FindName("ContentGrid", this)); //Line above causes null-pointer-exception ... }

    Read the article

  • Function template overloading: link error

    - by matt
    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 get a link error "unresolved external symbol" for: imShow<unsigned char,char>(unsigned char *,char *,int,int) I don't understand what I did wrong!

    Read the article

  • c++ defining a static member of a template class with type inner class pointer

    - by Jack
    I have a template class like here (in a header) with a inner class and a static member of type pointer to inner class template <class t> class outer { class inner { int a; }; static inner *m; }; template <class t> outer <t>::inner *outer <t>::m; when i want to define that static member i says "error: expected constructor, destructor, or type conversion before '*' token" on the last line (mingw32-g++ 3.4.5)

    Read the article

  • Detect template presence at compilation time

    - by doublep
    GCC up to 4.5 doesn't have standard C++0x type trait template has_nothrow_move_constructor. I could use it in my package for optimization, but I don't want to rule out one of the common compilers and don't want to overload configuration with symbols like HAVE_STD_HAS_NOTHROW_MOVE_CONSTRUCTOR. Is it somehow possible to use that template if present and just fall back to copying if not present without using any predefined configuration symbols? I also don't want to depend on Boost, since my library is small and doesn't need Boost for any other reasons. In pseudocode, I need something like: template <typename type> struct has_nothrow_move_constructor_robust : public integral_constant <bool, /* if possible */ has_nothrow_move_constructor <type>::value /* otherwise */ false> { }; Since move constructors are only for C++0x anyway, I don't mind using other C++0x features for the above definition, if at all possible.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >