console

Console.Read() and Console.ReadLine() FormatException

此生再无相见时 提交于 2020-01-06 01:05:21
问题 using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Int32 a = 3; Int32 b = 5; a = Console.Read(); b = Convert.ToInt32(Console.ReadLine()); Int32 a_plus_b = a + b; Console.WriteLine("a + b =" + a_plus_b.ToString()); } } } I get an error message at the ReadLine() function: FormatException was unhandled. What is the problem? 回答1: I guess it is just because you pressing ENTER key after you type first number . Lets analyze your code. Your code reads the

Finding bounded events in inspector

北战南征 提交于 2020-01-05 21:16:40
问题 I've been wondering a long time about this. Is there a way in eg Chrome to see what events are bound to an element? Since many people now use jQuery with a syntax like the following: $("a.subtle").click(function(){ //do something }); Is there a way in the inspector to easily find this code? I know in the inspector you can go to the "event listeners"-tab to see what events are bound. Looking at an example I can see there is a click-event on the element with the js file of jQuery next to it, so

C# output on both form textbox and console application using RedirectStandardOutput and Error streams

风流意气都作罢 提交于 2020-01-05 15:04:09
问题 The question here is if anyone has an idea how to both get StandardOutput data to print in Windows form application and keep the output in the console itself. The WinForms part I have completed already, it works great with process events and invoking form elements. At this point I am pretty sure that after re-directing output, Console.Writeline() doesn't print anything on the console window anymore. Any ideas besides running another dummy process that simply displays anything whats on

How to automatically “like” Twitter tweets with JavaScript helper console code

蹲街弑〆低调 提交于 2020-01-05 09:29:27
问题 I am trying to search for a term in Twitter, and then "like" the tweets that come up, using JavaScript code in the console. I tried making a class substitution into this working facebook code for auto-inviting users to like your page: var inputs = document.querySelectorAll('a._42ft._4jy0._4jy3._517h'); for(var i=1; i<inputs.length;i++) { inputs[i].click(); } When I inspect the heart icon used by Twitter for liking a tweet, i see <button class="ProfileTweet-actionButton js-actionButton js

How to automatically “like” Twitter tweets with JavaScript helper console code

独自空忆成欢 提交于 2020-01-05 09:28:08
问题 I am trying to search for a term in Twitter, and then "like" the tweets that come up, using JavaScript code in the console. I tried making a class substitution into this working facebook code for auto-inviting users to like your page: var inputs = document.querySelectorAll('a._42ft._4jy0._4jy3._517h'); for(var i=1; i<inputs.length;i++) { inputs[i].click(); } When I inspect the heart icon used by Twitter for liking a tweet, i see <button class="ProfileTweet-actionButton js-actionButton js

redirect ftp pipe in C

百般思念 提交于 2020-01-05 09:26:57
问题 I am using NamedPipe in windows Application Programming to redirect cmd.exe Input/Output buffer to my program console. everything works good until I enter commands like "ftp". if you type this to real cmd.exe console you recive "ftp>" in terminal, but I don't.it is my code: #include <windows.h> #include <tchar.h> #include <stdio.h> #include <strsafe.h> #define BUFSIZE 4096 HANDLE hReadChildInput = NULL; HANDLE hWriteChildInput = NULL; HANDLE hReadChildOutput = NULL; HANDLE hWriteChildOutput =

redirect ftp pipe in C

試著忘記壹切 提交于 2020-01-05 09:24:20
问题 I am using NamedPipe in windows Application Programming to redirect cmd.exe Input/Output buffer to my program console. everything works good until I enter commands like "ftp". if you type this to real cmd.exe console you recive "ftp>" in terminal, but I don't.it is my code: #include <windows.h> #include <tchar.h> #include <stdio.h> #include <strsafe.h> #define BUFSIZE 4096 HANDLE hReadChildInput = NULL; HANDLE hWriteChildInput = NULL; HANDLE hReadChildOutput = NULL; HANDLE hWriteChildOutput =

How to automatically update a C# .Net console application?

左心房为你撑大大i 提交于 2020-01-05 08:33:00
问题 I have a Console application (executable) written in C# .Net that users download and run locally. The users download a zip and extract it to a local directory and run (using command line parameters) via the command line from that location. Since users will not check for new version I need a way for the executable to check for a newer version of itself and automatically download it and overwrite itself (or at least notify the user). I have looked at the possibility of using clickonce but that

How to automatically update a C# .Net console application?

六月ゝ 毕业季﹏ 提交于 2020-01-05 08:32:19
问题 I have a Console application (executable) written in C# .Net that users download and run locally. The users download a zip and extract it to a local directory and run (using command line parameters) via the command line from that location. Since users will not check for new version I need a way for the executable to check for a newer version of itself and automatically download it and overwrite itself (or at least notify the user). I have looked at the possibility of using clickonce but that

Invalid Handle when using SetConsoleWindowInfo

白昼怎懂夜的黑 提交于 2020-01-05 04:19:08
问题 I'm new to C++ and decided to challenge myself with a small console game. To avoid typical flickering. Fromm what I got from MSDN docs I should be using a Console Buffer, but I took it easy and started from simple things like changing Window title and resizing it. The small program I wrote was meant to do just that, but for some reason I get Error Code 6 (should be "invalid handle") when I execute the SetConsoleWindowInfo. Anyone who can point me in the right direction with this? Thank you in