Proposal: String enums

A string enum is inferred by looking at the constant value of the initializer of its first member:
enum stringsInferred {
   a = "a",
   b, // "b"
   c  // "c"
}

Or it is declared using a string index:
enum stringsDeclared {
   [prop: string] : string;
   a, // "a"
   B, // "B"
   c  // "c"
}

The auto initialized value on an enum is its property name.
Inferred enum special case
enum stringsLowerCase {
   Shoes = "shoes", // If the first member has lowercase chars, then lowercase all other member values
   Boots, // "boots"
   Feet  // "feet"
}

:+1:
We should definitely be able to use enums with string values. Even a const enum with compile-time string literals that are safe to inline would be helpful already, mainly for …

restricting variables to a set of known string values, and
avoiding misspellings.

I'm not sure the automagical upper- and lowercasing described underneath Inferred enum special cases is such a good idea, though. I'd rather spell all cases exactly like they should be stringified:
enum stringsUpperCase {
   Shoes = "SHOES",  // "SHOES"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}

@mariusschulz You could always use the declared form (which doesn't infer anything):
enum stringsUpperCase {
    [prop: string] : string;
   Shoes = "SHOES",  // "SHOES"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}

The automatic lower-casing comes from @SaschaNaz :
https://typescript.codeplex.com/discussions/549207
I'll admit that maybe the uppercase one isn't needed.

Can this be generalized to other types (with the constraint that all types must be initialized - none can be inferred)?

@impinball It can, more elaborate examples in #3105
Just wanted to keep this discussion focused on the enum with values of type string.
Seems a bit redundant to not allow inferring the type:
// (a)
enum strings {
   Shoes = "Shoes",  // "Shoes"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}
// (b)
enum strings {
   [prop: string] : string;
   Shoes,           // "Shoes"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}

Both work but find (a) more visually appealing.

@jbondc
I agree, and this could be the other special case (where value inference already exists for numbers).

@jbondc
And I feel this syntax is a little repetitive in the [prop: string]: string part. Couldn't the syntax be modified to have the type after the enum name, instead of in the body? Maybe this syntax, to borrow your example?
enum strings : string {
   Shoes,           // "Shoes"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}

Certainly could and it's a neat looking syntax.
Went with  [prop: string]: string because:
(a) Same looking syntax as with interfaces
(b) The property index adds some expressiveness so you could have things like:
type UpperFirst = /[A-Z][A-Za-z]+/;
enum strings {
   [prop: UpperFirst] : string;
   Shoes,           // "Shoes"
   BOOTS,            // "BOOTS"
   Feet              // "Feet"
}

My gamble is it has some usefulness if you want to create a library that has some opinionated styles to it :grinning:
So less about type safety but using types as a mechanism to enforce constraints.

Not allowing anyone to extend your enum:
enum strings {
   [prop: "Shoes" | "BOOTS" | "Feet"] : string;
   Shoes,
   BOOTS,
   Feet
}
// Or something like this
enum strings {
   [prop: keys(this)] : string;
   Shoes,
   BOOTS,
   Feet
}

These same patterns naturally apply to interfaces too.

@jbondc Any advantages to that over my recent proposal? I don't think that regex-based solution is really that helpful in practice. All that regex does there is enforce type names, something better left to a linter as opposed to the main compiler. And it looks a little out of place compared to the enum entries. And as you said in the other thread, it will complicate the parser and compiler a little, likely more than it should.
And as for extending enums, that's not very good practice, anyways. And it's generally not possible among other TypeScript users. Mine allows for such extensions, but you can only truly extend them in the same module or private namespace declaration, unless you're writing a definition file. That's because of the module wrapper emitted around every namespace declaration. So, for most purposes, you can't really extend them in the first place.

Always hard to evaluate usefulness of things that don't exist so no strong opinion about it. A subjective argument is that learning one pattern for interface a { [x: string]: string } and enum b { [x: string]: string} adds up to perceived simplicity across the language. Initially didn't like the { [x: a]: string } syntax but once I adopted it, it fits naturally object looking declarations. It's not like you declare enums every day so a few more characters for expressiveness wouldn't seem to hurt.

:+1:  for string (const) enums

My current workaround looks something like this (this is a real-world, copy-and-paste code example):
class Task {
  ..
  static State = {
    Unstarted: "Unstarted",
    Started: "Started",
    Completed: "Completed",
    Faulted: "Faulted",
    Canceled: "Canceled"
  }
}

let task = new Task();
..
if (task.state === Task.State.Completed)
  console.log("Done!");

This also gives a nice encapsulation into the class type that I find appealing (through the static modifier).
Replicating this through enum would require several different enhancements. I will consider posting a separate proposal for class encapsulated enums if that hasn't been proposed before.
I think having string enums would be very useful (maybe "necessary" should be the right word here). Automatic inferring of things like letters would be problematic because of locale and language issues (every language would have its own letters and ordering). Automatic lowercasing/uppercasing would also be impacted from similar issues (every language has different lower/uppercasing rules), and seems to me like a minor detail/enhancement at this point.

Maybe the string keyword would lend itself to be included in the declaration:
string enum PromiseState {
    Pending,
    Fulfilled,
    Rejected
}

In the above example, the string values of the cases would equal their names. They could be overwritten like this:
string enum PromiseState {
    Pending = "pending",
    Fulfilled = "fulfilled",
    Rejected = "rejected"
}

This may turn out a bit long for a const enum that is also exported:
export const string enum PromiseState {
    Pending,
    Fulfilled,
    Rejected
}

So maybe an alternative using some sort of a psuedo-generic type parameter?
export const enum PromiseState<string> {
    Pending,
    Fulfilled,
    Rejected
}

Due to issues with different languages, alphabets, and locales it would be difficult to apply a correct conversion to lowercase/uppercase in many languages other than English. So just preserving the plain casing and allowing custom ones through = seems like a reasonable compromise.

@rotemdan Do you have a test case in mind?
Works fine:

Emit is:
var bar;
(function (bar) {
    bar["ÉLÉGANT"] = "élégant";
    bar["ΚΟΜΨΌ"] = ""κομψό"";
    bar["NO ISSUE"] = ""no issue"";
})(bar || (bar = {}));

There is some usefulness with auto lowercasing enums if you to do case insentive searches in a database for example. Arguably, I think it's a better default. Programmatically some coding conventions say that:
module myPhilosophy {
   export enum {
     CamelCaseA,
     CamelCaseB
   }
}

is "better". Don't want to get into that... but you get the idea.

Hi, what is the actual state of this proposal? can we have a roadmap to know when will be implemented in the language? Thanks

@Gambero81 See #1206 for a more up-to-date version of this.

Can this be closed?

@impinball No, added this here strictly for discussing a string enum & use cases.
e.g. can you interest two string enums?
enum a {
   hello = "hello"
}
enum b {
    world = "world"
}
let c = a & b;
let d = typeof a & typeof b;

Union and intersection types would already exist with my proposal. You
could achieve the same thing.
On Sun, Sep 20, 2015, 09:17 Jon<EMAIL_ADDRESS>wrote:

@impinball https://github.com/impinball No, added this here strictly
for discussing a string enum & use cases.
e.g. can you interest two string enums?
enum a {
hello = "hello"
}
enum b {
world = "world"
}
let c = a & b;
let d = typeof a & typeof b;
—
Reply to this email directly or view it on GitHub
https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-141784947
.

Using of String are really neat feature. In our 20k loc project we still use workarounds.
Apart, using objects as enum values (like in #1206 or http://stackoverflow.com/a/15491832/1224258) are risky - comparison fails after any Enums serialization/de-serialization or deepcopy (angular.copy).

Probably better if https://github.com/Microsoft/TypeScript/issues/1003 is done instead

@basarat I think both have their uses. A primitive enum (excluding symbols) could be seen as the union of their values in that sense. And also, I believe that should be expanded to also include numbers.

I made a relevant response over there on #1003.

@basarat The two are related:
const enum listDrinks {
    Coffee = "coffee",
    Tea
}
let drink: listDrinks; // Can have values "coffee" | "tea"
drink = linkDrinks.Coffee;
drink = "beer"; // error
let drinkType: "coffee" | "tea" = "tea";
drinkType = "beer"; // error

With enough effort 'Flag me down' #4 can be solved:
http://www.informit.com/articles/article.aspx?p=2425867
Oh and const enums can't have null or undefined values, so hmm... food for thought.

@jbondc I tried to include those, but I didn't get a very positive response from it.

@impinball Meant more:
const enum numbers {
   a = null, // error
   b = undefined, // error
   one = 1,
}

Seems clear this should error (the same for string enums), effectively these are non-nullable types.
function foo (): numbers  {
   return null;
}

@basarat Thanks, I've just discovered related #1003, #1295. Great proposals/ideas!
My understanding #1003 (string literal union type) vs #3192 (string enums) are following:

String enums are simple, straightforward approch
#1003 - are more wider idea, which are may be both: multi-purpose (like for type guards) sulution and space for funky/unwanted/corner cases
Syntax are RADICALLY different (which not obvious on first site):

    var var1 = MyEnum.Kind1;
    var var2 = "kind1";

Readability: IMHO, String enums have better readability. Moreover, in many languages enum types make uppercased to highlight limited possibilities and static nature.
IDE support. Tools are all for us! Possible, implementing auto-complete for #1003 (string literal union type) may be significantly harder inside IDEs comparing to  #3192 (string enums). Not because of complexity of union-type concept, also because IDE should introduce in-natural auto-complete inside string literals: "kind1" (should suggest kind2,kind3.. if this is union type).

Apart, from all above, Javascript ecosystem generally encourage wide usage of string literals. As result, like in #1003, #1295 IDEs/Tools will be forced to support special meaning of string literals, like as enum constants/properties names etc, not just meaningless text to output.

:+1: This feature would be great.
Right now, the enums are a bit counter intuitive from a JavaScript usage perspective. They work well for internal TypeScript code but not so much when code is used in third party apps.
It would be especially useful for bridging the gap between both worlds:
Example:
sdk.ts
--------

export enum Environments {
  SANDBOX,
  PRODUCTION
}

interface ClientOptions {
  id: string;
  secret: string;
  env?: Environments;
}

export class Client {
  constructor(public options: ClientOptions) {}

  hostname(): string {
    let part = 'sandbox';

    if (this.env === Environments.PRODUCTION) {
      part = 'api';
    }

    return `rest.${part}.example.com`;
  }
}

caller.js
----------

var client = new Client({
  id: 'id',
  secret: 'secret',
  env: 'production'
});

Right now, client.hostname() will fail because Environments.PRODUCTION === 1.

:+1:

My two cents while this gets approved:
Not that you can pretend this feature like this.
    export enum OrderType {
        Ascending = "Ascending" as any,
        Descending = "Descending" as any,
    }

The benefit is that then your API is better documented, asking for an OrderType instead of a dirty string.
The problem is that you need to repeat the identifier for the common case when declaring.
Also, when using it, you have to cast from string -> any -> OrdeType:
var orderType: OrderType = "Ascending"; //Error
var orderType: OrderType = "Ascending" as any; //OK

Here's a way you'll be able to emulate string enums in typescript@next. Taking a modified version of Esprima's Syntax object:
function strEnumify<T extends { [prop: string]: "" | string }>(obj: T) {
    return obj;
}

export const Syntax = strEnumify({
    AssignmentExpression: 'AssignmentExpression',
    AssignmentPattern: 'AssignmentPattern',
    ArrayExpression: 'ArrayExpression',
    ArrayPattern: 'ArrayPattern',
    ArrowFunctionExpression: 'ArrowFunctionExpression',
    BlockStatement: 'BlockStatement',
    BinaryExpression: 'BinaryExpression',
    BreakStatement: 'BreakStatement',
    CallExpression: 'CallExpression',
    CatchClause: 'CatchClause',
    ClassBody: 'ClassBody',
    ClassDeclaration: 'ClassDeclaration',
    ClassExpression: 'ClassExpression',
    // ...
    ThisExpression: 'ThisExpression',
    ThrowStatement: 'ThrowStatement',
    TryStatement: 'TryStatement',
    UnaryExpression: 'UnaryExpression',
    UpdateExpression: 'UpdateExpression',
    VariableDeclaration: 'VariableDeclaration',
    VariableDeclarator: 'VariableDeclarator',
    WhileStatement: 'WhileStatement',
    WithStatement: 'WithStatement',
    YieldExpression: 'YieldExpression'
});

(@ariya)
The problem is that you can't do something like the following:
let kind = Syntax.VariableDeclaration;
kind = Syntax.WithStatement;

export type ResponseType = "json" | "others";

export const responseType = {
    json: <ResponseType>"json",
    others: <ResponseType>"others",
};

Like this, you can get a type, and tips when typing from responseType.

When doing that, the json property has type "json" | "others" if that's fine with you.

@olmobrutall thanks for perfect workaround! Well serialized/deserialized, apart from unreadable numeric enums inside json.
Below working even in v1.4:
  enum OrderType { Ascending = <any>"Ascending", Descending = <any>"Descending" }

@DanielRosenwasser I would generally prefer to use const numeric enums where possible (a JS-to-ESTree AST parser couldn't for spec reasons) for that just for memory and performance reasons (both reduced for free). But I could see merit in a string enum to hold error messages like what jshint uses.

@olmobrutall @DanielRosenwasser @vitrilo there workaround are good but a good feature of string enum should be to inlining string const enum without emit js as done with standard const enum, unfortunally for this porpouse all these workaround doesn't work

@Gambero81, of course having native support from the language will be the best solution, simplifying the declaration (no repetition for the simple cases), and the usage (no casting).
About const enums, we already have the syntax and the concept for normal enums, it will make sense just to extrapolate the same concepts for string enums.
export const enum Color extends string{
   red,
   blue,
   darkViolet= "dark-violet"
}

:+1: current project: accessing REST service with generated TypeScript interfaces and enums. Enums are not usable, since service needs strings in JSON payload.
Is there a way to serialize / deserialize JSON and convert enum instances on-the-fly?

I've just found this today: https://blog.wearewizards.io/flow-and-typescript-part-2-typescript
TLDR; Typescript is better than flow but has no string enums :-1:

The only issues we have encountered so far (and would love help to resolve!) are:

webpack building the previous version: adding an empty line and saving a file re-triggers a compilation but can be frustrating
no string enums: we want to keep human readable enum members but TypeScript only supports int enums

Any news on this issue? Any change this gets implemented.

I agree.. string enum is a MUST!! (in particular const string enum)
still hope to show it soon...

I agree.. string enum is a MUST!! (in particular const string enum)
still hope to show it soon...

I agree.. string enum is a MUST!! (in particular const string enum)
still hope to show it soon...

I just read that the new TypeScript 1.8 beta has "string literal types": https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#string-literal-types
That seems to solve exactly this use case, right?
type Order = "Ascending" | "Descending";

string literal is not string enum..

Wow didn't know that. With autocompletion they can be a even better alrernative!
column.order = //autocompletion here please!
               //"Ascending"
               //"Descending"

Thanks TS Team!

@olmobrutall I have two issues created for your tracking :rose: https://github.com/Microsoft/TypeScript/issues/5602 https://github.com/Microsoft/TypeScript/issues/6705

String enums can be mimicked by merging a string literal type and module this way:
type MyStringEnum = "member1" | "member2";

module MyStringEnum {
    export const Member1: MyStringEnum = "member1";
    export const Member2: MyStringEnum = "member2";
}

Full example.
It seems it's only worth implementing enum MyStringEnum { myMember = "my member" } for syntactic sugar now.

@dsherret nice point!

@dsherret s/module/namespace/g. module in that context is deprecated, and it has been for a while. :smile:

I forgot declaration merging worked with a variable. This is better:
type MyStringEnum = "member1" | "member2";

const MyStringEnum = {
    Member1: "member1" as MyStringEnum,
    Member2: "member2" as MyStringEnum
};

Updated example.

Clever hack @dsherret but why is this not implemented yet? +1 for string enums!

@amcdnl I feel the more general #1206 is more helpful than just this.

I came up with such solution:
// Utils.ts
export function convertEnumValuesToString(obj) {
  Object.keys(obj).forEach(function (key) {
    if (isNaN(+key)) {
      Object.defineProperty(obj, key, {
        value: key,
        enumerable: true
      });
    }
  });
  return obj;
}

// actions/hello.ts
import { convertEnumValuesToString } from '../utils'

export enum actionTypes {
  GREETING,
  FAREWELL_INIT,
  FAREWELL_DONE
}

console.log(actionTypes .GREETING) // 0
convertEnumValuesToString(actionTypes); // override to same key-based string values
console.log(actionTypes .GREETING) // "GREETING"

Maybe would be helpful to someone :)

+1 would love to have this for angular2 ngrx reducer types.
i've been using this as string enums for now
export class Color {
  public static red = "red";
  public static blue = "blue";
  public static green = "green";
}

@theRemix check out this decorator I wrote -<EMAIL_ADDRESS>

@dsherret Your hack doesn't work for ambient declarations.

@zspitz just need to change the syntax accordingly:
declare type MyStringEnum = "member1" | "member2";
declare const MyStringEnum: { Member1: MyStringEnum; Member2: MyStringEnum; };

@dsherret This still won't inline the values (unlike const enum), although I'm not sure any of the workarounds on this page will allow this, or if there is any language feature that supports inlining values other than number via enums.

TS 2 allows you to refer to enums as types as well as values, e.g.
enum ColorTypes { Red, Green, Blue }
type RedColor = { type: ColorTypes.Red }
const redColor: RedColor = { type: ColorTypes.Red }

As far as I can see, none of the workarounds above will allow for this behaviour?

I think we can dupe this to #1206 since the only other type really being discussed there is string and there's some progress being made to some solution

Hi TS Team,
Seems like this is the most upvoted issue in this repository - so could we please at least get some update if this even get considered/done ? Seems like it does not even exist on the roadmap for Future https://github.com/Microsoft/TypeScript/wiki/Roadmap :(

With keyof applied to a namespace or object, you can now trivially use an object or namespace of string literals as a "string enum". Given that enums aren't on the ECMAScript proposal table, and TS has avoided adding any further non-typesystem non-ECMAScript syntax for many moons, I would not hold my breath on this. Instead, I'd write this:
function mkenum<T extends {[index: string]: U}, U>(x: T) { return x; }
const Cardinal = mkenum({
  North: 'N',
  South: 'S',
  East: 'E',
  West: 'W'
});
type Cardinal = (typeof Cardinal)[keyof typeof Cardinal];

Flexible, powerful, relatively DRY. All TS could do with further syntax is imply the type line from extra syntax in the declaration and infer literal types by default which, again, is unlikely, given how little convince it offers over what is possible now, versus the extra risk if taking on new non-ECMAScript emit.

@weswigham Thanks for this great idea - is there any way to adjust it so that it isn't using widening types ?
As soon as one does:
let test = Cardinal.North

the type of test becomes string

@wallverb Use const or add a type annotation, otherwise, no. This is simply how string literal types are flowed now (the justification being: what is the use of assigning a single unit type to a mutable variable?).

Or seems like one can do this (slightly less DRY but could prevent surprises and need to provide type annotations)
function mkenum<T extends {[index: string]: U}, U extends string>(x: T) { return x; }
const Cardinal = mkenum({
  North: 'N' as 'N',
  South: 'S' as 'S',
  East: 'E' as 'E',
  West: 'W' as 'W'
});
type Cardinal = (typeof Cardinal)[keyof typeof Cardinal];

and use it in cases like:
interface Go {
  cardinal: Cardinal
  miles: number
}
function go(where:Go){...}

const a = {
   cardinal: Cardinal.North,
   miles: 50
} // No need to annotate

go(a)  // <- otherwise we would get string not assignable to N|S|E|W due to type widening

For me that's a good enough alternative to string enums. Thanks a lot @weswigham / TS Team

You don't need the 'mkenum' function when you explicitly write the
typecasts like that. The function call only existed to make the compiler do
exactly that for you. ;)
On Sat, Nov 19, 2016, 11:25 AM wallverb<EMAIL_ADDRESS>wrote:

Or seems like one can do this (slightly less DRY but could prevent
surprises and need to provide type annotations)
function mkenum<T extends {[index: string]: U}, U extends string>(x: T) { return x; }const Cardinal = mkenum({
North: 'N' as 'N',
South: 'S' as 'S',
East: 'E' as 'E',
West: 'W' as 'W'
});type Cardinal = (typeof Cardinal)[keyof typeof Cardinal];
and use it in cases like:
interface Go {
cardinal: Cardinal
miles: number
}function go(where:Go){...}
const a = {
cardinal: Cardinal.North,
miles: 50
} // No need to annotate
go(a)  // <- otherwise we would get string not assignable to N|S|E|W due to type widening
For me that's a good enough alternative to string enums. Thanks a lot
@weswigham https://github.com/weswigham / TS Team
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-261723390,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACzAMrXKNBMUMmJKrV6H1vcAeB4lu1Tiks5q_yLggaJpZM4Eds5F
.

[…] TS has avoided adding any further non-typesystem non-ECMAScript syntax for many moons.

While that is true, the required syntax is already in place in large parts. We already have const enums. Allowing strings as values (rather than only numbers) would "only" be a relaxation of a constraint that currently exists.

@weswigham Given your example, how come the final line here fails?
function mkenum<T extends {[index: string]: U}, U extends string>(x: T) { return x; }
const Cardinal = mkenum({
  North: 'N',
  South: 'S',
  East: 'E',
  West: 'W'
});
type Cardinal = (typeof Cardinal)[keyof typeof Cardinal];
const p = Cardinal.East
const x = { y: Cardinal.East }
interface z { foo: Cardinal.East } // 'Cardinal' only refers to a type, but is being used as a value here.

Here's my workaround for string enums with type and value position support, until 2.1 lands with keyof:
// Boilerplate for string enums until 2.1 (keyof)
// String enums can be used in type and value positions.
// https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-261720275
export class ActionTypes {
	public static Foo: 'Foo' = 'Foo'
}

interface FooAction extends ReduxAction {
	type: typeof ActionTypes.Foo
}

@OliverJAsh The error in https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-262187334 is correct. You are using an "enum value" (Cardinal.East) as if it was a type. The type Cardinal is the union type of all valid const Cardinal values (in this example, 'N' | 'S' | 'E' | 'W').
If you want to define a type that has a key that can only ever have the value Cardinal.East, you're going to have to use typeof Cardinal.East; but that's probably not what you mean to do. interface z { foo: Cardinal } should work and allow any of the Cardinal values.

@weswigham just a note about the mkenum example from https://github.com/Microsoft/TypeScript/issues/3192#issuecomment-261720275 : the inferred type here will be string, that's a different behaviour from using an standard numeric enum:
enum NumericEnum {
    A = 1
}

let a = NumericEnum.A              // a inferred type will be NumericEnum, good
let b = Cardinal.North             // b inferred type will be string, bad, is too generic, so ...
let c : Cardinal = Cardinal.North  // to have an useful type we must explicitely type c

Here is a mkenum version were you don't need to specify the strings twice (merged with the previous mkenum example):
// original version:
function mkenum<T extends {[index: string]: U}, U extends string>(x: T) { return x; }
// new:
function mkenum2<X extends {[i:string] : any}, K extends string>(x : X )
  : {[K in (keyof X) ] : K}  {
    let o : any = {}
    for(let k in x)
        o[k] = k;
    return o
}

// to define the type in a more succint way, for both versions:
export type enumType<T> = T[keyof T]

// define enums using the original and the new version:

const Colors  = mkenum({"Red"   : "Red",
                        "Green" : "Green"});
type  Colors  = enumType<typeof Colors>

const Colors2 = mkenum2({"Red"   : 1,
                         "Green" : 1});  // strings specified once, not twice
type  Colors2 = enumType<typeof Colors2>

let a  = Colors.Red       // string
let a2 = Colors2.Red      // "Red"

let b  : Colors  = Colors.Red       // "Red" | "Green"
let b2 : Colors2 = Colors2.Red      // "Red" | "Green"

There is a little difference, the Colors constant is { Red : "Red", Green : "Green"} but the Colors2 constant is generated as { "Red" : "Red", "Green" : "Green"}.
Questions:

What's generally better, the type inferred for a (string) or the one inferred for a2 (the "Red" literal)?
If the one inferred for a is better, how do you change mkenum2 to generate a constant exactly like Colors to make a2 be inferred with the same type as a?
Is possible a mkenum version that takes as parameter an array like ["Red", "Green"] ?

Now with typescript 2.1 and keyof, there is a better implementation of string enum? and what about online version for construction enum?

export type Enum = (typeof Enum)[keyof typeof Enum); works for me, even with no mkenum function

@nahuel
function mkenum3<X extends string>(...x:X[]):{[K in X]:K } {
  const o:any = {};
  for (const k in x)
    o[k] = k;
  return o;
}

type enumType<T> = T[keyof T];

const Colors3  = mkenum3('Red', 'Green');
type  Colors3  = enumType<typeof Colors3>;

@igrayson Is there any way to modify your version so it behave the same as @nahuel mkenum2 ?
let a2 = Colors2.Red // "Red"
let a3 = Colors3.Red // string -> would love to have "Red"

@igrayson Awesome solution! But I think you're loop is incorrect. It should be
function mkenum3<X extends string>(...x:X[]):{[K in X]:K } {
  const o:any = {};
  for (const k in x)
    o[x[k]] = x[k];
  return o;
}

that is, iterate over the values of the array not the keys.
When I ran your version, the types were correct, but the runtime value of Colors3 was ["0": 0, "1", 1].

I use the techniques here in several of my projects, so I turned them into an NPM module for easy access. See https://github.com/dphilipson/typescript-string-enums.
I don't mean to claim credit for this solution, and I did my best to credit the users who came up with it in the readme. Hopefully others will find this useful.

The runtypes library allows defining a runtime type for a union of literals and then extracting both the static type as well as its enumerated values. Example usage:
// Define the runtype
const Day = Union(
  Literal('Sunday'),
  Literal('Monday'),
  Literal('Tuesday'),
  Literal('Wednesday'),
  Literal('Thursday'),
  Literal('Friday'),
  Literal('Saturday'),
)

// Extract the static type
type Day = Static<typeof Day> // = 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday'

// Extract enumerated literal values
const days: Day[] = Day.alternatives.map(lit => lit.value)

for (const day of days) {
  console.log(`Good morning, it's ${day}!`)
}

With custom transformers introduced in #13940, you can create string enum from string literal types.
import { enumerate } from 'ts-transformer-enumerate';

type Colors = 'green' | 'yellow' | 'red';
const Colors = enumerate<Colors>(); // type of Colors is { [K in Colors]: K }

console.log(Colors.green); // 'green'
console.log(Colors.yellow); // 'yellow'
console.log(Colors.red); // 'red'

See https://github.com/kimamula/ts-transformer-enumerate.

Implementation now available in#15486.

Let's track this at #1206


shortcut for dat /dir

Backwards compatible with sync command.
dat-next sync . === dat-next .

In the old version it would create and sync for you when doing dat dir -- do we want to remove that capability?

In the old version it would create and sync for you if there was no previous dat when doing dat dir -- do we want to remove that capability?

Yes, I'd like to remove that. I think it hides a bit too much what is going on. It also made maintenance on the old CLI harder because of all the guesswork involved in what the user was trying to do.
I think the latter will be less of an issue with this new code base. But I'd still be wary of combining them, especially if we want to add any init questions, like npm init, to populate dat.json.
The downside is that for large dats it can take a lot longer to start sharing files. The shortcut for that would be to run dat create --no-import && dat sync. But definitely wouldn't be obvious to do that.

@karissa shipped the basic shortcut in PR #58 but let me know if you think we should also add the create step.


Add js-generator tests

Would love to help :)

@sebmck I'm quite confused about which package is this related, is the js-ast one? 🤔

The package is named js-generator


Add more bob's mods.

You can add other fashion-related modes bobs?
bobsflowcontrol
bobmods_gfxtweak
bob_presets
CMHMod

Of course, I will add them asap. :)

I added bobsflowcontrol, bobsmods_gfxtweak and both CMHMods, but I can't find bob_presets at the modportal. Could you provide a link? :)

mod portal

Thanks. Added.


Raspberry PI Real time kernel

I see that there is nothing updated for raspberry pi real time kernel, so I was wondering when will it be updated, or if possible you you suggest some links to keep a real time kernel

Hi @chandravaran
You can build a real-time kernel for the Raspberry-PI using this guide here: https://real-time-working-group.readthedocs.io/en/latest/Guides/Real-Time-Operating-System-Setup/Real-Time-Linux/build_rt_kernel_using_docker.html
We wanted to create a ready-to-use real-time RPI image but it's too large to host it in Github. We will probably upload the .debs  mentioned in the guide so you can simply download and install them using dpkg.
Your feedback is very useful, if you think having an RPI image would be helpful we can find a way to host them.
cc @LanderU @razr

This is done now as part of https://github.com/ros-realtime/ros-realtime-rpi4-image. We will update the documentation once we create a release.


Remove use of distutils from setup.py

distutils is depracated and will be removed in Python 3.12 PEP 632, we should get rid of it.

After PR #3585, remaining distutils usage will be:

from distutils.command.clean import clean: Inherited to remove .c, .cpp files generated by Cython
from distutils.command.build import build: Inherited to pass options for force_cython and use_openmp. Those options are used by build_ext and not build, so they could be moved to build_ext instead (which comes from setuptools) and/or provided as environment variable (I'm no fan of env. var. but passing options through pip's --global-option is cumbersome).


Make Hug API with base url path other than root '/'

Hi!
My second issue of the day. Either I'm missing something, or this has not been implemented yet. I'd like to have the Hug API work relatively from a certain base path (default to root '/'), but am again having a hard time figuring it out. There doesn't seem to be any support for it, as far as I can tell?
Say I have the following API function
@hug.get('/stuff')
def stuff():
    return {"hello":"world"}

and run the hug server on localhost 8000, I'd be able to use the following curl command:
curl http://localhost:8000/stuff/

to perform a GET request on the API function I just defined.
if I add versioning, it becomes
@hug.get('/stuff',versions=1)
def stuff():
    return {"hello":"world"}

and now I have to point curl to
curl http://localhost:8000/v1/stuff/

However, this doesn't really play nicely when I want to run my hug API as part of a bigger webserver, such as in my previous question #209.
For example, if I want to use a base_path '/api', so that (in my case) tornado can re-direct all http requests that start with '/api' in the url path to the hug WSGI application, I can add '/api' to every path in the decorators, like so:
@hug.get('/api/stuff')
def stuff():
    return {"hello":"world"}

which I'd be able to reach with curl on
curl http://localhost:8000/api/stuff/

BUT, this stops working when I introduce versioning
@hug.get('/api/stuff',versions=1)
def stuff():
    return {"hello":"world"}

which I'd be able to reach with curl on
curl http://localhost:8000/v1/api/stuff/

breaking the pattern rule I had set-up for Tornado.
Is there anyway to get this working?
Thanks a lot!
Best,
Erwin

Hi @ErwinHaasnoot,
The easiest way to solve your issue short-term is to the 'X-API-VERSION' to request different versions instead of the '/v1' url prefix.
Unfortunately, hug does assume that it's running on the root path currently. I would be very happy to see the ability to set the root path on the API object to enable this, and would very quickly accept a pull request that adds that feature. Either way, I'll make sure it gets into the hug 2.0.0 release slated for March 1st.
Thanks!
~Timothy Crosley

Hi @timothycrosley,
Thanks for all your work, I love the experience of developing a hug API so far. I'll try and see if I can implement the feature myself and submit a pull request, but I'm not sure if I'll have time.
Luckily the API I'm working on is not yet slated for public release, so right now it does not need versioning information, but it will be good to implement asap.
Best,
Erwin

If you use nGinx in front of the API, just add a location rule with a rewrite, for example:
location /api {
        rewrite ^/api/?(.*)$ /$1 break;
        #forward to HUG API
        uwsgi_pass unix:///tmp/api.uwsgi.sock;
        include uwsgi_params;

    }

Then Hug doesn't need to care about the root prefix, and the versioning etc all works as normal.

As mentioned in #495, this is now possible in Hug 2.0
hug.API(__name__).http.base_url = '/subdir'
Make sure you do this OR the nginx rewrite (not both!)


[APMAPM-474] Adding tracerConfig support for dd_trace_agent_url

Motivation
The parametric app for Java currently does not support the key dd_trace_agent_url as a key in the return value for the endpoint /trace/config/. This is a key that is necessary in order to properly test the DD_TRACE_AGENT_URL configuration as part of the configuration consistency effort.

Changes
Added support for dd_trace_agent_url by using the Config::getAgentUrl method and returning it as part of the response to the client-side.
APMAPI-474

Workflow

⚠ Create your PR as draft ⚠
Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
Mark it as ready for review

Test logic is modified? -> Get a review from RFC owner. We're working on refining the codeowners file quickly.
Framework is modified, or non obvious usage of it -> get a review from R&P team

:rocket: Once your PR is reviewed, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist

[ ] If PR title starts with [<language>], double-check that only <language> is impacted by the change
[ ] No system-tests internal is modified. Otherwise, I have the approval from R&P team
[ ] CI is green, or failing jobs are not related to this change (and you are 100% sure about this statement)
[ ] A docker base image is modified?

[ ] the relevant build-XXX-image label is present

[ ] A scenario is added (or removed)?

[ ] Get a review from R&P team

/merge

@mhlidd we're not using the merge queue, you can safely hit the squash and merge button 😃


mmdet=2.14 version is not matching with mmdet3d==0.18.1

According to https://github.com/open-mmlab/mmdetection3d/blob/v0.18.1/docs/en/getting_started.md ,the environment you gave can't built correctly. Hopping for you to provide a new environment version about mmdet?

You can try the mmdet3d==0.15.0.


Some pages flagging as Dangerous on Chrome

Bug Report
What is the issue?
When going on some pages they show up as dangerous
What steps are required to reproduce the issue?
Go to any of the pages replicating the nhs website :

https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-healthaz
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-mentalhealth
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-livewell
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-socialcare
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-pregnancy
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-nhs-services
https://nhsuk-prototype-kit.azurewebsites.net/templates/nhsuk-coronavirus-hub

It is possible to bypass them (for now) by clicking the link in show details but still not great.

What was the environment where this issue occurred?

Device: Macbook
Operating System: Mac Sequoia
Browser: Google Chrome

Is there anything else you think would be useful in recreating the issue?
GOV.UK had some issues with login prototype pages in the past, particularly with Chrome

err ... won't this just be a problem for anyone doing prototype testing on heroku domains (unless it gets set up with custom prototype domains like HMRC did for a while?) with one login it was so bad that we had to skip pages for a while

Possibly!? As I understand it, the warning in Chrome is based entirely on unknowable heuristics, so is hard to predict!  Possibly prototypes behind a password might be safer (although I think the heuristics run client-side so perhaps not?).
The pages linked to above likely trigger the warning as they're deliberately exact copies of pages on the NHS website. You can report it as a false-positive but not sure how quickly that updates...
Perhaps sticking a 'this is an example page' banner at the top would help?

@vickytnz this seems to have resolved itself somehow - the links no longer flag as dangerous for me in Chrome or Safari, even on the Azure URLs.
In any case, the new nhs.uk should fix it. But we can re-open this again in future if it recurs.


README.md errors [2024/03/26]

Description
README.md contains several issues which need to be addressed before next merge.
Severity

Low (Slightly annoying)

Version
4694e76
Expected Correction
Line 3
Remove the "by a COMPANY" which is useless.
Current:
SportShield is a security system developed by a COMPANY to protect individual users' valuable equipment, initially targeting skis and snowboards. The system integrates cutting-edge technology to provide robust physical security, including a multi-layered cable and electromagnetic lock mechanism.
Expected:
SportShield is a security system developed to protect individual users' valuable equipment, initially targeting skis and snowboards. The system integrates cutting-edge technology to provide robust physical security, including a multi-layered cable and electromagnetic lock mechanism.
Line 33
Vivien's last name is not included.
Current:
| ![Vivien Bistrel](https://ca.slack-edge.com/T06NTMGDGGM-U06NQ0DURCN-g034e0d2085c-192) | BISTREL Vivien | Project Manager | [GitHub](https://github.com/Bistrel2002) \| [LinkedIn](https://www.linkedin.com/in/bistrel-tsangue-603635261/) |
Expected:
| ![Vivien Tsangue](https://ca.slack-edge.com/T06NTMGDGGM-U06NQ0DURCN-g034e0d2085c-192) | TSANGUE Vivien | Project Manager | [GitHub](https://github.com/Bistrel2002) \| [LinkedIn](https://www.linkedin.com/in/bistrel-tsangue-603635261/) |
Other Details
/

This issue was addressed in c676eb4


Stemcell: Increase root_maxkeys and maxkeys

In the current 3262.2 stemcell, root_maxkeys and maxkeys are set to 500 (you can see the values in /proc/sys/kernel/keys/root_maxkeys). This number is fairly low if you want to use stemcell as base for concourse worker, which can launch a lot of containers. Most of them are quite small, short lived or could be even no-op (just started and then shut down), but there's a lot of them. The low root_maxkeys combined with large number of containers then hits this docker issue: https://github.com/docker/docker/issues/22865
Which interferes with concourse worker functionality (as it is unable to import containers for tasks).
I am not 100% sure what the good value is. In the docker issue thread they suggest numbers as high as 1 million. I'd say that for now 10K would seem OK...

Story: https://www.pivotaltracker.com/story/show/127320133

Committed to develop via 3e7d904b7b478c5d1762d2faf372e96ecec2167a

Indeed this is now present in the recent stemcells.


Emit events on alarm snooze/dismiss and new app

This adds events to alarm dismiss and snooze for other apps to use
It also includes a standalone app that uses this for quiet mode disabling after alarm dismiss, as an alternative way of doing #2429
This should be a cleaner way, that doesn't bloat the menus for alarm editing
For now alarmqm runs for all alarms, but maybe in the future there could be a configurable time range, and it will run only for alarms in that range

Thanks! This looks great! Sorry for not replying properly in https://github.com/espruino/BangleApps/pull/2429 but things have been manic this month - I've got a bunch of people chasing me for different things


Karma tests issue

Feature Description
Hello.
I have the following karma configuration in karma.conf.js:
module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      clearContext: false,
      jasmine: {
        random: false
      }
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, '../coverage'),
      reports: ['html', 'lcovonly'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false,
    failOnEmptyTestSuite: false
  });
};

In angular.json:
...
"test": {
          "builder": "ngx-pug-builders:karma",
          "options": {
            "main": "src/main/angular/src/test.ts",
            "polyfills": "src/main/angular/src/polyfills.ts",
            "tsConfig": "src/main/angular/src/tsconfig.spec.json",
            "karmaConfig": "src/main/angular/src/karma.conf.js",
            "styles": [
              "src/main/angular/src/styles.styl"
            ],
            "scripts": [
              "node_modules/perfect-scrollbar/dist/perfect-scrollbar.js",
<EMAIL_ADDRESS>            ],
            "assets": [
              "src/main/angular/src/favicon.ico",
              "src/main/angular/src/assets"
            ],
            "fileReplacements": [
              {
                "replace": "src/main/angular/src/environments/environment.ts",
                "with": "src/main/angular/src/environments/environment.test.ts"
              }
            ]
          }
        }
...

Tests not working and print the following errors:
Error: Errors during JIT compilation of template for FinancialServicesComponent: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
	ag-grid-angular.ag-theme-balham(appAgGrid, [gridOptions]="gridOptions", [columnDefs]="columnDefs")
	[ERROR ->]"): ng:///FinancialServicesComponent/template.html@22:0, Invalid ICU message. Missing '}'. (" type of documentTypes")
	        i.mr-3.fas.fa-business-time([ngClass]="type.color")
	        span [ERROR ->]{{type.name}}

	app-ag-grid-filters([gridOptions]="gridOptions")
	"): ng:///FinancialServicesComponent/template.html@18:13
	Error: Errors during JIT compilation of template for FinancialServicesComponent: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
	ag-grid-angular.ag-theme-balham(appAgGrid, [gridOptions]="gridOptions", [columnDefs]="columnDefs")
	[ERROR ->]"): ng:///FinancialServicesComponent/template.html@22:0, Invalid ICU message. Missing '}'. (" type of documentTypes")
	        i.mr-3.fas.fa-business-time([ngClass]="type.color")
	        span [ERROR ->]{{type.name}}

	app-ag-grid-filters([gridOptions]="gridOptions")
	"): ng:///FinancialServicesComponent/template.html@18:13
	    at parseJitTemplate (node_modules/@angular/compiler/fesm2015/compiler.js:22746:1)
	    at CompilerFacadeImpl.compileComponent (node_modules/@angular/compiler/fesm2015/compiler.js:22555:43)
	    at Function.get (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:27408:1)
	    at getComponentDef (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:1120:1)
	    at node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:27206:1
	    at Array.forEach (<anonymous>)
	    at setScopeOnDeclaredComponents (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:27202:1)
	    at flushModuleScopingQueueAsMuchAsPossible (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:26887:1)
	    at TestBedRender3.checkGlobalCompilationFinished (node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1815:53)
	    at TestBedRender3.resetTestingModule (node_modules/@angular/core/__ivy_ngcc__/fesm2015/testing.js:1665:1)

It's looks like that pug templates not compiling to the html code. But in development and production everything works ok. Thank you!
ngx-pug-builders version: 12.0.0
Angular version: 12
Use Case
No response

Hi @AlexeyPotopakhin,
I've tried to reproduce that, but looks it is working just fine on my side:
ngx-pug-builders version: 12.0.0
Angular version: 12.2.16
Could you upload minimal reproduction to Github or StackBlitz, please?

Hi @lekhmanrus, thank you for attention! I've created fresh project from the Angular CLI and added ngx-pug-builders as dependency and builder in angular.json. Also I've created two components with html and pug templates for demonstration. Tests with html component are passing successfully, but test should render title with pug template fails.
https://github.com/AlexeyPotopakhin/ngx-pug-builders-karma-issue

Thanks @AlexeyPotopakhin! I was able to reproduce the issue. I'll try to allocate some time for this issue this weekend.

Hello,
I have the same problem and I think that the JIT compilation just doesn't work yet with this project, my pug files are all generating errors while using JIT but never while using AOT.
The problem is that ng test is only using JIT from what I know

I've found one ugly solution, but it works. I use gulp task to copy all project files to temporary directory and compile pug code to html in all pug files before testing. Copy operation is too long (~2 mins for my project, cause of heavy node_modules directory).
gulpfile.js
const {src, dest, series} = require('gulp');
const rename = require("gulp-rename");
const pug = require('gulp-pug');

function pug2html () {
    return src('./src/**/*.pug')
        .pipe(pug({ doctype: 'html' }))
        .pipe(rename({ extname: '.pug' }))
        .pipe(dest('.dist/src'));
}

function copyProject () {
    return src('**/*')
        .pipe(dest('./dist'));
}

exports.test = series(copyProject, pug2html);

And in package.json:
"test": "gulp test && cd dist && npm i && ng test --karma-config karma.conf.js"
I gas it's possible to avoid copy operation and compile it directly in your project and then revert compiled html code in git :). Maybe it can help someone as temporary solution.

Looks like the issue is fixed for Angular CLI >= 13.1.0-rc.0 ("@angular-devkit/build-angular": "13.1.0-rc.0").


Duration.get is inconsistent with asMonth or asMillisecond

Describe the bug
moment.duration('P31D').asMilliseconds() ===<PHONE_NUMBER>;
moment.duration('P1M').asMilliseconds() ===<PHONE_NUMBER>;
moment.duration('P30D').asMilliseconds() ===<PHONE_NUMBER>;

so 'P1M' === 'P30D' as Milliseconds, but...
moment.duration('P31D').get('month') === 1
moment.duration('P30D').get('month') === 0
moment.duration('P1M').get('month') === 1

To Reproduce
Steps to reproduce the behavior:
https://stackblitz.com/edit/moment-error
Expected behavior
I expect more consistency between Milliseconds, get and asMonth
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):

All browsers

Please run the following code in your environment and include the output:
console.log((new Date()).toString())
console.log((new Date()).toLocaleString())
console.log((new Date()).getTimezoneOffset())
console.log(navigator.userAgent)
console.log(moment.version)

Output:
Mon Dec 16 2019 12:07:00 GMT+0100 (Central European Standard Time)
preview-7288e15037d0fae56bd6b.js:1 16/12/2019, 12:07:00
preview-7288e15037d0fae56bd6b.js:1 -60
preview-7288e15037d0fae56bd6b.js:1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
preview-7288e15037d0fae56bd6b.js:1 2.24.0

I dug into this a little more, using duration.as(), and it seems like, while using 'P1M' for duration, gives us exactly 30 days, Moment's internal definition of a month is not an integer number of days, but instead a float value somewhere between 30 and 31. (I'm guessing is the value is 365/12 = 30.41666666666....)
These are the results I got.
moment.duration('PT744H').as('month') === 1.0185014065997249
moment.duration('P31D').as('month') === 1.0185014065997249
moment.duration('P30D').as('month') === 0.9856465225158627

And further inconsistencies, P1M registers as both 30 days and as one month, while 30 days registers as 0.98564.... months.
moment.duration('P1M').as('month') === 1
moment.duration('P1M').as('days') === 30


Please make the first day of week customizable.

Thanks for the work you've done to bring this plugin to life!
I prefer my calendar starting on Monday, so it would be great if you could expose that as a configurable setting.
It would be the :firstDayOfWeek="2" prop in App.vue

Is it possible to respect the :start-of-week setting that already exists in Logseq?

I also like to change to Monday as start of week. Respecting :start-of-week would be very nice.
But I accidentally found out that there are separate settings for the plugin. Go to your plugins in Logseq and you will find a little wheel icon on the left down corner of "Journal calendar". There you can change firstDayOfWeek. Please note: :start-of-week -> 0 to 6; firstDayOfWeek -> 1 - 7

Hi,
the first day of the week is configurable.

Would this qualify for closing/done this issue?
Best Regards,
Oliver


Download code is incomplete

The downloaded code is incomplete and cannot be compiled (it is missing at least the "main"-method). Therefore, this approach cannot be used as the base for a custom bot.

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

ID: baa9e2e6-b901-9e27-d070-701922396a4c
Version Independent ID: c29a68b2-886d-2cec-0ce7-c49c586d7ea8
Content: Create a bot with Bot Service - Bot Service
Content Source: articles/bot-service-quickstart.md
Service: bot-service
Sub-service: abs
GitHub Login: @v-ducvo
Microsoft Alias: v-ducvo

Can you give more information? It looks like you were creating a bot in the Azure portal then downloading it... in what language? When you tried to run it, what happened? This runs on a framework so you won't see a "main" method per se.

Basically, I followed the steps outlined in the Download Code link:

I created a QnA Bot in C#
In Azure I clicked on the "Build" button in the "Web App Bot" resource
There I clicked on "Download Bot Source Code". It asked me, if I want to include the secrets which I confirmed.
I extracted the ZIP file locally, opened it in Visual Studio 2019 and clicked "Run". Visual Studio tried to compile the code but was unable to, because the main method was missing.
After I analyzed it and compared it with the samples for the BotBuilder there seem to be additional files missing.

When I follow the link to create a web app bot, I don't see the option to create a QnA bot - instead it links me off the docs page about QnA. I'm seeing that it will either create a Basic bot (a core bot with dialogs and LUIS) or an Echo bot - both of which won't match the QnA sample in the BotBuilder repo.
All of that is an aside, as the bot should work when you download it, regardless of if you chose the Echo or Basic bot. Have you verified you have the necessary prerequisite .NET libraries are installed to run locally? I'll give these steps a shot myself here shortly and see what happens for me.

The Bot has been created through the QnA Maker Web Service. After I published a Knowledge Base, there is an option to create a Bot. This option creates the Bot in Azure which is a normal "Web App Bot" - the only difference seems to be that the template cannot be selected and that the API Key of the associated QnA Web Service has to be included.

Is this a Bot Framework SDK v3 bot?

This is a bug. It's been reported to the QnA team. Thanks!

@Kaiqb Thank you :)


