Could any one point me to the [v8 javascript API documentation to work in c] so that I could find proper functions, their uses and return types for doing things, the various API's available on internet are old and the newer v8 is particularly not compatible with those (pre 2013)
check this out..
http://izs.me/v8-docs/namespacev8.html
This set of documents provides reference material generated from the V8 header file;
And For other documentation check this
http://code.google.com/apis/v8/
I've created a GitHub repository that is intended as up-to-date v8 API reference. Check out: http://peerigon.github.io/v8-docs/
To update the documentation, just fork the repo and run doxygen: https://github.com/peerigon/v8-docs
Related
I'm building an app that automatically labels Office files on Windows computers. To apply my sensitivity labels to documents programmatically, Microsoft tells me to use its MIP SDK.
But the SDK is in C++, with some convoluted async Observer patterns, so it's not clear to me how to call its functions from Python.
Has anyone succeeded in using the MIP SDK with Python 3? Can you share a concrete Python example of calling the SetLabel() function on a file?
I have spent sometime looking into this problem. Microsoft doesn't make it clear on how to call their MIP C++ code using Python. It's also unclear for me if you're trying to set sensitivity labels on local Office files or ones stored in SharePoint or in Office 365.
I previously mentioned using Python Bindings, but after doing some research there are other ways.
Technique One
Microsoft has a PowerShell framework called Security & Compliance Center PowerShell. One the cmdlet is Set-Label, which can be used to enable sensitivity labels for Office files. There is another module called Set-LabelPolicy that can assist in setting global sensitivity
policies.
PowerShell cmdlet can be called from Python. There are lots of examples on Stack Overflow on how to accomplish this.
Technique Two
Again Microsoft really requires you to dig for information to use Python over their prefer coding languages.
Microsoft has a GitHub project called AutoRest Python. This project generates Python code that is needed to interact with Microsoft Information Protection (MIP) and other Microsoft centric products.
The other GitHub project that is needed is msrest for python.
If you dig through some of Microsoft GitHub repositories you will find examples on how to use these modules.
Technique Three
You can also use Python to set registry settings related to sensitivity labels for Office files. If needed I can provide you the registry keys.
I would like to package an indesign document through the SDK (c++ or javascript, it doesn't matter) but I cannot find any documentation.
Does anyone know if it is possible?
This is the duplication of the question Packaging a document with Indesign SDK that was marked as answered but the accepted answer describes how to package via UI and NOT via SDK.
Thanks!
Yes, you can do this with JavaScript. All you need to do is call the packageForPrint method of InDesign's document object and use a whole lot of booleans to set the options (see the linked doc page for details).
I'm looking for a module system for Nashorn. From what I can tell, CommonJS is the way to go concerning modules for JS. I have looked through the list (here and here) and have found little in the way of a CommonJS implementation for Java.
Narwhal is no longer active and it's documentation is no longer hosted on GitHub. Is there an existing CommonJS implementation which supports Java or should I start a new project?
Have a look at jvm-npm here https://github.com/nodyn/jvm-npm. This project is used by nodyn as the CommonJS module system. It is NPM-aware, meaning you can load modules directly from NPM, but it does not provide any of the Node.js API.
Here is a simple example usage:
$ npm install pegjs
npm http GET https://registry.npmjs.org/pegjs
npm http 200 https://registry.npmjs.org/pegjs
pegjs#0.8.0 node_modules/pegjs
$ jrunscript
nashorn> typeof require
undefined
nashorn> load('./jvm-npm.js')
nashorn> typeof require
function
nashorn> var PEG = require('pegjs');
nashorn> typeof PEG
object
It is primarily all Javascript, but the actual loading of files from the filesystem and such is done using Java.
I asked a very similar question on the Nashorn mailing list a little while back, here's Sundar's (Nashorn Engineer) reply:
From: A. Sundararajan
To: nashorn-dev#openjdk.java.net
I forgot to add. Nashorn does not contain any builtin module system.
But, if a module system is pure JS + Java, it must be possible to run
on nashorn.
Nashorn supports "load" (loads scripts from URL, File, resources) and
"loadWithNewGlobal" (loads script but into a fresh global scope)
primitives in addition to the good old 'eval'. So, it should be
possible for any module system to be implemented on top of nashorn in
pure JS or perhaps with a bit of Java code.
-Sundar
I've been looking for such an implementation for a while. I've been using a little patched version of Rhino-Require. Although Rhino claimed to be CommonJS compatible, AFAIK, it implemented only modules and not packages (package.json) can't be parsed.
RingoJS should be compatible. But Nashorn will never be see.
Laterly, Oracle announced project Avatar which relies on Avatar.js or here. It's the official project of what was unofficially called Node.jar. But as of now, you have to compile it by yourself. The project is very young.
Another very young project is Nodyn which relies on dyn.js.
So, if understood well, CommonJs should work with avatar-js and nodyn, but those two are still pretty young. I don't understand why avatar-js in not fully distributed along with nashorn though.
A kind of solution would be to add a CommonJS compatibility script like the one for Rhino which adds importClass/importPackage (mozilla_compat.js) which would add CommonJS compatibility into nashorn, kind of Rhino-Require shim thoroughly tested.
I had the same need, and I used jvm-npm for a while, but I needed something that would work even without allowing usage of Java packages inside JavaScript, so I wrote my own version here: https://github.com/coveo/nashorn-commonjs-modules
It's implemented entirely in Java and supports loading modules from elsewhere than the filesystem (Java resources, a custom database, etc.)
It's published on Maven Central if someone wants to use it.
There's also nashorn-require, you can get that off of github too. I've used it, I was able to do
engine.eval(reader("src/main/javascript/nashorn-require.js"),bindings);
engine.eval("var initRequire = load('src/main/javascript/nashorn-require.js');",bindings);
engine.eval("initRequire({mainFile : 'src/main/javascript/foo', debug : true})", bindings);
engine.eval("var babel = require('babel');",bindings);
and then transpile JSX React components to ES5 with
Buffer input = findTemplateSource(fileLocation,context);
bindings.put("input",input.toString());
result = engine.eval("babel.transform(input,{ presets: ['react', 'es2015'] }).code;",bindings);
Then when I pulled react and react-dom into my browser and loaded the resulting js components, things worked fine, so I'm sure Babel was perfectly happy, though I'm not sure about if it will find 3rd-party plugins or not...
I am very excited to start working on Twitter API. I have looked about this on the web but I am unable to understand why most links talk about using PHP, Javascript or C# only.
Since I know C and C++ only, can I use these languages?
If not, then why?
Here are some C++ APIs for twitter:
kQOAuth by Johan Paul – a Qt based OAuth Library
libOAuth by Robin Gareus – a collection of POSIX-C functions implementing OAuth
QTweetLib by Toni Jovanoski – a Qt based Twitter API library
Twitcurl by Mahesh – a Twitter API library
(from https://dev.twitter.com/docs/twitter-libraries#cplusplus)
And you can always use the REST API from almost any language, which ist just a bunch of HTTP calls. You can do that for example with libcurl.
There are Twitter APIs for C++:
QTweetLib by Toni Jovanoski – a Qt based Twitter API library
Twitcurl by Mahesh – a Twitter API library
And you can always write your own. See also: https://dev.twitter.com/docs/twitter-libraries#cplusplus
Let's apply some logic. It can be done in PHP. PHP is written in C. Conclusion: yes it can be done in C. And anything that can be done in C can be done in C++.
If you're interested, there's a project over at Microsoft's DevLabs to provide a library that makes this task more straightforward. It looks pretty interesting, although it's still in development. http://msdn.microsoft.com/en-us/devlabs/casablanca.aspx
Is a possibility to track my C++ application usage using google analytics?
to track application usage with google analytics is necessary to generate http request to this url:
*
http://www.google-analytics.com/__utm.gif?
utmwv=3&
utmn=<random number>&
utme=&
utmcs=ISO-8859-1&
utmsr=1280x1024&
utmsc=24-bit&
utmul=en-us&
utmje=1&
utmfl=-&
utmhn=<www.stopka.us>&
utmhid=2112093191&
utmr=-&
utmp=/login.php?user=12&
utmac=UA-XXXXX-1&
utmcc=__utma%3D1.<unique id>.<time (in sec's since Jan 1, 1970) of first
visit).<time of last visit>.<time of current visit>.<visit count>%3B
%2B
__utmz%3D1.1203103189.1.1.utmcsr%3D<source>%7Cutmccn%3D<campaign>
%7Cutmcmd%3D<medium>%3B
*
all parameters is possible to fill with it's user env. values.
This way is not convenient enough.
So, I create my own library. I call it UsageAnalytics and distribute it as open source project at: http://code.google.com/p/usageanalytics/
thanks for all for participation, thanks for me for the library.
btw. cause code.google.com outdated, I've moved that stuff to
https://github.com/vyemialyanchyk/usageanalytics
By now you may have already solved your need, but for what it's worth, my firm has also released a C library supporting Google's Universal Analytics Measurement Protocol.
https://github.com/analytics-pros/universal-analytics-c
Good luck!
Google has a library for accessing Analytics API from C++, it's in "alpha", but it looks like what you want... https://developers.google.com/api-client-library/cpp/apis/analytics/v2.4
The best library I found for tracking analytics with c++ is this unofficial one on github: https://github.com/HSAnet/qt-google-analytics
Note however that it has Qt as a dependency...
If you want to track C++ Android or iOS apps you could use Google's Firebase:
https://firebase.google.com/docs/analytics/cpp/start
Old question, but nowadays more and more developers are starting to use usage analytics for their software.
"SoftMeter", a library I created myself, is my solution to this need.
It has a native C and C++ interface.
https://www.starmessagesoftware.com/softmeter/sdk-api