Tracking method for QGIS Plugin Usage - http-headers

I have a QGIS3 python plugin that I would like to track its users' usage. Is it possible to add a http request to the headers? How can I do it?

The biggest obstacle is that an http request package should be installed (like requests). This easy to do in the osgeo4w shell for a particular installation of QGIS, but it can't be done from within a plugin (as far as I can tell).
However, there's nothing to stop you from inserting requests.post(path,headers,data) into your plugin script files.

Related

Chrome manifest v3 - is there a viable workaround to use Google's File Picker in a Chrome extension?

My searches have turned up nothing concrete. My extension uses Google's file picker to allow the user to browse their sheets and choose a desired file to write some data to, which manifest v3 breaks because of some GAPI limitations. Unless I've missed something obvious, there does not seem to be a simple workaround or method for this to migrate to v3 -- it just seems to be disallowed.
I'm not asking if there's a way to do something that they intend to not be possible (even though I doubt such a thing would exist with Google) but I'm optimistically hoping that maybe there is some hacky/annoying workaround that still fits within their rules. If I absolutely have to just allow them to set a sheet URL manually I will...I'm just trying to avoid it.
Any tips or suggestions would be appreciated.
You may have to test it yourself to make sure there are no weird behaviors, but Google has some recommendations regarding this in their migration guide:
In Manifest V3, all of your extension's logic must be included in the extension. You can no longer load and execute a remotely hosted file. A number of alternative approaches are available, depending on your use case and the reason for remote hosting. Here are approaches to consider:
Configuration-driven features and logic
In this approach, your extension loads a remote configuration (for example a JSON file) at runtime and caches the configuration locally. The extension then uses this cached configuration to decide which features to enable.
Externalize logic with a remote service
Consider migrating application logic from the extension to a remote web service that your extension can call. (Essentially a form of message passing.) This provides you the ability to keep code private and change the code on demand while avoiding the extra overhead of resubmitting to the Chrome Web Store.
Bundle third-party libraries
If you are using a popular framework like React or Bootstrap, you can download the minified files, add them to your project and import them locally.
For your case, option #3 seems like the easiest. Looking at the Google Picker API documentation it only uses two relatively small script files, https://apis.google.com/js/api.js and https://accounts.google.com/gsi/client. You could try to bundle these in your Chrome extension and call the methods locally.

I cannot edit http files or use the http client on IntelliJ, how can I resolve this?

I am trying to learn Spring Boot and as part of this I need to send http requests to test the functionality of the API I have created.
When following along with this video, the teacher had an 'actions for URL' selection which I do not see in my own editor. Note that the point in the video I linked shows this.
After updating (to IDEA 2021.1) and restarting I still could not see this option.
I tried to create my own .http file, but am not able to work with this type of file.
After more research I found that I should have a plugin called 'http client' installed by default. I cannot find this in my installed plugins or by searching through the marketplace.
When downloading and installing manually (from here), I now get this error which I cannot resolve.
Please can someone give me a pointer to get this plugin working.
I assume you're using the Community Edition, so it probably doesn't have it since according to the JetBrains blog, HTTP Client is built-in on the Ultimate Edition.
You can also check the zip file for the plugin here.

build jmeter-parellarel-request-master

I need to write a scenario where we make several calls to an API in parallel with JMeter. The solution is based on OAuth, where a token is extracted and passed along with every call made to the API. This works fine, however, JMeter has no built-in option to make multiple parallel calls. I could divide them into separate thread groups, but this would not be desired.
Thread group
oauth calls to get token
extract token
api call /getCustomerActions
api call /getCustomerBlabla1..
api call /getCustomerBlabla2..
I've found the following custom sampler by Franz See:
https://github.com/franz-see/jmeter-parellarel-request
As I'm not big on development/compiling, my question would be how do I compile this package and use in in JMeter?
Download and install Apache Maven.
Download latest jmeter-parallel-request release
Unpack downloaded sources and switch to that folder
Invoke maven package command from that folder
Copy file from target/jmeter-parallel-request-xx.jar to JMeter's lib/ext folder
Restart JMeter to pick the plugin up
You can also check out How to Load Test AJAX/XHR Enabled Sites With JMeter guide for alternative solutions.
this plugin seems to work, but using it as a seperate thread group, all extracted values or tokens from other (main) threads are not captured.. too bad

