Search Results

Search found 3563 results on 143 pages for 'templates'.

Page 21/143 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Binding In Binding with Templates(WPF)

    - by AKRamkumar
    I have a WPF UI Bound to a collection of AwesomeClass Now, AwesomeClass has a collection of AwesomeParts objects. How can I make my UI In such a way that (as an example) for each AwesomeClass instance, there is a Tab on a tab panel and then for each awesome part in that, there is an object on a listbox, on that tab. Basically: Awesomes-Tabs And Then : Awesome.Awesomeparts-Tabs.Listbox

    Read the article

  • Can't Show image in gridview using templates

    - by n10i
    i am trying to load images from the northwind database (categories table, images that are stored in the database) into grid view control. But it dosenot seems to work. Plz! have a look... Default.aspx <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CategoryID" DataSourceID="NorthWindSQLExpressConnectionString" EnableModelValidation="True"> <Columns> <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False" ReadOnly="True" SortExpression="CategoryID" /> <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" /> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /> <asp:TemplateField HeaderText="Picture" SortExpression="Picture"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Picture") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Image ID="Image1" runat="server" ImageUrl='<%# RetriveImage(Eval("CategoryID")) %>' /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:SqlDataSource ID="NorthWindSQLExpressConnectionString" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindSQLExpressConnectionString %>" SelectCommand="SELECT [CategoryID], [CategoryName], [Description], [Picture] FROM [Categories]"> </asp:SqlDataSource> </div> </form> [Partial] Default.aspx.cs protected string RetriveImage(object eval) { return ("ImageHandler.ashx?CategoryID=" + eval.ToString()); } [Partial] ImageHandler.ashx public void ProcessRequest(HttpContext context) { if (context.Request.QueryString == null) { } else { try { using (var sqlCon = new SqlConnection(conString)) { const string cmdString = "Select picture from Categories where CategoryID=@CategoryID"; using (var sqlCmd = new SqlCommand(cmdString, sqlCon)) { sqlCmd.Parameters.AddWithValue("@CategoryID", context.Request.QueryString["CategoryID"]); string trmp = sqlCmd.ToString(); sqlCon.Open(); using (var sqlDr = sqlCmd.ExecuteReader()) { sqlDr.Read(); context.Response.BinaryWrite((byte[])sqlDr["Picture"]); } } } } catch (Exception ex) { context.Response.Write(ex.Message); } } }

    Read the article

  • Object Recognition from Templates

    - by JonLeah
    Hi Guys, I was hoping someone could point me in the right direction here. With a picture of a die (from above) I want to recognize which side is up. I understand the basics in play here, but I'm having trouble grasping the power of OpenCV. I imagine I want a picture of each side of the die. Then I can somehow compare them all to the current image to be classified. How can I use OpenCV to do this? Thanks, Jonathan

    Read the article

  • django integrate htmls into templates

    - by dana
    hi guys, i have a django 'templating' question if i have in views.py: def cv(request): if request.user.is_authenticated(): cv = OpenCv.objects.filter(created_by=request.user) return render_to_response('cv/cv.html', { 'object_list': cv, }, context_instance=RequestContext(request)) and in cv.html something like: {% for object in object_list %} First Name {{ object.first_name }} Last Name {{ object.last_name }} Url {{object.url}} Picture {{object.picture}} Bio {{object.bio}} Date of birth {{object.date_birth}} {% endfor %} but i want this content to appear on the profile.html page too, how can i do it? a smple {% include cv.html %} in the profile.html doesn't work. Also, is there another way to 'parse the object list' than explicitly write all the objects, like above? thanks in advance!

    Read the article

  • Handling JSON and HTML templates in jQuery

    - by Toby Hede
    I have an ajax-enabled site that presents a lot of dynamic content by interpolating JSON values with HTML. This all works fine. BUT it means I have significant amounts of HTML all through my JavaScript. For example: var template = "<div>Foo: {bar}</div><div>Blah: {vtha}</div>"; template.interpolate({bar:"bar",blah:"vtha"}); I have cut this down a fair bit - some of my dynamic elements have quite a lot of HTML and a lot going on. I am using jQuery and I am building on Rails, so if there is something smart in either framework, that would be great. For reference, the String interpolation function used above is: String.prototype.interpolate = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; } ); };

    Read the article

  • Using Angularjs with server side templates

    - by codecollision
    For SEO purposes the server renders out the full html template for a given URL on initial load. The site uses angularjs which detects the URL route and renders a client template from the JSON API. For example, you navigate to: /blog/post-title Server responds with post-title content. Angular loads, detects route: /blog/:post_slug and begins to load JSON and render client side template from response. Obviously what Angular does is fine when links are followed after the initial load, but on first load it duplicates effort. My question is if there is a clean way to prevent this situation.

    Read the article

  • Velocity templates seem to fail with UTF-8

    - by steve
    Hi, i have been trying to use a velocity Template with the following content: Sübjäct $item everything works fine except the translation of the tow unicode characters. The result string printed on the commandline looks like: Sübjäct foo I searched the velocity website and the web an this issue, and came uo with differnt font encoding options, which i added to my code. But those won't help. This is the actuall code: velocity.setProperty("file.resource.loader.path", absPath); velocity.setProperty("input.encoding", "UTF-8"); velocity.setProperty("output.encoding", "UTF-8"); Template t = velocity.getTemplate("subject.vm"); t.setEncoding("UTF-8"); StringWriter sw = new StringWriter(); t.merge(null, sw); System.out.println(sw.getBuffer()); Can anyone give me some hints, how to fix this issue?

    Read the article

  • Velocity Templates - New Line.

    - by LdSe
    Hello all, I've been working with Apache's Velocity engine and a custom template. The thing is, that I haven't been able to generate a String with the corresponding line breaks. I tried almost everything that I found, such as using $esc.n and $esc.newline (I'm already using escape tools on my project) but it seems that the version I'm currently using doesn't support it (1.4), checked if putting '\n', '\\n' and even '\\\n' would work, but same thing. Does anyone have any solution to this? Thanks a lot in advance! Regards.

    Read the article

  • WPF problem modify style of images in multiple Button Templates

    - by user556415
    I'm trying to create a control panel for a video camera, the panel has buttons for up, down, left and right etc. Each camera function up, down, left and right is represented by three images (see code below) for the left side, middle and right side. The control panel is circular so the corner images kind of overlap (its complicated to explain this without a visual). When I click on up for example I have to hide the initial three images (leftside, middle and right side) and display another three images for left , middle and right that indicate that the button is pressed. I am achieving this by having a grid inside a button template. The problem I have is that for the corner images for the control there are really four images that represent this. For example for the top left corner the four images would be represent 1. Top not clicked. 2. Top Clicked and 3. Left Not clicked and 4. Left Clicked. My problem is if I need to make the images contained within the Top button have precedence when the top control is clicked or the images in the left button have precedence when the left button is clicked. So it's like I want to modify the left button's image visible property when the top button is clicked and vise versa. This is really difficult to explain so I apologize if it makes little sense but I can email the source code on request if anyone is interested in my predicament. <Grid> <Canvas> <!--<StackPanel>--> <Button Name="TopSide" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Height="34" Width="102" Canvas.Left="97" Canvas.Top="60" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid Width="100"> <Canvas> <Image Name="TopRightNormal" Source="Resources/topright_off.jpg" Height="34" Width="34" Canvas.Left="66"></Image> <Image Name="TopRightDown" Source="Resources/topright_down.jpg" Height="34" Width="34" Canvas.Left="66" Visibility="Hidden" ></Image> <Image Name="TopNormal" Source="Resources/topcenter_off.jpg" Height="34" Width="34" Canvas.Left="34" /> <Image Name="TopPressed" Source="Resources/topcenter_down.jpg" Height="34" Width="34" Canvas.Left="34" Visibility="Hidden" /> <Image Name="TopDisabled" Source="Resources/topcenter_off.jpg" Height="34" Width="34" Canvas.Left="34" Visibility="Hidden" /> <Image Name="TopLeftNormal" Source="Resources/topleft_off.jpg" Height="34" Width="34" Canvas.Left="2" ></Image> <Image Name="TopLeftDown" Opacity="0" Source="Resources/topleft_down.jpg" Height="34" Width="34" Canvas.Left="2" Visibility="Hidden" ></Image> </Canvas> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="TopNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="TopPressed" Property="Visibility" Value="Visible" /> <Setter TargetName="TopRightNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="TopRightDown" Property="Visibility" Value="Visible" /> <Setter TargetName="TopLeftNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="TopLeftDown" Property="Visibility" Value="Visible" /> <Setter TargetName="TopLeftDown" Property="Opacity" Value="100" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="TopNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="TopDisabled" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Button.Template> </Button> <!--</StackPanel>--> <!--<StackPanel>--> <Button Name="LeftSide" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Canvas.Left="100" Canvas.Top="60" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MouseDown="Button_MouseDown_1"> <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid Width="34" Height="100"> <Canvas> <Image Name="TopLeftNormal" Source="Resources/topleft_off.jpg" Height="34" Width="34" Canvas.Left="0"></Image> <Image Name="TopLeftDown" Opacity="0" Source="Resources/topleft_leftdown.jpg" Height="34" Width="34" Canvas.Left="0" Visibility="Hidden" ></Image> <Image Name="Normal" Source="Resources/leftcenter_off.jpg" Height="34" Width="34" Canvas.Top="32" Canvas.Left="0"/> <Image Name="Pressed" Source="Resources/leftcenter_down.jpg" Visibility="Hidden" Canvas.Top="32" Height="34" Width="34" /> <Image Name="Disabled" Source="Resources/leftcenter_off.jpg" Visibility="Hidden" Height="34" Width="34" Canvas.Top="32" /> </Canvas> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="Normal" Property="Visibility" Value="Hidden" /> <Setter TargetName="Pressed" Property="Visibility" Value="Visible" /> <Setter TargetName="TopLeftNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="TopLeftNormal" Property="Opacity" Value="0" /> <Setter TargetName="TopLeftDown" Property="Visibility" Value="Visible" /> <Setter TargetName="TopLeftDown" Property="Opacity" Value="100" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Normal" Property="Visibility" Value="Hidden" /> <Setter TargetName="Disabled" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Button.Template> </Button> <!--</StackPanel>--> <!--<StackPanel>--> <Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Height="34" Width="34" Canvas.Left="165" Canvas.Top="92" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MouseDown="Button_MouseDown_2" > <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Image Name="Normal" Source="Resources/rightcenter_off.jpg" /> <Image Name="Pressed" Source="Resources/rightcenter_down.jpg" Visibility="Hidden" /> <Image Name="Disabled" Source="Resources/rightcenter_off.jpg" Visibility="Hidden" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="Normal" Property="Visibility" Value="Hidden" /> <Setter TargetName="Pressed" Property="Visibility" Value="Visible" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Normal" Property="Visibility" Value="Hidden" /> <Setter TargetName="Disabled" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Button.Template> </Button> <!--</StackPanel>--> <!--<StackPanel>--> <Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Height="34" Width="34" Canvas.Left="133" Canvas.Top="124" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Image Name="BottomNormal" Source="Resources/bottomcenter_off.jpg" /> <Image Name="BottomPressed" Source="Resources/bottomcenter_down.jpg" Visibility="Hidden" /> <Image Name="BottomDisabled" Source="Resources/bottomcenter_off.jpg" Visibility="Hidden" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="BottomNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="BottomPressed" Property="Visibility" Value="Visible" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="BottomNormal" Property="Visibility" Value="Hidden" /> <Setter TargetName="BottomDisabled" Property="Visibility" Value="Visible" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Button.Template> </Button> <!--</StackPanel>--> <Image Source="Resources/bottomright_off.jpg" Height="34" Width="34" Canvas.Left="165" Canvas.Top="124"></Image> <Image Source="Resources/bottomleft_off.jpg" Height="34" Width="34" Canvas.Left="100" Canvas.Top="124"></Image> <!--<ToggleButton Style="{StaticResource MyToggleButtonStyle}" Height="34" Width="34" Margin="150,100"/>--> </Canvas> </Grid>

    Read the article

  • Get CCK values, without the html in Drupal templates

    - by DasRakel
    I'm storing a string in a CCK field. The problem is getting it back out. I have a node-node_type.tpl.php and ask it $node->content['field_custom_map_data']['#value'] That returns html, three nested div's and uses HTML entities, I want the pure text, as entered. What is the Drupal 5 way to fix this?

    Read the article

  • Komodo Edit 5.2 Django Template Syntax Error - Info: <head> previously mentioned

    - by Lance McNearney
    I am using Komodo Edit 5.2 for editing html and Django template files. It always shows a single syntax error inside the first {% block %} area on the first tag of my template. For example: {% extends "base.html" %} {% load i18n %} {% block title %}Hello{% endblock %} {% block content %} <p>Hello</p> <-- Syntax error on this single line <p>Other lines have no errors</p> {% endblock %} {% block footer %} <p>No errors here</p> {% endblock %} The syntax error given is: Info: <head> previously mentioned I know for a fact that the error has nothing to do with my <head> tag since it occurs in the base template and in child templates (and the IDE isn't smart enough to process the base templates when in a child, etc.) All of my html tags are closed properly and everything validates for XHTML strict. This forum post mentions a similar problem but offers no solution (and may be specific to Smarty syntax highlighting). Any ideas on how to resolve this error (or disable it from being shown)?

    Read the article

  • Visual Studio template not showing

    - by David
    Hi all I've followed this tutorial to try to add a template to Visual Studio: http://www.switchonthecode.com/tutorials/visual-studio-how-to-create-item-templates The template I have created is designed to add one predefined .aspx and one predefined .aspx.cs file to the project. The folder contains the following files: MoosePage.aspx MoosePage.aspx.cs MoosePage.vstemplate MoosePageItemTemplateIcon.ico The .vstemplate file looks like this: <VSTemplate Type="Item" Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"> <TemplateData> <Name>MoosePage</Name> <Description>MoosePage Template</Description> <DefaultName>NewMoosePage</DefaultName> <ProjectType>CSharp</ProjectType> <Icon>MoosePageItemTemplateIcon.ico</Icon> </TemplateData> <TemplateContent> <ProjectItem TargetFileName="$fileinputname$.aspx" ReplaceParameters="true"> MoosePage.aspx </ProjectItem> <ProjectItem TargetFileName="$fileinputname$.aspx.cs" ReplaceParameters="true"> MoosePage.aspx.cs </ProjectItem> </TemplateContent> </VSTemplate> I have zipped the files up (.zip not .zipx) and placed the zip folder in My Documents\Visual Studio 2008\Templates\ItemTemplates\VisualWebDeveloper. I have restarted Visual Studio. When I go into my website project and choose Add New Item, I don't see my new template. Can anyone suggest what might have gone wrong? Thanks David

    Read the article

  • How to resolve user registration and activation email error in Django registration?

    - by user2476295
    So I was just trying to setup a basic user authentication in Django and downloaded a django registration app with templates. Now when I run the server at 127.0.0.1:8000/accounts/register/ I get a basic registration page, I fill in the details and when I click submit I get this error "NoReverseMatch at /accounts/register/" Error during template rendering In template Users/sudhasinha/mysite/mysite/registration/templates/registration/activation_email.txt, error at line 4 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs. 1 {% load i18n %} 2 {% trans "Activate account at" %} {{ site.name }}: 3 4 http://{{ site.domain }}{**% url registration_activate activation_key %**} 5 6 {% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} 7 This is what my activation_email.txt looks like: {% load i18n %} {% trans "Activate account at" %} {{ site.name }}: http://{{ site.domain }}{% url registration_activate activation_key %} {% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %} And this is what my registration_form.html looks like: {% extends "base.html" %} {% load i18n %} {% block content %} <form method="post" action="."> {{ form.as_p }} <input type="submit" value="{% trans 'Submit' %}" /> </form> {% endblock %} I have very minimal experience with Django and would appreciate some help to resolve this error. My urls seem to be setup correctly but I will post it if needed. Also pardon my horrible formatting

    Read the article

  • Drupal: Template Files, Modules and Content Types for Advanced Theme

    - by theandym
    Intro I am in the process of trying to convert my first HTML/CSS design into a theme for Drupal. I have used ModX for quite a few designs and appreciate the ability to create different page templates and custom variables to be assigned to those templates. However I seem to be having some issues making the transition. The site I am working on theming in Drupal is for a real estate agent. Each page/section will have a different set of content associated with it and will need to display only that content. For example, there will be a page for current listings, each of which will be formatted by a custom content type. However, when I call the content on the home page (or on other pages) I do not want to see this listing data. Layout The layout of the site and the regions associated with each page/section is as follows: Home Spotlight Featured 1 Featured 2 About Spotlight Bios - Profiles of each agent (each will be a node with name, contact info, pic, etc) listed on the page; multiple nodes listed Sidebar Listings Spotlight Listings - Profiles of properties (each will be a node with locations, basic info, pic, etc) listed on the page; multiple nodes listed Sidebar Services Spotlight Content - general paragraph text area Sidebar News/Blog News/Blog Items - List of stories with summaries and links to full article Sidebar Each page/section will use the same header and footer. Issue I have done some reading on Drupal, custom content types (and CCK), Views, and Pathauto. However I have not been able to get a clear picture of how to put it all together to accomplish what I am attempting. What I really would like to know is which modules to use, how best to use them, which elements I need to use where, and what template files I should be using to theme the elements I need to use. Any help or reference to useful resources would be much appreciated.

    Read the article

  • calling template function without <>; type inference

    - by Oops
    Hi, if I have a function template with typename T, where the compiler can set the type by itself, I do not have to write the type explicitely when I call the function like: template < typename T > T min( T v1, T v2 ) { return ( v1 < v2 ) ? v1: v2; } int i1 = 1, i2 = 2; int i3 = min( i1, i2 ); //no explicit <type> but if I have a function template with two different typenames like... template < typename TOut, typename TIn > TOut round( TIn v ) { return (TOut)( v + 0.5 ); } double d = 1.54; int i = round<int>(d); //explicit <int> Is it true that I have to specify at least 1 typename, always? I assume the reason is because C++ can not distinguish functions between different return types, true? but if I use a void function and handover a reference, again I must not explicitely specify the return typename: template < typename TOut, typename TIn > void round( TOut & vret, TIn vin ) { vret = (TOut)(vin + 0.5); } double d = 1.54; int i; round(i, d); //no explicit <int> should the conclusion be to avoid functions with return and more prefer void functions that return via a reference when writing templates? Or is there a possibility to avoid explicitely writing the return type? something like "type inference" for templates... is "type inference" possible in C++0x? I hope I was not too unclear. many thanks in advance Oops

    Read the article

  • Why is partial specialziation of a nested class template allowed, while complete isn't?

    - by drhirsch
    template<int x> struct A { template<int y> struct B {};. template<int y, int unused> struct C {}; }; template<int x> template<> struct A<x>::B<x> {}; // error: enclosing class templates are not explicitly specialized template<int x> template<int unused> struct A<x>::C<x, unused> {}; // ok So why is the explicit specialization of a inner, nested class (or function) not allowed, if the outer class isn't specialiced too? Strange enough, I can work around this behaviour if I only partially specialize the inner class with simply adding a dummy template parameter. Makes things uglier and more complex, but it works. Note: I need this feature for recursive templates of the inner class for a set of the outer class. To make things even more complicate, in reality I only need a template function instead of the inner class. But partial specialization of functions is generally disallowed somewhere else in the standard ^^

    Read the article

  • How to easily map c++ enums to strings

    - by Roddy
    I have a bunch of enum types in some library header files that I'm using, and I want to have a way of converting enum values to user strings - and vice-versa. RTTI won't do it for me, because the 'user strings' need to be a bit more readable than the enumerations. A brute force solution would be a bunch of functions like this, but I feel that's a bit too C-like. enum MyEnum {VAL1, VAL2,VAL3}; String getStringFromEnum(MyEnum e) { switch e { case VAL1: return "Value 1"; case VAL2: return "Value 2"; case VAL1: return "Value 3"; default: throw Exception("Bad MyEnum"); } } I have a gut feeling that there's an elegant solution using templates, but I can't quite get my head round it yet. UPDATE: Thanks for suggestions - I should have made clear that the enums are defined in a third-party library header, so I don't want to have to change the definition of them. My gut feeling now is to avoid templates and do something like this: char * MyGetValue(int v, char *tmp); // implementation is trivial #define ENUM_MAP(type, strings) char * getStringValue(const type &T) \ { \ return MyGetValue((int)T, strings); \ } ; enum eee {AA,BB,CC}; - exists in library header file ; enum fff {DD,GG,HH}; ENUM_MAP(eee,"AA|BB|CC") ENUM_MAP(fff,"DD|GG|HH") // To use... eee e; fff f; std::cout<< getStringValue(e); std::cout<< getStringValue(f);

    Read the article

  • Execute a function to affect different template class instances

    - by Samer Afach
    I have a complicated problem, and I need help. I have a base case, class ParamBase { string paramValue; //... } and a bunch of class templates with different template parameters. template <typename T> class Param : public ParamBase { T value; //... } Now, each instance of Param has different template parameter, double, int, string... etc. To make it easier, I have a vector to their base class pointers that contains all the instances that have been created: vector<ParamBase*> allParamsObjects; The question is: How can I run a single function (global or member or anything, your choice), that converts all of those different instances' strings paramValue with different templates arguments and save the conversion result to the appropriate type in Param::value. This has to be run over all objects that are saved in the vector allParamsObjects. So if the template argument of the first Param is double, paramValue has to be converted to double and saved in value; and if the second Param's argument is int, then the paramValue of the second has to be converted to int and saved in value... etc. I feel it's almost impossible... Any help would be highly appreciated :-)

    Read the article

  • Django, url tag in template doesn't work: NoReverseMatch

    - by Lukasz Jocz
    I've encountered a problem with generating reverse url in templates in django. I'm trying to solve it since a few hours and I have no idea what the problem might be. URL reversing works great in models and views: # like this in models.py @models.permalink def get_absolute_url(self): return ('entry', (), { 'entry_id': self.entry.id, }) # or this in views.py return HttpResponseRedirect(reverse('entry',args=(entry_id,))) but when I'm trying to make it in template I get such an error: NoReverseMatch at /entry/1/ Reverse for ''add_comment'' with arguments '(1L,)' and keyword arguments '{}' not found. My file structure looks like this: project/ +-- frontend ¦   +-- models.py ¦   +-- urls.py ¦   +-- views.py +-- settings.py +-- templates ¦   +-- add_comment.html ¦   +-- entry.html +-- utils ¦   +-- with_template.py +-- wsgi.py My urls.py: from project.frontend.views import * from django.conf.urls import patterns, include, url urlpatterns = patterns('project.frontend.views', url(r'^entry/(?P<entry_id>\d+)/', 'entry', name="entry"), (r'^entry_list/', 'entry_list'), Then entry_list.html: {% extends "base.html" %} {% block content %} {% for entry in entries %} {% url 'entry' entry.id %} {% endfor %} {% endblock %} In views.py I have: @with_template def entry(request, entry_id): entry = Entry.objects.get(id=entry_id) entry.comments = entry.get_comments() return locals() where with_template is following decorator(but I don't think this is a case): class TheWrapper(object): def __init__(self, default_template_name): self.default_template_name = default_template_name def __call__(self, func): def decorated_func(request, *args, **kwargs): extra_context = kwargs.pop('extra_context', {}) dictionary = {} ret = func(request, *args, **kwargs) if isinstance(ret, HttpResponse): return ret dictionary.update(ret) dictionary.update(extra_context) return render_to_response(dictionary.get('template_name', self.default_template_name), context_instance=RequestContext(request), dictionary=dictionary) update_wrapper(decorated_func, func) return decorated_func if not callable(arg): return TheWrapper(arg) else: default_template_name = ''.join([ arg.__name__, '.html']) return TheWrapper(default_template_name)(arg) Do you have any idea, what may cause the problem? Great thanks in advance!

    Read the article

  • How do I append Word templates to a new document in VB.NET?

    - by Tom
    I'm poking around to see if this app can be done. Basically the end user needs to create a bunch of export documents that are populated from a database. There will be numerous document templates (.dot) and the end result will be the user choosing templates x y and z to include for documentation, click a button and have the app create a new Word document, append the templates, and then populate the templates with the appropriate data. The reason it needs to be done in Word as opposed to something like Crystal Reports is that the user may customize some fields before printing the documents as it can vary from export to export. Is this possible to do through VB.NET (VS 2010)? I assume it is but I'm having difficulty tracking down a solution. Or alternatively is there a better solution? Here's what I have so far (not much I know) Import Microsoft.Office.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oDoc As Word.Document oWord = CreateObject("Word.Application") oWord.Visible = False oDoc = oWord.Documents.Add 'Open templates x.dot, y.dot, z.dot 'Append above templates to new document created 'Populate new document oWord.Visible = True End Sub End Class Thanks.

    Read the article

  • SharePoint 2010 Hosting :: SharePoint 2010 Custom Web Template

    - by mbridge
    SharePoint 2010 offers some changes and additions to the SharePoint 2007 approach. Site definitions and publishing providers remain largely the same, but site templates created from the SharePoint UI or SharePoint Designer are now saved to a .WSP file, the same solution deployment packaging file format used for deploying custom SharePoint solutions. Site Templates saved to a .WSP solution file can be imported into Visual Studio for additional customization. Introducing the WebTemplate Feature Element The WebTemplate element, introduced in SharePoint 2010, allows site templates to be defined and deployed as a Feature as part of a solution package. A WebTemplate element feature can be used to deploy site templates in either a Farm or Sandbox solution - without modification. If deployed as a Farm feature and solution, site templates will appear in the site collection provisioning page in Central Administration and can be used to provision new site collections, or within a Site Collection to create sub-sites. If deployed as a Site feature and Sandbox solution, site templates will appear within the site collection to support creating a root site or sub-sites. Creating a new WebTemplate Feature in Visual Studio 2010 In addition to supporting the ability to save and import Site Templates created from the SharePoint UI into Visual Studio for customization, it can also be used to create new site templates from scratch. In the following sample we will walk through how to create a new WebTemplate solution based on  a customized version of the out-of-box Blank Site. 1. Create a new Empty SharePoint Project in Visual Studio 2010. 2. Add a new Empty Element to the project. we like to create folders for each type of element in our solution, so in our sample, we have created a Web Templates folder, and then added the BLANKENT element. NOTE: The Elements folder MUST share the same name as the WebTemplate name property. 3. Open the empty Elements.xml and add the <WebTemplate /> element block. 4. Copy the default.aspx and ONET.XML files from the STS site definition location at 14\TEMPLATES\Site Templates\STS. We will customize the ONET.XML in the next section. Open the properties for each file and set the Deployment Type to ElementFile. This ensures the files are deployed with the Element when included in a Feature. 5. By default a new feature is added to the solution for you automatically when a new element is added to the solution. Rename and edit the feature as appropriate. Select Farm for the scope to deploy the WebTemplate to the entire farm, or Site for a sandboxed solution. Customize the ONET.XML At this point, you have a working WebTemplate solution that will deploy the identical site to the out-of-box Blank Site, however the ONET.XML supporting the STS site definition contains 3 configurations – essentially 3 separate site templates and can be simplified before customizing. In the following sample, we have trimmed the ONET.XML to the essentials for a single Site Template, and added references to the <SiteFeatures /> and <WebFeatures /> elements to include the SharePoint Standard and Enterprise features. We have left the top-level navigation bar, and the default page module intact, but removed all other extraneous markup.

    Read the article

  • error C2784: Could not deduce template argument

    - by atch
    Hi guys, Still fighting with templates. In this example, despite the fact that is copied straight from a book I'm getting the following error message: Error 2 error C2784: 'IsClassT<T>::One IsClassT<T>::test(int C::* )' : could not deduce template argument for 'int C::* ' from 'int'. This is an example from a book Templates - The Complete Guide. (I work with Visual Studio 2010 RC). template<typename T> class IsClassT { private: typedef char One; typedef struct { char a[2]; } Two; template<typename C> static One test(int C::*); template<typename C> static Two test(…); public: enum { Yes = sizeof(IsClassT<T>::test<T>(0)) == 1 }; enum { No = !Yes }; }; class MyClass { }; struct MyStruct { }; union MyUnion { }; void myfunc() { } enum E {e1} e; // check by passing type as template argument template <typename T> void check() { if (IsClassT<T>::Yes) { std::cout << " IsClassT " << std::endl; } else { std::cout << " !IsClassT " << std::endl; } } // check by passing type as function call argument template <typename T> void checkT (T) { check<T>(); } int main() { /*std::cout << "int: "; check<int>(); */ std::cout << "MyClass: "; check<MyClass>(); } And although I know roughly what's going on in this example I cannot fix this error. Thanks for help.

    Read the article

  • Django conditional template inheritance

    - by Ed
    I have template that displays object elements with hyperlinks to other parts of my site. I have another function that displays past versions of the same object. In this display, I don't want the hyperlinks. I'm under the assumption that I can't dynamically switch off the hyperlinks, so I've included both versions in the same template. I use an if statement to either display the hyperlinked version or the plain text version. I prefer to keep them in the same template because if I need to change the format of one, it will be easy to apply it to the other right there. The template extends framework.html. Framework has a breadcrumb system and it extends base.html. Base has a simple top menu system. So here's my dilemma. When viewing the standard hyperlink data, I want to see the top menu and the breadcrumbs. But when viewing the past version plain text data, I only want the data, no menu, no breadcrumbs. I'm unsure if this is possible given my current design. I tried having framework inherit the primary template so that I could choose to call either framework (and display the breadcrumbs), or the template itself, thus skipping the breadcrumbs, but I want framework.html available for other templates as well. If framework.html extends a specific template, I lose the ability to display it in other templates. I tried writing an if statement that would display a the top_menu block and the nav_menu block from base.html and framework.html respectively. This would overwrite their blocks and allow me to turn off those elements conditional on the if. Unfortunately, it doesn't appear to be conditional; if the block elements are in the template at all, surrounded by an if or not, I lose the menus. I thought about using {% include %} to pick up the breadcrumbs and a split out top menu. In that case though, I'll have to include it all the time. No more inheritance. Is this the best option given my requirement?

    Read the article

  • Problem filling Django template in googleappengine Loader

    - by googleappenginenewbie
    I am trying to test a googleapengine project locally, but am getting errors loading templates: My settings.py contains TEMPLATE_LOADERS with Loader wrappers: e.g. django.template.loaders.filesystem.Loader but there is no Loader wrapper class in the bundled filesystem.py file within xx/google_appengine/lib/django/django/template/loaders/ so I'm getting this error: Exception Type: ImproperlyConfigured Exception Value: Module "django.template.loaders.filesystem" does not define a "Loader" callable template source loader Exception Location: in xxxx/google_appengine/lib/django/django/template/loader.py in find_template_source, line 60

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >