Posts

Meteor - data not available with Iron Router -

i trying achieve pretty simple: load template , fill data. however, template rendered several times, , first time null data. i found various posts issue stating rendering occurs every time subscription adds record clients database, , tried applying proposed solutions, still have first rendering without data. how can fix that? router.configure({ layouttemplate: 'layout', loadingtemplate: 'loading', notfoundtemplate: 'notfound' }); router.route('/team/:_id/cal', { name: 'calendar', waiton: function() { return [ meteor.subscribe('userteams',meteor.user()._id), meteor.subscribe('teamusers', this.params._id)]; }, action : function () { console.log("action:"+this.ready()); if (this.ready() && template.currentdata != null) { this.render(); } }, data: function(){ var team = teams.findone({_id:this.pa...

c++ - How do I validate integer input? -

so making little calculator program game brother plays because bored. took c++ course last semester in college (now taking java course find bit more confusing) , found fun make these little programs. usual i'm getting carried away , must perfectionist , bothering me. now in game, , in real life, numbers seperated commas make easier read. because of this, that's how numbers going inputted calculator brother. tell him not put in commas when typing in number , put in prompt there should not commas can't sure. so, best if code doesn't mess every time that's not number put in. what i've got far pretty good. if put in letters prompt user again , if put letters in after numbers (not inbetween, messes found) ignore letters , work properly. if put in commas though, returns same thing (0 , 5) although i'm putting in. have no idea if comma acting cut off point or what. here's code getting integers: #include <iostream> using namespace std; int main...

c# - Reflection error: "parameter type mismatch" -

i trying understand reflection in c# , trying following code work. first method (getusername) works second method (addgivennumbers) giving me exception error of "parameter type mismatch". created class library 2 methods , trying use reflection in main console application. class library code: namespace classlibrarydelete { public class class1 { public string getusername(string account) { return "my name " + account; } public int addgivennumbers(int num1, int num2) { return num1 + num2; } } } code in main console application: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.reflection; namespace consoleapplicationdelete_reflection { class program { static void main(string[] args) { assembly assemblyinstance = assembly.loadfrom(@"c:\users\xyz\desktop\de...

c++ - Wrapping pointers into an iterator for copying into an STL container -

i have pointer data want put string. thought using std::copy should safest approach. however, in visual studio 2010 warning warning c4996: 'std::_copy_impl': function call parameters may unsafe - call relies on caller check passed values correct. disable warning, use -d_scl_secure_no_warnings. and of course warning correct. there checked_array_iterator objects described on msdn checked_array_iterator can used wrap pointer , make compatible stl iterators. the problem is, checked_array_iterator can used target, not source. so when try use this, application crashes or doesn't compile: char buffer[10] = "test"; std::string s; // these parameters external call , shown here illustrate usage. char *ptargetadress = &s; const char *obegin = buffer; const char *oend = obegin+sizeof(buffer); std::string *p = reinterpret_cast<std::string *>(ptargetadress); std::copy(obegin, oend, p->begin()); // crash stdext::checked_array_iterator...

wordpress - WP_Query code outputs the PHP in the HTML instead of results -

i have page supposed display 3 of latest posts in category. php code make work below <section id="projects"> <div class="container"> <div class="row"> <h2><span class="w200">latest </span><span class="w600 green">roofing projects</span></h2> <p class="text-center pad_bottom">click view latest project</p> <?php //latest projects loop $latestproj = new wp_query('cat=3&posts_per_page=3'); if ($latestproj->have_posts()) : while ($latestproj->have_posts()) : $latestproj->the_post(); ?> <div class="col-lg-4"> <?php if (has_post_thumbnail()) { the_post_thumbnail('square-thumbnail'); ?> <p class="proj_title"><?php the_title(); ?></p> <p><?php the_title(); ?></p> ...

How to Run Rails on Shared Server Using Heroku -

Image
i have website http://example.com , to host ruby on rails generated app http://example.com/projects/ruby . i using heroku zerigo dns addon (or open openshift if works). i tried installing ndeploy through cpanel [siteground][1] (my web host) not seem allow access apache or command line(?). my goal present project through website (not through cloud9 or heroku domain). can please point me, in right direction. on heroku when try press "add domain" control panel receive message: *"can't have more 1 domains / check *** larger plan accommodates needs"* if you're using heroku host rails app (which uses amazon e3), you'll not hosting on shared hosting at all . your fix come the following : all you're doing heroku custom domains (which need pro account for), forwarding traffic domain.com/path heroku app. now, don't know how heroku deal being routed - subfolder - know fact thing here dns setup domain. in section, need a...

java - How make jcomponents change its sizes according to the screen resolution -

i've created application using jframes , jinternal frames. wanted make custom close , minimize buttons made jframe decorated. , made fit screen of given resolution using below codes. public dimension screensize = toolkit.getdefaulttoolkit().getscreensize(); public rectangle winsize = graphicsenvironment.getlocalgraphicsenvironment().getmaximumwindowbounds(); public int taskbarheight = screensize.height - winsize.height; public int width = (int) screensize.getwidth(); public int height = (int) screensize.getheight()-taskbarheight; in constructor ive typed this.setsize(width, height); and way managed make decorated jframe fit screen. want make other components in side jframe change sizes according screen resolution.is there way make components change sizes, instead of assigning dimensions each every components separately. i.e jdesktoppane1.setpreferredsize(new dimension(width*9/10, height*88/100)); i found difficult arrange components according ...