command

(Django) Create a management command that will override the default settings in BaseCommand

送分小仙女□ 提交于 2019-12-06 08:18:54
We always run our tests off of settings_test, like so: ./manage.py test someapp --settings=settings_test. The problem is that it's sometimes problematic to remember to add the option. I'd like to introduce a common app that just has the management command test.py. Depending on it's placement in the INSTALLED_APPS setting, it will override the default. Inside the command itself, I'd like to change the default of the --settings option. How can I do that? I am aware that I can create a local.py file that is similar to manage.py but with settings_test instead of settings. However, the point is to

Java Terminal Only Printing Output From First Command

旧时模样 提交于 2019-12-06 08:04:23
EDIT: The code now works! Here's how I did it: package me.nrubin29.jterminal; import javax.swing.*; import javax.swing.filechooser.FileSystemView; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.*; import java.util.ArrayList; public class JTerminal extends JFrame { private JTextPane area = new JTextPane(); private JTextField input = new JTextField("Input"); private SimpleAttributeSet inputSAS = new SimpleAttributeSet(), output = new SimpleAttributeSet(),

Programatically change icon for a eclipse RCP command

我怕爱的太早我们不能终老 提交于 2019-12-06 07:59:07
问题 I have a menu drop down action in the coolbar. It has 3 sub items that form a radio group. I would like to change the icon shown in the coolbar when the user selects one of these options. I've googled and seen that I should look at: org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) and org.eclipse.ui.commands.IElementUpdater Its probably the right thing to look at exception its not enough information. One or two small code snippets will be excellent. Thanks in advance. 回答1:

How to store the output of batch (CALL) command to a variable

天涯浪子 提交于 2019-12-06 07:43:35
I have the batch file which has the command to call second.bat file. It will produce single line of output when it called. I want to store that line into variable. CALL second.bat I have tried using the following lines of commands but no use FOR /F "tokens=* USEBACKQ" %%F IN ('COMMAND') do SET result=%%F FOR /F "tokens=1 delims= " %%A IN ('COMMAND') DO SET NumDocs=%%A I don't know what to replace with COMMAND Joey As the help will tell you, COMMAND should be the command you want to run and get the output of. So in your case second.bat . At least it works for me: @echo off FOR /F "tokens=*" %%F

How to login to an ftp server using shell scripting in linux?

随声附和 提交于 2019-12-06 07:31:02
问题 I want to login to my FTP server using shell scripting. I made a .sh file having contents as ftp open 172.31.1.45 but it's not working. The second command is not executing. Please help. I am new to linux so please forgive if this is a stupid question 回答1: try this: #!/bin/sh HOST="yourhost" USER="user" PASSWD="pass" FILE="file.txt" ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT 回答2: If it's just a matter of simple file transfers, you might want to look

Installing an APK using pm command

无人久伴 提交于 2019-12-06 07:15:32
I tried updating an APK using this code: Process process; process = Runtime.getRuntime().exec(new String[] {"su", "-c", "pm install -r -d"+MyApk.apk}); but it does not work. This works well when I use it with adb like: adb shell su -c pm install -r -d /system/app/Community-debug.apk It also works fine if it has to ask for user permission in order to install like using the intent method. Your application would need to run as System user to access this level of commands. It cannot be done in any way if your app is distributed using standard channels, e.g. Google Play, installing from SD card, or

How do run a Unix command at a given time interval?

大兔子大兔子 提交于 2019-12-06 06:21:52
问题 I want to run a Unix command (e.g. ls ) at 5 minute intervals through a script. Explanation: I have a Unix script. In that script I have a command called "ls". I want that "ls" command to run every 5 minutes from that script. 回答1: Use watch . The -n flag specifies interval in seconds, so watch -n 300 ls 回答2: while true; do ls sleep 300 done ? 回答3: Put your script into the Crontab via crontab -e More information about Cron you can find at wikipedia 回答4: You could use crontab for example. See

Occasionally connected CQRS systems - Client and Server Commands - Task based screens

最后都变了- 提交于 2019-12-06 06:19:06
Premise: It is recommended that in CQRS+DDD+ES style applications use task based screens, these screens guide the user and capture intent. These task screens can also be referred to as Inductive User Interface . Some examples of UI design guidelines that can help you create mondern, user-friendly apps: Microsoft Inductive User Interface Guidelines and, Index of UX guidelines The way I understand it, the tasks , generally speaking, should line up with Commands or Functions waiting on the Server. For example, if the User makes a change to the Customer's [first name], generally speaking this

Running command with with space argument value with apache command line

蹲街弑〆低调 提交于 2019-12-06 06:16:59
I'm using apache command line library and I want to execute from java program git stash list --format=%gd:%at:%B --grep="some text with space" this is the code commandLine.addArgument( "--grep=\"" + filter+"\"", false); it is run on windows without any problem but on linux does not. If i execute the command from terminal it is execute correctly I also tried to let apache library to put quoting commandLine.addArgument( "--grep=" + filter); but i get fatal: bad revision '"--grep=text message"' VonC While there is a bug around quotes managements in Common Exec , this answers suggests : // When

How to execute a normal mode command in a vim function?

戏子无情 提交于 2019-12-06 05:47:58
I am writing a vim function to insert some text in a c++ file, please see the following function: function! InsertDebugInfo() let i = line('.') call append(i+1, '#ifdef DEBUG') call append(i+2, 'std::cout << "" << std::endl;') call append(i+3, '#endif') call append(i+4, '') call cursor(i+3, 0) endfunction In normal mode, I use == to re-indent one code line. My question is how to call == in the above function. Furthermore, how to execute the command such as 2f" which move the cursor to the second " . To indent, you can just use normal == To find also you can use normal 2f" or even shorter norm