w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
make file multiple executables
As per the standards every directory will contain one Makefile. So you can have three Makefiles for this job done if you have three directories. (d) common | |---(f) common.h |---(f) common.c |---(f) Makefile --- MAkefile for the common folder. (d) app | |---(f) app.h |---(f) app.c |---(f) Makefile (d) unittest | |---(f) unittest.h |---(f) unittest.c |---(f) Makefile (f) Makefile --- invoke all makefiles in the mentioned order. If you want one Makefile to happen all these done, you can do in that way also. Here you have to compile the files by providing paths of the files. order is most impotent.

Categories : C

Executables deployment in multiple servers regularly
There are many system management tools. Chef is what we use, it is great but there is a bit of a learning curve. You may want to look into your OS's default package manager and distribute packages of your code base.

Categories : Shell

Python passing arguments to already running executables
You need interaction, a way to start a process, and then monitor its output and be able to pass input to the process.. Python has this, it is called subprocess.Popen. There are many examples of similar questions and answers here on StackOverflow. For example: Running an interactive command from within python Python - How do I pass a string into subprocess.Popen (using the stdin argument)? And many more.

Categories : Python

Turning files of Python code into executables
You need to do ./brian. Unix will then look for it in the current directory. Your current directory may not be in the system path and hence it is unable to find a command named brian.

Categories : Python

How to structure Python code to support multiple releases of MY project (i.e. not multiple versions of Python)
Your subprocess offers an API to the web sites. The trick is to make it so that API v2 of the subprocess code can handle calls from both v1 and v2 web sites. This is called backward compatibility. Also, it's nice if the v1 web site is not too picky about the data it receives and can for instance handle a v2 answer from the subprocess that has more information than it used to have in v1. This is called forward compatibility. Json and xml are good ways to achieve it, since you can add properties and attributes at will without harming the parsing of the old properties. So the solution, I think, does not lie in a python trick, but in careful design of the API of your subprocess such that the API will not break as the subprocess's functionality increases.

Categories : Python

Running executables iOS
I was able to call some command line applications using NSTask as described here: NSTask or equivalent for iPhone Including the NSTask.h header file from Mac OS X was enough to get this working on my jailbroken device.

Categories : IOS

