TypeScript type definitions

Sugar.js is wonderful and makes writing JavaScript much more enjoyable.  As I've been looking into TypeScript and some its tooling, I've been thinking Sugar.js would be an excellent complement.  IntelliSense-like code completion with Sugar.js methods could be a huge productivity boost.  Have there been any discussions about creating a TypeScript type definitions file for Sugar.js?  (For reference, DefinitelyTyped is a repository of TypeScript type definitions for other popular JavaScript libraries.)

This should be easy enough by tweaking the doc build tools in place. Will have a look after the new versions are out.

@andrewplummer Any news on this?

@andrewplummer version 2.0.1 is out, any news on sugar.d.ts for this new version?

Yes, now that this is released I'm going to have a look into this. It raises a question however: now that the ability to extend natives is opt-in, it seems that this means that 2 definition files are now required... 1 for non-extended use and one that will included methods that may potentially be extended.
I'm thinking maybe:
sugar.d.ts
sugar-extended.d.ts
Does this make sense?

Alternately it could just be a single definition file with everything together? Would having extended-native definitions in the d.ts file offend people who are adamantly against extending natives? Or does this still make sense to do since this is still behavior that exists regardless of whether or not they choose to use it?

Ok, I'm having a look at this right now but there's a few roadblocks I'm hitting, and it would be nice to have some TS experts here to help out.
First, is there a way for a type to explicitly refer to a global object? For example:
type Native = Object | Array | String | ...;

Here I would like Native to not be "an object" or "an array", but refer to the global objects themselves. Is this even possible?

Also, could someone check my work so far? This seems to get the job done for the main core features in 2.0.0:
declare module sugarjs {

  interface sugar {
    (options?: sugaroptions): sugar;
    extend(options?: sugaroptions): sugar;
    array: sugarnamespace;
  }

  interface sugaroptions {
    objectprototype?: boolean;
    methods?: array<string>;
    except?: array<string>;
    // todo: figure out global literals
    namespaces?: array<string>;
    enhance?: boolean;
    enhancestring?: boolean;
    enhancearray?: boolean;
  }

  interface sugarnamespace {
    <t>(init?: t): sugarchainable<t>;
    new<t> (init?: t): sugarchainable<t>;
    extend(options?: sugaroptions): sugar;

    defineinstance(methods: object): sugarnamespace;
    defineinstance(name, function): sugarnamespace;

    // other helper and method definition functions listed here...

    flatten<t>(array: t[]): t[];
    // other sugar static methods listed here...

  }

  interface sugarchainable<t> {
    raw: t;
    valueof(): t;

    flatten(limit?: number): sugarchainable<t>;
    // other sugar chainable methods listed here...

    join(separator: string): sugarchainable<t>;
    // other native methods mapped to chainables listed here...

  }

}

interface array<t> {

  flatten(limit?: number): t[];
  // other extended mode methods listed here...
}

declare var sugar: sugarjs.sugar;

With this as a base it should be a matter of:

listing up the method signatures in all 3 places (static, chainable, extended) which are slightly different
Pulling out interfaces for option objects (for example Date#create
Pulling out interfaces for callback functions (for example Array#unique
Anything else I'm missing?

Here I would like Native to not be "an object" or "an array", but refer to the global objects themselves. Is this even possible?

Yes, it's possible, you should use ObjectConstructor, ArrayConstructor, StringConstructor, etc., instead of Object, Array, String respectively.

And you have to declare SugarConstructor for sugar static options and methods.

@trikadin Cool, that seems to have worked!
For the second part, I'm declaring interface Sugar and it seems to have worked. Is that what you meant or something else?

In TS you have to split on class declaration into two parts: one for the static methods and properties and one for the the instance methods and properties. For example:
interface ObjectConstructor { // static methods
  assign<T, U>(target: T, source: U): T & U;
}

interface Object { // instance methods
  hasOwnProperty(v: string): boolean;
}

Thereby, you should rename your Sugar interface into SugarConstructor.

http://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes

Ok, I see... that's interesting. Actually, though, Sugar is not a class with any instance methods on it, just a namespace (well, actually a function as well, but not a class).
The only instance methods I'm using (aside from on natives when in extended mode is the Sugar chainables, but it seems that I'm already splitting them as you suggested between SugarNamespace and SugarChainable. Maybe though I should rename SugarNamespace to SugarChainableConstructor instead to make it more clear.

I've hit another issue, this time potentially blocking. Sugar allows user defined functions (this is a major feature of the v2.0 update) that will appear on the global object like such:
Sugar.Array.defineInstance('foo', function() {});
Sugar.Array.foo(); // This function will now be available on here

Strangely, though, it appears that Typescript index signatures can't handle this. I've pruned it down to the following declarations file:
declare module sugarjs {
  interface SugarArrayConstructor {
    [propName: string]: any;
  }
  interface Sugar {
    Array: SugarArrayConstructor;
  }
}
declare var Sugar: sugarjs.Sugar;

Doing this will throw the error:  Property 'foo' does not exist on type 'SugarArrayConstructor'.
Is there some way to workaround this?

Not really. That's dynamic by nature, so not typeable.

I'm not quite sure what you mean. Index signatures are supposed to allow dynamic access to objects such as not to throw a compile error. Looking into it further, it seems that this works with brackets but not dot syntax for a property. However this isn't really a workable solution for Sugar.

I don't know of a workaround. Property names are dynamic; so TS constrains them to []

Ah I see what you mean now.

You want to create dts as a standalone module or add it to main repo?

How can I join to development to help you with this feature?

Good timing! I've essentially just finished with the new gulp tsd task to generate a typescript declarations file! This has taken quite a long time, but it's pretty nice, as the task allows options as well. You can include/exclude modules or methods and also turn off the extended mode declarations if you want. The default declarations file will have them included.
So the question is now what? Is it best practices to include the declarations file directly in the Sugar repo? Also, can you link me to the best guide for contributing them? Is typings the newest/best place for this?

One thing to note is that I will need to look into the issue with being unable to define new methods. Until that is resolved, these definitions aren't exactly complete. If typescript doesn't support that (accessing arbitrary properties through the dot syntax) then new method definition cannot be supported.
Also, due to typescript quirkiness with conflicting interfaces, extending Object.prototype cannot be supported. This is not recommended anyway, however, so I'm willing to consider it unsupported.

IMHO, the best way is to include module (not extended) declaration file directly into Sugar repo, and add declaration for extended mod to typings.

Ah I see, so split into 2 declarations? Something like:
sugar.d.ts
sugar-extended.d.ts

Maybe? But why only check one into the repo? Or better question, is there a good reason to check any into the repo when they can be built easily?

Ah I see, so split into 2 declarations?

Yep)

Or better question, is there a good reason to check any into the repo when they can be built easily?

Well, I think you right -- there's nothing bad about to add them both, and add the 'typings' field to the package.json with value './sugar.d.ts'. So, when you use Sugar in your libs (without extending) -- TS automatically find the declaration, and you don't need to do anything more. And when you write the standalone application and you want to use extended mode -- you just add the 'sugar-extended.d.ts' into your references, something like:
/// <reference path="./node_modules/sugar/sugar-extended.d.ts" />

Kind long, but not the problem)

OK that sounds pretty good. Is it customary to put them in the root directory or a subfolder? What about the file naming?

Is it customary to put them in the root directory or a subfolder? What about the file naming?
No limitations, but usually .d.ts. files placed in the root directory and named as <package>.d.ts.

So, imho, sugar/sugar.d.ts and sugar/sugar-extended.d.ts. is the best choice.

Yep that sounds good... I'll make the necessary changes. Also which typings repos should I check them into?

<whew!> I was worried for a second about splitting out the two files, as the extended forms still reference callbacks and options interfaces that exist in the base declarations file, but it seems that they can reference each other even across different files, so I think this should work!

OK, in addition to the main declarations in the repo, I have also added declarations for each of the modularized npm packages (sugar-array, sugar-date, etc). These will be generated each release and contain only the declarations relevant to the module!

So, according to this guide, the preferred way of publishing the types is to put them in the repos and add the "types" field to package.json, which I have done.
Is this all I need to do? If so, I think we can close this one out...

OK, in addition to the main declarations in the repo, I have also added declarations for each of the modularized npm packages (sugar-array, sugar-date, etc)

Not bad)

Is this all I need to do? If so, I think we can close this one out...

Please, use a Type Guards for 'Object.is'
You can read more about Type Guards here.

Ok, so from what I gathered:
isDate(instance: Object): boolean;

becomes:
  isDate(instance: Object): instance is Date;

? I guess the return boolean value is implied in the type guard?

becomes:
isDate(instance: Object): instance is Date;

Yes. The same is for 'isFunction', 'isString', 'isNumber', etc.

I guess the return boolean value is implied in the type guard?

Yep.

Makes sense! Will make this change!

Ok! This is now updated.

You forgot to add reference to the sugar.d.ts in extended declaration, something like:
/// <reference path="./sugar.d.ts" />

Oh, I thought the user would include both separately, but I guess this might be better?

sugarjs declared in sugar.d.ts, and sugar-extended.d.ts using it, so you have to import or reference sugar.d.ts in it.

Ah ok that's a good point since sugar-extended does have explicit references. Will update this!

Why sugar.d.ts declare module called sugarjs? It should declare module sugar.

And you have to explicitly declare exports of this module.

You can look at the good example of module declaration here.

So, I named it sugarjs to give it a more unique name. Are collisions not a thing here? That said, it works fine as the naming seems not to matter once it reaches the final variable declaration. If we can be sure that there will not be collisions then I will rename this. As for exports, I have tested it now and it is working fine, so what does declaring the exports do? Is there a way I can test?

While we're on the topic, module and namespace seem to show no difference in usage. Is there a correct way to use one vs the other?

So, I named it sugarjs to give it a more unique name.

The name of the declared module should be equal to package.json name and it should have explicit exports. Now it doesn't, and i've got this error:

While we're on the topic, module and namespace seem to show no difference in usage. Is there a correct way to use one vs the other?

namespaces is like "internal modules". Maybe, this link will help you to understand module declaration:
http://www.typescriptlang.org/docs/handbook/modules.html#working-with-other-javascript-libraries

Is there a way I can test?

https://gist.github.com/trikadin/bfa72f3b77c7b3e648cf3c1accbd0106

