terminal

Enable MCrypt using MAMP

人走茶凉 提交于 2019-12-24 08:50:45
问题 I'm using MAMP and ive installed a fresh version of Opencart, its telling me i dont have MCrypt enabled, when i go to terminal and type: php -m | grep mcrypt output: mcrypt I can locate the library but it doesn't seem to be enabled. 回答1: That fact that php -m | grep mcrypt returns mcrypt , means the mcrypt library is INSTALLED and ENABLED. Although it may just be enabled for CLI. You can try editing the PHP.ini file and adding the following line under the ; Extensions section: extension

How can I make my shell script executable

僤鯓⒐⒋嵵緔 提交于 2019-12-24 08:23:39
问题 I wrote a shell script wich opens some directories and run some script , I run this bash file by terminal (bash filename.sh), how can I make it clickable ? 回答1: You first need to start your script with '#!/bin/bash ' and save it as < filename >.sh Also make sure that you keep the permissions as a+x i.e all users can execute the script. 回答2: You need to add the following shebang line to the top of your code. #!/bin/bash You also need to ensure that the script has executable permissions by

Read from the terminal in Python

ぐ巨炮叔叔 提交于 2019-12-24 07:38:02
问题 How can I receive input from the terminal in Python? I am using Python to interface with another program which generates output from user input. I am using subprocess.Popen() to input to the program, but I can't set stdout to subprocess.PIPE because the program does not seem to flush ever, so everything gets stuck in the buffer. The program's standard output seems to be to print to terminal, and I see output when I do not redirect stdout. However, I need Python to read and interpret the

How should I add a stationary progress bar to a C++ program that produces terminal output (in Linux)?

我的未来我决定 提交于 2019-12-24 04:02:06
问题 I have an existing program that contains a loop over files. It does various things, providing lots of terminal output. I want to have an overall progress bar that remains stationary on the same line at the bottom of the terminal while all of the output from the file operations is printed above it. How should I try to do something like this? EDIT: So, just to be clear, I'm trying to address the display problems inherent in something a bit like the following: #include <unistd.h> #include

issues with getsitepackages under a virtualenv

此生再无相见时 提交于 2019-12-24 03:52:51
问题 I wanted to check out which Python interpreter was running under my virtual env so I just entered the virtualenv and used getsitepackages. This is what came out. (test)~/Documents/Development/test$ python Python 2.7.9 (default, Apr 7 2015, 07:58:25) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import site >>> print site.getsitepackages() Traceback (most recent call last): File "<stdin>", line 1, in

How to detect screen resize events coming from ncurses in QNX?

安稳与你 提交于 2019-12-24 03:25:37
问题 I can not configure to receive events about changing the size of the terminal using ncurses QNX Momentics. I am using Putyy as a terminal and data is transmitted through the COM port. My question is how to realize the reception of screen change events when using a remote terminal? FILE* fcons = fopen("/dev/ser1", "r+"); SCREEN* term = newterm("xterm-r5", fcons, fcons); int y = 0, x = 0; //if(y < 24 || x < 80) // resizeterm(24, 80); flushinp(); main_scr = newwin(24, 80, 0, 0); head_scr =

Find and rename all pictures with incorrect file extension

走远了吗. 提交于 2019-12-24 03:23:30
问题 I'm looking for a way to automate renaming all images with a wrong filename extension. So far I at least found out how to get the list of all these files: find /media/folder/ -name *.jpg -exec file {} \; | grep 'PNG\|GIF' > foobar.txt find /media/folder/ -name *.png -exec file {} \; | grep 'JPEG\|GIF' >> foobar.txt find /media/folder/ -name *.gif -exec file {} \; | grep 'JPEG\|PNG' >> foobar.txt However, I would also like to automate the renaming. I tried things like find /media/folder/ -name

What does “if [ -t 1 ]” do in shell scripting?

泪湿孤枕 提交于 2019-12-24 02:07:54
问题 I have code for setting the zsh as default shell: if [ -t 1 ]; then exec zsh fi What exactly does the command if [ -t 1 ] do here? 回答1: if command; then other_command; fi runs command and then, if that command exits with a return code of 0 ("success"), runs other_command . The command [ ... ] is designed to take the place of the Boolean expressions that you find in traditional programming languages. It has a number of options for what goes between the brackets and exits with 0=success if

How to signal EOF of stdin when in mac osx terminal?

穿精又带淫゛_ 提交于 2019-12-24 01:18:31
问题 I know that in linux's terminal, it's ctrl+D. I also searched that in OSX's terminal. Someone said it's Control+Q, Control+D,return. But this 3 step command doesn't work on my computer. 回答1: Just use Ctrl-D, it would do the work in any terminal. 来源: https://stackoverflow.com/questions/15848134/how-to-signal-eof-of-stdin-when-in-mac-osx-terminal

Memory leak when running python in Mac OS Terminal

我与影子孤独终老i 提交于 2019-12-24 00:57:26
问题 I just ran a python program in the Mac OS Terminal, and there is unusual memory leak. The program is simple like this: for i in xrange(1000000000, 2000000000, 10): i2 = i * i print i, i2, str(i2)[::2] if str(i2)[::2] == '1234567890': break When the program is running, it consumes more and more memory till it use up all my memory. When I terminate the program, my Terminal.app still consumes a lot of memory, so I guess it's a bug in Terminal.app? Does anyone have similar experience? 回答1: This