update typo

Just updated a typo from the docker image section

Just updated a typo from the docker image section
Signed-off-by: Nikhileshwar<EMAIL_ADDRESS>

Just updated a typo from the docker image section
Signed-off-by: Nikhileshwar<EMAIL_ADDRESS>


Add column to user table

Add user_research_preference column to users table

Not sure about the name of this. user_research_preference as True doesn't really make instant sense to me. Could it be clearer as something like user_researched_opted_in (which I think is what it's trying to say)?

lgtm in terms of code however sam does have a point about the variable name.

Changed the variable name. I think this is ready to go now.


tagging versions in github

this is a request, and not an issue.
Is it possible to tag pip versions in github, like what was done in v1? I'm trying out ipdb like
b fastai2/learner.py:468

and since what is in pip might not be what is in sync with github:master, finding the right line number can be a bit tedious. I'm glad to help out with this as well.
fastai v1 screenshot.

We are still in a development stage, we'll do this once we move fastai2 to the main repo, but not before.


TextureViewer displays mips of BC1 texture as black if not divisible by 4

Description

Steps to reproduce
See the attached DDS file. This is a BC1 compressed texture filled with a constant color through all mip levels. It's easily verifiable in a hex editor that the entire file is filled with the same pattern tightly packed.
mips.zip
Opening this file directly in the texture viewer shows the top level correctly as yellow, but of the lower mips, only the ones with a resolution divisible by 4 are displayed correctly, while all others are shown as completely black.
As required by the D3D11 spec the highest mip level of the texture is divisible by 4 (although this is a runtime restriction, rather than a necessity of the BC1 format), but the same requirement does not apply to lower mips, which are to be treated as virtually padded, with the additional pixels at the border to be discarded after decoding.
Curiously, the texture is displayed correctly when we inspect it in a RenderDoc capture of our D3D12 application using it. The bug occurs only when loading the texture directly outside of a capture.

