How do I run mercurial queries from C++ (cross-platform)? - c++

I would like to run some mercurial queries from C++ and get some results (similar to what we get on the command line) and would like it to be cross-platform. Any way to accomplish this without using Mercurial python API (I am hoping to see a wrapper that someone has already built in C++ or in C)?

Better than using the python API would be interfacing with the Mercurial Command Server though it does not yet have a C / C++ wrapper.
https://www.mercurial-scm.org/wiki/CommandServer#Libraries

Related

Is there any way to install OpenCV in C++ on Windows without using any IDE but only in cmd?

I am writing a educational program about OpenCV in C++ right now. And as for the question about fee and copyright. I'm now thinking if there exists any way to install C++ OpenCV only with cmd or PowerShell ?
I have already found many ways in the Internet, but they all told me that I have to use VS or other IDE or I should use python OpenCV. But as for the classes I will teach, I must use C++, so I want to know if there exists any way to solve this problem?

Best way to run local server using c or c++

I'm wanting to create a local server on my laptop that runs on c or c++ for the sake of web development. I'm building a website and the backend will run on c or c++ so I'm wanting my development environment to be very similar to the production environment. I've never done anything like this before. What's the best way to go about this? Also if I use https protocol, does that make it 'safe'? Thanks
The simplest way is to install lampp or xampp and use apache. On linux you are going to install your C programs as *.cgi in your directory /opt/lampp/cgi-bin , first get your install to work then you can worry about making it secure, most people will tell you to use PHP and/or other languages instead of C. There is no reason not to use C if you like it. It works fine.

Building AlchemyAPI on Windows with Visual Studio

I am trying to integrate AlchemyAPI into my c++ project and I'm a little lost regarding where to start. I downloaded the API, obtained the key. The readme file has Unix installation instructions on running the autobuild.sh script then configure and make and make install. I have cygwin installed, I installed autoconf for windows. I'm just guessing there must be a more straightforward way to use AlchemyAPI c++ on windows.
There's two ways to go about this that are probably a lot easier than what you're trying to do:
Using the C# SDK that AlchemyAPI provides, build it, reference it, and call it from your solution.
Bypass the SDKs all together, hitting the API directly by building your own URLs and data strings for HTTP GETs or POSTs (x-www-form-urlencoded) and submitting them using a popular C++ HTTP implementation. (This is all the SDK is really doing anyway.)
An example URL that you could use to build your own interface might be this one (enter your API key to view it in your browser):
http://access.alchemyapi.com/calls/url/URLGetRankedNamedEntities?apikey=YOUR_API_KEY&url=http://www.cnn.com/2011/09/28/us/massachusetts-pentagon-plot-arrest/index.html?hpt=hp_t1&sentiment=1
If you want to parse the results in XML, you can use libxml, and AlchemyAPI's C++ SDK can provide you with an example. If you want to parse the results as JSON, then add 'outputMode=json' to the request and use your favorite JSON parser.
There's more information in the documentation on all of the features and how to implement them in your requests:
http://www.alchemyapi.com/api/

is there a way to compile a c/c++ program from python?

Currently I'm coding a python script to compile a C/C++ Linux kernel in the following way:
subprocess.check_call(["make", "-j5"])
subprocess.check_call(["make", "-j5", "modules_install"])
subprocess.check_call(["make", "-j5", "install"])
With these approach the commands are executed in the shell. So I was wondering if there is another way to compile the kernel using python build in libraries?
Ultimately, python isn't a C/C++ compiler, so you need to ship out the compiling to an external program (e.g. gcc). So, there is no way to do this entirely in python.
Note that here python doesn't spawn any shells (although make might). You could try to reproduce what make does entirely in python, (there is a version of make written in python FWIW), but honestly, it's not worth it. You need to spawn subprocesses anyway -- you might as well use the tools which are already in place and "tried and true".

Python C++ binding in OpenCV

What technique/library is used for Python binding in OpenCV2.0?
I am aware there there are a number of libraries for C++/Python binding and that previous versions of OpenCV were using SWING library.
I am testing Python in Python Tools for Visual Studio which has code completition (intellisense) built in. However, for current OpenCV Python bindings it displays only function names in interactive window. In editor, it does not even display the function names.
Is it possible to have intellisense working on parameter level for C++ Python bindings?
What technique/library is used for Python binding in OpenCV2.0?
Vadim Pisarevsky, one of the core developers of OpenCV, has given a brief answer for this question here: How Python API is generated?. He says:
We do not use SWIG or any other standard wrapper generation tool. We
did not find such tools that would produce satisfying results.
Instead, we use our own purely Python-based solution for parsing
OpenCV headers
The parser is at opencv/modules/python/src2/hdr_parser.py
After all the API is extracted, we use some more python code
(opencv/modules/python/src2/gen2.py) to produce Python wrappers.