Are the JSONiq documentation code snippets valid? - jsoniq

I was trying some examples from the JSONiq document, but it throws error for some of the snippets from the document.
I have installed jsoniq (version 0.0.8) using npm.
Tutorial/Document link
Example :
if(1 + 1 eq 2)
then { "foo" : "yes" }
else { "foo" : "false" }
Error :
jsoniq run test.jq
/source/lib/compiler/Translator.ts:117
throw new Error("Invalid query plan.");
^
Error: Invalid query plan.
at Translator.compile (/source/lib/compiler/Translator.ts:117:19)
at JSONiq.compile (C:\ravindra\Setup\node-v14.15.5-win-x64\node_modules\jsoniq\dist\lib\JSONiq.js:60:29)
at Command.<anonymous> (/source/lib/cli/Main.ts:15:20)
at Command.listener (C:\ravindra\Setup\node-v14.15.5-win-x64\node_modules\jsoniq\node_modules\commander\index.js:315:8)
at Command.emit (events.js:315:20)
at Command.parseArgs (C:\ravindra\Setup\node-v14.15.5-win-x64\node_modules\jsoniq\node_modules\commander\index.js:651:12)
at Command.parse (C:\ravindra\Setup\node-v14.15.5-win-x64\node_modules\jsoniq\node_modules\commander\index.js:474:21)
at Object.<anonymous> (/source/lib/cli/Main.ts:53:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Is this code snippet invalid?
Few other snippets also throw the above error.
It would be of great help if anyone can point me to the latest/valid documentation or let me know if this syntax is no longer valid.

Yes, the snippet is correct. If it does not work, then it is specific to this implementation.
Rumble is actively supported and easy to install. It works on many file systems (your own disk, S3, HDFS...) and at many scales (small files all the way to billions of records).
You can also directly type (small) JSONiq queries into the public sandbox to play around. This is a Jupyter notebook pre-populated with queries taking you through a JSONiq tutorial.

Related

GlideApp symbol not found in Android Studio 4.1

I have been using Glide 4.11.0 and Realm 6.0.2 for some time now, and recently upgraded Android Studio 4.0.x to 4.1. All has been going fine. Today I ran the lint checker, and started doing some "clean up", nothing out of the ordinary (it would seem). One of the things I did a lot of was to replace switch statements that were testing against R.id. with if-else statements per the lint warning about what's gonna happen in Gradle 5.0.
When I did this, I did use a number of int variables I named 'id' that were to replace the value to compare - i.e. instead of a switch statement that would be:
switch (menuOpt.getId()) {
case R.id.xxx:
...
}
I would do:
int id = menuOpt.getId();
if ( id == R.id.XXX) {
} else if....
per the new guidelines.
Suddenly, on a full build AS complains that it no longer recognizes GlideApp, and I am also getting a very weird message about Realm not being able to process correctly:
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaPlayerActivity.java:61: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaDialogActivity.java:92: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
C:\BLD\AndroidStudioProjects\InTouch\app\src\main\java\com\reddragon\intouch\ui\MediaListActivity.java:48: error: cannot find symbol
import com.reddragon.intouch.utils.GlideApp;
^
symbol: class GlideApp
location: package com.reddragon.intouch.utils
Note: Version 10.0.0 of Realm is now available: https://static.realm.io/downloads/java/latest
Note: Processing class Album
error: Class "Album" contains illegal final field "id".
Note: [1] Wrote GeneratedAppGlideModule with: []
Class "Album" contains illegal final field "id".
4 errors
I have had the field 'id' in my Album class for about 2 years with no issues!
No manner of rebuild, invalidating cache and restarting, syncing gradle files or "reload all from disk" seems to help.
Actually, if I invalidate and restart, I don't get the red squiggle in the offending classes that are referencing GlideApp, but as soon as I start to run the app and it goes through a build process it errors out.
I Googled a bit and found one post where there seemed to be some conflict between Realm and Glide (RequestOptions), but the strange thing to me is why would this suddenly start occurring?
I have validated that the GlideAppjava class is in fact getting built - I am using the debug build variant, and I can see in the file system GlideApp.java that is in the ap_generated_sources/debug directory in the proper package where I have my class that extends AppGlideModule with the #GlideModule annotation.
So GlideApp is getting generated. It just isn't getting recognized.
One of the other new things is that I've recently created a Dynamic Feature module. This module does depend on a class that is in the base module (where GlideApp is referenced). Not sure if this is relevant (I had many, many successful builds before I started doing lint clean-up).
So frustrating! Any help appreciated.
It turns out that the answer was staring right at me, although somewhat hidden: part of the lint check that I did was accept some suggestions about making variables 'final' - including those that are used in Realm classes to define Realm objects. Realm doesn't like that - above build error output includes as a last line the statement 'Class "Album" contains illegal final field "id".'
"Album" extends RealmObject, and the "auto accept" of the lint's suggestion to make some of the fields final was the culprit.
I think this issue with Realm caused a ripple effect somehow with the other annotation processing - when I went back to all the RealmObject classes and removed the "final" declaration, build now completes smoothly.

How to fix error "Ambiguous use of 'increment'" on iOS Firestore increment()

I receive a compiler error when trying to use firebase FieldValue.increment(1) in iOS using swift. The error only says "Ambiguous use of 'increment'"
I have updated all my pods to the current versions of all firebase pods used. More specifically I am on Firebase(5.20.2) and FirebaseFirestore (1.2.1).
My code (below) is almost exactly the same as the example in the docs Seen at the bottom of this page
How can I fix this error and get the app to compile?
let docRef = db.collection("metadata").document("permanentConversions")
docRef.updateData([
"total": FieldValue.increment(1)
])
As noted in the comments, the "Ambiguous use of 'increment'" error is solved for me by changing the code in the example to
FieldValue.increment(Int64(1)).
The compiler provides an option of double or int64 for the increment operator and I guess it does not know which one to choose.

Deploying Microsoft.Maps/account

I have used an ARM Template to deploy a Microsoft.Maps/account resource to Azure.
That was successful:
Resource Microsoft.Maps/accounts 'nzmoebasedemo0000bt' provisioning status is succeeded
I'd like to retrieve the Primary key generated, within the ARM template, in order to persist it to a KeyVault.
I looked in https://resource.azure.com but the Maps/account provider was not listed, so could find no hint as to what property to read.
I tried:
[listKeys(resourceId('Microsoft.Maps/account', 'parameters('keyVaultVaultSecretMapsAccountResourceName')'), providers('Microsoft.Maps', 'account').apiVersions[0]).keys[0].value]"
Abd got back:
#{parameters=; status=Trial run failed. ; outputs=; provisionStateSucceeded=False; deploymentOutput=; errorCode=InvalidTemplate; errorMessage=Deployment template validation failed: 'The template resource 'azure.arm.base.keyVault.vault.secret' at line '168' and column '9' is not valid: Unable to evaluate template language function 'providers': function requires the second argument to be a multi-segmented resource type excluding the resource provider namespace. Invalid function argument 'account'. Please see https://aka.ms/arm-template-expressions/#providers for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'.}
Which in this case...seems incorrect.
What am I not seeing/getting?
Thanks!
Edit:
As per suggestion given, the following did pass a test run.
"[listKeys(resourceId('Microsoft.Maps/account', parameters('keyVaultVaultSecretMapsAccountResourceName')), '2018-05-01').keys[0].value]"
But when actually run, got the following:
1:02:35 AM - Resource Microsoft.Maps/account 'nzmoebasedemo0000bt' failed with message '{
"error": {
"code": "InvalidResourceType",
"message": "The resource type could not be found in the namespace 'Microsoft.Maps' for api version '2018-05-01'."
}
}'
Edit again:
As per guidance given in the comments, the following works! (after correcting api version, spelling mistake, and using 'primaryKey' property:
"[listKeys(resourceId('Microsoft.Maps/accounts', parameters('keyVaultVaultSecretMapsAccountsResourceName')), '2018-05-01').primaryKey]"
So the problem was due to a typo, the provider\resource is Microsoft.Maps/accounts

Kibana (Elasticsearch) dev environment

I want to embed one my specific chart in dahsboard of kibana. For that I need inject my JS into Kibana source. I have followed by instructions https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md to provide test environment, but I have obtained an error after "./kibana --dev"
let _ = require('lodash');
^^^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
Can anybody help me with start environment, or advice. Probably, I am moving by wrong way...my general goal (inject my JS code into Kibana) can be reached by another approach.
Thanks
I have reached my general goal, and if it is right - I place here my approach. (also, as an answer for above question)
When I was seeking ways how to implement what I want (my own custom metrics in dashboard....only as training and for personal "sport interest" sake) - I had chosen next way.
First of all - you need pay attention on index.js, not small one but huge file (more than 5MB), it predominantly contains angularJS terms.
My steps was:
I put into HTML empty container for my metrics
<div class="metric_container"></div>.
HTML defines in index.js as
define('text!plugins/dashboard/index.html',[],function () { return '<div dashboard-app class="app-container dashboard-container">\n .....
you can try to search ctrl+F it over the index.js
I found variable with JSON data for charts (esResp)
I found watcher on changing it $scope.$watch('esResp', prereq(function (resp, pre Resp) {....
Put in the body of watcher my_function () call.
finished my_function() call, that contains completing HTML metric sample with renewed figures (from esResp JSON) and putting it into
metric_container
so, I can develop my own metrics, charts, and it will be renew, but ONLY based on information provided in charts.
So, If you need smth - you need firstly create appropriate chart because of data set for you own calculations and further visualization.
Something So.
I am sure, probably there is best way, but my was.
I have created a number of visualizations for Kibana 4.4.1, and once you have the right baseline, it is no big deal.
I encourage you to take a look at any of my sources, in order to know what has to be done (http://github.com/JuanCarniglia).
There are some basic files you need to have, and you have them, you just put them on the src/plugins directory, and restart kibana. If everything is fine, you get a new visualization on the list.
If you encounter any problems or need a more detailed description, send me a message or post it here and I'll try to explain with more detail.

Error while compiling botan sample example in Qt

I am trying to find out the error for two days but still haven't got this unknown reason figure out.
I have configured and compiled Botan library. Everything goes ok but when try to write this sample code to be run..
S2K* s2k = get_s2k("PBKDF2(SHA-256)");
s2k->set_iterations(4049);
SecureVector<byte> key_and_IV = s2k->derive_key(48, passphrase).bits_of();
SymmetricKey key(key_and_IV, 32);
it says error: 'class Botan::PBKDF' has no member named 'set_iterations'
How can I solve this problem ?
The Botan docs for v1.11.1 report that the function get_s2k() has been deprecated, recommending that you use get_pbkdf() instead.
According to the docs, get_sdk(algospec) just returns the result of a call to get_pbkdf(algo_spec) which will give you a pointer to an instance of the class Botan::PBKDF.
First things first then, your code needs to be something more like:
PBKDF *s2k = getpbkdf("PBKDF2(SHA-256)");
Unfortunately without knowing what you want to do with s2k I can't help any further, as the docs have no reference to a public member function of PBKDF called set_iterations(). You're getting the error you mention because Botan::PBKDF really does have no member named set_iterations. You need to read the docs, work out what the purpose of set_iterations() was in your now deprecated example and hence how to achieve that purpose in the newer version of the library.
Possibly you missed your library header... as your error message says: 'has no member named...'

Resources