Environment

RenderDoc version: 1.7
Operating System: Windows 10
Graphics API: N/A

We have reproduced this in our team across multiple versions of Windows 10 as well as both NVidia and AMD.

The culprit is probably renderdoc\common\dds_readwrite.cpp:1134. The number of rows needs to be calculated as RDCMAX(1U, (numRows + 3) / 4) instead of  RDCMAX(1U, numRows / 4);.

Yes I've already fixed it locally. There are some other issues I'm tidying up while in the same place.

That commit should fix it. I'm looking at how to support opening DDS files that don't have a multiple-of-4 dimension on the top mip, since as you say it's only a D3D requirement and the file is still well-formed. I played around with padding up the texture dimension and just accepting that you'd see a border, but that breaks down in some cases where the real dimension drops down to a multiple of the block size in lower mips but the padded dimension doesn't.
An easier solution would be to just use OpenGL or Vulkan instead for displaying the textures where there's no such requirement, but that would also mean that using D3D11 as a local proxy for a remote capture in GL/Vulkan with such a texture wouldn't be able to display it, so I'd like to find a way to support it properly.

Interesting anecdote: While we investigated the issue, it would show up the exact same way in 1) our engine 2) RenderDoc and 3) Photoshop. And of course on multiple vendor GPUs. So we assumed it might be a bug in D3D. Turns out, it's just the same kind of bug in three different applications :D

