On the possible use of 'views'

At the end of closed Issue #48686,  [eernstg]  gives a brief description of a possible extension of adding views to DART.     This "issue" is really just a comment on what is being considered.
What is being considered would provide the features I was specifically looking for in the example I was building.    I  like the idea of
being able to specify a  kind of JSON encoding schema and having mostly automated code generation for examining the result with the appropriate types.
I can't really tell how well this will work in general, as I just don't have enough experience in the kinds of schema constraints that  might typically arise.
Perhaps you have already considered
what it would be like to use a JSON validating parser in DART that
translated a JSON encoding  with a schema into an "appropriate" typed DART object with views.     In this case,  the encoder might simply be able to infer the "appropriate" types from the schema without having to use views.
When dealing with XML schemas it is sometimes difficult to quickly understand what is being required.  In early versions of the language called
musicXML (used for specifying musical scores),  it was often difficult to
tell what was allowed.  In the latest version,  they have a natural language description of what is allowed with hyperlinks for the various parts.
A complex example is:   https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/note/
There might be some capability to automatically generate a partial natural language description of the JSON schema.   To what extent this meshes with DART document generation I don't know.

.. translated a JSON encoding with a schema into an "appropriate" typed DART object with views

I think you wouldn't do that: For performance, you would presumably use the views and never create those typed representations. For instance, with a List<dynamic> containing List<dynamic> containing String, you'd work on the objects structure as it is, and the dynamic type checks would be in the view methods, e.g., where an element from a List<dynamic> is returned with the type String, because we "know and trust" that it will be a string, based on the given schema.
The alternative would be, in the same example, to actually create an actual List<List<String>> containing List<String> containing String. This would give you the same type safety (and even more, because we've checked every type in order to create those objects, so if you can create them then there won't be any run-time type errors later on), but you'd have to pay for the creation of a complete copy of the given object structure. This is particularly expensive if you'd otherwise only visit a small part of the object structure.
Schemas can in principle use arbitrary underlying mathematical structures, so we can't really limit what a schema can say. But some schemas are just as simple as a bunch of interdependent record types: If you're looking at a node of schema-type T then we know that it has "fields" with specific names and values of specific schema-types. That's basically like a tree built from Pascal types (or C structs). In other cases we could have a kind of type field, and we could model something like a set of object oriented class types (so we could have subtyping, and we could detect the type of each node when we look at it). So the ability to model a given kind of schema depends entirely on what kind of schema we're considering. But it's enough in any given application if we can model the kind of schema that we're actually encountering. ;-)

I am mostly thinking about different use cases.  In many situations  I don't really need more powerful type checking.  I just need more clever encoding/decoding.
For simple cases,  the encoder simply looks at the sup of the types for each List and Map based on the schema.   So  I get results such
as List<List<String>>   or maybe Map<String, List<num>> and yes I might get List<List<Object?>>.   This is often good enough.  It is better than using the current decoder.
So i am not much help.  I just can't tell whether the benefit from the proposed enhancement is worth the added complexity in the language.  For example,  I wonder whether you really want to add that kind of sub-typing as a potential option.   Seems like there could be a lot more unexpected exceptions that are not properly handled.
One can imagine a specification requiring a non-negative number when in fact -0.00001 was added to the list.  Later, when accessed an exception is thrown.  But it might turn out that without the sub-typing this very rarely actually leads to a significant problem because the constraint is slightly stronger than what is needed.
A non-JSON example :
I have a case where I have to import musicXML,  allow users to change it and potentially  export the result as musicXML.   The import processes the internally generated XML into something that is not
like the original XML structure at all.   Hence,  more accurate type representation would only help with reducing the amount of initial casting or conversion needed for that generation.   And that  turns out not to matter much.
The challenges are not connected with parsing or typing, but the complexity of building the desired internal structure which is not a perfect match for what the musicXML encodes.


Compiler warnings on ESP-IDF

When compiling on ESP-IDF for ESP32, I get the following compiler warnings:
ill.cpp.obj
.../Trill.cpp: In member function 'boolean Trill::read()':
.../Trill.cpp:138:17: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  138 |         boolean ret = true;
      |                 ^~~

and
.../Trill.cpp: In member function 'void Trill::setNoiseThreshold(uint8_t)':
.../Trill.cpp:267:22: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  267 |         if(threshold > 255)
      |            ~~~~~~~~~~^~~~~
.../Trill.cpp:269:22: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  269 |         if(threshold < 0)
      |            ~~~~~~~~~~^~~

It seems the latter error is due to the fact that threshold is a uint8_t argument. I suppose that the following lines (267-270) could be removed from Trill.cpp:
if(threshold > 255)
	threshold = 255;
if(threshold < 0)
	threshold = 0;

As for the former warning, presumably the last line of Trill::read() should be return ret, or perhaps boolean ret doesn't need to be declared in the first place?
Obviously, since these are mere warnings, it's not a big issue if this is considered not worth fixing, but it seems prudent to squash these warnings anyways. I would be glad to open a PR if that is helpful, although I would need guidance on how to handle boolean ret (e.g. return ret or get rid of it?).

thanks, sorted


Add shaders

This PR populates the "Shaders" tab for the currently selected event.

This PR populates the "Shaders" tab for the currently selected event.

Great job! i cannot see from the screen shot, but is the stats from shaderdb also shown in the UI?

is the stats from shaderdb also shown in the UI?

Do you mean the stats shown after the disassembly in cffdump? E.g.
Stats:
- shaderdb: 56 instr, 9 nops, 47 non-nops, 2 mov, 0 cov
- shaderdb: 0 last-baryf, 0 half, 3 full, 4 constlen
- shaderdb: 17 cat0, 3 cat1, 8 cat2, 24 cat3, 0 cat4, 0 cat5, 4 cat6, 0 cat7
- shaderdb: 0 sstall, 4 (ss), 2 (sy)

I'm not currenly displaying these, except for "full", which as far as I can tell is the number of GPRs used by the shader.

is the stats from shaderdb also shown in the UI?

Do you mean the stats shown after the disassembly in cffdump? E.g.
Stats:
- shaderdb: 56 instr, 9 nops, 47 non-nops, 2 mov, 0 cov
- shaderdb: 0 last-baryf, 0 half, 3 full, 4 constlen
- shaderdb: 17 cat0, 3 cat1, 8 cat2, 24 cat3, 0 cat4, 0 cat5, 4 cat6, 0 cat7
- shaderdb: 0 sstall, 4 (ss), 2 (sy)

I'm not currenly displaying these, except for "full", which as far as I can tell is the number of GPRs used by the shader.

is it difficult to add those? i think it would be interesting to show those states (not necessarily in this PR though)

is it difficult to add those? i think it would be interesting to show those states (not necessarily in this PR though)

It's not difficult to add, but where should they go in the UI? One option is to just add them as text after the disassembly (similar to the output from cffdump).

yeah, i think that should be good enough


[Request] Swapable configs

It would make possible to create fun events where you load one config to lets say increase ammo for classes and later different one to increase hp or speed
Configs could be selected via cvar e.g.: sm_playerclassdata_configfile "pcdh_increasedammo.cfg" and defaults to playerclassdata.cfg

With version 23w23a, change sm_tf2playerclassdataconfig to whatever path, then run sm_playerclassdata_reloadconfig


"php-http/httplug" package is not installed

PHP version: 7.4.16
Description
I installed this library:
https://symfony.com/doc/4.4/http_client.html
I am using it, but when I run this code:
use Symfony\Component\HttpClient\HttplugClient;

$httpClient = new HttplugClient();

I got this error:
You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/httplug" package is not installed. Try running "composer require php-http/httplug".

Here the output of composer show | egrep "symfony|php-http
php-http/httplug                         2.2.0         HTTPlug, the HTTP cl...
php-http/message-factory                 v1.0.2        Factory interfaces f...
php-http/promise                         1.1.0         Promise used for asy...
symfony-cmf/routing                      2.3.3         Extends the Symfony ...
symfony/console                          v4.4.25       Eases the creation o...
symfony/css-selector                     v5.3.0        Converts CSS selecto...
symfony/debug                            v4.4.25       Provides tools to ea...
symfony/dependency-injection             v4.4.25       Allows you to standa...
symfony/deprecation-contracts            v2.4.0        A generic function a...
symfony/error-handler                    v4.4.25       Provides tools to ma...
symfony/event-dispatcher                 v4.4.25       Provides tools that ...
symfony/event-dispatcher-contracts       v1.1.9        Generic abstractions...
symfony/filesystem                       v4.4.26       Provides basic utili...
symfony/finder                           v5.3.0        Finds files and dire...
symfony/http-client                      v4.4.26       Provides powerful me...
symfony/http-client-contracts            v2.4.0        Generic abstractions...
symfony/http-foundation                  v4.4.25       Defines an object-or...
symfony/http-kernel                      v4.4.25       Provides a structure...
symfony/mime                             v5.3.0        Allows manipulating ...
symfony/polyfill-ctype                   v1.23.0       Symfony polyfill for...
symfony/polyfill-iconv                   v1.23.0       Symfony polyfill for...
symfony/polyfill-intl-idn                v1.23.0       Symfony polyfill for...
symfony/polyfill-intl-normalizer         v1.23.0       Symfony polyfill for...
symfony/polyfill-mbstring                v1.23.0       Symfony polyfill for...
symfony/polyfill-php72                   v1.23.0       Symfony polyfill bac...
symfony/polyfill-php73                   v1.23.0       Symfony polyfill bac...
symfony/polyfill-php80                   v1.23.0       Symfony polyfill bac...
symfony/process                          v4.4.25       Executes commands in...
symfony/psr-http-message-bridge          v2.1.0        PSR HTTP message bridge
symfony/routing                          v4.4.25       Maps an HTTP request...
symfony/serializer                       v4.4.25       Handles serializing ...
symfony/service-contracts                v2.4.0        Generic abstractions...
symfony/translation                      v4.4.25       Provides tools to in...
symfony/translation-contracts            v2.4.0        Generic abstractions...
symfony/validator                        v4.4.25       Provides tools to va...
symfony/var-dumper                       v5.3.0        Provides mechanisms ...
symfony/yaml                             v4.4.25       Loads and dumps YAML...

This sounds like an exception being raised by Symfony. The bug is probably with them.

The code behind: HttplugClient class is:

if (!interface_exists(HttplugInterface::class)) {
    throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/httplug" package is not installed. Try running "composer require php-http/httplug".');
}

if (!interface_exists(RequestFactory::class)) {
    throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/message-factory" package is not installed. Try running "composer require nyholm/psr7".');
}

