How to check python version using C++? - c++

I want to use C ++ to confirm local windows system python version installed, I do not know How to determine?

If the python directory has been added to the PATH environment variable, you can easily _popen python with the --version argument, and parse out the version number from the standard output (which will be e.g. Python 2.7.6).
Another option would be to use regedit to see if the version appears somewhere in the registry that you can read it from. Lots of existing S.O. Q&A on how to read registry values....
If you get stuck implementing either option, post your code and the specific problem.

Related

Need to install C/C++ sdk appdynamics for my C++ application

I was going through this appdynamics document page for the installation of C/C++ SDK.
C/C++ SDK installation on Linux
But since, i am doing this for the first time, i am not sure what is meant in the 3rd point.
I think i have to set the location in my LD_LIBRARY_PATH env variable and then invoke them by typing
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/appdynamics-cpp-sdk/lib
Can somebody explain, what needs to be done?
Yes - you need to set "/opt/appdynamics-cpp-sdk/lib" in your "LD_LIBRARY_PATH" environment variable to use the SDK as you have posted.
Generally this is put in a script used to build your application which you are wanting to instrument.

How can I protect my source code when deploying on different computers

I have a program I just finish writing in CFML (.cfm files) for my client, but I don't want my client to see the source code. I will install the software on his computer. I tried using the compile.bat but when I install it on the other computer, it gives an error (java language...). What are my options?
#Bardware is correct: the target machine needs to have the same major version of Java as that which you compiled the code with, and probably for good measure the minor version should be the same or greater.
You can - of course - confront this from the other direction: find out what version of Java they have running, and compile to that version. However they will still need to be running at least the minimum Java version that is supported for the intended version of ColdFusion.
Also it's vital to note #Bardware's comment against the question itself:
cfcompile.bat calls findjava.bat. There a variable JAVACMD is set.
Coldfusion prefers the JAVA that resides within the CF installation
folder. That is an issue, since CF came with JAVA 7 but might be set
to run with JAVA 8 in the jvm.config. You might resolve the variables
from the command afterdeploycompdir and compile without using the bat
file.

Python and oracle 32bit and 64bit instaclient on same machine

I have both wamp and python on a single machine. For very specific reasons PHP needs to use the 64bit version of oracles instaclient and python needs to use the 32bit version. My Path variable points to the 64bit version. This is obviously no good for my 32bit Python.
Is there a way I can point python cx_oracle to look specifically at the 32bit version of instantclient.
You can start your script by setting the environment variables correctly. For example, if you run your script from command line like this and set the environment variables, it should work as expected. Bu do not forget to remove 64bit instant client path from %path%, I just put this as an example. Just add your paths as semicolon seperated, or you can create a python script removing/changing the environment variables and starting your application.
C:\Windows\System32\cmd.exe /c "set ORACLE_HOME=D:\oracle && PATH=%path% && yourscript.py"
Your second option is to copy the instant client files to your application working directory.

Calling a OSX package from xcode c++ program terminal

im planning to build a c++ application based on another c++ package (aria2c) i found over the internet which acts as a ready made wheel for me. I have already installed the package on my machine, but the problem is when i run system("aria2c"); it outputs "command not found", whereas if i run system("git"); (which i have also installed) it will output the git's man page.
calling "brew" also doesnt work whereas git, ls and some other that i tried work.
So can someone explain to me why i cant access that package ? and if there is any solution to it ?
The most common mistake is that the pacakge might be installed for a particular user or at a particular path. Make sure that you have the library/application in your path list
To do that ,i would suggest first finding where the package is installed and then do echo $PATH in terminal to see if its in your path variable

How do you set up gsutil to be run from the command line

I'm on 64-bit Windows 7 with 64-bit Python 2.7 and gsutil version 4.11
I'm trying to set up gsutil so that I can run it from the windows command prompt with the commands python gsutil or gsutil. I'm referring to the documentation here in the section called "Facilitating the use of gsutil"
According to that documentation and other references in that guide, I should be able to set up gsutil to run by using either python gsutil or just gsutil. I am able to run gsutil by cd-ing to the C:\gsutil directory or by running python C:\gsutil\gsutil, which will work fine, but I'd like to set it up the way the guide says it can be set up. I've looked at this answer but it just explains what I already can do.
The first step of the guide is associate .py files with Python, which I'm assuming is already done because when I double click a .py file, it runs in Python, but maybe I'm confused.
The second step of the guide is to rename the 'gsutil' file to 'gsutil.py', but that doesn't make sense because there's already a file in the C:\gsutil folder called gsutil.py. I've opened both the files in Sublime Text and they're both different, so maybe they do the same thing but I'm not sure...
The third step is to add C:\gsutil to my PATH environment variable, but I'm still unable to run gsutil using the command python gsutil after doing that.
I've also tried steps 4 and 5 but they don't help me either. There is no gsutil\boto path (unless they mean C:\gsutil\third_party\boto) and I should be able get this set up without anything to do with boto anyways.
I can still use gsutil but I'd like to understand why I can't run it the way Google says I should be able to. Thanks for any help.
I'm looking at the docs for Windows and they do seem a bit messed up. You don't need to rename anything as long as you have installed Python correctly, as you can just invoke 'gsutil.py' from anywhere as long as 'C:\gsutil' (or wherever you installed it) is in your path. The 'gsutil' script is just another Python wrapper that imports 'gsutil.py', which would work on a Unix system to save typing the extension if it was in your path but not on Windows (Windows needs a file extension to associate the type). I'd recommend just installing the Google Cloud SDK using the Windows installer as it installs gsutil properly along with a 'gsutil.cmd' wrapper for Windows which actually does this properly.
You could only ever run 'python gsutil' from inside the installation directory as Windows path rules would never apply to a filename given as an argument to another command.
If you just want the functionality of typing 'gsutil' as it is supposed to work, the 'gsutil.cmd' script essentially does this (substituting with the actual directories where you installed stuff):
cmd.exe /C C:\Python27\python.exe "C:\gsutil\gsutil.py" %*"