Yes I created a texture myself with similarly odd dimensions to make sure that the data wasn't corrupted by a mistaken pitch somewhere (which was the case actually, the fixed-colour was hiding that), and I ended up going through a bunch of applications that either broke similarly or completely refused to open the file.
I guess people really don't commonly use unaligned sizes of textures with block compression :).


Unexpected high tail latency of async snapshot

Bug Report
Under sysbench read_only workload, found some high tail latency of async snapshot:

While the latency of raftstore is very low and some transfer-leaders were scheduled, so they were potentially related to this phenomenon:

@5kbpers Any update?


Enhance swipe of reset button

The swipe to reset button has problems with swipe when tabbing while swiping.
Implement swipe like on coins

Perhaps just use a normal button (with sth like a long press to accept gesture or a confirmation popup)


Fix get codec

Simple fix for #78.
Also removed a minor spam output from running tests.
TODO:

[ ] Unit tests and/or doctests in docstrings
[ ] tox -e py36 passes locally
[ ] tox -e py27 passes locally
[ ] Docstrings and API docs for any new/modified user-facing classes and functions
[ ] Changes documented in docs/release.rst
[ ] tox -e docs passes locally
[ ] AppVeyor and Travis CI passes
[ ] Test coverage to 100% (Coveralls passes)

