Search Results

Search found 40441 results on 1618 pages for 'function templates'.

Page 12/1618 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Iterating dictionary indexes in django templates

    - by unclaimedbaggage
    Hi folks...I have a dictionary with embedded objects, which looks something like this: notes = { 2009: [<Note: Test note>, <Note: Another test note>], 2010: [<Note: Third test note>, <Note: Fourth test note>], } I'm trying to access each of the note objects inside a django template, and having a helluva time navigating to them. In short, I'm not sure how to extract by index in django templating. Current template code is: <h3>Notes</h3> {% for year in notes %} {{ year }} # Works fine {% for note in notes.year %} {{ note }} # Returns blank {% endfor %} {% endfor %} If I replace {% for note in notes.year %} with {% for note in notes.2010 %} things work fine, but I need that '2010' to be dynamic. Any suggestions much appreciated.

    Read the article

  • Creating Visual Studio Templates

    - by vanja.
    I'm looking to create a Visual Studio 2008 template that will create a basic project and based on remove certain files/folders based on options the user enters. Right now, I have followed some tutorials online which have let me create the form to query the user and pass the data into an IWizard class, but I don't know what to do from there. The tutorials provide a sample to do some simple substitution: code: Form1 form = new Form1(); DialogResult dlg = form.ShowDialog(); if (dlg == DialogResult.OK) { foreach (KeyValuePair<string, string> pair in form.Parameters) { if (!replacementsDictionary.ContainsKey(pair.Key)) replacementsDictionary.Add(pair.Key, pair.Value); else replacementsDictionary[pair.Key] = pair.Value; } } form.Close(); but I'm looking to selectively include files based on the user settings, and if possible, selectively include code sections in a file based on settings. Is there a clever way to do this, or will I manually have to delete project files in the IWizard:ProjectFinishedGenerating()?

    Read the article

  • Why this works (Templates, SFINAE). C++

    - by atch
    Hi guys, reffering to yesterday's post, this woke me up this morning. Why this actually works? As long as the fnc test is concerned this fnc has no body so how can perform anything? Why and how this works? I'm REALLY interested to see your answers. template<typename T> class IsClassT { private: typedef char One; typedef struct { char a[2]; } Two; template<typename C> static One test(int C::*); //NO BODY HERE template<typename C> static Two test(…); //NOR HERE public: enum { Yes = sizeof(IsClassT<T>::test<T>(0)) == 1 }; enum { No = !Yes }; }; Thanks in advance with help to understand this very interesting fenomena.

    Read the article

  • Specifying Struts templates source

    - by Chris
    Say I'm using a form with a text-field. <@s.form action="login" <@s.textfield label="E-mail" name="email"/ <@s.submit value="send"/ How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl?

    Read the article

  • wso2 governance email templates

    - by Barry Allott
    We have gotten WSO2 governance registry to send e-mails successfully. Now we want to template the emails that are being sent out. There is a sample at : http://docs.wso2.org/wiki/display/Governance450/Notification+E-mail+Customization+Sample This allows you to alter the text coming through the event but is there an easier way that writing Java code? We cannot compile the sample anyway as the Maven compiler keeps looking up the references files and errors with checksum validation failed. Thanks

    Read the article

  • C++ templates error: instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass]

    - by pureconsciousness
    Hello there, I've some problem in my code I cannot deal with: #ifndef TESTCLASS_H_ #define TESTCLASS_H_' #include <map> using namespace std; template <typename T> class TestClass { public: TestClass(){}; virtual ~TestClass(){}; void testMethod(T b,std::map<T,int> m); }; template <typename T> void TestClass`<T`>::testMethod(T b,std::map<T,int> m){ m[b]=0; } #endif /*TESTCLASS_H_*/ int main(int argc, char* argv[]) { SomeClass s; TestClass<SomeClass> t; map<SomeClass,int> m; t.testMethod(s,m); } Compiler gives me following error in line m[b]=0; : instantiated from 'void TestClass::testMethod(T, std::map) [with T = SomeClass] Could you help find the problem?? Thanks in advance

    Read the article

  • How to reduce compile time with C++ templates

    - by Shane MacLaughlin
    I'm in the process of changing part of my C++ app from using an older C type array to a templated C++ container class. See this question for details. While the solution is working very well, each minor change I make to the templated code causes a very large amount of recompilation to take place, and hence drastically slows build time. Is there any way of getting template code out of the header and back into a cpp file, so that minor implementation changes don't cause major rebuilds?

    Read the article

  • C++ typedef for partial templates

    - by Gokul
    Hi, i need to do a typedef like this. template< class A, class B, class C > class X { }; template< class B, class C > typedef X< std::vector<B>, B, C > Y; I just found that it is not supported in C++. Can someone advise me on how to achieve the same through alternative means? Thanks, Gokul.

    Read the article

  • Python templates for huge HTML/XML

    - by newtover
    Hello, Recently I needed to generate a huge HTML page containing a report with several thousand row table. And, obviously, I did not want to build the whole HTML (or the underlying tree) in memory. As result, I built the page with the old good string interpolation, but I do not like the solution. Thus, I wonder whether there are Python templating engines that can yield resulting page content by parts.

    Read the article

  • Hiding instantiated templates in shared library created with g++

    - by jchl
    I have a file that contains the following: #include <map> class A {}; void doSomething() { std::map<int, A> m; } When compiled into a shared library with g++, the library contains dynamic symbols for all the methods of std::map<int, A>. Since A is private to this file, there is no possibility that std::map will be instantiated in any other shared library with the same parameters, so I'd like to make the template instantiation hidden (for some of the reasons described in this document). I thought I should be able to do this by adding an explicit instantiation of the template class and marking it as hidden, like so: #include <map> class A {}; template class __attribute__((visibility ("hidden"))) std::map<int, A>; void doSomething() { std::map<int, A> m; } However, this has no effect: the symbols are still all exported. I even tried compiling with -fvisibility=hidden, but this also has no effect on the visibility of the methods of std::map<int, A> (although it does hide doSomething). The document I linked to above describes the use of export maps to restrict visibility, but that seems very tedious. Is there a way to do what I want in g++ (other than using export maps)? If so, what is it? If not, is there a good reason why these symbols must always be exported, or is this just a omission in g++?

    Read the article

  • Bigcommerce Templates file missing

    - by ime
    I am developing a template for bigcommerce site, where i want to show category list and some hard code links in the place of Page menu. Now what i do, just place this %%Panel.SideCategoryList%% in the upper navigation area. Which shows category list right. But the problem is that i didn't find this %%SNIPPET_SideCategoryList%% file. (In snippets folder exist a file with this name, but that file doesn't work even if i remove all contents of that file.)

    Read the article

  • VBA Public Function to Excel

    - by Sugih
    Dear sir , I have create below function Option Explicit Public Function fyi(x As Double, f As String) As String Application.Volatile Dim data As Double Dim post(5) post(1) = "Ribu " post(2) = "Juta " post(3) = "Milyar " post(4) = "Trilyun " post(5) = "Ribu Trilyun " Dim part As String Dim text As String Dim cond As Boolean Dim i As Integer If (x < 0) Then fyi = " " Exit Function End If If (x = 0) Then fyi = "Nol" Exit Function End If If (x < 2000) Then cond = True End If text = " " If (x >= 1E+15) Then fyi = "Nilai Terlalu Besar" Exit Function End If For i = 4 To 1 Step -1 data = Int(x / (10 ^ (3 * i))) If (data 0) Then part = fyis(data, cond) text = text & part & post(i) End If x = x - data * (10 ^ (3 * i)) Next text = text & fyis(x, False) fyi = text & f End Function Function fyis(ByVal y As Double, ByVal conds As Boolean) As String Dim datas As Double Dim posts(2) posts(1) = "Puluh" posts(2) = "Ratus" Dim parts As String Dim texts As String 'Dim conds As Boolean Dim j As Integer Dim value(9) value(1) = "Se" value(2) = "Dua " value(3) = "Tiga " value(4) = "Empat " value(5) = "Lima " value(6) = "Enam " value(7) = "Tujuh " value(8) = "Delapan " value(9) = "Sembilan " texts = " " For j = 2 To 1 Step -1 datas = Int(y / 10 ^ j) If (datas 0) Then parts = value(datas) If (j = 1 And datas = 1) Then y = y - datas * 10 ^ j If (y = 1) Then posts(j) = "belas" Else value(y) = "Se" End If texts = texts & value(y) & posts(j) fyis = texts Exit Function Else texts = texts & parts & posts(j) End If End If y = y - datas * 10 ^ j Next If (conds = False) Then value(1) = "Satu " End If texts = texts & value(y) fyis = texts End Function but when I return to Excel and type '=fyi(500,"USD") it return to #name? please do me favor to inform me how to solve Rgds, Sugih

    Read the article

  • "Decompile" Javascript function? *ADVANCED*

    - by caesar2k
    [1] Ok, I don't even know how to call this, to be honest. So let me get some semi-pseudo code, to show what I'm trying to do. I'm using jquery to get an already existing script declared inside the page, inside a createDocument() element, from an AJAX call. GM_xmlhttprequest({ ... load:function(r){ var doc = document_from_string(r.responseText); script_content = $('body script:regex(html, local_xw_sig)', doc).html(); var scriptEl = document.createElement('script'); scriptEl.type = 'text/javascript'; scriptEl.innerHTML = script_content; // good till here (function(sc){ eval(sc.innerHTML); // not exactly like this, but you get the idea, errors alert('wont get here ' + local_xw_sig); // local_xw_sig is a global "var" inside the source })(scriptEl); } }); so far so good, the script indeed contains the source from the entire script block. Now, inside this "script_content", there are auto executing functions, like $(document).ready(function(){...}) that, everything I "eval" the innerHTML, it executes this code, halting my encapsulated script. like variables that doesn't exist, etc removing certain parts of the script using regex isn't really an option... what I really wanted is to "walk" inside the function. like do a (completely fictional): script = eval("function(){" + script_content + "};"); alert(script['local_xw_sig']); // a03ucc34095cw3495 is there any way to 'disassemble' the function, and be able to reach the "var"s inside of it? like this function: function hello(){ var message = "hello"; } alert(hello.message); // message = var inside the function is it possible at all? or I will have to hack my way using regex? ;P [2] also, is there any way I can access javascript inside a document created with "createDocument"?

    Read the article

  • New Visual Studio 2012 Project Templates for DotNetNuke

    - by Chris Hammond
    Earlier this month Microsoft put the bits up for Visual Studio 2012 RTM out on MSDN Subscriber downloads, and during the first two weeks of September they will officially be releasing Visual Studio 2012. I started working with VS2012 late in the release candidate cycle, doing some DNN module development using my templates at http://christoctemplate.codeplex.com . These templates work fine in Visual Studio 2012 from my testing, but they still face the same problem that they had in Visual Studio 2008...(read more)

    Read the article

  • Where are my sub templates?

    - by Tim Dexter
    This one is for standalone/BIEE uses of Publisher. All the ERP/CRM/HCM folks are already catered for and can tuck into a nut cutlet and arugala salad. Sorry, I have just watched Food Inc and even if only half of it is true; Im still on a crusade in my house against mass produced food. Wake up World! If you have ventured into the world of sub templating, you'll be reaping some development benefit. In terms of shared report components and calculations they are very useful. Just exporting all of your report headers and footers to a single sub template can potentially save you hours and hours of work and make you look like a star. If someone in management gets it into their head that they would like Comic San Serif font rather than Arial in their report headers, its a 10 min job rather than 100 hours! What about the rest of the report content? I hear you cry. Its coming in 11g, full master template support. Your management wants bright blue borders with yellow backgrounds for all the tables in your reports, 5 minute job! Getting back to sub templates and my comment about all the ERP/CRM/HCM folks be catered for. In the standalone release there is no out of the box directory for you to drop your sub templates. Dropping them into the main report directory would make sense but they are not accessible there via a URL. An oversight on our part and something that will be addressed in 11g. Sub templates are now a first class citizen in the world of BIP, you can upload them and BIP will know what to do with them. But what do you do right now? The easiest place to put them where BIP can 'see' them is to create a directory under the xmlpserver install directory in the J2EE container e.g. $J2EE_HOME/xmlpserver/xmlpserver/subtemplates You can call it whatever you want but when the server is started up, that directory is accessible via a URL i.e. http://tdexter:9704/xmlpserver/subtemplates/mysub.rtf. You can therefore put it into the top of your main templates and call the sub template. <?import: http://tdexter:9704/xmlpserver/subtemplates/mysub.rtf?> Of course, you can drop them anywhere you want, they just need to be in a web server mountable directory. Enjoy the arugala!

    Read the article

  • Efficient inline templates and C++

    - by Darryl Gove
    I've talked before about calling inline templates from C++, I've also talked about calling inline templates efficiently. This time I want to talk about efficiently calling inline templates from C++. The obvious starting point is that I need to declare the inline templates as being extern "C": extern "C" { int mytemplate(int); } This enables us to call it, but the call may not be very efficient because the compiler will treat it as a function call, and may produce suboptimal code based on that premise. So we need to add the no_side_effect pragma: extern "C" { int mytemplate(int); #pragma no_side_effect(mytemplate) } However, this may still not produce optimal code. We've discussed how the no_side_effect pragma cannot be combined with exceptions, well we know that the code cannot produce exceptions, but the compiler doesn't know that. If we tell the compiler that information it may be able to produce even better code. We can do this by adding the "throw()" keyword to the template declaration: extern "C" { int mytemplate(int) throw(); #pragma no_side_effect(mytemplate) } The following is an example of how these changes might improve performance. We can take our previous example code and migrate it to C++, adding the use of a try...catch construct: #include <iostream extern "C" { int lzd(int); #pragma no_side_effect(lzd) } int a; int c=0; class myclass { int routine(); }; int myclass::routine() { try { for(a=0; a<1000; a++) { c=lzd(c); } } catch(...) { std::cout << "Something happened" << std::endl; } return 0; } Compiling this produces a slightly suboptimal code sequence in the hot loop: $ CC -O -xtarget=T4 -S t.cpp t.il ... /* 0x0014 23 */ lzd %o0,%o0 /* 0x0018 21 */ add %l6,1,%l6 /* 0x001c */ cmp %l6,1000 /* 0x0020 */ bl,pt %icc,.L77000033 /* 0x0024 23 */ st %o0,[%l7] There's a store in the delay slot of the branch, so we're repeatedly storing data back to memory. If we change the function declaration to include "throw()", we get better code: $ CC -O -xtarget=T4 -S t.cpp t.il ... /* 0x0014 21 */ add %i1,1,%i1 /* 0x0018 23 */ lzd %o0,%o0 /* 0x001c 21 */ cmp %i1,999 /* 0x0020 */ ble,pt %icc,.L77000019 /* 0x0024 */ nop The store has gone, but the code is still suboptimal - there's a nop in the delay slot rather than useful work. However, it's good enough for this example. The point I'm making is that the compiler produces the better code with both the "throw()" and the no side effect pragma.

    Read the article

  • Visual Studio 2005 Project And Item Templates

    All about Project and Item Templates. You can use Custom Templates to make your development process faster than you ever think. Create your own Template for Visual Studio and distribute with all others. You can also learn how to create an installer to install a template.

    Read the article

  • How can I invoke a function in bash shell script

    - by sufery
    !/bin/bash one_func(){ echo 'abcd' } echo $(one_func) echo one_func the end I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script. When I set the variable "PS1" in ~/.bashrc, I can't invoke the function by one_func e: export PS1="\n[\e[31m]\$(one_func)" it work export PS1="\n[\e[31m]one_func" it doesn't work

    Read the article

  • Jquery callback function executes over and over again...

    - by Pandiya Chendur
    This my jquery function, function getRecordspage(curPage, pagSize) { // code here $(".pager").pagination(strarr[1], { callback: function() { getRecordspage(2, 5);},current_page: curPage - 1, items_per_page:'5', num_display_entries: '5', next_text: 'Next', prev_text: 'Prev', num_edge_entries: '1' }); } and i call this jquery function, <script type="text/javascript"> $(document).ready(function() { getRecordspage(1, 5); }); </script> As you see my It works fine for 1st time and my callback function is configured to the current function itself... when it gets called the callback gets executed over and over again.... How can i prevent this? Any suggestion....

    Read the article

  • jQuery plugin, return value from function

    - by Marius
    Hello there, Markup: <input type="text" name="email" /> Code: $(':text').focusout(function(){ $(this).validate(function(){ $(this).attr('name'); }); }); Plugin: (function($){ $.fn.validate = function(type) { return this.each(function(type) { if (type == 'email') { matches = this.val().match('/.+@.+\..{2,7}/'); (matches != null) ? alert('valid') : alert('invalid'); } /*else if (type == 'name') { } else if (type == 'age') { } else if (type == 'text') { }*/ else { alert('total failure'); } }); }; })(jQuery); The problem is that when I execute the code above, it runs the plugin as if type was a string: "function(){ $(this).attr('name'); });" instead of executing it as a function. How do I solve this? Thank you for your time. Kind regards, Marius

    Read the article

  • Need to call original function from detoured function

    - by peachykeen
    I'm using Detours to hook into an executable's message function, but I need to run my own code and then call the original code. From what I've seen in the Detours docs, it definitely sounds like that should happen automatically. The original function prints a message to the screen, but as soon as I attach a detour it starts running my code and stops printing. The original function code is roughly: void CGuiObject::AppendMsgToBuffer(classA, unsigned long, unsigned long, int, classB); My function is: void CGuiObject_AppendMsgToBuffer( [same params, with names] ); I know the memory position the original function resides in, so using: DWORD OrigPos = 0x0040592C; DetourAttach( (void*)OrigPos, CGuiObject_AppendMsgToBuffer); gets me into the function. This code works almost perfectly: my function is called with the proper parameters. However, execution leaves my function and the original code is not called. I've tried jmping back in, but that crashes the program (I'm assuming the code Detours moved to fit the hook is responsible for the crash). Edit: I've managed to fix the first issue, with no returning to program execution. By calling the OrigPos value as a function, I'm able to go to the "trampoline" function and from there on to the original code. However, somewhere along the lines the registers are changing and that is causing the program to crash with a segfault as soon as I get back into the original code.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >