What’s the difference between console.dir and console.log?

In Chrome the console object defines two methods that seem to do the same thing: console.log(…) console.dir(…) I read somewhere online that dir takes a copy of the object before logging it, whereas log just passes the reference to the console, meaning that by the time you go to inspect the object you logged, it … Read more

JUnit test for System.out.println()

I need to write JUnit tests for an old application that’s poorly designed and is writing a lot of error messages to standard output. When the getResponse(String request) method behaves correctly it returns a XML response: @BeforeClass public static void setUpClass() throws Exception { Properties queries = loadPropertiesFile(“requests.properties”); Properties responses = loadPropertiesFile(“responses.properties”); instance = new … Read more

How to clear the interpreter console?

Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times. I’m wondering if, … Read more

How do I launch the Android emulator from the command line?

I’m on Mac, working on Android development from the terminal. I have successfully created the HelloWorld project and now I’m trying to run it from the command line in the Android emulator. Which command runs the emulator for my HelloWorld project? I already have the Android tools and platform-tools in my PATH. Edit: How do … Read more

How can I call controller/view helper methods from the console in Ruby on Rails?

When I load script/console, sometimes I want to play with the output of a controller or a view helper method. Are there ways to: simulate a request? call methods from a controller instance on said request? test helper methods, either via said controller instance or another way? 14 Answers 14 To call helpers, use the … Read more

How do I print debug messages in the Google Chrome JavaScript Console?

How do I print debug messages in the Google Chrome JavaScript Console? Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the print command in JavaScript Debugger will not work here. In the JavaScript Console, print() will send the parameter to the printer. 15 … Read more

Preventing console window from closing on Visual Studio C/C++ Console application

This is a probably an embarasing question as no doubt the answer is blindingly obvious. I’ve used Visual Studio for years, but this is the first time I’ve done any ‘Console Application’ development. When I run my application the console window pops up, the program output appears and then the window closes as the application … Read more

Unable to show a Git tree in terminal

Killswitchcollective.com’s old article, 30 June 2009, has the following inputs and outputs git co master git merge [your_branch] git push upstream A-B-C-D-E A-B-C-D-E-F-G \ —-> \ your branch C-D-E G I am interested how you get the tree like-view of commits in your terminal without using Gitk or Gitx in OS/X. How can you get … Read more

Text progress bar in terminal with block characters [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago. Improve this question I wrote a simple console app to upload and download files from an FTP server … Read more