Expose a function that returns whether a file path matches the glob

In Vite, when a file is updated, we check whether that file is included in the glob to know whether the file containing a glob has to be updated.

Links to relevant code
https://github.com/vitejs/vite/blob/802839d48335a69eb15f71f2cd816d0b6e4d3556/packages/vite/src/node/plugins/importMetaGlob.ts#L66-L81
https://github.com/vitejs/vite/blob/802839d48335a69eb15f71f2cd816d0b6e4d3556/packages/vite/src/node/plugins/importMetaGlob.ts#L89-L106

I guess Vite cannot simply use picomatch as tinyglobby has more features. It would be nice if tinyglobby exposes a function that returns whether a file path matches the glob.
import { globMatcher } from 'tinyglobby';

const match = globMatcher(['files/*.ts', '!**/*.d.ts'], { cwd: 'src' }); // pass in the same options

const result = match('files/bar.ts') // pass the file path
expect(result).toBe(true)

will consider adding it, meanwhile do you have any examples of previous work in other glob libraries?

fast-glob uses micromatch and node-glob uses minimatch and both does not extend any features related to matching IIUC, so in these cases those libraries can be used.
globby extends some features but does not provide a function like this.

for an example, maybe take a look at the matcher lib and its isMatch function which returns a boolean, see their implementation here, side note, matcher was created by the same globby author.

fast-glob uses micromatch and node-glob uses minimatch and both does not extend any features related to matching IIUC, so in these cases those libraries can be used. globby extends some features but does not provide a function like this.

just wondering, what are the exclusive features do you need that tinyglobby has but picomatch doesn't? it uses it under the hood. i can try to implement this but it might take a while until i can focus on it

what are the exclusive features that you need that tinyglobby has but picomatch doesn't?

I think it's mainly braces expansion support.

tinyglobby supports the same braces expansion picomatch does, which supports nearly all usecases except for range increments {01..10..2} which to be fair i haven't ever seen used in the wild. if range increments are really needed it's probably possible to add it to tinyglobby though (with the expandRange picomatch option)

Ah, I see. Then, I think I can use picomatch.


Package creation fails for static build

Hey Olivier!
First of all thanks for the great work :)
I've been using this conan package to develop with Qt (v5.8.0).
Everything works perfectly if I build shared libs.
However, if I enable the option '-o Qt:shared=False', the test_package fails.
There seems to be a linker issue for the test applications (helloworld1/2, hellogui) against several system libraries (libz, libpthread, libglib-2.0, ...) and other libs (libqtpcre, ...). If I hardcode those in the target_link_libraries in the cmake file for the helloworld1/2 everything works fine. Still having issues with the hellogui executable though.
Is this a known issue? Should the conan package export those libraries as well so that the ${CONAN_LIBS} point to those or am I doing something wrong? I'm guessing that if the test_package fails I will probably have the same issue for my application as well...
Thanks a lot!
Matteo

It isn't a known issue but I'm not really surprised since I never really tested the package with static linking. In fact, because of the Qt licensing policy I never really tried static linking with Qt (it would force my released work to be LGPL). So my first question before thinking too far is : do you really want to statically link, knowing your final work will have to be licensed either as GPL or as LGPL.
Now, if I tried to to understand, I would guess that system dependencies are not an issue when dynamically linking since they are referenced in the dynamic libs. But when statically linking, they are not known and must be specified at build time. It could be interesting to ldd the .so files to confirm.
I'm surprised the Qt-provided CMake files don't manage this situation. The Qt::Core target should have a dependency with those system libraries.
It would be necessary to run tests to really understand. Could you open a PR containing your current modifications of the test_package?


x-editables with select2

I am using select2 with x-editables. Select2 allows me to modify the query field and i can append a new item to select in the drop down if it doesnt currently exist. Though when i select it and hit the check button the x-editable field remains with the "Empty" text that it originally had but in the back end it knows the right value. Is there somthing i need to do to make it so it updates the "Empty" text to the text of what i selected in the select2 drop down?

Hi,
I have just spent a few hours figuring out why xEditable kept showing 'Empty' when I was using type='select2'.  I think I have finally figured out what you have to do to make it work, by looking through the code here.
I think the reason is the code in this section in the value2html function:
       value2html: function(value, element) {
           var text = '', data,
               that = this;

           if(this.options.select2.tags) { //in tags mode just assign value
              data = value;
              //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc);
           } else if(this.sourceData) {
              data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
           } else {
              //can not get list of possible values
              //(e.g. autotext for select2 with ajax source)
           }

           //data may be array (when multiple values allowed)
           if($.isArray(data)) {
               //collect selected data and show with separator
               text = [];
               $.each(data, function(k, v){
                   text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
               });
           } else if(data) {
               text = that.formatSelection(data);
           }

           text = $.isArray(text) ? text.join(this.options.viewseparator) : text;

           //$(element).text(text);
           Constructor.superclass.value2html.call(this, text, element);

Basically, if the select2 is not in 'tags' mode, you have to provide a sourceData to set the data variable, which is then used to set the text.  The only way to ensure that the sourceData is set, is to specify a source xEditable option, as can be seen from this code section here:
        if(!options.select2.tags && options.source) {
            var source = options.source;
            //if source is function, call it (once!)
            if ($.isFunction(options.source)) {
                source = options.source.call(options.scope);
            }

            if (typeof source === 'string') {
                options.select2.ajax = options.select2.ajax || {};
                //some default ajax params
                if(!options.select2.ajax.data) {
                    options.select2.ajax.data = function(term) {return { query:term };};
                }
                if(!options.select2.ajax.results) {
                    options.select2.ajax.results = function(data) { return {results:data };};
                }
                options.select2.ajax.url = source;
            } else {
                //check format and convert x-editable format to select2 format (if needed)
                this.sourceData = this.convertSource(source);
                options.select2.data = this.sourceData;
            }
        }

What it took me hours to figure out was that my original code was not setting the source xEditable option, but setting the select2 data option directly in the select2 property.  As soon as I replaced the select2.data option with the source option instead, xEditable displayed the text of the selected entry as expected.
I think that either the xEditable select2 documentation section could be altered to make this much clearer, or consider enhancing the xEditable select2 class constructor method so that it will set the sourceData directly from the select2 data option if it has been set instead of the xEditable source.
Hope this helps anyone encountering the same issue as I did, might save you a wasted evening  :-)

Thanks!  You saved me the rest of a wasted evening!

Thanks, but can you provide with a JSFiddle or some code?

@rjsmith  - any chance at all of providing a fiddle or some code with this working? You'd save my bacon!

I am using xEditable within a Meteor.js application via this Meteor lightweight wrapper package.  Here is one example of a Meteor Blaze template that wraps a select2 xEditable widget. As I described above, the key here is to pass a 'source' attribute to xEditable.
<template name='xEditableSelectRequirementComponent'>
  {{> xEditable type="select2" success=onSuccess mode="inline" placeholder="Select a Requirement" select2=getSelect2Options source=getSource value=initialValue}}
</template>

Template.xEditableSelectRequirementComponent.created = function () {
  var tmpl = this;

  // Get contents of select2 list and store it in template instance
  tmpl.select2Source = select2Source(tmpl.data);

};

Template.xEditableSelectRequirementComponent.helpers({

   // Provides xEditable 'source' attribute which provides data list for
   // select2 and also enables xEditable to display correct text.
   // Displaying text does NOT work if you specify the select2 'data' option directly!
   // See: https://github.com/vitalets/x-editable/blob/master/src/inputs/select2/select2.js#L171
   getSource: function () {
      var tmpl = Template.instance();
      return tmpl.select2Source;
   },

   getSelect2Options: function () {
    var self = this,
    tmpl = Template.instance()
    ;
    return {
      placeholder: 'Select a Requirement',
      allowClear: false,
      width: '100%',
      formatResult: formatRequirementOptions,
      formatSelection: formatRequirementSelection,
      initSelection: function (element, callback) {
        var initRequirement = _.find(tmpl.select2Source, function(item) {
          return item.id === element.val();
        });
        if (initRequirement) {
          callback(initRequirement);
        } else {
          callback();
        }
      }
     }
  },

  onSuccess: function () {
    var self = this,
    tmpl = Template.instance();
    // Provides xEditable success callback
    return function(res, requirementId) {
      if (_.isFunction(self.onSelectedRequirement)) {
        self.onSelectedRequirement(requirementId);
      }
    }
  },

  initialValue: function () {
    var self = this;
    return self.requirement._id;
  }

});

/**
 * Helpers for creating requirement - lookup select2 lists
 */
function formatRequirementOptions(requirement) {
  var _html = "
" + _.escape(requirement.text) + "" +
    "" +
    Plangy.Utils.camelCaseToTitleCase(requirement.type)+ "
";
  return _html;
}

function formatRequirementSelection(requirement) {
var _html =
  _.escape(requirement.text);
return _html;
}

function select2Source(dataContext) {
  // Fetch list of requirements
  var _requirements = dataContext.requirementsCursor.fetch();
  // Transform into select2 - friendly data array
  var _data = _.map(_requirements, function (requirement) {
    return {
      id:   requirement._id,
      text: requirement.tag,
      type: requirement.type
    };
  });
  return _data;
}

Thank you very much for that - except I'm not using meteor, Could you post your final rendered version of your js (if that's possible?) I don't know much about meteor.
Also - what version of select2 and xeditable are you using?
Here is my fully rendered JS - maybe you can see what I can't:
    $('#example .eo_role a').editable( {
        params: function(params) {  //params already contain `name`, `value` and `pk`
          var data = {};
          data[params.name] = params.value;
          return data;
        },
        source: 'http://localhost:8000/api/eo_role/select_two_data/',
        //have to set tpl to correct label or else it won't register what type
        tpl: '<select></select>',
        //set ajax to put
        ajaxOptions: {
            type: 'put'
            },

        select2: {
            //cacheData doesn't seem to work but i'm keeping it
            cacheDatasource:true,
            width: '150px',
            id: function(pk) {
                return pk.id;
            },
            source: 'http://localhost:8000/api/eo_role/select_two_data/',
            formatSelection: function (item) {
                return item.text;
            },
            ajax: {
                url: 'http://localhost:8000/api/eo_role/select_two_data/',
                source: 'http://localhost:8000/api/eo_role/select_two_data/',
                dataType: "json",
                type: 'GET',
                processResults: function(item) {return item;},
                },

            },

        formatSelection: function (item) {
            return item.text;
        },
        formatResult: function (item) {
            return item.text;
        },
        templateResult: function (item) {
            return item.text;
        },
        templateSelection : function (item) {
            return item.text;
        },

    });