Is there any API to automate extension installation in XWiki?

I use xwiki Enterprise 7.4. The official way to install extensions is to use either Import feature or Extension Manager. Both ways require user interaction. I would like to automate extension installation process, so no user interactions for extension installation. Is it possible? I've automated spaces/pages creation via REST API. Maybe it's possible to use REST API to do it, I can't find it in documentation.
Why do I need it? It's simple: I've automated all the steps of deployment/migration process for my application and I would like to automate xwiki extension installation too.
As indicated by Vincent, you can use the extension script service from inside XWiki. This script service is what the UI is using so everything the UI is doing can be done also by any script (as long as the script author has proper rights).
I just wrote a Velocity example on http://extensions.xwiki.org/xwiki/bin/view/Extension/Extension+Script+Module#HNon-interactiveandsynchronousinstall:
{{velocity}}
## Create install request for extension with id org.xwiki.contrib:extension-tweak and version 1.3 on current wiki
#set($installRequest = $services.extension.createInstallRequest('org.xwiki.contrib:extension-tweak', '1.3', "wiki:${xcontext.database}"))
## Disable interactive mode
$installRequest.setInteractive(false)
## Start install
#set($installJob = $services.extension.install($installRequest))
## Wait until install is done
$installJob.join()
{{/velocity}}
All you need is to put the Thomas' script in a page. You can use the REST API for that. See: http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI#HPageresources
Then you call the URL from your application.
Ex: you put the code in XWiki/AutoInstall with a REST call and then you can call this page with the following url:
http://localhost:8080/xwiki/bin/get/XWiki/AutoInstall
I suggest to use the "get" action from the URL to avoid unnecessary informations.
The XWiki Core dev team is aware of this and it's in the roadmap but it's not done yet. For example you can see that it was planned for the 8.0 roadmap but it slipped (http://www.xwiki.org/xwiki/bin/view/Roadmaps/Archives8xCycle/).
Continue improving upgrade tools: Scriptable upgrades (priority 1), Simulation (priority 2)
It seems there's no issue created for this at the moment. Would be great if you could create a JIRA issue at http://xwiki.org in the XWiki Platform project.
Now regarding extensions, there's some Script Service that can be used to manipulate extensions, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Extension+Script+Module
However this documentation is pretty terse. You could check the java code at https://github.com/xwiki/xwiki-platform/blob/95abd2951123431c1624c124b49ca7a88b41be00/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/src/main/java/org/xwiki/extension/script/ExtensionManagerScriptService.java#L84-L84
I've not personally used this script service so I can't give real examples of using this API

How to work with apache Jmeter with ZK Framework

I am new at performance testing and I would like to load 500 virtual users and check the response time of my application.
I want to use apache jmeter with ZK Framework.
Can you please help achieve this?
I don't know whether you've already resolved your problem or not, but the first thing you will need to do is download the relevant zk plugin (zk-jmeter-plugin-0.8.0.jar) available via http://blog.zkoss.org/index.php/2013/08/06/zk-jmeter-plugin/
save the plugin .jar to %apache-jmeter-root%/lib/ext
Once you've downloaded this, run JMeter. Within the Workbench object in your JMeter hierarchy, there will be a new 'Non-Test Element' entitled 'ZK HTTP Proxy Server'. You will need to use this rather than the standard JMeter 'HTTP(S) Test Script Recorder' to record your http requests.
I'm new to JMeter and the ZK Framework myself, but I've just been working on this so hopefully this detail will be helpful.
There are some additional config files you will need once you actually get going, but I'll wait to see if you still need any more help before bombarding you with info you might already have.
Cheers,
sqeeky