OK... I've read through the guide, and I see what you mean now. I also get the difference between namespaces and modules. It does appear that the sugarjs name doesn't matter as an internal namespace, but I see now that a module named "sugar" is also required with the proper exports. So, this is what I have set up, and it seems to be working in all cases:
declare namespace sugarjs {

  // Top level interfaces...

  namespace Array {

    // Array interfaces...

  }

}

declare var Sugar: sugarjs.Sugar;

declare module "sugar" {
  const Sugar: sugarjs.Sugar;
  export = Sugar;
}

This satisfies both the "import Sugar = " node form, as well as explicitly referencing the declarations file for non-commonjs use.
Let me know what you think.

Please, give me a link at the commit, so i can test it on my projects.

Oh, sorry, see it now.

Works fine, thanks a lot! Will waiting for release on npm.

One thing:
https://github.com/andrewplummer/Sugar/blob/d165e89c15794dab62dc6ea5124e9375fe21f765/sugar.d.ts#L934
It should be "instance is string". string referenced for primitive type, and String referenced for instance of constructor String. Example:
const primitive: string = 'foobar';

const instance: String = new String('foobar');

The same is for number and boolean.

Hmm. I see what you mean, and I definitely intended the primitive, but technically this method will accept either. Is that possible?

So, I can't really figure out a way to test this, but I naively tried string | String and it doesn't seem to throw an error... what do you think?

technically this method will accept either.

Hmm. You use something like this to check types?
Object.prototype.toString.call('bla');

I never used the primitive types wrappers explicitly, and afaik this is considered as a bad practice, and it have some caveats. For example:
if (new Boolean(false)) {
    console.log('lol'); // will be printed
}

Maybe, it have sense to use more stricter checking?

So, I can't really figure out a way to test this, but I naively tried string | String and it doesn't seem to throw an error... what do you think?

Left the string only)

You use something like this to check types? Object.prototype.toString.call('bla');

Exactly.

I never used the primitive types wrappers explicitly, and afaik this is considered as a bad practice,

I agree, so in that sense, maybe it's not necessary, but I wanted to make it as accurate to the actual code as possible.

Left the string only

Sorry I didn't understand... you mean only use the primitive? I'm ok with this, so if that's what you think then let's do it!

I wanted to make it as accurate to the actual code as possible.

In this case, you shouldn't:
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html

Don’t ever use the types Number, String, Boolean, or Object.

OK fair enough!

Are we good then? I'm going to wait for a final approval from you so that I don't have to keep bumping npm version numbers :)

Seems ok) Thank you a lot)

It seems that Webpack is using some other way of importing the declarations files than /// ... I'm moving that to this thread to help figure it out...

@andrewplummer Right, so I don't think ///'referencing (reference paths) is the "latest and greatest" recommendation, it's more of the old way to import typescript definitions, which even though it is not officially deprecated, is not really preferred the way things are going with typings right now (granted they've made a LOT of changes in the past year or so).
See here for some larger list of reflections:
https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181
And here for a good answer to this question of using reference paths or not:
http://stackoverflow.com/a/34121620/2136136
I don't know everything about the definitions and best way to include them, but I do know that there is a new thing called @types in npm, where you install each definition as its own package. https://www.npmjs.com/~types
I think we can keep the definition to being included in the project, but it would probably be more "sane" to move it to the definitelytyped/@types repos so other users can help contribute more easily without your intervention. Of course this may be a double-edged sword.
Also yes, something needs to be done about ES6 module compliance, because right now something's off and I cannot yet figure out why.. Compare it to the moment.d.ts file for example, there are some clear differences.

@qvazzler Apologies, I did know about the referencing here, in fact it was the same issue that @trikadin raised a few comments up. It seems that this is in fact addressed with the latest typings, I was just waiting to release them to give it a bit of time to settle before bumping the version. This seems like an opportune time, so I will release them now!

OK, there were a couple other issues with this, but I think I got them sorted out. For reference, the updated version is 2.0.4.
Note that if you are going to use extended mode, then you will still need to reference "node_modules/sugar/sugar-extended.d.ts" using the /// form. Other than that it should work.

Awesome, congratulations!

@andrewplummer So I can confirm that Sugar is now loading properly with the following:
import * as Sugar from "sugar";

Which is excellent news! I also want to highlight that I am using the latest beta packages of typescript and webpack, so you are looking great.
"webpack": "2.1.0-beta.27",
"typescript": "next" //2.2.0-dev.20161117