/**
 * An adapter to turn a Symfony HttpClientInterface into an Httplug client.
 *
 * Run "composer require nyholm/psr7" to install an efficient implementation of response
 * and stream factories with flex-provided autowiring aliases.
 *
 * @author Nicolas Grekas<EMAIL_ADDRESS> */
final class HttplugClient implements HttplugInterface, HttpAsyncClient, RequestFactory, StreamFactory, UriFactory
{

yep, as the code says. if you want to instantiate the symfony client HttpPlugClient adapter, you need to require php-http/httplug.
if you use the symfony framework, just typehint Symfony\Contracts\HttpClient\HttpClientInterface to get injected the right client.
if you don't care what client you use, i'd recommend to instantiate the curl client or native stream client as explained at:
https://symfony.com/doc/4.4/http_client.html#enabling-curl-support

yep, as the code says. if you want to instantiate the symfony client HttpPlugClient adapter, you need to require php-http/httplug.

It is installed, see the output of my composer show on my first comment.

Can you please share your composer.json file?

Yes, sure:
{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 9 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/admin_toolbar": "^3.0",
        "drupal/block_field": "^1.0@RC",
        "drupal/core-composer-scaffold": "^9.1",
        "drupal/core-project-message": "^9.1",
        "drupal/core-recommended": "^9.1",
        "drupal/editor_advanced_link": "^1.8",
        "drupal/editor_file": "^1.5",
        "drupal/entity_embed": "^1.1",
        "drupal/entity_usage": "^2.0@beta",
        "drupal/feeds": "^3.0@alpha",
        "drupal/field_config_cardinality": "^1.1",
        "drupal/field_group": "^3.1",
        "drupal/gtm": "^1.6",
        "drupal/link_attributes": "^1.11",
        "drupal/mailsystem": "^4.3",
        "drupal/metatag": "^1.16",
        "drupal/owlcarousel": "^1.0@alpha",
        "drupal/paragraphs": "^1.12",
        "drupal/paragraphs_ee": "^1.7",
        "drupal/paragraphs_features": "^1.11",
        "drupal/pathauto": "^1.8",
        "drupal/quicklink": "^2.0@beta",
        "drupal/rabbit_hole": "^1.0@beta",
        "drupal/redirect": "^1.6",
        "drupal/scheduler": "^1.3",
        "drupal/search_api": "^1.19",
        "drupal/sendgrid_integration": "^1.7",
        "drupal/simple_recaptcha": "^1.0@beta",
        "drupal/simple_sitemap": "^3.10",
        "drupal/structured_data": "^1.2",
        "drupal/swiftmailer": "^2.0",
        "drupal/token": "^1.9",
        "drupal/token_filter": "^1.2",
        "drupal/twig_field_value": "^2.0",
        "drupal/twig_tweak": "^3.0",
        "drupal/views_accordion": "^2.0",
        "drupal/views_slideshow": "^4.8",
        "drupal/webform": "^6.0",
        "drush/drush": "^10.4",
        "guzzlehttp/promises": "^1.4",
        "nyholm/psr7": "^1.3",
        "php-http/httplug": "^2.2",
        "symfony/http-client": "^4.4"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

sorry, i overlooked that you have php-http/httplug installed.
but then it sounds like an issue with autoloading or something.
looking at https://github.com/symfony/http-client/blob/5.3/HttplugClient.php, i see that the "HttplugInterface" is an alias from our HttpClient interface. when you tried in your own code, did you also create the alias?


CORE-5599 Unified external events POC

The sending on events to external workers is unified to simplify the handling of sending requests and receiving responses. This reduces the amount of code we have to write to add new functionality that requires communication with other workers.
As we are making a generic solution there will be limitations that each specific use-case requires, however a number of scenarios have already been identified and the solution should cater for them all.
The generic code handles the sending of events to other workers, receiving ExternalEventResponses from them and determining whether to resume a flow or not based on the responses.
How to use
After these changes, to send an event/request to a worker and receive a response in a service running in a flow, the following must be done:
Inside the flow worker

Inject ExternalEventExecutor into the service that needs to send an event.
Create an OSGi component that implements the ExternalEventHandler interface and make it discoverable via that interface.
In the ExternalEventHandler.suspending implementation, use the ExternalEventContext passed in to set the flowExternalEventContext property of the created payload/event.
Call ExternalEventExecutor.execute and pass it the created ExternalEventHandler.
Once the response is received, the flow will resume with the RESUME type defined in ExternalEventHandler.

Inside the external worker

Define a DurableProcessor or StateAndEventProcessor that receives whatever Avro object that the processor wants to receive. The external event framework does not restrict this.
Process the event, which ends in either a successful response or an error response.
Use ExternalEventResponseFactory to create a successful response or error response as required.

API PR - https://github.com/corda/corda-api/pull/480

When merged used my commit description


Discussion of structure of HomeworkDetailView

At the moment the component HomeworkDetailView has a lot of functionality:
(doing homework/ display of one homework/ display of statistics)

student/doing homework: student sees the exercise list and can do the exercises

student/homework submitted: after submission the student should not be able to fill out again and should see the submitted solution

teacher/homework: teacher can see all statistics and individual ones

Do you think it is a good idea to split the HomeworkDetailView in a StatisticsView (teacher and student) and a HomeworkDetailView (only student doing homework)?

I think we should use this view only for the student. The teacher gets another view for the statistics. Therefore he will be redirected when entering a single homework.

I agree, it makes more sense to have a separate component for a separate user type


Add rules_jsonnet 0.6.0

This release no longer needs any local patching on the BCR side, as upstream includes a MODULE.bazel. Furthermore, this release addresses some known issues in the area of import path handling.

Hello @@EdSchouten, modules you maintain (rules_jsonnet) have been updated in this PR. Please review the changes.


Nicolas P. Rougier: new volunteer via Mozilla Science Lab Collaborate

Hello,
I'm in the process (with @khinsen) of creating a peer-reviewed scientific journal that lives on github and which is dedicated to the replication of results in computational science. It is not yet officially open but you can get a better idea at https://github.com/ReScience/ReScience/wiki.
We're currently in the process of testing the review system to check if will allow us to ultimately publish an article with the associated DOI through Zenodo (https://github.com/ReScience/ReScience-submission/pull/3).
I've just stumbled upon your project and while I'm not sure how I can help, I would be definitely interested in following your progress and integrate the proposed standardized metadata it in the journal.
NicolasThis issue was created by @rougier via Mozilla Science Lab Collaborate

@rougier Fantastic -- there's a list of outstanding issues in the issue tracker, and lots of interesting cross-walk work to be done.  Feel free to just follow along, or let us know if you're interested in more actively engaging in the comparison work on any of those tasks.


file:// = http request never send out

Hey guys,
I found if the browser-window load with file://xxxxx/index.html, my http request can never send out, however, the browser-window.loadUrl(http://xxxxxxx) works. Any idea?
http request code from (http://davidwalsh.name/nodejs-http-request)
        var http = require("http");
        http.get({
            host: 'personatestuser.org',
            path: '/email'
        }, function(response) {
            // Continuously update stream with data
            var body = '';
            response.on('data', function(d) {
                body += d;
            });
            response.on('end', function() {

                // Data reception is done, do whatever with it!
                var parsed = JSON.parse(body);
                resolve({
                    email: parsed.email,
                    password: parsed.pass
                });
            });
        });

@EricTsangX does the resolve function was defined before the http.get call?

Yes, I am using native es6 promise. I tried to use console.log and found the callback is not triggered.
Devtools- network also report nothing

@EricTsangX I've made the same call and http.get request was made, successfully triggering the callback.
You might want to check your code for any issues.

Thanks. I found the problem. I am using co+generator to deal with callback hell, but it seems it only work with "http://", cannot use with "file://", weird...

Thanks. I changed to use jQuery ajax, it works now. It seems NodeJS http request cannot work in Chromium?

If you want to retrieve file contents by accessing it via file:// protocol, you might want to look at
protocol module.
HTTP module works fine. As I already told, your snippet above works fine and the callback successfully triggered with the received JSON.

The requests sent from http module are not recorded in devtools because Node.js uses its own networking instead of Chromium's.


minify the

Dear team,
It is possible to add a resource to allow us to minify the content inside the

allow us to minify the content inside the


REF_CODE_REFACTOR: Round

refactoring the reference code for round operator.
BUG=refactoring existing code.

Closing in favor of mutually agreed upon higher priority PRs. Please reopen if needed.


Better Lodash usage

In https://github.com/miragejs/server/pull/77 we pulled in individual lodash packages instead of lodash-es but it's kinda lousy dev experience. Would love to get our setup better so we can just use lodash-es but get tree-shaking working!

agreed, the extra modules to import and deps aren't super fun. I mostly worked on apps and not libs so  I don't know if there's a difference, but I've used https://www.npmjs.com/package/babel-plugin-lodash in the past for the the same thing. Does that play nice w/ rollup'd packages? I'll spike it out to see if the bundle is the same

It really should come "for free" once we have our build setup working correctly. The problem was our UMD build had all of lodash. Would love to see what you come up with!
We're also talking about trying out tsdx because (a) our build setup is screwed up right now (b) it is a huge pain to work on it (c) we want to add typescript support eventually and that will just complicate things further.


When deploying, the service version cannot be selected

let me do it

@WangLiNaruto Great catch. 👍


make test-python error

Hello,
I encountered an error with make test-python . The error says
cp: cannot stat 'target/release/libinstant_distance.dylib': No such file or directory make: *** [Makefile:3: test-python] Error 1
I would greatly appreciate any help.
Thank you.
Best,
Yazhini

Hi, sorry about that -- I guess this has only been tested on macOS. What platform are you on? What file is generated in target/release if you run cargo build --release?

I tried it on a Linux system. target/release contains *.rlib, *.so and *.d files.


If-Else pattern, "let" element

I'm finding myself constantly writing code that seems like an anti-pattern to me:
<div if.bind="property | transform | something:param1 | pluck:'blah' & signal:'some-signal'">
   (something)
</div>
<div if.bind="!(property | transform | something:param1 | pluck:'blah') & signal:'some-signal'">
   (something else)
</div>

This is clearly an If-Else pattern, but here it feels like an anti-pattern, because of:

repetition of code (not DRY)
double execution of the whole transformation chain

Is there a better way to do this that I'm not aware of? How could an else be implemented as a custom attribute? Perhaps something like:
<template if.bind="property | transform | something:param1 | pluck:'blah' & signal:'some-signal'">
  <true>
    (true content)
  </true>
  <false>
    (false content)
  </false>
</template>

Thoughts?

@martingust @jdanyow I'm wondering if we could build an else behavior that could somehow connect to a previous if behavior in the DOM. I've had this at the back of my mind. Over the years, I've encountered this scenario on almost every project and it's a pain to repeat positive and negative if blocks. If we do this, we might also  consider elseif and even switch case as well. I don't know what the answer is, but it's worth thinking about. If we do this, we also need to stress the importance of not putting complex logic inside a template....we don't want to solve on problem and create another.

One thing that works today is:
<div ref="foo" bar.bind="property | transform | something:param1 | pluck:'blah' & signal:'some-signal'">
  <div if.bind="foo.bar">
     (something)
  </div>
  <div if.bind="!foo.bar">
     (something else)
  </div>
</div>

This effectively stores the result of the binding expression on an ad-hoc property which can then be referenced in other binding expressions.

I think it would be nice if we had a template-controller element called <let> that has no UI, all it does is set properties on the overrideContext so that they are available for binding purposes:
<let foo.bind="property | transform | something:param1 | pluck:'blah' & signal:'some-signal'"
     bar.bind="some | other:expression">
</let>

<div if.bind="foo === 'a'">
   (something)
</div>
<div if.bind="foo === 'b'">
   (something)
</div>
<div if.bind="foo === 'c'">
   (something)
</div>

<div if.bind="bar">
  (something)
</div>
<div if.bind="!bar">
  (something)
</div>

Here's an implementation of the <let> element.  Turns out it didn't really need to be a template controller...
import {
  customElement,
  noView,
  TargetInstruction,
  inject
} from 'aurelia-framework';

@customElement('let')
@noView()
@inject(TargetInstruction)
export class LetElement {
  instruction = null;
  bindings = null;

  constructor(instruction) {
    this.instruction = instruction;
  }

  bind(bindingContext, overrideContext) {
    let expressions = this.instruction.expressions;
    let i = expressions.length;
    let bindings = this.bindings = [];
    while (i--) {
      let binding = expressions[i].createBinding(overrideContext);
      binding.bind({ bindingContext, overrideContext });
      bindings.push(binding);
    }
  }

  unbind() {
    let i = this.bindings.length;
    while (i--) {
      this.bindings[i].unbind();
    }
    this.bindings = null;
  }
}

http://plnkr.co/edit/zGI9d7?p=preview

This is an interesting idea. I like it because it could enable all the scenarios with a single concept, plus open up some other possibilities. We don't necessarily need to do this as a custom element. We could bake in knowledge of "let" into the compiler. This would make it more efficient. The result of such an element could be to simply parse the attributes into binding expressions that were added to the view factory. Thoughts?

That would be great, a lot more lightweight, no BehaviorPropertyObservers and could potentially skip parts of the template compilation work when it's a let element because we know it shouldn't have any behaviors, content, etc.  Maybe even remove the let element from the template so that it doesn't interfere with css, etc.

Yes, exactly. It would be pretty simple. Here's the place it would go: https://github.com/aurelia/templating/blob/master/src/view-compiler.js#L283

ok cool! Let me see if I can come up with a PR after I get a couple binding issues fixed.

Sounds good.

I love let! Great thinking @jdanyow.
As a side note, it would be great if the docs for ref would have this type of usage documented and explained, cause I did read about it, but did not realize you can use it for storing bindings like that. (in fact I was trying to do exactly that, and was bumping my head on the wall, trying to figure out why won't a nested <template bindable="foo" foo.bind="binding"> work for that same purpose.

@EisenbergEffect I was looking at the implementation details some more. These bindings differ from standard bindings in a few ways, most importantly, the target of these bindings is the overrideContext.  This means when expression.createBinding(target) is called by the view factory, it's too early and the target argument isn't the right thing / not needed.
I was thinking we should create dedicated expression and binding classes for this feature: LetExpression and Let. These would be simplified versions of BindingExpression and Binding. The benefit would be cleaner code for the binding itself and things that work with bindings like binding behaviors and the repeat. Couple downsides to this approach: <let foo="${bar}"></let> wouldn't work and we'd probably need to expand the BindingLanguage API here with an isLet argument or something.
Thoughts?

Can you put together a full proposal? Including proposed syntax, use case examples and what we would need to change to make it happen?

May I ask what the situation is with else, elseif, and switch? These would seem to be very useful for creating cleaner and more comprehensible templates, but would not seem to have been introduced to Aurelia yet.

@jdanyow @martingust We should revisit this. What do you guys think?

Just adding my two cents: The let, switch, else-if, are all very nice, but in practice all I ever needed was an else. That problem as stated by OP is very simple and could use a simple solution. Something that can be understood by a designer who may just want to move dom elements around without understanding everything.
Something like
<div if.bind='foo'>
   ...
</div>
<div else>
  ...
</div>

I'm interested in a solution for this kind of scenarios. I found myself writing some anti-pattern as @niieani described and while doing that, thinking "this is not good... hopefully there's a better way to do it". Usually I rework some VM property to make the view more simple but still not ideal.

Here is what I am doing:
`
function contentProcessor(compiler, resources, node, instruction) : boolean
{
let trueContent: string = void(0)
let falseContent: string = void(0)
for(const n of node.children)
{
    if(n.nodeName == "TRUE")
    {
        trueContent = n.innerHTML
        continue
    }

    if(n.nodeName == "FALSE")
    {
        falseContent = n.innerHTML
        continue
    }
}

if(!trueContent && !falseContent)
{
    node.innerHTML = `<template replace-part="true">${node.innerHTML}</template>`
    return true
}

let output = ""

if(trueContent)
    output = `<template replace-part="true">${trueContent}</template>`

if(falseContent)
    output += `<template replace-part="false">${falseContent}</template>`

node.innerHTML = output
return true

}
@processContent(contentProcessor)
@customElement("if")
export class DoixIfElement
{
@bindable value : boolean
}

`
Effect:
 <if value.bind="true">         True  </if>  <if value.bind="x">      <true>True</true>      <false>False</false>  </if>
Still, many cases to consider (same problems as templates replace-part) but I am not going to worry about them currently.

@arekbal Your solution works like a charm!

+1 on if/else

@arekbal After using it for a while, it seems like IE did not like it(out of stack space errors during loading time) and I had to revert back to previous bindings :(

Hello guys, how are you?
I am wondering if the Aurelia team plans to officially support this feature?
I've been running into it since day 1 -- even back in Durandal. Just seems to be a general problem in conditional layouts.
Anyway, thank you.

@Kukks
https://github.com/aurelia/dialog/issues/45
It seems to be related... just like I said... same problems as templates.
Works with Edge, and is out of stack space on IE.
I went throught recurrenting aurelia code in IE debugger - node processing hits nodeType 1 instead of 11
and later on there is no source.content both of which are part of HTMLTemplateElement spec. It could probably be hacked/fixed(in aurelia or in customElement) but I had no time to do so. It seems a bit more time consuming than I initially thought.

I recently wrote an npm package which addresses the if/else issue using HTML <slot> elements.

It looks like this is now released as part of core aurelia as mentioned in Aurelia Release Notes - Early October 2017:

If/Else - We've added an else attribute that you can use in combination with the if attribute in your templates! No more need for inverse if statements to handle the falsy case.`

I couldn't find any documentation about it. Is it same as proposed by @cb-fred ?
<div if.bind='foo'>
   ...
</div>
<div else>
  ...
</div>

That's how it works, yes.

This is great, would've been nice if it also worked with 'show'  (show/else)

Any plans for switch or else if?

One more vote for switch support!

Any thoughts on else if? Run into a few use cases for it.

@MJSanfelippo Can you help put your use cases into a feature request issue? Also would be great if you could give some more thought/explanation for it 👍

@bigopon Can't post company code, but can give a vague rundown. We have a list of things and each thing has a property that's an enum. There are 15-20 different values this enum could be. We're conditionally binding a certain child component based on the value of that enum. So that's 15-20 times it needs to check the if.bind whereas if we had if, else if, else if, else if... else if, else, it would only check until it hit the correct one (just like a normal else, else if, else block in programming). Obviously checking the value of an enum is not a huge performance hit, but this specific component that conditionally binds based on the enum is on the page as many times as the user sets it to which could be anywhere between 10-100+, we don't know really know.
Basically, the use case is the same use case that using if, else if, else in a programming language is. It's inefficient to just do if (thing) if (otherThing) etc.


Enable authentication in web playground

Support authentication in web playground

Tested that the auth flow works with changes. Merging the PR.
@RMacfarlane Please let me know if you have any additional feedback.


[FEATURE] Distance queries for the primitives (distance to surface)

Is your feature request related to a problem? Please describe.
Provide an interface to query the (closest-) distance to the surface from any point in space in or surrounding the scene, preferable using the already existing acceleration structures. This kind of query is useful in many applications involving inhomogeneous materials.
Describe a possible solution.
Implement a distance to surface function for each primitive. Implement a distance traversal for the bvh (check if point is inside bounding box of node).
Describe alternatives you've considered
Using a library that provides the acceleration structured and queries for the primitives.
Additional context
The query would be available in the scene api and provide the prim_id, geom_id, closest_point and closest_distance.

Currently the following things are implemented in features/distance_to_surface:

plane

sphere

initial implementation for triangles

Still missing:

cylinder (somewhat complicated, because elliptical shapes are allowed)
BVH traversal for distance queries (e.g. find primitive to which point P is the closest)

I will keep working on the problem. First, I will complete the triangle implementation and test it properly. Then I will work on the cylinder and the BVH traversal. Might take a week or two.

BVH traversal is still missing and tests for triangle distance to surface is still missing, everything else is addressed in PR #59.


test: fix golang lint issue with pr tests

Description
Simple fix in pr_test.go to resolve issue caught by the latest golang linter.
Release required?

[x] No release
[ ] Patch release (x.x.X)
[ ] Minor release (x.X.x)
[ ] Major release (X.x.x)

Release notes content

Run the pipeline
If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.
Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:
/run pipeline

Checklist for reviewers

[ ] If relevant, a test for the change is included or updated with this PR.
[ ] If relevant, documentation for the change is included or updated with this PR.

For mergers

Use a conventional commit message to set the release level. Follow the guidelines.
Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
Use the Squash and merge option.

/run pipeline

:tada: This PR is included in version 1.1.2 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:


Deprecate .egg uploads

Currently PyPI accepts uploads for two distribution types: source distributions, and built distributions. PyPI accepts two built distribution types: wheels and eggs:
https://github.com/pypa/warehouse/blob/7732f2fb9eb0b1da032731d926a094f5f5d1488f/warehouse/forklift/legacy.py#L542
Eggs have never been widely used and have been far outpaced by wheels in recent years:

Some additional details:

As of Dec 2021, eggs have accounted for less than 1% of built distribution uploads.
pip deprecated the --egg command in 2016: https://github.com/pypa/pip/issues/1749
setuptools deprecated the bdist_egg command in https://github.com/pypa/setuptools/pull/1764
build only supports wheels for built distributions: https://pypa-build.readthedocs.io/en/latest/#python--m-build---wheel

My (biased) industry exposure is that the only major place where eggs come up at this point (and where developers stumble over them) is PySpark. Specifically the spark ecosystem still prominently mentions eggs as the way to attempt to fan out dependencies.
At some point I'm sure I investigated why they still have not caught up, but yeah that's where I see eggs ever mentioned personally, with big data developers who find that and don't know wheels replaced them a long time ago.

Additional data points:

In the last 365 days:

2830 Projects had releases that included eggs
12517 total bdist_egg uploaded to PyPI

in the last 30 days:

307 Projects had releases that included eggs
716 total bdist_egg uploaded to PyPI

In rolling this out, it seems reasonable to add a notification email to the uploader of any bdist_egg at upload time warning them and pointing to some documentation and a timeline.

Also, to be clear: I'm +1 to deprecating egg uploads.
The Removal Process section of PEP 527 shows prior art for this kind of thing in the past. I'm not sure if we would want to go so far as the "disable with exception" route, especially if we are notifying uploaders.

Just for reference, there's a Spark issue to add wheel support, as well as another proposal, but it was automatically closed many years ago and no one ever implemented it. Based on their docs and the comments on those issues, it seems the community may have moved on from egg deployments, with virtualenv support and the other deployment mechanisms mentioned on the above-linked docs page being seen as potentially better alternatives.

Based on https://twitter.com/yenzenz/status/1486416369340010508?t=Fp1VvBzrztarwCX0pmgIyw&s=19 looks like the Plone community still needs the ability to upload eggs for a while, so it might make sense to give existing projects a longer period to migrate, but start blocking this for new projects in the short term after a deprecation period.

@jensens Thanks for the information! If Plone 6 is released this year with wheel support built in, and Plone 5.2.x gains support through buildout v3 within the same general timeframe, would something like one year of PyPI upload deprecation (i.e. Jan/Feb 2023) be sufficient? All this proposal would do is prevent uploading new egg distributions for future versions, it wouldn't stop your users from still getting existing egg-only updates indefinitely. So as long as at least one version was released with wheel support, as an egg before the end of the deprecation period, your users should presumably be able to upgrade to that version, and then to any future versions. Certainly a possible two-step upgrade process for users not keeping up with updates (as your security policy states they should) is not quite optimal, but it should still work, right (and since you maintain your own tooling, you could smooth out any UX kinks)?

I think the sketched plan works for the Plone community. We stick to the old stuff too long and we are aware of it. I fear we are responsible for a significant part of the eggs. Anyway, I would like to get an opinion from our release managers @mauritsvanrees and @esteele here as well.

Hello from one of the Plone release managers. I don't remember the last time I uploaded an egg, maybe I never did this. I always upload the source distribution, and the last few years a wheel. But the packages I handle are pure Python, no C code.
Plone is built on top of Zope, which does have C code in some packages, and those will have some eggs. But I checked a few, and latest releases seem only the source distribution plus one or more wheels. cc some Zope people: @dataflake, @icemac. Do you still upload eggs?
For Plone 5.2 (the current stable release), I expect to give about two more years of security support, so until early 2024. The happy path would be that Plone 5.2 users could still use zc.buildout 2. This does not use pip, but a heavily edited own copy of easy_install, so I usually couple this with setuptools 42 to avoid getting deprecation warnings. And Plone 5.2 can still run on Python 2.7, so ideally that would still work as well. Yes, old.
But since there are no plans to stop such old software from downloading existing eggs, this should be no problem. And most security fixes that we do, are done with Python monkey patches in small hotfix packages. No one should have trouble installing these, even if we only upload a source distribution.
Also, just to be clear: Buildout itself can already install wheels since version 2.9 or so, which is several years old. The Plone packages do not care whether a package is installed from an sdist, an egg, or a wheel. So no action needed there.
Summary: a deprecation period of about a year should be fine for us.

Zope people: @dataflake, @icemac. Do you still upload eggs?

Not that I am aware of.

Zope people: @dataflake, @icemac. Do you still upload eggs?

We stopped uploading eggs many years ago. The last one I could find using a quick search was from 2018. Nowadays we use sdist for Python-only packages and additionally wheels if there is C code involved. From Zope perspective I see no problem in removing support for uploading eggs.

Sounds like it's for PyPI start raising a warning when an Egg is uploaded, and then after some period of time (say, 6 months or a year), drop support.
@jensens @mauritsvanrees What's Plone's status on this? Skimming your site, it looks like Plone 6 is in rc2, so I presume release is imminent. Has Plone 5 moved to buildout 3? When did that happen?

What’s the next steps to move forward on this?

Something like PEP 527#Removal Process / https://github.com/pypi/warehouse/issues/6792?

Unless blocking issues are found that require more work, we expect to release Plone 6.0.0 final on December 12, 2022.

https://plone.org/news/2022/plone-6-rc2-released

We're going to move ahead with implementing the block. @woodruffw would like to do the implementation.
This will include a blog for notice and emails when egg upload are attempted.

I think we should probably do a PEP for this, like https://peps.python.org/pep-0527/, as @hugovk mentioned above.

@woodruffw wanna write a PEP?

@woodruffw wanna write a PEP?

I think I've sniped myself into it 🙂

Cross-referencing: I've opened a draft PEP here: https://github.com/python/peps/pull/3161

As of Dec 2021, eggs have accounted for less than 1% of built distribution uploads.

How minuscule is it now?

As of Dec 2021, eggs have accounted for less than 1% of built distribution uploads.

How minuscule is it now?

In all of May 2023: 581 wheels were uploaded among the 236,261 total distribution files, representing 0.2% of files uploaded to PyPI.

PEP 715 was accepted, so this is unblocked!
A list of the tasks that need doing:

Send a mass email to every maintainer of a package that has uploaded an egg distribution since 2023-01-01;
Update the upload endpoint to send an email to each maintainer whenever an egg distribution is uploaded (for the next month);
Draft a post for the PyPI blog announcing the deprecation period.

I'm not 100% sure how mass email blasts work with PyPI's infra, but I'll start work on the second two while I figure out the first!

Started in on this: https://github.com/pypi/warehouse/compare/pep_715
Got beat up by tests.

On Jun 25, 2023, at 4:43 PM, William Woodruff @.***> wrote:
PEP 715 https://peps.python.org/pep-0715/ was accepted, so this is unblocked!
A list of the tasks that need doing:
Send a mass email to every maintainer of a package that has uploaded an egg distribution since 2023-01-01;
Update the upload endpoint to send an email to each maintainer whenever an egg distribution is uploaded (for the next month);
Draft a post for the PyPI blog announcing the deprecation period.
I'm not 100% sure how mass email blasts work with PyPI's infra, but I'll start work on the second two while I figure out the first!
—
Reply to this email directly, view it on GitHub https://github.com/pypi/warehouse/issues/10653#issuecomment-1606256548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJFFQFUI3MRT547IXMZFP3XNCPHBANCNFSM5M3VQ4WQ.
You are receiving this because you commented.

Got beat up by tests.

I can take a look at tests; will send a PR to your branch.

#14017 for the initial rollout is now ready for review

The initial notification to all maintainers of projects that have uploaded eggs since Jan 1, 2023 has now been sent.
We'll need a PR to finalize the deprecation for merge on August 1, 2023.

Bump on this, we are ~2 weeks from the Aug 1 deadline. @woodruffw are you planning to produce that PR?

Bump on this, we are ~2 weeks from the Aug 1 deadline. @woodruffw are you planning to produce that PR?

I am! I can spend some time on that today.

Opened https://github.com/pypi/warehouse/pull/14118 for the above.


Cesride-wasm integration example e2e

This is a draft PR representing an e2e integration with cesride-wasm that corresponds with this PR in cesride:
https://github.com/WebOfTrust/cesride/pull/155
It uses the dater implementation from cesride-wasm to execute tests in signify-ts that correspond to the test_dater() tests in keripy that have been transcribed into jest.
Note: todos are due to deviations from keripy/signify-ts calling conventions and the current cesride implementation.  Also for future work is getting javascript options objects and destructuring to work so there's a better calling convention than new Dater(dts, undefined, undefined, ...

Note: Tests don't pass because I didn't work out the dependency issue on cesride-wasm.

What's the intention of this PR?  Perhaps this work would be better on a fork if you just want a place to show how it could work.

@pfeairheller oh sorry, the intention was to demonstrate that cesride-wasm could be imported into signify-ts and would pass a unit test of js code proving interoperability.  I'm not sure if I have the ability to create a branch on this repo but that would be fine by me if one was created and I can push this there.

Closed.  Implementation exists on daidoji/signify-ts if future generations are interested.


Does not work when some other application takes over keyboard

Tried demo on macbook pro with touch bar using a shortcut like "Shift+Cmd+b", it works everywhere except the case where I actually would like this to work: an OpenGL application that runs in a fullscreen and possibly takes over a keyboard. System shortcuts like Cmd+Tab work just fine, but the demo stops working when the application is in foreground.

Not sure if this can be fixed. Could you try alternate components for the shortcut recording? Do they work while the OpenGL window is active.


How to install this?

in src/app/index.scss i write
   @import "../bower_components/refills/source/stylesheets/all";

But it throws
   error index.scss (Line 6: File to import not found or unreadable: ../bower_components/refills/source/stylesheets/all.

Do i need to build it? Importing main file i enough thought

Installation instructions can be found here.
We don’t officially support or recommend using Bower (someone else probably added it to Bower’s database); it’s best to copy-paste into your project or use the Rails generator. Bower is more for things that you never plan on editing; but we expect you to change and edit Refills to fit your project.

Great, thanks
For guys who struggle with this a bit, install it from gem, it's easier


Use JSON format prompt

Feature request
I find it is quite useful when using JSON format prompt.
Unfortunately, I cannot pass JSON format prompt to langchain.
Motivation
Here is prompt example, which gives detail instruction on how the GPT should response to the student.
Could you please support the JSON format prompt in the feature release!
prompt：'''
{
"ai_tutor": {
"Author": "JushBJJ",
"name": "Mr. Ranedeer",
"version": "2.5",
"features": {
"personalization": {
"depth": {
"description": "This is the level of depth of the content the student wants to learn. The lowest depth level is 1, and the highest is 10.",
"depth_levels": {
"1/10": "Elementary (Grade 1-6)",
"2/10": "Middle School (Grade 7-9)",
"3/10": "High School (Grade 10-12)",
"4/10": "College Prep",
"5/10": "Undergraduate",
"6/10": "Graduate",
"7/10": "Master's",
"8/10": "Doctoral Candidate",
"9/10": "Postdoc",
"10/10": "Ph.D"
}
},
"learning_styles": [
"Sensing",
"Visual REQUIRES PLUGINS",
"Inductive",
"Active",
"Sequential",
"Intuitive",
"Verbal",
"Deductive",
"Reflective",
"Global"
],
"communication_styles": [
"stochastic",
"Formal",
"Textbook",
"Layman",
"Story Telling",
"Socratic",
"Humorous"
],
"tone_styles": [
"Debate",
"Encouraging",
"Neutral",
"Informative",
"Friendly"
],
"reasoning_frameworks": [
"Deductive",
"Inductive",
"Abductive",
"Analogical",
"Causal"
]
}
},
"commands": {
"prefix": "/",
"commands": {
"test": "Test the student.",
"config": "Prompt the user through the configuration process, incl. asking for the preferred language.",
"plan": "Create a lesson plan based on the student's preferences.",
"search": "Search based on what the student specifies. REQUIRES PLUGINS",
"start": "Start the lesson plan.",
"continue": "Continue where you left off.",
"self-eval": "Execute format ",
"language": "Change the language yourself. Usage: /language [lang]. E.g: /language Chinese",
"visualize": "Use plugins to visualize the content. REQUIRES PLUGINS"
}
},
"rules": [
"1. Follow the student's specified learning style, communication style, tone style, reasoning framework, and depth.",
"2. Be able to create a lesson plan based on the student's preferences.",
"3. Be decisive, take the lead on the student's learning, and never be unsure of where to continue.",
"4. Always take into account the configuration as it represents the student's preferences.",
"5. Allowed to adjust the configuration to emphasize particular elements for a particular lesson, and inform the student about the changes.",
"6. Allowed to teach content outside of the configuration if requested or deemed necessary.",
"7. Be engaging and use emojis if the use_emojis configuration is set to true.",
"8. Obey the student's commands.",
"9. Double-check your knowledge or answer step-by-step if the student requests it.",
"10. Mention to the student to say /continue to continue or /test to test at the end of your response.",
"11. You are allowed to change your language to any language that is configured by the student.",
"12. In lessons, you must provide solved problem examples for the student to analyze, this is so the student can learn from example.",
"13. In lessons, if there are existing plugins, you can activate plugins to visualize or search for content. Else, continue."
],
"student preferences": {
"Description": "This is the student's configuration/preferences for AI Tutor (YOU).",
"depth": 0,
"learning_style": [],
"communication_style": [],
"tone_style": [],
"reasoning_framework": [],
"use_emojis": true,
"language": "Chinese (Default)"
},
"formats": {
"Description": "These are strictly the specific formats you should follow in order. Ignore Desc as they are contextual information.",
"configuration": [
"Your current preferences are:",
"🎯Depth: <> else None",
"🧠Learning Style: <> else None",
"🗣Communication Style: <> else None",
"🌟Tone Style: <> else None",
"🔎Reasoning Framework <> else None:",
"😀Emojis: <✅ or ❌>",
"🌐Language: <> else English"
],
"configuration_reminder": [
"Desc: This is the format to remind yourself the student's configuration. Do not execute  in this format.",
"Self-Reminder: [I will teach you in a <> depth, <> learning style, <> communication style, <> tone, <> reasoning framework, <with/without> emojis <✅/❌>, in ]"
],
"self-evaluation": [
"Desc: This is the format for your evaluation of your previous response.",
"",
"Response Rating (0-100): ",
"Self-Feedback: ",
"Improved Response: "
],
"Planning": [
"Desc: This is the format you should respond when planning. Remember, the highest depth levels should be the most specific and highly advanced content. And vice versa.",
"",
"Assumptions: Since you are depth level , I assume you know: <list of things you expect a  student already knows.>",
"Emoji Usage:  else "None"",
"A  student lesson plan: <lesson_plan in a list starting from 1>",
"Please say "/start" to start the lesson plan."
],
"Lesson": [
"Desc: This is the format you respond for every lesson, you shall teach step-by-step so the student can learn. It is necessary to provide examples and exercises for the student to practice.",
"Emoji Usage:  else "None"",
"",
"<lesson, and please strictly execute rule 12 and 13>",
"<execute rule 10>"
],
"test": [
"Desc: This is the format you respond for every test, you shall test the student's knowledge, understanding, and problem solving.",
"Example Problem: ",
"Now solve the following problems: "
]
}
},
"init": "As an AI tutor, greet + 👋 + version + author + execute format  + ask for student's preferences + mention /language"
}
Your contribution
I am not sure

Can you please better format the json and rephrase your exact requirements.

Below is the format JSON style prompt. Basically, I would like to use JSON format prompt in langchain, because I think there are some very useful functions, such as self-evaluation, self-reminder and init etc, in the below JSON prompt. But I don't know how to use JSON prompt in langchain. Could you please give me some hint?
{
"ai_tutor": {
"Author": "JackyChen",
"name": "IR Copilot AI Assistant",
"version": "0.6",
"features": {
"personalization": {
"depth": {
"description": "This is the level of depth of the content the student wants to learn. The lowest depth level is 1, and the highest is 10.",
"depth_levels": {
"1/10": "Elementary (Grade 1-6)",
"2/10": "Middle School (Grade 7-9)",
"3/10": "High School (Grade 10-12)",
"4/10": "College Prep",
"5/10": "Undergraduate",
"6/10": "Graduate",
"7/10": "Master's",
"8/10": "Doctoral Candidate",
"9/10": "Postdoc",
"10/10": "Ph.D"
}
},
"learning_styles": [
"Sensing",
"Visual REQUIRES PLUGINS",
"Inductive",
"Active",
"Sequential",
"Intuitive",
"Verbal",
"Deductive",
"Reflective",
"Global"
],
"communication_styles": [
"stochastic",
"Formal",
"Textbook",
"Layman",
"Story Telling",
"Socratic",
"Humorous"
],
"tone_styles": [
"Debate",
"Encouraging",
"Neutral",
"Informative",
"Friendly"
],
"reasoning_frameworks": [
"Deductive",
"Inductive",
"Abductive",
"Analogical",
"Causal"
]
}
},
"commands": {
"prefix": "/",
"commands": {
"test": "Test the student.",
"config": "Prompt the user through the configuration process, incl. asking for the preferred language.",
"plan": "Create a lesson plan based on the student's preferences.",
"search": "Search based on what the student specifies. REQUIRES PLUGINS",
"start": "Start the lesson plan.",
"continue": "Continue where you left off.",
"self-eval": "Execute format ",
"language": "Change the language yourself. Usage: /language [lang]. E.g: /language Chinese",
"visualize": "Use plugins to visualize the content. REQUIRES PLUGINS"
}
},
"rules": [
"1. Follow the student's specified learning style, communication style, tone style, reasoning framework, and depth.",
"2. Be able to create a lesson plan based on the student's preferences.",
"3. Be decisive, take the lead on the student's learning, and never be unsure of where to continue.",
"4. Always take into account the configuration as it represents the student's preferences.",
"5. Allowed to adjust the configuration to emphasize particular elements for a particular lesson, and inform the student about the changes.",
"6. Allowed to teach content outside of the configuration if requested or deemed necessary.",
"7. Be engaging and use emojis if the use_emojis configuration is set to true.",
"8. Obey the student's commands.",
"9. Double-check your knowledge or answer step-by-step if the student requests it.",
"10. Mention to the student to say /continue to continue or /test to test at the end of your response.",
"11. You are allowed to change your language to any language that is configured by the student.",
"12. In lessons, you must provide solved problem examples for the student to analyze, this is so the student can learn from example.",
"13. In lessons, if there are existing plugins, you can activate plugins to visualize or search for content. Else, continue."
],
"student preferences": {
"Description": "This is the student's configuration/preferences for AI Tutor (YOU).",
"depth": 0,
"learning_style": [],
"communication_style": [],
"tone_style": [],
"reasoning_framework": [],
"use_emojis": true,
"language": "Chinese (Default)"
},
"formats": {
"Description": "These are strictly the specific formats you should follow in order. Ignore Desc as they are contextual information.",
"configuration": [
"Your current preferences are:",
"🎯Depth: <> else None",
"🧠Learning Style: <> else None",
"🗣Communication Style: <> else None",
"🌟Tone Style: <> else None",
"🔎Reasoning Framework <> else None:",
"😀Emojis: <✅ or ❌>",
"🌐Language: <> else English"
],
"configuration_reminder": [
"Desc: This is the format to remind yourself the student's configuration. Do not execute  in this format.",
"Self-Reminder: [I will teach you in a <> depth, <> learning style, <> communication style, <> tone, <> reasoning framework, <with/without> emojis <✅/❌>, in ]"
],
"self-evaluation": [
"Desc: This is the format for your evaluation of your previous response.",
"",
"Response Rating (0-100): ",
"Self-Feedback: ",
"Improved Response: "
],
"Planning": [
"Desc: This is the format you should respond when planning. Remember, the highest depth levels should be the most specific and highly advanced content. And vice versa.",
"",
"Assumptions: Since you are depth level , I assume you know: <list of things you expect a  student already knows.>",
"Emoji Usage:  else "None"",
"A  student lesson plan: <lesson_plan in a list starting from 1>",
"Please say "/start" to start the lesson plan."
],
"Lesson": [
"Desc: This is the format you respond for every lesson, you shall teach step-by-step so the student can learn. It is necessary to provide examples and exercises for the student to practice.",
"Emoji Usage:  else "None"",
"",
"<lesson, and please strictly execute rule 12 and 13>",
"<execute rule 10>"
],
"test": [
"Desc: This is the format you respond for every test, you shall test the student's knowledge, understanding, and problem solving.",
"Example Problem: ",
"Now solve the following problems: "
]
}
},
"init": "As an AI tutor, greet + 👋 + version + author + execute format  + ask for student's preferences + mention /language"
}

@czmmiao I don't think so we need to separately develop JSON format prompt. You can convert the above JSON to your desired Prompt template using the from langchain.prompts import PromptTemplate class.  If you are not sure how to use this please refer to: https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/. For example taking your JSON, I can do something like this:
"""
You are an AI tutor who is going to test the students.
You should test the student at the following level {depth_levels}.
You should follow the learning style {learning_styles}.
You should follow the communication style {communication_style}.
You should follow the tone style {tone_style}.
Additionally adhere to the following rules:
            1. Follow the student's specified learning style, communication style, tone style, reasoning framework, and depth.,
            2. Be able to create a lesson plan based on the student's preferences.,
            3. Be decisive, take the lead on the student's learning, and never be unsure of where to continue.,
            4. Always take into account the configuration as it represents the student's preferences.,
            5. Allowed to adjust the configuration to emphasize particular elements for a particular lesson, and inform the student about the changes.,
            6. Allowed to teach content outside of the configuration if requested or deemed necessary.,
            7. Be engaging and use emojis if the use_emojis configuration is set to true.,
            8. Obey the student's commands.,
            9. Double-check your knowledge or answer step-by-step if the student requests it.,
            10. Mention to the student to say /continue to continue or /test to test at the end of your response.,
            11. You are allowed to change your language to any language that is configured by the student.,
            12. In lessons, you must provide solved problem examples for the student to analyze, this is so the student can learn from example.
            13. In lessons, if there are existing plugins, you can activate plugins to visualize or search for content. Else, continue.

If you are giving self-evaluation use the following format:
  Response Rating (0-100): response rating to student,
  Self-Feedback: feedback you give to student,
  Improved Response:  response you give to student

If you are taking test use the following format:
  Example Problem: Example Problem you state,
  Now solve the following problems:  Problem you give to student

"""

Hopefully, you get the point. Please try it out and let know.

It is helpful, thank you very much.


git lfs ls-files does not list duplicates

I was just using git lfs ls-files to verify which files were being tracked, and I noticed when I expected to see two files, I only saw one. It turns out this was because they were identical files. Everything seemed to be functioning properly though, only one POST to my test lfs server, and only one GET file request when cloning, but git lfs ls-files only shows one file instead of both. I found this very confusing, and think it would be nice if it would at least list both (and maybe even tell me it's a duplicate?)
git init
git lfs init
git config lfs.url http://localhost:8080/git/test/

git lfs track '*.tgz'
git add .gitattributes

ls /proc -la > one.tgz
cp one.tgz two.tgz

git add one.tgz
git add two.tgz

git commit -m "commit"

git lfs ls-files yields
one.tgz

Instead of something like
one.tgz
two.tgz (duplicate of one.tgz)

Using version 0.5.1 of git-lfs

Nice idea :+1:

Fixed 😄


Device volume control

I would like to be able to add a device-specific volume control, independent from the asha audio volume. My worry is that different hearing device manufacturers will all use different mechanisms to control this volume.
If anybody can reverse engineer their hearing devices to determine what the device volume control is, please let me know and I will add it to the below table.

Device Type
Characteristic
range

Audibel Arc AI 1200
f3f594f9-e210-48f3-85e2-4b0cf235a9d3
0x00 - 0xff

Oticon More 1
f3f594f9-e210-48f3-85e2-4b0cf235a9d3
0x00 - 0xff

To find the volume control on my hearing aids, I used bluetoothctl to explore the available characteristics. This is can be tedious, as there were about 90 characteristics to check, and reading some of them caused my hearing aids to stop responding until I restarted them.
First, attach your hearing device via bluetooth, then run bluetoothctl.
$ bluetoothctl
[Hearing Aids]# menu gatt
[Hearing Aids]# list-attributes

At this point, bluetoothctl will dump lots of output to the screen. You will want to copy and paste the output for reference.
The Attributes we are looking for are Characteristics that are Vendor specific, like this:
Characteristic (Handle 0x0000)
        /org/bluez/hci0/dev_9C_9C_1D_96_2F_5E/service00ec/char0106
        f3f594f9-e210-48f3-85e2-4b0cf235a9d3
        Vendor specific

To check this characteristic, check its value, and see if it has the notification flag.
[Hearing Aids]# attribute-info f3f594f9-e210-48f3-85e2-4b0cf235a9d3
Characteristic - Vendor specific
        UUID: f3f594f9-e210-48f3-85e2-4b0cf235a9d3
        Service: /org/bluez/hci0/dev_9C_9C_1D_96_2F_5E/service00ec
        Value:
  36                                               6
        Notifying: no
        Flags: read
        Flags: write
        Flags: notify
        MTU: 0x0200

If it says Flags: notify, then you can optionally enable notifications this way:
[Hearing Aids]# select-attribute f3f594f9-e210-48f3-85e2-4b0cf235a9d3
[Hearing Aids:/service00ec/char0106]# notify on
Notify started

Now, change the volume of your device. If you have notifications enabled, and it is the right characteristic, you should see a message like this:
[CHG] Attribute /org/bluez/hci0/dev_9C_9C_1D_96_2F_5E/service00ec/char0106 Value:

If you don't have notifications, then just run the attribute-info command again, and see if the Value: has changed.

It will need to have one of write or write-without-response. I also assume that whatever bluetooth apps interact with the device will want to read the current volume state, which means it needs read, and also be notified if you press a volume button on the device, which would have notify.
I think you need, at a minimum, read, write, but you should prioritize testing of devices that have read, write, notify.
All of the volume controls I have seen so far have been a single byte as well.

is changing volume via pipewire enough, or should I use asha_stream_test?

Neither. Use a button on the hearing device itself, if you have it.

That would be a problem, mine don't have any.
Which means that I have to use the app, then check the value.

This procedure may not work for you then, as I presume your app has to be connected via bluetooth to your hearing devices (which probably only connect to one thing at a time.)

But the volume sticks when I disconnect, so the value is changed.

True.
An alternative would be to gather an hci dump from your hearing device. If you have an android phone, you can:

enable hci traces using the developer menu,
connect your hearing devices
Make several volume changes
disconnect your hearing devices
use adb to pull the logs off of your phone.

I'm a little fuzzy on the details at the moment, but some googling about "getting a bluetooth log from android" should get you the information you need.

Does your hearing device only have 16 volume levels?
I think your volume adjustment is written as two bytes to handle 0x00aa. I see you repeatedly writing the value 040z to that handle, where z is a hex value from 0 to f, and then your hearing device sends a response back as a notification on 0x00b2.
If you saved your output from the bluetoothctl list-attribute command, you should be able to find the UUID by looking for the handle embedded into the last four characters of the path. Once you know the uuid, you should be able to do this:
$ bluetoothctl
[Hearing Aid]# menu gatt
[Hearing Aid]# select-attribute UUID
[Hearing Aid:/service????/char00aa]# write "0x04 0x00"
<At this point, your hearing device should be muted>
[Hearing Aid:/service????/char00aa]# write "0x04 0x07"
<At this point, your hearing device should be at a medium volume>
[Hearing Aid:/service????/char00aa]# write "0x04 0x0f"
<At this point, your hearing device should be at its loudest>

If this doesn't work, then I've completely guessed wrong. The only other packet that I see being sent to your hearing aids is to 0x00c6, which appears to be a much more complex format that varies in size. I doubt I have much chance of decoding that without a lot more context.

There's also log from manufacturer's Android app, unsure if it's of any use. [changing volume of left side when only left is connected] AppLog_20240611_074425_bb0b8953-2918-4db0-a127-9eaa13b727a4.zip

Wow.... this level of context is fantastic. If you captured this log along with the bluetooth log, and also did something where you waited a minute in between button presses, and noted the exact time you changed each control, we could completely decode this protocol.

wrote a simple bash script to output all attribute infos at once, for me it causes no problems with devices.

That looks like it would easily provide the mappings from UUID's to handles we need to interpret the snoop file.
I also posted a tool here that dump all values of all attributes, and will subscribe to every notification available. It is interesting to see what values change over time. It will be less useful for you since your devices are entirely controlled via your app, and you can't connect to both the phone and the computer.

Lol... starkey's app includes.... a volume control. That's it. The rest of the app is dedicated to helping old people stay active.

There would have to be some abstraction and documentation of what controls are available. I can already tell you that your volume controls don't look anything like mine.

Lol... starkey's app includes.... a volume control. That's it. The rest of the app is dedicated to helping old people stay active.

Wow... I just reinstalled the starkey app, and it has a lot more features than it used to. I can actually make some headway at decoding a lot of this now.
I've made a wiki entry documenting everything I have figured out for my hearing aids. We can probably do the same for you if you like. Hopefully even if this app ends up dying the slow death I hope it does after mainstream asha support makes its way into bluez, the knowledge gained here won't be wasted.

I'm not sure if I understood how to use gatt_dump, but I compiled and started it, then at the end of this log, I used the volume up button 5 times on my left ear and the volume button down 4 times on my right ear.
I know they are using Zephyr RTOS for Bluetooth LE connectivity:
https://www.zephyrproject.org/zephyr-on-a-hearing-aid-oticon-more/
Not sure if the same service id could indicate that yours are also using Zephyr RTOS?

Not sure if the same service id could indicate that yours are also using Zephyr RTOS?

Not necessarily. I have two versions of the service, where the values are formatted slightly differently. Its like starkey had its own version, then implemented a common version later. The rest of the services are different.

It's this one isn't it? c8f747ac-21b2-45b8-87f8-bd49a13eff49

I can't tell from the information you have given me. I either need the output from bluetoothct gatt.list-attributes, or you can try the gatt_dump utility, which I just updated to post the dbus path of each attribute (which embeds the bluetooth handles)

I'm not sure if I understood how to use gatt_dump, but I compiled and started it, then at the end of this log, I used the volume up button 5 times on my left ear and the volume button down 4 times on my right ear. So the last 4 entries should be volume down:

gatt_dump will only connect with one device, and in this case it looks like it was your left ear.
Interesting. You have the same service id 7d74f4bd-c74a-4431-862c-cce884371592 that I do, and the characteristics all appear to have the same meanings. That includes your volume control at f3f594f9-e210-48f3-85e2-4b0cf235a9d3.

I've added a wiki entry for the Oticon More 1. Let me know if you see anything incorrect or if you want to add anything there.

I though that I could correlate things looking at timings and logs snopp and app.
Here's what gatt_dump outputs:
gatt.dump.txt

Interesting. You also have the 7d74f4bd-c74a-4431-862c-cce884371592 service, with its battery level and volume control. That dump is your left hearing aid and your battery level reads as 100% and your volume reads at about 53%. Is that right?

and this one is after changing volume to 14:
gatt.dump.txt

That changed your volume to 93%, which matches since your max volume is 15.

This is great. I should be able to implement the characteristics in service 7d74f4bd-c74a-4431-862c-cce884371592, and it seems to handle all of our devices so far.

@barolo I'm thinking that your log dumps may be less useful now because they seem to control the volume via a different, more complicated interface than the common one. If you would like, you can try controlling your volume using the common interface, just to make sure that it works. The argument is number from 0 to 255, written in the example using hexidecimal.
$ bluetoothctl
[Hearing Aids]# gatt.select-attribute f3f594f9-e210-48f3-85e2-4b0cf235a9d3
[Hearing Aids:/service00ec/char0106]# gatt.write 0x00
[Hearing Aids:/service00ec/char0106]# gatt.write 0x80
[Hearing Aids:/service00ec/char0106]# gatt.write 0xf0

Just making sure, we're figuring out the volume unrelated to streaming [well, it slightly related since you can mute the outside mics basically], as this controls environmental volume, right?

Yes. I want to add a separate volume control for it if I can figure out how, and perhaps an option to mute the microphone when audio is streaming.

Interestingly, this is exact service uuid is embedded in the le extended advertisement packets sent by my hearing aids.

Note, the service 7d74f4bd-c74a-4431-862c-cce884371592 appears to be the MFI service. At least according to Android: https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/framework/java/android/bluetooth/BluetoothUuid.java;l=271?q=7d74f4bd-c74a-4431-862c-cce884371592&ss=android%2Fplatform%2Fsuperproject%2Fmain

Pretty sure Android uses it too, as I can control my HA volume from the system settings as well as the Oticon app.

So we're using MFi actually? xD

When I first contacted starkey asking for details on the protocol, their response was "Go buy an imac, it works fine". I thought it was a stupid, arrogant answer, but rooting through apples mfi nda's it kind of makes sense now.

Now I wonder if MFI has its own audio standard that is higher quality than asha's

Now I wonder if MFI has its own audio standard that is higher quality than asha's

I would guess they are using AAC of some sort. Maybe we could do a test with different profiles (AAC-LC, AAC-HE etc.) and see what plays?

aac support would be fantastic, but it would take a lot of work to reverse-engineer the protocol. I don't have access to an iphone, and I don't think they make it easy to capture bluetooth traffic.

I've no idea of how this works, but I was just thinking maybe it's possible to just switch out the G722 codec to AAC-ELD and see if it plays?

My device only advertises G.722 support. Dumping anything else into the stream just sounds like really loud static.

if you can get a sample file, the asha_stream_test app just dumps whatever raw data you give it into the socket.

Part of the problem is that when you start audio streaming, you have to specify which protocol you are streaming with. ASHA only defines one value.  I can see that they are typedef'd to a 32 bit integer.

hm... any clue what those numeric values are? I can see that they are typedef'd to a 32 bit integer.

Ah, here: https://github.com/phracker/MacOSX-SDKs/blob/041600eda65c6a668f66cb7d56b7d1da3e8bcc93/MacOSX11.3.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Versions/A/Headers/CoreAudioBaseTypes.h#L367

What should I be looking for?

What should I be looking for?

The 7d74f4bd-c74a-4431-862c-cce884371592 service. It should have at least 15 characteristics or so.

What should I be looking for?

The 7d74f4bd-c74a-4431-862c-cce884371592 service. It should have at least 15 characteristics or so.

That information you just posted in the screenshot is the same as the stuff dumped by the gatt_dump tool though here:

It has 18 characteristics.

It has 18 characteristics.  It matches this stuff you already posted earlier from gatt_dump:
   7d74f4bd-c74a-4431-862c-cce884371592
      61d1b37d-94d5-4281-a88f-9b67f8f96314 [notify, read] [subscribed] 01 00 00 00 "\001\0\0\0"
      8e750bb1-40c1-48df-b450-97f245c57e0c [read] 00 "\0"
      98924a39-6559-40a8-b302-3c8e40dbf834 [read] 00 "\0"
      76b3db1f-44c4-46cc-a7b5-e9ce7dfbef50 [read] 00 "\0"
      4656d3ac-c2df-4096-96e7-713580b69ccd [notify, read, write] [subscribed] 00 "\0"
      16438c66-e95a-4c6f-8117-a6b745bd86fc [read] 01 00 00 00 "\001\0\0\0"
      9c12a3db-9ce8-4865-a217-d394b3bc9311 [read, write] ff "\377"
      7be94a55-8d91-4592-bc0f-ea3664ccd3a9 [read, write] 52 65 6d 6f 74 65 20 4d 69 63 20 31 "Remote Mic 1"
      a28b6be1-2fa4-42f8-aeb2-b15a1dbd837a [read, write] 05 "\005"
      adc3023d-bfd2-43fd-86f6-7ae05a619092 [notify, read] [subscribed] bf 03 00 00 "\277\003\0\0"
      a391c6f1-20bb-495a-abbf-2017098fbc61 [notify, read, write] [subscribed] 00 "\0"
      21ff4275-c41d-4486-a0e3-dc11138bcde6 [read] 31 "1"
      6ac46200-24ea-46d8-a136-81133c65840a [notify, read, write] [subscribed] 00 "\0"
      f3f594f9-e210-48f3-85e2-4b0cf235a9d3 [notify, read, write] [subscribed] a2 "\242"
      497eeb9e-b194-4f35-bc82-36fd300482a6 [read] 51 41 52 34 2d 27 "QAR4-'"
      c97d21d3-d79d-4df8-9230-bb33fa805f4e [read] 51 41 52 60 3c 37 "QAR`<7"
      8d17ac2f-1d54-4742-a49a-ef4b20784eb3 [read] 00 "\0"
      24e1dff3-ae90-41bf-bfbd-2cf8df42bf87 [notify, read] [subscribed] 08 "\b"

To reverse engineer the mfi hearing aid stuff, you would need a packet trace from a procedure like this one, which I think requires you to have a mac (and if you have a mac, you probably don't need the code I'm writing).
I'm also not sure where the legal line is trying to reverse-engineer a proprietary protocol. Android's version, is at least open source.

Yeah, I was more thinking if we could use the MFI codec with the ASHA protocol. No Mac here so the only way forward I think is to try different AAC codecs maybe.

I hopefully have buttons on my Bernafon Alpha 3 ITC and on my side also f3f594f9-e210-48f3-85e2-4b0cf235a9d3 is resposnible for volume it changes between 00 (muted) and ff (max volume). The default value is 94.

Starkey Arc AI
Starkey has generated a custom service in the Bluetooth LE realm called Starkey Hearing Instrument Profile (SHIP)
Service Characteristics UUID:

Name
GUID String Format

SHIP Primary Service
896c9518-d4ea-11e1-af45-58b035fea743

Audio Config
896c9748-d4ea-11e1-af48-58b035fea743

Audio Configuration
Payload:

Byte
Description

0
Mute Status. 0: Mute Disabled 1: Mute Enabled

1
Microphone Volume Range: 1-255

Starkey has generated a custom service in the Bluetooth LE realm called Starkey Hearing Instrument Profile (SHIP)

Interesting. I've seen that service before (See my notes in the wiki), But I don't see that particular characteristic on my device. Did you see that new characteristic using the gatt_dump tool?

I have some Starkey documentation. Email my directly and I can send it to you. Email in my bio

I have some Starkey documentation. Email me directly and I can send it to you. Email in my bio

Done. Don't violate any NDAs though.


SwaggerUi name not following naming conventions

The name SwaggerUi should be written SwaggerUI in order to follow the least surprise principle for .NET developers, since two letter acronyms should be writen in uppercase as explained in the Capitalization Conventions.
I understand it is a breaking change, but it might still be early enough in the life of the project to make these changes now. This will serve all future users of Swaschbuckle.

I'm all for adhering to conventions but in this case, I'm inclined to say we just live with it. It will be a breaking change that will likely frustrate many of the early adopters. Furthermore, changing the case in the package name could lead to undesired behavior throughout the Nuget ecosystem - http://adamralph.com/2015/03/04/nuget-gallery-casing-woes.
Principles & practices are great and they add massive value to the software community. But, I've been at this long enough to also view them pragmatically, keep sight of the "WHY" and understand the trade-offs in every situation.
When you say "This will serve all future users of Swashbuckle", I'd like to understand some specific scenarios where this change would actually help a developer incorporate Swashbuckle into their application. To be honest, I can't think of too many concrete examples and therefore, IMO, the cons currently outweigh the pros.
But then again, I can always be swayed with the right argument :)

As ASP.NET Core package is still in RC it is not a big deal to do that in my opinion

What I meant by this will serve all future users of Swashbuckle is that the principle of least
surprise (or reducing WTFs/minute) is important for a library.

I feel that we can live with the unchanged (and only partially consistent) package name, as file name casing is something (usually) handled by the tools. And Visual Studio is not case sensitive when searching for a NuGet package.

@epsitec - you sowed the seed and it started to niggle at me :) In the end, I made the change but not without some case-sensitive file rename gotchas. What should have been 1 commit became 4 ...
4bbf5cacd6ad0817b9015d699c559fd5c1cedf0d
b1c718f70305c8c657e11009472c507aa1a9fa70
b8334b1098bdf05ca1cea5d7dcebee105dffd439
0cd8487fd80e262b41c37040f2d52195569fcd4b
Before the next official release, I would really appreciate if you could upgrade to the preview version that's available on MyGet and make sure everything works as expected:
Swashbuckle.AspNetCore 1.0.0-preview-0109
Let me know

Just released https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases/tag/1.0.0-rc2

Thank you very much. I love the new names :-) they make me very happy every time I see them!


Can't perform a React state update on an unmounted component

When I use useCollection and useDocumentOnce together in one function component I periodically get index.js:1375 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function. warnings.
Here is one of the components that throw that warning:
const Channels = ({user, feedId}) => {
  const [
    userValue,
    userLoading,
    userError,
  ] = useDocumentOnce(firebase.firestore().doc('users/' + user.email), {
    snapshotListenOptions: {includeMetadataChanges: true},
  });
  const [
    value,
    loading,
    error,
  ] = useCollection (
    firebase
      .firestore ()
      .collection ('channels')
      .where ('feedId', '==', feedId),
    {
      snapshotListenOptions: {includeMetadataChanges: true},
    }
  );
  return (

Channels

      {error && Error: {JSON.stringify (error)}}
      {loading &&
Loading Channels...
}
      {value && userValue &&

          {value.docs
            .sort ((a, b) => {
              return a.id > b.id ? 1 : -1;
            })
            .filter(doc => userValue.data().channels.includes(doc.id))
            .map (doc => (
              <React.Fragment key={doc.id}>

                  <button onClick={() => navigate ('/messages/' + doc.id)}>
                    {capitalize (doc.id)}
                  </button>

              </React.Fragment>
            ))}

}

  );
};

Here is the parent component:
const App = () => {
  const [user, loading, error] = useAuthState(firebase.auth());
  const logout = () => firebase.auth().signOut();
  return (

<Link to="/">Don-Nan</Link>

        {user && {user.email}<button onClick={logout}>logout</button>}

        {!loading && <Router className="app-router">
          {user && <Feeds path="/feeds" />}
          {user && <Channels path="/channels/:feedId" user={user} />}
          {user && <Messages path="/messages/:channelId" user={user} />}
          <Login default path="/" user={user} />
        </Router>}
        {loading &&
loading...
}

  );
}

I don't think the useDocumentOnce returns a cleanup function.

useDocumentOnce is already set up with a cleanup method that will be called on unmount, however there is a small window where this could result in the above warning.
Ultimately, there's not much that can be done to prevent the warning and as it implies, this won't affect your application adversely.


Add new OS/CS

Added JSON Profile of XACML 3.0 OS, XACML REST Profile OS, and SMP CS01

Thank you very much, Chet 😄 - this was crowdsourced, right ...?

Given all the voices inside my head, yes.
On Wed, Jul 10, 2019 at 4:02 PM Stefan Hagen<EMAIL_ADDRESS>wrote:

Thank you very much, Chet 😄 - this was crowdsourced, right ...?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sdrees/oasis-standards/pull/1?email_source=notifications&email_token=ALJUYUMPIHEGT6TNRE6EZXTP6Y53HA5CNFSM4H7SNLMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZUSH3Q#issuecomment-510206958,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALJUYUIESVGJNGTYQJUP4E3P6Y53HANCNFSM4H7SNLMA
.

--
/chet
Chet Ensign
Chief Technical Community Steward
OASIS: Advancing open standards for the information society
http://www.oasis-open.org
Mobile: +1<PHONE_NUMBER>


Update to Python 3.12

Fixes #32516

For context: I went ahead and created a python package from my metadrive PR just so we don't have to wait. We can change it to be the original metadrive package once a new release is made with it.
https://pypi.org/project/metadrive-simulator-py3-12/0.2.0/

This seems like a common issue with moving to 3.12: ModuleNotFound Error: No module named six.moves``
I see a lot of mentions and how using 3.11 fixed it 😕
https://github.com/Datalux/Osintgram/issues/947#issuecomment-1872485426

removing --system-site-packages solved the previous issue that I was having where six modules were not being found.

closing since this relies on pyenv being removed. Making a new PR that adds support with pyenv present.


Fix msg length

If the msg is too long, then it throws a db error. This truncates the
msg value.

@mythmon Can you give this a quick look? Is it sane or a terrible idea? As a side note, I'm not sure what this does to utf-8 encoding.

Hrm. I guess I could do a goofy loop:
msg = unicode(msg)
while len(msg.encode('utf-8')) > 255:
    msg = msg[:-1]
msg = msg.encode('utf-8')

Yeah, django has a Truncator class which does some clever stuff, but it's locale-aware and does a bunch of other stuff. I'm not wildly excited about using it.
I'll go with the goofy loop. The output is something that only I see. If it's too goofy, I'll fix it later.

^^^ That redoes the code to use a loop with tests.

Seems nicely smarter. r+

I found this Stack Overflow post that suggests another way. msg.encode('utf-8')[:255].decode('utf-8', 'ignore').
That ignores parsing errors and just throws away bad data. In my tests it seems to behave the same as your test case. It might hide other errors though, but as long as msg was valid UTF8 before, I think it would be safe.

That being said, the current loop likes it will work fine.

I'm going to leave the goofy loop because i need to land and push this out with enough time for me to fix issues because next week is release week and today is friday and OMG THE STRESS!!! THE ANXIETY!!!
But I like your way a lot. I wish I thought of looking at stackoverflow.

Thank you both!


Bool variable being set to an object

I'm not sure if you have ever run into this before and I'm not even sure if you can do anything on your end but I thought I would just let you know about it and see what your suggestions might be.  This function:
public Polygon CalcOuterRect(Polygon fp)
{
            PointD orient = _orientation.NormalizeXY();
            bool bSkipTransform = orient.X== 1.0 && orient.Y== 0.0; // skip if it would be the identity matrix
            double eave0 = _eaveHeight0 + BaseElev;
            double eave1 = _eaveHeight1 + BaseElev;
            Mat4 t = null;

            // [FIXIT] Does this if block need to be here? We're just preserving it from the previous change.
            // I suspect that this was a fix applied to the incorrect place. See GetEaveHeight(), I suspect
            // that's what they were really trying to fix; the 0 elevation check in particular.
            if (_roofType == RoofType.Shed && _eaveHeight0== 0 && _eaveHeight1==0)
            {
                eave0 += 1;
                eave1 += 1;
            }

		    BoundingCube bc;
            if (bSkipTransform)
            {
                bc = fp.GetBoundingCube();
            }
            else
            {
                Polygon fpCopy = new Polygon(fp);
				PointD orientation = new PointD(orient.X, orient.Y);
                PointD leftOrientation = orientation.RotateXY90();
                t = new Mat4();
                //otherToSketch.Set3x3Col(orientation, leftOrientation, PointD.Z_Vector); // this is otherToSketch
                t.Set3x3Row(orientation, leftOrientation, PointD.Z_Vector); // this is sketchToOtherF
                //Mat4 sketchToOther = new Mat4(otherToSketch);

                fpCopy.Transform(t);
                bc = fpCopy.GetBoundingCube();
            }
            var lo = bc.lo;
            var hi = bc.hi;

            PointD BL = new PointD(lo.X, hi.Y, eave0);
            PointD FL = new PointD(hi.X, hi.Y, eave0);
            PointD FR = new PointD(hi.X, lo.Y, eave1);
            PointD BR = new PointD(lo.X, lo.Y, eave1);

			Polygon outer = new Polygon(BL, FL, FR, BR);

            if (!bSkipTransform)
            {
                t.Transpose(); // inverse of a rotation transform
                outer.Transform(t);
            }

            return outer;
		}

becomes this in JS:
function Roof2_CalcOuterRect (fp) {
    var orient = (this._orientation).NormalizeXY();
    var eave0 = +this._eaveHeight0 + +this.get_BaseElev();
    var eave = +this._eaveHeight1 + +this.get_BaseElev();
    var t = null;
    if (!((this._roofType !== $T1A().Shed) ||
        (+this._eaveHeight0 !== 0) || (+this._eaveHeight1 !== 0))) {
      eave0 += 1;
      eave += 1;
    }
    var expr_92 = ((+orient.X === 1) &&
      (+orient.Y === 0));
    if (expr_92 !== null) {
      var bc = fp.GetBoundingCube();
    } else {
      var arg_DF_0 = $S07().Construct(fp);
      var orientation = $S04().Construct(orient.X, orient.Y, 0);
      var leftOrientation = orientation.RotateXY90();
      t = $S08().Construct();
      t.Set3x3Row(orientation, leftOrientation, $T09().Z_Vector);
      $S09().CallVirtual("Transform", null, arg_DF_0, t);
      bc = arg_DF_0.GetBoundingCube();
    }
    var lo = bc.lo;
    var hi = bc.hi;
    var arg_15B_0 = $S04().Construct(lo.X, hi.Y, eave0);
    var FL = $S04().Construct(hi.X, hi.Y, eave0);
    var FR = $S04().Construct(hi.X, lo.Y, eave);
    var BR = $S04().Construct(lo.X, lo.Y, eave);
    var outer = $S0A().Construct(arg_15B_0, FL, FR, BR);
    if (expr_92 === null) {
      t.Transpose();
      $S09().CallVirtual("Transform", null, outer, t);
    }
    return outer;
  };

The IL code (from ILSpy) for this function is here:
public Polygon CalcOuterRect(Polygon fp)
{
	PointD orient = this._orientation.NormalizeXY();
	object arg_92_0 = orient.X == 1.0 && orient.Y == 0.0;
	double eave0 = this._eaveHeight0 + this.BaseElev;
	double eave = this._eaveHeight1 + this.BaseElev;
	Mat4 t = null;
	if (this._roofType == RoofType.Shed && this._eaveHeight0 == 0.0 && this._eaveHeight1 == 0.0)
	{
		eave0 += 1.0;
		eave += 1.0;
	}
	object expr_92 = arg_92_0;
	BoundingCube bc;
	if (expr_92 != null)
	{
		bc = fp.GetBoundingCube();
	}
	else
	{
		Polygon arg_DF_0 = new Polygon(fp);
		PointD orientation = new PointD(orient.X, orient.Y, 0.0);
		PointD leftOrientation = orientation.RotateXY90();
		t = new Mat4();
		t.Set3x3Row(orientation, leftOrientation, PointD.Z_Vector);
		arg_DF_0.Transform(t);
		bc = arg_DF_0.GetBoundingCube();
	}
	PointD lo = bc.lo;
	PointD hi = bc.hi;
	PointD arg_15B_0 = new PointD(lo.X, hi.Y, eave0);
	PointD FL = new PointD(hi.X, hi.Y, eave0);
	PointD FR = new PointD(hi.X, lo.Y, eave);
	PointD BR = new PointD(lo.X, lo.Y, eave);
	Polygon outer = new Polygon(arg_15B_0, FL, FR, BR);
	if (expr_92 == null)
	{
		t.Transpose();
		outer.Transform(t);
	}
	return outer;
}

So it makes sense where the JS code came from but it looks like there might be some optimization that the C# compiler is doing and understands how to resolve the IL code to make it work properly because if I turn the optimizer off for the project then arg_92_0 is actually set to a bool and everything works fine in the JS code.
The issue is that when the optimizer is on then the if statement if(expr_92 != null) changes the entire flow of the function because expr_92 will never be null and therefore the else block is never entered.
The workaround that I found is if I actually move
bool bSkipTransform = orient.X== 1.0 && orient.Y== 0.0; // skip if it would be the identity matrix

to right before the if statement so it looks like this:
bool bSkipTransform = orient.X== 1.0 && orient.Y== 0.0; // skip if it would be the identity matrix
if (bSkipTransform)

Then it all translates just fine (in both IL and JSIL).  The only reason this worries me is that this problem could happen in a ton of other locations just depending on how the developer likes to format their code.  Plus, this type of error was horrible to debug and find and I would prefer to not have to go through that process again.  Do you have ideas or suggestions for this?
Thanks!

Could you report it to ILSpy?