PHP Exec Won't Launch Executables
It looks like you are: on Windows trying to launch an external program asynchronously Here is the secret sauce that will allow you to do so: function async_exec_win($cmd) { $wshShell = new COM('WScript.Shell'); $wshShell->Run($cmd, 0, false); // NB: the second argument is meaningless // It just has to be an int <= 10 } This requires the COM class to be available to your PHP instance, you may need to enable extension=php_com_dotnet.dll in php.ini (since PHP 5.3.15/5.4.5) in order to make it available. Also note that this will require a full file name of the file you wish to execute, as the extension search list will not be used outside cmd.exe. So instead of srcds -console ... you'll want srcds.exe -console ... - personally I don't l

Categories : PHP

Java library for finding executables
Use the where command on Windows. WHERE [/R dir] [/Q] [/F] [/T] pattern If you do not specify a search directory using /R, it searches the current directory and in the paths specified by the PATH environment variable. Here's a sample code that finds the two locations where notepad.exe resides on Windows. String searchCmd; if (System.getProperty("os.name").contains("Windows")) { searchCmd = "where"; } else { // I'm assuming Linux here searchCmd = "which"; } ProcessBuilder procBuilder = new ProcessBuilder(searchCmd, "notepad.exe"); Process process = procBuilder.start(); ArrayList<String> filePaths = new ArrayList<String>(); Scanner scanner = new Scanner(process.getInputStream()); while (scanner.hasNextLine()) { filePaths.add(scanner.nextLine()); } scanner.close(

Categories : Java

compiling .py into windows AND mac executables on Ubuntu
From the pyinstaller FAQ: Can I package Windows binaries while running under Linux? No, this is not supported. Please use ​Wine for this, PyInstaller runs fine in Wine. You may also want to have a look at ​this thread in the mailinglist. In version 1.4 we had build in some support for this, but it showed to work only half. It would require some Windows system on another partition and would only work for pure Python programs. As soon as you want a decent GUI (gtk, qt, wx), you would need to install Windows libraries anyhow. So it's much easier to just use Wine. In other words, you cannot simply run a command in Linux to build a Windows executable (or a Mac executable for that matter) like you are trying to do. The workaround they have provided for Windows (and o

Categories : Python

using c executables / methods in an android ndk project
Rename your main function or put another wrapper around it. If you want your native function to be named as cansend(), your wrapper function should be something like this: #ifdef __cplusplus extern "C" { #endif JNIEXPORT void Java_com_aaa_bbb_ccc_cansend( JNIEnv* env, jobject thiz); #ifdef __cplusplus } #endif Here, com_aaa_bbb_ccc comes from your package name of your java code which contains public native void cansend();. For example, if your package name is com.example.test, your function name will be: Java_com_example_test_cansend();

Categories : Android

Why do Phantom, Casper, and Meteor need their own executables?
phantomjs is completely separate from node: http://phantomjs.org/faq.html Q: Why is PhantomJS not written as Node.js module? A: The short answer: "No one can serve two masters." A longer explanation is as follows. As of now, it is technically very challenging to do so. Every Node.js module is essentially "a slave" to the core of Node.js, i.e. "the master". In its current state, PhantomJS (and its included WebKit) needs to have the full control (in a synchronous matter) over everything: event loop, network stack, and JavaScript execution. If the intention is just about using PhantomJS right from a script running within Node.js, such a "loose binding" can be achieved by launching a PhantomJS process and interact with it. CasperJS is built on top of node, so it

Categories : Node Js

Is there any valgrind command to run for more than one executables in one shot
There's no single valgrind command to do it, but it's trivial to do in shell: #!/bin/zsh for exe in *(*) do valgrind --log-file="${exe}.log" --leak-check=full "${exe}" done

Categories : Python

Include IE executables in Eclipse RCP project
No, for both licensing and technical reasons, you cannot embed and redistribute IE10 executables. Doing so would violate Microsoft's copyright, and it wouldn't work anyway because IE10 does not support a non-installed "side-by-side" configuration.

Categories : Internet Explorer

Shared variable between different executables in Linux
The execve will drop all mappings in the kernel, so this technique will not work. What you can do instead is open a file (as in Vaughn's suggestion) and pass the descriptor to the child process. Open file descriptors are unchanged across an exec. Then you can map it in the child. Alternatively, investigate APIs like shm_open()/shm_unlink() which will manage a global file mapping such that other processes can use it, not just a child. But basically: you have to mmap() in the child, you can't pass anything in your address space to the child in Unix.

Categories : Linux

Pack two binaries(executables) into one file
In short no. You cannot have two main functions in one executable. You could rename the two mains to MethodA and MethodB then decide which to call based on the arguments you send to main i.e. the argv in int main(int argc, char** argv) Since you say you don't want to edit the source code, perhaps you are better off writing a script that calls the correct exe depending on the parameters.

Categories : C

Makefile that generates executables that run Node scripts
Have it generate a file with the following contents: #!/bin/sh node myscript.js "$@" And then have it mark the file executable (chmod +x myscript).

Categories : Node Js

Having spaces in Runtime.getRuntime().exec with 2 executables
Each argument you pass to the command should be a separate String element. So you command array should look more like... String[] a = new String[] { "C:path hat hasspacesplink", "-arg1", "foo", "-arg2", "bar", "path/on/remote/machine/iperf -arg3 hello -arg4 world"}; Each element will now appear as a individual element in the programs args variable I would also, greatly, encourage you to use ProcessBuilder instead, as it is easier to configure and doesn't require you to wrap some commands in ""...""

Categories : Java

Getting Permission Denied running perl executables
Make sure that the perl script itself is set to be executable. You can do this with a command like this: chmod +x /Users/Wes/Desktop/Perl_dir/phylo.pl And then make sure the first line of the script has an appropriate "hash-bang" line to invoke perl, something like: #!/usr/bin/perl -w With both of those in place, I think your scripts should start working. (Note: The -w isn't strictly necessary, and may cause warnings in your script. I do suggest it, though, for developing new perl code, since it encourages a certain brand of perl hygiene.)

Categories : Perl

CppUnit for unit-testing executables or ELFs?
CppUnit is a framework for automated unit testing, not automated system testing. System testing is just what its name implies. It's all about testing all the code modules together as a complete system from a user's point of view. Automated system testing is when you exercise your entire system from a test harness, providing it with specific user inputs and testing that the behaviors and outputs function as expected. Unit testing is all about testing the smallest possible unit of code from a code point of view, providing it with entry conditions and asserting the exit conditions are properly met. At its best, one unit test should exercise one path through a method on a public interface of a class, free of external dependencies on hard-to-provide resources like databases or services. U

Categories : Unit Testing

Can signing executables prevent antivirus quarantining?
If you're being rated as suspicious, the quickest way to resolve it would probably be to submit a white listing request. Since the software has been deemed suspicious by a heuristic/reputation based system, there's no guarantee that signing it will automatically white list it (although it will most likely raise the possibility)

Categories : C#

OS X Xcode/clang to build Windows executables?
After thinking why the hell would you want to do this?, I just surprised myself and found what may actually be a solution! The Cocotron The Cocotron is an open source project which aims to implement a cross-platform Objective-C API similar to that described by Apple Inc.'s Cocoa documentation. This includes the AppKit, Foundation, Objective-C runtime and support APIs such as CoreGraphics and CoreFoundation. Also see this blog post: Win-win with Cocotron and Xcode 4.3 — code for Mac, build for Windows (Part 1) Although the last entry on the Cocotron site was from 2010 - so it may or may not still be alive

Categories : C

C compiler cannot create executables - Cygwin/MiniGW
Current versions of Cygwin gcc do not support -mno-cygwin anymore because it never really worked correctly. Instead, you should use a proper cross-compiler, which is provided by the mingw64-i686-gcc packages, then run ./configure --host=i686-w64-mingw32.

Categories : Gcc

Gem::Specification.executables does not match that is created by `bundle gem` command
I have this problem as well. While seemingly intuitive, it doesn't appear to work for me at all. However, looking at other gems on GitHub, it looks like you can just specify the gem itself and the default /bin directory will be used spec.executables = ['MyGem'] EDIT: Looking back at this, kevinrivers' answer is also valid. FYI Bundler does assume you're using git, so both answers work (amongst many more - in fact, after I posted this answer I soon dug more into how gemspecs work, especially related to the inclusion of files, and I wrote a lot about it, if you're interested - http://chrisarcand.com/using-git-in-your-gemspec/).

Categories : Ruby

xCode 4.6.1 - Don't Create Position Independent Executables. Can't enable
You need to edit the Build Settings of the project target. Make sure that the IOS deployment target is over 4.3 or OSX is over 10.7. Generate Position-Dependent Code is set to "NO", and Don't Create Position Independent Executables is also "NO" If this doesn't fix you problem it might be that libraries that you have included in your project don't have these setting. What is the correct Xcode setting for Position Independent Executables might help.

Categories : Xcode

Is it possible to extract constants and other predefined values from binary executables?
Yes you could easily use a decompiler to extract those kinds of constants, especially strings (since they require a larger chunk of memory). This will even work in machine-code binaries and is even easier for VM-languages like Java and C#. If you need to keep something secret in there you will need to go great lengths. Simply encrypting the string for example would add a layer of security, but for someone who knows what she does this won't be a big barrier. For example scanning the the file for places with uncommon entropy is likely to reveal the key which was used for encryption. There are even systems which encode secrets by altering the used low-level commands in the binary. Those tools replace certain combinations of commands with other equivalent commands. But even thous systems are

Categories : Security

How to read executables stdout stderr from Java code?
Runtime tr = Runtime.getRuntime(); try { Process p = tr.exec("c:\a.bat"); InputStream err = p.getErrorStream(); InputStream std = p.getInputStream(); //TODO here we go! } catch (IOException e) { e.printStackTrace(); }

Categories : Java

How can I configure nginx and fcgi to call separate executables depending on request-uri
You can do it with nginx and fcgi. The simplest way to do this is, by using spawn-fcgi - First you will need to setup your nginx.conf. Add the following inside the server {} block - location /index { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } location /contact { fastcgi_pass 127.0.0.1:9001; include fastcgi_params; } location /view_post { fastcgi_pass 127.0.0.1:9002; include fastcgi_params; } Restart nginx and then run your apps listening same ports as declared in the nginx.conf. Assuming your programs are in ~/bin/ folder - ~ $ cd bin ~/bin $ spawn-fcgi -p 9000 ./index ~/bin $ spawn-fcgi -p 9001 ./contact ~/bin $ spawn-fcgi -p 9002 ./view_post Now the requests to localhost/index will forward to your index program and its output will go back to ngi

Categories : Nginx

How can I build executables which can be run in Window XP using Visual Studio 2012 and Intel Compiler XE 2013?
I found a solution in Intel official articles. http://software.intel.com/en-us/articles/linking-applications-using-visual-studio-2012-to-run-on-windows-xp

Categories : C++

Python Pass multiple variables through command to change multiple lines in a text file with regex
I replaced the for loop with the following code and it worked: with open('test1.txt') as f: line1 = f.readline() line2 = f.readline() line3 = f.readline() build = re.sub ('build='r'.*','build='+buildpath,line1) apps = re.sub ('apps='r'.*','apps='+appspath,line2) logs = re.sub ('logs='r'.*','logs='+logspath,line3) tf.write(build + apps + logs)

Categories : Python

Install OpenCV for Python (multiple python versions)
Use virtualenv virtualenv -p python2.7 env source env/bin/activate python --version # prints «Python 2.7.3» pip install pyopencv If you need support of 2.4 (or other version), just create new environment.

Categories : Python

Multiple python versions: How to set default python binary
Create a symbolic link python in /usr/bin and point it to /usr/local/bin/python2.7. Something like this should work: ln -s /usr/local/bin/python2.7 /usr/bin/python Make sure you have permissions to do that. Once done, hit python command and it should get you to python 2.7 Hope this helps.

Categories : Python

python multiple inputs and multiple outputs
Loop over filenames. input_filenames = ['a.sam', 'b.sam', 'c.sam'] output_filenames = ['aout.sam', 'bout.sam', 'cout.sam'] for infn, outfn in zip(input_filenames, output_filenames): out = open('/home/directory/{}'.format(outfn), 'w') infile = open('/home/directory/{}'.format(infn), 'r') ... UPDATE Following code generate output_filenames from given input_filenames. import os def get_output_filename(fn): filename, ext = os.path.splitext(fn) return filename + 'out' + ext input_filenames = ['a.sam', 'b.sam', 'c.sam'] # or glob.glob('*.sam') output_filenames = map(get_output_filename, input_filenames)

Categories : Python

Multiple inheritance in Python
You probably should have looked through the related questions before posting. This seems to be a valid way to get class C to inherit from classes A and B: class A(object): # stuff for A goes here class B(object): # stuff for B goes here class C(A, B): # stuff for C should come from A and B. As Dek points out in the comment, the Python documentation already has a page about this.

Categories : Python

Python: multiple installations
Actually I fixed the problem by reinstalling MySQLdb following the step found here. I'm not sure how well this will work for additional modules though

Categories : Python

multiple python decorators
You'll need to swap the @decorator1 and @decorator2 lines if you want decorator2 to check up on whatever decorator1 returned: @decorator2 @decorator1 def my_method(self, request, *args, **kwargs): return u'The result that must be returned if all the checks performed by the decorator succeed' Now decorator2 will wrap whatever method decorator1 returned, and you can thus inspect what that method returns. def decorator2(method_to_decorate): @wraps(method_to_decorate) def wrapper2(self, request, *args, **kwargs): result = method_to_decorate(self, request, *args, **kwargs) if isinstance(result, tuple) and result and result[0] == 'failure': # decorator1 returned a failure return result else: # decorator1 passed through

Categories : Python

Merge multiple csv's using python
Assuming all the CSV files are of the same length and contain the same first column in the same order, something like this might work for you: list_of_files = ['csv1.csv', 'csv2.csv', 'csv3.csv'] # Use the first file as a template with open(list_of_files[0], 'r') as f: output_text = [line.strip() for line in f] # Append the values to the end of the lines for fn in list_of_files[1:]: with open(fn, 'r') as f: for i, line in enumerate(f): key, value = line.strip().split(",") output_text[i] += "," + value # Dump result to new csv with open("result.csv", 'w') as f: f.write(" ".join(output_text))

Categories : Python

Multiple inheritance in python vs c++
what minimal changes can we make to the C++ code to make it behave like the Python code? Short answer: You can't. B2 has no idea that it's going to form part of a sub-class that also has B1 as super-class. Long answer: You can, if you use some grotty downcasting (essentially casting this to a D*). But it's probably not a good idea, as *this is not necessarily a D.

Categories : C++

Python logging from multiple threads
The good news is that you don't need to do anything extra for thread safety, and you either need nothing extra or something almost trivial for clean shutdown. I'll get to the details later. The bad news is that your code has a serious problem even before you get to that point: fileLogger and consoleLogger are the same object. From the documentation for getLogger(): Return a logger with the specified name or, if no name is specified, return a logger which is the root logger of the hierarchy. So, you're getting the root logger and storing it as fileLogger, and then you're getting the root logger and storing it as consoleLogger. So, in LoggingInit, you initialize fileLogger, then re-initialize the same object under a different name with different values. You can add multiple handlers

Categories : Python

python iterator over multiple lists
Use itertools.chain.from_iterable(): from itertools import chain for elem in chain.from_iterable(nested_list): Demo: >>> from itertools import chain >>> nested_list = [['a', 'b'], ['c', 'd']] >>> for elem in chain.from_iterable(nested_list): ... print elem, ... a b c d

Categories : Python

Parsing multiple lines in Python
You need to add y to an existing list, using list.extend(): words = [] while True: y = input() if y == "###": break y = y.lower() y = y.split() words.extend(y) Now words is a list containing all the words of the lines your user entered. Demo: >>> words = [] >>> while True: ... y = input() ... if y == "###": ... break ... y = y.lower() ... y = y.split() ... words.extend(y) ... Here is a line like sparkling wine Line up now behind the cow ### >>> print(words) ['here', 'is', 'a', 'line', 'like', 'sparkling', 'wine', 'line', 'up', 'now', 'behind', 'the', 'cow']

Categories : Python



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