I'm using xEditable bootstrap v1.5.1, with select2 v3.5.1
It's not really possible for me to show the compiled javascript, its all tied up with the Meteor framework. You have not said what the problem is you want to resolve. I can only suggest you do what I did ... put breakpoints in the xEditable code in your browser and step through it until you figure out what the root cause of whatever your issue is.  In my code, I provide the xEditable 'source' attribute which is assigned to the select2 'data' property .. in my code the 'source' is a javascript array, not an ajax url. You might want to simplify your code and try a dummy array source first, to focus on xEditable itself instead of the extra complexity of your ajax call too.  Best wishes!

Sorry - the problem is that using select2 dropdown, after successful selection the cell displays 'Empty' exactly like the initial post. The server is updated via ajax call successfully however it just doesn't appear so due to it showing 'empty' in the cell after selecting. You have to reload the page (and pull from the server again) in order to get it to show the correct value.
I'll see what I can do to add breakpoints in the select2 code, I may revert back to 3.5.1, I am using 4.4 currently.

I suggest you put breakpoints in the xeditable Select2 value2html function
which determines how to render the selected value .
On 14 Oct 2017 4:23 p.m., "ihelmer07"<EMAIL_ADDRESS>wrote:

Sorry - the problem is that using select2 dropdown, after successful
selection the cell displays 'Empty' exactly like the initial post. The
server is updated via ajax call successfully however it just doesn't appear
so due to it showing 'empty' in the cell after selecting. You have to
reload the page (and pull from the server again) in order to get it to show
the correct value.
I'll see what I can do to add breakpoints in the select2 code, I may
revert back to 3.5.1, I am using 4.4 currently.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/vitalets/x-editable/issues/431#issuecomment-336641937,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AApa_U8k_LHwWeYRF2B7boHL_B0nkX1oks5ssNHxgaJpZM4BLFUW
.