Without much insight in this package yet, I do think leaving anything that requires reference tags (///) is probably not going to be a popular thing for typescript users. With that said, really looking forward to use this package. :-) Thanks!

Well, Sugar's original form -- in fact perhaps the reason it exists at all -- is in extending native prototypes. This is now optional, so the typings that support that need to be optional as well. If there  is another way to allow the optional loading of typings instead of referencing with /// then I'm all for that, but this doesn't seem to exist as far as I can tell.

Maybe it's because the extended functions actually belong in a separate js file? That way we could import either as needed.
I just realized, that I actually want to use the extended functions.. Like minutesAgo for example.

Extended mode is not separated in this way, nor can it be. It's a feature that's part of the sugar-core module that allows any defined method to be extended across to its corresponding native prototype.

Ok, but then why are these functions like minutesAgo not available in the Sugar Date object?

It should be! I see it in the declarations file now as well... It should be called like this:
Sugar.Date.minutesAgo(date)
If this isn't working can you provide a repro maybe?

Sorry... I did not realize this function was static and not part of the created/initialized Sugar.Date object. This is working just fine.
Sugar.Date.minutesAgo(refreshTime);

Well it actually should be both, so I'm still curious! Essentially you should be able to do this:
Sugar.Date.minutesAgo(d); // Static
new Sugar.Date(d).minutesAgo(); // Chainable

Sugar.extend(); // Extend methods to prototypes
new Date().minutesAgo();  // Extended

Let me know if any of those don't work!

I think I see what you mean now.. The Date object in Sugar is just a regular Date object, not a special "Sugar"-Date object. So enabling the extended mode, will indeed prototype this Date object with Sugar's extraneous methods.
While I, who have not included the extended typescript definitions (because it's outside the declared conventions in my project), will get an error by doing this.
        Sugar.Date.minutesAgo(refreshTime); // Static: No error
        new Sugar.Date(refreshTime).minutesAgo(); // Chainable: No error

        Sugar.extend(); // Extend methods to prototypes: No error
        new Date().minutesAgo();  // Extended: Getting "Property minutesAgo() does not exist on type 'Date'

The Date object in Sugar is just a regular Date object

Well, it depends. The short version is that Sugar instance methods have 3 modes of use:

Static - Instances (vanilla JS objects) are passed as the first argument to static methods in the global namespace and return other vanilla JS objects. (Think Lodash/Underscore, but with namespaces).

Chainable - Special objects that are created via the namespaces themselves (Sugar.Date()). Instance methods are called directly on them as if they were on the prototype. Return values are also chainables (wrapped), and the underlying vanilla JS objects are accessed with the raw property. Essentially the same as _.chain() in Lodash/Underscore.

Extended - Extends the native prototypes. Methods are called directly on them. This is the only mode that needs to be opted into. Which methods are extended can be controlled.

Hope that makes sense...

While I...will get an error by doing this.

Yes, that's exactly right.

I'm going to close this issue for now to get it off my plate. Thanks for all the help, especially @trikadin. I may actually delve into Typescript more after this :) . For now, I feel that this should work for most cases, but there definitely may be a few quirks, so please feel free to re-open.

Sorry, but I found some errors(
https://github.com/andrewplummer/Sugar/blob/master/sugar-extended.d.ts#L357
Please, replace it with:
isArray(instance: any): instance is Array<any>;

Same for this, replace with:
isMap(instance: any): instance is Map<any, any>;

And this:
isSet(instance: any): instance is Set<any>;

And, you shouldn't use 'Object' instead of 'any'. isArray can accepts string, boolean, etc. Please, could you check your dts and replace Object to any whenever needed?

I've actually been using generics for this. Would this work:
isArray<T>(instance: any): instance is Array<T>;

Other generics can be derived from the ES6 typings...

I've actually been using generics for this

Ts reports errors for your current definitions:
node_modules/sugar/sugar-extended.d.ts(364,46): error TS2677: A type predicate's type must be assignable to its parameter's type.

Would this work

Yes, it would, but you shouldn't use generics for this, because argument could be non-typed array, like [0, true, '2'], and, in fact, your method doesn't answers on question "is this a typed array?", only "is this an array"?
Typescript built-in es6.d.ts has the following definition for Array.isArray:
isArray(arg: any): arg is Array<any>;

One more error:
https://github.com/andrewplummer/Sugar/blob/master/sugar-extended.d.ts#L48
Your Array.prototype.map definition:
map<U>(map: string|sugarjs.Array.mapFn, context?: any): U[];

sugarjs.Array.mapFn is generic - please, could you provide types to it? Like this:
map<U>(map: string|sugarjs.Array.mapFn<T, U>, context?: any): U[];

Typescript built-in es6.d.ts has the following definition for Array.isArray

Ok fair enough... the rest makes sense too... Will check this out

I'll try to carry out a full inspection of all the TS definitions in the nearest future and send PR.

Thank you! If possible can you keep track of it somewhere so I can repro the errors?

If possible can you keep track of it somewhere so I can repro the errors?

Sorry, I don't understand... What do you want?

Ah sorry, I just meant if you can give me some code to help test the definitions I would appreciate it :)

you shouldn't use generics for this, because argument could be non-typed array...

Ok I re-read this and I think I finally understand what you mean. Unfortunately I think this means that I'm overusing generics in a lot of places then. For example:
var squares = Array.construct(5, function(n) {
  return n * n;
});

This is a common use case for this method, but in theory construct could return anything, including a non-typed array. Right now in the definitions I have this:
construct<T>(n: number, map: (i: number) => any): T[];

However should probably be this:
construct(n: number, map: (i: number) => any): any[];

Would you agree?

But actually I still find this confusing... If this is correct, then why do the native lib.es6.d.ts typings define interface Array<T> with a generic? A standard array may or may not be typed. I have been interpreting generics to mean "a subset of types", not just "a single type". In fact the docs that I have read have themselves said that any effectively turns off type checking and if possible use a generic instead, as there are certain checks it can still perform. I don't have a perfect understanding of this, so I don't know what checks generics provide over any, but I was simply trusting in the docs that it would be better...

I'd prefer construct<T>(n: number, (i: number) => T): T[];
If T needs to be any, that's no issue

I agree with @vendethiel about construct.

A standard array may or may not be typed.

For non-typed arrays you can use smth like:
const bla: Array<any> = [1, '0', true, {}];

Or, if you have restricted subset of types, you may use unions:
const numAndStringArr: Array<number | string> = [1, '', 'bla'];

But, in case of isArray you don't need the information about the type of arrays items. Same for isMap, isSet, etc.

For non-typed arrays you can use smth like...Or, if you have restricted subset of types...

Right, but wouldn't the generic help to facilitate that? i.e. Array.construct<number | string>(...)

if the function has the return type number | string, it'll correctly get inferred when you pass it to Array.construct.

Ahh ok this is making more sense now. Also ignore my above comment, I was misunderstanding something. However it leads me to another question. For the method fromQueryString, there is an optional callback that receives an object key and property. Right now the typings are like this:
fromQueryString<T, U>(str: string, options?: QueryStringParseOptions): Object;

interface QueryStringParseOptions {
  ...
  transform?: <T, U>(key: string, val: T, obj: Object) => U;
}

This should probably be this:
fromQueryString<T, U>(str: string, options?: QueryStringParseOptions<T, U>): Object;

interface QueryStringParseOptions<T, U> {
  ...
  transform?: <T, U>(key: string, val: T, obj: Object) => U;
}

...right? Does that look right to you overall?

Yes, that's right. Maybe, it have a sense to read a doc about generics)
https://www.typescriptlang.org/docs/handbook/generics.html

Oh believe me, I've been over that document many times now....

Ok, I fixed the issues raised in the comments:

isArray, isString, etc. accept any instead of Object.
Callback functions like mapFn are now passed generics. The previous definitions were simply incorrect as type mapFn = <T>(...) but should have been type mapFn<T> = (...).
Options interfaces similarly accept and are now passed generics. One note, though is that my above comment was incorrect. It said transform?: <T, U>(...) but should have been transform?<T, U>: (...). I corrected this as well.
construct is now correctly using the generic for the map callback. This was simply an oversight.

Please have a look. I will also have a more thorough look at how generics are being used in each method later. However I think these should probably be ok now, as I understand that any was mostly only applying to the type checking methods. However there may be a few more like construct which should be more strictly enforcing their generics. Thanks!

Another issue raised with definitions... it seems that this won't work:
import SugarDate from 'sugar/date'

Having a look at how lodash does it, there seems to be a main index.d.ts file, and also one for each method as well. Sugar is similarly modular, so it makes sense that it should follow this pattern.
However this raises another question... lodash types are in the @types/lodash module. It seems that Sugar should follow suit with this as well, especially if a declarations file is required for not only each module but also each method as well.
Looking into this raised another point. Although the user claimed it work, it seems that ES6 import syntax import Sugar from 'sugar' isn't working as I am using this export =  syntax now. This should probably be changed to export default Sugar, no? It seems though that these 2 types are incompatible. That means that if this is changed, the import = require('sugar') will no longer work. My only question is are there any side effects to making this kind of change? If not, then it seems it should be moved as the ES6 style seems to be the standard now.

Update: It seems that export default Sugar is incompatible with node modules, so it will need to be required with import * as Sugar from 'sugar' or import Sugar = require('sugar'). In addition, I'm having trouble exporting the declarations for each method. The declarations look something like this:

declare namespace sugarjs {

  interface Sugar {
    Date: Date.Constructor;
  }

  namespace Date {

    interface Constructor {
      create(str?: string): Date;
    }

  }
}

declare module "sugar/date/create" {
  var create: sugarjs.Date.create; // this is the part that won't work
  export = create;
}

I've tried various different approaches with the module, but it doesn't seem to be able to access create in a way that works with ambient contexts (declares). The docs haven't been much help so far. Turning to stackoverflow....

Typescript does not pick up the sugar-extended types by default. Perhaps these could be put in a separate @types package so Typescript can pick them up by default?

I'm getting an error from webpack using the sugar-date npm module that may be relevant to this conversation:
ERROR in [at-loader] ./wwwroot/app/index.ts:25:24
    TS2306: File '/node_modules/sugar-date/sugar.d.ts' is not a module.

I'm getting an error from webpack using the sugar-date npm module

I'm getting the same error from the TypeScript compiler. Any news about this? Thanks!

The file is missing an export directive.
I wonder what the meaning of the end of sugar.d.ts is:
declare module "sugar" {
  const Sugar: sugarjs.Sugar;
  export = Sugar;
}

declare var Sugar: sugarjs.Sugar;

Maybe it's automatically translated somehow? Instead, using:
export const Date: sugarjs.Date.Constructor;

Seems to help. But then, I don't understand what the deal with constructors are. I replace interface Sugar with:
  interface Sugar {
    (opts?: ExtendOptions): Sugar;
    createNamespace(name: string): SugarNamespace;
    extend(opts?:

Okay, after digging a bit more in Typescript documentation, I think I was mislead. There is a simpler modification that would work:
declare module "sugar-date" {
  const Sugar: sugarjs.Sugar;
  export = Sugar;
}


REST endpoint to post 'Follow' activity

A REST endpoint is required to post a 'Follow' activity in order to add to the service's followers list.

We will also need an Unfollow API.
See https://www.w3.org/TR/activitypub/#undo-activity-outbox


Command not found when using action-apt

 runs-on: ubuntu-latest
...
  - uses<EMAIL_ADDRESS>        with:
          packages: |
            libsasl2-dev

I get an error

Run<EMAIL_ADDRESS>with:
packages: libsasl2-dev
/usr/bin/sudo ./patch-apt.sh /etc/apt/
sudo: ./patch-apt.sh: command not found
Error: The process '/usr/bin/sudo' failed with exit code 1

hmm weird, it shouldn't try to patch that if there's no architecture specified. just pushed an update with another check here which i think you could try from ryankurte/action-apt@master?
(as an aside, you can always run: sudo apt update && sudo apt install ... if you need)

Thanks for looking at this! I got around the issue by doing a normal run with sudo apt-get commands. Today I will try again with ryankurte/action-apt@master as you've suggested.

yeah the sudo commands solve most of the problem, i only really added this to get multiarch working more consistently


docs: add conf environment variables description

When setting up the provider I required ENV variable setup but could not find those in the docs.

hi @anryko,
thank you!
the docs directory is autogenerated, your changes will be erased
could you please modify the templates/index.md.tmpl file ? thank you

@flbla Thank you! Done.


Initialization bugs in inner classes with several (2) levels of inheritance

Running the script
extends Spatial

class Foo extends Node:
        func _init(f):
                .init()
                print("Foo")
class Bar extends Foo:
        var d
        func _init(f, g):
                ._init(f)
                d = g
class Bar2 extends Bar:
        var t
        func check(d):
                t = d
                print(t)
func _ready():
        var ch = Bar2.new("a", "b")

tells me that new() requires 0 arguments. If we run Bar.new("a") instead, everything works properly.
Adding separate _init() to Bar2 doesn't solve a problem, as changing Bar2 to this:
class Bar2 extends Bar:
        var t
        func check(d):
                t = d
                print(t)
        func _init(f, g):
                ._init(f, g)

produces error message which requires 2 arguments for .new()

Well, 2 levels can't be called many, does it? As the reaction to many might be wontfix just because of that word. The problem starts for ma at exactly 2nd level of inheritance.

Need to mention that Bar class works as intended (really seriously tested that)., only Bar2 and later have problems.

Thanks for the precision.

I can reproduce the issue with the above snippet.

@slapin @akien-mga
I'm not sure if this is a bug, following the wiki, the above code should be:
extends Spatial

class Foo extends Node:
        func _init(f):
                print("Foo")
class Bar extends Foo:
        var d
        func _init(f, g).(f):
                d = g
class Bar2 extends Bar:
        var t
        func check(d):
                t = d
                print(t)
        func _init(f, g).(f, g):
            pass

func _ready():
        var ch = Bar2.new("a", "b")

I tested both snippets and this one run fine.

Oh nice catch @TheHX. While doing some testing right now I was also starting to wonder if @slapin's call of .init() was the proper way of calling the ancestor's constructor, but I didn't know about this _init().() construct.

Thanks a lot for help, guys
Well, I was told to use ._init() before.
Anyway, what should I do if I need to cook arguments for parent constructor (not just pass them)?
any more advanced example?
This stuff is not really easy to be found also this thing is not similar to other languages,
so it deserves a few examples.
Also I wonder why my implementation works until extended twice?

@slapin Maybe the problem is that _init is called automatically, and isn't supposed to be called by hand? (Info taken from the same wiki link)

Basically the problem is that capabilities of overriding class constructor are very limited (confirmed by @reduz, so it is to be worked around now, and probably will be fixed later, but at least it is considered misfeature. So if you need extra constructor, use pseudo-constructor (additional function) now, and override it in your class tree.

yes you are not supposed to call the parent constructor, it's called automatically. However, after talking to slapin, it makes sense to detect a call to it and if so, allow that one to be used.
Yet, this is 2.1 material.

Potentially related: #942

too difficult to do for little gain, and not a bug, may do it at some other time

Not critical for the upcoming 2.1, so moving to the next milestone.

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.
The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.
If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

I wonder, do you even read the bugs you close? The message looks
awkward at best.
On Sun, Jun 14, 2020 at 5:02 PM Hugo Locurcio<EMAIL_ADDRESS>wrote:

Closed #3387.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@slapin That's a copy pasted message which has been posted on more than 1000 issues over the past few weeks.

Well, that bug might be relevant if 2.x is supported yet and totally not a
feature request, JFYI.
On Mon, Jun 15, 2020 at 1:43 PM Rémi Verschelde<EMAIL_ADDRESS>wrote:

@slapin https://github.com/slapin That's a copy pasted message which
has been posted on more than 1000 issues over the past few weeks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/3387#issuecomment-644051755,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAABPU7VHISRWJKARPMOV3TRWX3NRANCNFSM4BY7CKPQ
.


fix (#1654): exporting to requirements.txt always prepends -e to dependencies

This PR fixes (at least partially) #1654.
It now respects the develop value set in pyproject.toml when exporting to requirements.txt and also installing in non-development mode works again.
Pull Request Check List
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes.  But please read our contribution guide at least once, it will save you unnecessary review cycles!

[ ] Added tests for changed code.
[ ] Updated documentation for changed code.

I'm not fully satisfied with this PR now. But I already pushed it to get some feedback.

We are still missing tests for locker and install command and I'm not sure how to include them.
My path dependencies are still get install in development mode, regardless I have set develop=false. I will take a look at this in the next step.
There are more places that looks suspicious to me, that the develop value is missed, e.g.

https://github.com/sdispater/poetry/blob/c1f9838b516a7af02b3efb867cddcdba4773d5a6/poetry/packages/package.py#L406-L415

Hm, any hints for me to get the tests pass @sdispater , @stephsamson ? Why the pathes doesn't seem to be correct? Locally it works.

Ok, tests seem to work now. Not sure why it works here. The paths definitely doesn't work local.
Time for feedback please :)


DM text field can "float" in the wrong place

Steps to Reproduce

Go to a DM convo
Start DMing
Switch to another app
Switch back to bsky
Sometimes (not sure how often) the input bar floats a way away from the bottom edge, as if the IME were visible (but isn't)
The problem persists even when going back to the DM list and than into another convo

Attachments

What platform(s) does this occur on?
Android
Device Info
Pixel 9 Pro, Android 15
What version of the app are you using?
Build version: <IP_ADDRESS>2; Bundle info: c59dc0d8e (prod); Bundle date: 24112017; Platform: android; Platform version: 35
Additional Information
No response

Duplicate of this
https://github.com/bluesky-social/social-app/issues/6522

Ah yeah, indeed. Hadn't found that existing bug because it wasn't worded too clearly.


Added support for winston's built-in formatter function

Added reference for the formatter transport parameter found in winston so as to support its usage in this extension. In regular winston transports this works like so:
var logger = new (winston.Logger)({
  transports: [
    new (winston.transports.Console)({
      timestamp: function() {
        return Date.now();
      },
      formatter: function(options) {
        // Return string will be passed to logger.
        return options.timestamp() +' '+ options.level.toUpperCase() +' '+ (options.message ? options.message : '') +
          (options.meta && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' );
      }
    })
  ]
});

And now it should work with winston.transports.Rotate as well.

I just merged this and pushed a new release to npm.


Add simulation framework for pure sampling & sampling + LL

The file noisy_liquid_legions_per_query_epsilon.py can produce, via simulation, different type of errors given number of buckets involved in sampling, per-query epsilons and deltas (for DP), true reach, frequency distribution and other parameters of the liquid legions sketch. When the sketch size is set to -1, assume that no sketch is used.
The file per_query_vs_total_epsilon.py can produce the maximum number of queries per bucket for a given per-query epsilon, delta and total epsilon.
Directory simulation_results contain the simulated error results for sketch_size=100_000 and decay_rate=10 which are the parameters we propose to use for liquid legions.

@amiragha If you are available, would you mind taking a look at this PR? Please let me know if you have any questions. Thank you very much!


Picking first string only for localnav title

As part of the new mobile redesign task, the mobile localnav requires the ability to override the title. To support this, we are introducing an overriding capability by allowing an additional string to be added to the title, e.g., "Photoshop | Overview."
This is a prerequisite task for the mobile redesign work, enabling authors to prepare their content before the mobile redesign code is merged.
Resolves: MWPW-163191
Test URLs:

Before: https://main--milo--adobecom.aem.page/?martech=off
After: https://gnav-localnav-title--milo--adobecom.aem.page/?martech=off

Qa

Before: https://main--federal--adobecom.hlx.page/federal/dev/blaishram/page-with-localnav
After: https://main--federal--adobecom.hlx.page/federal/dev/blaishram/page-with-localnav?milolibs=gnav-localnav-title

Verified that the mobile localnav supports overriding the title by adding the first string to the title as a prerequisite for the mobile redesign .
https://adobe.sharepoint.com/:w:/r/sites/adobecom/_layouts/15/Doc.aspx?sourcedoc={6574CC95-5DE5-44E4-BAA0-3E22AC0986C1}&file=Page-with-localnav.docx&action=default&mobileredirect=true

https://main--federal--adobecom.hlx.page/federal/dev/blaishram/page-with-localnav?milolibs=gnav-localnav-title
mobile view

desktop view


bump python version

as per https://github.com/AMYPAD/miutil/pull/30

@conda-forge-admin, please rerender


[RTL] Fix Preview Banner on Desktop

Issues found during #47
Blocked by:

[x] #495

Banner no longer exists


Cannot read property 'toLowerCase' of undefined in normalizeType

Waterline version: ^0.13.5
Node version: 10.10.1
NPM version: 6.4.1
Operating system: Windows 10

i want migrate drop with waterline utils and i have error with build schema in sails-mysql i use waterline standalone and waterline utils
i tried both use autoMigrations.columnType and without it .. any idea ?

Ok, fixed!

@fikrihanda Hi I'd like to help out with this. It looks like columnName is the only thing that gets passed into normalizeType(), so it seems that somehow a columnName is coming up as undefined. Would you post more of your code or context for the problem and I'll see if anything else stands out?

i use vuex electron in main process and i get error
this is my users.js code
users.js
attributes: {
    name: {
        type: 'string',
        autoMigrations: {
            columnType: '_string'
        }
    }
    [...]
}

and this is my database code for load database
Waterline.start({
    [...],
    defaultModelSettings: {
        [...],
        attributes: {
            id: {type: 'number', autoMigrations: { columnType: '_number', autoIncrement: true }}
        }
    }
}, function (err, orm) {
    autoMigrations('alter', orm, function () {})
})

i tried use columnType still got Cannot read property 'toLowerCase' of undefined in normalizeType any solution ?


random video freeze when participant disconnects

description
when a participant leaves the room, some of the remaining participant may randomly experience a freeze on the video track from a remote participant or from his own stream.
how to reproduce
run the client-sdk-flutter/example on three devices (I tried iOS, Android and chrome)
join the same room, then make one participant leave. Then check if all video streams are updating on the remaining participants
if it doesn't occur, rejoin the room on the participant that left, and try again... it will eventually happen.
btw, the audio is still alive, but the video is frozen, it gets fixed if the "frozen" participant mutes/unmutes his video
I think it's related to the visibility events being fired
tested on commit 2b375033e9cb2cd1b7eba2e547248b3b35d3c9d7
livekit-server 0.15.1

oh, I forgot to mention, sometimes I get the freeze without even leaving the room, but I couldn't find a repro for that scenario, it's probably the same bug.

as @davidzhao  suggested, I tried disabling the optimizeVideo option on the room, and I could no longer reproduce the issue, it must be something related to it

I've been testing it for a while without the optimizeVideo, and it's much better, not only the freezing, but also there was some lag induced by the optimizeVideo feature, I had like 1 second video lag when it kicked in, and unnecesary low resolution switching, now the video plays smoothly with no delays and no freezes.
maybe that feature it should be marked as experimental and disabled by default until it's fixed and tested throughly

Thanks alex for the report, I'm looking into this now.

Hi alex this should be fixed in https://github.com/livekit/client-sdk-flutter/pull/65 but I will do more testing to make sure.

This feature has been renamed to adaptiveStream in RoomOptions and now is off by default.
The logic has been re-written and after testing I believe it is much more stable compared to before so I will close this issue for now.


Version 53.0

Built on top of https://github.com/conda-forge/weasyprint-feedstock/pull/25, with updated dependencies.
We currently miss the pydyf package. If someone is interested in adding this package…

Hi! This is the friendly automated conda-forge-linting service.
I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

We currently miss the pydyf package. If someone is interested in adding this package…

PR is in https://github.com/conda-forge/staged-recipes/pull/15963
Also, just fyi, you can push to the bot PR directly, if you want.

Also, just fyi, you can push to the bot PR directly, if you want.

Good to know!

Edit: Package is now available. Let me know if someone from here wants to be added as maintainer.

Thanks a lot for the package. I’d be happy to be one of the maintainers.

@conda-forge-admin, please restart ci

please restart ci

Looks like it doesn’t do what I expected 😒.

@conda-forge-admin, please restart ci

Ok will add you!
The checks aren’t being shown because of https://conda-forge.org/status/
The checks are still being run and can be seen on the conda-forge azure page: https://dev.azure.com/conda-forge/feedstock-builds/_build

Will be fixed by #27.


adding json tags to attributes for marshaling

I added the JSON tags needed for JSON marshaling of service_binding objects.
Thanks.

Thanks. No tests needed for this.


Add Reward to Tools

Thanks for you request but as it is a quite unpopular package, I would rather not add it to the list.


Formatting the scraper files

Nothing is changed here except the formatting of the files according to our new common standards

Basics

[ ] Details of what you changed are in commit messages
(first line should have module: short statement syntax)
[ ] References to issues, e.g. close #X, are in the commit messages.
[ ] The buildserver is happy.
[ ] The PR is rebased with current master.

Checklist

[ ] I added unit tests for my code
[ ] I fully described what my PR does in the documentation
(not in the PR description)
[ ] I fixed all affected documentation
[ ] I fixed all affected decisions
[ ] I added code comments, logging, and assertions as appropriate
[ ] I mentioned every code or binary not directly written or done by me in reuse syntax

Review

[ ] Documentation is conforming to our Documentation Guidelines
[ ] Examples are well chosen and understandable
[ ] Code is conforming to our Coding Guidelines
[ ] Code is consistent to our Design Decisions

Thanks for separating the reformatting from the other PR.


Update link to Set-PnPPage

[Enter feedback here]
Under "Change the layout of your custom results page", the link to the PowerShell cmdlet should now be Set-PnPPage.  It's currently a 404 when you click on the link.
https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnppage?view=sharepoint-ps

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 6155388f-afc0-e18a-c039-9ae20214e342
Version Independent ID: 74a3dc05-1312-fa5f-9e6c-bf5dcbdd35e9
Content: Create a custom search results page in SharePoint Online
Content Source: MicrosoftSearch/create-search-results-pages.md
Service: mssearch
GitHub Login: @jeffkizn
Microsoft Alias: jeffkizn

Thanks for the update. This is now fixed.


CSP Final, N@TM Retrospective

Individual review contains 4/5 points, two points for each bullet
Issue of quality, easy to read bullets/summaries on requirements, easy to find video, reference to code, utterances working, and early delivery can earn you extra credit. If Teacher is satisfied you met requirements of CPT, easily finds materials, and spends less than 5 minutes with your information that will be big indicator for extra credit.

[ ] one minute video, prepared in CPT style to highlight your feature with the project ie no voice and captions
[ ] correlation to CPT, an article that show how your features or pull requests map to College Board requirements

[ ] Link To Blog
[ ] Link to Video


Build and Release docker images on a release

Introduces a workflow that releases a docker image based on when a Github release has been made. It will pull the version id from the setup.py and that state
Relevant gh docs: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
Tested this on a separate branch using the current dev version.
CPU tag can be seen here: https://hub.docker.com/r/huggingface/accelerate-cpu/tags
GPU tag can be seen here: https://hub.docker.com/r/huggingface/accelerate-gpu/tags
FFT, should we just merge these two release workflows together and check if 'dev' is in the version to automatically tag the latest tag? Or maybe just publish the prerelease tags? WDYT?

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

FFT, should we just merge these two release workflows together and check if 'dev' is in the version to automatically tag the latest tag? Or maybe just publish the prerelease tags? WDYT?

I guess you are talking about the existing build_docker_images.yml here. I don't have particular opinion about if merging these 2 workflow files or not.

@ydshieh by other folks, not for testing. We've had people use the latest images already, so made sense to also do releases
Okay, will think on this and do a follow up most likely with the merge


VSCode does not exit delve properly

VSCode Version: Code 1.13.1 (379d2efb5539b09112c793d3d9a413017d736f89, 2017-06-14T18:13:05.928Z)
OS Version: Darwin x64 16.6.0
Extensions:

Extension
Author
Version

aurelia
AureliaEffect
0.3.4

vscode-npm-script
eg2
0.2.0

task-master
ianhoney
0.1.39

quicktask
lkytal
2.8.0

Go
lukehoban
0.6.62

debugger-for-chrome
msjsdiag
3.1.4

Steps to Reproduce:

Open a Golang project
Debug something
Stop debugging (via Stop, aka the red square or Shift+F5)

delve is the debugger for golang, or at least it's the one that the Go extension uses. When you debug something with delve, it creates a large binary file in the current directory. If you debug a main function (dlv debug), you get 'debug'. If you debug a test function (dlv test), you get 'debug.test'.
In normal delve usage, when you're done, you quit delve. Delve then deletes this file. Apparently VSCode gracelessly terminates (SIGKILL?) delve, which means the file sticks around.

This may be a regression from Microsoft/vscode-go#765 which fixed Microsoft/vscode-go#438

Yes, VS Code terminates debug adapters "gracelessly" (and we are planning to make this more graceful).
But for now the VS Code Go debugger could 'quit' delve nicely when receiving a DisconnectRequest from VS Code. VS Code kills the VS Code Go debugger after it has received the response from the DisconnectRequest.

This issue was moved to Microsoft/vscode-go#1345


MMD for multi-channel latent

Hi,
I am investigating how to implement WAE for a fully convolutional encoder and decoder such that there is no fully connected layers being used. Assuming that I am working with 1D data, I have a latent code (i.e. output of the bottleneck) with dimensionality [batch_size X 1024 channels X 8 samples_per_channel].
I have used the implementation of imq_kernel shown here which is similar to your implementation . However, this is only working with 2D data (no channel dimension).
My question: is it OK to sum every tensor along the channel dimension (which will lead to matrix of size [batch_size X number_of_samples] then continue as usual ? or there is no way from using fully connected layer to flatten the tensor before mmd calculation ?
When I have used that approach, I got very unstable values for the mmd_loss, the values are fluctuating between positive and negative and there is no monotonic decrease !
Finally: in case of using fully conv layers like what I have described, does the latent code represent a samples from distribution Q(z|x) that should be compared w.r.t Gaussian noise of mean 0 and covariance I ? Or the latent in all cases shall be a vector of means and matrix of co-variance that should be fitted onto Gaussian (which is ur case when using FC layers)?!  Does the situation (of fitting mean and covar onto Gaussian) happen also in case of WAE-GAN ?
Sorry for prolonging and many thanks in advance

Hey,
it's hard for me to answer, because I think I'm misunderstanding some parts of your question. Let me clarify:
[----- You wrote -----]
Assuming that I am working with 1D data, I have a latent code (i.e. output of the bottleneck) with dimensionality [batch_size X 1024 channels X 8 samples_per_channel].
[----- ---------- -----]
The latent space (the "bottleneck space", or where the encoder spits out the points) can in principle be any space, but if you want to use Gaussian prior (and from your further questions it indeed seems this is the case) it should be the d-dimensionsl Euclidean space R^d. If you are mini-batching, the encoder should then spit out vectors of shape [batch_size X d].
[----- You wrote -----]
I have used the implementation of imq_kernel shown here which is similar to your implementation . However, this is only working with 2D data (no channel dimension).
[----- ---------- -----]
I am not familiar with that code, but from a quick review I see it may have some issues. For instance, these lines seem to forget taking squares of the coordinates before summing them in the norms computation. If that indeed is a bug, this may be causing some instabilities...
[----- You wrote -----]
Finally: in case of using fully conv layers like what I have described, does the latent code represent a samples from distribution Q(z|x) that should be compared w.r.t Gaussian noise of mean 0 and covariance I ? Or the latent in all cases shall be a vector of means and matrix of co-variance that should be fitted onto Gaussian (which is ur case when using FC layers)?! Does the situation (of fitting mean and covar onto Gaussian) happen also in case of WAE-GAN ?
[----- ---------- -----]
I am a bit confused with the terminology you are using. Let me try clarifying. The goal of the WAE regularizer is to make sure that the aggregated posterior, which is the distribution in the latent space obtained by first sampling the data point and then encoding it, matches the prior distribution. It is not the conditional Q(Z|X), which you should match with the Gaussian, but the mixture of these conditionals across multiple input points X sampled from the data.
Let me know if there are still questions remaining.

Sorry for this complicated description.
What I was doing is simply encode the input mini-batch (without using fully connected layer at the encoder output, so it is still a multi-channel tensor). Then I compare this encoded representation (which is multi-channel) with random Gaussian with the same dimensionality in terms of mmd measure  to get the regularization term. Finally I feed that multi-channel encoded representation to the decoder network in order to reconstruct the signal.
Accordingly, I was dealing with that encoded representation as the 'sampling' from Q(Z|X). Does this make sense ?

"aggregated posterior, which is the distribution in the latent space"
I think this sentence means that the encoder output 'must be' distribution parameters (like what is in VAE), not samples from the distribution Q(Z|X) as what I did !

Hey,
[----- You wrote -----]
What I was doing is simply encode the input mini-batch (without using fully connected layer at the encoder output, so the output is still a multi-channel tensor). Then I compare this encoded representation (which is multi-channel) with random Gaussian with the same dimensionality in terms of mmd measure to get the regularization term. Finally I feed that multi-channel encoded representation to the decoder network in order to reconstruct the signal.
[----- ---------- -----]
Yeah, sure, it makes sense now. So, instead of having a (batch_size, latent_dim)-shaped tensor after encoding as in our implementation, you are ending up with, say (batch_size, latent_dim1, latent_dim2)-shaped one. In other words, for a given input, the code in your case is not a latent_dim-dimensional vector but rather a higher dimensional tensor.
It's hard to say for sure, but I don't see any problems with this approach. You should only be careful when defining the regularization penalties, especially the MMD-based ones which may be sensitive to the latent space dimensionality. Personally, I would flatten the codes before computing the regularizer. Say, your input gets encoded to a (dim1, dim2)-shaped tensor. In order to compute an MMD loss, I would take a (batch_size, dim1, dim2)-shaped tensor representing encoded training points, reshape it to (batch_size, dim1 * dim2), and then compare it to the tensor of the same shape populated with the independent standard Gaussian entries using these lines. While doing so you will need to replace opts['zdim'] with dim1 * dim2.
Meanwhile the decoder can operate directly with the (batch_size, dim1, dim2)-shaped input.
[----- You wrote -----]
"aggregated posterior, which is the distribution in the latent space"
I think this sentence means that the encoder output 'must be' parameters of distribution Q(Z|X) (like what is in VAE), not samples from the distribution Q(Z|X) as what I did !
[----- ---------- -----]
No, actually either of these is fine, you can use Gaussian encoder, any other stochastic encoder, or even a deterministic encoder. All you need to verify is that you can sample from Q(Z|X=x) for any given input point x. If your encoder is parametrizing mean and covariance of a Gaussian, this sampling will be defined by (a) running the encoder for an input x to get the Gaussian parameters, (b) sample a random code from a Gaussian corresponding. If your encoder is deterministic, then Q(Z|X=x) is just a function mapping an input x to a fixed code.
Note that if you are using a deterministic encoder, Q(Z|X) is a Dirac point mass and obviously can not match the standard Gaussian. However, the aggregate posterior is a continuous mixture of the point masses.
I hope this clarifies some of your questions!

The first part of your answer is totally clear for me now and similar to what I though about (i.e. to exclude FC from encoder and deal with the coded representation directly to calculate mmd after reshaping the multi-channel encoded representation like what you have described).
'Note that if you are using a deterministic encoder, Q(Z|X) is a Dirac point mass and obviously can not match the standard Gaussian. However, the aggregate posterior is a continuous mixture of the point masses.'
This is the only thing remaining to understand, what does it mean by 'aggregate posterior' ? is it the mean of codes Q(Z|X) calculated over mini-batch ? i.e.
aggregate posterior= 1/n sum(Q(Z|X=x_i) where n is the mini-batch size and i is the sample index of the mini-batch

When I say aggregate posterior, ideally I mean marginal distribution of a code Z when (a) you sample your data point x from the unknown data distribution, and (b) you sample a code Z from Q(Z|X=x).
When computing MMD we are using a U-statistic, which is a sample-based estimate of the true MMD. In other words, we are estimating the population MMD between actual aggregate posterior QZ and the prior PZ (say, standard Gaussian) based on samples from QZ and PZ. Both samples are of size batch_size. Loosely speaking, we are replacing distributions Qz and Pz with two point-clouds.

This is the only thing remaining to understand, what does it mean by 'aggregate posterior' ? is it the mean of codes Q(Z|X) calculated over mini-batch ? i.e.

No, this is not the case. There is no averaging of vectors in the latent space going on. Instead, as can be seen from the Algorithm 2, what happens is an averaging of pairwise similarity measures between points fro, those two clouds.

if so, then increasing the mini-batch size should lead to better mmd measure

Indeed, we have reasons to believe that MMD should work better with larger minibatch sizes, but that is not necessary.

Aha, so the calculation of that aggregate posterior is already done by averaging the mmd estimates between samplings from Pz and Q(Z|X=x) according to the update role described in algorithm 2 and this should ensure the aggregate posterior to be continues mixture matches the prior.
Cool, then all what I need to do then is to apply that idea of reshaping the multi-channel latent (encoded representation).

I'm glad we clarified this. Let me know if you have any further questions.


dataset

How to get dataset? Do I need to apply for qualifications?

Thank you for your interest!
TUH dataset is available here, please follow instructions for TUSZ: https://isip.piconepress.com/projects/tuh_eeg/html/downloads.shtml
MIT dataset is available here: https://physionet.org/content/chbmit/1.0.0/
UPenn dataset is available here: https://www.kaggle.com/competitions/seizure-detection
After downloading, you can follow the preprocessing instructions in the README.


Typescript imports referring to .js files instead of .ts

Describe the bug
This might be more a question than a bug, but I'm working on a Typescript/Webpack 5 project and replacing Selectize with Tom Select.
Since I'm compiling my own Typescript down I decided to import straight from the source files:
import TomSelect from 'tom-select/src/tom-select';
//import plugins, etc.

All of the relative import statements are using the .js extension which don't exist (since they're all .ts)
import TomSelect from '../../tom-select.js';
Is there a reason the extension is JS or can it easily be changed to TS? Or is there some tsconfig setting to load the TS files instead of the referenced JS files?
To Reproduce
Create a typescript file and import TomSelect:
import TomSelect from 'tom-select/src/tom-select';
Error:
ERROR in ./node_modules/tom-select/src/plugins/checkbox_options/plugin.ts 15:0-44
Module not found: Error: Can't resolve '../../tom-select.js' in '{...}\node_modules\tom-select\src\plugins\checkbox_options'

Expected behavior
I should be able to refer to the Typescript files and my webpack ts-loader handle them.
Context:

tom-select: 2.0.0-rc.3
webpack: 5.52.0
typescript: 4.3.4

Editing my node_modules to test it out, I removed the .js extensions and 2 minor typescript changes, and it's working now.
I'll submit a PR in a few hours with my changes so you can see if it breaks the current dist builds.


The module is not working with Nuxt 3.12

Hi, I have upgraded my project to Nuxt 3.12 and I have encounter an issue with Nuxt Multi cache.
 ERROR  [worker reload] [worker init] Cannot read properties of undefined (reading 'component')          2:09:40 PM

  at <anonymous> (node_modules/.pnpm/nuxt-multi-cache@3.1.1_patch_hash=3d7jtreyhnmo6h3yjzuqi7daoa_rollup@4.18.0/node_modules/nuxt-multi-cache/dist/runtime/serverHandler/helpers/storage.mjs:7:30)
  at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
  at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

The plugin didn't success to load the nuxt.config.ts configuration on server side.
I think there is a change in how you can get runtimeConfig through Nitro. The module currently load the global runtimeConfig and the multiCache config doesn't exist :
const runtimeConfig = useRuntimeConfig();

On the Nitro documentation, it is recommended to load the event inside the useRuntimeConfig, see https://nitro.unjs.io/guide/configuration#runtime-configuration.
[EDIT] Maybe use check to use something like this : https://github.com/harlan-zw/nuxt-schema-org/pull/55

So after investigation, it seems Nuxt Turnstile is creating this bug in combination with nuxt-graphql-middleware. I have move nuxt turnstile in nuxt module at the end and it is not throwing the error anymore.


Bad response after cancel download task

What did you do?
I've created a method to download large files:
        downloadRequest = sessionManager.download(endpoint,
                                                      method: method,
                                                      parameters: parameters,
                                                      encoding: JSONEncoding.default,
                                                      headers: headers,
                                                      to: to).downloadProgress { progress in
                                                        fractionCompleted(progress.fractionCompleted)
        }.response(queue: queue,
                   completionHandler: { downloadResponse in

                    print(downloadResponse)

                    // Rest of the code

        }).validate()

During this process the user can pause the download:
downloadRequest.suspend()
And after that the user can cancel the download:
downloadRequest.cancel()
What did you expect to happen?
The response to the cancel should be
Error Domain=NSURLErrorDomain Code=-999 "cancelled"
What happened instead?
The response to the cancel is
Alamofire.AFError.ResponseValidationFailureReason.dataFileNil
Alamofire Environment
Alamofire version: 4.7.2
Xcode version: 11.3.1
Swift version: 5
Platform(s) running Alamofire: iOS

First, I suggest you update your version of Alamofire, to 5 if you can, 4.9.1 if you can't, to see if maybe this is something that was fixed.
Second, looking at the code (of 4.9.1), there should only be one way this happens: the URLSession didn't return the cancellation error. This could be due to the request actually being finished when it was suspended.
In any case, this likely won't be something that's fixed for Alamofire 4 if it is a bug. But just in case, a replicable test case would be greatly appreciated, as this isn't something we see in our tests.

Thank you for your answer, I'll try to update the version and check the problem again.

If you do find an Alamofire issue, feel free to update this issue.

@jshier Hi Jon, I have a similar problem.
I'm using Alamofire 5.1.0
I have a few screens in my iOS app. When I'm leaving the screen I'm canceling all requests.
I'm also using RequestRetrier. In current case from that method I'm returning completion(.doNotRetryWithError(error))
Here are the error details before I return it.
error.asAFError?.isExplicitlyCancelledError = false
nsError.domain = "Alamofire.AFError"
nsError.code = 13
error.localizedDescription = "URLSessionTask failed with error: cancelled"
In responseJSON I expect to get AFError where isExplicitlyCancelledError = true or NSError with domain = NSURLErrorDomain, code = NSURLErrorCancelled, but instead I'm getting:
nsError.domain = "Alamofire.AFError"
nsError.code = 8
error.localiedDescription = "Request retry failed with retry error: Request retry failed with retry error: URLSessionTask failed with error: cancelled, original error: URLSessionTask failed with error: cancelled, original error: Request retry failed with retry error: URLSessionTask failed with error: cancelled, original error: URLSessionTask failed with error: cancelled"
FYI: Also I'm using ServerTrustEvaluating when creating a Session.
I'm still trying to find out what can it be, but I would be very grateful if you could help me. Thank you

First, I suggest not using the NSError info for making decisions here. Using asAFError should give you the AFError instance which you can use to inspect all properties or even switch over the entire set of possible errors.
From the look of the message it appears that multiple retries with the same error will repeat over and over again. I'm not sure how though, as it should stop after a single .doNotRetryWithError instance. I can investigate that, but you could try updating your RequestRetrier to not return the error in the cancellation case, instead using .doNotRetry, which should preserve the original error.

Also, @rsimenok, how are you cancelling your requests?

With .doNotRetry I'm getting some AFError, my debagger doesn't show me what exactly error it is, localizedDescription is right but isExplicitlyCancelledError still returns me false. If I cast it to the NSError(will not do this in the future) I see domain = "Alamofire.AFError", code = 13.
How I cancel:
// sessionManager is the Session class
sessionManager.session.getAllTasks { tasks in
        tasks.forEach { $0.cancel()
     }
}

This was left from the Alamofire 4.9 in my code, will try cancelAllRequests. Thank you!

Working!
First, I'm canceling my requests with session.cancelAllRequests.
Second, in my RequestRetrier I add this few lines :
if let afError = error.asAFError, afError.isExplicitlyCancelledError {
                completion(.doNotRetry)
            } else {
                completion(.doNotRetryWithError(error))
            }

But I can't say that this looks good, so as you mentioned this should be investigated.
Jon, thank you very much!

Filtering cancellation errors is generally a good idea for retry so you don't unnecessarily retry in that case. Really we should ensure retriers aren't called when the request as been cancelled, so I'll investigate that change.
Ultimately your issue was cancelling by interacting with the task directly. Since URLSession returns the cancellation error for a variety of reasons, including actual cancellation, it's not something we look to unconditionally filter. I'll see if I can update the docs to make it clear the URLSession and tasks should never be used for lifetime methods.


Throw types

Fixes #23689
This PR is based on #40336 (Template string types and mapped type 'as' clauses) so it doesn't use master as the base branch.
This PR introduces:

A new type-level expression: throw type_expr. Currently throw type only throws in a conditional type.
A new modifier to use in the template string typeof T to make it easier to debug.

Considered use cases:
Welcome to suggest more use cases!
TypeAlias instantation
type MustNumber<T> = T extends number ? T : throw `Expected, but found "${typeof T}"`
type A = MustNumber<1>
type B = MustNumber<typeof window>

Prevent CallExpression
class X<T> {
    constructor(public item: T) { }
    add(a: T): T extends number | string | bigint ? T : throw `Cannot apply + operator on this type` {
        // @ts-ignore
        return a + this.item
    }
}
new X(1).add(2).toExponential()
new X("").add("")
new X({}).add({})

TODO:

[x] Figure out how to "print" types in the error message. Maybe a new modifier \${typeof T}``
[ ] Write tests and fix broken parts
[ ] Wait for #40336 to be merged

This is great, it can help develop and debug complicated type systems much more efficiently. I really hope it lands along with it's base PR on 4.1 😍

Why would you use typeof keyword in
type MustNumber<T> = T extends number ? T : throw `Expected, but found "${typeof T}"`

T already is a type in that expression.

It's can be changed to another keyword if there is a better alternative

I think something like nameof is more clear in this case.

@Jack-Works this looks awesome. Is there a playground link we can try? I have a type assertions library (expect-type) and I'd like to see if I can use this to improve the error messages.

@Kingwl hi can you let the bot to pack this?

sure. @typescript-bot pack this

Oh seems like the bot won't pack this until no test error, I'll handle this later

As you wish.
@typescript-bot pack this.

I'm gonna re-pack, a bunch of PRs got merged on monaco / monaco-ts which broke the playground build - I think I fixed it.
@typescript-bot pack this.

Third time lucky ( see #40445 )
@typescript-bot pack this.

@Jack-Works trying this out on my library now, and it's working beautifully. I did notice one small issue, though. Throw types for generic functions inside generic interfaces can get replaced with Unknown, if the throw type uses both generics. There may be other ways to repro it, but here's a reasonably simple illustrative example:
interface Example<T> {
  tOnly: <U>() => throw `T: ${typeof T}`
  uOnly: <U>() => throw `U: ${typeof U}`
  tAndU: <U>() => throw `T: ${typeof T}, U: ${typeof U}`
}

declare const ex: Example<{foo: string}>

ex.tOnly<{bar: string}>() // Error looks good: Type instantiated results in a throw type saying: T: { foo: string; }

ex.uOnly<{bar: string}>() // Error looks good: Type instantiated results in a throw type saying: U: { bar: string; }

ex.tAndU<{bar: string}>() // Error looks bad: Type instantiated results in a throw type saying: Unknown

playground link

Thanks @mmkal , I'll try to investigate the bug later

I found another potential usage. This PR might be able to resolve #18433 (Dangerous "name" global).
If we mark it as declare var name: throw "Error-prone deprecated global variable" and emit type error once it referenced, the problem is gone.

hi everyone please move to #40468

@mmkal the bug has been fixed!


Fails on most recent version of Render

Screen flashes and then goes blank

Closing issue - solution is to have credit card information already on file for the render account, since the build uses a starter plan.


Adding support for logging framework

We need support for logging and I suggest that we add dependencies for a logging framework and configure the logging to write to standard output for the time being. What about using Log4j2? https://stackify.com/compare-java-logging-frameworks/
To showcase how the logging works we can add a first logmessage when the server starts.

Had to change thread sleep in ServerTest.java from 500 ms to 1000 ms because the server object didn't have enough time to initialize.


Collision Problem with Id when iterating in Visual Studio with .NET C#

When creating a loop with templating, I also create an Input.Text type for each of my iterations, (imagine looping answers, and then comment fields as input for each of those answers). The problem here is that Input.Text requires a unique ID, and that is a problem if you want to save the result to an object in the backend. If I do a $index, the object cannot be mapped and thus saved in my DB.
There is a way to make it work the old way, by writing the card in C#. But this includes writing a new card for each step so there are no conflicts, and putting all the cards in a foreach loop. Finally you could put all the cards in a List of Attachments, but the final look is horrible. I don't see a way to use Templating with binding to make my solution work.
When writing the card in the online Designer I don't get a collision due to iterating, the submit button maps the fields properly for every generated button (unless I manually write (iterate) all the fields that need to be iterated, then I get the duplicate id error from the validator). When using Visual Studio I get: Collision detected for id '{Id name goes here}'
Packages: "AdaptiveCards 2.4.0", "AdaptiveCards.Templating 1.1.0"

URL: https://adaptivecards.io/explorer/Input.Text.html

@samoZacc
Hi,
You can use AEL concat function.
Suppose you have "id": "${}",
You can have a unique id by appending $index, for example, "id": "${concat('aString', $index)}"
Can you try this, and let me know how it goes?
Thanks

@samoZacc
Hi,
You can use AEL concat function.
Suppose you have "id": "${}",
You can have a unique id by appending $index, for example, "id": "${concat('aString', $index)}"
Can you try this, and let me know how it goes?
Thanks

That is not binding the data. It needs to be the same text as the property to bind. Nothing new is added to the DB if you do that. That solves only the bug, but doesn't solve the problem. "id" : "propertyName + index" doesn't work

That is not binding the data. It needs to be the same text as the property to bind. Nothing new is added to the DB if you do that. That solves only the bug, but doesn't solve the problem. "id" : "propertyName + index" doesn't work

hey @jwoo-msft
That is not binding the data. It needs to be the same text as the property to bind. Nothing new is added to the DB if you do that. That solves only the error, but doesn't solve the problem. "id" : "propertyName + index" doesn't work

@samoZacc
I'm not sure. I'm following you. You mentioned that your issue is duplicated ID, and I mentioned a way to generate a unique id. Can you share your template & data?


random_device: rdrand failed

node version: v10.19.0
os: ubuntu 20.04
npm version: 6.14.8
Node platform: linux
Node process:
  node: '12.20.0',
  v8: '7.8.279.23-node.45',
  uv: '1.40.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.16.1',
  modules: '72',
  nghttp2: '1.41.0',
  napi: '7',
  llhttp: '2.1.3',
  http_parser: '2.9.3',
  openssl: '1.1.1g',
  cldr: '37.0',
  icu: '67.1',
  tz: '2019c',
  unicode: '13.0'
}

Node architecture: x64
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR<EMAIL_ADDRESS>postinstall: `node scripts/build.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the<EMAIL_ADDRESS>postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

got this when doing a npm i which requires "node-sass": "^4.12.0"

Same issue here on Azure DevOps hosted Agent,
node version: v14.15.1
os: Windows Server 2019
node-sass in package.json: ^4.13.0
Starting: npm install
==============================================================================
Task         : npm
Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Cannot download "https://github.com/sass/node-sass/releases/download/v4.13.0/win32-x64-83_binding.node":
><EMAIL_ADDRESS>install D:\a\1\s\<project>\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.0/win32-x64-83_binding.node

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

npm i
npm WARN deprecated<EMAIL_ADDRESS>request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated<EMAIL_ADDRESS>this library is no longer supported
npm WARN deprecated<EMAIL_ADDRESS>Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated<EMAIL_ADDRESS>Please update to v 2.2.x

><EMAIL_ADDRESS>install /home/dragos/Downloads/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-64_binding.node
Download complete  ] - :
Binary saved to /home/dragos/Downloads/node-sass/vendor/linux-x64-64/binding.node
Caching binary to /home/dragos/.npm/node-sass/5.0.0/linux-x64-64_binding.node

><EMAIL_ADDRESS>postinstall /home/dragos/Downloads/node-sass
> node scripts/build.js

Binary found at /home/dragos/Downloads/node-sass/vendor/linux-x64-64/binding.node
Testing binary
terminate called after throwing an instance of 'std::runtime_error'
  what():  random_device: rdrand failed
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR<EMAIL_ADDRESS>postinstall: `node scripts/build.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the<EMAIL_ADDRESS>postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dragos/.npm/_logs/2020-12-17T11_16_23_002Z-debug.log

thing is i ve used it successfully on 2 other machines, both running ubuntu 20.04, the only difference being that those were intel machines, as opposed to this one which is and amd ryzen 7 with b550 chipset; could it be an issues with the linux drivers for this kind of setup?

@mbaumanndev you're installing the wrong version of node-sass for node 14. Check the readme for the version compatibility table.

I didn't changed my CI and worked great for months, how can it be the wrong version ?

@fk1blow looks an incompatibility between the system libraries the binaries are compiled with and those on your local machine. Could be something about the architecture of that machine or an ABI mismatch.
Unfortunately there isn't much we can do. Out of curiosity does node-sass@^4 install without issue?

@mbaumanndev my guess is your CI environment upgraded their node version to node 14 recently. Node sass 4.13 has never worked with node 14.

@xzyfer tried it and it fails in the same way.
Will migrate to dart-sass for now.
Could it work inside a docker container? Anyway, will try it tonight.
Thanks for your help!

@fk1blow can't say for sure sorry

It is unlikely node-sass can do anything to make it work :(

For what it's worth, I experienced this "RDRAND failed" error after upgrading from Debian10 to Debian11 when running "yarn add node-sass" in an empty directory. (Apparently Debian11 brings a newer libstdc++ which perhaps has a newer implementation of the C++ std::random_device class that started using RDRAND?)
I resolved the issue by upgrading the BIOS. (CPU: AMD Ryzen 7 5800X, Motherboard: GIGABYTE B550I AORUS PRO AX. Original BIOS was version "F3" which triggered the RDRAND errors, updating to BIOS version "F13" resolved the issue.)


Unmanagedexports for .net framework 4.8

Hello. @3F
I m using the UnmanagedExports 1.2.7 Nuget package and it works for me in framework 4.7 but if I upgrade my framework version to 4.8 I m getting a error with version48 in the UnmanagedExports.
Error msg :
The "DllExportAppDomainIsolatedTask" task failed unexpectedly.
System.ArgumentException: Requested value 'Version48' was not found.
Thanks for reading!

Duplicate of #162
@Pratikkulkarni-93 You can easily upgrade to modern DllExport packages. Start here

Hi Denis
I followed the above link and replaced unmanagedexports.
Dllexport 1.7.4 exported  fine , but functionally not working
Could you guide me  more
On Tue, Sep 7, 2021, 16:04 Denis Kuzmin @.***> wrote:

Closed #194 https://github.com/3F/DllExport/issues/194.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/3F/DllExport/issues/194#event-5264898578, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AVQPRDYR5MWVNEZAU3GNTO3UAXTDVANCNFSM5DR3WJ7A
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

@Pratikkulkarni-93
Hi,
Could you please follow the bug issue template? I need logs, configuration, and steps to reproduce.

I followed the above link and replaced unmanagedexports.
Dllexport 1.7.4 exported  fine , but functionally not working

Please open a new issue if the problem is different from the current. Also please make sure this is not a duplicate.
Thanks.


Unambiguous datetime conversion is considered ambiguous because of DST

iex(15)> "2017-10-28T23:59:43.522Z" |> Timex.parse!("{ISO:Extended:Z}") |> Timex.local
#DateTime<2017-10-29 01:59:43.522+02:00 CEST Europe/Stockholm>
iex(16)> "2017-10-29T00:00:43.522Z" |> Timex.parse!("{ISO:Extended:Z}") |> Timex.local
#<Ambiguous(#DateTime<2017-10-29 02:00:43.522+02:00 CEST Europe/Stockholm> ~ #DateTime<2017-10-29 01:00:43.522+01:00 CET Europe/Stockholm>)>

The example above is using timex 3.1.24 and the local time zone is "Europe/Stockholm".
The source datetime is using UTC (Zulu time) and I believe this means that conversion from it to any other time zone should be always possible, since UTC does not have daylight saving.
I have read through the docs about Timex.AmbiguousDateTime, but I don't think this issue fits any of the 2 example cases in it.

Your issue seems to relate to this other one: https://github.com/bitwalker/timex/issues/142
Namely, there seems to be an overlap in daylight savings timezone and normal timezone in europe

Also running into this issue, using a pipeline like:
datetime = "20171105T01:37:07America/New_York"

datetime
|> Timex.parse!("%Y%m%dT%T%Z", :strftime)
|> Timex.Timezone.convert("UTC")

** (FunctionClauseError) no function clause matching in Timex.Parse.DateTime.Parser.parse!/3
    (timex) lib/parse/datetime/parser.ex:77: Timex.Parse.DateTime.Parser.parse!("%Y%m%dT%T%Z", :strftime, Timex.Parse.DateTime.Tokenizers.Default)
iex(infusion@<IP_ADDRESS>)17> Timex.parse!(datetime, "%Y%m%dT%T%Z", :strftime)
** (FunctionClauseError) no function clause matching in Timex.Parse.DateTime.Parser.apply_directives/3
    (timex) lib/parse/datetime/parser.ex:199: Timex.Parse.DateTime.Parser.apply_directives([], #<Ambiguous(#<DateTime(2017-11-05T01:37:07-04:00 America/New_York)> ~ #<DateTime(2017-11-05T01:37:07-05:00 America/New_York)>)>, Timex.Parse.DateTime.Tokenizers.Strftime)
    (timex) lib/parse/datetime/parser.ex:90: Timex.Parse.DateTime.Parser.parse!/3


refactor: link components

Converting link components to functional components with updated types and additional cleanup.
Refactoring the components to move away from class components and better prop types to prepare for React 18.
Upon refactoring this component I ran into some issues with the logic surrounding the context in the UnstyledLink  it's not straightforward the value of its purpose and use in the UIKitProvider component.
WIP as the story for UIKitProvider is broken stating --  TypeError: Cannot read property 'className' of undefined. It is not clear why this is broken yet.

Testing

Trade-offs

Dependencies

Screenshots

Checklist for PR creator

[ ] If any new components were added, there are exported from packages/index.ts
[ ] If this PR is associated with a JIRA, it is mentioned in commit message footer ("Closes …")
[ ] If this PR contains breaking changes, is stated in commit message body ("BREAKING CHANGE: …")
[x] Info for applicable sections above is provided

I've made some additional updates to try to fix the issues with the link delegate story under the UIKitProvider.
Unless there is something else to address the undefined 'className'.
I have been following the trail of errors. It looks like the next thing to update and convert might be interactionMode.ts, may be able to turn this into a hook.
The issue is around the FocusStyleManager set on the Button component which the link delegate uses. I suspect it might have something to do with this being a class and the use of this and overall class-based logic.

@vacas5
Sadly the UIKitProvider / Link Delegate story has the error above still.
Still WIP because of this, but if anyone wants to poke around and try to fix it they are very much welcome to!


How to get two bots chatting to each other

Hiya @innightwolfsleep thanks for the bot code!
You might have seen my reply to your Telegram bot chat wrapper.
Now that I have Dockerised your bot code I have two bots in the same room. However, they seem to not respond to each other's output. Is there a way to get them to see each other?

Have nothing to add here...
python-telegram-bot library not provide user api, so it is imposible to make fake "telegram user" with my code. Need migrate to another framework to provide this feature.


Fix typo of template

Fix typo of portfile template.

@UnaNancyOwen,
Thanks for having already signed the Contribution License Agreement. Your agreement has not been validated yet. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

Thanks, appreciate the fix!


Button -- Or Obvious Clickable Link (Inside Text Area)

Can we have a Wrapping Button or clickable Link inside a text area? -- Something like a button that is obvious to click on -- that would show a (VIDEO) or (PICTURE) but have formatted text.
Thanks

I think this is similar to my request in #87 for adding support to insert arbitrary nodes.

Adding a button would indeed require #87. Clickable text does not, and you can do that with RichTextFX. You will not be able to use any of the specialized subclasses like CodeArea, InlineCssTextArea, InlineStyleTextArea or StyleClassedTextArea, because in those, "style" equals either inline CSS or CSS style class. But in StyledTextArea, style is literally anything, so it can be your custom object containing a URL to go to. You just need to provide a function how to apply your custom style to a Text node. (Those other classes just set "custom style" = "CSS string" and "apply function" = "Node.setStyle", or similar, for convenience.)
Here is a demo
package org.fxmisc.richtext.demo;

import javafx.application.Application;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.IndexRange;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;

import org.fxmisc.richtext.StyledTextArea;

public class InlineLink extends Application {

    static class MyStyleDef {
        static final MyStyleDef NO_LINK = new MyStyleDef();

        private final String url;

        private MyStyleDef() {
            this(null);
        }

        MyStyleDef(String url) {
            this.url = url;
        }

        void applyToText(Text text) {
            if(url != null) {
                text.setCursor(Cursor.HAND);
                text.setFill(Color.BLUE);
                text.setUnderline(true);
                text.setOnMouseClicked(click -> {
                    System.out.println("Go to " + url);
                });
            }
        }
    }

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {

        StyledTextArea<MyStyleDef> area = new StyledTextArea<MyStyleDef>(
                MyStyleDef.NO_LINK,
                (text, style) -> style.applyToText(text));

        Button addLink = new Button("Add link");
        addLink.setOnAction(ae -> {
            IndexRange range = area.getSelection();
            area.setStyle(
                    range.getStart(), range.getEnd(),
                    new MyStyleDef("https://github.com/TomasMikula/RichTextFX"));
        });

        VBox.setVgrow(area, Priority.ALWAYS);
        area.setWrapText(true);
        VBox vbox = new VBox(addLink, area);

        Scene scene = new Scene(vbox, 600, 400);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

and the result:

Hi Tomas - I've recently started learning RichTextFX and I have been experimenting with this demo. I have noticed that single-clicking on the hyperlink does not consistently trigger the "Go to..." callback. About one in ten times, the click is ignored. I first observed this in my own app, but I can duplicate the issue with your demo code.
I'm almost certain it's connected with the behaviour of the flashing caret. If you happen to click the link at the exact location of the caret while the caret is visible, it seems that the MOUSE_CLICKED event is delivered to the ParagraphText node rather than the TextExt node, ie the click goes to some node other than the TextExt. The reason seems to be connected with the way that Java FX locates the target for the mouse event (see Scene:3551 ish). I am fairly sure that the flashing of the caret is confusing this algorithm.
I've been trying to find a workaround but all my ideas have failed. I wondered if you had any insights please ? Btw thank you for creating such a powerful framework, it has saved me a huge amount of time and frustration !

btw, with reference to my earlier comment, here's a shot from the debugger during one of these "failed" clicks. Notice that the "pressedTargets" and "releasedTargets" are not identical, which means that FX selects the ParagraphText node as the one that receives the mouse event, rather than the TextExt. Like I say, I think this must be related to the flashing of the caret but I have no idea how to work around the problem.

Ah I think I found a solution ! I went down the rabbit hole of trying to write my own "mouse pick" routine that would ignore certain types of node, but then I realised that every node has a "MouseTransparent" property. If I modify the source of CaretNode to set this to true, my problem goes away. Hooray !
Can anyone thing of a reason why you would ever want the caret to not be transparent ? I can't think of a valid case.

Hi @chrisf-london thanks for chasing this down. Could you submit a PR please and I'll be happy to merge it.

Hi Jugen - thanks, just did it. I hope the format is ok (my first time PR'ing to this repo)


Why does the input resource name have to show up in pathToDockerFile and pathToContext

This is the example used at the page: https://github.com/tektoncd/pipeline/blob/master/docs/tutorial.md#task-inputs-and-outputs to create a task:
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: build-docker-image-from-git-source
spec:
  inputs:
    resources:
      - name: docker-source
        type: git
    params:
      - name: pathToDockerFile
        description: The path to the dockerfile to build
        default: /workspace/docker-source/Dockerfile
      - name: pathToContext
        description:
          The build context used by Kaniko
          (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts)
        default: /workspace/docker-source
  outputs:
    resources:
      - name: builtImage
        type: image
  steps:
    - name: build-and-push
      image: gcr.io/kaniko-project/executor
      # specifying DOCKER_CONFIG is required to allow kaniko to detect docker credential
      env:
        - name: "DOCKER_CONFIG"
          value: "/builder/home/.docker/"
      command:
        - /kaniko/executor
      args:
        - --dockerfile=${inputs.params.pathToDockerFile}
        - --destination=${outputs.resources.builtImage.url}
        - --context=${inputs.params.pathToContext}

It took me hours to figure out we have to keep the input resource name, like "docker-source" as defined in this example, in pathToDockerFile and pathToContext as part of the prefix "/workspace/docker-source", then continue the REAL path to dockerfile or context. Why is it implemented like this?
The input resource name actually has nothing to do with pathToDockerFile and pathToContext.

Resource names describe where the source is placed inside /workspace -- if you have a resource named foo and another named bar, they'll be materialized into /workspace/foo and /workspace/bar
The kaniko builder needs to be aware of the location of the input resource, to know where inside /workspace to find the Dockerfile.
FWIW, in general you should probably use the kaniko Task in the catalog, rather than creating your own.

@ImJasonH Thank you for the response.
However, the kaniko task in the catalog is hardly able to use, since context is missing. I can locate the dockerfile, but it is a hassle to reach the correct directory. Probably this is a feature to be added.

@houshengbo
You can use TargetPath to change the behavior.

The Kaniko task in the catalog sets workingdir: /workspace/source, which is supposed to address this, but since the default of --context is /workspace and not ., it doesn't. :(
I've proposed https://github.com/tektoncd/catalog/pull/33 to address this, thanks for bringing this to my attention.

@ImJasonH
I submitted another PR https://github.com/tektoncd/catalog/pull/32 to address this already. Hope we do not repeat the effort.
--context=/workspace/source/${inputs.params.CONTEXT}, so --context can be set to ./. The user does not need to care whether workspace or workspace/source.

It looks like we can close this now that the catalog fix has been merged. Please let me know if I missed something and there is still work to do here.


So many dependencies

Your selector include bootstrap, chosen, lodash (incompatible with underscore) , jstzdetect, moment-timezone, moment and angular. This cause a lot of incompatibilities in a lot of current applications. Try to clean it.

Open to pull requests if you are able to trim it down


Request for datasets and training code

Hi,
Thanks for giving the 1st nice try on text-to-music!
Could you please release the dataset Textune and training code?
Sincerely

Hi Xin,
Thank you for your interest in this project! The dataset Textune was collected internally and there are no plans to release it for now. However, Textune will probably be released under some form in the future. If interested in this dataset, please stay tuned for further updates.


Move dependencies to a conda environment file

Also, remove the Git submodules file since there will be no need


Removed deprecation note from node-pressure-eviction.md

Fixes: #32170

Hi @daminisatya, @jimangel,
Could you please have a look

The deprecated kubelet garbage collection options are listed on this page but not in a specific section: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
I would rather see this note updated to point to that page
/close