w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JLabel wont change when i run from command line
Add the following lines of code System.out.println( "displayOil :" + displayOil ); just after you create each variable. You'll know if your code gets until there. If the message is not output to the console, then an exception is interrupting your code. Otherwise, your method has a throws Exception declaration. this is not good code practice since we don't know anything from what exceptions the method can throw (therefore, where it could have issues). You should rather be more specific in your exception declaration: eg. throws JDBCException, BusinessException that way, you know what to expect from it. Also, never do a catch(Exception ex) {} you can loose hours and days of debugging because of this line (depending on the size of your project). If you really don't know what

Categories : Java

Change a command line argument argv
Did you try debugging? If you do, you will see that it never attempts to erase anything. You can't compare strings (char*) with simple equality, because in reality you're comparing pointers, which will (almost) never be equal. Instead, you should use string comparison functions, like this: if (!strcmp(argv[i], "--item")) { Also, since you're overwriting the argument, you don't need to use a lot of spaces, you can simply set it to an empty string (argv[i] = ""), or modify the existing string to make it empty (argv[i][0] = 0). Alternatively, you could shift the rest of the arguments so you don't end up with gaps which could confuse the rest of your code.

Categories : C++

How can I use python command line arguments that change at run time?
The whole configuration is done at runtime. The examples use string constants for the names, but you are not bound to that. You first load the configuration, then when you have all the elements, simply loop over those and register them as arguments: parser = argparse.ArgumentParser(....) for element in configuration_elements: parser.add_argument('--' + element, type=float, ...) then parse your command line. Alternatively, argparse.ArgumentParser() as a partial parsing mode as well; simply call parser.parse_known_args() to parse everything that argparse does know about, it'll return a namespace object (all the options it could parse) and the remaining arguments it didn't know how to handle: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--foo')

Categories : Python

Change Google Chrome Homepage - Command Line
It's possible to do it on IE and Firefox (with some inline Java manipulation within the batch) but so far I've also not been able to find an answer to this question. There's really nothing to try when the info on how to do it doesn't exist. The closest I've gotten is(run this in the Chrome.exe directory): chrome.exe -homepage "cnn.com" Which spawns chrome and the page cnn.com. But it doesn't actually change the homepage. So the next time you start up Chrome, it's back to whatever your home page was originally set to.

Categories : Google Chrome

System() / windows Command line commands don't change the directory?
Assuming that the C# tag is accurate, this is not the correct way to do that. Look at the Directory class. Specifically Directory.EnumerateFiles().

Categories : C++

Change 'play dist' output file name via command-line
You can modify the output by changing the build.sbt file in your project directory. name := "myname" version := "1.0-SNAPSHOT" Remember to recompile, might have to clean too.

Categories : Scala

Flyway command line filesystem migrations from actual command line input
flyway.cmd -configFile=/path/to/other/configFile.conf should do what you want. I just checked and it seems I forgot to document this on the website (It is in the usage description of the tool itself). Could you file an issue against the website, requesting this to be added?

Categories : Windows

Piping output from 1 command to other command in an adb shell command line
One way is to create a shell script containing the commands you want and then run the shell script. Since the Android root filesystem is not writeable at run time (usually, unless you have rooted your device and remount it), you can copy the file to the removable (or emulated) storage, for example /sdcard. Then run the script using the command adb shell sh /sdcard/your-script-name. Because each script runs in its own subshell, both of your commands will be executed in the same shell on the device (you can confirm it with ps).

Categories : Android

unix command line cut and remove new line, unwrap next line
This awk one liner can do it: $ awk '{if ($0 ~ /&$/) {getline a; print $0,a} else {print }}' file it gets the lines ending with & and joins them with the next one. Otherwise just prints the line. Test $ awk '{if ($0 ~ /&$/) {getline a; print $0,a} else {print }}' file A7233334 PALLETS 2 11.000 EACH 2331 Storm Supply 247.5000 2,722.50 2,722.50 4144 Gentro Sales 225.0000 2,475.00 2,475.00 5155 Wacca Outfit 225.0000 2,475.00 2,475.00 6661 Acme Warehouse & Fuller Supply 225.0000 2,475.00 2,475.00 1661 McHugh & Donaldson

Categories : Unix

Changing Ruby versions with rbenv from system and "shell" command does not work
Oops! Looks like somebody stuttered. $ ls $HOME/.rbenv/libexec/*shell* /home/tim/.rbenv/libexec/rbenv-sh-shell Looks like there is no shell command, but rather a sh-shell command $ rbenv sh-shell rbenv: no shell-specific version configured Yup. Let's see, if we link to it with a rbenv-shell $ cd $HOME/.rbenv/libexec/ $ ln -s rbenv-sh-shell rbenv-shell then we should get a working shell command $ rbenv shell rbenv: no shell-specific version configured

Categories : Ruby

Command works in command line but gives 'no such file or directory' in bash script
Remove the quotes around line 8. Like this: ./optAlg.exe "$inputFile" 500 2>&1 > "output/$outputFile" By placing quotes around the whole line you tell bash to execute a command which is called exactly ./optAlg.exe $inputFile 500 2>&1 > output/$outputFile and of course there is no such command. In reality you want to run ./optAlg.exe with parameters. Do not forget to place quotes around the variables because otherwise filenames that have whitespace characters are going to be passed as several arguments. Please read about arguments. And you can read about common pitfalls as well.

Categories : Bash

How to get command-line equivalent of command entered in Task Scheduler
schtasks /query /? schtasks /create /? the first has an option to export to xml, the second one as an option to import from xml. If you have only one or a few tasks to schedule, I would create them "the hard way" with schtasks /create

Categories : Windows

php sudo shell_exec command runs from command line, but not from browser
Would it be out of the question to make a shell script that would run your command? #!/bin/sh sudo whoami in the php: $retVal = `/path/to/custom/script/myscript.sh &2>1`; if ($retVal) echo 'SWEET'; else echo 'POOP: ' . $retVal; {command} inside `` means the same as shell_exec('{command}') on a linux server. If I'm not way off base here your goal is to add users to your VPN (among other things perhaps) in which case you could pass command-line parameters for username/password/etc to your custom shell script. It's not exactly a pure shell_exec() answer to your question, but maybe you can run myscript.sh without doing sudo. Just basing this on the fact you said everything you tried worked in shell and path was set in echo $PATH, but not sudo echo $PATH in your PHP script. Seem

Categories : PHP

How to issue a command from the command line of a process running on Linux
If you don't mind waiting for the calls to finish (one at a time) before returning control to your program, you can use the subprocess library. If you want to start something running and not wait for it to finish, you can use the multiprocessing library.

Categories : Python

Batch file/command to start a program through command line
I'll edit this if you respond to my comment but if you want to simply execute this command via a batch file (and you know nothing about batch files): Open a text editor (e.g.Notepad) Type in your command (e.g. c: andaotherfoldermyprogram.exe 10 20) Save the file as mybatchfile.cmd Double click the file (in Windows Explorer etc.)

Categories : Windows

Defining the command line arguments of a linux command in python
format is your friend: import os, sys if len(sys.argv) == 2: os.system("sudo rtcwake -m off -s {}".format(sys.argv[1])) else: print "usage: ..." so the seconds are command line parameters. Or, you can make it interactive: import os secs = raw_input() os.system("sudo rtcwake off -s {}".format(secs)) to verify that the user input is an integer: try: secs = int(secs) except: print 'usage: '

Categories : Python

different order of command line options in a command affecting my output
getoptlong() is doing exactly what it is supposed to do. The format-string "d:g:hv" implies that the parameters d and g require a value. Anything specified following a command-line parameter is consider a value being passed to it. You should run your program as $program --download file --version Checkout this detailed example demonstrating the various aspects of using getoptlong(). How rm can handle the differing position of its cmd-line params? Apparently because rm's parameters (r, v etc.) do NOT accept any values as arguments. Thus directory does not get passed to any of them but rather is a separate cmd-line argument on its own. You can confirm this from the source-code of rm. To do something similar for your program, you will need to modify the optstring to "dghv" a

Categories : C

PHP exec command works in shell and php command line but not on website
You can add the second parameter to help debug, $output will display what the cp command is doing, whether it be an error or not. I would also recommend placing quotes around the files, just in case something with a space gets in there. $src = "/mnt/..."; $dest = "/var/www/..."; exec("cp '$src' '$dest'", $output, $retrun_var); var_dump($output, $retrun_var);

Categories : PHP

Always given command line before python fabric command is executed on remote
Interesting, I don't have such issue, your code works fine for me (up to adding env.key_filename and env.password) c:work>fab hello [x.x.x.x] Executing task 'hello' [x.x.x.x] run: touch hello.world Done. Disconnecting from x.x.x.x... done. I'm using Fabric 1.7.0 and Paramiko 1.11.0. Possibly it's a problem of the terminal on your server.

Categories : Python

How do I set a command-line flag when running a Symfony2 Command test?
disabling debug in the kernel You can initialize the kernel in your test's setUp() method with debug set to false. use SymfonyBundleFrameworkBundleTestWebTestCase; class YourCommandTest extends WebTestCase { public function setUp() { static::$kernel = static::createKernel(array('debug' => false)); static::$kernel->boot(); // ... } Have a look at WebTestCase->createKernel(). using enviroments If you don't want the debug output in your logs edit/create app/config/config_test.yml and edit ... monolog: handlers: file: type: stream level: debug # log-level ... ... to another log level that suits your needs. Then execute your command using the test environment with --env=test

Categories : PHP

How Can Be Used the Command Line of Developer Command Prompt in Vim on Windows?
You need to setup your PATH, INCLUDE and LIB environment variables. You could do that by running D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat (or wherever it is located on your installation) in the same prompt you're running vim, or even manually setting these environment variables (here is a list of all values for VS2008 and Windows SDK: Using Visual Studio's 'cl' from a normal command line). However, you just can't run the bat file from vim directly, because it will open another Prompt, so the environment variables will be set only for that new prompt. The other option is just to create bat file which you can put it inside your PATH, for example cvim: call "D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" "C:Program Files (x86)Vimvim74g

Categories : C++

Remote command execution from command line in Windows XP
Maybe you could do that via Windows Scripting Host (WSH) which supported remote execution. See Setting up Remote WSH. The article contains a link to examples. (You may need to use the WshShell object to invoke taskkill from your remote script.)

Categories : Windows

Trouble running android command in command line
What Am I missing? You are missing two ~ characters, perhaps. The exact path is /Users/me/Development/adt-bundle/ That's not what you typed into your PATH. Your PATH says that there is no /Users/me -- instead, PATH is expecting a /Development directory in the root of your volume. Now, in Linux, the solution would be to add a ~ to indicate that /Development is relative to your home directory: export PATH=${PATH}:~/Development/adt-bundle/sdk/platform-tools:~/Development/adt-bundle/sdk/tools My OS X shell experience is rusty, so I forget if ~ will map to /Users/me or not. If it does, use ~, otherwise, go with: export PATH=${PATH}:/Users/me/Development/adt-bundle/sdk/platform-tools:/Users/me/Development/adt-bundle/sdk/tools

Categories : Android

Is there a command I can use to sign my modified apk on the command line in Linux?
For this you use standard Java SE tools: jarsigner and keytool. From Android documentation on signing: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name Remember that you should first sign and then align.

Categories : Android

how to read multiline output command line by line, in a shell script?
Maybe I found a different solution, where I can use variables also outside the loop I have to change the default IFS to newline echo Searching for android virtual devices ... IFS=$' '; for l in $(${PROGDIR}/android list avd) ; do VAR1=$(echo $l | cut -d: -f1 | sed -e 's/s*//'); #sed removes trailing blanks if [ $VAR1 == "Name" ]; then NUM_AVD=$(($NUM_AVD+1)); fi; done echo "NUM_AVD=$NUM_AVD" In this case NUM_AVD is correctly 2

Categories : Shell

Reading input files by line using read command in shell scripting skips last line
DONE=false until $DONE do read line || DONE=true echo $line done < blah.txt How to use `while read` (Bash) to read the last line in a file if there’s no newline at the end of the file?

Categories : Bash

How to get command line output snippet if I know the line number in Windows?
Here's one way of doing it with a batch file, although it's not a very elegant solution. @echo off setlocal set currentservice="" set servicestate="" sc query state= all > services.txt for /f "delims=:; tokens=1,2" %%a in (services.txt) do call :findservice "%%a" "%%b" del services.txt echo %servicestate% endlocal goto :end :findservice if not %1 == "SERVICE_NAME" goto :findstate set currentservice=%2 goto :end :findstate if not %1 == " STATE " goto :end if not %currentservice% == " Telnet" goto :end set servicestate=%2 goto :end :end It first writes out the result of the sc query to a temporary file (services.txt). It then uses a for loop to process each line of that file. When it find a line starting with SERVICE_NAME, it saves the value of that name in t

Categories : Windows

Read all files line by line in a directory and do a command on them
If you want to save the file names in a variable, use array=(a b c) syntax to create an array. There's no dollar sign. Then loop over the array with for item in "${array[@]}". To read from a file with a while read loop, use while read; do ...; done < "$file". It's odd-looking, but the file is redirected into the loop as a whole. files=(/dos2unix/*.txt) for file in "${files[@]}"; do while IFS=',' read -ra line; do ... done < "$file" done Another way is to use cat to concatenate all the files together, which lets you get rid of the outer for loop. cat /dos2unix/*.txt | while IFS=',' read -ra line; do ... done

Categories : Bash

How to open Command Prompt, change directory and execute a command using Java code (Windows)
If you just want to run an application with a specific working directory, the easiest way is to use a ProcessBuilder: ProcessBuilder pb = new ProcessBuilder(executable, arguments, if, any); pb.directory(theWorkingDirectory); pb.start();

Categories : Java

How to use command prompt using c# and getting the results line by line?
I think you have to use a dedicated thread to read every new line from the StandardOutput stream, something like this: //This will append each new line to your textBox1 (multiline) private void AppendLine(string line) { if (textBox1.InvokeRequired){ if(textBox1.IsHandleCreated) textBox1.Invoke(new Action<string>(AppendLine), line); } else if(!textBox1.IsDisposed) textBox1.AppendText(line + " "); } //place this code in your form constructor Shown += (s, e) => { new Thread((() => { while (true){ string line = CMDProcess.StandardOutput.ReadLine(); AppendLine(line); //System.Threading.Thread.Sleep(100); <--- try this to see it in action }

Categories : C#

Command line app: Unix cd command
Because system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. So each command is executed independently, each in a new instance of the shell. So your first call spawns a new sh (with your current working directory), changes directories, and then exits. Then the second call spawns a new sh (again in your CWD). See the man page for system(). The better solution is to not use system. It has some inherent flaws that can leave you open to security vulnerabilities. Instead of executing system() commands, you should use the equivalent POSIX C functions. Everything that you can do from the command-line, you can do with C functions (how do you think those utilities work?) Instead of system("rm -rf ...") us

Categories : Unix

Chrome keeps all versions of my hosted app/extension (takes up MB's). How tell it to remove old versions? To downgrade?
https://code.google.com/p/chromium/issues/detail?id=126394, basically same issue. No. But you can delete them yourself by dragging them to the trash. The extension isn't kept in local storage or the HTML5 filesystem, so no. No.

Categories : Google Chrome

Is there a reference table which shows which mysql versions are supported by which rails versions?
I don't think it should be in Rails documentation. The reason is that communication with DB is handled via adapters and is not in core rails functionality, so it is a matter of compatibility between rails and some particular adapter (mysql or mysql2 for example for MySQL) rather than between rails and some particular DBMS. Adapter is a 3rd party product, so how the rails team can be responsible for it? You should find out 2 things - 1) which adapter works for MySQL 5.5 and 2) with which rails versions that adapter can be used. In any case you should focus on adapter, not on rails if you want to use some particular DBMS.

Categories : Mysql

Server is serving old versions of static files, but trimmed or padded to match length of new versions
In the end it turned out that this was probably being caused by VM issues. The code in question was located on a Windows drive, but was being served from within a Linux VM that was accessing the code via a shared directory. Remounting the share seemed to fix the problem (although not necessarily reliably).

Categories : Caching

Java EE Application Servers and JDK versions need to match certified versions?
your main argument should be that java 6 has been EOL'ed by Oracle and will not be getting any new (freely available) security updates. should you ship a jdk-6-based product some of your customers will definitely complain about it (i know some of the customers of the company i work for routinely scan products they buy and install and notify vendors of any EOL'ed or known-to-be-insecure versions in use).

Categories : Java

How is interacting with a prompt of a third party command line program different from a Windows Command prompt?
Most likely the program starts its own shell and does no longer interact with the original one. (You would notice this if the program opens a new window) Or the program needs some specific library to be present to be able to interact with a shell (readline seems to be the case here) and that is not present in your Java Environment. As a quick hack you might try to start bash (or cmd) that then starts the tool. bash and cmd have readline library. I don't have a windows ready here but as a guess just try to call your program like cmd urjtag.exe instead of just urjtag.exe that way you start a cmd process (with that you can interact) and that cmd starts the urjtag.exe where you already know that it can interact with. Either way the problem lies in the way the program you want to call intera

Categories : Java

How to change/re-write git history to include original versions of files, unavailable at time of git init
You are going to have multiple problems: First, in order to track a file with git, you need to put it into a repository. Configuration files are scattered around your file system, so you cant just put them all into one repository. Second, some configuration files may change even if their content stays the same. Think of an .xml file that gets read and written again. The structure may have changed, even though it actually contains the same content.

Categories : GIT

Change the color of line draw line android
Because Path itself doesn't contain any information about it's color (color is managed by Canvas) I would suggest you to create new pair of (Path, Paint) for every new path with different paint and use only current pair in onTouch event. So here is some code which illustrate this idea public class ColoredPath { private Paint paint; private Path path; public ColoredPath(Paint paint, Path path) { this.paint = paint; this.path = path; } public Paint getPaint() { return paint; } public Path getPath() { return path; } } private List<ColoredPath> paths = new ArrayList<ColoredPath>(); public DrawerView(Context context, AttributeSet attrs){ super(context, attrs); //custom paint can be used here paths.ad

Categories : Android

Eclipse compareEditor showing change line by line
This : CompareConfiguration configuration = new CompareConfiguration(); CompareUI.openCompareDialog(new CompareEditorInput(configuration) { @Override protected Object prepareInput(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { String text1 = "line1 line2 line3 "; String text2 = "testline line1 line2 line3 "; CompareItem left = new CompareItem("1", text1); CompareItem right = new CompareItem("2", text2); DiffNode diffNode = new DiffNode(left, right); return diffNode; } }); Works perfectly for me on Kepler. So I thinks you're not giving us enough data.

Categories : Eclipse

why "extra characters after command" error shown for the sed command line shown?
It appears that some of the variables are expanding to values that contain a /. Use a different delimiter that isn't contained in any of the variables, e.g. sed 's@dump 0 $2 $3 $4 $5@dump 1 $2 $3 $4 $5@g' base_file.properties (Your first command isn't a valid sed expression.)

Categories : SQL



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.