FilePath.resolveNativePath fails after Jan.2016 Security update

fails silently, no errors. Nexus 6p
https://source.android.com/security/bulletin/2016-01-01.html

I see. I guess we'll have to figure out a different way of getting the file path now :/

+1. Love to see support for this.

is there any alternative????

Same issue here, we are trying to get the true path to obtain the filesize however we cannot anymore...

Getting a different error now after Feb. update:
'java.lang.IllegalArgumentException: None of the requested columns can be provided'
Seems that Google is playing around with the file system calls.

Hello guys,
I've solved this issue & the PR is ready to be merged.
Until my fixes are merged, feel free to use my unofficial version release.

Thanks to @TanaseButcaru this is now fixed in 1.0.2.

I'm  still getting the
java.lang.IllegalArgumentException: None of the requested columns can be provided error with 1.0.2.
Does the fix work after the Feb.2016 update? I only got this error after upgrading to Feb.2016 updates.

Please give more details about device, version, location of selected file.

If you could provide a stack trace too that would be great.

Does this still happen?


Redirects not correct & callback URL issue

Oops, something went wrong.

What happened?
Oauth error invalid_request: The redirect_uri is not whitelisted

I've added the https://(your-domain).com/authenticate to the whitelist (with the real domain). Its still coming up with this.
Where on Shopify can I find the callback URL for the app? searched and can't find?
Here is a screenshot of my app settings on Shopify
https://cl.ly/b63caed61cc7
Thanks in advance.

Might be worth putting this in the docs.

Pretty sure it's in the docs I'll have to double check. But yes, as of last year, everything Shopify requires HTTPS :)


Update request-quota-increase-for-openshift-project-set.md

Adding information on ## Steps to request quota increase that advises readers that requests for quota decreases are automatically approved
Removed the area in Step 5 that described: "... if you need to submit photos or files please do so in the next step as it is necessary and part of the request process..."
Confirmed with Artem that Step 6 is still valid

@caggles  can you kindly review the content for the following feedback we received:

[ ] Step 4

""object storage vs pvc, is object storage on openshift or is it somewhere else""