I figured out that like you - datasource isn't being set during this function call:
    $.extend(Constructor.prototype, {
        render: function() {
            this.setClass();

            //can not apply select2 here as it calls initSelection
            //over input that does not have correct value yet.
            //apply select2 only in value2input
            //this.$input.select2(this.options.select2);

            //when data is loaded via ajax, we need to know when it's done to populate listData
            if(this.isRemote) {
                //listen to loaded event to populate data
                this.$input.on('select2-loaded', $.proxy(function(e) {
// ****** THIS IS NEVER setting this.sourceData for some reason. List still populates however.
                    this.sourceData = e.items.results;
                }, this));
            }

            //trigger resize of editableform to re-position container in multi-valued mode
            if(this.isMultiple) {
               this.$input.on('change', function() {
                   $(this).closest('form').parent().triggerHandler('resize');
               });
            }
       },

Here's what worked for me with select2 (v4.0.13) and x-editable (v1.5.1)
$(editable.input.$input).on('select2:select', function (e) {     var data = e.params.data;     editable.options.display = function(value,source){         $(this).html(data.text);     }; });


Assets: cannot drag&drop fonts

Win10:
Switching to "Assets" tab. Try to drag and drop a .ttf or .otf font to the drag and drop area. Nothing will happen.

I think the issue is that Kha doesn't seem to accept files with upper case endings like .TTF in which windows font files are stored (compared to files ending with .ttf). Can you confirm that ".ttf" files work?


Not existing Users are not created by ressource "AtlasBasic"

Is your feature request related to a problem? Please describe.
When I create an AtlasBasic ressource, I could configure "clusterProps, projectProps, ipaccesslistProps", those are created if they not exist in my account. However if I define "dbUserProps", the user is not created, if it does not exist, I simply get an error that says "user cannot be found".
Describe the solution you'd like
I would expect to create the user if it does not exist, since if I create a project and cluster with this ressource, I will have an henn egg problem with the user, since the project must already exist to create the user. This means I have to use 3 Ressources to create a cluster, even if there is a ressource that should manage that.
Describe alternatives you've considered
Alternative is to not create the user, but it should be documented and explained, why.
Additional context
Add any other context or screenshots about the feature request here.

thanks @romulus-ai for opening the issue.
can you please share the info requested including the CDK code and cdk synth output so we can know the code you're executing?
AtlasBasic L3 creates a DB user for you with default values:
const dbDefaults = {
dbName: "admin",
username: "atlas-user",
password: "atlas-pwd",
roles: [
{
roleName: "atlasAdmin",
databaseName: "admin",
},
],
};
but you can override those values, this is the code in the L3 that allows that:
// Create a new MongoDB Atlas Database User
this.mDBUser = new atlas.CfnDatabaseUser(this, "db-user-".concat(id), {
profile: props.profile,
databaseName: props.dbUserProps?.databaseName || dbDefaults.dbName,
projectId: this.mProject.attrId,
username: props.dbUserProps?.username || dbDefaults.username,
roles: props.dbUserProps?.roles || dbDefaults.roles,
password: props.dbUserProps?.password || dbDefaults.password,
...props.dbUserProps,
});
thanks

Closing because inactivity


Data Distillery: July 16 distribution is missing OTG

Statement of Problem
The July 16 distribution of the Data Distillery Knowledge Graph does not contain data from Open Target Genomics (OTG).
Solution
I have the ontology CSVs that were used to generate the July 16 distribution. I will ingest the OTG data for both distributions:

The turnkey distribution available via the UBKG download site.
The back end for the public API.

Issue: invalid format
References to HSCLO nodes in the edge and node files for OTG were missing the HSCLO SAB.
CHOP corrected and regenerated the edge and node files.
The edge and node files are not yet in Globus.

Done


instanceof typeguard fails if classes have similar structure

TypeScript Version:
1.8.x and nightly
Code
class C1 { item: string }
class C2 { item: string[] }
class C3 { item: string }

function Foo(x: C1 | C2 | C3): string {
    if (x instanceof C1)
        return x.item;
    else if (x instanceof C2)
        return x.item[0];
    else if (x instanceof C3)
        return x.item; // Error property item does not exist on C2
}

Expected behavior:
Code should compile
Actual behavior:
Code has an error as shown
More
The following works i.e. if C1 and C3 differ in structural compatibility:
class C1 { item: string }
class C2 { item: string[] }
class C3 { items: string }

function Foo(x: C1 | C2 | C3): string {
    if (x instanceof C1)
        return x.item;
    else if (x instanceof C2)
        return x.item[0];
    else if (x instanceof C3)
        return x.items; // Ok
}

:rose:

I'm afraid this is by design. I get a lot trouble with this too, so I hope this could be changed. Adding a brand to one of the classes fixes it, but I don't like that approach very much. I think x instanceof C1 should only remove C1 in the else branch, not both C1 and C3, or it shouldn't remove any types in the else branch. The current behavior doesn't match what happens at runtime, for instance this does not give any compile error:
function Foo(x: C1 | C2 | C3): string {
    if (x instanceof C1)
        return x.item;
    else
        return x.item[0];
}

The type of x is C2 in the else block, but at runtime it could also be C3.

I've also run into this problem, and wish that the compiler behaviour could be brought more into line with what happens at runtime. It's not specific to instanceof, it's really just about the structural similarity of the types in the union. E.g., this works fine at runtime, but fails at compile time:
type UnaryFunction = (a: any) => any;
type BinaryFunction = (a: any, b: any) => any;
function isUnaryFunction(fn: Function) : fn is UnaryFunction {
    return fn.length === 1;
}
function isBinaryFunction(fn: Function) : fn is BinaryFunction {
    return fn.length === 2;
}
function foo(fn: UnaryFunction | BinaryFunction) {
    if (isBinaryFunction(fn)) {
        fn(1, 2);   // OK: fn is BinaryFunction here
    } else {
        fn(1);      // ERROR: Cannot invoke an expression whose type lacks a call signature
    }
}

I think the problem is similar to @basarat's, because from a structural typing viewpoint, a UnaryFunction is just a subtype of a BinaryFunction, triggering different narrowing behaviour than if the types were structurally independent. However there is no subtype relationship according to the runtime checks in isUnaryFunction and isBinaryFunction.

Here is another case that brings up this type guard behaviour because the compiler sees the types as structurally related. Consider a function that takes either (a) an options object, where all options are optional, or (b) a function that returns an options object:
interface OptionsObject {
    option1?: string;
    option2?: number;
}
interface OptionsFunction {
    (): OptionsObject;
}
function isOptionsObject(opts: OptionsObject | OptionsFunction) : opts is OptionsObject {
    return opts && typeof opts === 'object'; // definitely not a function
}
function bar(opts: OptionsObject | OptionsFunction) {
    let option1: string;
    if (isOptionsObject(opts)) {
        option1 = opts.option1 || 'none';   // ERROR: no option1 on OptionsObject|OptionsFunction
    } else {
        option1 = opts().option1 || 'none'; // OK
    }
}

I have learned how to spot and work around these cases now. But that involves taking valid runtime code, and rearranging it just right so the compiler won't complain. It's a (rare) case where the tool is fighting me rather than helping me. Probably also quite unintuitive for beginners.

@basarat here is a version of your example without instanceof. It has the same error as your example, which is why I think this is about the structural type similarity and not related to the presence of instanceof:
class C1 { item: string }
class C2 { item: string[] }
class C3 { item: string }

function isC1(c: C1 | C2 | C3): c is C1 { return /*some test*/ }
function isC2(c: C1 | C2 | C3): c is C2 { return /*some test*/ }
function isC3(c: C1 | C2 | C3): c is C3 { return /*some test*/ }

function Foo(x: C1 | C2 | C3): string {
    if (isC1(x))
        return x.item;
    else if (isC2(x))
        return x.item[0];
    else if (isC3(x))
        return x.item; // Error property item does not exist on C2
}

Another example, this time with typeof, that's maybe the same problem? Since Function is a subtype of Object. But isn't string also a special case of Object structurally? Not sure about this one...
function ok(x: string | Object) {
    if (typeof x === 'string') {
        x // string
    }
    else {
        x // Object
    }
    if (typeof x === 'object') {
        x // Object
    }
    else {
        x // string
    }
}

function fail(x: Function | Object) {
    if (typeof x === 'function') {
        x // Function | Object
    }
    else {
        x // Function | Object
    }
    if (typeof x === 'object') {
        x // Function | Object
    }
    else {
        x // Function | Object
    }
}

+1 this behavior is buggy.

from #6589 because it merged into this issue.

Type narrowing strategy for most closest type selection
Narrowing to the closest runtime type by instanceof operator:
class A<T> {
    prop: T;
}
class B<T> extends A<T> {
}
class C extends B<any> {
}

var x: A<string> | B<any> | C;
if (x instanceof A) {
    x; // closest type is A, now B
}
if (x instanceof B) {
    x; // closest type is B, now B
}
if (x instanceof C) {
    x; // closest type is C, now B
}
if (x instanceof Object) {
    x; // closest type is A, now B
}
if (x instanceof Array) {
    x; // no closest type, must be contextual type `A<string> | B<any> | C`
}

Motivation
Sometimes we must check the instance type instead of pattern matching. TypeScript should provide the way that select the most closest type for alternate method of pattern matching.
// maybe monad
  public bind<U>(f: (val: T) => Maybe<U>): Maybe<U> {
    return new Maybe<U>(() => {
      const m: Just<T> | Nothing | Maybe<T> = this.evaluate();
      if (m instanceof Just) {
        return f(m.extract());
      }
      if (m instanceof Nothing) {
        return m;
      }
      if (m instanceof Maybe) {
        return (<Maybe<T>>m).bind(f); // `m` is `Nothing | Maybe<T>`, should be `Maybe<T>`
      }
      throw new TypeError(`ArchStream: Maybe: Invalid monad value.\n\t${m}`);
    });
  }

Searching and showing of all derived types is useless and too complex when there are many derived types, and TypeScript should reduce those unnecessary costs for optimization.
class A<T> {
    prop: T;
}
class B<T> extends A<T> {
}
class C extends B<any> {
}

var x: A<string> | B<any> | C;
if (x instanceof A) {
    x; // this scope narrowed by A, B and C are useless, but x is B
}

In general, sets of types must narrow by operations, but instanceof operator widen types. Roles and effects of typings for abstraction is reducing of calculation size based on sets size.
class A<T> {
    a: T;
}
class B<T> extends A<T> {
	b: T;
}
class C extends A<any> {
    c: any;
}

var x: A<string> | B<string> | C;
if (x instanceof A) {
    x; // x should narrow to A of the most closest type from `instanceof` operator specified type.
    // if you want B or C, it should narrow by those types.
}

instanceof operater compare constructors in js engine, but TypeScript compiler compare structural types. It is mismatch behavior.

As noted in #8503, classes should be treated definitely for instanceof checks.
note this applies to instanceof type guards only, and not for user defined type guards; the later stays structural as we have no guarantees on how they will be implemented, where as instanceof is known to always be nominal.

Another example, in this case TS picks the never type:
class A { field: string; }
class B { field: string; }

function f(x: A|B) {
  if (x instanceof A) {
    x.field; // all good.
  } else if (x instanceof B) {
    x.field;  // error: no property `field` on `never` type.
  }
}

Just retried all the examples on this page with the nightly, and they all work except for the UnaryFunction | BinaryFunction one (which I know was not addressed by #10216). Nice that as well as the OP example, the other non-instanceof examples all work now too. CFA is getting very good indeed.

I just wanted to mention that I came across a situation where TypeScript does treat classes nominally.  We (Dojo 2) have a Promise shim which introduced a protected property named _state.  While at run-time we load the same module, when we are developing we will often npm link in development branches of our packages and those packages then import in physically different locations of the .d.ts UMD file from the shim package.  Once that occurs, TypeScript then starts to complain that Promise<T> is not assignable to Promise<T> because they are different class instances.  We worked around the issue by npm linking in the package to all the other dependent packages, so the class Promise definition was coming from exactly the same physical file location, but I will admit it was surprising to see TypeScript treat it this way, especially with the "TypeScript is structural typing" booming in my head.
I guess the thought there will be quite a few other surprises like that, where for various reasons the typings appear to be nominally distinct but they are actually the same at run-time.

private and protected properties are nominal. treating them structurally defies the whole point of visibility modifiers.

Is this a problem with structural classes or wrong if-else instanceof?
class Foo {
    foo: string;
}

class Bar {
    bar: string;
}

function test(x: Foo | Bar) {
    if (x instanceof Foo) {
        x.foo.toUpperCase()
    } else { // somewhy x is Bar here
        x.bar.toUpperCase();
    }
}
test({ foo: 'foo' });

@mkusher at runtime, obviously {foo: 'foo'} is not an instance of the Foo class so you end up in the else block.
At compile time, the only questionable thing here is the last line, where the compiler allows the call to test with an argument that is not a Foo or a Bar. That's where structural typing comes into play. AFAIK TypeScript sees no difference in type between new Foo() and {foo: 'foo'} in this case.

@yortus I understand why it happens so now, but the question is more about what needs to be fixed: type guard(if-else instanceof) or nominal classes

@mkusher the core team are looking at a solution for this under #202 (and this ticket).  It will be some form of nominal support most likely, but something that doesn't break/incompatible with the rest of the structured typing system.

Why is this closed?  I've spent the last 20 minutes trying to find the canonical (open) issue on this, but I've failed.  There are lots of dupes, but the only open ones (at the moment) I can find are https://github.com/Microsoft/TypeScript/issues/11664 and https://github.com/Microsoft/TypeScript/issues/10934.  I assume they'll get closed as dupes eventually.
This is the best bug to track I've found so far (best title and description).  I see #202 has been referenced a couple times as covering this issue, but it seems to be much broader and it's not obvious if/how it will address the concrete issue reported here where the compiler has chosen to implement "instanceof" different from how it behaves at runtime.
I ask because our code is getting littered with hacks to work around this behavior and I'd like to reference an appropriate issue so that we can easily check if/when it gets addressed.
I'd also love to see a solution for this sooner than later, since the behavior is non-intuitive and the resulting errors are varied and often appear nonsensical.

This issue was closed by PR #10216 which the core team felt dealt partially with this issue, enough to close it.  For broader nominal type, that is still #202 and is on the Future Roadmap

Thanks @kitsonk.  I see that the specific issue here does seem to be solved.  I've gone ahead and opened new issues for the instanceof cases I'm still hitting.

See #19671 for a recent relevant merged PR.


Error when running IlluminaParser.jar

Hello,
I'm encountering the following error while executing this command:
java -Xmx15000m -jar IlluminaParser-1.0.jar --inFileIllumina aligned.sorted.bam --tsv illumina_cellbarcodes.tsv --outFile illumina.bam.obj --cellBCflag CB --umiFlag UB --geneFlag GN
..................................................
..................................................
..........................Scan took: 10:58:811
Getting some stats
Exception in thread "main" java.lang.NullPointerException
        at com.rw.bamparsermaven.Parser.parse(Parser.java:149)
        at com.rw.bamparsermaven.Main.main(Main.java:89)

Any ideas what could be causing this?
Thanks,
John

This error occurred during the generation of some stats(number of UMIs associated with genes) after writing the parsed Illumina data to disk.
That means the parsed Illumina data were written to disk just some stats were not calculated.
Was the input bam file generated by Cellranger or another pipeline ?
We revised the calculation of the  stats.  Please try it again with today’s build.
Since one library shared by three jars was modified you need to replace IlluminaParser-1.0.jar , NanoporeBC_UMI_finder-1.0.jar, NanoporeReadScanner-0.5.jar and the entire /lib directory.

That helped, but now I'm hitting an error a few lines later. And no, this BAM file was not generated using Cell Ranger.
..................................................
..........................Scan took: 08:37:930
Getting some stats
Exception in thread "main" java.lang.NullPointerException
        at com.rw.bamparsermaven.Parser.parse(Parser.java:154)
        at com.rw.bamparsermaven.Main.main(Main.java:99)

It is actually the same error.  I just split one line with a complex sequence of java stream operations into several lines to facilitate the identification of the problem.
This exception suggests that no SAM record with the gene , cell barcode and umi tag you specified in your command line was found in your BAM file.
Since your BAM file was not generated by Cellranger, could you verify whether  the gene name , cell barcode and umi in your SAM records have the GN, CB and UB tags respectively that you defined in the command line.
We added now additional code that verifies whether the BAM file has the tags specified in the command line. Info about not found tags is printed now.
To install the revised code, Just replace IlluminaParser-1.0.jar, no need to replace the lib folder.
To identify the reason why your bam file poses problems we would need a few (5 – 10) SAM records from your BAM file.
At least two of those SAM records should have the SAM tags for the gene, cell barcode and umi.

In the end, I've decided to run CellRanger and this is producing the BAM file with the proper tags. Thanks for your explanations.


add --with-group command line option

Also resolves #444
Not sure about the logic in CmdLine.cmdHintFiles - which decides to look in files according to existence of --with options. Should that also depend on --with-group options?

Can you add a test in tests/? This looks like exactly the kind of functionality I'm going to break in a refactoring without realising it!
Not sure about the --with vs --with-group, but suggest we go with what we've got for now. I think #434 might impact whatever we do here anyway...

Sure, now with tests! :)

Thanks!


IRGen: fix and re-enable static read-only arrays

Static read-only arrays didn't work when passed to ObjectiveC as NSArray. The storage class of static read-only arrays doesn't carry information about the Element type. The new __SwiftDeferredStaticNSArray is generic over the element type and doesn't have to rely on the element type information of the array storage.
This is a follow-up of https://github.com/apple/swift/pull/59612
rdar://94185998

@swift-ci test

@swift-ci benchmark

@swift-ci test


Angular optimization

Working on #32

Looks good, we can merge I think. I don't see the sim-summary directive anywhere in the html or project.json, is that correct?

Yes, I'll add an issue for that.


When can we get stable openness 20.03 code base?

Hi Team,
Can anyone please let us know when can we get stable openness 20.03 code base?
As I posted in forum we are unable to deploy openness 20.03. Please look into issue link fro more details.
https://github.com/open-ness/openness-experience-kits/issues/51
Thanks & Regards,
Devika

Hi,
From what I can see in this error message I believe this is related to issue we faced with one of our dependencies. This issue has been fixed for version 20.06 and we highly suggest trying that version.


cached for all users

If the visitor is logged in, caching continues to work.
opencart <IP_ADDRESS>
v2pagecache 1.4
php 7.0
https://goodbooks.com.ua

#36


Hi, A child container failed during start

log

Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
	... 27 common frames omitted

I found is because the spring-data-hadoop-store-2.4.0.RELEASE.jar dependency servlet-api-2.5.jar.
So, modify the pom
    <dependency>
      <groupId>org.springframework.cloud.task.app</groupId>
      <artifactId>spring-cloud-starter-task-jdbchdfs-local</artifactId>
      <exclusions>
      	<exclusion>
      		<groupId>javax.servlet</groupId>
      		<artifactId>servlet-api</artifactId>
      	</exclusion>
      </exclusions>
    </dependency>

This is probably due to some dependency changes after a Spring Boot version upgrade and we should probably add some excludes to get this to run.

This exclusion is introduced as of Belmont.M1 release.


TypeError: null is not an object (evaluating 'TrackPlayer.RATING_HEART')

**Help me I have this error install  package and import then show this error how to solve that issue **
TypeError: null is not an object (evaluating 'TrackPlayer.RATING_HEART')
****TypeError: null is not an object (evaluating 'TrackPlayer.RATING_HEART')
at node_modules\expo\build\environment\react-native-logs.fx.js:27:23 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:17 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:39 in ### handleError
at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:203:40 in guardedLoadModule
at http://<IP_ADDRESS>:19000/node_modules\expo\AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:134790:3 in global code
Invariant Violation: "main" has not been registered. This can happen if:

Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
at node_modules\expo\build\environment\react-native-logs.fx.js:27:23 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:17 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:39 in handleError
at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:370:35 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:16 in callFunctionReturnFlushedQueue****

Sorry, please follow the bug report template. Thanks.

i am using expo app

I have the same problem, it happens when building on release

I am also getting the same error, when I import the React Native track player getting this error

@Md-Yousuf-sheikh @malaganator3000 @krmgopi @lynkas
If you are having a similar issue please raise a bug report and follow the Issue template so we can investigate.
Thank you :)


🐞 [Bug]: rmb-sdk-go Peer router middlewares not working

What happened?
Peer router method Use accepts middlewares but does not actually use them.
which network/s did you face the problem on?
Dev

Verified:
Tried it in this commit and worked fine.
requests to the node under admin subroute responded with "unauthorized" (if not the farm owner)


Roadmap

Per @gaearon's suggestion, I'm typing up the roadmap I have planned here, as a more technically oriented follow-up to my medium post. I will probably eventually write this up on Medium.
My immediate main priorities development-wise are these:
More flexible path matching
This comes in two parts.
Richer path declaration syntax
The first is to switch from the home-built pattern matcher to path-to-regexp from Express. I have a very rough WIP on https://github.com/taion/rrtr/pull/12 – this is not ready to merge as-is. For earlier discussion, see https://github.com/reactjs/react-router/pull/3105 and and tangentially https://github.com/reactjs/react-router/issues/1923#issuecomment-195439126.
This path matcher is very similar to the existing one. It adds a major new feature in supporting regex constraints, so I can specify routes as e.g. ':widgetId(\\d+)' This will be very useful for constraining the types of parameters. In practice I expect this to be used like:
<Route path={`:widgetId(${UUID})`}>

with template strings, but only when needed – mount route path specifications shouldn't change at all.
This also comes with two meaningful under-the-hood benefits – it removes a significant amount of rather fiddly code from our codebase, and per @KyleAMathews's benchmarks on https://github.com/reactjs/react-router/issues/3215#issuecomment-199496345, is (somehow) an order of magnitude faster than even my optimized path matching logic released in<EMAIL_ADDRESS>It also makes things more consistent for people working full-stack in JavaScript, if they're using Express or one of the popular Koa routers.
This is slightly incompatible with the current path matching language, but only slightly – optional parameters and splats are handled a bit differently, and I want to move to Express's logic for repeated and anonymous route parameters, per https://github.com/reactjs/react-router/issues/2422. I have an idea that I think works for deprecation strategy: https://github.com/taion/rrtr/pull/12#issuecomment-208722968. Essentially, we make the feature opt-in on a route-by-route basis (possible because of changes I made earlier in https://github.com/reactjs/react-router/pull/2421), but in dev mode run both matchers in parallel, and issue deprecation warnings only on mismatches. This should avoid deprecation warnings for the vast majority of use cases, and give users a way to switch to the new syntax.
Conditional route matching
This is from @j's PR on https://github.com/reactjs/react-router/pull/3098. Essentially, the problem is that if you have your routes set up like:
<Route path=":orgId" component={Org}>
  <Route path=":repoId" component={Repo} />
</Route>

You have no good way of rendering a "not found" view that doesn't include <Org>, if :repoId doesn't exist – there's no real API for a route to say "I do not match" in a dynamic way. This is related to the above, but orthogonal, as it involves dynamically (and perhaps asynchronously) checking for a route match and forwarding to an unmatched route if the dynamic check fails.
The best available option right now is to redirect in an async onEnter hook to e.g. /not-found, but I believe in general that this is not the correct approach.
You're well-entitled to ask at this point why I didn't just merge https://github.com/reactjs/react-router/pull/3098, if I like it so much. The problem is that the current React Router route matching algorithm would lead to this feature leading to some very strange and unexpected behavior. I'll go into this later.
Scroll position management
This feature is just plain missing in the Router, and it's a pretty critical UX thing. I have the appropriate algorithms mostly coded up on scroll-behavior, but the library needs to be refactored to integrate to the router to properly handle async routes, rather than to integrate into history.
Why am I talking about this? Per discussion in https://github.com/mjackson/history/issues/163, the pending v3 release of history is moving in a direction that makes it even more difficult to accomplish this in a reasonable way when using a hash history.
Furthermore, this should probably be integrated into the router – it's a core UX feature and shouldn't just be missing or opt-in. Proper scroll management should be present by default.
Route matching semantics
There's a few things wrong here. The biggest one is our handling of nested routes with absolute paths, per https://github.com/reactjs/react-router/issues/3172.
To summarize, in order to support nested routes with absolute paths, we walk down all route branches with non-async children, even after the current path has failed to match, just in case there's a nested async route somewhere.
This is slow. It's not too noticeably right now for smaller route configs, since everything is synchronous, but would be absolutely awful with support for async route match conditions. As such, to implement async route match conditions requires removing this form of support for nested routes with absolute paths.
Per my updated docs in https://github.com/reactjs/react-router/pull/3178, this pattern isn't even necessary any more – it's possible to decouple UI from URL with pathless routes, without any use of absolute paths in nested routes.
In principle it would be possible to build a mapping of absolute routes ahead of time, but it'd be extremely fiddly to preserve the existing route precedence semantics, so finally fixing this might actually require a breaking change. Instead I have a deprecation up on https://github.com/reactjs/react-router/pull/3246, but note that it's not merged – even here.
Again, this is relevant not just for its own sake, but mostly so we can actually do dynamic route matching conditions without exhaustively evaluation all preceding ones.
Link active semantics
As a follow-up to the above, and to https://github.com/reactjs/react-router/pull/3158, which removes some silly handling of extraneous slashes in the router (for whatever reason, we make the pattern /foo/bar match the path /foo////////bar//////), we can also dramatically simplify link active state semantics, per https://github.com/reactjs/react-router/issues/3231.
Instead of running a match right now, we can just do a prefix match with some careful handling of trailing slashes. This would allow us to completely bypass issues like https://github.com/reactjs/react-router/issues/3277, which are not wrong per se, but actually just confusing complications of the current "active" semantics.
It would also be a lot faster, which would address the unresolved (but closed) https://github.com/reactjs/react-router/issues/1873.
Async route handling and code splitting
This is from https://github.com/reactjs/react-router/issues/3232, which I believe was closed without proper consideration.
I'm not going to go into as much detail here, as I sketch out the problem in some concrete detail in the linked issue, but essentially the current route-based code splitting API in React Router is not ideal, in that it will lead to suboptimal results if used in the most straightforward way.
The problem with an API like getChildRoutes is that it doesn't look at which of the child routes might potentially match, so it always leads to overfetching through loading all of the child routes whenever any child route might be active. Furthermore, when used in conjunction with an async getComponent callback (which will mitigate the overfetching), this leads to async route loads requiring two server round-trips.
Per https://github.com/reactjs/react-router/issues/3259, most applications shouldn't be using getChildRoutes or getIndexRoute at all and should just be using getComponent or getComponents.
For applications that do need route-based code splitting for whatever reason, the split point should be after the match, with something like my getRouteConfig proposal, such that we load only a chunk with only the relevant route, rather than a chunk containing all child routes as happens right now in the huge-apps example with getChildRoutes.
Other features
There are a few other miscellaneous features I haven't fully thought through, or don't need much of a writeup, but I'll list them for completeness:

Call getComponent and getComponents with router state instead of location, so the callback has access to route params: https://github.com/reactjs/react-router/issues/3262
Support reducer-based paradigm for routing state so Redux users can access route params in a non-broken way from the store: https://github.com/reactjs/react-router/issues/3190 (this will require some careful engineering with managing caching of async route assets)

Release schedule and project management
I don't know how much there is to say here. I'd like to cut feature releases on a regular basis – perhaps monthly, but never with more than one or two deprecations at a time. I'd like to cut bugfix releases as soon as they're merged – actually, I'd like to cut all releases as soon as they're merged, because I think long-running divergences between master and the latest release are unhealthy, except in the case of breaking changes.
I use this library, and I don't particularly enjoy migrating my code to use new APIs. API stability is an absolute priority. https://github.com/taion/rrtr/pull/12 once ready will almost certainly include more code for handling backward compatibility than for implementing the feature.
Also, I'm thinking that moving toward a policy of "no questions on the issue tracker" has been very counterproductive. Given such an issue, the right policy ought to be to answer no questions on the issue tracker, to be consistent and to avoid "rewarding" (I use that term sarcastically here) people who break the issue filing guidelines.
However, basic human decency makes that policy almost impossible to follow without the conversations growing extremely contentious. As such, it'd probably be best to address simple questions on the issue tracker as possible (e.g. when they can be resolved with a simple pointer to the relevant section of the docs), but redirect more complicated ones to Stack Overflow or Reactiflux. This implicit policy has worked quite well for us on React-Bootstrap, and I think it's relatively scalable, given that React Router is a small project in terms of API size, unlike, say, Babel, for which this approach is less likely to succeed.

This lib might help to serve inspiration with what's first: https://visionmedia.github.io/page.js/

@michaelBenin Thanks. I guess I forgot to mention it above (I'll ETA), but one of the explicit goals here is in fact to minimize API changes, so major divergences from the React Router v2 API are probably out of the picture.

Another addition: I'm also really fond of the React-Bootstrap contribution policy, which requires all non-trivial changes go through PRs that are signed off by at least two contributors to the project. I'd like to move to that pattern ASAP, as soon as I actually have other collaborators on this project.

One more note – I'm considering moving some commonly used extensions that are agnostic to other libraries into the core of this project in the near term.
The two I'm looking at are:

use-named-routes: first-class named route support as a history enhancer, that makes all router functionality work with route names
<LinkContainer> (and <IndexLinkContainer>) from React-Router-Bootstrap, that allow styling custom React components as links, by injecting down href and an onClick handler

Is it your general idea to keep easily extractable functionality within the core of the project? I'm asking because IMHO it would be a nice approach to make a common route-matching library that can be used if your plan is to rework that part anyway.
If you want to have that in the core then that is totally fine with me. I just want to get a general feel for where this project is heading.

@Furizaa Can you clarify what you mean by "easily extractable functionality"?

Ok, that was a poor choice of words on my side. Cut the "easy" :smiley: . But I think the route matching is a prime example here. If I remember correctly there was a discussion on the React-Router project about moving the matching out of the core like it was done with the history. Is this something you would embrace or do you like to keep things in the core?
If this all makes no sense than that's also fine. I Occasionally have to dig in the source of the router but I'm far to detached to make sense of it all.

@Furizaa
It depends. You might be talking about my https://github.com/reactjs/react-router/issues/2286, or else a related issue.
We were thinking of making route matching be customizable to allow something like the regex-based path matching I've mentioned above.
At this point, I think using path-to-regexp plus the condition check would offer an acceptable solution in almost all use cases, so I don't think it'd immediately make sense to offer further customizability for route pattern matching.
However, one consequence of the above change is that the details of pattern matching would be out of core! They'd live upstream in the path-to-regexp dependency.

Crossed out one of the minor quality-of-life things that I just implemented.

One minor detail that might be worth mentioning: perhaps we could use a different Discord chat on the README. The current one goes to React Router.

That might become necessary at some point. I'd rather not clutter up Reactiflux more than necessary, though.

Thanks for everyone's feedback. I'm folding this project back into React Router proper. Please stay tuned for a proper announcement. I'm deeply sorry for all the inconvenience this has caused, and I thank you all for your patience.


Add helpers package

Add light utilities for working with Array buffers, typed arrays and converting data to base64 strings.

I no longer think this is necessary. Let's keep the code and packages focused and introduce feature creep.


since version<EMAIL_ADDRESS>@npm getting error during publish of an extension

using the  https://marketplace.visualstudio.com/items?itemName=ms-devlabs.vsts-developer-tools-build-tasks extension in VSTS to publish extensions to the marketplace.
I did publication today with 0.4.11 and that been working; since its updated to 0.4.13 its broken.
results in the error:
2017-12-15T16:35:21.9423684Z error: TypeError: Cannot read property 'indexOf' of undefined
2017-12-15T16:35:21.9625179Z ##[error]tfx failed with error: Error: d:\a_tools\tfx.cmd failed with return code:<PHONE_NUMBER>

I have rolled back the update. Thanks for reporting.

Found the issue and fixed in 0.4.16. Thanks again.

thanks!


Access-Control-Allow-* headers are not present in the response when some Rejection occurs

Hi all!
When some Http request is rejected by any reason by Akka, then the headers related to CORS are removed and, even reading code and documentation, I'm not able to find a solution for that.

val route = cors() {
       path("ping") {
           get {
               complete("pong")
           }
       } ~
       path("pong") {
           get {
               throw new Exception("BOOM!!!")
           }
       }
}

Then, if I call /ping:
> $  curl -v "http://localhost:3000/ping" -H "Origin: http://localhost:8080"
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET /ping HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
> Origin: http://localhost:8080
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: http://localhost:8080
< Access-Control-Allow-Credentials: true
< Server: akka-http/10.1.12
< Date: Wed, 16 Sep 2020 07:56:19 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 4
<
* Connection #0 to host localhost left intact
pong* Closing connection 0

We can see correctly the "Access-*" headers.
But if I call /pong:
> $  curl -v  "http://localhost:3000/pong" -H "Origin: http://localhost:8080"
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET /pong HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
> Origin: http://localhost:8080
>
< HTTP/1.1 500 Internal Server Error
< Server: akka-http/10.1.12
< Date: Wed, 16 Sep 2020 08:00:03 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 35
<
* Connection #0 to host localhost left intact
There was an internal server error.* Closing connection 0

We can NOT see correctly the "Access-*" headers.
Could you please give me some tips to fix it?
Thanks!

After more and more reading I found the problem!
The problem was the moment where I handle the rejections. I performed it after the CORS directive instead of before.
Something like this fix the problem:

val yourRoutes = cors() {
       path("ping") {
           get {
               complete("pong")
           }
       } ~
       path("pong") {
           get {
               throw new Exception("BOOM!!!")
           }
       }
}

val route: Route =
   handleRejections(corsRejectionHandler){
      cors(corsSettings){
         handleRejections(RejectionHandler.default){ //or your handler
            yourRoutes
         }
      }
  }


Close applications via .env var

This adds a switch for closing applications via the config file.

@Pinpickle She's all yours

Looking good 👍


Indentation Bug (Reordering)

Indent list items one after the other as shown in this video: https://streamable.com/97t26
When you indent number 5 it jumps into the wrong position. The same is true for the following list items.
Here's a gomix for reproduction:

https://big-keeper.gomix.me
https://gomix.com/#!/project/big-keeper

Thank you, this is fixed in 0.5.6 ! Your indication on how to reproduce were very welcome :D


Use New-NetNat instead of SharedAccess to make wi-fi hotspot work

Recently I found that once wireguard server's NAT is enable, I will not able to create a  wi-fi hotspot with Internet access.
Why should not use SharedAccess ?
This service is made for hotspot and can only support one NAT instance, meaning that, you will not able to set up a Wi-Fi hotspot with Internet access because SharedAccess services has been occupied by wireguard server's NAT
However, with New-NetNat command, you'll able to set up many NAT instances and keep wi-fi hotspot work.
How to set up NAT with New-NetNat?
Requirements:

Windows 10 Anniversary Update or later
Hyper-V is enabled (But you can set hypervisorlaunchtype to off in bcdedit if you dont want to use hyper-v!)

Disable Internet sharing first.

Then, open powershell with admin permission
# First, get your interface index of wg_server interface
Get-NetAdapter
# Give a IP to wg_server interface
New-NetIPAddress -IPAddress <IP_ADDRESS> -PrefixLength 24 -InterfaceIndex 68 # Your interface index here
New-NetNat -Name wgservernat -InternalIPInterfaceAddressPrefix <IP_ADDRESS>/24 # Your NAT name and interface CIDR here
Get-NetNat #

For test purpose, you can disable SharedAccess  service and will find that NAT is working still .

For more information, check this article
Please note New-NetIPAddress should be executed every time you reboot

Hey @kenvix, thanks for sharing this! There have been numerous issues with SharedAccess, including the limitation of only one shared network at a time, so I like the idea of New-NetNat. SharedAccess should still be supported for older versions of Windows.
I can't promise that this will be added any time soon, but I appreciate the suggestion.

Update: There no is need for hyper-v installation (Win10 10.0.19044)
Additionally, a powershell script for someone who want to execute New-NetIPAddress automatically at startup:
#Requires -RunAsAdministrator
$ifName = "wg_server"
function Get-IfIndex() {
    return (Get-NetAdapter | Where -Property Status -eq 'Up' | Where -Property Name -Like $ifName | select -ExpandProperty ifIndex -first 1)
}
$ifIndex = Get-IfIndex
while ( $ifIndex -eq $null -Or $ifIndex  -eq "" ) {
    echo "Waiting interface $ifName up ..."
    sleep 3s
    $ifIndex = Get-IfIndex
}
echo "$ifName Interface index is $ifIndex"
echo "Setting up IpAddr"
New-NetIPAddress -IPAddress <IP_ADDRESS> -PrefixLength 24 -InterfaceIndex $ifIndex
exit 0

Thanks @kenvix!


chocolateygui does not present all updates seen in "choco outdated"

When I type 'choco outdated' on cmd, the console has more updates than chocolateygui. In the past occurr sometimes. Example: today when running choco outdated it presented an update for atom and firefox. For chocolateygui only warned that the firefox needs to be updated.
Thanks.

I have the same problem. choco outdated shows:
Chocolatey v0.10.15
Outdated Packages
 Output is package name | current version | available version | pinned?

androidstudio|<IP_ADDRESS>|<IP_ADDRESS>|false
tortoisegit|<IP_ADDRESS>|<IP_ADDRESS>|false

but ChocolateyGUI 0.16.0 shows nothing.

Same problem here, noticed that on different machines.
choco outdated lists more packages which are out of date than visible as outdated in the GUI.
Using ChocolateyGUI v0.17.2 and Chocolatey v0.10.15

Found out while debugging that choco console shows updates for side by side packages - choco GUI doesn't

@Sam13 it would help if you can provide a full set of steps to reproduce for the issue that you are seeing. Exactly what steps have you taken to get to where you are?

@gep13 I just launched the debugger when the output of choco outdated and list of upgradable packages in choco GUI differs.
A current example is the package vscode which was installed with the command choco install -y vscode some time ago.

In the class PackageViewModel I created a conditional breakpoint in the getter of the CanUpdate property.
This shows that the flag IsSideBySide is true which prevents the possible update:

I did not manage how to determine more details about the side by side status in the command line to dig into that further...


FormOptions.PromptFieldsWithValues skip fields

I am using FormOptions.PromptFieldsWithValues
when during the chat I go back few fields (using back command) to correct some entry and I either provide new value or type 'c' , flow than skips fields with values and jumps to the first field for which there is no value. I think this is not consistent with PromptFieldsWithValues (or at least expected from me ) behavior

This is by design.  PromptFieldsWithValues is only about how the initial state passed in is treated.  Once someone has entered or confirmed a value we treat that as done--they can always navigate to the field if they really want to change it.


Test payments with HODL invoices

Description
This PR replaces the testSendPayment function by wrapping sendPayment with code that actually attempts to pay an invoice.
That invoice is a HODL invoice and when it is held, we cancel it and return success. If the payment is not received within a timeout, or if the wallet throws an error first, the test fails and the wallet is not attached.
However, I realized that payments might also fail because it has insufficient balance. The wallet should still get attached in that case, see TODO.
TODO:

[x] ~how to attach wallet if payment fails due to insufficient balance? can we assume and parse the error message?~ update: we will log errors as warnings and not block attachment
[x] make sure logger in sendPayment is optional in every wallet
[ ] make sure we use any config returned by sendPayment (or find an alternative solution for LNC)
[ ] test all wallets

Based on #1340
Additional Context
Wallets that can't pay regtest invoices like phoenixd or Blink will not be attachable during development.
Update: test payments will only be used to indicate to the user that something might be wrong but it will not block attachments. We should show errors during test payments as warnings.
Checklist
Are your changes backwards compatible? Please answer below:

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:

For frontend changes: Tested on mobile? Please answer below:

Did you introduce any new environment variables? If so, call them out explicitly here:

Mhh, this PR would be ready for review if it wouldn't be for this bug that I can't explain yet:
For some reason, NWC test payments sometimes fail with incorrect_payment_details. This is usually thrown when an invoice is canceled. Afaict, this means that something is canceling the invoice but it's not our code.
This only happens for test payments. Payments created to pay for an action always succeed. When I print the bolt11 for a test payment in the console and pay it manually with sndev stacker_lndcli payinvoice <bolt11> and sndev sn_lndcli settleinvoice <preimage>, it works as expected.

video
https://github.com/user-attachments/assets/80fea727-9682-401b-a38f-d84add521c63

Sample invoice flow logs in worker
event invoice_updated triggered with args {
  chain_address: undefined,
  cltv_delta: 80,
  confirmed_at: undefined,
  confirmed_index: undefined,
  created_at: '2024-09-04T05:27:20.000Z',
  description: 'Funding @test01 on stacker.news',
  description_hash: undefined,
  expires_at: '2024-09-04T05:30:20.000Z',
  features: [
    { bit: 9, is_known: true, is_required: false, type: 'tlv_onion' },
    {
      bit: 14,
      is_known: true,
      is_required: true,
      type: 'payment_identifier'
    },
    {
      bit: 17,
      is_known: true,
      is_required: false,
      type: 'multipath_payments_v0'
    }
  ],
  id: '9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003',
  index: 195,
  is_canceled: undefined,
  is_confirmed: false,
  is_held: undefined,
  is_private: false,
  is_push: undefined,
  mtokens: '1000',
  payment: 'd06927af302cdf429635d423091b441d41ace08070cf5db960af9acba97e81ec',
  payments: [],
  received: 0,
  received_mtokens: '0',
  request: 'lnbcrt10n1pnd0macpp5jejuc99nfdwlgtjktd38mmcmm73t7esd5aahp3eh4cml68rc6qpsdpjge6kuerfdenjqsr5v4ehgvp3yphkugrnw3skx6m9wghxuethwvcqzzsxqz95sp56p5j0tes9n0599346s3sjx6yr4q6ecyqwr84mwtq47dvh2t7s8kq9qyyssqh4903ykmm7qf0lpjnrt9f7gtkz2wgd
wxnkmcd7hqrrvtqsc4nnhkhvywf0uv230zr2f6penacc0ufssx9eg8c902pt823ngsc53cn0spyxksdx',
  secret: '',
  tokens: 1
}
event hodl_invoice_updated triggered with args {
  chain_address: undefined,
  cltv_delta: 80,
  confirmed_at: undefined,
  confirmed_index: undefined,
  created_at: '2024-09-04T05:27:20.000Z',
  description: 'Funding @test01 on stacker.news',
  description_hash: undefined,
  expires_at: '2024-09-04T05:30:20.000Z',
  features: [
    { bit: 9, is_known: true, is_required: false, type: 'tlv_onion' },
    {
      bit: 14,
      is_known: true,
      is_required: true,
      type: 'payment_identifier'
    },
    {
      bit: 17,
      is_known: true,
      is_required: false,
      type: 'multipath_payments_v0'
    }
  ],
  id: '9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003',
  index: 195,
  is_canceled: undefined,
  is_confirmed: false,
  is_held: undefined,
  is_private: false,
  is_push: undefined,
  mtokens: '1000',
  payment: 'd06927af302cdf429635d423091b441d41ace08070cf5db960af9acba97e81ec',
  payments: [],
  received: 0,
  received_mtokens: '0',
  request: 'lnbcrt10n1pnd0macpp5jejuc99nfdwlgtjktd38mmcmm73t7esd5aahp3eh4cml68rc6qpsdpjge6kuerfdenjqsr5v4ehgvp3yphkugrnw3skx6m9wghxuethwvcqzzsxqz95sp56p5j0tes9n0599346s3sjx6yr4q6ecyqwr84mwtq47dvh2t7s8kq9qyyssqh4903ykmm7qf0lpjnrt9f7gtkz2wgd
wxnkmcd7hqrrvtqsc4nnhkhvywf0uv230zr2f6penacc0ufssx9eg8c902pt823ngsc53cn0spyxksdx',
  secret: '',
  tokens: 1
}
Trace: checkInvoice:: 9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003
    at checkInvoice (file:///app/worker/wallet.js:116:11)
    at EventEmitter.<anonymous> (file:///app/worker/wallet.js:100:15)
    at EventEmitter.emit (node:events:514:28)
    at EventEmitter.emit (node:domain:489:12)
    at invoiceUpdated (/app/node_modules/lightning/lnd_methods/invoices/subscribe_to_invoice.js:116:50)
    at ClientReadableStreamImpl.<anonymous> (/app/node_modules/lightning/lnd_methods/invoices/subscribe_to_invoice.js:120:14)
    at ClientReadableStreamImpl.emit (node:events:514:28)
    at ClientReadableStreamImpl.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client.js:347:24)
    at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:315:178)
    at <anonymous> (/app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:175:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
invoice not found in database 9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003
event hodl_invoice_updated triggered with args {
  chain_address: undefined,
  cltv_delta: 80,
  confirmed_at: undefined,
  confirmed_index: undefined,
  created_at: '2024-09-04T05:27:20.000Z',
  description: 'Funding @test01 on stacker.news',
  description_hash: undefined,
  expires_at: '2024-09-04T05:30:20.000Z',
  features: [
    { bit: 9, is_known: true, is_required: false, type: 'tlv_onion' },
    {
      bit: 14,
      is_known: true,
      is_required: true,
      type: 'payment_identifier'
    },
    {
      bit: 17,
      is_known: true,
      is_required: false,
      type: 'multipath_payments_v0'
    }
  ],
  id: '9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003',
  index: 195,
  is_canceled: undefined,
  is_confirmed: false,
  is_held: true,
  is_private: false,
  is_push: undefined,
  mtokens: '1000',
  payment: 'd06927af302cdf429635d423091b441d41ace08070cf5db960af9acba97e81ec',
  payments: [
    {
      canceled_at: undefined,
      confirmed_at: undefined,
      created_at: '2024-09-04T05:27:24.000Z',
      created_height: 1617,
      in_channel: '1617x23x1',
      is_canceled: false,
      is_confirmed: false,
      is_held: true,
      messages: [],
      mtokens: '1000',
      pending_index: 1,
      timeout: 1700,
      tokens: 1,
      total_mtokens: '1000'
    }
  ],
  received: 1,
  received_mtokens: '1000',
  request: 'lnbcrt10n1pnd0macpp5jejuc99nfdwlgtjktd38mmcmm73t7esd5aahp3eh4cml68rc6qpsdpjge6kuerfdenjqsr5v4ehgvp3yphkugrnw3skx6m9wghxuethwvcqzzsxqz95sp56p5j0tes9n0599346s3sjx6yr4q6ecyqwr84mwtq47dvh2t7s8kq9qyyssqh4903ykmm7qf0lpjnrt9f7gtkz2wgd
wxnkmcd7hqrrvtqsc4nnhkhvywf0uv230zr2f6penacc0ufssx9eg8c902pt823ngsc53cn0spyxksdx',
  secret: '',
  tokens: 1
}
Trace: checkInvoice:: 9665cc14b34b5df42e565b627def1bdfa2bf660da77b70c737ae37fd1c78d003
    at checkInvoice (file:///app/worker/wallet.js:116:11)
    at EventEmitter.<anonymous> (file:///app/worker/wallet.js:100:15)
    at EventEmitter.emit (node:events:514:28)
    at EventEmitter.emit (node:domain:489:12)
    at invoiceUpdated (/app/node_modules/lightning/lnd_methods/invoices/subscribe_to_invoice.js:116:50)
    at ClientReadableStreamImpl.<anonymous> (/app/node_modules/lightning/lnd_methods/invoices/subscribe_to_invoice.js:120:14)
    at ClientReadableStreamImpl.emit (node:events:514:28)
    at ClientReadableStreamImpl.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client.js:347:24)
    at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:315:178)
    at <anonymous> (/app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:175:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Logs generated running this patch with console.log and cancel by us excluded
diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js
index 03965f6a..9d3c2c81 100644
--- a/api/resolvers/wallet.js
+++ b/api/resolvers/wallet.js
@@ -415,6 +415,7 @@ const resolvers = {
       if (!timingSafeEqual(Buffer.from(hmac), Buffer.from(hmac2))) {
         throw new GraphQLError('bad hmac', { extensions: { code: 'FORBIDDEN' } })
       }
+      console.log('cancelInvoice::', hash)
       await finalizeHodlInvoice({ data: { hash }, lnd, models, boss })
       return await models.invoice.findFirst({ where: { hash } })
     },
diff --git a/wallets/index.js b/wallets/index.js
index eaca1f7c..179d63a1 100644
--- a/wallets/index.js
+++ b/wallets/index.js
@@ -182,11 +182,12 @@ function useConfig (wallet) {

     logger.info('sending test payment:', `payment_hash=${inv.hash}`)

+    let invHeldPromise, paymentPromise
     try {
-      const paymentPromise = wallet.sendPayment(inv.bolt11, config, context)
+      paymentPromise = wallet.sendPayment(inv.bolt11, config, context)

       // test is successful if invoice is held
-      const invHeldPromise = invoice.waitUntilPaid({
+      invHeldPromise = invoice.waitUntilPaid({
         id: inv.id,
         waitFor: inv => inv.isHeld
       })
@@ -207,11 +208,12 @@ function useConfig (wallet) {
       // which we will never do for test payments
       logger.ok('test payment received')
     } catch (err) {
+      console.log(invHeldPromise, paymentPromise)
       // test payment failures are not blocking attachment,
       // we only want to let the user know that there _might_ be an issue
       logger.warn('test payment failed:', err.message)
     } finally {
-      await invoice.cancel(inv)
+      // await invoice.cancel(inv)
     }
   }, [invoice, wallet])

diff --git a/wallets/nwc/index.js b/wallets/nwc/index.js
index 254ac428..e980e936 100644
--- a/wallets/nwc/index.js
+++ b/wallets/nwc/index.js
@@ -72,6 +72,8 @@ export async function nwcCall ({ nwcUrl, method, params }, { logger, timeout } =
     const decrypted = await nip04.decrypt(secret, walletPubkey, response.content)
     const content = JSON.parse(decrypted)

+    console.log(content)
+
     if (content.error) throw new Error(content.error.message)
     if (content.result) return content.result

diff --git a/worker/index.js b/worker/index.js
index 759d6ad7..3387d09d 100644
--- a/worker/index.js
+++ b/worker/index.js
@@ -88,7 +88,7 @@ async function work () {

   if (isServiceEnabled('payments')) {
     await subscribeToWallet(args)
-    await boss.work('finalizeHodlInvoice', jobWrapper(finalizeHodlInvoice))
+    // await boss.work('finalizeHodlInvoice', jobWrapper(finalizeHodlInvoice))
     await boss.work('checkPendingDeposits', jobWrapper(checkPendingDeposits))
     await boss.work('checkPendingWithdrawals', jobWrapper(checkPendingWithdrawals))
     await boss.work('autoDropBolt11s', jobWrapper(autoDropBolt11s))
diff --git a/worker/wallet.js b/worker/wallet.js
index 4ffdaf88..f5845eb1 100644
--- a/worker/wallet.js
+++ b/worker/wallet.js
@@ -113,6 +113,7 @@ function subscribeToHodlInvoice (args) {
 }

 export async function checkInvoice ({ data: { hash }, boss, models, lnd }) {
+  console.trace('checkInvoice::', hash)
   const inv = await getInvoice({ id: hash, lnd })

   // invoice could be created by LND but wasn't inserted into the database yet
@@ -371,6 +372,7 @@ export async function autoDropBolt11s ({ models, lnd }) {
 // The callback subscriptions above will NOT get called for JIT invoices that are already paid.
 // So we manually cancel the HODL invoice here if it wasn't settled by user action
 export async function finalizeHodlInvoice ({ data: { hash }, models, lnd, boss, ...args }) {
+  console.log('finalizeHodlInvoice::', hash)
   const inv = await getInvoice({ id: hash, lnd })
   if (inv.is_confirmed) {
     return
@@ -398,6 +400,8 @@ export async function finalizeHodlInvoice ({ data: { hash }, models, lnd, boss,
     return
   }

+  console.log('cancelHodlInvoice::', hash)
+
   await cancelHodlInvoice({ id: hash, lnd })
   // sync LND invoice status with invoice status in database
   await checkInvoice({ data: { hash }, models, lnd, ...args })
@@ -410,8 +414,8 @@ export async function checkPendingDeposits (args) {
     try {
       await checkInvoice({ data: { hash: d.hash }, ...args })
       await sleep(10)
-    } catch {
-      console.error('error checking invoice', d.hash)
+    } catch (err) {
+      console.error('error checking invoice', d.hash, err)
     }
   }
 }

Is it expiring?

Is it expiring?

No, it has the normal expiry of 3 minutes and when it is held, it's down to 60 seconds but the error is thrown before

I'll try to pull this today and look at it

I this is caused because --allow-self-payments is not set in lnd and the destination rejects the payment.

I this is caused because --allow-self-payments is not set in lnd and the destination rejects the payment.
Edit: Actually, that might be unrelated.

Yes, unrelated, it should then fail every time and it's not a circular payment since it goes from stacker_lnd to sn_lnd. It also only happens with NWC (afaict even though it doesn't make sense to me) and not with LNbits but they use the same node.
Does this mean you were able to reproduce the bug?

Does this mean you were able to reproduce the bug? Not necessarily consistently, but it at least also happened on your machine at least once?

I was getting that invalid payment details message because I was doing p2p noncustodial zap to the same node. It was exactly as you described - an unexpected cancelation of the invoice.


Build fails using dmd git master

Build currently fails as
pushd >/dev/null ~/Work/justd/knetquery && \nice -n 0 /home/per/opt/x86_64-unknown-linux-gnu/dmd/bin/dub --compiler=dmd
WARNING: A deprecated branch based version specification is used for the dependency gfm. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
Selected package derelict-sdl2 1.2.7 does not match the dependency specification in package gfm:sdl2 (1.2.8). Need to "dub upgrade"?
Target logger 0.3.0 is up to date. Use --force to rebuild.
Target derelict-util 1.0.3 is up to date. Use --force to rebuild.
Target derelict-enet 1.3.10 is up to date. Use --force to rebuild.
Target gfm:enet ~master is up to date. Use --force to rebuild.
Building gfm:math ~master configuration "library", build type debug.
Running dmd...
../../../.dub/packages/gfm-master/math/gfm/math/quaternion.d(85): Error: template gfm.math.quaternion.Quaternion!float.Quaternion.opCast does not match any template declaration
../../../.dub/packages/gfm-master/math/gfm/math/quaternion.d(262): Error: template instance gfm.math.quaternion.Quaternion!float error instantiating
../../../.dub/packages/gfm-master/math/gfm/math/quaternion.d(85): Error: template gfm.math.quaternion.Quaternion!double.Quaternion.opCast does not match any template declaration
../../../.dub/packages/gfm-master/math/gfm/math/quaternion.d(263): Error: template instance gfm.math.quaternion.Quaternion!double error instantiating
FAIL ../../../.dub/packages/gfm-master/.dub/build/library-debug-linux.posix-x86_64-dmd_2067-9ECF61644CE4AE9C389510415351E78D/ gfm_math staticLibrary
Error executing command run:
dmd failed with exit code 1.

Is anybody working on this or should I try fixing it myself in a PR?

This should be fixed as of 2.0.13+ (apart from gfm:assimp which is waiting on upstream)


Feature : Position coordinates of mouse in scene shown in status bar.

Operating system or device - Godot version:
Windows 8.1
Godot v.2.1.stable
Issue description (what happened, and what was expected):
Whenever I want to place an instance in a scene, right now I have to do that approximately as I can't say which is the center and everything. So it would be better to show the mouse coordinates in some type of status bar or on bottom right of scene.
And also one more thing that can be done is when resizing an instance and the size shown somewhere in realtime of resizing.
Steps to reproduce:
Link to minimal example project (optional but very welcome):

I implemented something like this in my local build some time ago, it shows mouse coordinates in grid units and the tile under the mouse. It may need some polishing I think, but it works ^^ I'll make a PR.

YES, have wanted this for so long!
+1 is not enough!
(I hope it won't be just for tilemap... having to place Position2Ds to judge position is very clunky)

Another Vote for this feature. Is especially useful in developing hidden object & adventure games.

isn't this solved with the 2D Editor Rulers?

Maybe instead of putting it on bottom of the editor, do it more contextually - like - display X,Y near the cursor as some kind of transparent hint. Same for resizing - then you could focus solely on your action, and no switching your sight back and forth.

@dreamsComeTrue I think it makes sense to display the selected node's coordinates while moving or resizing something, as it already causes the editor to redraw continuously.
However, we can't always display the mouse cursor coordinates as this would cause unnecessary redrawing, which is problematic for Godot users on laptops.

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


Why X.class?

I love your approach! This is the way to go for those who, like me, don’t like sneaky throws.
I just reviewed several popular SO questions that deal with the “streams and checked exceptions” issue, and found only your library as a solution for those who want no library that sneaky throw among their dependencies, among the ones that these questions reference (though I may have missed some):

Java 8: How do I work with exception throwing methods in streams?
Java 8: Lambda-Streams, Filter by Method with Exception
Aggregate runtime exceptions in Java 8 streams
How can I throw CHECKED exceptions from inside Java 8 streams?

Now to my question. Why do you require a class parameter designating the exception thrown, when creating a ThrowingStream? This seems unnecessary to me, and makes usage less elegant from the caller’s point of view. At least, the example in the wiki can be modified so as to avoid usage of the parameter Class<X> x in the StreamAdapter constructor (I just did it). Is there something that has escaped me?

It's been a while since I wrote this code, so I don't remember the original reason (has it really been 5+ years, ouch).
I think it's to maintain type-safety with the checked exception. Java doesn't let you catch/throw exceptions generically, you need an actual class instance to do it. The following isn't allowed:
try {
  ...
} catch (X e) {
  ...
}

Instead you have to do something like:
try {
  ...
} catch (Throwable e) {
  if (x.isInstance(e)) {
    X exception = x.cast(e);
    ...
  } else {
    ...
  }
}

What did you do to get rid of the parameter in StreamAdapter?

It's been a while since I wrote this code, so I don't remember the original reason (has it really been 5+ years, ouch).
I think it's to maintain type-safety with the checked exception. Java doesn't let you catch/throw exceptions generically, you need an actual class instance to do it. The following isn't allowed:
try {
  ...
} catch (X e) {
  ...
}

Instead you have to do something like:
try {
  ...
} catch (Throwable e) {
  if (x.isInstance(e)) {
    X exception = x.cast(e);
    ...
  } else {
    ...
  }
}

What did you do to get rid of the parameter in StreamAdapter?

try {
  ...
} catch (RuntimeException e) {
  throw e;
} catch (Exception e) {
  // here we know that e is of type X, because 1) e is a checked exception and 2) what we call in the try can only throw X as a checked exception. This requires an annotation for defusing safety warning of the compiler, but it is provably safe by construction.
  X exception = (X) e;
  …
}

This works because

try {
  ...
} catch (RuntimeException e) {
  throw e;
} catch (Exception e) {
  // here we know that e is of type X, because 1) e is a checked exception and 2) what we call in the try can only throw X as a checked exception. This requires an annotation for defusing safety warning of the compiler, but it is provably safe by construction.
  X exception = (X) e;
  …
}

This works because

I'd rather be safe than sorry in that situation. Getting a ClassCastException because someone did a sneaky throw would be pretty annoying to debug

There would be no ClassCastException in such a situation, IMHO: the runtime would simply throw the exception. The cast serves no other purpose than satisfying the compiler.

Also X extends Throwable, so if someone used an exception type that inherited from RuntimeException, this might not work as expected (it's possible it does, but it's not a case I've considered). I suppose we could restrict X to X extends Exception to get around this.

I don’t understand. Which problem would that cause? Also, an exception type that inherits from RuntimeException also extends Exception, so how is the restriction getting around this? Did you mean, “if someone used an exception type that inherited from Throwable but that is not an Exception”? Which problem would that cause?

I'm not against improving this API to make it more usable, I'm just not going to have the time to do it. I'd be happy to review PRs if you're feeling up to it

Thanks for your replies so far and willingness to review. TBH currently I am rather discouraged by the size of the library. I  consider implementing only pieces of it for my own use for the moment, and later perhaps release an improvement to it, or even a totally new one that would be more modest. Anyway the API would be incompatible, I suppose.
Speaking of this, I am very surprised to see that ThrowingStream seems to be used by zero Maven artifacts, according to mvnrepositories. Is this correct? I find it hard to believe that there would be no open source library for such a use case that would be popular among Maven publishers. Perhaps another one is getting the favor of the users? Do you know of any library similar to yours, i.e. that helps working with streams and checked exceptions but without sneaky throws?
Also, relatedly, you posted somewhere that your library uses Brian Goetz’s recommended approach, or something similar. I have read his opinion (voiced numerous times) against sneaky throws, but I am not aware that he recommended a specific approach to solve the problem, similar to what this library does. Do you have a pointer supporting this? I’d be most curious to read his thoughts.

I'd rather be safe than sorry in that situation. Getting a ClassCastException because someone did a sneaky throw would be pretty annoying to debug

There would be no ClassCastException in such a situation, IMHO: the runtime would simply throw the exception. The cast serves no other purpose than satisfying the compiler.

Also X extends Throwable, so if someone used an exception type that inherited from RuntimeException, this might not work as expected (it's possible it does, but it's not a case I've considered). I suppose we could restrict X to X extends Exception to get around this.

I don’t understand. Which problem would that cause? Also, an exception type that inherits from RuntimeException also extends Exception, so how is the restriction getting around this? Did you mean, “if someone used an exception type that inherited from Throwable but that is not an Exception”? Which problem would that cause?

I'm not against improving this API to make it more usable, I'm just not going to have the time to do it. I'd be happy to review PRs if you're feeling up to it

Thanks for your replies so far and willingness to review. TBH currently I am rather discouraged by the size of the library. I  consider implementing only pieces of it for my own use for the moment, and later perhaps release an improvement to it, or even a totally new one that would be more modest. Anyway the API would be incompatible, I suppose.
Speaking of this, I am very surprised to see that ThrowingStream seems to be used by zero Maven artifacts, according to mvnrepositories. Is this correct? I find it hard to believe that there would be no open source library for such a use case that would be popular among Maven publishers. Perhaps another one is getting the favor of the users? Do you know of any library similar to yours, i.e. that helps working with streams and checked exceptions but without sneaky throws?
Also, relatedly, you posted somewhere that your library uses Brian Goetz’s recommended approach, or something similar. I have read his opinion (voiced numerous times) against sneaky throws, but I am not aware that he recommended a specific approach to solve the problem, similar to what this library does. Do you have a pointer supporting this? I’d be most curious to read his thoughts.


realm: batching of profiling responses

Right now, every profiling measurement request is handled by a separately-spawned task, which probably isn't great for profiling overhead.  Consider (optionally) batching responses by target proc and task ID.  Changes to the body of the profiling tasks would be needed, but should be minimal.

Still desirable?

It would probably still help minimize profiling overhead, but it is a "nice to have" and not "essential" feature as we've clearly been living with it for a while now.


viewport in 2d no affect

Godot 3.0 rc1
subscene like this :

and i tried to add a viewport into another scene like this(Node2D is the subscene above)

but, if i moved ths Node2D down to the viewport,

it shows nothing.
I found the demo in 2.1 (split screen platformer, and the demos has been removed now on github) works well, but when i changed into v3.0, the viewport just has no effect.So does v3.0 get another way to handle this ? or just a bug?

Put the ViewportContainer node as parent, any control does not work anymore.

Seems like this is already documented. I mean, the documentation only mentions ViewportContainers, not Controls.
Unless the proper fix would be explicitly saying that Control nodes no longer work this way?

Closing as per above comment. I don't think people would try to use Controls anymore.


add appsettings.local.json to gitignore

this file is used by asp.net developers when testing local app settings w/o checking them in to source control. save some future headache by adding this to gitignore now

cc @cleemullins


Implement flatten layer functionality

Flatten layer would get the final result of the analysis workflow and create a dataset with that (which will be plugged as data source to the layer). This would have to cartodby the dataset so it appears on the user's datasets list.
@urbanphes can you attach an image of the UI for reference?
This is very important since some analysis need to be persisted very often, such as georeference.
SMOKE_AN14

Here the visual designs

From

To

@urbanphes just thinking on a tweak for this. Flattering a layer means merging all analysis steps into a single dataset. When doing so, sometimes you want to create a copy of the data, but sometimes you would just like to override the actual dataset with the processed one (like in most ETL workflows). What about adding that option to the modal?

We can give this possibility before flattening the layer, here you can the visual:

uhm... that seems wrong. .CARTO doesn´t make sense here. I was expecting two options.

@javierarce you know what I mean?

I imagine that we want to have two options:

Flatten and replace layer
Flatten into a new layer

Using the screenshot as an example, in the first case we'll have layers A and B (except B will be the result of the flatten operation), while in the second case we'll have layers A, B and C (with C being the result of the operation).

yep
exactly

Hey, the visual the screen modal. The user have two options to choose as a radio buttons. In this way we have only one button for main action.

Like the solution, but remember the difference between layers (representación of dataset on maps) and datasets.

Modify the copy.

You did the opposite way.
When you flatten a layer this is what happens behind the scenes:
A. Replace dataset
The original dataset gets overrided with the result of all the analysis worklfow. The analysis nodes dissapear and the layer is just the datasource.
A. Create new dataset
The original dataset keeps intact. The result of the analysis workflow gets materialized as a new dataset. The analysis nodes dissapear and the layer is just the NEW datasource.

Here the visual taking into account the feedback. Using the tooltip component (as a analysis configuration) we can give some of the explanation about each method.
Modal

Modal + tooltip

Like it!

Hey @javierarce, do you mind if we pass this issue to @MariaCheca in order to unblock you with "style by icon" thing? 💋

Yeah, no problem 👍

Moved to Salardú, because the previous one @MariaCheca should support Style-with-icons feature with @gfiorav and @javierarce.

Pushing again this one

Stale issue. Closing 👋


Use 1.27.1 version of Fabric plugin

What has been done

Use 1.27.1 version of Fabric plugin. Not willing to update to a higher version at this point as it causes other compilation issues and requires more changes.

Build on bitrise is failing due ANDROID_NDK_HOME not being properly unset.
The temporary fix would be run build commands via shell step as
unset ANDROID_NDK_HOME

./gradlew assembleDebug testDebug jacocoTestReport checkstyle pmd jdepend lintDebug buildDashboard assembleDebugAndroidTest crashlyticsUploadDistributionDebug -PversionCode=$BITRISE_BUILD_NUMBER -PfabricApiKey=$FABRIC_API_KEY -PfabricApiSecret=$FABRIC_API_SECRET

As per Krisztián Gödrei (godrei)

the problem is that steps are running in separate shell sessions, so a step can not modify the parent's environemnt, thats why we introduced envman. But envman has no feature to unset envs, envman can only clear envs, but it turned out that it is not enough, the ANDROID_NDK_HOME needs to be fully removed from the env set

No ETA when it's going to be fixed on bitrise side. Will need consider whether it makes sense to have workaround implemented or wait for official fix from bitrise.

Coverage remained the same at 100.0% when pulling 96705be347a8335c7f6a1504f7438036e8f54e38 on update-fabric-plugin-version into 1d39aead0d868fd606007b377f596c1ccf077e68 on master.

Bitrise issue (https://github.com/vgaidarji/ci-matters/pull/31#issuecomment-538321356) will be addressed separately.


Mobile copy with formatting between different flutter quill editors

I have 2 flutter quill text editors next to each other, can someone explain to me how I can change the code so that when I copy from one editor to the other, it copies the formatting together?

I already have tried to run example of this. And I can copy from Home page and pasted to read only page. So, I thinks this can copy paste from 2 quill editors each other.

No. It did not copy the formatting. Before, when the user selects a paragraph and copies it, the Quill will copy the format into a variable, and when the user pastes it, Quill will merge it. (Look at the picture)
However, now the variable is not used, you only copy the text and paste it.
If you want to implement this feature, I can help you, naturally, I can't give you my code (Company policies)

@hoangsang17th  can you please help me? I want to implement it.

The current version does not have this problem. Copying formatted text between editors is supported.
If the problem still exists, please reopen and let us know how to reproduce the program.


[Java API] Remove Kuzu prefix from class names

Since the Java API is encapsulated in com.kuzudb package, there is no need to add the Kuzu prefix for class names. We should remove it for simplicity.

Removed the Kuzu prefix in Java API for kuzu/ldbc_snb_interactive_v1_impl/ldbc_finbench_transaction_impls repositories.


Log what we are preempting and what will run instead

This change will make it easier for us to understand the choices the rebalancer is making so we can audit it.

Ready for another round of review

@wyegelwel have some open responses above.


LastInsertID method for non-int-ID nodes

[x] The issue is present in the latest release.
[x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯
Cant convert non-int ID field (like string, or custom type) to desired value.
https://github.com/facebook/ent/blob/master/dialect/sql/sqlgraph/graph.go#L1182-L1200
Expected Behavior 🤔
lastInsertID should respect any type.

@aight8 Which database are you using?
for mysql and sqlite the limitation seems to be on the database/sql result type
I have implemented a fix for postgres in #1104

Yes I'm using postgres. Your PR solves exactly what I meant. thanks!

Hey @aight8,
This is a PostgreSQL thing, and other dialects don't really support this - but I don't mind adding this. Also, I expect that the configuration of the generated ID value was created by other tool (or manually), because ent supports only auto_increment ids for such configuration.
Thanks a lot @cliedeman for sending this patch really quickly. I'll review this.

Closing with #1104

Closed with #1104


It is possible update existing xls file ?

Hi,
i have xls template file with ready calc formulas, it is possible update this file or need create new ?

Yes, check the docs: http://www.maatwebsite.nl/laravel-excel/docs/import#edit