Posts

c# - An unhandled exception of type 'System.InvalidOperationException' occurred in System.dll -

i executing code below : class program { static void main(string[] args) { performancecounter performancecounter = new performancecounter("network interface", "bytes sent/sec", "intel(r) 82579v gigabit network connection"); console.writeline(performancecounter.nextvalue().tostring()); } } i'm getting exception. an unhandled exception of type 'system.invalidoperationexception' occurred in system.dll additional information: instance 'intel(r) 82579v gigabit network connection' not exist in specified category. i have tested parameters windows perfmon tool , working in code giving exception. can please help.. have checked if name spelled correctly? minor error, won't work. to check names exist in category, try (as suggested here: https://stackoverflow.com/a/29270209/1648463 ) performancecountercategory category = new performancecountercategory("network interface"); string[...

AngularJS ng-checked isn't updating checkbox when model changed in javascript -

i have filtered list of objects being repeated ng-repeat input checkbox beside each item. when list isn't filtered (as when page loaded) don't want checkboxes checked. if list filtered want checkboxes checked (the checkboxes form treeview via css). the checkbox has ng-checked="{{site.ischecked}}". when list filtered updating ischecked variable on objects within filter javascript code, isn't updating checkbox value. if item filtered out it's removed screen , filtered in again updated ischecked value come through screen. the html follows: <ul> <li ng-repeat="site in sites | filtersites:searchbuildings"> <input type="checkbox" ng-checked="{{site.ischecked}}" id="item-f{{site.id}}" /><label for="item-f{{site.id}}">{{site.site}}</label> <ul> <li ng-repeat="building in site.filteredbuildings"> <a href=...

javascript - Adding numbers together -

i want loop on array whilst addding numbers together. whilst looping on array, add current number next. my array looks [0,1,0,4,1] i following; [0,1,0,4,1] - 0+1= 1, 1+0= 1, 0+4=4, 4+1=5 which give me [1,1,4,5] following; 1+1 = 2, 1+4=5, 4+5=9 and on until 85. could advise on best way go this transform follows specified method of summation, end result of 21, please specify how 85. var ary = [0,1,0,4,1], transform = function (ary) { var length = ary.length; return ary.reduce(function (acc, val, index, ary) { if (index + 1 !== length) acc.push(ary[index] + ary[index + 1]); return acc; }, []); }; while (ary.length !== 1) ary = transform(ary);

mvvm - MvvmCross binding property of custom type to custom view -

i tried bind property of custom type in view model custom view, in binder method "setvalue(object value)" value null. why happens? impossible bind property of custom type custom view in mvvmcross? my viewmodel: public class recipesfiltersvm : mvxviewmodel { public searchfield dishfield { get; private set; } public searchfield cuisinefield { get; private set; } public searchfield ingredientfield { get; private set; } private readonly ifiltersservice _filtersservice; public recipesfiltersvm(ifiltersservice filtersservice) { _filtersservice = filtersservice; updatesearchfields (); } private async void updatesearchfields () { var allfilters = await _filtersservice.loadallfilters (); dishfield = new searchfield ( allfilters .where(f => f.type == filtertype.dish) .tolist() ); cuisinefield = new searchfield ( allfilters .wher...

pointers - Can you explain why I get 2 different results passing the same structure in Objective-C? -

have been struggling hope people can me. suppose have defined following structure struct _sparticleeffect { enumparticletypes type; int count; glkvector3 initialpos; glkvector3 direction; float triggerradius; cgsize prtsize; float prtclspeedmax; float prtclspeedinitial; float prtcllifemax; glkvector4 color; }; typedef struct _sparticleeffect sparticleeffect; then make instance of structure , pass single function in 2 ways - pointer , value: - (void) initgeometry { sparticleeffect splasheffect; splasheffect.count = 15; [splashprt testfunc: &splasheffect : splasheffect]; } //test function 2 parameters - pointer , value //method of splashprt - (void) testfunc: (sparticleeffect*) attrpointer: (sparticleeffect) attr { nslog(@"1: %d", attrpointer->count); nslog(@"2: %d", attr.count); } and result get 2015-07-01 16:58:28.766 [1738:707] 1: 15 2015-07-01 16:58:28.770 [1738:707]...

Generating a PDF with Prawn and Ruby On Rails -

i've been following ryan bate's railscast tutorial (excellent always) have run issue cannot seem resolve. i have prawn::document rendering using static content fine, ie with class printpdf < prawn::document def initialize super text "text" end end and in controller def print @vegetaux = vegetable.all respond_to |format| format.html format.pdf pdf = printpdf.new send_data pdf.render, filename: "vegetaux.pdf", type: "application/pdf", disposition: "inline" end end end but when try pass in rails model adding this pdf = printpdf.new(@vegetaux) & in pdf object class printpdf < prawn::document def initialize(vegetaux) super @vegetaux = vegetaux text "text" end end i error message no implicit conversion of symbol integer relating line... pdf = printpdf.new(@vegetaux) the object @vegetaux seems ok though, because in html reponse can loop t...

Trouble using Functions for Hangman game in C -

i trying make hangman gave using c functions. able make game without using functions when try use functions running few problems. the main problem having in displayword() function. need function print out word screen letters have not been correctly guessed blanked out underscore. ~header fiiles #include <stdio.h> #include <stdlib.h> #include <string.h> /* constants. */ #define num_words 50 #define alphabet_size 26 #define good_guess 0 #define bad_guess 1 #define game_over 1 #define game_continue 0 #define max_guess 10 #define max_word_len 10 /* function prototypes. */ int init(char* word); void displayword(char* word, int* guessedletters, int* length); int guessletter(char* word, int* guessedletters); void displayhangman(unsigned wrongguesses); int isgameover(char* word, int* guessedletters, unsigned wrongguesses); void readrestofline(); ~main code #include "hangman.h" /************************************************************************...