Thanks @jeromekelleher. I've some other stuff to get done today but will follow this and #77 up first thing next week.

Looks good, thank you.


Anoyance: ESC doesnt cancel editing in cell, rather closes ResX View

As said, when editing the contents of a cell, pressing ESC doesnt only cancel the editing but also closes (switches away) ResX. Not expected behavior.

Can't reproduce

Click on any cell, edit the cell and press ESC. Works with and without cell selection enabled. Also works when editing in the top line edit control.


Refactor TestKit from using own resource management to reuse Flux/Mono.usingWhen(…)

The TCK's TestKit.returnGeneratedValues() method is implemented to close the Connection before a Result.map(BiFunction) Publisher has terminated:
https://github.com/r2dbc/r2dbc-spi/blob/8de2fd017366254602a185987130ba8955340644/r2dbc-spi-test/src/main/java/io/r2dbc/spi/test/TestKit.java#L648
This requires the driver to cache generated values so that Row objects may be consumed after the connection is closed.
The closing of the connection in this TCK method is curious, as it seems to conflict with behavior that is specified in the javadoc of Connection:

Objects created by a connection are only valid as long as the connection remains open.

In Oracle's R2DBC implementation, we handle this by draining row data into a List that can be published after the connection is closed:
https://github.com/oracle/oracle-r2dbc/blob/527b7e181d082d9f52b4e5334d941f577c9291ef/src/main/java/oracle/r2dbc/impl/OracleResultImpl.java#L211
This implementation seems very anti-reactive (pre-active?). I think a more reactive implementation would defer fetching rows from the database until a subscriber had singled demand.
Is the closing of the Connection in retrunGeneratedValues() simply a mistake? If so, then I think it should be corrected. (I can probably implement the change and create a pull request, if that's desired)
Or, is it the intent of the TCK to verify that generated values can be consumed after a Connection is closed? If so, then I think that should be defined in the specification of R2DBC.

No, results and rows are only valid if the connection is open. The TCK makes use of concatMap that activates a Publisher only after the previous publisher has completed.

I think a more reactive implementation would defer fetching rows from the database until a subscriber had singled demand.

Sounds good.

Is the closing of the Connection in retrunGeneratedValues() simply a mistake? If so, then I think it should be corrected. (I can probably implement the change and create a pull request, if that's desired)

As mentioned above, the close Publisher should be subscribed to after the result has completed its emission. If you experience other behavior, something needs to be fixed, likely the TCK. It would probably make sense to generally refactor resource management to usingWhen methods as these are ensuring resource disposal upon failure and cancellation.

It is true that the close Publisher is subscribed to after the Statement.execute() Publisher emits a Result, and so we can guarantee that the Result is emitted downstream before the connection is closed. But I don't think this can guarantee that the Rows of the Result have been mapped before the connection is closed.
The ordering between mapping Rows and closing the connection will depend on which thread invokes the Row mapping function. If the Row is mapped on the same thread that invokes onNext(Result), then the following sequence is executed on a single thread and we get the correct order:

onNext(Result)
Result.map(BiFunction)
BiFunction.apply(Row, RowMetadata) outputs T
onNext(T)
... Returning up the stack ...
Subscribe to close()

With Oracle's implementation of the row publisher, we have the row mapping function executed on a different thread, so when onNext(Result) has returned there is no guarantee that the Row has been emitted and mapped.
Unless there is a requirement about which thread executes the mapping function, I think the concatMap operator should be sequenced after the map(BiFunction) Publisher terminates, not after the execute() Publisher terminates.

Threading should not impact the ordering of the sequence. We rather rely on signal ordering that isn't tied to thread switches.

But I don't think this can guarantee that the Rows of the Result have been mapped before the connection is closed.

Row and Result aren't something to be carried around really. The intention is to consume both within the stream that returns the result. Row is even specified as:
A row is invalidated after consumption in the {@link Result#map(BiFunction) mapping function}.

https://github.com/r2dbc/r2dbc-spi/blob/a86562421a312df2d8a3ae187553bf6c2b291aad/r2dbc-spi/src/main/java/io/r2dbc/spi/Row.java#L37
I also think that we should refactor the TCK to improve at least readability and robustness. With switching to Flux/Mono.usingWhen for connection management, the other things will also fall into place.

I changed the title to reflect what this is about.

Thanks for looking into this, mp911de.
I think usingWhen operators are great for the R2DBC use case where we need to close Connection objects. For JDBC, the try-with-resources expression made it a lot harder to leak java.sql.Connections, and I think usingWhen can do the same for R2DBC.
So if we refactor the returnGeneratedValues() method, we can write something like this:

  @Test
  default void returnGeneratedValues() {

    getJdbcOperations().execute(expand(TestStatement.DROP_TABLE));
    getJdbcOperations().execute(getCreateTableWithAutogeneratedKey());

    Flux.usingWhen(
      getConnectionFactory().create(),
      connection -> {
        Statement statement = connection.createStatement(getInsertIntoWithAutogeneratedKey());

        statement.returnGeneratedValues();

        return Flux.from(statement
          .execute())
          .flatMap(it -> it.map((row, rowMetadata) -> row.get(0)));
      },
      Connection::close)
      .as(StepVerifier::create)
      .expectNextCount(1)
      .verifyComplete();
  }

We get a nice scope in the connection -> { ... } lambda, which I think is helpful for programmers to reason about the happens before and happens after relationship between creating and closing the Connection. The programmer can just focus on what they need to do with the Connection inside of this scope, and they don't need to worry about managing the Connection resource so much. Once the Publisher returned from this scope emits a terminal signal, it indicates that the work performed using the connection has completed, and so the close() Publisher can be created and subscribed to.
Would this make sense?

Sounds about right.

Do you have any update on whether you plan to submit a pull request?

Yes, I can take this one. I can get started today. I'll plan to refactor all tests to use usingWhen; does that sound good?

Sure. I went today through the open issues and wanted to make sure that we don't miss anything.


Jira webhook issue update error

Bug description
Issue status can't be changed with Jira webhook, because of error at line
https://github.com/DefectDojo/django-DefectDojo/blob/9d196df3f263df6796ba3c2deb42d78efb43cf37/dojo/jira_link/views.py#L80
It throws error if assignee is present, but doesn't have name key (in my case it has 'displayName' key instead).
I'm thinking about fast fix changing the check of field existence to fix to the code below, but I also would like to add check for 'displayName' existence in case name is absent. If you have good idea on how to solve that I would appreciate.
Fast fix:
assignee_name = assignee['name'] if assignee['name'] else None

Expected behavior
Status successfully changes
Deployment method (select with an X)

[X] Docker Compose
[ ] Kubernetes
[ ] GoDojo

Logs
Use docker-compose logs (or similar, depending on your deployment method) to get the logs and add the relevant sections here showing the error occurring (if applicable).
[pid: 1|app: -|req: -/-] <IP_ADDRESS> (-) {60 vars in 1218 bytes} [Tue Aug 16 12:44:56 2022] POST /jira/webhook/******0?user_id=ug%3****&user_key=ug%3A***** => generated 145 bytes in 44 msecs (HTTP/1.0 500) 6 headers in 184 bytes (1 switches on core 1)
[pid: 1|app: -|req: -/-] <IP_ADDRESS> (admin) {58 vars in 1105 bytes} [Tue Aug 16 12:44:57 2022] GET /alerts/count => generated 13 bytes in 10 msecs (HTTP/1.1 200) 6 headers in 171 bytes (1 switches on core 0)
[16/Aug/2022 12:45:03] ERROR [dojo.jira_link.views:202] 'name'
Traceback (most recent call last):
  File "/app/./dojo/jira_link/views.py", line 80, in webhook
    assignee_name = assignee['name'] if assignee else None
KeyError: 'name'
[16/Aug/2022 12:45:03] ERROR [django.request:224] Internal Server Error: /jira/webhook/******00
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/app/./dojo/jira_link/views.py", line 80, in webhook
    assignee_name = assignee['name'] if assignee else None
KeyError: 'name'

I can tkae this one.

Hi. Problem still persist for me in 2.15.* version (both Docker Compose / Kubernetes)
There is case when there is no assignee in Jira for current task and webhook notification ends with 500 error from DefectDojo side.
django-DefectDojo/dojo/jira_link/views.py
Error example:

[22/Nov/2022 13:20:54] ERROR [django.request:224] Internal Server Error: /jira/webhook/
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
return func(request, *args, **kwargs)
File "/app/./dojo/jira_link/views.py", line 106, in webhook
jira_helper.process_resolution_from_jira(finding, resolution_id, resolution_name, assignee_name, jira_now, jissue)
UnboundLocalError: local variable 'assignee_name' referenced before assignment

@damiencarol  Should we reopen issue?


Where can I find a clear list of dependencies?

I'm trying to build Infer from source on RHEL. I find the INSTALL.md unhelpful.
There are three lists of dependencies which might be helpful to me: one labeled "Infer dependencies for Linux", one labeled "Debian 7 and Ubuntu 14.04 LTS", and one labeled "Ubuntu 12.04.4 LTS". Each of these lists contains a different list of packages.
Can anyone give me a exhaustive list of packages I need for Infer to run?

Hi @MatthewBennington. The best way is probably to follow the list of dependencies for Linux and to find the corresponding packages in RHEL.

There are generic dependencies listed at the top of the "Infer dependencies for Linux" section: https://github.com/facebook/infer/blob/master/INSTALL.md#infer-dependencies-for-linux
Then ./build-infer.sh should let you know if you are missing any dependencies. Let me know if that's not the case.


Unit 13™ [PCSA00014]

App summary

App name: Unit 13™
App serial: PCSA00014
App version: 1.00

Vita3K summary

Version: v0.1.8
Build number: 3194
Commit hash: https://github.com/vita3k/vita3k/commit/ca92b35e
CPU backend: Dynarmic
GPU backend: Vulkan

Test environment summary

Tested by: Gerold55
OS: Windows 1Q
CPU: Intel Core i5 9300H
GPU: NVIDIA Geforce GTX 1650
RAM: 8 GB

Issues
Crashes at intro
Screenshots

Log
Recommended labels

Intro

As of https://github.com/Vita3K/Vita3K/commit/ba5f9ace08808507c9f3c249b230d8b2e9c95678, the game now goes ingame (with numerous graphical bugs).
Screenshots

Log
vita3k.log
Recommended Labels

Ingame -
graphics bug

It still shows as "Ingame-" in your compatibility list


No output with XCode 11.1

Hi there,
I upgraded the XCode 11.1, Unfortunately, there is no output for each file building status.
Thanks

Do you have an example project? I'll take a look at it later.

It could easily reproduce with any xcode project.

Install XCode11.1 & command line tools.
xcode-select --p make sure xcode 11 is default
xcrun xcodebuild xxx.xcodeproj  build | xcbeautify

There is only the final build result shows in log (success, fail). I am not able to see which file is building.
Thanks a lot for looking into this!

I think it has to do with the Xcode output:
CompileSwift normal x86_64 /tmp/test/test/AppDelegate.swift (in target 'test' from project 'test')
because the pattern "Compile[\w]+\s.+?\s((?:\.|[^ ])+\/((?:\.|[^ ])+\.(?:m|mm|c|cc|cpp|cxx|swift)))\s.*\(in target: (.*)\)" expects a colon after "target". Making it optional at least shows a match on regex101
Also, I don't know if (.*) is desirable because it puts the target and the project in the same capture group.

Looks like Xcode changed its output format again. Would you mind to submit a PR to fix it?


Corrected the confusion of steps in the document due to formatting

Summary
improve Logging documentation. The main changes are as follows:

Added language settings for code blocks
Fixed wrong numbering of operation steps caused by indentation
Corrected heading hierarchy for first paragraph

The following is a comparison example before and after restoration:
Before:

After:

Reference from specification:

MD009/no-trailing-spaces
MD010/no-hard-tabs
MD012/no-multiple-blanks
MD029/ol-prefix
MD031/blanks-around-fences
MD032/blanks-around-lists
MD034/no-bare-urls
MD040/fenced-code-language

Release Note
None.
Documentation
This PR implements the doc change.

Hi @normal-coder,
I just looked through this and it seems like a great PR.
One question I have is with the indentation of fenced (```) code blocks, for example the go and yml code blocks. Why are they indented by four spaces?
For example, I would expect:

```go
...
```

instead of:

    ```go
     ...
     ```

This doesn't seem to affect rendering, but I'd typically expect fenced code blocks to not be indented.
Thanks, this seems like a great contribution.

Also @ltagliaferri , this PR seems to be post-migration and doesn't need to be rebased.

Hi @normal-coder,
I just looked through this and it seems like a great PR.
One question I have is with the indentation of fenced (```) code blocks, for example the go and yml code blocks. Why are they indented by four spaces?
For example, I would expect:
...

instead of:
```go
 ...
 ```

This doesn't seem to affect rendering, but I'd typically expect fenced code blocks to not be indented.
Thanks, this seems like a great contribution.

Perhaps you should try to understand principle of uniformity of the CommonMark specification: if a chunk of text has a certain meaning, it will continue to have the same meaning when put into a container block (such as a list item or blockquote).
I can understand that coding preferences don't want to have too many spaces in front of the example code snippets (which is extremely unfriendly to Vim or Emacs users), but compared to blockquotes inserting > at the beginning of the line, it maintains the integrity and coherence of the code sex.
Such writing does not affect rendering, because most parsers follow this specification for processing and implementation.


Remove business metrics dashboard ID

Description
The dashboard is not rendered and this may be due to a hardcoded dashboard ID.
Changes proposed in this pull request:

Remove dashboard ID
Remove pluginVersion
Add dashoard tags

Related issue(s)

/kind enhancement


Migrated to Asphalt 5

coverage: 99.615% (+7.3%) from 92.283%
when pulling acfbc314423b345eeedc4d3c493e785b6ed16a45 on asphalt5
into 917211b659c98084f5b6ece533466a6216cf4a1f on master.


How do I make GF smaller?

What is your question?
I want to make Girlfriend smaller so she can appear to be farther away from Boyfriend but I don't want to edit the FLA. How can I do this?

You can scale the characters on Character Editor.


[Add-ins] (delegate) No Mac support

Docs Build status updates of commit 631d515:
:white_check_mark: Validation status: passed

File
Status
Preview URL
Details

docs/add-ins/categories.md
:white_check_mark:Succeeded

docs/add-ins/delegate-access.md
:white_check_mark:Succeeded

docs/add-ins/get-and-set-recurrence.md
:white_check_mark:Succeeded

For more details, please refer to the build report.
Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

Docs Build status updates of commit 4e0e28a:
:white_check_mark: Validation status: passed

File
Status
Preview URL
Details

docs/add-ins/categories.md
:white_check_mark:Succeeded

docs/add-ins/delegate-access.md
:white_check_mark:Succeeded

docs/add-ins/get-and-set-recurrence.md
:white_check_mark:Succeeded

For more details, please refer to the build report.
Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.


Add support for overriding entry file in react-native-xcode.sh

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at<EMAIL_ADDRESS>Thanks!

By analyzing the blame information on this pull request, we identified @frantic and @clickthisnick to be potential reviewers.

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Hey @kennethlynne, thank you for your pull request. The react-native-xcode.sh script was designed to make the initial experience with React Native seamless. Indeed, the script is very simple and makes a lot of assumptions about the structure of your project.
However, if it doesn't fit your needs anymore, I recommend copying it into your source tree and changing Xcode to use your forked script. You will have more freedom over what happens and when. There is a trade-off in accepting this PR – it adds another configuration change that serves only small percent of the users. It will require maintenance and also encourage other people to tune it to fit their needs.


Icons don't show inline

Hi, I'm unable to get the icons to show inline. The only change I've made is the url for the svg  in order to use our icons:

Is there a way to update this to have the node image be inline with the text? Thanks!

For more context, here's how the html looks:

Turned out it was user error (facepalm)


Merge br_delay_valid_next and br_delay_valid_next_nr into one module with EnableReset parameter

Same for br_delay and br_delay_nr

nvm, likely to lead to confusion/bugs since the use cases are quite different


Backend for Badges

Find a cool way to give badges
First way that comes to my mind:

save badge type along with the reponame based on checkup result to the database
serve them from a fixed based on reponame like repologist-web-app-url.com/badges/githubusername/reponame.svg

Assigned to @Ishub

Can you please check how other apps that gives badge are handling this?

That will be the first thing I will do :smile:


Make parasite only die after it falls off from the host

About the PR
Parity
Parasites only begin the infection process after they fall off from the mask
also makes it so the death sound only plays AFTER they detach
https://github.com/user-attachments/assets/f808527a-e7d1-45ed-bb29-35eb1244874e

Does this still correctly ghost the parasite player on hug?

yep


EID 998 add labels

Summary
EID-998
Added labels to issue and PR list views
PR - Merge Checklist

[ ] CR'd
[ ] Workflow: Title has semver bump level defined (#major, #minor, or #patch)
[ ] .jenkins-docker passes locally
[ ] README updated or N/A
[ ] Acceptance criteria verified by QE
[ ] Fully tested and approved by QE

Dependencies

[ ] {db-schema,upstream repos,chef,config,hardware,ops - Add bullet points with links to corresponding PRs/tickets}

Risks:
{Risks that are associated with this merge. Things that it could possibly take down in production if released.}
{NOTE: There is always some sort of Risk, don't leave this section blank!}
Rollback:
{revert}

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.

Hello @agnesjang98,Thanks again for the PR!                                         You have earned 7 out of the 5 points needed to receive glorious SendGrid Hacktoberfest swag.                                         Please take a moment to checkout this link to find more issues to get you past the required threshold or to simply continue the celebration.                                         Also, please be sure you have officially registered with us here by November 1, 2018 to qualify.                                         If you have any questions you can email us at<EMAIL_ADDRESS>                                        Thank you and Happy Hacktobering!                                         Team SendGrid


Created ScanServerSelector that tries to use servers on the same host

Implementation seems fine. Hashing to the hostname is what we'd like to happen for leveraging a shared cache.


Huggingface_Pipeline for summarization returning generalized response

System Info
Python = 3.9
Langchain = 0.0.245
Who can help?
@hwchase17
Information

[ ] The official example notebooks/scripts
[X] My own modified scripts

Related Components

[X] LLMs/Chat Models
[ ] Embedding Models
[ ] Prompts / Prompt Templates / Prompt Selectors
[ ] Output Parsers
[ ] Document Loaders
[ ] Vector Stores / Retrievers
[X] Memory
[ ] Agents / Agent Executors
[ ] Tools / Toolkits
[ ] Chains
[ ] Callbacks/Tracing
[ ] Async

Reproduction
I checked the recent update for summarization pipeline with memory as:
from langchain.llms import HuggingFacePipeline
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
from langchain.memory import ConversationSummaryBufferMemory
import torch

summarize_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large-cnn", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
summarize_tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-cnn", padding_side="left")
pipe_summary = pipeline("summarization", model=summarize_model, tokenizer=summarize_tokenizer) #, max_new_tokens=500, min_new_tokens=300

hf_summary = HuggingFacePipeline(pipeline=pipe_summary)
memory=ConversationSummaryBufferMemory(llm=hf_summary, max_token_limit=10)

Then, added chat history to the memory and observed the memory afterwards as:
memory.save_context({"input": "hi"}, {"output": "whats up"})
memory.save_context({"input": "not much you"}, {"output": "not much"})
memory.save_context({"input": "what's my name"}, {"output": "AJ"})

memory.load_memory_variables({})

It returned:
{'history': "System: The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential. Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary. The human asks the AI: Why do you think artificial Intelligence is a Force for good? The AI: Because artificial intelligence will help human reach their potential.\nHuman: what's my name\nAI: AJ"}

This doesn't summarize the actual chat history, but returns a generalized text: The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential. Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary. The human asks the AI: Why do you think artificial Intelligence is a Force for good? The AI: Because artificial intelligence will help human reach their potential.
Expected behavior
This would pass wrong prompt to the LLM for question-answering. The expectation is the summary of the chat history.

This is not helpful, bot. Can someone take a look at this issue?

@AjinkyaBankar Per the bot's message, do you get different results by using a different model? If so, it might be that

the default prompts are not suitable for the facebook/bart-large-cnn model
facebook/bart-large-cnn is not suitable for summarization

@devstein I tried with sshleifer/distilbart-cnn-12-6 and t5-small models. But observing the same behavior. Any recommendation for choosing the model?

I don't have specific model recommendations, but would imagine the more recent LLM/transformer based models will perform better

@devstein It worked as expected for the recent models, such as marianna13/flan-t5-base-summarization and ArtifactAI/flan-t5-base-arxiv-cs-ml-question-answering. Thanks for taking time to answer my question.


multiple @data/values order execution

Maybe I am doing ytt wrong but...:
It seems that ytt proccess multiple data/values files like:
config.yml
a.yml
b.yml

ytt assumes that file b will override file a, just because b is after a
Is it possible if ytt allows something like this: ytt -f "b.yml, a.yml" (where a overrides b) in the future, so that we can specify what files overrides the others?
If ytt already support file order, can someone help me by providing the command?

Hello @juanr2001 good question
The way for you to establish order when using data values files or overlays is from left to right of the files that you provide in the command line via -f flag and after that by alphabetic order inside folders.
You can find a little bit more information about this in these 2 links:
https://carvel.dev/ytt/docs/latest/lang-ref-ytt-overlay/#overlay-order
https://carvel.dev/ytt/docs/latest/ytt-data-values/#splitting-data-values-into-multiple-files

An example, let's assume you have the following 3 files:
a.yml
#@data/values
---
a: 2

b.yml
#@data/values
---
a: 1

template.yml
#@ load("@ytt:data", "data")
---
result: #@ data.values.a

When you execute -f a.yml -f b.yml:
$ ytt -f template.yml -f a.yml -f b.yml
result: 1

When you execute -f b.yml -f a.yml:
$ ytt -f template.yml -f b.yml -f a.yml
result: 2

When you execute -f .:
$ ytt -f .
result: 1

We usually advise people when they create the configuration to try to separate it into logical folders so that it can be easier to provide the ordering to ytt. An example of that could be something like:
config/config.yml
config/values.yml
config-prod/values.yml
This way you can order by doing ytt -f config -f config-prod.
Do you think this helps?

Thank you @joaopapereira for your quick response!
I attacked an image.
I think ytt -f template.yml -f b.yml -f a.yml does not respect this order. Instead it respects the name of the file name in  acending order.

Thank you @joaopapereira for your quick response. I guess I skipped an important concept (overlap).


Clarification needed on the article What is Language Understanding (LUIS)?  (LUIS app/models)

I'm new to LUIS and am trying to understand some basic concepts, especially those that pertain to using LUIS as a developer using the Bot Framework SDK.
I am adding information to the Bot Framework SDK docs related to its set of CLI commands related to BF LUIS, and I need to have a solid understanding of the LUIS concepts that pertain to what I am documenting. I have some thoughts/suggestions/questions from reading the article What is Language Understanding (LUIS)?

It would be helpful to have clear and concise definitions of terms, many of which may be new to a reader that is reading an introductory article.
For example:

LUIS app is first mentioned in the section Use LUIS in a chat bot but what specifically is a LUIS app? I can see it referring to a bot that uses LUIS, however you also create a LUIS app in Azure, which is the one that this is referring too? Is that the same for the other 5 times LUIS app is referenced?  As it pertains to Azure, what does a LUIS app it consist of?
The LUIS model. What is it and how does it relate to the LUIS app? There are over a half-dozen different 'models' listed in the article What is Language Understanding (LUIS)?...

How do these different models relate to each other?
How many different types of models can exist in a single LUIS app?
How many models can exist in a single LUIS app?
What models apply to the Bot Framework SDK, and more specifically to BF CLI LUIS?

model
questions/comments

custom model
Defined in the Natural language processing section. Is this another name for a LUIS model? One that the user creates as opposed to a prebuilt model?

custom language model
I assume that this is the same thing as the custom model? What does adding the word language signify?

Machine learned language model
IDK… Google search results: The search LUIS "Machine learned language model" -video -speech returns nothing. Is this related to Machine Learning?

domain-specific natural language model
This is mentioned in the section titled Natural language processing. My guess is this is just another name for the LUIS model. What does domain-specific mean in this context? Is that term used consistently throughout the LUIS docs?

prebuilt model
Defined in the Natural language processing section. A link to the article Prebuilt models would be helpful, reading this definition made a lot more sense after reading that article.

prebuilt domain model
Defined in the Natural language processing section. What does domain mean when the definition refers to prebuilt domain models?

The LUIS model
I assume that both the custom and prebuilt models are both a type of LUIS model, if so, is that also true of the other models mentioned (with the exception of the dispatcher model)?

language model
Just another name for the LUIS model?

dispatcher model
This, I assume, is not a LUIS model, but relates to the Dispatch tool.

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

ID: 902be7bb-e623-ff49-9d9d-e53f17161f06
Version Independent ID: be07779d-229f-5ce4-5ea3-ae1497f650c7
Content: What is Language Understanding (LUIS)? - Azure Cognitive Services
Content Source: articles/cognitive-services/LUIS/what-is-luis.md
Service: cognitive-services
Sub-service: language-understanding
GitHub Login: @diberry
Microsoft Alias: diberry

@WashingtonKayaker Thanks for the feedback. We are investigating the issue and will update you shortly.

@WashingtonKayaker  Thanks for the feedback.
The SDK defines a common declarative file for language recognition called a .LU file. LU files are simple markdown files which are easy to edit and capture the basic NLU concepts of intents, entities, labeled data, dictionaries, etc. The SDK provides a plugin to BF CLI which parses LU files and creates a LUIS model from it. Services like Power Virtual Agents can consume LU files to train their internal custom NLU recognizer. The open source community have created LU parsers which target open source NLU engines from Spacey.io and BERT models.

@aliciaep Please review and comment.

After a review with the service team, this item will move to backlog as part of a larger effort for this semester's plan. #please-close


Page title field uses Chinese garbled

Orchard Version: 1.10.3
MySQL:5.7

Chinese Culture is alread added to setting and set to the default.
How can  I resolve the problem ?
Thanks!

Can you explain the issue? With repro steps?

Can you explain the issue? With repro steps?

Hi, Thank you for taking the time to reply to me.

I deploy a new Orchard instance (I have tried Orchard 1.10.3 release and 1.10.x branch from source code)

Create a new Page content

the Page title fill in chinese character, such as “你好世界”

also put some chinese character in the Layout

click "Save"

the content saved, but the title and route url becomes to "????",  but the chinese character in Layout is correct.

I have tried https://dotnest.com , haven't this issue.
So, any one know how https://dotnest.com solved this problem ?

Tryed on our test env and everything works as expected, with no issue. Could be a mysql db misconfiguration?

misconfiguration

Ah,, may be MySQL connection string should add a utf-8 parameter, let me have a try....
Thank you for your advice !

@HermesSbicego-Laser Add ;charset=utf8; parameter to connection string solved my problem , Thank you!

Orchard MySQL 中文乱码。(Add this comment to make it easier for others to search)


WARNING: Atom.jl: unrecognised message validatepath and changemodule

Hello everyone!
I was using julia 0.6.2 in Atom and it worked correctly, nevertheless, for an specific project I need to work with Julia 0.5.2 version. So I have installed 0.5.2 the same way I did it for la version 0.6.2
I have updated all the packages in the new version, to have the same packages as I was using in the newer version, so I have nothing yet to update. I'm not having problem to work with Julia console, however, when using Atom and more precisely REPL I'm getting the following errors (when starting Julia)
WARNING: Atom.jl: unrecognised message validatepath
WARNING: Atom.jl: unrecognised message changemodule

I have read some other issues but I haven't found the solution.
Thanks you very much!

You'll either live with those or revert to julia-client 0.5.x and a corresponding ink version. Look at apm help install for some more info on that.

https://github.com/JunoLab/Juno.jl/issues/141


Resource binding roadmap?

The example language is using GLSL/HLSL-like resource binding.
I find this resource binding horrible and complex. On the other hand, Metal 3.0 resource binding
API is the simplest and most powerful at the same time. You don't need the complexity of DX12 and Vulkan.
Are there any plans for moving to essentially what CUDA/OpenCL/Metal do?
You simply declare a standard C/C++ struct with data, GPU pointers and sampler/texture handles
and pass them as a regular function parameters.

Shady's main goal is to be an useful IR and my approach to binding models is to basically support the interfaces APIs want. You can actually find some code supporting passing arguments to kernel directly but that code is reliant on runtime support which is a component you might not want to use in your own application.
Overall the binding model stuff is kind of out of scope / up to you as an user. Shady gives you the tools required to implement transformations to support any binding model you want.
I hope this helps!

I should have said 'vcc' (the front end for Shady) in my question above.
It's understood that Shady is agnostic (as it should be).

I really don't have time at the moment for this but I would gladly support anyone who takes up this for themselves.


[Improvement-15744][parameter] project parameter add update time and update user id

fix #15744
Purpose of the pull request

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:

(or)
If your pull request contain incompatible change, you should also add it to docs/docs/en/guide/upgrede/incompatible.md

Hi @sdhzwc it's not a bugfix pr, please change the pr title prefix to [Improvement-15698], thanks.

Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 39.09%.  Consider uploading reports for the commit 20a30f0 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##                dev   #15745      +/-   ##
============================================
- Coverage     39.11%   39.09%   -0.03%
+ Complexity     4855     4850       -5
============================================
  Files          1316     1316
  Lines         44963    44929      -34
  Branches       4810     4786      -24
============================================
- Hits          17589    17563      -26
+ Misses        25474    25466       -8
  Partials       1900     1900

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Hi @sdhzwc it's not a bugfix pr, please change the pr title prefix to [Improvement-15698], thanks.
see https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md

Adjustments have been made

Hi @sdhzwc , How to see this projectParameter.Operator in ui?

Hi @sdhzwc , How to see this projectParameter.Operator in ui?

The UI has added a Create User and Modify User display