console

find and remove a line in multiple files

江枫思渺然 提交于 2019-12-31 07:35:13
问题 I have many files, and I have to find a single line in these files and delete, and should be in terminal in linux. Anyone know how to do? Example FileSystem myFiles + file1 + file2 ... + file6500 The file aaa0 aaa1 .... fff9 回答1: This would delete that line in each file. for f in myFiles/*; do sed -i 'd/pattern that matches line that you want to delete/' $f done Alternatively you could use awk as well. tmp=$(mktemp) for f in myFiles/*; do awk '!/pattern that matches the line that you want to

Fractions instead of decimals

眉间皱痕 提交于 2019-12-31 06:07:26
问题 So, I am Writing this little program in c++, it's made to compute various values with lines (sorry i am french, i don't know how to say it in English, but they are the lines with equation types Y = kx + t). And I want my program to output fractions instead of decimals (2/3 instead of 0.666666666...). Can anyone tell me how ? I read online that there are some libraries for that purpose, can anyone help me on how to use them and/or how to implement them in my code ? Thanks :) #include "pch.h"

Eclipse RCP MessageConsole: How to allow user to input and handle this listener?

懵懂的女人 提交于 2019-12-31 03:20:07
问题 I'm writing an eclipse-plugin which creating a new Console. Please see my source code: IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); MessageConsole myConsole = new MessageConsole("CLI", null); ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { myConsole }); consoleView.display(myConsole); MessageConsoleStream stream = myConsole

Redirecting Console.Out within test Setup and Teardown

十年热恋 提交于 2019-12-31 03:03:53
问题 This is a follow up from Grabbing the output sent to Console.Out from within a unit test? and the referenced article in the accepted answer by Mark Seemann. I would like to use Console.Out and Console.In to redirect the streams while testing. Every test in the class needs to use the redirects. In order to keep the tests clean I would like to do this in the test SetUp and TearDown. This is what I was thinking: private StringWriter _sw; private StringReader _sr; [SetUp] public void SetUp() {

Filling last line in console

二次信任 提交于 2019-12-31 02:57:09
问题 I would like to fill/update the entire bottom line of the console. Example: static void Main(string[] args) { Console.BufferWidth = Console.WindowWidth; Console.BufferHeight = Console.WindowHeight; Console.CursorTop = Console.WindowHeight - 1; string s = ""; for(int i = 0; i < Console.BufferWidth; i++) s += (i%10).ToString(); Console.Write(s); Console.CursorTop = 0; Console.ReadKey(); } The issue is that when the text is printed, it moves to a new line. Similar questions stated to move the

Create Java Command Console in JPanel

落花浮王杯 提交于 2019-12-31 02:08:49
问题 I want to create a "Command Console" similar to the Windows Command Prompt, with command history, etc which is in a JPanel so that it can be added to a JFrame. What I want to do is present the user with the prompt to allow them to execute commands. What I have in mind is similar to the BeanShell Console, however I haven't be able to find the source code for the console. 回答1: To include BeanShell into your application, add the .jar-files from the BeanShell download page to your Java project

VB Script to change desktop wallpaper on startup

断了今生、忘了曾经 提交于 2019-12-30 11:49:20
问题 Due to some mardy users voting down my last one, I'll change the question. I want to create a VBScript, or whatever method you deem possible to do so. That sets the desktop background to a desired image on PC startup. Anybody shed light on how to do so Would running a powershell script be better suited to do so or? I work mainly with C# and .NET technologies, so this is kind of out my area 回答1: I'm not sure if it is the best option. But you could edit the registry entry that is responsible

View deleted console output

跟風遠走 提交于 2019-12-30 09:40:11
问题 I am running multiple Junit tests, running a test results in the console being cleared and populated with the log of the current test. Where will the log file containing the previous test logs be stored. Is there any way in eclipse, by which i can see such deleted logs. 回答1: Try the following: Open your Run configuration Select the tab Common In the Standard Input and Output group activate File and set a file Select the Append Checkbox Run your configuration That way everything which is

How does a jQuery instance appear as an array when called in console.log?

一世执手 提交于 2019-12-30 05:22:37
问题 When entered into a JavaScript console, a jQuery object appears as an array. However, it's still an instance of the jQuery object. var j = jQuery(); => [] console.log(j); => [] console.log('test with string concat: ' + j); => test with string concat: [object Object] j instanceof Array => false j instanceof jQuery => true How could one duplicate this with their own object? --------- EDIT --------- Thanks to ZER0 for figuring it out. Here's some example code to create an object that works just

Custom C++ cout class - output to both console and log file

六月ゝ 毕业季﹏ 提交于 2019-12-30 04:37:07
问题 I'm working on a program that makes heavy use of "cout << strSomething;" to log information to the console. I need to modify the program so that all console output goes to both the console AND a file. Although I can modify the "cout <<" in our code, there are several large third party libraries that also use "cout <<"; those libraries cannot be modified due to their licenses - so modifying all references to "cout <<" is not a solution. Also, the use of "wtee.exe" isn't possible due to the