terminal

linux terminal animation - best way to delay printing of 'frame' (in C)

南楼画角 提交于 2019-12-10 17:45:41
问题 I'm working on a simple pong clone for the terminal and need a way to delay the printing of a 'frame'. I have a two dimensional array screen[ROWS][COLUMNS] and a function that prints the screen void printScreen() { int i = 0; int j; while(i < ROWS) { j = 0; while(j < COLUMNS) { printf("%c", screen[i][j]); j++; } i++; } } It seems that when I do printScreen(); usleep(1000000); printScreen(); it will sleep the execution during printScreen() . Any tips for doing this type of animation on the

'rails server' command not working in terminal

隐身守侯 提交于 2019-12-10 17:30:02
问题 I'm pretty new to rails, and trying to setup an extremely simple test site. I've created the new rails app directory using the rails new command, but then cannot setup the server to view the page in a browser. (Below is the message I receive when attempting rails server ) MacBook-Pro:documents AT$ rails server Usage: rails new APP_PATH [options] Options: -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -m

Keep SSH Sessions running after disconnection - for overnight [closed]

喜欢而已 提交于 2019-12-10 17:08:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . This is a follow up question for this question. I took the advise by @Chris Lear by using screen commend. It works great, for short time sign out. But i met the following question several times. After I log out, by ctrl+a, ctrl+d, and go to sleep, and try to resume on next morning, I am keep getting the

Use external terminal

ぐ巨炮叔叔 提交于 2019-12-10 16:43:57
问题 How can I have Netbeans run my Java project inside a system terminal rather than its built-in terminal? I looked around and apparently I am supposed to do Project Properties->Run->Console Type but this has regrettably been removed from the project configuration panel at some point in history. Every other thread I can dig up on the internet regarding this issue has - predictably - no replies. I know I can run the jar file from the command-line but an integrated solution would be helpful. I am

ZSH: Call in-built function from zsh function that uses the same name

别等时光非礼了梦想. 提交于 2019-12-10 16:34:41
问题 I use zsh and would like to slightly extend the in-built cd function. I'd like that when I call cd , it changes directly and then lists the content of the directory. function cd() { cd $1 ls . } I'd have expected this code to work, but as it turns out, the call to cd refers to the function definition, resulting in an infinite loop. Is there a work-around to solve this problem, apart from choosing a different name for my function? UPDATE Strangely enough, this worked function cd() { `echo $1`

Bash on macOS - Get a list of dates for every Saturday on a given year

非 Y 不嫁゛ 提交于 2019-12-10 15:58:52
问题 In bash on macOS , I would like to write a small script with dates (or any other program that would do) that gives me a list of dates in the format yyyymmdd of every Saturday of a given year and saves it to a variable. For example, if I wanted to have a list of dates for all Saturdays of the year 1850, it should somehow look like this: var = [ 18500105, 18500112, 18500119, …, 18501228 ] with the below code: list=() for month in `seq -w 1 12`; do for day in `seq -w 1 31`; do list=( $(gdate -d

Upgrade Pip error message

回眸只為那壹抹淺笑 提交于 2019-12-10 15:56:13
问题 When i run pip install --upgrade pip I get this error message: Collecting pip Downloading pip-8.1.0-py2.py3-none-any.whl (1.2MB) 100% |████████████████████████████████| 1.2MB 371kB/s Installing collected packages: pip Found existing installation: pip 8.0.2 Uninstalling pip-8.0.2: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip/commands

gzip & tar Error when installing Tomcat (Ubuntu)

99封情书 提交于 2019-12-10 15:52:49
问题 I'm working on a project, but I need to use Apache Tomcat to run my user interface. I'm also running my project on Ubuntu though Virtualbox. I am following this tutorial on installing Tomcat: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04 However, when I type this command in the terminal : sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1 I get the following error: -C /opt/tomcat --strip-components=1 gzip: stdin: not in

How to test if result of a command contains a string in fish shell?

我是研究僧i 提交于 2019-12-10 15:17:31
问题 I'm trying to write a brief function to allow me to toggle wemo lights on and off from the command line. Basically I have a command that if i type wemo status will return either Switch: Lights 1 if the lights are on or 0 if they are off. I'd like to write a fish function that essentially lets me toggle them: function lights --description 'Toggle lights' if contains (wemo status) "Lights 1" wemo switch "Lights" off else wemo switch "Lights" on end end Though this doesn't work. I'm thinking

“sudo pip install Django” => sudo: pip: command not found

孤人 提交于 2019-12-10 15:15:13
问题 This what my terminal is saying when trying to install Django. MacBook-XXXX:~ Stephane$ sudo pip install Django sudo: pip: command not found I have tested in idle shell if pip is installed: >>> import easy_install >>> import pip >>> What am I doing wrong? 回答1: you need to install pip sudo easy_install pip 回答2: pip is a package management system used for installing packages written in python. So first install pip and then Django . sudo apt-get install python-pip. And for installing django ,