""this is being more descriptive when it comes to pvc, where the ui was not descriptive about it (when it comes to PVC's). "" a week can be a very long time for a development team"" where it mentions to collect data for a week. teams are doing sprint reviews every 2 weeks or 1 week, so this would be frustrating to show that we are collecting data for a week....

""a list of the current config would be nice on the page""""hard to fill out if I have a lot of pods""

would like the example link because they are confused about impact assessment line. ""not sure about this line, scalability"" on the impact assessment line"

[ ] Setting up resource monitoring with Sysdig Monitor

""Readers are confused as to why they need to see this information in the page. Could you perhaps introduce this subject making notion that it is important to read when making adjustments to their quota? This will attempt to clear the why behind adding this topic in this particular document


Can I detect 3 people at the same time?

I'm planning to apply it to my game but I want to have multiple players play at the same time
thank you for help me

no, seems mediapipe only support one person at once...


vnode reference to original component

What problem does this feature solve?
I have two components that are meant to be used together, parent and child. Meaning, the only components allowed in the default slot of the Parent component is the Child component.
I was originally enforcing this check with the following code, after importing the Child component to ChildComponent:
beforeCreate() {
	this.$slots.default.forEach((vnode) => {
		if (
			vnode.componentOptions &&
			vnode.componentOptions.Ctor.extendOptions !== ChildComponent
		) {
			throw new Error('...');
		}
	});
}

This typically works fine, however, I've noticed that it doesn't in the context of my Karma test. vnode.componentOptions.Ctor.extendOptions evaluates to a copy of the component where the main difference seems to be the additional property of _Ctor: { 1: ƒ VueComponent(options) }. (There are other minor differences too, eg. my inject: { name: key } is converted to inject: { name: { from: key } }). I am looking for a for sure way (ideally via strict equality of object references) to ensure that the children of the Parent component are the Child component.
I used BFS to check if the vnode had any other references to ChildComponent but it did not.
What does the proposed API look like?
I'm not opinionated about the API but some sort of reference to the original component accessible from vnode.

Why not giving your component a name and then check if it's a component with that name?
example https://jsfiddle.net/a0eudrj6/

@sqal
Because strings aren't unique.
Like I said in my post, I'm looking for a "for sure way (ideally via strict equality of object references)". We're working on components used by 2nd and 3rd parties so we don't want to risk name collision and also not concern ourselves with it all the time.

You can use custom logic to verify correct component is used in the slot.
Following snippet demos an approach to ensure the type of child components.
// component-types.js
export const ListItemType = Symbol('ListItem)

// ListItem.vue
<script>
import { ListItemType } from './component-types'

export default {
  group: ListItemType
}
</script>

// List.vue
<script>
import { ListItemType } from './component-types'

export default {
    render (h) {
  	const children = this.$slots.default
  	return h('div', {}, children.map(vnode => {
	  if (!vnode.componentOptions || !vnode.componentOptions.Ctor) return vnode
          if (vnode.componentOptions.Ctor.extendOptions.group === ListItemType) return vnode

          console.log(`[Vue Warn]: Invalid use of ${vnode.componentOptions.tag || 'child'} component in Comp.`)

           return vnode
    }))
  }
}
</script>

Working demo: https://jsfiddle.net/znck/7dss4m7k/

@znck
This can definitely be achieved in the user-land, and the issue wasn't opened as a question to find a custom solution. The point of the feature request was to request official support.

I feel that it would increase vue API surface with no additional benefit.
If you think, it should be added to vue, I can reopen the issue.

I think that an extra property to reference the original component will offer a credible and convenient way to confirm the identity and hence integrity of the Vnode at question. If the cost is one property added to the Vnode to gain an official way to assure that the right component is being passed into a Vnode, I think it's a good deal.

@vuejs/collaborators comments on this!

@znck You might want to reopen this if you want a discussion with collaborators. A closed issue in a sea of notifications will be drowned out.
Personally I can't say too much as I don't understand the original problem enough (why the check didn't work in karma etc.) at the moment.

Might be worth noting that the problem occurred when using vue-test-utils v1.0.0-beta.7. However, I'm not filing this as a bug, but as a FR on supporting a way to accurately identify the component of a vnode.

This should work by checking vnode.componentOptions.Ctor !== Vue.extend(ChildComponent)
Vue.extend caches constructors created from raw options.
IMO this use case is too low-level and too specific to create dedicated API for.

@yyx990803
How would you recommend that I identify a vnode's component? Surely, reading into the slot vnodes isn't uncommon, and being able to tell what kind of vnode it is would be useful.
Not sure what you mean with that code snippet as Vue.extend(TableCol) returns a constructor function and vnode.componentOptions.Ctor.extendOptions references an Object -- they would never equal each other.
In my example below, TableCol is ChildComponent.

> Vue.extend(TableCol)

I guessed you may have meant vnode.componentOptions.Ctor.extendOptions._Ctor['1'] === Vue.extend(TableCol) but that didn't evaluate to true when expected either.

FYI, I believe I wasn't able to do a strict equality because of the deep clone in vue-test-utils
Turned off cloning with clone: false.


[dpg][lro] roll back workaround for envelopeResult and logicalResult

Description
Previous in our emitter, we made some workaround due to https://github.com/Azure/typespec-azure/issues/3725. Now it's fixed. We should try to roll back the workaround.

This is covered in #4021

close as it's resolved in #4021


Spyder 2.3.8 vs. Matplotlib 1.5 vs. latex fonts

In the Spyder (v. 2.3.8) IPython Console I get a runtime error from matplotlib ("RuntimeError: In select_charmap: Could not set the charmap") when rendering plots with Latex fonts. To enable the Latex fonts, I use these settings:
plt.rc('text', usetex=True)
plt.rc('font', **{'family':'serif', 'serif':['Times'], 'size':24})

In a normal IPython Console the same plot with Latex labels renders fine, so I suspect the issue is related to the default graphics backend in the Spyder IPython console.
Disabling the latex fonts or downgrading to Matplotlib 1.4.3 both make the problem disappear. Below I have copied the full error traceback.
  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/IPython/core/formatters.py", line 337, in __call__
    return printer(obj)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.py", line 213, in <lambda>
    svg_formatter.for_type(Figure, lambda fig: print_figure(fig, 'svg', **kwargs))

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.py", line 117, in print_figure
    fig.canvas.print_figure(bytes_io, **kw)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2178, in print_figure
    **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_svg.py", line 1206, in print_svg
    return self._print_svg(filename, svgwriter, fh_to_close, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_svg.py", line 1234, in _print_svg
    self.figure.draw(renderer)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1133, in draw
    func(*args)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2304, in draw
    a.draw(renderer)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/axis.py", line 1111, in draw
    tick.draw(renderer)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/axis.py", line 252, in draw
    self.label1.draw(renderer)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/text.py", line 792, in draw
    mtext=mtext)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_svg.py", line 1152, in draw_tex
    self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_svg.py", line 957, in _draw_text_as_path
    return_new_glyphs_only=True)

  File "/data/bs538/installed/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py", line 346, in get_glyphs_tex
    font.select_charmap(charmap_code)

RuntimeError: In select_charmap: Could not set the charmap

Are you sure this is a Spyder bug instead of a Matplotlib one?

Thanks for the quick response. The same code runs fine and produces a figure in a standard IPython console.

Ok, a couple of questions: What's your

Operating system?
Python version?
Matplotlib backend?

Sorry, could have included this information in the first place.

OS: Red Hat Enterprise Linux Workstation release 6.7 (Santiago)
Python version: Python 2.7.10 | Anaconda 2.2.0 (64-bit)| IPython 4.0.0
Matplotlib backend: Inline (Spyder default)

Ok, good. So it's a problem with the SVG backend. i still think this is an issue with Matplotlib instead of Spyder.
Could you post a fully reproducible example to test on my end?

Minimal example:
import matplotlib.pyplot as plt
import numpy as np

plt.rc('text', usetex=True)
plt.rc('font', **{'family':'serif', 'serif':['Times'], 'size':24})

x=np.linspace(-5,5,100)
plt.plot(x,np.sin(x))
plt.savefig('test.png')
plt.show()

Creating and saving the figure works fine, it is displaying it with plt.show() that creates the error.

Seems it might be already fixed in matplotlib 1.5.1: https://github.com/matplotlib/matplotlib/pull/5770#issuecomment-168212746

Great! Thanks for letting us know about it :-)


Error on vignette

Hi @lmweber,
I was trying nnSVG vignette, but I get the following error on this function qclus <- quickCluster(spe) (line 69):
Error in .compute_mean_var(x, block = block, design = design, subset.row = s, : no residual d.f. in any level of 'block' for variance estimation

I think that the problem is in spe <- spe[, colData(spe)$in_tissue == 1] (line 56) because after that no columns remains.
dim(spe)
[1] 33538     0

Do you get the same error too? However, I see that all your Github actions run successfully.
I'm using renv 0.15.4

sessionInfo()

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=it_IT.UTF-8
[4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=it_IT.UTF-8    LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=it_IT.UTF-8       LC_NAME=C                  LC_ADDRESS=C
[10] LC_TELEPHONE=C             LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4    stats     graphics  grDevices datasets  utils     methods   base
other attached packages:
[1] ggplot2_3.3.5               nnSVG_0.99.9                scran_1.22.1
[4] scuttle_1.4.0               STexampleData_1.2.0         ExperimentHub_2.2.1
[7] AnnotationHub_3.2.2         BiocFileCache_2.2.1         dbplyr_2.1.1
[10] SpatialExperiment_1.4.0     SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0
[13] Biobase_2.54.0              GenomicRanges_1.46.1        GenomeInfoDb_1.30.1
[16] IRanges_2.28.0              S4Vectors_0.32.3            BiocGenerics_0.40.0
[19] MatrixGenerics_1.6.0        matrixStats_0.61.0
loaded via a namespace (and not attached):
[1] bitops_1.0-7                  bit64_4.0.5
[3] filelock_1.0.2                httr_1.4.2
[5] tools_4.1.2                   irlba_2.3.5
[7] utf8_1.2.2                    R6_2.5.1
[9] HDF5Array_1.22.1              colorspace_2.0-3
[11] DBI_1.1.2                     rhdf5filters_1.6.0
[13] withr_2.5.0                   tidyselect_1.1.2
[15] BRISC_1.0.4                   bit_4.0.4
[17] curl_4.3.2                    compiler_4.1.2
[19] cli_3.2.0                     BiocNeighbors_1.12.0
[21] DelayedArray_0.20.0           scales_1.1.1
[23] pbapply_1.5-0                 rappdirs_0.3.3
[25] digest_0.6.29                 R.utils_2.11.0
[27] XVector_0.34.0                pkgconfig_2.0.3
[29] htmltools_0.5.2               sparseMatrixStats_1.6.0
[31] fastmap_1.1.0                 limma_3.50.1
[33] rlang_1.0.2                   RSQLite_2.2.10
[35] shiny_1.7.1                   DelayedMatrixStats_1.16.0
[37] generics_0.1.2                BiocParallel_1.28.3
[39] dplyr_1.0.8                   R.oo_1.24.0
[41] RCurl_1.98-1.6                magrittr_2.0.2
[43] BiocSingular_1.10.0           GenomeInfoDbData_1.2.7
[45] Matrix_1.4-0                  munsell_0.5.0
[47] Rcpp_1.0.8                    Rhdf5lib_1.16.0
[49] fansi_1.0.2                   lifecycle_1.0.1
[51] R.methodsS3_1.8.1             yaml_2.3.5
[53] edgeR_3.36.0                  zlibbioc_1.40.0
[55] rhdf5_2.38.0                  grid_4.1.2
[57] blob_1.2.2                    parallel_4.1.2
[59] promises_<IP_ADDRESS>              dqrng_0.3.0
[61] crayon_1.5.0                  lattice_0.20-45
[63] Biostrings_2.62.0             beachmat_2.10.0
[65] KEGGREST_1.34.0               rdist_0.0.5
[67] locfit_1.5-9.5                magick_2.7.3
[69] metapod_1.2.0                 pillar_1.7.0
[71] igraph_1.2.11                 rjson_0.2.21
[73] ScaledMatrix_1.2.0            glue_1.6.2
[75] BiocVersion_3.14.0            renv_0.15.4
[77] BiocManager_1.30.16           vctrs_0.3.8
[79] png_0.1-7                     httpuv_1.6.5
[81] gtable_0.3.0                  RANN_2.6.1
[83] purrr_0.3.4                   assertthat_0.2.1
[85] cachem_1.0.6                  rsvd_1.0.5
[87] DropletUtils_1.14.2           mime_0.12
[89] xtable_1.8-4                  later_1.3.0
[91] tibble_3.1.6                  AnnotationDbi_1.56.2
[93] memoise_2.0.1                 cluster_2.1.2
[95] statmod_1.4.36                bluster_1.4.0
[97] ellipsis_0.3.2                interactiveDisplayBase_1.32.0

Hi @davidecrs , thanks for your interest!
I think this is due to the latest updates in the SpatialExperiment objects in the STexampleData package.
Could you please try updating to the latest versions of the following packages?
remotes::install_github("drighelli/SpatialExperiment")
remotes::install_github("lmweber/STexampleData")
install.packages("BRISC")
remotes::install_github("lmweber/nnSVG")

This package is still a work in progress. I have just submitted it to Bioconductor, so I will probably make some updates as it goes through the Bioconductor review process, and then a more stable version should be available in a few weeks.

Thanks for your answer. With the updated packages it works.


[QUERY] Breaking change in poison queue upgrading storage bindings extension to v5

Library name and version
Microsoft.Azure.WebJobs.Extensions.Storage 5.0
Query/Question
hello team,
We want to migrate to a new extension bundle, which uses the Microsoft.Azure.WebJobs.Extensions.Storage 5.0, but the new breaking change for poison queues on blob trigger make us impossible to have a successful migration.
Nowadays, we use a Function App with many functions which use an input blob trigger and differents storage connection. In previous versions, every error goes to the poison queue of function app storage where a function with a input queue trigger handle this errors, but after version 5.0, each error goes to the storage specified in blob trigger making that it doesn't work.
Is there a way to specify in blob trigger functions the storage connection for poison queue or any other way for having previous behaviour?
Environment
-Functions ~3
-Python 3.8
-Microsoft.Azure.Functions.ExtensionBundle [3.3.0 - 4.0.0) -> Microsoft.Azure.WebJobs.Extensions.Storage 5.0

Hi, guys!  Any news about this?


Clarify the 'promises' exercise instructions

Fix #1331
TODO :

[ ] Make the exercise available again (by removing the wip status)

@joshgoebel Can you have a look whether you think the exercise is ok now?

Let me pull this down and have a look.

Much much better I think.
export const all = (promises) =>
  promises.reduce(
    async (acc, promise) => (await acc).concat(await promise),
    Promise.resolve([])
  );

Just out of curiosity this isn't concurrent, is it?  It seems like each promise stacks, having to wait until the one before it finishes before the array is resolved and then concat for the next item can be called, correct?

Much much better I think.
export const all = (promises) =>
  promises.reduce(
    async (acc, promise) => (await acc).concat(await promise),
    Promise.resolve([])
  );

Just out of curiosity this isn't concurrent, is it? It seems like each promise stacks, having to wait until the one before it finishes before the array is resolved and then concat for the next item can be called, correct?

I'm not used to using reduce with async functions but I have tested this in the browser and it looks like it is CONCURRENT :
let all = (promises) =>
  promises.reduce(
    async (acc, promise) => (await acc).concat(await promise),
    Promise.resolve([])
  );

  let createPromise = () =>
      new Promise((resolve) => {
          setTimeout(() => {
               console.log(performance.now(), "hello");
               resolve();
          }, 1000);
      });

all([createPromise(), createPromise(), createPromise(), createPromise()]).then(() => console.log("finished"));

Result :
2540591.3000000003 'hello'
2540591.5000000005 'hello'
2540591.6 'hello'
2540591.6999999997 'hello'
finished

I must admit I don't quite understand why though (or maybe something is wrong with my test code).

@junedev Should i remove the "wip" status before this gets merged ?

yes please

@TomPradat Are you sure?  You're creating them all at once (in the array creating)... so their setTimeout will be concurrent, that doesn't mean reduce is... I don't see how it can be... it has to wait, one at a time - since array addition is sequential.  Perhaps this doesn't matter in practice though since the time spent in reduce is so small...?

@TomPradat Are you sure? You're creating them all at once (in the array creating)... so their setTimeout will be concurrent, that doesn't mean reduce is... I don't see how it can be... it has to wait, one at a time - since array addition is sequential. Perhaps this doesn't matter in practice though since the time spent in reduce is so small...?

You are perfectly right, I came to the same conclusion after some more thoughts. The reduce is sequential :
let all = (promises) =>
  promises.reduce(
    async (acc, promise) => (await acc).concat(await promise()),
    Promise.resolve([])
  );

  let createPromise = () =>
      new Promise((resolve) => {
          setTimeout(() => {
               console.log(performance.now(), "hello");
               resolve();
          }, 1000);
      });

all([createPromise, createPromise, createPromise, createPromise]).then(() => console.log("finished"));

Note : The difference with the previous sample is that the promise is being created in the reduce instead of being created in the array

Result :
3360643.1999999997 'hello'
3361644.1 'hello'
3362644.6999999997 'hello'
3363645.4 'hello'
finished

So to conclude, the reduce is sequential but it doesn't matter as the promises run in parallel. It adds a small overhead that is probably (IMO) negligible

yes please

Done in ddd27138


Add consumeRetryInterval to the Kafka pubsub component settings table

Per dapr/components-contrib#1241
consumeRetryInterval controls the constant backoff interval for attempting to consume from topics.

resolved


Foreign key is not showing on MySQL while using prisma migrate with update version of prisma 2.10.1

Can check with basic example for mysql,
It will not show the foreign keys in database, checked it manually  in database, earlier it was working (tried in 2.8.0)
checked on:
Server version: 5.6.24 - MySQL Community Server (GPL)

Sample : schema.prisma
generator client {
  provider = "prisma-client-js"
}

datasource postgresql {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model links {
  created_at DateTime?  @default(now())
  id         Int        @id @default(autoincrement())
  user_id    Int
  link_name  String
  posted_by  users      @relation(fields: [user_id], references: [id])
}

model users {
  id                 Int        @id @default(autoincrement())
  created_at         DateTime?  @default(now())
  username           String     @unique
  country            String
  links              links[]
}

cmds run
npx prisma migrate save --name 'add-new-model' --experimental

npx prisma migrate up --experimental

Well It will show an error at end though, (tables were created fine but miss-out Foreign keys if any)
Error: P1014
The underlying table for model `_migration` does not exist.

The underlying case sensitivity issue has been fixed in recent migrate versions. Thanks for the report :) Please open a new issue if something else comes up.


How to access admin page?

I'm trying to get to the admin page on my server (and I'm not currently on my server's network), what do I do to whitelist myself? Running in Docker if that's relevant.
Search brought me to https://github.com/ajanata/PretendYoureXyzzy/issues/165 but the solution seems out of date.

Lucky for you, Ajanta has followed through with adding admins to the build properties.
Unlucky for you, you have to build the project again for it to take effect.
https://github.com/ajanata/PretendYoureXyzzy/blob/master/build.properties.example

Any chance that could be set through Docker environment variables?

Lucky for you, Ajanta has followed through with adding admins to the build properties.
Unlucky for you, you have to build the project again for it to take effect.
https://github.com/ajanata/PretendYoureXyzzy/blob/master/build.properties.example#L16

You can go in and edit the resulting properties file directly without having to do a build.

Any chance that could be set through Docker environment variables?

There is no official Dockerfile, so you'd have to bring that up with whomever is providing it.


Update nano-server.md

Following items edited:
Reset-IISServerManager -confirm:$false
$sm = Get-IISServerManager
When creating a new PR, please do the following and delete this template text:

Reference the issue number if there is one:
Fixes #Issue_Number

The "Fixes #nnn" syntax in the PR description causes
GitHub to automatically close the issue when this PR is merged.

Suggest reviewers if you know who should review the PR, using the GitHub Reviewers UI.

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot


Mixin classes

This PR expands upon #13604 to add support for mixin classes and constructors. The PR includes type system support for the ECMAScript 2015 mixin class pattern described here and here as well as rules for combining mixin construct signatures with regular construct signatures in intersection types.
In the following, the term mixin constructor type refers to a type that has a single construct signature with a single rest argument of type any[] and an object-like return type. For example, given an object-like type X, new (...args: any[]) => X is a mixin constructor type with an instance type X.
A mixin class is a class declaration or expression that extends an expression of a type parameter type. The following rules apply to mixin class declarations:

The type parameter type of the extends expression must be constrained to a mixin constructor type.
The constructor of a mixin class (if any) must have a single rest parameter of type any[] and must use the spread operator to pass those parameters as arguments in a super(...args) call.

Given an expression Base of a parametric type T with a constraint X, a mixin class class C extends Base {...} is processed as if Base had type X and the resulting type is the intersection typeof C & T. In other words, a mixin class is represented as an intersection between the mixin class constructor type and the parametric base class constructor type.
When obtaining the construct signatures of an intersection type that contains mixin constructor types, the mixin construct signatures are discarded and their instance types are mixed into the return types of the other construct signatures in the intersection type. For example, the intersection type { new(...args: any[]) => A } & { new(s: string) => B } has a single construct signature new(s: string) => A & B.
Putting all of the above rules together in an example:
class Point {
    constructor(public x: number, public y: number) {}
}

class Person {
    constructor(public name: string) {}
}

type Constructor<T> = new(...args: any[]) => T;

function Tagged<T extends Constructor<{}>>(Base: T) {
    return class extends Base {
        _tag: string;
        constructor(...args: any[]) {
            super(...args);
            this._tag = "";
        }
    }
}

const TaggedPoint = Tagged(Point);

let point = new TaggedPoint(10, 20);
point._tag = "hello";

class Customer extends Tagged(Person) {
    accountBalance: number;
}

let customer = new Customer("Joe");
customer._tag = "test";
customer.accountBalance = 0;

Effectively, a mixin class declaration is required to pass its constructor arguments through to the abstract base class constructor, and the result is an intersection of the declared class constructor and the base class constructor. For example, adding explicit type annotations to the code above:
interface Tagged {
    _tag: string;
}

function Tagged<T extends Constructor<{}>>(Base: T): Constructor<Tagged> & T {
    return class extends Base {
        _tag: string;
        constructor(...args: any[]) {
            super(...args);
            this._tag = "";
        }
    }
}

const TaggedPoint: Constructor<Tagged> & typeof Point = Tagged(Point);

let point: Tagged & Point = new TaggedPoint(10, 20);
point._tag = "hello";

The type of TaggedPoint is an intersection of two constructor types, Constructor<Tagged> and typeof Point. Since Constructor<Tagged> is a mixin constructor type, its construct signature is "mixed into" the constructor for Point. Thus, TaggedPoint has a single construct signature with the same parameter list as Point but with the return type Tagged & Point.
Mixin classes can constrain the types of classes they can mix into by specifying a construct signature return type in the constraint for the type parameter. For example, the following WithLocation function implements a subclass factory that adds a getLocation method to any class that satisfies the Point interface (i.e. that has x and y properties of type number).
interface Point {
    x: number;
    y: number;
}

const WithLocation = <T extends Constructor<Point>>(Base: T) =>
    class extends Base {
        getLocation(): [number, number] {
            return [this.x, this.y];
        }
    }

Fixes #4890.
Fixes #10261.

I guess we can use multiple mixins this way?:
class Customer extends Subscribable(Scorable(Tagged(Person)) {

Everything fits good into exist language syntax, however it also would be great to have some syntax sugar mixins, maybe even separate keyword, because this does not look good between beautiful domain models and services:
type Constructor<T> = new(...args: any[]) => T;

function Tagged<T extends Constructor<{}>>(Base: T) {
    return class extends Base {

And one another question, is it possible to do:
function Tagged<T extends Constructor<{}>>(Base: T) {
    return class Tagged extends Base {

and later on to check if object instanceOf Tagged ?

I guess we can use multiple mixins this way?

Yes.

Everything fits good into exist language syntax, however it also would be great to have some syntax sugar mixins, maybe even separate keyword, because this does not look good between beautiful domain models and services.

We may consider adding the Constructor<T> type to lib.d.ts, but beyond that I wouldn't expect syntactic sugar for the feature.

and later on to check if someCustomer instanceOf Tagged?

You can check if something is an instance of a specific invocation of Tagged like this:
const TaggedPoint = Tagged(Point);

function check(obj: object) {
    if (obj instanceof TaggedPoint) {
        // obj narrowed to mixin type
    }
}

However, you can't use instanceof to determine if an object is some Tagged type, but you could of course write a user defined type predicate to check it.

@ahejlsberg this is awesome, thanks for making this all work!
Since #4890 was where we were talking about the extends type operator, which would describe the mixin application more accurately than intersection types, should we open a new issue to track that, or it that idea shelved in favor of intersections indefinitely?

@pleerock it actually is possible to get customer instanceOf Tagged working by implementing the [Symbol.hasInstance] method on Tagged, and having Tagged leave some information on the class it produces.
I talk about this here: http://justinfagnani.com/2016/01/07/enhancing-mixins-with-decorator-functions/ though some members of the V8 team have warned me against using hasInstance at all, since at least at one point it cause a global slowdown of instanceOf.

@justinfagnani We considered adding a B extends A type operator (or alternatively an A with B type operator), but we decided against it because we have yet to devise a consistent error reporting scheme for such an operator.
Presumably users would expect B extends A to report errors if A and B have conflicting properties (e.g. when A has a property x: number and B has a property x: string), similarly to how we report conflicts in class and interface declarations. The extends keyword strongly implies such a check. However, when A and/or B are type variables, we don't discover such errors until B extends A is instantiated with actual types. This brings about two issues. (1) Type instantiations are deferred and occur only when they are actually needed. This is pretty much a must in any compiler implementation that supports parametric types. (2) The reasons for type instantiations are not currently tracked (and, indeed, are not easy to track). Because of these issues, errors reported from type instantiations would be inconsistent and unable to exactly pinpoint the cause of the source code. For example, errors resulting from relating types that contain properties using extends types might or might not be reported depending on whether we ever need to check the particular properties (because only then would instantiation happen). So, you might see "phantom" errors that appear and disappear in inexplicable ways. That's not a good experience.
We could of course consider having an extends type operator that doesn't report errors, but that would immediately lead to inconsistencies (because a B extends A would presumably be assignable to A, but might not actually be assignable upon instantiation).
So, the upshot of all of this is that any implementation of extends we could provide would be an unacceptable compromise. For that reason we've chosen to stay with the intersection operator. And, of course, it is always good to not have multiple ways of doing almost the same thing.

@ahejlsberg Thanks for the detailed explanation.
There were some comments about deferring the extends check until the types are known. Is something like that possible? And excuse my ignorance, I only hang out with compiler people from my days on Dart and from sitting near some V8 folk.
class A {
  x: number;
}

// 1: is it possible to infer here that Base must be extendable by {x: string}?
// extendableBy might be a new internal type operator?
const B = <T extends Constructor<{}>>(Base: T) => class extends Base {
  x: string;
}

// 2: is possible here to check that A is extendable by {x: string}?
// This is where the error would be reported
const C = B(A);

(by the way, this is why I was asking if we should open an issue, for this discussion. I can move it there, and it could be closed so I know it's over :) )

What would the types for a function which applied a mixin look like? I couldn't find a way to get this to work:
type Constructor<T> = new(...args: any[]) => T;

interface IMixin<S extends Constructor<{}>, T> {
  (superclass: S): T; // this return type should be Constructor<T> & S?
}

function applyMixin<S extends Constructor<{}>, T>(Mixin: IMixin<S, T>, SuperClass: S) {
  return Mixin(SuperClass);
}

class SuperClass {
  x() {}
}

function Mixin<T extends Constructor<{}>>(superclass: T) {
  return class extends superclass {
    y() {}
  };
}

const A = applyMixin(Mixin, SuperClass);
const a = new A();
// a.x is not known here
// a.y is known here

const B = Mixin(SuperClass);
const b = new B();
// b.x is known here
// b.y is known here

@mjewell That's an example of where we need higher-order functions (#9366), i.e. the ability to pass a generic function as an argument to another generic function without erasing the type parameters of the first function.

Thanks for the quick response. Does this also mean there is no way to return a generic class from a mixin? Something like:
class SuperClass<T> {

}

function Mixin<T extends Constructor<SuperClass>>(superclass: T) {
  return class<S> extends superclass<S> {
    y() {}
  };
}

Wow.  Is this really happening?

@electricessence, I exclaimed aloud when I saw this. The TS team delivers again.

@ahejlsberg is there a way to use generic classes as base for mixins? say in your example what if we had class Point<N> { constructor (public x: N, public y: N) {} } then what?

Can this be proposed and standardize in ECMAScript for es2018/2019? 🌷

All of this is still ECMAScript 2015. The work here affects the type system side, so now TypeScript can more accurately model the different scenarios, and give you the same support (i.e. checking & tooling) that TypeScript has been giving in other places.

Ar, I didn't know that class Foo extends X(Y) { } and return class extends Base { ... } is supported in ES6. Thanks! 🌷
https://jsbin.com/xoxipoqeto/edit?js,console
// in JS.
class Point {
    constructor(x, y) {}

}

class Person {
    constructor(name) {}
}

function Tagged(Base) {
    return class extends Base {
        constructor(...args) {
            super(...args);
            this._tag = "defaultTag";
        }
    }
}

const TaggedPoint = Tagged(Point);

let point = new TaggedPoint(10, 20);

class Customer extends Tagged(Person) {
}

let customer = new Customer("Joe");
customer.accountBalance = 0;
console.log(point);
console.log(customer);

I'm having some problems with using the new syntax for mixins. Conside the following example:
export abstract class Item {
    foo(): void {}
}

export class FooItem extends Item {
	name?: string;

	toString(): string {
		if (this.name) {
			return this.name;
		}
		return `${this.id}`;
	}
}

export type Constructor<T> = new(...args: any[]) => T;

// Throws an error when compiled
// "Error TS4060: Return type of exported function has or is using private name '(Anonymous
export function WithTags<T extends Constructor<FooItem>>(Base: T) {
	return class extends Base {
		static getTags(): Promise<any> { ... }
		tags(): Promise<any> { ... }
	}
}

// Throws two errors:
// At `Test`: "Error TS4093: 'extends' clause of exported class 'Test' refers to a type whose name cannot be referenced."
// At `WithTags`: "Error TS4020: 'extends' clause of exported class 'Test' has or is using private name '(Anonymous class)'."
export class Test extends WithTags(FooItem) {}

const test = new Test();

Test.getTags()
test.tags();

I cannot figure out what is the issue. Am I missing something?

Did you get an answer @aleksey-bykov?
Is it possible to use mixins with generic classes? The code in the example below does not work. And none of the other things I've tried does either.
export type Constructor<T> = new (...args: any[]) => T;

export function Tagged<T extends Constructor<{}>>(Base: T) {
  return class extends Base {
    _tag: string;
    constructor(...args: any[]) {
      super(...args);
      this._tag = "";
    }
  }
}

class GenericPerson<A> {
  accountBalance: number;
}

class Customer<A> extends Tagged(GenericPerson<A>) {
  foo() {
    console.log("foo");
  }
}

generics not supported in mixins
On Apr 9, 2017 8:48 AM, "Simon Friis Vindum"<EMAIL_ADDRESS>wrote:

Did you get an answer @aleksey-bykov https://github.com/aleksey-bykov?
Is it possible to use mixins with generic classes? The code in the example
below does not work. And none of the other things I've tried does either.
export type Constructor = new (...args: any[]) => T;
export function Tagged<T extends Constructor<{}>>(Base: T) {
return class extends Base {
_tag: string;
constructor(...args: any[]) {
super(...args);
this._tag = "";
}
}
}
class GenericPerson {
accountBalance: number;
}
class Customer extends Tagged(GenericPerson) {
foo() {
console.log("foo");
}
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/pull/13743#issuecomment-292783825,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA5PzdH9fz4W64VSrIakk8Ylzcd8a1wpks5ruNORgaJpZM4Lw9jJ
.

Thank you for the answer @aleksey-bykov.
Is there any plans to support this? Is there an issue to track it?

i don't know, i am not in the design team, i am now aware of any open issues regearding this, have you tried search?

Looks ugly
class Customer extends Subscribable(Scorable(Tagged(Person))) {

It's better with a more semantic syntax, maybe this:
class Customer extends Person mixins Subscribable, Scorable, Tagged

With mixins, it's easy to understand the key world super refer to the class Person, and others all is mixin.
I know the key word mixins is not standard of javascript, but, anyone think the standard will run to this ugly syntax extends Subscribable(Scorable(Tagged(Person)))  in the future?

I was trying to see if I could clean up the syntax with a MixinBuilder (similar to what is described here http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/), but I can seem to get the type right. Anyone have a suggestion?
type Constructor<T> = new(...args: any[]) => T;
	type ConstructorG = Constructor<{}>;

	export const Mix = <T  extends ConstructorG = ConstructorG>(superclass: T = class {} as T) => new MixinBuilder<T>(superclass);

	class MixinBuilder<T extends ConstructorG> {
		private superclass: T;
		constructor(superclass: T) {
			this.superclass = superclass;
		}

		with<M1>(m1: M1): M1 & T;
		with<M1, M2>(m1: M1, m2: M2): M1 & M2 & T;
		with<MAll>(...mixins: Function[]): T {
			return mixins.reduce((c, mixin) => mixin(c), this.superclass) as T;
		}
	}

	class Person {}
	class Named {}
	class Programmer {}
	class Cody extends Mix(Person).with(Named, Programmer) {}

The compiler classifies a constructor as a mix-in constructor iff it has a constructor with new (...args: any[]).  The assumption here is that the mixin will forward all parameters to the other base class constructors. (more here)the classes Person, Named and Programmer do not have one of these, but rather a default constructor new ().
We should however reconsider supporting such patterns. Please file a new issue to track that.
As I noted earlier, the issue is that there are too many constructors that the compiler can not safely reduce, since it can not assume that one of them will pass the args to the others. You can work around this however using the deconstructed constructor pattern. in this you take a constructor function, extract it into two type variables using inference, one represents the instance side (call it I), and one represents the static side (call it S), then you put them back togather with a new constructor signature with (...args:any[]): I & S. here is that applied to your sample:
type Constructor<T> = new(...args: any[]) => T;

function Mix<T extends object, U extends object>(superclass: U & Constructor<T> = class { } as U & Constructor<T>) {
    return new MixinBuilder<T, U>(superclass);
}

type Properties<T> = {[K in keyof T]: T[K]};

class MixinBuilder<T extends object, U extends object> {
    private superclass: Constructor<T> & U;
    constructor(superclass: Constructor<T> & U) {
        this.superclass = superclass;
    }

    with<M1 extends object, I1 extends object>(m1: Properties<M1> & Constructor<I1>): M1 & U & Constructor<T & I1>;
    with<M1 extends object, I1 extends object, M2 extends object, I2 extends object>(m1: Properties<M1> & Constructor<I1>, m2: Properties<M2> & Constructor<I2>): M1 & M2 & U & Constructor<T & I1 & I2>;
    with<MAll>(...mixins: Function[]): Constructor<T> {
        return mixins.reduce((c, mixin) => mixin(c), this.superclass) as Constructor<T>;
    }
}

@mhegazy
Would be great if you could write an example how to use  Mix<>(....).with(...) ? I made quite a few attempts but was keep getting this error.
constructor(superclass: Constructor<T> & U) {         ^ TypeError: Object prototype may only be an Object or null: undefined
Thanks!

@oozaa, this is an adaptation of @CodySchaaf  solution, may be @CodySchaaf  can share his full implementation.

@mhegazy How to fix this error?
/**/index.js:10
        return mixins.reduce((c, mixin) => mixin(c), this.superclass);
                                           ^

TypeError: Class constructor Named cannot be invoked without 'new'
    at mixins.reduce (/**/index.js:10:44)

@mhegazy How to fix this error?

Please file an issue, provide a self-contained sample for us to be able to help.

type Constructor<T> = new(...args: any[]) => T;

function Mix<T extends object, U extends object>(superclass: U & Constructor<T> = class { } as U & Constructor<T>) {
    return new MixinBuilder<T, U>(superclass);
}

type Properties<T> = {[K in keyof T]: T[K]};

class MixinBuilder<T extends object, U extends object> {
    private superclass: Constructor<T> & U;
    constructor(superclass: Constructor<T> & U) {
        this.superclass = superclass;
    }

    with<M1 extends object, I1 extends object>(m1: Properties<M1> & Constructor<I1>): M1 & U & Constructor<T & I1>;
    with<M1 extends object, I1 extends object, M2 extends object, I2 extends object>(m1: Properties<M1> & Constructor<I1>, m2: Properties<M2> & Constructor<I2>): M1 & M2 & U & Constructor<T & I1 & I2>;
    with<MAll>(...mixins: Function[]): Constructor<T> {
        return mixins.reduce((c, mixin) => mixin(c), this.superclass) as Constructor<T>;
    }
}

class Person {
    methodA() { console.log("methodA"); return this}
    protected methodAP() { console.log("methodAP"); return this}
    propA: number;
    static staticMethodA() { console.log("staticMethodA"); };
}
class Named {}
class Programmer {}
class Cody extends Mix(Person).with(Named, Programmer) {
    methodB() { console.log("methodB"); }
    methodBAP() { this.methodAP(); console.log("methodB"); }
    propB: number;
    static staticMethodB() { console.log("staticMethodB"); };
}

Cody.staticMethodA();
Cody.staticMethodB();
Cody.prototype
new Cody().methodA();
new Cody().methodB();

@mhegazy
type Constructor<T> = new(...args: any[]) => T;

function Mix<T extends object, U extends object>(superclass: U & Constructor<T> = class { } as U & Constructor<T>) {
    return new MixinBuilder<T, U>(superclass);
}

type Properties<T> = {[K in keyof T]: T[K]};

class MixinBuilder<T extends object, U extends object> {
    private superclass: Constructor<T> & U;
    constructor(superclass: Constructor<T> & U) {
        this.superclass = superclass;
    }

    with<M1 extends object, I1 extends object>(m1: Properties<M1> & Constructor<I1>): M1 & U & Constructor<T & I1>;
    with<M1 extends object, I1 extends object, M2 extends object, I2 extends object>(m1: Properties<M1> & Constructor<I1>, m2: Properties<M2> & Constructor<I2>): M1 & M2 & U & Constructor<T & I1 & I2>;
    with<MAll>(...mixins: Function[]): Constructor<T> {
        return mixins.reduce((c, mixin) => mixin(c), this.superclass) as Constructor<T>;
    }
}

class Person {
    methodA() { console.log("methodA"); return this}
    protected methodAP() { console.log("methodAP"); return this}
    propA: number;
    static staticMethodA() { console.log("staticMethodA"); };
}
class Named {}
class Programmer {}
class Cody extends Mix(Person).with(Named, Programmer) {
    methodB() { console.log("methodB"); }
    methodBAP() { this.methodAP(); console.log("methodB"); }
    propB: number;
    static staticMethodB() { console.log("staticMethodB"); };
}

Cody.staticMethodA();
Cody.staticMethodB();
Cody.prototype
new Cody().methodA();
new Cody().methodB();

not sure what error you are seeing.. here is the code above pasted in the playground

@mhegazy I compile in ES6, then run in NodeJS. At the compilation stage, there are no errors. But at runtime there is an error:
/**/index.js:10
        return mixins.reduce((c, mixin) => mixin(c), this.superclass);
                                           ^

TypeError: Class constructor Named cannot be invoked without 'new'
    at mixins.reduce (/**/index.js:10:44)

ah.. as i said erlier, this is an adaptation to @CodySchaaf's implementation to address a specific issue with getting it to type check correctly. i can not claim that i know how it behaves or should behave at runtime.

My example came from http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/#improvingthesyntax
I used a bad choice for the mixins, they still need to be in the function syntax:
function Tagged<T extends Constructor<{}>>(Base: T) {
    return class extends Base {
        _tag: string;
        constructor(...args: any[]) {
            super(...args);
            this._tag = "";
        }
    }
}

I tried playing with it briefly, and could not get the typing to check out as well.

@mhegazy Can you help me?
How to export mixin class? The following code
export type Constructor<T = object> = new(...args: any[]) => T;
export default <S extends Constructor>(Superclass: S) => class Pluggable extends Superclass {...}

generates this error
error TS4082: Default export of the module has or is using private name 'Pluggable'.

Looks like you are running into https://github.com/Microsoft/TypeScript/issues/15066.
The workaround is to give your function an explicit type annoation using intersection types, i.e.:
export default <S extends Constructor>(Superclass: S): S & Constructor<{ <props Pluggable adds>}> => class Pluggable extends Superclass { }

@khusamov sounds like a bug, can you open up another issue?

@DanielRosenwasser I open issue https://github.com/Microsoft/TypeScript/issues/15870

I'm trying to understand why inference works better than explicit typing here.
I'm new to TS so maybe I'm missing some core understanding of what TS does with
const a: Type = ...;
but it feels like either it should work with explicit typing or there's something wrong with Constructor & T; return type (and it doesn't quite capture what's going on).
class Person {
    constructor(public name: string) {}
}

type Constructor<T> = new(...args: any[]) => T;

type MixinFn<MixinInterface> = <T extends Constructor<{}>>(superclass: T) => Constructor<MixinInterface> & T;

interface Tagable {
    tag: (tag: string) => void;
}

// Why doesn't this work?
type TagableMxinFn = MixinFn<Tagable>;
const Tagable: TagableMxinFn = <T extends Constructor<{}>>(superclass: T) => { // T is not <Constructor<{}>>
    return class extends superclass {
        // no typechecking of rerturn type; must use implements
    }
};

const TagablePerson = Tagable(Person);
let foo  = new TagablePerson('a');
// foo.tag(); error

// While this does (and you can actually drop the return type.
function Tagable2<T extends Constructor<{}>>(superclass: T) {
  return class extends superclass {
      // implements Tagable is enforced here
      tag(tag: string) {
          console.log(`tagged with ${tag}`);
      }
  }
}

const Tagable2Person = Tagable2(Person);
let bar = new Tagable2Person('s');
bar.name;
bar.tag('s'); // all good, autocompleted and checked

export {};

@dmitryxcom please open up a separate issue if you think you've found a bug. Also, that works for me using the nightlies.

Just to be clear - it's flat out impossible right now to have a generic mixin, or to mix into a generic type? This is really limiting the usefulness of mixins for me, are there any workarounds?

@zzmingo I like it but I don't think mixin would be better than mixins.
class SuperHero mixin Person, CanFly, SuperStrength {}

We could also just do something like C#:
class SuperHero extends Person, CanFly, SuperStrength {}

Would work just about the same.

@granteagon I don't think the TypeScript team wants to add new additional features outside of he type system. There's too much danger of incompatibilities with future JavaScript evolution.
FWIW, I have a proposal to TC39 to add mixins to JavaScript: https://github.com/justinfagnani/proposal-mixins
As that progresses, the TypeScript team could consider adding support. I'm not sure when they start adding proposed features, but probably not earlier than stage 3.

@justinfagnani Mixins seem to solve a lot of inflexibility with OOP.  They also somewhat bring the functional programming world and OOP world closer together.  If there's a way I can show support for you proposal, let me know.

Hello everyone, I'm trying to figure out how to type a class-factory. I've an API that takes an object literal, and effectively returns the equivalent of a class.
const Foo = Class(({Private}) => ({
  someMethod() {
    Private(this).somePrivateMethod()
  },
  private: {
    somePrivateMethod() { ... },
  }
}))

const foo = new Foo
foo.someMethod()

where Class is a function that accepts an object literal (or a function that returns an object literal) and returns what is effectively equivalent to a class {}. I am wondering how to begin typing this (if possible).
I made a StackOverflow question about it, and I figured to share it here because the people that know most about class factories in TypeScript are here. :)

@trusktr Have not yet think deeply in how to solve your problem, but you might encounter this: https://github.com/Microsoft/TypeScript/issues/17388 when you create your solution. 🌷

In my opinion one of the issues of classes in javascript is absence of mixins. People can do object merging and destructing with plain javascript objects and lot of people simply use factory functions which produce pojos and have all javascript flexibility.
Although it is possible to do mixins right now (this PR) but usage is ugly and probably is used by people on some edge case scenarios.

I agree, it adds a lot of complexity in order to do something that is otherwise simple in plain JavaScript.

Seems like we are getting off topic.

@trusktr there is a little known typescript type mostly because its undocumented that will allow you type that called ThisType
And all i solved the Mixin problem today in a correctly typed implementation.
The underlying problem is that the "this" of a class cannot be changed unless via a super-type or itself, this limits and solution because what you want is essentially to manipulate the type of "this" within the class.
Understanding that i wrote this with some help.
export type Constructor<T = {}> = new (...args: any[]) => T;

/* turns A | B | C into A & B & C */
type UnionToIntersection<U> =
	(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never

/* merges constructor types - self explanitory */
type MergeConstructorTypes<T extends Array<Constructor<any>>> =
	UnionToIntersection<InstanceType<T[number]>>;

export function Mixin<T extends Array<Constructor<any>>>(constructors: T): Constructor<MergeConstructorTypes<T>> {
	const cls = class {
		state = {
		}
		constructor() {
			constructors.forEach((c: any) => {
				const oldState = this.state;
				c.apply(this);
				this.state = Object.assign({}, this.state, oldState);
			});
		}
	} as any;
	constructors.forEach((c: any) => {
		Object.assign(cls.prototype, c.prototype);
	});
	return cls as any;
}

And the implementation.....
export class FooMixin {
	state = {
		value: ""
	}
	getBlah() {
		return "Blah"
	}
}

export class BarMixin {
	state = {
		othervalue: "merge together"
	}
	getBar() {
		return "Bar"
	}
}

export class FooBar extends Mixin([FooMixin, BarMixin]) {
	constructor() {
		super();
		this.getBlah = this.getBlah.bind(this);
		this.getBar = this.getBar.bind(this);
	}

	test() {
		this.state.value  // here on the typings good :)
		this.state.othervalue // here on the typings good :) this proves the merge strategy for state
		this.getBar(); // here :)
		this.getBlah(); // here :)
	}
}

I feel like this should put this request to rest, it doesn't need special syntax or some hieroglyphics solution that hacks together over complicated typings.
take prototypes -> smash them together -> extend -> correct this.

i can't believe that this adventure is officially called "mixins":

no generics
no way for to mix things adhoc, only through laborious (re)declarations
no way to get out of single base class/prototype limitation
and all this is happening in a broad daylight when much better results can be achieved in plain JS by simply calling a bunch of initializers on a bare object

this is a notorious case of where "support idiomatic javascript code" goal is violated

I did an adaptation of @ShanonJackson's solution and got a pseudo form of generics working. @JustASquid @aleksey-bykov  I have the same issue as you guys and this seems to be the closest thing I got to generics.  This seems to be somewhat "okay" in terms of being able to have stable classes and mixing those in - instead of defining mixin functions with anonymous classes.
export type Constructor<T = {}> = new (...args: any[]) => T;

/* turns A | B | C into A & B & C */
type UnionToIntersection<U> =
	(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never

/* merges constructor types - self explanatory */
type MergeConstructorTypes<T extends Array<Constructor<any>>> =
  UnionToIntersection<InstanceType<T[number]>>;

export function Mixin<C1>(ctor1: Constructor<C1>): Constructor<C1>;
export function Mixin<C1, C2>(
  ctor1: Constructor<C1>,
  ctor2: Constructor<C2>,
): Constructor<C1 & C2>;
export function Mixin<C1, C2, C3>(
  ctor1: Constructor<C1>,
  ctor2: Constructor<C2>,
  ctor3: Constructor<C3>,
): Constructor<C1 & C2 & C3>;
export function Mixin<C1, C2, C3>(
  ctor1: Constructor<C1>,
  ctor2: Constructor<C2>,
  ctor3: Constructor<C3>,
): Constructor<C1 & C2 & C3>;
export function Mixin<C1, C2, C3, C4>(
  ctor1: Constructor<C1>,
  ctor2: Constructor<C2>,
  ctor3: Constructor<C3>,
  ctor4: Constructor<C4>,
): Constructor<C1 & C2 & C3 & C4>;
export function Mixin<C1, C2, C3, C4, C5>(
  ctor1: Constructor<C1>,
  ctor2: Constructor<C2>,
  ctor3: Constructor<C3>,
  ctor4: Constructor<C4>,
  ctor5: Constructor<C5>,
): Constructor<C1 & C2 & C3 & C4 & C5>;
export function Mixin() {
  const constructors = [].slice.call(arguments);
  return constructors.reduce((cls, mixin, idx) => {
    if (!idx) {
      return mixin;
    }
    const mixedClass = class extends mixin {
      constructor(...args: any[]) {
        super(...args);
        cls.call(this, args);
      }
    };
    Object.assign(mixedClass.prototype, cls.prototype, mixin.prototype);
    return mixedClass;
  });
}

Example:

class A<T> {
  a = 1;
  b = 3;

  genericFuncFromA(some: T) {

  }
}

class B {
  c = 2;

  duck() {

  }
}

class E {
  d = 4;
  quack() {
  }
}

class C<T> extends Mixin(A, B, E) {
  something(testing: T) {
  }

};

type _C<T> = C<T> & A<T> & B & E;

const d: _C<string> = new C<string>();

All the instance variables/methods come through great:

The generics are somewhat working...:

How can I get rid of this...:

Can't get out of the single base limitation either. Anyone might have ideas to how this could be achieved? Maybe something crazy could be done with proxies.

its also easily possible to adapt the solution to use Objects instead of classes, or both.

I implemented a solution to the generics problem in my ts-mixer library, but the solution can easily be adapted if you don't want to take on a (albeit, small) dependency.
Essentially, the trick is to use class decorators (which can't alter types) to apply the mixins "on the JavaScript side" in conjunction with interface merging to coerce the proper class type "on the TypeScript side."  Because TypeScript is blind to changes made by class decorators, the interface merging will work without conflicts:
import {MixinDecorator} from 'ts-mixer';

// Some generic classes
class GenericClassA<T> {
	testA(input: T) {}
}
class GenericClassB<T> {
	testB(input: T) {}
}

// Class decorator/interface merging trick to create the generic mixed class
@MixinDecorator(GenericClassA, GenericClassB)
class Mixed<A, B> {
	newMethod(a: A, b: B) {}
}
interface Mixed<A, B> extends GenericClassA<A>, GenericClassB<B> {}

let mm = new Mixed<string, number>();
mm.testA('test');		// ok
// mm.testA(2);		        // will cause error

mm.testB(2);			// ok
// mm.testB('test');		// will cause error

More info on this exploit is available in the ts-mixer docs.  If you prefer not to use my library, a potential MixinDecorator might look like this:
function MixinDecorator(...constructors) {
	return function<T, U extends T>(baseClass: T): U {
                // `Mixin` is assumed to come from one of the solutions above.
		return class Mixed extends Mixin(baseClass, ...constructors) {} as unknown as U;
	};
}

I'd love feedback if anyone has any. 🙂

@ahejlsberg, I am the author of @northscaler/mutrait, which enables stateful traits in JavaScript.  I'm trying to use what this PR enables in order to implement a similar thing in TypeScript, but I'm still not sure if the language's type system permits it.  I have a github repo demonstrating the issue at https://github.com/matthewadams/typescript-trait-test.
TL;DR: I'm basically trying to enable a simple way for folks to define traits & enable their classes to express them, like class Person extends trait(Nameable) { ... } (one trait) or class Person extends traits(Nameable).with(HasParents).with(HasChildren).apply() { ... } (multiple traits).  The traits provide default implementations of isolated functionality, and the goal is that classes expressing traits can override methods provided by the trait.
This leverages the subclass factory pattern you describe at the top of this issue, but attempts to do so in a way that allows a class to override functionality.  Your example illustrates that you can add functionality to a class, but you can't customize it easily because the subclass factory-created class extends the class receiving the functionality, instead of the other way around.
This works fine in JavaScript using @northscaler/mutrait, and we use it with great success.  I'm just having some trouble describing the typing correctly.  If you could have a look at my repo and tell me if I'm doing something wrong, or if TypeScript's typing system doesn't support what I'm trying to do, I'd appreciate it.
If you git clone https://github.com/matthewadams/typescript-trait-test && cd typescript-trait-test && npm install && npm test, you should see the following errors:
><EMAIL_ADDRESS>test /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> run-s build test:*

><EMAIL_ADDRESS>build /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> run-p build:*

><EMAIL_ADDRESS>build:main /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> tsc -p tsconfig.json

><EMAIL_ADDRESS>build:module /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> tsc -p tsconfig.module.json

src/index.ts:1:15 - error TS2307: Cannot find module './lib/async' or its corresponding type declarations.

1 export * from './lib/async';
                ~~~~~~~~~~~~~

src/index.ts:2:15 - error TS2307: Cannot find module './lib/number' or its corresponding type declarations.

2 export * from './lib/number';
                ~~~~~~~~~~~~~~

src/lib/traitify.spec.ts:11:19 - error TS2509: Base constructor return type 'S' is not an object type or intersection of object types with statically known members.

11     class extends superclass implements ITaggable {
                     ~~~~~~~~~~

src/lib/traitify.spec.ts:36:29 - error TS2345: Argument of type '<S>(superclass: Constructor<S>) => typeof (Anonymous class)' is not assignable to parameter of type 'Trait<unknown>'.
  Types of construct signatures are incompatible.
    Type 'new (...args: any[]) => Taggable<S>.(Anonymous class)' is not assignable to type 'new (...args: any[]) => S'.
      Type 'Taggable<S>.(Anonymous class)' is not assignable to type 'S'.
        'S' could be instantiated with an arbitrary type which could be unrelated to 'Taggable<S>.(Anonymous class)'.

36   class Point extends trait(Taggable) {
                               ~~~~~~~~

src/lib/traitify.spec.ts:50:9 - error TS2339: Property 'tag' does not exist on type 'Point'.

50   point.tag = 'hello';
           ~~~

src/lib/traitify.spec.ts:52:14 - error TS2339: Property 'tag' does not exist on type 'Point'.

52   t.is(point.tag, 'hello');
                ~~~

src/lib/traitify.spec.ts:53:24 - error TS2339: Property 'tag' does not exist on type 'Point'.

53   t.throws(() => point.tag = '');
                          ~~~

src/lib/traitify.spec.ts:59:43 - error TS2345: Argument of type '<S>(superclass: Constructor<S>) => typeof (Anonymous class)' is not assignable to parameter of type 'Trait<unknown>'.

59   class Sub extends superclass(Base).with(Taggable).apply() {
                                             ~~~~~~~~

src/lib/traitify.spec.ts:73:7 - error TS2339: Property 'tag' does not exist on type 'Sub'.

73   sub.tag = 'sub';
         ~~~

src/lib/traitify.spec.ts:75:12 - error TS2339: Property 'tag' does not exist on type 'Sub'.

75   t.is(sub.tag, 'sub');
              ~~~

src/lib/traitify.spec.ts:76:22 - error TS2339: Property 'tag' does not exist on type 'Sub'.

76   t.throws(() => sub.tag = 'throw');
                        ~~~

Found 11 errors.

Thanks in advance for this.  Because we leverage traits in many of our projects, this is preventing us from using TypeScript more often.

@ahejlsberg, I am the author of @northscaler/mutrait, which enables stateful traits in JavaScript.  I'm trying to use what this PR enables in order to implement a similar thing in TypeScript, but I'm still not sure if the language's type system permits it.  I have a github repo demonstrating the issue at https://github.com/matthewadams/typescript-trait-test.
TL;DR: I'm basically trying to enable a simple way for folks to define traits & enable their classes to express them, like class Person extends trait(Nameable) { ... } (one trait) or class Person extends traits(Nameable).with(HasParents).with(HasChildren).apply() { ... } (multiple traits).  The traits provide default implementations of isolated functionality, and the goal is that classes expressing traits can override methods provided by the trait.
This leverages the subclass factory pattern you describe at the top of this issue, but attempts to do so in a way that allows a class to override functionality.  Your example illustrates that you can add functionality to a class, but you can't customize it easily because the subclass factory-created class extends the class receiving the functionality, instead of the other way around.
This works fine in JavaScript using @northscaler/mutrait, and we use it with great success.  I'm just having some trouble describing the typing correctly.  If you could have a look at my repo and tell me if I'm doing something wrong, or if TypeScript's typing system doesn't support what I'm trying to do, I'd appreciate it.
If you git clone https://github.com/matthewadams/typescript-trait-test && cd typescript-trait-test && npm install && npm test, you should see the following errors:
><EMAIL_ADDRESS>test /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> run-s build test:*

><EMAIL_ADDRESS>build /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> run-p build:*

><EMAIL_ADDRESS>build:main /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> tsc -p tsconfig.json

><EMAIL_ADDRESS>build:module /Users/matthewadams/dev/matthewadams/typescript-play/typescript-trait-play
> tsc -p tsconfig.module.json

src/index.ts:1:15 - error TS2307: Cannot find module './lib/async' or its corresponding type declarations.

1 export * from './lib/async';
                ~~~~~~~~~~~~~

src/index.ts:2:15 - error TS2307: Cannot find module './lib/number' or its corresponding type declarations.

2 export * from './lib/number';
                ~~~~~~~~~~~~~~

src/lib/traitify.spec.ts:11:19 - error TS2509: Base constructor return type 'S' is not an object type or intersection of object types with statically known members.

11     class extends superclass implements ITaggable {
                     ~~~~~~~~~~

src/lib/traitify.spec.ts:36:29 - error TS2345: Argument of type '<S>(superclass: Constructor<S>) => typeof (Anonymous class)' is not assignable to parameter of type 'Trait<unknown>'.
  Types of construct signatures are incompatible.
    Type 'new (...args: any[]) => Taggable<S>.(Anonymous class)' is not assignable to type 'new (...args: any[]) => S'.
      Type 'Taggable<S>.(Anonymous class)' is not assignable to type 'S'.
        'S' could be instantiated with an arbitrary type which could be unrelated to 'Taggable<S>.(Anonymous class)'.

36   class Point extends trait(Taggable) {
                               ~~~~~~~~

src/lib/traitify.spec.ts:50:9 - error TS2339: Property 'tag' does not exist on type 'Point'.

50   point.tag = 'hello';
           ~~~

src/lib/traitify.spec.ts:52:14 - error TS2339: Property 'tag' does not exist on type 'Point'.

52   t.is(point.tag, 'hello');
                ~~~

src/lib/traitify.spec.ts:53:24 - error TS2339: Property 'tag' does not exist on type 'Point'.

53   t.throws(() => point.tag = '');
                          ~~~

src/lib/traitify.spec.ts:59:43 - error TS2345: Argument of type '<S>(superclass: Constructor<S>) => typeof (Anonymous class)' is not assignable to parameter of type 'Trait<unknown>'.

59   class Sub extends superclass(Base).with(Taggable).apply() {
                                             ~~~~~~~~

src/lib/traitify.spec.ts:73:7 - error TS2339: Property 'tag' does not exist on type 'Sub'.

73   sub.tag = 'sub';
         ~~~

src/lib/traitify.spec.ts:75:12 - error TS2339: Property 'tag' does not exist on type 'Sub'.

75   t.is(sub.tag, 'sub');
              ~~~

src/lib/traitify.spec.ts:76:22 - error TS2339: Property 'tag' does not exist on type 'Sub'.

76   t.throws(() => sub.tag = 'throw');
                        ~~~

Found 11 errors.

Thanks in advance for this.  Because we leverage traits in many of our projects, this is preventing us from using TypeScript more often.


Set current time

My calendar application has to support local time as well as UTC. I'm able to do this by simply adding the timezone offset to all my events and thus make it look like UTC. However, the current time doesn't seem to be able to be set. I tried setting the selected-date but that appears to be date only (aptly named).
Is there a way to force the time to the value I want to simulate UTC?

Hi @jmthomas, in V4 there is no way and it's the last version of v4.
But in the v5, where you have created this issue, I will think about it and add it to the todo list, I should be doable without too much rework I think.
The first pre-release should be next January

I mean natively supporting timezones would be even more awesome but I'd settle for this small hack. :-)


Globals are not present in variables

Using Grafana 11.1.3 and plugin version 1.7, the variables variable does not include the globals (__from, __to, etc.). It only includes the custom dashboard variables that I created.

I think variables.__from and others should be included there?

@stevenpaligo Could you confirm this and check the full suite of properties on the variables var by console.log(variables); from the Script section.

@jacksongoode I put console.log(variables); in the panel's Processing Script section. This is all that was logged:

Those are the custom dashboard variables I created.

Ah indeed, there is an issue. Thanks, I'll fix it!

This will be fixed in the next release.


Add ability to batch INSERT statements into a single INSERT for selected batch of data

Is your feature request related to a problem? Please describe.
Hello, sometimes I need to select a certain chunk of data and then insert it via SQL console.
Right now, when a chunk of data is selected and I do Generate SQL -> INSERT it generates individual INSERT statements.

And when it is copied to SQL console, I have to manually run them one by one. This can get annoying with large chunks of data.
Describe the solution you'd like
I would like to have a checkbox in the generation dialog that would batch all INSERT statements into a single INSERT like this:
INSERT INTO timers (tstamp, dates) VALUES
('2024-02-03 15:38:36.000', '2024-02-03 15:38:36.000'),
('2024-02-02 20:10:53.000', '2024-02-02 20:10:53.000'),
('2024-02-03 14:47:11.000', '2024-02-03 14:47:11.000'),
('2024-02-03 07:22:17.000', '2024-02-03 07:22:17.000'),
('2024-02-03 15:38:36.000', '2024-02-03 15:38:36.000'),
('2024-02-02 20:10:53.000', '2024-02-02 20:10:53.000'),
('2024-02-03 10:19:06.000', '2024-02-03 10:19:06.000'),
('2024-02-03 03:56:32.000', '2024-02-03 03:56:32.000'),
('2024-02-03 05:53:57.000', '2024-02-03 05:53:57.000'),
('2024-02-02 23:52:20.000', '2024-02-02 23:52:20.000'),
('2024-02-03 15:38:36.000', '2024-02-03 15:38:36.000'),
('2024-02-02 20:10:53.000', '2024-02-02 20:10:53.000'),
('2024-02-03 14:47:11.000', '2024-02-03 14:47:11.000'),
('2024-02-03 07:22:17.000', '2024-02-03 07:22:17.000'),
('2024-02-03 15:38:36.000', '2024-02-03 15:38:36.000');

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.

Hello @PauliusLozys
You can configure this as the "Copy as SQL" command.
First, you need to change the command settings:

And change the upsert keyword to "Insert all" (you can configure a number of rows in a batch as well):

And then you can copy highlighted data as SQL:

Oh, yes, you didn't specify the database.
So, you can leave default settings in the command configuration and do Copy as SQL. It is multi-value by default (for 10 rows).

Sorry, for not specifying the database earlier, thank you, seems just what I needed 👍


Feature request: add update_frequency field

Is your feature request related to a problem? Please describe.
Add an update_frequency field to the linz extension to allow users to capture this information consistently.
Describe the solution you'd like
[A clear and concise description of what you want to happen.]
name: linz:update_frequency
description: "Indicates how frequently an updated dataset may be distributed to the publication platform."
Type: string/enum
One of: "continual", "daily", "weekly", "fortnightly", "monthly", "quarterly", "biannually", "annually", "as needed", "irregular", "not planned".
See https://confluence.linz.govt.nz/display/LIFFP/Core+and+Spatial+Metadata+Content
Describe alternatives you've considered
[A clear and concise description of any alternative solutions or features you've considered.]
Additional context
[Add any other context or screenshots about the feature request here.]

Would it be possible to use machine readable values for the well-defined values, like  ISO 8601/RFC 3339P1Y for "annually"?


lib: avoid changing process.config

Checklist

[x] npm install && npm test passes
[x] commit message follows commit guidelines

Description of change
It is deprecated and will emit a warning in Node.js 16.
Refs: https://github.com/nodejs/node/pull/36902

I'll let someone from @nodejs/node-gyp land this.

@gengjiawen I don't suppose you want to help us get set up with the Actions suggested in #2286 so we can reduce this friction?

@gengjiawen I don't suppose you want to help us get set up with the Actions suggested in #2286 so we can reduce this friction?

Actually I can help with it. I am home for Chinese spring festival, get more free time :)

Hi, folks.
I was testing node-gyp with NodeJS nightly v16. I noticed node-gyp still changes process.config, and the warning is still emitted on Node 16. I am working on submitting a fix as a PR.
I believe this is because Object.assign() does not deep-copy nested objects under the object being copied. It only creates a reference to the nested object. So we can't modify the new object's nested objects without modifying process.config.
Details of the problem, with annotated code snippet to illustrate (click to expand)
We do the following, which mutates the process.config.target_defaults object nested under process.config:
// lib/configure.js

    var config = Object.assign({}, process.config) // This is not a deep-copy operation!
    var defaults = config.target_defaults // defaults is a pointer to process.config.target_defaults!

    // ... snipped ...

    // don't inherit the "defaults" from node's `process.config` object.
    defaults.cflags = [] // this mutates process.config.target_defaults.cflags !
    defaults.defines = []
    defaults.include_dirs = []
    defaults.libraries = []

I think it's a bit suboptimal to stringify to JSON and parse it back out again, but I am not aware of any other simple way to deep copy an object. deepCopyOfObject = JSON.parse(JSON.stringify(originalObject)).
There are libraries specifically for deep copying objects, but I'm not sure it's worth adding another library just to deep copy process.config.

I wouldn't be opposed to JSON.parse(JSON.stringify()), it's simple and easy and avoids another dep. process.config is pretty small and simple so it shouldn't cost much. It also wouldn't be hard to write a manual deep copy but JSON might just be easier. Or maybe we can work around it entirely by being a bit smarter about what we pull out?

Exploring options: we could also do this:
var defaults = Object.assign({}, process.config.target_defaults)
var variables = Object.assign({}, process.config.variables)
var config = { variables, target_defaults: defaults }

(Since process.config is only two layers deep and has not many children, we can directly copy both child objects out.)
I personally find it slightly more confusing to read than the JSON.stringify() approach.
And we have to be confident neither of process.config.target_defaults nor process.config.variables will contain a deeper-nested object in the future, or we could end up mutating process.config again.
microbenchmarks (either fix is about 0.1 - 0.4 milliseconds slower than current master branch) (click to expand)
Original as of this PR: ~0.10 - 0.13 milliseconds (outlier slow runs: ~0.14 - 0.15 milliseconds) (NOTE: deprecated)
Object.assign() fix: ~0.25 - 0.31 milliseconds (outlier slow runs: ~ 0.35 - 0.52 milliseconds)
JSON.stringify() fix: ~0.26 - 0.35 milliseconds (outlier slow runs: ~ 0.46 - 0.56 milliseconds)
These times are from a microbenchmark of just assigning defaults, variables and config with each approach, and doing perf_hooks.performance.now() immediately before and after object assignment. it's not reliably or perceptibly faster than the JSON.stringify() approach. They're both "twice as slow" as doing Object.assign() once, with references instead of deep copying. So yeah, there's a "performance hit"... a performance hit of only about 0.1 to 0.2 milliseconds! (Up to 0.4 milliseconds slower in a few outlier runs.)

I personally lean toward JSON.parse(JSON.stringify) over that. But in general I think these are close to, if not the two optimal solutions for deep copying today's process.config.

Note that when I opened this, I knew that the could would still change deep parts of process.config. I only cared about avoiding the warning and I validated it by changing the code directly inside npm/node_modules so I'm surprised that it can still be triggered.

@targos I have some steps to reproduce. I think these are pretty real-world equivalent:

Use n to install Node 16 nightly. (command: n nightly). macOS 10.15.7 Catalina.

(Effectively: download and extract the Node 16 nightly tarball, ensure its extracted bins dir is on the PATH)

Clone some package repo that builds with node-gyp (I used the superstring package: git clone https://github.com/atom/superstring), npm install its dependencies as normal.
In the module directory (/Users/[me]/superstring), do npx node-gyp configure.

To get the full trace stack for the warning, I did:

npm install -g node-gyp
node --trace-deprecation $(command -v node-gyp) configure inside a module directory that build with node-gyp (again, superstring in my case.)

Thanks for the detailed explanation. I just realized that the deprecation was applied deeply using proxies, so yeah we do need to create a deep copy...
I think the JSON stringify/parse approach is fine in this case.


For Issue #16 'pushbullet:enabled' not working properly

Issue #16 I found it MongoDB return the 'pushbullet:enabled' is boolean. I think this is the issue occur the function not working properly

Thanks @coderkk -- will have to make sure this works on Redis as well before merging.

Instead of saving true/false into the database, we now save 1 and 0, should make it easier to debug. Give it a try.


name:etymology:wikidata disables all name fields

Having a name:etymology:wikidata= tag disables all name-based fields even though there is no primary wikidata tag, rather its name's etymology entity does. Probably caused by https://github.com/openstreetmap/iD/issues/6683 being too eager? Expecting only etymology field to be disabled (at least until https://github.com/openstreetmap/id-tagging-schema/issues/256 is also separate).
Repro:
name=The 123
name:de=Das 123
name:etymology=123
name:etymology:wikidata=Q123

What would you expect in this case? If the name tag was not locked then one could accidentally change the name to something different (e.g. say, The 42), causing the etymology to not match the name anymore. In a perfect world the field would still be editable, but the name:etymology part would need to stay in there (e.g. you could change the above name to The mighty 123, but not to something not containing 123). But that would be very tricky to implement, and most likely not worth the effort if you ask me.

Heya!

What would you expect in this case?

I expected the regular name fields to not be be grayed out, because they are not based on a Wikidata item; I expect (only) the etymology field to be grayed out, because it is based on a Wikidata item. Besides being confusing, I can think of various use cases, but they are all a variation of "cannot edit wrong name(s) field(s)":
The street name changes and keeps etymology. Say "123 street" to "123 avenue". Or it's a typo like "123 streat". The name field is locked.
The street name changes to different etymology. Say "123 street" to "456 street". The new wikidata value is set, but the name field is (still) locked.
The street name without etymology changes to now have a new name and etymology. Someone adds etymology tags before changing the name, but the name field is now locked.
Another language/translation name is wrong. The language's name field is locked.
Someone wants to add another language/translation. The "+" is locked.
Someone wants to delete incorrect language name. The trash can button is locked.
Multiple features are selected where some are missing a value set in others. Say one has "123 street"/"straad 123" but the other only "123 street". The second language's name field is locked.

openstreetmap/id-tagging-schema#256 would at least separate the etymology into a separate field, perhaps with a corresponding field for the etymology’s Wikidata QID, making the reason for locking a little more discoverable. Grouping the Wikidata fields with their non-Wikidata counterparts would help too: #8104.


[bug 1195899] Upgrade django to 1.7.10

Quick r?

@mythmon Can you do a quick r? on this? Then I can do SUMO.

Confirmed that the git commit is correct on django/django, and that the hash matches what I downloaded from PyPI.
r+


Support/wagtail 4.1 compatibility

This is a follow-up PR to https://github.com/torchbox/wagtail-content-import/pull/50
This just adds testing for wagtail 4.1 and python 3.11 in the test matrix and tox.

Again, could you rebase this please @katdom13?

Superseded by #59


Is there a specific reason to undef HOST_NOT_FOUND?

Just wonder. Is there a specific reason to undef HOST_NOT_FOUND? What's the problem if it's still defined?
https://github.com/chronoxor/FastBinaryEncoding/blob/b1f5223846c76ae909d720a83099fff1ffdd5da6/proto/fbe.h#L44

Quick answer - we have HOST_NOT_FOUND duplicate in one of our projects and we want a quick solution for this issue)

But other definitions from Winapi.h must be undefined anyway, because they are duplicates even with std libraries (e.g. std::min, std::max):
#undef DELETE
#undef ERROR
#undef Yield
#undef min
#undef max
#undef uuid_t

Thank you for your prompt response! The reason why I ask this is that HOST_NOT_FOUND is also used in netdb.h on Linux, and undefine it will cause some other libraries to not work, e.g., Asio.

Probably I'll remove it soon. Thanks for pointing on this!

Fixed in FBE <IP_ADDRESS>


Implement InputType for Box<str>.

Description of the feature
Greetings! Any way to have ability use Box<str> as input type?
Code example (if possible)
#[derive(InputObject)]
struct Args {
    username: Box<str>,
    password: Option<Box<str>>,
}

I implemented InputType for Box<str> and Arc<str> and released in v3.0.23, although I don't know what's the point of you using Box<str> instead of String. 😁

I implemented InputType for Box<str> and Arc<str> and released in v3.0.23,

Thank!

although I don't know what's the point of you using Box<str> instead of String. 😁
The answer is simple -- memory. String have pointer, lenght and capacity, str have only pointer and length. When starting a lot of immutable string data, it saves a lot of memory.


tf codes

When I run the dataset.py to get the tensor of tfrecords,the results of the tensor's shape is ?，and i do not konw how to solve it. like this:
Use for ... in dataset: to iterate over a dataset. If using tf.estimator, return the Dataset object directly from your input function. As a last resort, you can use tf.compat.v1.data.make_one_shot_iterator(dataset).
Tensor("octree_dataset/IteratorGetNext:0", shape=(?,), dtype=int8)
Tensor("octree_dataset/IteratorGetNext:1", shape=(?,), dtype=int64)
Tensor("octree_encoder/depth_2/octree_max_pool/OctreePad:0", shape=(1, 128, ?, 1), dtype=float32)
is that right?
when I reomove batch(batch_size) , I meet this problem:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 0 for 'ParseExample/ParseExample' (op: 'ParseExample') with input shapes: [], [0], [], [], [0], [0].

Maybe because of the structure of octree,  the shape of the feature is "?" ,is that right?

May I ask if Tensoflow can be used in the training process?

May I ask if Tensoflow can be used in the training process?

I can't run the code. Did you use it ?

Sorry for the convenience. I am currently busy doing a research project, and I will release step-by-step details on how to use the tensorflow code in the several weeks. Please be patient.

Sorry for the inconvenience. I am currently busy doing a research project, and I will release step-by-step details on how to use the tensorflow code in the several weeks. The code is ok, and I am using them in my own projects. Please be patient.

thanks

The issue should have been fixed with the latest code.


v_extended_table_info.sql documentation issue

The columns column is defined as "encoded columns / unencoded columns," but it appears that the column is "encoded columns / all columns."

You're right. Thanks for bringing this to my attention. Fixed.


Define SDK use cases

We need to define who will be the users, what they will be building and for what platforms.

https://docs.google.com/document/d/1OPdYsHV92lz0_BGB2Ac86qE8v7LTbD_g7QkTV4zwpi4/edit?tab=t.0

https://docs.google.com/document/d/1OPdYsHV92lz0_BGB2Ac86qE8v7LTbD_g7QkTV4zwpi4/edit?tab=t.0

hello Ivan, may I pls get access to this file? curious to see who are the users, thanks

I'd like to see this file as well.  It would go a long way to understanding our potential use cases for non-dev non-industry Dash community members, thanks :)


Android Basics: Persist data with Room - missing pictures

The 'Before you Begin' page mentions an image of how Room fits in with the overall architecture recommended in the course, however, the image seems to no longer be available.

This may have been a temporary error. Checking the current codelab (https://developer.android.com/codelabs/basic-android-kotlin-training-persisting-data-room), I'm able to see all the images.


Add some tests that exercise patterns used by us

There are a few goals for these tests:

Give an example of how currently access particles for ingress/egress
Give an example of how we are managing datatype conversion
Highlight an issue with schema hashes
Show an issue with resolving references nested more than 1 level

Ignoring the failing test for now, with a reference to a bug about it.


Docker image is too large

According to @rennerocha and @paulochf our Docker image is too large. What can be done to get us in a better scenario?
I appreciate @Irio's effort in this discussion: organizing our repositories in submodules allowing us to orchestrate various containers in a seamless way.
If we have a neat Docker environment as such we could have our images on Docker Hub, what would decrease download size considerably – I guess.
Surely we can generate images on Docker Hub from now, but documenting ever-changing, non-mature images might create a version/documentation overhead. That's why I like the idea of orchestrating tihs flow.
Any other ideas that would made our images smaller?

Perhaps the changes proposed by https://github.com/datasciencebr/rosie/pull/41 are now more relevant?

I like the idea of changes that cause the smallest impact possible. So what changes with minimum impact could we do to reach this goal of having smaller Docker images?
Basic refactoring like:

RUN command: only one per Dockerfile if possible
COPY command: only one copying a compressed file, then on RUN we extract and copy to the right paths
The question is: if I would do this refactoring how smaller would be the Docker image? Would I have real benefits?
It's important to see the big picture: If I would do this refactoring in all the Docker images of the Project how much I would gain?
The less I change, the less risks I take with bugs or incidents.

Our base image is 2 GB large. https://microbadger.com/images/jupyter/datascience-notebook
We only add 10% of it's size (2.2GB) https://microbadger.com/images/datasciencebr/serenata-de-amor
Do we need all that conda's libs to work? We could refactor our Dockerfile but the gain would be marginal at best if we don't  change the base image or create the environment ourselves.

Our base image is 2 GB large. https://microbadger.com/images/jupyter/datascience-notebook
We only add 10% of it's size (2.2GB) https://microbadger.com/images/datasciencebr/serenata-de-amor

This is very important! Thanks for these stats ; )

all that conda's libs to work

Do you mean the ones in the conda_requirements.txt or the ones installed by default in Anaconda?

Apologies if this is non-pertinent to the topic, but I've been following this repo and I have my two cents to give on this issue:

the datascience-notebook image seems like an overkill to start here I would use the minimal-notebook, base-notebook, or even a bare bones miniconda image and install Jupyter there using the conda_requirements.txt (it would also be nice to rename it to environment.yml and list the channels used, env name, etc... More metadata for reproducibility in a single file);
avoid images with the Anaconda distribution and always prefer miniconda instead to prevent "bloating" with unused software.

I have the same problem with it in my Python's project.

Do you mean the ones in the conda_requirements.txt or the ones installed by default in Anaconda?

I mean https://github.com/jupyter/docker-stacks/blob/master/datascience-notebook/Dockerfile#L39
and
https://github.com/jupyter/docker-stacks/blob/master/scipy-notebook/Dockerfile#L20
that are added by the base image.
And to be clear the 2GB are the download size. Once you unzip it's about 5.5GB

Ok, good to know Miniconda is available in a Python 3 edition, yay ; )
Regrading the R packages including IRKernel there was a PR using R and we might want to bring it onboard one of these days. However the PR is idle for months and IMHO we shouldn't push us to do that in this issue — this should be done when bringing the R notebook to master.
Regarding the list of Conda dependencies by heart I can say we use some of them (scikit-learn, pandas, matplotlib, seaborn, bokeh, beautifulsoup4) bur surely this doesn't mean we use all of them. I bet this repo doesn't depend on sqlalchemy for example… I think we could take the risk of cut some of them off, using a global search into the project source code to check if they're not imported anywhere…
And, again, I would consider that rosk together with @viniciusartur's question:

The question is: if I would do this refactoring how smaller would be the Docker image? Would I have real benefits?

Or, as @caduvieira said: how far can we get considering the 2Gb we have today?

Regrading the R packages including IRKernel there was a PR using R and we might want to bring it onboard one of these days.

You don't need to rely on that Docker image to get the R packages. They can be listed in the environment.yml like this. Note that the "state" of the docker image bloats a little bit for each RUN call, so it is best to install everything in a single call.

We could use multiple runs to prevent an invalidation of a docker cache that we didn't need like this https://stackoverflow.com/questions/34398632/docker-how-to-run-pip-requirements-txt-only-if-there-was-a-change

Thanks for bringing me here!
Actually, I don't know Docker really well. What I learned about it was during Serenata's SP Sprint haha.
What I do know is that we have an ML project at work that we are using a Docker base image based (strange phrasing, but I'll get it) on alpine which has Python 3.6 and Scikit+Pandas+Numpy+Scipy, and then our project uses it.
I'll talk to some people there and see what I can do for you, at least get the code for you to use as a reference.

What I do know is that we have an ML project at work that my colleague @icaroseara crafted a Docker base image based (strange phrasing, but I'll get it) on alpine, which has Python 3.6 and Scikit+Pandas+Numpy+Scipy, and then our project uses it. Something like @cauebs pointed out.

Where are this image?

Hey @caduvieira, We do use the follow image at work to decrease the size of our ML projects.
https://hub.docker.com/r/empregoligado/alpine-python-ml/

Agreed ; )


Add a "View only mode"

Version?

vs code plugin: 0.0.6

Feature
Add a strictly "viewing" mode, where all the options at the top are hidden.  Yours can.

There are some questions:

Should the view directly load into readonly mode? Then we need a configuration option

If not, we need a new button in the option sections (so one can toggle readonly while viewing the table)

What options at the top should be hidden? The only thing that makes sense to me is are the write options (and some buttons e.g. apply changes, add row…).

* Should the view directly load into readonly mode? Then we need a configuration option

  * If not, we need a new button in the option sections (so one can toggle readonly while viewing the table)

Honestly, whatever it's easiest for you to implement. Personally, I'm partial to a new option on the drop down menu when clicking with the right mouse button.

What options at the top should be hidden? The only thing that makes sense to me is are the write options (and some buttons e.g. apply changes, add row…).

These: https://i.imgur.com/pytl2tw.jpeg

Personally, I'm partial to a new option on the drop down menu when clicking with the right mouse button.

The context menu? Hm I don't think this suited for that as all actions in are meant to be applied to one cell/row/column.
As for the options to hide (the 2 "rows"):

In the first row write options and Preview (and the 2 next buttons) are not needed.
For the second row only hide comments and help makes sense in readonly mode.

Hiding these will introduce too much extra conditions, disabling is probably the way to go.
Disabling also allows to add a new toggle button to switch from readonly to edit mode and vice versa.
I'll also add a config option to always start in readonly (or edit) mode.

I see. I actually was going to suggest you add an option by default, but I thought that was harder than adding a new option to the context menu.
Also, another good idea is to add a checkbox option that reads the first row as a header by default.

Also, another good idea is to add a checkbox option that reads the first row as a header by default.

This is already an option: csv-edit.readOption_hasHeader

There are some still some things I'm not 100% sure about:

should column/row reordering be allowed? I think this is ok to keep it
I tried to change the color of the text when the table is disabled but so one will notice that it's disabled... but I think it strains the eyes too much. The toggle readonly mode button also changes color so this should be enough

should column/row reordering be allowed? I think this is ok to keep it

Sorry, I don't quite get what you mean. Could you rephrase it?

generally everything that is done before the table is create is done

Sounds fine to me.

changes to the source file from outside the extension are not prevented (only the table is readonly)

You mean, for example, I edited the csv outside VSCode with Notepad++, it wouldn't prevent that? If so, then it is as it should, in my opinion, as long as the read-only view automatically reloads if changes are made to the file, whether the changes are done with VSCode or some other software.

should column/row reordering be allowed? I think this is ok to keep it

Sorry, I don't quite get what you mean. Could you rephrase it?

Currently you can drag'n'drop columns/rows to reorder them (when you click on the headers).
When the file is changed outside of the extension a dialog is displayed where you can decide to reload the file or not.

Ah okay. In that case, in Read-only, column reordering shouldn't be allowed in my opinion.

Think this is finished now and will be shipped in the next update.
I also disabled

row reordering
undo/redo
column sorting


range doesnt handle case when n > m

UNFORGIVABLE!!! CANT USE ANDI'S UTILS ANYMORE!

Same thing happened to me! I guess I will go back to lodash again. Shame

Yeah i really wanted to use this lib. I'll return to good 'ol lodash i guess. lodash >>> andi's utils