How to use and access the preference in thunderbird , in Webextension environment ,not in the legacy - mozilla

Currently using this method as a legacy method.
this.prefService = Components
.classes["#mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
this.prefBranch = this.prefService.getBranch(root);
but i did not get a complete idea about how to use this in the webextension environment thunderbird .any api in order to use this feature ?

I solved my issue, by using Web Extension experiment.
Implemented the same legacy extension function with the Web Extension Experiment Specification and that solved my need at this moment.
the link mentioned below.
https://thunderbird-webextensions.readthedocs.io/en/68/how-to/experiments.html
https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/functions.html

I think you can use the storage.local API (see documentation, it seems to work the same for Firefox and Thunderbird). This allows you to store data related to your add-on with something like:
let settingItem = browser.storage.local.set(
keys // object
)
and to retrieve or remove it after that (see available methods).

Related

How to create Index with custom analyzers from json file in Azure Search .NET SDK?

I had read that the Azure Search .NET SDK uses NewtonSoft.Json to convert it's models to/from json in it's underlying REST API calls so I've been doing the same in my own app.
I have a simple app which creates a new Index using the .NET SDK. To do this, I was defining my Index in a json file, using the format outlined here https://learn.microsoft.com/en-us/rest/api/searchservice/create-index and then I was converting this to a Microsoft.Azure.Search.Models.Index object using Newtonsoft.
var index = JsonConvert.DeserializeObject<Microsoft.Azure.Search.Models.Index>(System.IO.File.ReadAllText("config.json");
This was working fine before I configured custom Analyzers, but now that I have custom Analyzers in my config, the Analyzers, Tokenizers, and TokenFilters are not being resolved into the correct types. ie. my custom Analyzer is being deserialized as a Microsoft.Azure.Search.Models.Analyzer, instead of Microsoft.Azure.Search.Models.CustomAnalyzer, same goes for the Tokenizers and TokenFilters, they are being deserialized into the base types.
Is there an easy way I can create an Index like this in the .NET SDK from a json file?
Unfortunately this is not an officially supported scenario. While it works for simple index definitions, we're working to understand what we need to do to be able to support all cases.
Please post your feature request on our User Voice page to help us prioritize: https://feedback.azure.com/forums/263029-azure-search
In the meantime, you might be able to get it working yourself by adapting the JsonSerializerSettings initialization code at the bottom of this file.

SBT SDK Blogs and Activities API error

I setup the Social Business Toolkit against our development system. All APIs are working correct, except for the Blog and Activities API.
For both i recieve within the Java APIs the following error:
org.apache.http.conn.EofSensorInputStream cannot be cast to org.w3c.dom.Document
The blog request url from the sbt is:
http://example.com/service/proxy/connections/blogs/homepage/feed/blogs/atom?ps=5&dojo.preventCache=13
But correct would be:
http://example.com/service/proxy/connections/blogs/atom?ps=5&dojo.preventCache=13
Any idea why that happens?
The blog path is customizable per each IBM Connection installation: to support different blogs homepages, there is a parameter exposed on the BlogService API.
To change the default, try:
BlogService svc = ...
svc.defaultHomepageHandle = "";
Lorenzo's answer is correct, most installations use homepage as the blog handle, but you can configure it using the defaultHomepageHandle member variable in the BlogService.
Just a brief comment, maybe it's better to use the setHomepageHandle() method instead.

Drag 'n' Drop files to a Chrome Package App?

Has anyone successfully implemented drag and drop with files from desktop to the app?
I've tried just putting this drag 'n' drop example into the index file but I just get this error:
Can't open same-window link to "file:///C:/Users....whatever"; try target="_blank".
Please share your stories, what you've tried and if you have succeed :)
Some resources to help you:
New Chrome Packaged Apps codelab that we've been working on covers drag-and-drop in both AngularJS and pure JavaScript.
AngularJS drag-and-drop: https://github.com/GoogleChrome/chrome-app-codelab/tree/master/lab5_data/angularjs/2_drop_files
JavaScript drag-and-drop: https://github.com/GoogleChrome/chrome-app-codelab/tree/master/lab5_data/javascript/2_drop_files
There's an early version of docs too for AngularJS drag-and-drop for Chrome at developer.chrome.com/trunk/apps/app_codelab5_data.html#handle_drag_and_dropped_files_and_urls
We're working on the docs to cover both samples though.
I have done this a while ago and it worked.
The problem you've got is that you are creating a file url, then trying to navigate to the url. The navigation is failing, not the read. It's failing due to CSP, and you probably won't be able to override that with a different CSP due to security restrictions we've placed on allowable CSPs.
But, you should be able to just read the file and use the content. You need to change that sample code to use ReadAsText or ReadAsArrayBuffer instead of readAsDataURL. Look here for more details.
Please let us know how you get on!
Just listening for drop won't work. You will have to prevent the default functionality of dragover.
document.body.addEventListener('dragover', function(e) {
e.preventDefault();
}
document.body.addEventListener('drop', function(e) {
alert('it works!')
}

Can I monkey patch the phantomjs browser api with execute_script?

Im trying to test an application with some native JavaScript features disabled e.g. querySelector ...
So I thought this might work before the call to visit:
page.execute_script("document.querySelector = null")
but it doesn't work, any thoughts on how I could achieve this?
Cheers
John
Have a look at the :extensions option. This allows you to define a JS file which gets preloaded into the browser.

How to use YUI 3 History standalone without the loader?

Using YUI scripts on our SSL page turned out to break the SSL connection because they dynamically load scripts from yahoo (combo) over a http connection.
As we only use the history manager of YUI 3, I wanted to host the code on our server. If I copy the code from http://yui.yahooapis.com/combo?3.2.0/build/yui/yui-min.js&3.2.0/build/oop/oop-min.js&3.2.0/build/dom/dom-base-min.js&3.2.0/build/dom/selector-native-min.js&3.2.0/build/dom/selector-css2-min.js&3.2.0/build/event-custom/event-custom-min.js&3.2.0/build/event/event-base-min.js&3.2.0/build/node/node-base-min.js&3.2.0/build/event/event-synthetic-min.js&3.2.0/build/json/json-min.js&3.2.0/build/history/history-min.js&3.2.0/build/history/history-hash-ie-min.js It does not work anymore ("Y.History.getBookmarkedState is not a function" says firebug).
Does anyone know how to do that correctly?
Thanks
You're loading the modules correctly, but you're trying to use the deprecated History API (from YUI <=3.1.x). In YUI 3.2.0, the History Utility was rewritten, and the API is not backwards-compatible.
You can still use the old API in 3.2.0 by loading the history-deprecated module instead of history. Alternatively (and preferably) you can migrate to the new API, which is simpler and more flexible than the old one. You'll find a migration guide in the History Utility documentation.
I guess you should check the API. I've checked the code from this combo and it really loads History and submodules.
YUI({ bootstrap: false }).use('history', function(Y) {
Y.log(Y.History);
});
It shows outputs G(); Also I found getBookmarkedState declaration inside history-deprecated submodule so it seems like something new is used instead of this.

Resources