Posts

c# - Why did System.String[] appear as the output from printing 2d array? -

Image
using this, i'm trying print list of contents of players.text know foreach loop print fine if console.writeline used. i'm attempting manipulate data in particular ways later, , need split using indicated delimiter. however, given code repeated system.string[] printout. i've done search or 2 , of i've found has 1 part or other, haven't found information on how use them together. string[] playerfile = file.readalllines("players.txt"); foreach (string s in playerfile) { //console.writeline(s); string[] playerstuff = s.split(';'); console.writeline(playerstuff); } console.readkey(); i realize it's simplistic question. often, me @ least, it's missing obvious drives me crazy. thanks in advance. player;team;pos;hr;rbi;avg abreu, j;cws;1b;30;101;0.29 altuve, j;hou;2b;15;66;0.313 andrus, e;tex;ss;7;62;0.258 arenado, n;col;3b;42;130;0.287 aybar, e;laa;ss;3;44;0.27 the above first few lines of input. basically, ...

github - Removing single/multiple file from a git commit(s) -

i new git , trying clean branch intend remove multiple files added. the files intend remove having additional white space came after removed code. without white space file same base branch , don't want show in pull request. the pull request talking have multiple commits , @ stage want merge. want remove files branch showing because of white space. did try few things nothing helped- git checkout origin/<remote-branch> <filename> git commit --amend but did not help, want pick specific files multiple commits made , remove them changes(branch). what assuming branch master. change command if not git reset master git add -p this interactively go though differences asking 1 one if want them

PHP loop listen for user input -

i have php script run on console. while(1) { dostuff(); sleep(2); } i need accept input console. don't want loop stop each time , wait me input text. what want while loop continue normal, if type in console, php script able read text , update variable. can done ? you can non-blocking i/o. you'll need stream_set_blocking method , stream_select : stream_set_blocking(stdin, false); while (1) { dostuff(); $readstreams = [stdin]; $timeout = 2; // stream_select block $timeout seconds or until stdin // contains data read. $numberofstreamswithdata = stream_select( $readstreams, $writestreams = [], $except = [], $timeout ); if ($numberofstreamswithdata > 0) { $userinput = fgets(stdin); // process $userinput see fit } else { // no user input; repeat loop normal } }

puppet - Encrypted Hiera eyaml variable decrypts on master but not on node -

i set hiera-eyaml on puppet 3.8, opensource environment. defaults.yaml db_password: enc[pkcs7,mxcgfds......] site.pp $password=hiera(db_password) if i'm running: puppet master --debug --compile funky_hostname.mydomain.com --environment=dev i can see tempated configfile generating correctly: password="password123" but when i'm running on actual node (funky_hostname.mydomain.com), i'm getting original, encrypted string result: password="enc[pkcs7,mxcgfds......]" isn't hiera decryption happening on puppet master side? puppet catalogues compiled on puppet master. compiled catalogue shared client on ssl connection (assuming puppet ca has signed ssl certificate request client). catalogue realised on client. compilation stage involves merging hiera data (and decrypting first if using eyaml backend). if using e.g. gpg encryption, gpg recipients file on puppet master used in deciding keys use in decryption process. net resu...

css - Font Awesome add multiple icons to button -

Image
i have button: <button type="button" style="margin-bottom: 5px;" class="btn btn-danger btn-default btn-gray btn-primary btn-primary2 btn-success2 btn-warning btn-black btn-success btn_bottom_padding" data-toggle="modal" data-target="#mymodal" data-bind="css: {'btn-gray': isgray(), 'btn-danger': isred(),'btn-success':isgreen(), 'btn-primary': isblue(),'btn-success2':islimegreen(), 'btn-primary2': isskyblue(),'btn-warning':isorange(),'btn-black': isblack(),'btn-default':iswhite()},click:$root.getclick"> <span data-bind="text:shortname()"></span> <span data-bind="visible: isred()" class="fa fa-exclamation-triangle"></span> @*<span data-bind="" class="fa fa-bolt"></span>*@ </button> the thing wanted add multiple icons like: i managed add excla...

file - How to get directory permissions in Bash script without backtick evaluation? -

i'm updating bash script in z/os. current script uses result of backtick command test condition, so: var=`command` [test value of var] the problem 1 customer has no access /tmp directory, , z/os uses files in /tmp hold intermediate data backtick commands. i figure test before backtick command /tmp accessibility, , change script's behavior accordingly. i'm not finding way that, though. suggestions? if [[ -w /tmp ]]... test if current user has write access /tmp . there might alternative. don't have z/os, unixs have variable tmpdir can set temporary directory, example: export tmpdir="$home" might work. on note, backticks considered deprecated. use var=$(command) instead.

c# - ASP.NET Web Api, Database connection in Threads -

i have issue using database in thread in asp.net application. when want start application want start thread called "backgroundworker" it, runs in background till whole application stopped. the problem have massive problems dbcontext in thread. i try start walker in startup.cs in methods "configureservices" or "configure" , initialize dbcontext in constructor in walker "dbcontext = new applicationcontext()" tells me connection not configured, when try operate in while(true) queue on database. if write own controller walker receives applicationcontext in constructor , starts thread this, if call controller once request: public backgroundworker(chronicuscontext dbcontext) { _dbcontext = dbcontext; _messageservice = new mailmessageservice(); } // get: api/backgroundworker [httpget] [route("start")] public void startworker() { //thread thread = new thread(this.dobackgroundwork);...