Integrating Google maps with C++ Program - c++

I am making an artificial intelligence based shortest distance finder between two points in c++ language. My coding for that is complete and working fine. Now I want to integrate it with Google Maps Api. I want to show the shortest distance graphically on google maps exactly same as google maps show directions. I am stuck and can't find any help. I know I have to do socket programming for this. Please guide me with proper steps and coding snippets. Thanks in advance!

Check out the official api :
https://cloud.google.com/maps-platform/
For interaction with the http api you could use a client such as curl (http://curl.haxx.se/) or maybe boost asio if your are using boost. see this question at SO: Boost.ASIO-based HTTP client library (like libcurl)

There is a c++ client/ helper available. Disclosure I have not tried it yet.
https://google.github.io/google-api-cpp-client/latest/
Many links seem to be broken (The samples directory link). So I'm not sure how well supported it is but it looks like it might be helpful.
The description page is at :
https://google.github.io/google-api-cpp-client/latest/start/installation.html
IF that fails there are samples in other languages that you may have to translate by hand. (better than nothing)
https://developers.google.com/api-client-library/

Related

GET/POST using boos-asio for a REST API

I am new to network programming and got started with boost, REST etc. I wanted to know if I could use REST API's with boost-asio such as using Google Maps' Distance Matrix in my program. But I couldn't find a proper documentation for boost.
I don't expect you to give me complete working code rather I need idea or some sort of guidance as to what to do, where to find things etc.Also this program will be in C++ purely (I don't know if it can even be done in C++, given this answer https://stackoverflow.com/a/28736632/4846740). Thanks
Note: This post was not very helpful Integrating Google maps with C++ Program
You'd want to
use a REST library (e.g. cpprestsdk or some other frameworks like autobahn-cpp?), or
= at least write the REST requests on top of a HTTP library, such as Boost Beast
The library examples show you everything you need to send requests and receive responses. If you want, you can use additional libraries like https://github.com/0xdead4ead/BeastHttp to make it even more high-level/instant.
I would 100% recommend that you do not do this in C++. While I'm not a huge fan of Python, it's undoubtedly the hammer that is made for this nail. Check out BeautifulSoup, Mechanize, and Scrapy (+XPath), for really convenient ways of obtaining/parsing HTML, filling out web forms, and gaining responses. Typically, unless you're doing realtime target tracking, you do not need the latency gained from running everything in C/C++. You can get away with quarter-second, or even half-second updates.
I'm not sure what you're trying to do, but I would say save yourself the headache, and just work with Python.

VoIP c++ references

I'm having troubles with finding tutorials/examples of how a simple VoIP application would look like. I've searched the web and found an out-dated step-by-step tutorial, so it wasn't much of a help and that's about it considering tutorials. However I've managed to find some nice API's like libosip ( oSIP ). It would be a great thing if anyone would know any good tutorial; or if anything a small VoIP open source app that i could checkout. I don't really have any troubles with understanding someone else's code if it wasn't commented/explained.
There is a great sip framework called PJSIP. look at this example for a short, but yet complete demo. Also take a look in the PJSUA API.

What is the best way to integrate Google Analytics into a C++ OpenFrameworks desktop project?

I'm currently building an OpenFrameworks project and need to use Google Analytics to track user interactions. I have yet to find any existing C++ libraries for doing so, and am considering writing my own. Is the API open enough to allow a custom library to be created? If one doesn't exist, any ideas on where to begin coding my own?
Yes it is possible and easy to extend openframeworks!
You can look here if there is an addon which fits your need. Maybe ofxCurl or ofxHttpUtils are the right ones to create an request like the one mentioned in the comment by yahelc.
If you don't find a solution there, you can look here to find first informations about creating addons for openFrameworks. If you have any further questions, please ask in the official openframeworks forums which you can find here.
Looks like you'll have to build your own solution... I'd use ofxHttpUtils to ping Google's Analytics API. You should also consider wrapping your work as an OF addon and sharing in openframewors.cc
I've built an OpenFrameworks add-on to do just that:
http://github.com/armadillu/ofxGoogleAnalytics

Create a IM program (like MSN or Gtalk ) using C++

My question is that create a IM software like MSN or Gtalk, to have the basic function using C++.
You can use any technology and libary to do that.
Can someone give me a suggestion?
I add that this not my homework. This
is my job question.
Because I am a fresh man in my
company.
So, they give me some questions to let
me dirty my hand.
My suggestion from experience with doing this sort of thing before is to find a library that implements Jabber also known as XMPP (Google Talk) for you. That way all you have to do is create the user interface. If you are working with Windows, MSDN has some great tutorials for creating user interfaces in C++. If you are using Linux, you will probably want to look for an X windows tutorial. Other than that, check out this link for a list of C++ libraries for Jabber/XMPP.
Good luck!
It sounds like you will probably want to use a library that already knows how to interface with existing IM clients. Google Talk, for example, uses the XMPP (also known as Jabber) protocol. The XMPP website has links to a number of free C++ libraries to communicate with other XMPP clients (like Google Talk):
http://xmpp.org/software/libraries.shtml
Here is one example of a GPL XMPP library for C++: http://camaya.net/gloox/

C++, Get text from a website

I was told I have to use winsock, but I dont know where to start. For example, I am trying to access, lets say http://www.newegg.com/, I am trying to get the text title of just the three front page products. Any help is greatly appreciated. :D
I'd also recommend libcurl for this sort of thing.
You can use the cURL command line tool to generate sample code as well, which is helpful for experimentation.
W3.org themselves provide sample C / C++ librarys for Http requests.
Find them here
Specifically, look for HTTPReq.c
Use boost library and poco. They both provide solutions for network programming. Boost also provide spirit library which you can use for parsing data from websites. Poco libraru also provides NetSSL, crypto solutions.
P.S. boost::spirit is not a library for parsing data from websites, it provides solution for parsing strings ...
you need to open a socket.
then you need to do an http get
somewhat like :-
http://www.esqsoft.com/examples/troubleshooting-http-using-telnet.htm
You could use the QNetworkAccessmanager class from Qt framework.
I'm assuming you need to use c++ for a reason, such as integration with existing software, otherwise, as per some of the other suggestions, choosing a language with a more convenient framework (eg: scripting language) would be better suited for the task.
If you would like to avoid getting your hands dirty with WINSOCK, or have the need to run on a platform other than windows, you could look at the using the boost asio library.
The following page contains links to simple sync and async http clients:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/examples.html
You can find documentation on the library itself at:
http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html
Use c++ if you must, but it might be a lot less painful to use python.
Look at the Python httplib module for how to set the host you want to pull from etc. Python's available for free for most platforms and is enough like C++ that you can probably learn python a heck of a lot faster than you can learn to write a program controlled browser in c++. Well, maybe that's not true for everyone on this site, but I'll bet it's true for "most" of us. I used to get stock quotes updated in near real time from CNN Money years ago and IIRC it was around 100 lines of python code.
Hotei