Posts

javascript - need advice on dust temmplate -

i new dust (linkedin), working on first little template. after writing obvious (but long) way thought of way optimize using inline partial. long version looks this: {#parcours}<tr class="pcsel_pc" id="{id}"> <td class="pcsel_exp_btn"><a href="#" class="list{?exp}hide{:else}exp{/exp}btn"> <span class="glyphicon glyphicon-{?exp}minus{:else}plus{/exp}"></span></a></td> <td class="pcsel_col">{name}</td><td class="pcsel_col pcsel_num">{count}</td> </tr> {?exp} {#variants} <tr class="pcsel_var{?sel} pcsel_sel{/sel}" id="{id}" > <td class="pcsel_col">&nbsp;</td><td class="pcsel_var pcsel_col">{name}</td> <td class="pcsel_col pcsel_num">{count}</td> </tr> {/variants} {:else} {#variants} <tr class="pcsel_var pcsel_hide" id=...

c++ - Passing pointer to any member function as class template argument -

template<typename t, typename m, m method> class proxyobject { public: template<typename... args> void invoke (t& object, _in_ args&&... a) { (void)(object.*method)(std::forward<args>(a)...); } }; class object { public: int mymethod (int val) { wcout << l"hello!" << endl; return val; } }; int wmain () { object myobj; proxyobject<object, decltype(&object::mymethod), &object::mymethod> obj; obj.invoke(myobj, 10); return 0; } the decltype(&object::mymethod) seems redundant in definition of obj . there way make proxyobject automatically infer type of pointer-to-member-function being passed, can define obj follows: proxyobject<object, &object::mymethod> obj; i think it's impossible class template, because have specify member function type explicitly. template function lot argument deduction: template<typenam...

xml - What does it mean apply-templates select='*'? -

forgive me learned xsl , , have trouble understand apply-templates well. in understanding. apply-templates find nodes match select . , search in current xsl document if there template defined specified select nodes. apply style these nodes. for example: <catalog> <cd> <title>empire burlesque</title> <artist>bob dylan</artist> <country>usa</country> <company>columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>hide heart</title> <artist>bonnie tyler</artist> <country>uk</country> <company>cbs records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>greatest hits</title> <artist>dolly parton</artist> ...

ruby on rails - Attribute not updating on update_attribute even after reload -

i'm doing rails tutorial on : https://www.railstutorial.org/book/account_activation_password_reset i have piece of code supossed create reset_token , save hash , time created database. def create_reset_digest self.reset_token = user.new_token update_attribute(:reset_digest, user.digest(reset_token)) value = update_attribute(:reset_sent_at, time.zone.now) print value end starting debug before update_attribute on reset_sent_at: self.reset_sent_at == 2000-01-01 12:36:53 utc after it: self.reset_sent_at == thu, 22 oct 2015 12:52:47 utc +00:00 but doing self.reload makes: self.reset_sent_at == 2000-01-01 12:36:53 utc so maybe update_attribute not saving on db? but print value returns true, indicating successful save. i'm not sure going on. found out happened, on schema had t.time "reset_sent_at" instead of t.datetime. weird update_attribute returned true.

c# - How can I observe changes in the AllowedFileTypes of FileSavePickerUI? -

Image
when register app file-save picker, filesavepickeractivatedeventargs in app.xaml.cs : protected override void onfilesavepickeractivated(filesavepickeractivatedeventargs e) { var filter = e.filesavepickerui.allowedfiletypes; // ireadonlylist<string> } when user selects different set of file-types: how notification collection changed? filesavepickerui.allowedfiletypes not observable. there trick? @methodman , in windows store apps can register app filesavepicker, allows show option when other apps want "save as...". ui contains app outside control, drop down "save type" (look @ photo above). drop down contains values filesavepickerui.allowedfiletypes . when user changes selection, need notification. except... can't. can't seem find way observe change. looks there's bug in windows 10 of (oct 2015) filenamechanged event not fire when type changed. seems work in windows 8. the filenamechanged event documented being rai...

assembly - How to spot MARIE errors? -

after assembling current file in marie. if i'm prompted error, how can spot line error directed at? also i'm working on assignment requires me input length , width user , output perimeter or area. far here have : org 100 input length //take input length store length //store length in location length1 output length //show value of length input width //take input width store width //store location width output width //show input width load width subt width 1 //(subtract 1 w until 0) store width load a add length // add l area store a skipcond 00d //(skip when width hits 0) jump 007 // output area halt a, dec 0 b, dec 0 c, dec 0 end i wrote in java make more clear understand //find either perimeter or area of rectangle import java.util.scanner; public class perimeterorarea{ public static void main(string[] args){ int length, width; int perimeter, area; string ch; char character; scanner in = new scan...

Is it possible to extract in c++ the container template class? -

i wondering if possible detect template class container type, , redefine parameters. example : typedef std::vector<int> vint; typedef typeget<vint>::change_param<double> vdouble; where vdouble std::vector<double> ? adding on @kerrek sb's answer, here generic approach: template<typename...> struct rebinder; template<template<typename...> class container, typename ... args> struct rebinder<container<args...>>{ template<typename ... uargs> using rebind = container<uargs...>; }; which work container under sun.