From where am I supposed to install OpenSocial's gadgets.io? - javascript

I am trying to do this tutorial, http://developer.yahoo.com/yql/guide/yql-code-examples.html#yql_javascript
and it says to use gadgets.io, but does not say anything about installing it. Where do I get it from?
I should also say that I am trying to perform the query from a socket.io server.

gadgets.io is a javascript service exposed by the OpenSocial API which is available through OpenSocial containers. OpenSocial containers are used to host 3rd party web components known as gadgets and were originally contributed by Google.
There is no such thing as 'getting' the gadgets.io library, as it is exposed to gadgets running on a container. I'm not familiar with YQL, but I had a look at the link you provided and the code example they demonstrate is meant to be executed within some type of playground environment # Yahoo I guess - therefore their environment should support gadgets, i.e. an OpenSocial container.
Have a look at the original documentation of the gadgets.io.makeRequest in order to see similar examples. Hope it helps :)

Related

Powerapps Xrm.WebApi in a stand alone Web Resource

I have a stand alone web resource linked from the site menu in a Model Driven App. It does multiple api calls using parent.Xrm.WebApi and currently works fine.
According to Microsoft deprecation notice, https://learn.microsoft.com/en-us/power-platform/important-changes-coming, parent.Xrm will be going away and no longer work for standalone Web Resource. Xrm.WebApi without referencing the parent throws an error "Xrm" is not defined.
Can anyone help with a supported way to access Xrm.Utility and Xrm.WebApi from a standalone web resource?
Latest documentation update:
The ClientGlobalContext.js.aspx page is deprecated and scheduled to be unavailable after April 1, 2022. Alternative methods to access global context information will be available by December, 2021.
On this particular piece, so far nothing documented as workaround or alternate solution from Microsoft. I created a github issue for the assistance and it is still open.
Between, I came to know about one of the MS employee unofficial side project and code sample from this blog. That is also about to be confirmed as supported.
A lot of organizations use ClientGlobalContext.js.aspx in HTML web
resources, and this means you will want to upgrade those HTML web
resources that utilize the ClientGlobalContext.js.aspx library as soon
as possible.
If you are embedding HTML web resources in Dynamics 365 / Power Apps
forms, you may want to look at using getContentWindow.
If you have stand-alone HTML web resources, or if you are embedding in
forms and would like a neat way to swap out
ClientGlobalContext.js.aspx with a new library, Microsoft employee
Christopher Nichols has built a solution that may be of interest to
you.
Christopher has a nice unofficial side project going on called
mock-xrm that, as you can imagine, mocks xrm. This means we can call
our Xrm functionality from within web resources that instead of the
legacy aspx page.
All we have to do is just download the Xrm.min.js file as web resource and this has to be referred in our HTML web resource to consume Xrm the same way as earlier.
We can keep a close eye on this library and github issue for further updates and concrete communication.

How to customize a ppapi which could be used by Javascript?

I am researching on the Chromium PPAPI. After looking through all APIs from the official reference here: https://developer.chrome.com/native-client/cpp-api-dev, I seldom found any APIs that could be used by, or communicate with JS directly. In my opinion, a plugin process will set up a PP::instance and all functions within this instance would be loaded. Take video_capture.cc as an example, you could find it under /ppapi/examples/video_capture in chromium source codes. In this example, a customized PP::instance called VCDemoInstance registered some methods, yet I found only HandleMessage() could communicate with JS layer. From JS, you might use postMessage() to pass something to HandleMessage() above.
So here is my key question: Is there a way to create or define a method in PP::instance that could be used by or communicated with JS layer directly? Is it possible to register a JS object and call PPAPI like obj.apiFromPlugin? At lease I knew in Opera JSPP framework, it could be done.
Please correct me if anything is wrong. You're appreciated.
After digging into PPAPI, I couldn't find a way to create an JS object in plugin. I finally switched to Chromium Embed Framework which can port content API to JS. Using CefV8Handler may solve my question absolutely.

GAS: How to allow other people to use your library without sharing the code

How can I create a library in google app script in which I can share just the library key and people can use it, without sharing the code properly? I am trying hard to find a solution, but I failed.
I don't want to share the library for the world. I just want to use the library in different google drives, without having to share the code, but just the library/project key.
I found this link on stackoverflow that the guy had basically the same question as me, but it didn't has a good answer: How to share Spreadsheet with reference to a custom (private) library
Thanks in advance!
it is currently imposible with you requirement to end up "sharing a library key."
you must give at least read access to the library file for this case of running the script functions directly from the spreadsheet.
Once a script uses the library, and the user has view permission on the container script, a curious user could use the apps script debugger to "step into" a library function and there it is, the library source code.
If you were to instead publish the script as a web app, you could hide the library but that option does not apply in your case as you are making copies of the spreadsheet, and services do not get copied, need to be re-published.
Another option, but which does not give the library key in your requirement, is to publish an apps script service that uses the library and implements an API, which the other scripts (inside each spreadsheet copy) use. This however will not scale as quotas will be deducted from the API service publisher, and not the users that call the API.

gapi.load versus gapi.client.load

In Google's JavaScript API's, what's the difference between gapi.load() and gapi.client.load()? How interchangeable are they and when should I use one versus the other? I see both are used in the Google Drive Realtime API sample code.
As indicated by the CORS documentation, the gapi.load function is used to dynamically load specific JavaScript libraries.
As documented in the description of the gapi.client.load function (which is provided by the "client" JS library), gapi.client.load is used to build a JavaScript interface for accessing specific HTTP(S) APIs; you can also do this sort of thing yourself using API discovery (search for it to find docs) and sending API requests directly with gapi.client.request or CORS.
Edit: added clarification based on Brian Slesinsky's follow-up comment and made minor wording changes.
After researching this, here's my simple take:
gapi.load() loads the JavaScript client library. That is to say, it's loading gapi. Without this gapi won't work.
gapi.client.load() is for loading an interface for one of the many Google APIs. The loaded API interface will then be in the form gapi.client.api.collection.method. For example, the Moderator API would create methods like gapi.client.moderator.series.list.
You most likley need both.

Accessing javascript open source API

how can i communicate with Mega.co.nz? They claim that they are using a open source java-script project that we (developers) can use to communicate with their server. But how does someone begin? I would really appreciate if i can get some tips on this.
API's are mostly designed for third-party developers' use so they usually provide documentations on how to connect to it (e.g. which URL's to call, what parameters to pass and what is the expected response.) Most of the time, you can find it on their website, if not, you should ask them for it.
As it states on the mega.co.nz developer page the API specification has not been documented yet. You would have to reverse engineer the HTML and javascript on the site to learn how to use it. Or wait until full documentation is available.

Categories

Resources