text:
Comparator is not used in median_index

I was trying to replace my use of std::nth_element with miniselect's implementation of Andrei Alexandrescu's adaptive quickselect, but I ran into an issue while doing so: it seems that one of the median_index overloads does not consistently use the given comparator to compare elements (lines marked with HERE):
template <class Iter, class Compare,
          class DiffType = typename std::iterator_traits<Iter>::difference_type>
inline DiffType median_index(const Iter r, DiffType a, DiffType b, DiffType c,
                             Compare&& comp) {
  if (r[a] > r[c]) std::swap(a, c); // HERE
  if (r[b] > r[c]) return c; // HERE
  if (comp(r[b], r[a])) return a;
  return b;
}

I stumbled upon this issue while trying to sort with a custom predicate a collection of a type that doesn't have comparison operators, so I fortunately got into a compile-time error, but I believe that it can result into more subtle runtime errors too when the types to sort do implement comparison operators.
Anyway, thanks again for this library, I'm glad to see selection algorithms getting some love 😄

Thanks, will fix shortly !

Thanks, will fix shortly !

0.4.0 fixed, thank you. Everybody should use this version, my bad I didn't notice and somehow testing did not catch the failure -- in one test I was comparing pointers and all sanitizers were good :(

0.4.0 fixed, thank you. Everybody should use this version, my bad I didn't notice and somehow testing did not catch the failure -- in one test I was comparing pointers and all sanitizers were good :(

No problem, I plan to use the algorithm to replace libc++'s nth_element in one of my rather well-tested projects - I only noticed recently that it was O(n²) -, so I will tell you if I find anything else. Thanks for the quick fix 🙂

No problem, I plan to use the algorithm to replace libc++'s nth_element in one of my rather well-tested projects - I only noticed recently that it was O(n²) -, so I will tell you if I find anything else. Thanks for the quick fix 🙂


text:
update purchase order manager

update purchase order manager

Coverage decreased (-0.3%) to 71.351% when pulling 0f3e56ead2058d443705e3bdb5196f6430549fa4 on adityahenanda:dev into 3d6c3d4603fe87752ae9fd1595ce34b58f491c95 on danliris:dev.

Coverage decreased (-0.3%) to 71.351% when pulling db567f039174325860b76adc138ca6ed3cb95d79 on adityahenanda:dev into 3d6c3d4603fe87752ae9fd1595ce34b58f491c95 on danliris:dev.

source: gharchive/pull-request

authors: adityahenanda coveralls

repo: danliris/dl-module

license: mit

license_type: permissive

license_source: bigquery


text:
Minute/Hour summary + shortening at the Manage time card on each entry

Hello Dannie,
first of all, thank you for your trello power up.
I was thinking about some little update to Manage time card entries.

It would be nice to have there after the time range some kind of summary in minutes or hours (see the screenshot).

When the time interval is on the same day, the repetition of the date could be ommited, which could lead to more clarity.
I admit, that when you'll have those "shortened" and "unshortened" lines under, but i think is't worth the shot.

I think i could prepare a pull request if you would find those things usefull.

I've made the changes, it was quite straightforward. It should work as suggested.
The only thing i couldn't do is to test it in the Trello environment. Is there a way to test it?

I've made the changes, it was quite straightforward. It should work as suggested.
The only thing i couldn't do is to test it in the Trello environment. Is there a way to test it?

@jonez1 Your PR was merged. I'll close this issue on this note. Thank you for looking into this optimization :)

source: gharchive/issue

repo: danniehansen/activity-timer

license: MIT

license_source: github-api


text:
🛑 SendIT is down

In 32171a9, SendIT (https://sendit.dannluciano.com.br) was down:

HTTP code: 0
Response time: 0 ms

Resolved: SendIT is back up in 71a4489.

repo: dannluciano/upptime


text:
Error occurred while running upload command: null

I get this error when attempting to upload my changes.

Not very helpful, any ideas?

Hmm, not helpful indeed. That error occurs when the request to Google Drive fails and could happen for many reasons.
Can you try reproducing the same error with another project? If that doesn't work, more information about this particular error might help. Right now I'm only logging the message property on the error object that comes back from google. Do you feel comfortable editing your local copy to log the entire error object? You should find this downloaded in /usr/local/lib/node_modules. You'll find the log on line 53 of `upload.js.

Logging the entire error object also gives null.  I'll keep investigating.

Sorry these ones can be really tricky to track down. Maybe try re-authenticating?
Please do let me know if you find anything more

Figured it out. I wasn't using a standalone script, it was attached to a spreadsheet.

Oh, excellent!

it seems it's because some bug inside google-api-nodejs-client . I opened a issue over there.

If I understand correctly what the issue was here, it's not precisely a bug as much as a missing feature on the Google side: they make it quite clear that the API can only be used to access Apps Script projects, and that bound code in other types of documents is entirely inaccessible.
It also seems that this may indicate a bug in gapps where it doesn't check the MIME type of the document before it attempts to upload or download, to ensure that it's trying to access a document of the appropriate type.

authors: cjs-cynic-net danthareja goose2460 zixia

repo: danthareja/node-google-apps-script


text:
helpers::fill is not needed

https://github.com/dantrim/parquet-writer/blob/fafd671a1b4345551bd445d8b53ccb3c3bd8a326/src/cpp/parquet_writer_helpers.h#L152
The logic here should just be added to the data filling visitor

addressed in 3f06c0d

repo: dantrim/parquet-writer


text:
I want to pass data from one formfield to other formfield.. How can I do that ?

How do I change initial value of the formfields  during runtime?

How do I change initial value during runtime?

TextFields?

Did you try something like this in the setState()?
I am doing something like below to reset the state code when the country code changes. See the line in bold below:
onChanged: (country) {
setState(() {
_fbKey.currentState.fields['state'].currentState.setValue(null);
_currentCountry = country;
_setStatesDropdownItems(country);
})

Looks like it is an abandoned issue

authors: WilliamCunhaCardoso avinashpakala danvick ramnath30


text:
Bumb StakingBrain image version

Rationale:
https://github.com/dappnode/DNP_DAPPMANAGER/issues/1803#issuecomment-1903935622

Closed by https://github.com/dappnode/DAppNodePackage-web3signer-gnosis/pull/83


text:
pubsub.snssqs: Support regions in other AWS partitions

Fixes #1907
Signed-off-by: Clare Liguori liguori@amazon.com
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:

[x] Code compiles correctly
[x] Created/updated tests
[ ] Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

Will only merge once a docs PR has been created.

@mukundansundar @berndverst I don't think a docs update is needed here. This doesn't change the component format, it just determines the partition ID based on the current metadata.

@clareliguori is correct, this PR doesn't introduce any changes to metadata or the existing format.

Sounds good. I was going off of @mukundansundar 's review. Agreed and understood that no docs are required.

authors: berndverst clareliguori yaron2

repo: dapr/components-contrib


text:
Working on enchaning error handling for metadata api

Description
I am working on modifying the error handling for metadata API. Currently i have added 2 of them and working on writing more rich error handlers  Need some suggestions till here is it going correct?
Issue reference
refs #7489
Checklist
Please make sure you've  completed the relevant tasks for this PR, out of the following list:

[ ] Code compiles correctly
[ ] Created/updated tests
[ ] Unit tests passing
[ ] End-to-end tests passing
[ ] Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]
[ ] Specification has been updated / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]
[ ] Provided sample for the feature / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

Thanks for the start on this, however I think there is a long ways to go still. Specifically, there may be some confusion on the Metadata API, and what that is. Here is the Dapr docs for the Metadata API. From there, try to force some Metadata API errors, and update those existing returned errs to be the standardized errors, which are defined from the kit builder.

Thanks for the start on this, however I think there is a long ways to go still. Specifically, there may be some confusion on the Metadata API, and what that is. Here is the Dapr docs for the Metadata API. From there, try to force some Metadata API errors, and update those existing returned errs to be the standardized errors, which are defined from the kit builder.

I looked into the docs..
I understood that these are the things whichever metadata api will return
It would be great if I get a small example... Although I saw the pr for state and pubsub..
A small example would really help me.. a small and clear one  @cicoyle

Just an example like how one error handler is created for metadata and how it is used @cicoyle

There are examples of using the API in the docs link I provided. I sent a very clear example or 2 with links to the line in our codebase in our discord conversation as well. My suggestion is to read the docs link I provided, and try to force an error, then trace that in the codebase.
I would also suggest making this a draft PR, since the tests need to be written as well and polishing up the changes.

There are examples of using the API in the docs link I provided. I sent a very clear example or 2 with links to the line in our codebase in our discord conversation as well. My suggestion is to read the docs link I provided, and try to force an error, then trace that in the codebase.
I would also suggest making this a draft PR, since the tests need to be written as well and polishing up the changes.

Thanks..
I will implement things by taking help of resources you shared...
Ya let me make it draft pr

Hello @cicoyle I referred the PR for PubSub API and State API both and the Metadata api docs also api docs
I have a few questions:-

I saw in the files of pubsub and state and for pubsub in the line ```WithErrorInfo(kiterrors.CodePrefixPubSub+PostFixNameEmpty, metadata). we are using CodePrefixPubSub and same in state file we are using WithErrorInfo(kiterrors.CodePrefixStateStore+kiterrors.CodeIllegalKey, nil) we are using CodePrefixStateStore
My question is that from where we are getting it? When i searched in the Repo I saw we are using it from here ``kiterrors "github.com/dapr/kit/errors" so how can i find these for Metadata or can i see how it is created for Pubsub or State

In the PubSub and State files we are declaring functions and in Pubsub it takes three parameters func PubSubNameEmpty(name string, pubsubType string, metadata map[string]string) in most of the functions and for state file  we pass params but it differs in functionsfunc StateStoreInvalidKeyName(storeName string, key string, msg string).

My question is that is there any good way to find what our function will return?

I am currently not knowing that what functions will take as Parameters.
Will they take parameters what they will return? Like in Metadata api docs Subscriptions list of pub/sub subscriptions which includes pub/sub name, topic, routes, dead letter topic, and the metadata associated with the subscription.
So do we need to take Parameters based on these?

Hello @cicoyle I referred the PR for PubSub API and State API both and the Metadata api docs also api docs
I have a few questions:-

I saw in the files of pubsub and state and for pubsub in the line WithErrorInfo(kiterrors.CodePrefixPubSub+PostFixNameEmpty, metadata). we are using CodePrefixPubSub and same in state file we are using WithErrorInfo(kiterrors.CodePrefixStateStore+kiterrors.CodeIllegalKey, nil) we are using CodePrefixStateStore.

My question is that from where we are getting it? When i searched in the Repo I saw we are using it from here kiterrors github.com/dapr/kit/errors so how can i find these for Metadataor can i see how it is created forPubsub or State`

In the PubSub and State files we are declaring functions and in Pubsub it takes three parameters func PubSubNameEmpty(name string, pubsubType string, metadata map[string]string) in most of the functions and for state file we pass params but it differs in functionsfunc StateStoreInvalidKeyName(storeName string, key string, msg string).

My question is that is there any good way to find what our function will return?
Thanks.

The CodePrefixPubSub comes from the kit pkg, specifically this file. You posted the import above, the kiterrors.CodePrefixPubSub is referencing the pkg from the import, which you can find on github. Are you familiar with Go and how to use imports? That might be worth looking into if you are not familiar. You should have seen several links to the kit errors pkg, as I know I linked to it from the issue. Did you by chance review all the links provided?
I recommend reading the code there to understand better how to use the pkg when constructing the error with the builder pattern. If you are using an IDE, you should be able to ctrl+click and it should take you to where variables are defined.
The function always returns the error type. If you are asking about the parameters the function accepts, that depends on the API and what makes sense for that specific error you are standardizing.

repo: dapr/dapr


text:
Remove workaround for mTLS bug

Make sure mTLS workaround at https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-upgrade/#dapr-cli is removed in v1.2.

Code issue: https://github.com/dapr/cli/issues/664

/assign

authors: AaronCrawfis CodeMonkeyLeet

repo: dapr/docs


text:
SDK Packages links navigate away from SDK content into conceptual/HTTP content

Describe the issue
Starting from the SDKs doc page, all the top prominent links discuss scenarios that can be done in Client SDKs, Server extensions, and Actor SDKs, but each link actually navigates AWAY from the right SDK topic and instead shows the generic HTTP.
URL of the docs
https://docs.dapr.io/developing-applications/sdks/
Try Invoke, state, Actor-invoked, etc
Expected content
These links should take you to an SDK how to for that scenario, with a language pivot.  For example I should click Invoke, then go to a how to for invoke using SDKs, with tabs or some other navigation for language.
Screenshots
Starting at SDK page click any link above the fold like Invoke

We're taken to this general overview and http only content, and lost context of SDKs.
https://docs.dapr.io/developing-applications/building-blocks/service-invocation/

But I'd want to see docs like this:
https://docs.dapr.io/developing-applications/sdks/python/python-client/#invoke-a-service

Additional context

Breaking this into smaller items:

Adding tab items for SDK clients in all how-to guides within the building blocks section
Update SDK overview doc to better route users

authors: AaronCrawfis paulyuk


text:
Improved async call to okhttp.

Description
Former solution just wrapped a blocking call, now we using asynch call and collect the results via callbacks. Mono's are created based on the result. This make more efficient use of the resources since nothing is blocking now.
Reformatted according new checkstyle
Issue reference
#19
#46
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:

[ ] Code compiles correctly
[ ] Created/updated tests
[ ] Extended the documentation

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

The Java SDK is WIP, so we are not merging into master yet. I changed the base of this PR to the right branch. One we are done with this milestone, we should be able to use master directly again.

I promise less headache with upcoming commits.

I hit that button accidentially before the review was finished

authors: artursouza ji11er msftclas

repo: dapr/java-sdk


text:
Handle Request & Response

I would like to know if it's possible handle requests & responses?
For me it's necessary for logging, add headers by default or for logging responses (attributes as url, headers, body, statusCode), etc when the tests failed.
If that possible?

Hi,
Not sure if I get your whole question, but feel free to clarify if I do not answer your question fully.
In terms of logging, we have a debug option, which can be seen here http://dareid.github.io/chakram/jsdoc/module-chakram.html#.startDebug. This should wrap the requests to log the response.
Headers (and other request defaults) can be set on all requests using http://dareid.github.io/chakram/jsdoc/module-chakram.html#.setRequestDefaults.

That's usefull, but I would like that the response data could be logged just when the test is failed. I need reduce disk consumption.

This is not possible at the moment, debug is either on or off for a request.
Feel free to raise a PR for this functionality

authors: dareid fescobar

repo: dareid/chakram


text:
[Extension name] Bug description

Extension name
视频不能播放
Bug Description
视频能下载好，但是不能播放视频
To Reproduce
No response
Logs
"C:\Users\11793\AppData\Roaming\Playnite\playnite.log"    "C:\Users\11793\AppData\Roaming\Playnite\extensions.log"
Screenshots
No response

English only please. Also you didn't attach the logs


text:
登录API的padding是什么模式

https://github.com/darknessomi/musicbox/wiki/网易云音乐新登录API分析
https://github.com/bricke/Qt-AES
使用别人的AES代码，padding 有3种模式：ZERO, PKCS7, ISO。

我记得是PKCS，之前用 go 和 rust 复刻过

我记得是PKCS，之前用 go 和 rust 复刻过

authors: nnnewb sonichy

repo: darknessomi/musicbox


text:
fix(writer): buffer race condition

Closes #576

@christophcemper could you try this patch and see if it resolves this data race for you?

authors: darkweak mholt

repo: darkweak/souin


text:
refactor to use atom.dart package functionality

@devoncarew

Lgtm

authors: danrubel devoncarew

repo: dart-atom/dartlang


text:
Cannot build when a method name is a keyword and has generic parameters

When build the following code with pub build with sdk 1.24.2
import 'package:angular/angular.dart';

void main() {
  bootstrap(AppComponent);
}

@Component(selector: "my-app", template: "<h1>#Epic Fail</h1>")
class AppComponent{
  void set<T>(){}
}

the following error occurs
Working dir: C:\Users\Jack\WebstormProjects\untitled2
"C:\Program Files\Dart\dart-sdk\bin\pub.bat" build --mode=debug --output=build
Loading source assets...
Loading angular transformers...
Building untitled2...
[Info from Dart2JS]:
Compiling untitled2|web/main.dart...
[Error from Dart2JS]:
web\main.dart:13:3:
Unexpected token 'void'.
  void set<T>(){}
  ^^^^
Build failed.
[Info from Dart2JS]:
Took 0:00:04.792994 to compile untitled2|web/main.dart.
Process finished with exit code 65

We tried it with various keywords and they all have the same issue.
FYI. @jrote1

This isn't an angular issue - appears to be a problem with Dart2JS. I re-reported the issue at https://github.com/dart-lang/sdk/issues/30457

authors: JackHerring natebosch

repo: dart-lang/angular


text:
material-yes-button-text-color mixin don't work with stepper component

I created component with template:

    <material-stepper legalJumps="backwards"
                      orientation="horizontal"
                      size="default">
        <template step name="Consent">

        </template>
        <template step name="Strips">

        </template>
    </material-stepper>

and scss:
@import 'package:angular_components/css/material/material';
@import 'package:angular_components/material_stepper/mixins';
@import 'package:angular_components/material_yes_no_buttons/mixins';

:host {
  @include material-stepper-theme (
          $selector: '.teal-themed',
          $step-color: $mat-teal-500,
          $button-color: $mat-blue-400
  );
  .teal-themed {
    @include material-no-button-text-color($mat-teal-500);
    @include material-yes-button-text-color($mat-teal-500);
  }
}

Strange that this code override color for no button but is ignored for yes. Styles from asset:angular_components/lib/material_yes_no_buttons/material_yes_no_buttons.dart is not override by mixin - as I see it in chrome dev tools.

moved issue to angular_components: https://github.com/dart-lang/angular_components/issues/279


text:
Initial poc

First cut at an official repo with input from @tianon.

@googlebot I consent.
(but not without adding that CLAs are actively contributor-hostile)

@athomas I added checksum support. Ready for review.

authors: subfuzion tianon

repo: dart-lang/dart-docker


text:
dart-services should filter the possible completions

By default, the analysis server sends all possible completions for a location, including ones that don't match any chars the user may already have typed.
This matches what most clients want - they can apply any filtering they want locally. This causes a problem however for dartpad - when used with package:flutter_web, which has a large public namespace - you get a lot of results back. That equates to a 3.2MB json payload for the client to download.
We should perform some filter in dart-services, after we get results back from the analysis server, and before we send them to clients. That could be something as simple as determining the prefix of text already typed, and filtering results to only those starting with that prefix.

I think I have a fix here: https://github.com/dart-lang/dart-services/pull/403

@johnpryan's change is landed and the completions are now a sane size. I believe this is now done.

authors: devoncarew domesticmouse johnpryan

repo: dart-lang/dart-pad


text:
regen the discovery libraries

Regen the discovery libraries w/ the latest version of the discoveryapis_generator package.

Only whitespace changes -

But very nice whitespace changes. Is there a change to a dependency we need to continue picking these up?
lgtm.

The people who regen the libraries just need to ensure that they've run pub update locally.

There may be some min. dep we can set as well...

authors: devoncarew lukechurch

repo: dart-lang/dart-services


text:
How to use dart ffi gen with multiple dynamic libraries?

Hi,
Me again (sorry!)  I've posted this question on SO but no answers.  I will post on SO what I learn from here.
In my attempt to create Dart bindings for  GSL, I need to load two dynamic libraries libgsl.so and libgslcblas.so. I have used ffigen to generate the bindings and things work fine as long as all symbols called are from libgsl.so.
But there are issues when BLAS related functionality is needed (available from libgslcblas.so.) For example, there is a function gls_blas_dnrm2 which exists in libgsl.so that needs function cblas_dnrm2 from libgslcblas.so. So when I call the generated method for gsl_blas_dnrm2 (which gets resolved correctly) I get the error
/usr/lib/dart/bin/dart: symbol lookup error: /usr/local/lib/libgsl.so: undefined symbol: cblas_dnrm2

which makes sense as the symbol cblas_dnrm2 is in libgslcblas.so (I can confirm that.)
I've tried to modify the ffigen generated lookup to look in both libraries, something like this
  Gsl((ffi.DynamicLibrary, ffi.DynamicLibrary) dynamicLibraries) {
    ffi.Pointer<T> aux<T extends ffi.NativeType>(String symbolName) {
      print('looking up symbol $symbolName');
      if (dynamicLibraries.$1.providesSymbol(symbolName)) {
        return dynamicLibraries.$1.lookup(symbolName);
      } else if (dynamicLibraries.$2.providesSymbol(symbolName)) {
        return dynamicLibraries.$2.lookup(symbolName);
      } else {
        throw StateError('No symbol $symbolName');
      }
    }
    _lookup = aux;
  }

but that doesn't help because the _lookup function does not get called for the cblas_dnrm2 at all.
From C  (example), I can simply do gcc -Wall -o example example.c -lgsl -lgslcblas -lm and things work.
Do you have any suggestions on how I can resolve this?  I did not find this issue documented.  Many thanks for your help!
T

I am not sure I fully understand the problem. Could you elaborate?
You mean that the native code in libgsl.so needs libgslcblas.so? In that case it is the C dynamic linker that will try to find libgslcblas.so. (It will kind of try to do dlopen+dlsym.) Is libgslcblas.so on your include path? Or you can try doing DynamicLibrary.open('path/to/libgslcblas.so') to preload it for the C linker to find.

/usr/lib/dart/bin/dart: symbol lookup error: /usr/local/lib/libgsl.so: undefined symbol: cblas_dnrm2

I am a bit suprised we don't see libgslcblas.so in the error message. Is the way that libgsl.so is compiled not knowing that it needs libgslcblas.so as a dependency? Can you run ldd /usr/local/lib/libgsl.so to see what the dynamic dependencies are?

Thanks for looking at this.
Even if I load libgslcblas.so explicitly, it does not work
  var lib = DynamicLibrary.open('/usr/local/lib/libgslcblas.so');
  print(lib.providesSymbol('cblas_dnrm2'));  // true
  var lib2 = DynamicLibrary.open('/usr/local/lib/libgsl.so');
  print(lib2.providesSymbol('gsl_blas_dnrm2'));  // true

  var x = [1.0, 2.0, 3.0];
  var v = gsl.gsl_vector_alloc(3);
  for (var i = 0; i < x.length; i++) {
    gsl.gsl_vector_set(v, i, x[i]);
  }

  /// line below throws symbol lookup error: /usr/local/lib/libgsl.so: undefined symbol: cblas_dnrm2
  gsl.gsl_blas_dnrm2(v);
  gsl.gsl_vector_free(v);

On my C example file I get
$ ldd example
    linux-vdso.so.1 (0x00007ffe83ffa000)
    libgsl.so.27 => /usr/local/lib/libgsl.so.27 (0x00007f9b5b400000)
    libgslcblas.so.0 => /usr/local/lib/libgslcblas.so.0 (0x00007f9b5b6eb000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9b5b000000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9b5b319000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9b5b749000)

Here's on libgsl
~/gsl_dart$ ldd /usr/local/lib/libgsl.so
        linux-vdso.so.1 (0x00007ffce4ff2000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f515eb19000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f515e800000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f515ef03000)

Thank you,
T

So gsl.cblas_dnrm2(v) would fail because gsl is passed DynamicLibrary.open('/usr/local/lib/libgsl.so'). This could be solved by generating bindings for one cblas separately and importing those in your FFIgen config for gsl. But that's not the problem you're having.

On my C example file I get
$ ldd example
    linux-vdso.so.1 (0x00007ffe83ffa000)
    libgsl.so.27 => /usr/local/lib/libgsl.so.27 (0x00007f9b5b400000)
    libgslcblas.so.0 => /usr/local/lib/libgslcblas.so.0 (0x00007f9b5b6eb000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9b5b000000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9b5b319000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9b5b749000)

So because you pass the linker flags, the C program is compiled in such a way that it loads both libgsl.so and libgslcblas.so at startup. And once gls_blas_dnrm2 is invoked, cblas_dnrm2 is already loaded into the program by the dynamic linker.

Here's on libgsl
~/gsl_dart$ ldd /usr/local/lib/libgsl.so
        linux-vdso.so.1 (0x00007ffce4ff2000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f515eb19000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f515e800000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f515ef03000)

DynamicLibrary.open('/usr/local/lib/libgsl.so') does not trigger loading libgslcblas.so because it's not in the dependency list. See documentation for ldd. I'm not sure why not, it would make sense if it was, because it is clearly required.
Maybe open an issue the repo of the library provider why the requirement does not show up in ldd?
As a workaround for the missing entry in ldd, you could try to compile an new dummy dynamic library that has both libgsl.so and libgslcblas.so in it's ldd required dynamic libraries list. And then DynamicLibrary.open that dylib in Dart, which should then trigger loading both libraries.

I made it to work.  I RTFM autoconf!
So I've added the lines below to the configure.ac file at line 131.
AC_CHECK_LIB([m],[cos])

# ------------------------------------------------------------------
# Check for BLAS
# ------------------------------------------------------------------
AC_CHECK_LIB([cblas],[cblas_dgemm],[],[
  echo "Library libcblas not found. Looking for GSL cblas."
  echo -n " The present value of LDFLAGS is: "
  echo $LDFLAGS
  AC_CHECK_LIB([gslcblas],[cblas_dgemm],[],[
    echo "Library libgslcblas not found. gsl_dart requires a cblas library."
    echo "You may be required to add a cblas library to the LIBS "
    echo "environment variable. "
    echo ""
    echo -n " The present value of LDFLAGS is: "
    echo $LDFLAGS
    echo ""
  ],[])
],[])

# ------------------------------------------------------------------
# Check for GSL library (must check for BLAS first)
# ------------------------------------------------------------------
AC_CHECK_LIB([gsl], [gsl_vector_get], [],
	[echo ""
        echo "GSL not found."
        echo "gsl_dart requires the GSL library."
	echo ""
	echo -n " The present value of LDFLAGS is: "
	echo $LDFLAGS
        exit -1
	],[])

Then autoreconf --verbose --install --force.
Then the usual ./configure && make && make install did it.
ldd /usr/local/lib/libgsl.so
        linux-vdso.so.1 (0x00007ffe1f174000)
        libgslcblas.so.0 => /usr/local/lib/libgslcblas.so.0 (0x00007fcf95879000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcf9577d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcf95000000)

Thanks for the gentle help along the way.
T

authors: dcharkes thumbert

repo: dart-lang/ffi


text:
unresolved interferes with the log widget

 Issue by sigmundch
Originally opened as dart-lang/sdk#21640

hides the log widget that shows warnigns and errors. To fix this, we think the log widget should move the 'unresolved' attribute down to every child of body (except the widget of course).
We probably want to include 'unresolved' in the list of blacklisted attributes as well.

 Comment by lrhn

Added Area-Pkg label.

repo: dart-lang/polymer-dart


text:
Fatal package site error on opening Dart pub browse page

Opening https://pub.dartlang.org/packages
Fatal package site error
Please open an issue: https://github.com/dart-lang/pub-dartlang-dart/issues/new
Add these details to help us fix the issue:
Requested URL - https://pub.dartlang.org/packages
Request ID - c3e05e15be80f435ef6bfc56a96a4940

Weird, works fine for me! Is it a consistent failure for you? Are others seeing it?

Cc @jakobr-google @isoos

It was failing briefly due to issues with our search instances. Seems better now, so I’ll investigate further tomorrow.

Removing P0 as the site is back up. @jakobr-google did you investigate a bit what caused it?

Our instances lost their connection to memcache, which led to an uncaught exception tearing down the isolates.
I have a fix in package:memcache, and will upgrade our dependency once it's published.

authors: jakobr-google mit-mit timsneath

repo: dart-lang/pub-dartlang-dart


text:
Simple validation of the package name in the uploaded pubspec.

Fixes #50.

Looks fine with me. Added a few comments.
Would be really nice to share the entire logic of pubspec.yaml validation with the client. (or have at least a library we can copy entirely)

Done w/ the requested changes. Re: pubspec.yaml validation: we could either depend on the pub package, or create a new one (under /dart-lang/, I think a Googler should own it). Either way, I can do the PRs to share the same codebase.
If you don't mind, I'll open a new PR with more rigorous dart analyzer settings (e.g. finals enforced).

authors: isoos mkustermann


text:
A package path in pubspec.lock should have a relative path if specified by a relative path in pubspec.yaml

This issue was originally filed by ni...@blossom.io

In the documentation it's recommended to check the lockfiles into source control.
* http://pub.dartlang.org/doc/glossary.html#application-package
* http://pub.dartlang.org/doc/#updating-a-dependency
* http://stackoverflow.com/questions/16136739/in-dart-and-pub-should-i-add-pubspec-lock-to-my-gitignore
When I specify a required package via a relative path in pubspec.yaml an absolute path is generated in the lockfile. This requires the exact same location of the project for everyone who is working on the application.
It would be great if pubspec.lock would use a relative path.
Example:
pubspec.yaml
        name: application
        dependencies:
          blossom_utils:
            path: ../blossom_utils
pubspec.lock
        packages:
          blossom_utils:
            description:
              path: "/Users/nikolausgraf/projects/blossom/dart/application/../blossom_utils"
              relative: true
            source: path
            version: "0.1.0"

This issue has been moved to dart-lang/pub#585.

repo: dart-lang/sdk


text:
10 pkgbuild tests against public pub failing after r34853

I assume this is because you are preparing to ship a new version publicly?
I will suppress the errors in the status files

This issue has been moved to dart-lang/barback#44.

authors: DartBot ricowind


text:
Create instances of arbitrary types, specifying their type variables

This issue was originally filed by @Scorpiion

In order to do serialization/deserialization (more specifically deserialization) of a class Foo that has a List<Bar> list we need this.
This simple class:
class For {
  List<Bar> l;
}
Can not be serialized and later correctly deserialized because 'l' will be null and we can't instantiate 'List<Bar>' reflectively.
Quote of Alan Knight describing the issue:
"I think that what he wants is to create instances of arbitrary types, specifying their type variables. I can get a ClassMirror on List from the mirror system. And I can create a new instance of it, giving me a List<dynamic>.  But if I want to create a new List<Foo> I can't do it, because the only way to create a ClassMirror on List<Foo> is to already have an instance of List<Foo>"
For more discussion leading up to this issue please see the mailing list thread:
https://groups.google.com/a/dartlang.org/forum/#!topic/misc/9ze4Cqn5iAc

With null-safety you can now use late for instance variables which cannot be initialized immediately, or late assignment of final local variables.
The is not general way to create an instance of a type. The type can (like here) be an abstract class. There might not be any instances of that class, and no easy way to choose a concrete subclass, call a constructor taking arbitrary arguments.

authors: DartBot lrhn


text:
Async: "await for" vs. "listen()" performance

If I subscribe to the streams events via await for , then handling the events is significantly slower than using a listen() method.
In the case of my test code, I found that await for is 2x slower than listen().
I don't know if this is a issue, but it is pretty annoying because await for is pretty cool feature.

Just to be clear, did you mean in the VM or dart2js or both?

Issue occurs in both cases.

Not sure what's the status on this one but I was curious to run these tests myself and look at the numbers.
The original test code from @deftomat worked pretty much the same for me. But I also modified it to use benchmark_harness as it is recommended here: https://www.dartlang.org/articles/benchmarking/.
Here is modified version: https://dartpad.dartlang.org/48a9ed61272478edc881
It wouldn't work on Dartpad though, since it doesn't support pub packages.
The results are a bit confusing to me.
There is two benchmarks: AwaitFor and Listen. I ran each of these separately (the other one just commented out in main()).
Here is the numbers I got:
AwaitFor(RunTime): 16.702827197169466 us.
Listen(RunTime): 33.082386130656566 us.

So the picture is quite opposite to the original test. AwaitFor seems to be two times faster than Listen.
I ran those on Dart VM only though (1.12.1).
Also if I try to run both tests at the same time (both uncommented in main()) I get completely different numbers. And it also depends on the order of the tests too.
For instance, here is numbers when AwaitFor is run first:
AwaitFor(RunTime): 16.50255348976935 us.
Listen(RunTime): 80.67423832702362 us.

And here is for when Listen is first:
Listen(RunTime): 32.27464777418992 us.
AwaitFor(RunTime): 30.14119296371708 us.

I was wondering if anyone can shed some light on this and explain why results are so different?
It would be nice to understand why results are so different.

Oh, looks like benchmark_harness doesn't work well with async stuff. I'll play a bit more with it to get something working...

FYI, AngularDart has requested a lint to remove all uses of async/await from our code-base:
https://github.com/dart-lang/linter/issues/1010

Isn't that working as expected?
await for awaits for each handler call to complete (serial), while listen or forEach just fire away also for subsequent events when previous handler calls are not yet completed (kinda parallel).

authors: deftomat matanlurey pulyaevskiy sethladd zoechi


text:
dartdevc invocation issues

When I build the current SDK and run dartdevc, I get the following output:
Could not find an option named "dart-sdk".

Usage: dartdevc <command> [arguments]

Global options:
-h, --help    Print this usage information.

Available commands:
  compile   Compile a set of Dart files into a JavaScript module.
  help      Display help information for dartdevc.

Run "dartdevc help <command>" for more information about a command.

It looks like the invocation script is trying to pass a --dart-sdk option that isn't recognized. This also seems to happen with 1.17.0-dev.3.0.

This was fixed in https://github.com/dart-lang/dev_compiler/issues/505 & rolled forward to that commit in https://github.com/dart-lang/sdk/commit/95117b6086362de49c3d4e802985830e69cba7f7 ... but it was very recent (I think last night :) )


text:
Update imports on paste: should have a way to disable it

Unless it's perfect – for all users, it's just annoying. The checkbox should be just "don't ask again" and then save the default to the answer the user picks – yes/no

Also, the No text doesn't seem centered...

@kevmoo You'll find an option to disable the feature completely in Preferences.

@kevmoo You'll find an option to disable the feature completely in Preferences.

I'd rather have it inline here. ESPECIALLY if we don't end up fixing all of these edge cases.

Ok, switched from Always update, don't ask again to Remember, don't ask again that also remembers No answer.
Feel free to close this issue.

Awesome! Thanks!
On Fri, Nov 3, 2017 at 10:38 AM, Alexander Doroshko <
notifications@github.com> wrote:

Ok, switched from Always update, don't ask again to Remember, don't ask
again that also remembers No answer.
Feel free to close this issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/sdk/issues/31239#issuecomment-341775611,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABCikJ3Kx9qkgApBYi08xueaGowoXbzks5sy0-sgaJpZM4QJnew
.

Will leave it open until I get the latest...

Hey, to weight in here -
We should avoid if at all possible showing the user model dialogs as they're typing. Long term, I think we want:

a setting in the preference dialog to disable (which Alex says we have today)
no dialog prompt when the user hits paste
for the auto-managed imports to just work; to insert correct imports when those can be determined, and to make no changes to the imports if there's a situation where we can't reason about code well (incorrect code, truly ambiguous imports, ...)

Closing as stale and our focus has changed over time.

authors: alexander-doroshko devoncarew keertip kevmoo


text:
analyzer ConstantVerifier reports wrong errors

In linter prefer_const_constructors we use ConstantVerifier to test if const can be used to instanciate an object. In the following case, no lint is trigger:
// a.dart
class A {
  const A();
  static const A instance = const A();
}

// b.dart
import 'a.dart';
class B {
  const B(this.v);
  final B v;
}
f1() => new B(A.instance); // should LINT but nothing

The last line is not linted because the evaluation of const B(A.instance) with ConstantVerifier triggers 2 errors: CompileTimeErrorCode.INVALID_CONSTANT and CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT. However using const instead of new does not trigger error with analyzer.
Note that using new B(const A()); triggers correctly a lint to use const B(const A()). So the issue seems to be with constant fields defined in an other library.
(tested with 2.0.0-dev.15.0 and 1.25.0-dev.11.0)

The issue seems to be that ConstantExpressionsDependenciesFinder do not collect identifiers pointing on const elements.
I tried some changes and make it work
index b097c0e..88b00cc 100644
--- a/pkg/analyzer/lib/src/dart/constant/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/constant/utilities.dart
@@ -124,6 +124,17 @@ class ConstantExpressionsDependenciesFinder extends RecursiveAstVisitor {
   }

   @override
+  void visitSimpleIdentifier(SimpleIdentifier node) {
+    final element = node.staticElement;
+    if (element is PropertyAccessorElement &&
+        element.variable is ConstVariableElement) {
+      _find(node);
+    } else {
+      super.visitSimpleIdentifier(node);
+    }
+  }
+
+  @override
   void visitListLiteral(ListLiteral node) {
     if (node.constKeyword != null) {
       _find(node);

Unfortunately this change makes some tests failed and I don't know what should be done to make tests succeed.

It looks like there's a typo in the example. The classes A and B are not related to each other, so the use of an instance of A as an argument to the constructor for B, which expects a B is not valid. Try changing the type of the field v to A.
Perhaps the constant evaluator doesn't check assignability in some case where it ought to.

Sorry I made a typo when copying the test I made. My test didn't have the typo. I just redo the test with the following code and face the same issue.
// a.dart
class A {
  const A();
  static const A instance = const A();
}

// b.dart
import 'a.dart';
class B {
  const B(this.v);
  final A v;
}
B f1() => new B(A.instance); // should LINT but nothing

Note that I see the same kind of issue for the upcoming version of prefer_const_declarations (that also use ConstantVisitor) with the following code:
// a.dart
class A {
  const A();
  static const A instance = const A();
}

// b.dart
import 'a.dart';
void main() {
  final a = A.instance; // should LINT but nothing
}


text:
LSP emit very long response.

@DanTup
dart_analysis_server --lsp emits very long response for textDocument/completion.
This response makes editor freeze.
The log file is here.
lsp-log.txt
The target dart file is this. -> https://github.com/zesage/flutter_compass/blob/master/lib/main.dart

Which editor are you using? I recently added completions for symbols that aren't yet imported (as exists in the other editors) which will definitely have made the set of results much larger. The impact of this may depend on the editor.
You  can disable this feature by setting suggestFromUnimportedLibraries: false in your initializationOptions (how you configure this will depend on which editor).
@bwilkerson @natebosch I made this default to enabled because I thought it was good functionality and there were no perf issues in VS Code but I now wonder whether it may be better to make this opt-in? It means some users might not know of its existence (unless the editor exposes an obvious setting - which we probably would in VS Code - and default to true). WDYT?

IMO defaulting to true makes sense

That would be my preference, though I don't want it to cause issues that are frustrating to users. Do you know what the performance is like in Vim? It is a lot of data, so it might depend a lot on how the particular editors LSP client scales based on the number of items.
I just remembered from #37011 that @itome is using emacs. I had a quick search and found this from just yesterday:
https://www.reddit.com/r/emacs/comments/brc05y/is_lspmode_too_slow_to_use_for_anyone_else/
it sounds like it may be similar and mentions changing gc-cons-threshold to adjust GC. There's also this comment:

AFAIK there will be some speed improvements with native json parsing added to newer Emacsen.

So I think probably this is an emacs performance issue, and using the setting above is probably a reasonable workaround in the meantime.
@itome let me know if that sounds reasonable and whether the flag helps with the issue. Thanks!

Yes I'm using emacs, I checked detailed cpu usage with profiler.
When dart_analysis_server active, json-read-from-string takes 20% of cpu usage and Automatic GC takes 38% (While both of them are less than 1% when using rust language server).
Set gc-cons-threshold to 10000000000 makes Automatic GC 0% (But maybe this is not good because emacs can't release resources)
And native json support is new feature of Emacs27 (while current stable version is 26.2).
Maybe this have to be fixed in client side.
I opened issue in emacs-lsp https://github.com/emacs-lsp/lsp-mode/issues/851

Thanks for the info. It sounds like there's nothing to do on the server then. We have the initialisation option mentioned above that allows you to turn off this feature, but otherwise it sounds like you have a workaround (increasing GC threshold - maybe you could set it to something a little lower if you're worried about not having GC, but high enough to not cause this issue) and Emacs27 may improve things without it.
Let me know if you think this isn't the case, or if you hit any other issues. Thanks!

@itome

Set gc-cons-threshold to 10000000000 makes Automatic GC 0% (But maybe this is not good because emacs can't release resources)

FTR 10000000000 seems to be too much ~9gb .

@DanTup Thank you for your polite reply and sorry for the confusion.
@yyoncho Thanks, it's just for testing of json parser speed without gc time.
Maybe 10000000 is enough, I think.

@DanTup

Thanks for the info. It sounds like there's nothing to do on the server then.

What you can do on the server is remove the "documentation" from CompletionItem and support completionItem/resolve this will cut probably 80% of the size of the textDocument/completion.

@yyoncho good idea! I've already added support for completionItem/resolve to support this feature, but docs are currently only available in the initial request. I'll make a note to have a look at what's involved in changing this soon :-)

@yyoncho @itome FYI I just landed changes that reduce the JSON significantly (removing docs, edits, and all values that were optional and explicitly set to the default). In my testing a full request/response in VS Code for 8.5k items went from almost 3 seconds to around 300ms (and from around 8MB JSON to around 2MB).
Hopefully this will improve things somewhat for Emacs if you want to try re-enabling this. You'll need to wait for tomorrow's nightly (for Dart) or for it to roll into Flutter to get the changes though. The related commits are shown tagged at the bottom of https://github.com/dart-lang/sdk/issues/37163.

@DanTup Very good! I'll try it tomorrow and see if the completion speed is optimized.

@DanTup I tried nightly build! It seems usable enough! thanks.

Excellent :-) If you do hit any other problems with the LSP server, do open issues here and I'll take a look :-)

authors: DanTup itome natebosch yyoncho


text:
Do not check for existence of .analysis_options

When the analyzer is looking for the default analysis options for a package, it checks against analysis_options.yaml and .analysis_options. .analysis_options has been deprecated for a while. There is also a hint that shows up in the IDE asking users to migrate to analysis_options.yaml.
So it should be safe at this time to remove the checks for .analysis_options while trying to find the default options file.

@kevmoo, wdyt?
/cc, @stereotype441 , @scheglov

@keertip – is this pretty well contained or is this something causing complexity and issues elsewhere?
Might be a good thing to take care if in Vnull-safety+1

This is well contained, will not cause complexity elsewhere.
Looking at this now since it impacts the number of file access a stateless analysis would do every time it has to analyze a file. In a distributed system file access is more expensive than on a local machine.

https://dart-review.googlesource.com/c/sdk/+/138660

@keertip points for including the SHA where it was closed, too – 8329bd7ca81e4ff0706cbc9603e2a1ca295ee3a8 – makes it easier to find which release it's in!

Thanks Kevin!

authors: keertip kevmoo


text:
Bug: Type inference of List parameter in method with restricted type parameter resulting in analysis error

I'm creating this issue in response to a question that was asked today on StackOverflow.
As of Dart 2.12.0, the following code results in a static type error:
void main() {
  final nums = [1, 2.0, 3.5];
  final ints = [1, 2, 3];
  final doubles = [1.1, 2.2, 3.3];

  sums(nums);
  sums(ints);
  sums(doubles);
}

void sums<T extends num>(List<T> list) {
  T res = list[0];

  for (var i = 1; i < list.length; i++) {
    res = res + list[i];
  }

  print(res);
}

main.dart:15:15: Error: A value of type 'num' can't be assigned to a variable of type 'T'.
    res = res + list[i];
              ^

The same code when run in Dart 2.10.5 compiles successfully and prints the following:
6.5
6
6.6

When the sums method is altered to include the suggested fix, the error goes away in Dart 2.12.0:
void sums<T extends num>(List<T> list) {
  T res = list[0];

  for (var i = 1; i < list.length; i++) {
    res = res + list[i] as T;
  }

  print(res);
}

But when it is changed to use an addition-assignment operator, the error persists regardless of the cast. However, the static analysis error is hidden in the IDE (VS Code, DartPad) by a warning that suggests the cast is unnecessary:
void sums<T extends num>(List<T> list) {
  T res = list[0];

  for (var i = 1; i < list.length; i++) {
    res += list[i] as T; // IDE warning, error on `dart analyze` or on compile
  }

  print(res);
}

Both of these amended versions run flawlessly in Dart 2.10.5, with or without the cast.
This behavior has been confirmed on Mac OS 11.2.3 in VS Code (Dart extension 3.20.1) as well as the null-safety version of DartPad in Chrome.

The difference is that res = res + list[i] as T; means res = (res + list[i]) as T;, whereas res += list[i] as T; means res = res + (list[i] as T);. The latter cast is unnecessary since list[i] already has type T.
The error comes from res having type T extends num, so all we know about res + something is that it returns num (that's what num.operator+ does, and all we know about T is that it implements num).
However, num is not assignable to T extends num without an implicit or explicit downcast, and Null Safety removed the implicit downcast. So, you need to cast the result.
Dart has added some special cases to the typing of int.+, and similar operators, to avoid errors like this in cases where you're just doing integer arithmetic. Those special cases do not extend to T extends num.


text:
Tried to initialize from a previous compilation, but couldn't. Error message was 'null:5242880: indicated size does not match file size at

initialize_from.dill.gz

Dart SDK Version: 2.13.4 (stable)
Using MacOSX
Using Chrome

/cc @jensjoha

Thank you for reporting this.
Rest assured that the compilation itself was not hindered by this warning, although it may have taken a little more time.
The dill file is partial which is why it couldn't be loaded.
Most likely a process was killed at the wrong time (while serializing).
I don't assume this is something you see often and I'll close the issue.

authors: Nagendra-nagy jensjoha mraleph


text:
Consider using protozero rather than JSON for timeline recording

https://perfetto.dev/docs/design-docs/protozero
This format is designed to be more performant for trace recording, and would have the added benefit of support from https://ui.perfetto.dev for viewing/sharing traces.
It would likely result in breaking customers who currently rely on getting the timeline in JSON, such as some tests in the Flutter repository that verify tracing. Some of this could be alleviated by having package:vm_service expose more strongly typed Dart objects rather than JSON for timeline events (i.e. resolving https://github.com/dart-lang/sdk/issues/47615).
/cc @bkonyi @rmacnak-google
/cc @jacob314 @kenzieschmoll

JSON is not used for timeline recording. Recording happens either in VM-internal structures that operate directly on C string pointers and fixed-width timestamps and port ids, or is forwarded to Linux/Android systrace, Fuchsia tracing or Mac Signposts. Replacing the VM-internal recording with a variable-length format would degrade recording performance.

I think Dan was referring to the output format, rather than the internal data structures.

//cc @bkonyi

Protozero uses less memory per trace event than JSON based formats will.

I think more than changing the transmission format, it's important to change the transmission protocol.  Right now the ProfilerService is apparently building up this huge blob of JSON in memory to send over the network.  It should be streaming that data or create a way to segment the data across multiple fetches so it isn't memory bound (see https://github.com/flutter/flutter/issues/101002#issuecomment-1092282633)

I'd be surprised if a binary format (where e.g. integers can just be dumped directly into the file rather than serialized to ASCII) was not at least a little faster. Fundamentally, doing less work = faster, and a well-designed binary format will be less work than JSON.

authors: Hixie a-siva dnfield gaaclarke rmacnak-google


text:
Late variable error when disabling global type inference

While debugging another issue, I encountered this odd case. This simple program works fine when we run the global type inference, but not when it's disabled:
class A {
  late final _t;
  A() {
    _t = 1;
  }
}
main () {
  print(new A()._t);
}

Running with --disable-type-inference this program produces this error:
LateInitializationError: Field '_t' has already been initialized.
    at Object.wrapException (/tmp/out.js:336:17)
    at Object._lateWriteOnceCheck (/tmp/out.js:2205:15)
    at Object.A$ (/tmp/out.js:2170:9)
    at main (/tmp/out.js:2175:34)
    at action (/usr/local/google/home/sigmund/dart/git_all/sdk/sdk/lib/_internal/js_runtime/lib/preambles/d8.js:275:31)
    at eventLoop (/usr/local/google/home/sigmund/dart/git_all/sdk/sdk/lib/_internal/js_runtime/lib/preambles/d8.js:258:9)
    at self.dartMainRunner (/usr/local/google/home/sigmund/dart/git_all/sdk/sdk/lib/_internal/js_runtime/lib/preambles/d8.js:276:5)
    at /tmp/out.js:2687:7
    at /tmp/out.js:2672:7
    at dartProgram (/tmp/out.js:2683:5)

Ah, I hadn't even considered that we might run with global type inference disabled. This may be tricky and I'll have to think about how to handle this - type inference establishes some of the invariants related to late variables that we use later on.
/cc @rakudrama

Closing since this seems to be fixed with the improvements to inference and late lowering. Feel free to reopen if we run into this again.

authors: fishythefish sigmundch


text:
'augment class A {}' cannot be parsed

  Invalid argument(s): Content produced diagnostics when parsed:
    MISSING_CONST_FINAL_VAR_OR_TYPE: Variables must be declared using the keywords 'const', 'final', 'var' or a type name. - 1:1
    EXPECTED_TOKEN: Expected to find ';'. - 1:1

But macro class A {} can.

That is as intended(-ish). The support for augment class was originally added like the support macro class, but further development showed that augment class (for now) is only need in augmentation libraries. For this reason, augment class is now only supported when the scanner is configured for augmentation libraries, in which augment is treated as a modifier, whereas macro class is supported when the macros experimental flag is enabled.

OK, thank you.
This is inconvenient with the way analyzer works - we can parse a file not knowing initially how it will be referenced later. And it feels inconsistent with the way language version works, which allows you to set @dart = x.y in parts, but will check that it is the same as in the library.
So, for now in the analyzer I will enable augment anywhere when the macros feature is enabled.
https://dart-review.googlesource.com/c/sdk/+/242660

... augment class (for now) is only need in augmentation libraries.

How do we know that an arbitrary file is an augmentation library? Is there a file naming convention?

Currently we only read these files knowing that they are augmentation libraries.
The general discussion of how to identify these is in https://github.com/dart-lang/language/issues/2120

Thank you for the pointer.

authors: bwilkerson johnniwinther scheglov


text:
Dart run  with --pause_isolates_on_start by default. How it change?

After update flutter sdk to version 3.0.1 my dart web server app started loading with --pause_isolates_on_start.
This At the start, the application pauses and in order to continue it, you need to follow the link from the console to Dart DevTools debugger in browser and then push the button "Resume" to continue the application.
I work in Intellige Idea and in debug console i see next:
/Volumes/DATA/Dev/sdk_flutter/3.0.1-stable/flutter/bin/cache/dart-sdk/bin/dart --enable-asserts --pause_isolates_on_start --enable-vm-service:56281 /Volumes/DATA/Dev/Projects/dpt/api/bin/main.dart

The Dart VM service is listening on http://127.0.0.1:56281/DXBGulVE0tc=/

The Dart DevTools debugger and profiler is available at: http://127.0.0.1:56281/DXBGulVE0tc=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A56281%2FDXBGulVE0tc%3D%2Fws

I tried in the project settings to specify the launch options [--no-pause-isolates-on-start] but in this case my app launch with this params, but it not a run params. like this...

dart run main.dart --no-pause-isolates-on-start

but it should be...

dart --no-pause-isolates-on-start main.dart

How i can change default dart run params?
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on Mac OS X 10.15.7 19H1824 darwin-x64,
    locale ru)
[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

flutter --version
Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision fb57da5f94 (4 weeks ago) • 2022-05-19 15:50:29 -0700
Engine • revision caaafc5604
Tools • Dart 2.17.1 • DevTools 2.12.2

These flags:
--pause_isolates_on_start --enable-vm-service:56281

should be used by the IDE when you're debugging an app. The pause isolates flag lets the IDE set any user breakpoints before the app starts running, and then resume the isolate once all the breakpoints are set.
I don't believe we should pass these flags when running an app however. I'm not sure which you're doing above.
Triaging to the IntelliJ area for further eval.

cc @jwren

Did I understand correctly that the IDE should resume the application after it sets all the breakpoints, but in my case it does not?
What can I do now to make my application run without pause?
The way it was before the flutter update....

I make a video about my situation
https://youtu.be/Nz3UdvPATxs

No changes on the IDE side, @bkonyi, any changes here with the VM?
@zaidite what is your Dart SDK version?

@jwren definitely not. It looks like --pause_isolates_on_start is being passed alongside --enable_vm_service which is why the VM is pausing.

authors: bkonyi devoncarew jwren zaidite


text:
Change package:vm_service BoundVariable.value from "dynamic" to "Response"

Noted at https://github.com/dart-lang/sdk/issues/51916#issuecomment-1492918215. The current type of BoundVariable.value is dynamic:
https://github.com/dart-lang/sdk/blob/57ba99c2d3a3688478427654f7711ed7027b163f/pkg/vm_service/lib/src/vm_service.dart#L3088-L3089
All of the types it can be implement/extend Response so this could be Response.
The problem with dynamic is that it's easy to pass to any function and get a runtime error (which is what #51916 was, assuming it was always InstanceRef).
@bkonyi notes this code is generated so might not be trivial to know the types all share a common base.

FYI @derekxu16. This isn't high priority, but we'll probably want to do a breaking release at some point to make this change. It'd probably be sufficient to change all of our instances of dynamic in vm_service classes to Object to avoid having to figure out the common base class of each type in a union.

It'd probably be sufficient to change all of our instances of dynamic in vm_service classes to Object

Yeah, that sounds like a much simpler change and would've also prevented the issue I hit :-)

authors: DanTup bkonyi


text:
Unnecessary type check while destructuring dynamic type

I encounted a linter warning while records destructuring.
final (a, b) = (1, 2 as dynamic);
print(b is String); // Unnecessary type chck, the result is always `true`

However, line 2 will result false.

Great catch!

Interesting! The analyzer reports this warning for b, but not for an access to the record field using the implicitly induced getter:
void main() {
  final (b,) = (2 as dynamic,);
  print(b is String); // Unnecessary type chck, the result is always `true`
  int i = b; //

  final record = (2 as dynamic,);
  print(record.$1 is String); // No diagnostic messages.
}

A declaration like int i = b; shows that the type of b is reported as dynamic, but a dynamic variable declared using dynamic v = 2; or var v = 2 as dynamic; does not give rise to the same warning.

authors: eernstg luo3house srawlins


text:
Bad parser recovery with misshapen extension type, analyzer crash.

Not sure if parser deliberately lets the invalid code through, and front-ends fail to give useful error messages,
or the parser should just have rejected earlier.
Example:
extension type F._<X>(X _) {}

where the ._ is before the <X>, not after where it belongs.
That gives the error:
Analyzing acr.dart...
Unhandled exception:
type 'Null' is not a subtype of type 'FormalParameterListImpl' in type cast
#0      AstBuilder.endPrimaryConstructor (package:analyzer/src/fasta/ast_builder.dart:2776:39)
#1      Parser.parseExtensionTypeDeclaration (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3157:16)
#2      Parser.parseExtension (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3024:14)
...

suggesting that the parsing was considered "successful".
There is no crash in the CFE, which instead reports this cascade of badly recovered errors.
acr.dart:1:18: Error: A primary constructor declaration must have formal parameters.
Try adding formal parameters after the primary constructor name.
extension type F._<X>(X _){}
                 ^
acr.dart:1:18: Error: An extension type declaration must have a body, even if it is empty.
Try adding an empty body.
extension type F._<X>(X _){}
                 ^
acr.dart:1:19: Error: Expected a declaration, but got '<'.
extension type F._<X>(X _){}
                  ^
acr.dart:1:20: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
extension type F._<X>(X _){}
                   ^
acr.dart:1:20: Error: Expected ';' after this.
extension type F._<X>(X _){}
                   ^
acr.dart:1:21: Error: Operators must be declared within a class.
Try removing the operator, moving it to a class, or converting it to be a function.
extension type F._<X>(X _){}
                    ^
acr.dart:1:23: Error: 'X' isn't a type.
extension type F._<X>(X _){}
                      ^
acr.dart:1:20: Context: This isn't a type.
extension type F._<X>(X _){}
                   ^

Possibly, just have the parser recognize type arguments before and after the primary constructor name, then fail parsing if there are any after. (That also leaves us room to add generic constructors eventually.)
(@scheglov Even with bad recovery, the analyzer probably shouldn't crash.)

https://dart-review.googlesource.com/c/sdk/+/330242

authors: lrhn scheglov


text:
Update linked_list.dart

Replace double-linked list with circular doubly linked list in description.

[x] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

Should we close this PR?

Let's. It's a small change, and I disagree (a little) with the focus it adds.
It's easy enough to start from scratch if we find a better approach.

authors: EmreKaratopuk lrhn vsmenon


text:
web-angular tests: drop use of page object class and pageloader mock

Fixes #487

Coverage remained the same at 83.846% when pulling 4e5e999fbea9770add8c2d6bcb588374a1401d98 on chalin-web-angular-tests-0426 into 5620319a42714d9b4beb206926080246401993f3 on master.

authors: chalin coveralls

repo: dart-lang/stagehand


text:
netstandard2.0/netcoreapp2.0

Support for netstandard2.0

Thanks for doing this

authors: dasMulli rydergillen-compacSort


text:
fix(api-v2): Fix post-update check for resource with standoff link (DSP-841)

resolves DSP-841

[x] FIx post-update check for resource created with standoff link.
[x] Add test.
[x] Fix docs to mention that you have to install redis-cli to get client test data.

Thanks for the quick review!

repo: dasch-swiss/knora-api


text:
make build-frontend fails

Output of make build-frontend :
[*] Cleanup SvelteKit App
[OK] Cleanup done
[*] Building SvelteKit App

> dose@1.0.0 tailwind:build
> cross-env TAILWIND_MODE=build cross-env NODE_ENV=production postcss src/styles/tailwind.css -o src/styles/tailwind-output.css

warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
Source path: /data/dascr-board/frontend/src/styles/tailwind.css
Setting up new context...
Finding changed files: 5.329ms
Generate rules: 52.277ms
Build stylesheet: 1.104ms
Potential classes:  2611
Active contexts:  1
Content match entries 1206
JIT TOTAL: 187.436ms

> dose@1.0.0 build:only
> svelte-kit build

file:///data/dascr-board/frontend/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.263_svelte@3.46.4/node_modules/@sveltejs/kit/dist/cli.js:1176
					} else if (allow?.length && cwd) {
					                 ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
npm ERR! code 1
npm ERR! path /data/dascr-board/frontend
npm ERR! command failed
npm ERR! command sh -c svelte-kit build

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/davy/.npm/_logs/2022-02-10T10_16_34_810Z-debug.log
make: *** [Makefile:52: build-frontend] Error 1

Log file :
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build:only' ]
1 info using npm@7.5.2
2 info using node@v12.22.5
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/data/dascr-board/frontend/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/home/davy/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/etc/npmrc Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 2ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 10ms
19 verbose npm-session 20088485fea873b5
20 timing npm:load Completed in 19ms
21 timing command:run-script Completed in 112ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/usr/share/nodejs/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (events.js:314:20)
22 verbose stack     at maybeClose (internal/child_process.js:1022:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
23 verbose pkgid dose@1.0.0
24 verbose cwd /data/dascr-board/frontend
25 verbose Linux 5.13.0-28-generic
26 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build:only"
27 verbose node v12.22.5
28 verbose npm  v7.5.2
29 error code 1
30 error path /data/dascr-board/frontend
31 error command failed
32 error command sh -c svelte-kit build
33 verbose exit 1

These are the versions that are installed :
git : 2.32.0
go : 1.17.6
gcc : 11.2.0
node : 12.22.5
pnmp : 6.30.1
yarn : 1.22.17
I have no idea on how to solve this.
Can anyone help?

pnpm version
{
npm: '7.24.1',
node: '14.17.5',
v8: '8.4.371.23-node.76',
uv: '1.41.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.17.2',
modules: '83',
nghttp2: '1.42.0',
napi: '8',
llhttp: '2.1.3',
openssl: '1.1.1k',
cldr: '39.0',
icu: '69.1',
tz: '2021a',
unicode: '13.0'
}

Mine seams to be 14.17.5 as I tested building yesterday. Maybe you try updating and retry building?
Other than that the error is unfortunately not really specific.

In retrospective choosing svelte for frontend might have been a failure as they introduce breaking changes all the time.

Thx. Updating node to 14.19.0 did the trick.

authors: patrickhener ptahbe

repo: dascr/dascr-board


text:
Playback Errors

I'm getting a playback error in the latest version of Chrome. It doesn't appear to relate to any action taken inside the app.
I initially thought this was a mixed content issue (http vs https), but it appears this is happening on all tracks.
I didn't see anything fishy in the console, either. Here's the track that was having issues (I think).
{"playState":1,"playingTrack":{"id":"-Jp43-HuePFbPWCb9Ueu","timestamp":"2015-05-11T22:19:47.336Z","trackKey":"t50644953","userKey":"s2559","votes":{"s2559":"like","s699613":"like"}},"position":177}

I'll keep an eye out for more instances.

I got reports from a couple of users that they experienced playback errors that required a refresh to correct. The song starts playing, the album art comes in and then everything goes away.
Also, they said the following, "I think there are sync issues from time to time, if you're behind and the party track ends, it just skips to the next."

I spotted an NPE for me at one point.  This is the code snippet where the error happened:
      var data = _.extend({
        'track': response.result[self.rdioTrackKey],
        'formattedDuration': self.getDuration(response.result[self.rdioTrackKey].duration),  <---- this line broke
        'masterUser': userName,
        'addedBy': addedByName,
        'favorited': favorited
      });

This might also be tied to the region issue.  But we need to scrub the player code to handle bad data better and that should prevent the whole section from blanking out.

I don't think it has to do with the region since it will play after refresh. When I was working with the js API on another project I was having similar issues. It seems to me that it has to do with connection issues between Rdio and the end user through the API. That's just a feeling though. It will take some digging to find out if that's correct, but that's the first place I would look.

I'm not sure if this will be of any help, but when I'm running W7 with latest Firefox, that artwork disappears and I have to click refresh (as stated). I run this on an old XP machine at work. The sound stops but the artwork and buttons stay. I click on the musical note button and the song resumes.

Here's what I've found from testing the party over the weekend.

When I host the party, I have to click the resume playback or take master control button after each song. Listeners do not have to do that. I'm not having to refresh to make the songs start.

When we "commandeered" another party (afternoon vibes), the songs mostly played without interruption. There were some that would start and after about 1 second, the Now Playing panel would disappear and refreshing was necessary. One song (Peace Train by Cat Stevens) did not play after restarting. We gave that song enough time to complete and the next song did start and play properly. (I did check and peace train played on the regular rdio site.)

At 5:55 am pacific time, a song started, played about a minute and then I had to the take master control button to start the song back.

Not sure if you have logfiles or not, but the activity would have occurred between 5am and 5:40 am pacific time on 5-25-15.
Let me know if there any tests I can run that might be helpful to isolate the bug.

authors: FreeForm-Radio MikeNGarrett rstecker

repo: dasevilla/rdio-shindig


text:
confirm node/edge deselect after container click

Hey @dash14,
Thank you for creating and maintaining this great component!
Is there a way to prevent deselection of a node/edge after a container click? and use a confirm dialog for example.
I experimented a bit with the 'node:select' and 'view:click' events but I could not find a solution. Hope you can help me out.
Thanks in advance.

Hi @klipdassie,
Thank you for using v-network-graph!

Is there a way to prevent deselection of a node/edge after a container click? and use a confirm dialog for example.

There is no direct functionality, but it may be controlled using the selected-nodes prop.
Two examples are shown below.
In the first example, when the node selection state changes and the number of nodes selected is less than one, the node before the change is forcibly reselected.
<script setup lang="ts">
import { defineConfigs } from "v-network-graph";
import { ref, watch } from "vue"
import data from "./data"

const configs = defineConfigs({
  node: {
    selectable: true
  },
})

const selectedNodes = ref<string[]>(["node1"])

watch(selectedNodes, (value, oldValue) => {
  if (value.length === 0 && oldValue.length > 0) {
    selectedNodes.value = oldValue
  }
})

</script>

<template>
  <v-network-graph
    v-model:selected-nodes="selectedNodes"
    :nodes="data.nodes"
    :edges="data.edges"
    :layouts="data.layouts"
    :configs="configs"
  />
</template>

// data.ts
import { Nodes, Edges, Layouts } from "v-network-graph"

const nodes: Nodes = {
  node1: { name: "Node 1" },
  node2: { name: "Node 2" },
  node3: { name: "Node 3" },
  node4: { name: "Node 4" },
}

const edges: Edges = {
  edge1: { source: "node1", target: "node2" },
  edge2: { source: "node2", target: "node3" },
  edge3: { source: "node2", target: "node4" },
}

const layouts: Layouts = {
  nodes: {
    node1: { x: 0, y: 80 },
    node2: { x: 200, y: 80 },
    node3: { x: 360, y: 0 },
    node4: { x: 360, y: 160 },
  },
}

export default {
  nodes,
  edges,
  layouts,
}

The second example is a bit more complicated. When a selected node is deselected, a confirmation is shown, and the selection is only deselected if "Yes" is clicked.
data.ts is the same as in the first example.
<script setup lang="ts">
import { defineConfigs } from "v-network-graph";
import { ref, watch } from "vue"
import data from "./data"

const configs = defineConfigs({
  node: {
    selectable: 1 // only one node
  },
})

const deselecting = ref(false)
const lockedNodes = ref<string[]>([])
const selectedNodes = ref<string[]>([])

watch(selectedNodes, (value, oldValue) => {
  // Note that when assigning a value to a variable monitored by watch, it is called recursively.

  if (value.length > 0 && oldValue.length === 0 && lockedNodes.value.length === 0) {
    // save selected nodes
    lockedNodes.value = value
    return
  }

  if (lockedNodes.value.length > 0 && !isEquals(value, lockedNodes.value)) {
    // prevent update selection
    selectedNodes.value = lockedNodes.value
    deselecting.value = true
    return
  }
})

function deselect() {
  lockedNodes.value = []
  selectedNodes.value = []
  deselecting.value = false
}

function isEquals<T>(array1: T[], array2: T[]) {
  return JSON.stringify(array1) === JSON.stringify(array2)
}
</script>

<template>
  <v-network-graph
    v-model:selected-nodes="selectedNodes"
    :nodes="data.nodes"
    :edges="data.edges"
    :layouts="data.layouts"
    :configs="configs"
  />
  <div v-if="deselecting">
    Are you sure you want to deselect "{{ selectedNodes[0] }}"?
    <button @click="deselect">Yes</button>
  </div>
</template>

Hope this will help.

Hey @dash14
Thank you for providing the examples, very useful!


text:
mypy errors on CI

There are some existing mypy errors on CI. Mostly having to do with many types of arrays being allowed, but code expecting a certain type. I am hoping to take a look.
>>> mypy dask_ml/metrics
dask_ml/metrics/regression.py:102: error: "ndarray" has no attribute "chunks"
dask_ml/metrics/pairwise.py:30: error: "ndarray" has no attribute "to_delayed"
dask_ml/metrics/pairwise.py:37: error: "ndarray" has no attribute "chunks"
dask_ml/metrics/pairwise.py:42: error: "ndarray" has no attribute "chunks"
dask_ml/metrics/pairwise.py:58: error: "ndarray" has no attribute "chunks"
dask_ml/metrics/pairwise.py:59: error: "ndarray" has no attribute "map_blocks"
dask_ml/metrics/pairwise.py:136: error: Argument 2 to "check_pairwise_arrays" has incompatible type "Optional[ndarray]"; expected "ndarray"
dask_ml/metrics/pairwise.py:144: error: Argument 2 to "check_pairwise_arrays" has incompatible type "Optional[ndarray]"; expected "ndarray"
dask_ml/metrics/pairwise.py:161: error: Argument 2 to "check_pairwise_arrays" has incompatible type "Optional[ndarray]"; expected "ndarray"
dask_ml/metrics/pairwise.py:176: error: Argument 2 to "check_pairwise_arrays" has incompatible type "Optional[ndarray]"; expected "ndarray"
dask_ml/metrics/pairwise.py:211: error: Argument 2 to "check_pairwise_arrays" has incompatible type "Optional[ndarray]"; expected "ndarray"
Found 11 errors in 2 files (checked 5 source files)

>>> mypy dask_ml/preprocessing
dask_ml/preprocessing/label.py:200: error: Incompatible default for argument "uniques" (default has type "None", argument has type "ndarray")
dask_ml/preprocessing/label.py:202: error: "ndarray" has no attribute "cat"
dask_ml/preprocessing/label.py:212: error: "ndarray" has no attribute "cat"
dask_ml/preprocessing/data.py:39: error: Incompatible types in assignment (expression has type "float", variable has type "ndarray")
dask_ml/preprocessing/data.py:78: error: Need type annotation for 'n_features_in_'
dask_ml/preprocessing/data.py:145: error: Need type annotation for 'n_features_in_'
dask_ml/preprocessing/data.py:229: error: Argument 1 to "_handle_zeros_in_scale" has incompatible type "List[float]"; expected "ndarray"
dask_ml/preprocessing/data.py:230: error: Need type annotation for 'n_features_in_'
dask_ml/preprocessing/data.py:335: error: Missing return statement
dask_ml/preprocessing/data.py:371: error: "ndarray" has no attribute "map_blocks"
dask_ml/preprocessing/data.py:385: error: "ndarray" has no attribute "map_blocks"
dask_ml/preprocessing/data.py:391: error: "ndarray" has no attribute "map_blocks"
dask_ml/preprocessing/data.py:399: error: "ndarray" has no attribute "map_blocks"
dask_ml/preprocessing/data.py:764: error: Incompatible types in assignment (expression has type "Tuple[Tuple[Any, ...], Any]", variable has type "ndarray")
dask_ml/preprocessing/data.py:774: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "ndarray")
dask_ml/preprocessing/data.py:989: error: Incompatible types in assignment (expression has type "Tuple[Tuple[Any, ...], Any]", variable has type "ndarray")
dask_ml/preprocessing/data.py:999: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "ndarray")
dask_ml/preprocessing/_encoders.py:119: error: Incompatible default for argument "dtype" (default has type "Type[floating[Any]]", argument has type "dtype[Any]")
dask_ml/preprocessing/_block_transformer.py:74: error: Need type annotation for 'func'
Found 19 errors in 4 files (checked 5 source files)

As mentioned in https://github.com/dask/dask-ml/pull/784#issuecomment-771732976, disabling mypy on CI is an option.

authors: TomAugspurger jsignell

repo: dask/dask-ml


text:
LogisticRegression cannot train from Dask DataFrame

A simple example:
from dask import dataframe as dd
from dask_glm.datasets import make_classification
from dask_ml.linear_model import LogisticRegression

X, y = make_classification(n_samples=10000, n_features=2)

X = dd.from_dask_array(X, columns=["a","b"])
y = dd.from_array(y)

lr = LogisticRegression()
lr.fit(X, y)

Returns KeyError: (<class 'dask.dataframe.core.DataFrame'>,)
I did not have time to try if it is also the case for other models.

Thanks. At the moment the dask_glm based estimators just work with dask arrays, not dataframes. You can use .values to get the array.
I'm hoping to put in some helpers for handling all the extra DataFrame metadata sometime soon, so this will be more consistent.

Thank you so much for the quick response!
The problem is that when fitting a glm with intercept (which is usually the case), the dask array containing the features needs to have defined the chunk size, which I believe it is not possible when the array comes from a dataframe.
Anyways, I will reach out to the main dask issue page and ask there.
Thank you!

@julioasotodv, yes I forgot about that case. Let me put something together quick.

Do you think there is a way to achieve this without making changes to dask's engine itself?

What do you mean by "dasks's engine"?
See https://github.com/dask/dask-glm/issues/63 for a discussion on the
relationship between dask-ml and dask-glm, and
https://github.com/dask/dask-glm/compare/master...TomAugspurger:add-intercept-dd
for what the fix will look like.
On Mon, Nov 6, 2017 at 5:05 PM, Julio Antonio Soto <notifications@github.com

wrote:

Do you think there is a way to achieve this without making changes to
dask's engine itself?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dask/dask-ml/issues/84#issuecomment-342318409, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABQHIhn3_1V1qCkEkmlNXqr09SUYkpc7ks5sz5DRgaJpZM4QR2-N
.

I see. Would it work with that fix, even if chunksize is not defined for the underlying dask array?

Yes, that should work. The solvers only require that the shape along the second axis is known:
from dask_ml.linear_model import LinearRegression
from dask_ml.datasets import make_regression

X, y = make_regression(chunks=50)

df = dd.from_dask_array(X)
X2 = df.values  # dask.array with unknown chunks along first dim

lm = LinearRegression(fit_intercept=False)
lm.fit(X2, y)

Note that fit_intercept does not currently work with unknown chunks. But when https://github.com/dask/dask-glm/compare/master...TomAugspurger:add-intercept-dd is merged, you'd just do
lm = LinearRegression()  # fit_intercept=True
lm.fit(df)

And the intercept is added during the fit.

That's awesome!
But let me be just a little picky with that change (https://github.com/dask/dask-glm/compare/master...TomAugspurger:add-intercept-dd):
In theory, if using either L1 or L2 regularization (or Elastic Net), the penalty term should not affect the intercept (this is, the "ones" column that works as the intercept should not be multiplied by the Lagrange multipliers that perform the actual regularization).
However, it would still be better than not having intercept. What do you think about this?

Thanks, I'll take a look at how other packages handle regularization of the intercept, but I think your correct. cc @moody-marlin thoughts on that?

Yea, I agree that the intercept should not be included in the regularization; I believe this is recommended best practice, and also not regularizing the intercept ensures that all regularizers still produce estimates which satisfy that the residuals have mean 0, which preserves the standard interpretation of things like R^2, etc.

Opened https://github.com/dask/dask-glm/issues/65 to track that.
I'll deprecate the estimators in dask_glm and move them over here later today.

See there is PR ( https://github.com/dask/dask-glm/pull/66 ) to deprecate the dask-glm estimators and PR ( https://github.com/dask/dask-ml/pull/94 ), which seems to have migrated the bulk of that content to dask-ml. Is this still the plan?

Yes, in my mind dask-glm has the optimizers, and dask-ml has the estimators
built on top of those.
On Tue, Jun 5, 2018 at 9:02 PM, jakirkham notifications@github.com wrote:

See there is PR ( dask/dask-glm#66
https://github.com/dask/dask-glm/pull/66 ) to deprecate the dask-glm
estimators and PR ( #94 https://github.com/dask/dask-ml/pull/94 ),
which seems to have migrated the bulk of that content to dask-ml. Is this
still the plan?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dask/dask-ml/issues/84#issuecomment-394915785, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABQHImZMyUAU1i6xb6RUlqzOslUPFnWeks5t5zgdgaJpZM4QR2-N
.

I'm facing the same issue.
Traceback (most recent call last):
  File "diya_libs/alog_main.py", line 20, in <module>
    clf.fit(X, y)
  File "/Users/asifali/workspace/pythonProjects/ML-engine-DataX/pre-processing/diya_libs/lib/algorithms/diya_logit.py", line 67, in fit
    self.estimator.fit(X, y)
  File "/anaconda3/lib/python3.6/site-packages/dask_ml/linear_model/glm.py", line 153, in fit
    X = self._check_array(X)
  File "/anaconda3/lib/python3.6/site-packages/dask_ml/linear_model/glm.py", line 167, in _check_array
    X = add_intercept(X)
  File "/anaconda3/lib/python3.6/site-packages/multipledispatch/dispatcher.py", line 164, in __call__
    return func(*args, **kwargs)
  File "/anaconda3/lib/python3.6/site-packages/dask_glm/utils.py", line 147, in add_intercept
    raise NotImplementedError("Can not add intercept to array with "
NotImplementedError: Can not add intercept to array with unknown chunk shape

Initially I tried with Dask DataFrame, later changed to Dask Array using
X = X.values #resulted in nan chunks which is causing the above error.
What am I supposed to do now? How do I install the fix, as mentioned above? As it is not present in the version available on pip.

@asifali22 that looks strange. Can you provide a full example? Does the following work for you?
from dask import dataframe as dd
from dask_glm.datasets import make_classification
from dask_ml.linear_model import LogisticRegression

X, y = make_classification(n_samples=10000, n_features=2)

X = dd.from_dask_array(X, columns=["a","b"])
y = dd.from_array(y)

lr = LogisticRegression()
lr.fit(X.values, y.values)

Having a similar issue with dask array @TomAugspurger see my SO question, Any idea?

@thebeancounter do you have a minimal example? http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports

@TomAugspurger
Hi. The code is in the SO question, do you mean copy it here?

It looks like data isn’t defined.
Also the error says you have multiple columns with no variance. You probably don’t want that.

From: thebeancounter notifications@github.com
Sent: Friday, June 14, 2019 12:31 AM
To: dask/dask-ml
Cc: Tom Augspurger; Mention
Subject: Re: [dask/dask-ml] LogisticRegression cannot train from Dask DataFrame (#84)
@TomAugspurgerhttps://github.com/TomAugspurger
Hi. The code is in the SO question, do you mean copy it here?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/dask/dask-ml/issues/84?email_source=notifications&email_token=AAKAOITHSXGZHLBI7F6J3KDP2MUMZA5CNFSM4ECHN6G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXVYGBY#issuecomment-501973767, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAKAOIUA32NFF2AGXY7LBFTP2MUMZANCNFSM4ECHN6GQ.

@TomAugspurger
Data is defined
It's regular cifar10 data, passed via a pre trained resnet 50 for feature extraction. Trains well with sklearn. I can't guarantee that there are no zero variance columns but those should not prevent learning anyway! Only waste some processing time.
Here is the data zipped (read it from folder with generator just for preventing memory from exploding)
i = ImageDataGenerator(preprocessing_function=preprocess_input)

train_flow = i.flow_from_directory(directory=test_dir, target_size=(224, 224), class_mode="sparse", batch_size=1024, shuffle=True)

pre_model = ResNet50(weights="imagenet", include_top=False)
pre_model.compile(optimizer=Adam(), loss=categorical_crossentropy)

labels = []
data = []
for i in range(len(train_flow)):
    imgs, l = next(train_flow)
    data.append(pre_model.predict(imgs))
    labels.append(l)

labels = np.concatenate(labels)
data = np.concatenate(data, axis=0)
data = data.reshape(-1, np.prod(data.shape[1:]))

Data is under
github.com/thebeancounter/data

http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports may be helpful for writing an example.
Does the error show up if you have a dummy dataset where two columns have no variance?

From: thebeancounter notifications@github.com
Sent: Sunday, June 16, 2019 5:21 AM
To: dask/dask-ml
Cc: Tom Augspurger; Mention
Subject: Re: [dask/dask-ml] LogisticRegression cannot train from Dask DataFrame (#84)
@TomAugspurgerhttps://github.com/TomAugspurger
Data is defined
It's regular cifar10 data, passed via a pre trained resnet 50 for feature extraction. Trains well with sklearn. I can't guarantee that there are no zero variance columns but those should not prevent learning anyway! Only waste some processing time.
Here is the data zipped (read it from folder with generator just for preventing memory from exploding)
i = ImageDataGenerator(preprocessing_function=preprocess_input)
train_flow = i.flow_from_directory(directory=test_dir, target_size=(224, 224), class_mode="sparse", batch_size=1024, shuffle=True)
pre_model = ResNet50(weights="imagenet", include_top=False)
pre_model.compile(optimizer=Adam(), loss=categorical_crossentropy)
labels = []
data = []
for i in range(len(train_flow)):
imgs, l = next(train_flow)
data.append(pre_model.predict(imgs))
labels.append(l)
labels = np.concatenate(labels)
data = np.concatenate(data, axis=0)
data = data.reshape(-1, np.prod(data.shape[1:]))
Data is under
github.com/thebeancounter/data
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/dask/dask-ml/issues/84?email_source=notifications&email_token=AAKAOIUVGSFQ74FUQXZGRYDP2YH3TA5CNFSM4ECHN6G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXZJ35I#issuecomment-502439413, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAKAOIQAUZ67RBF65SEHGMDP2YH3TANCNFSM4ECHN6GQ.

@TomAugspurger
Hi, I posted the code and the data. It's a solid example :-)
Anyhow, Can you maybe post a working example for using numpy array for logistic regression in dask?

I’m guessing it’s not minimal. Simplifying it may reveal the issue.
Why do you want to use dask-ml’s LR on a numpy array?

On Jun 16, 2019, at 10:49, thebeancounter notifications@github.com wrote:
@TomAugspurger
Hi, I posted the code and the data. It's a solid example :-)
Anyhow, Can you maybe post a working example for using numpy array for logistic regression in dask?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@TomAugspurger
my data originally comes from a numpy array, I need to convert it to some form that dask can learn on. Can't find any example for that in the tutorial, maybe that's the issue, can you point me to something of that kind?

https://docs.dask.org/en/latest/array-creation.html documents creating dask
arrays, including from array-like things like NumPy arrays.
Though my (vague) question was a bit deeper. Why do you want to use dask's
LR, rather than scikit-learn's or Scipy's? If you're coming from a NumPy
array, then does your data fit in memory? If so, you should just use one of
those.
On Mon, Jun 17, 2019 at 4:11 AM thebeancounter notifications@github.com
wrote:

@TomAugspurger https://github.com/TomAugspurger
my data originally comes from a numpy array, I need to convert it to some
form that dask can learn on. Can't find any example for that in the
tutorial, maybe that's the issue, can you point me to something of that
kind?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dask/dask-ml/issues/84?email_source=notifications&email_token=AAKAOIQRF2DG7VWTZ2IU7RDP25IKXA5CNFSM4ECHN6G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX2RKZQ#issuecomment-502601062,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKAOIQ4AUET3IQRB3QVNULP25IKXANCNFSM4ECHN6GQ
.

I have seen above and there is the case:
X2 = df.values  # dask.array with unknown chunks along first dim

For me if i use .values, I will not know the chunksize for this array
x= df_train.values
dask.array<values, shape=(nan, 11), dtype=float64, chunksize=(nan, 11)>

And will this influence the distributed computation?
Like the managing the memory, the speed?

@TomAugspurger
Scikit learn will not utilize the machines cores, and takes way way way too long to run...
Looking for a multithreaded solution.

@xiaozhongtian  can you please clarify? are you asking a question? Not sure I see the connection to this thread.

@TomAugspurger
I'm asking a question with the same confusion in the above.

@thebeancounter

Scikit learn will not utilize the machines cores, and takes way way way too long to run...

With the n_job = -1 in sci-kit learn, it uses the multi-process to fit. no?
But here, I want to know the manage of the memory for scikit learn and dask-ml.
If we don't use the chunk to divise the dataset, there will be no different with sci-ket learn in my opinion.

I'm having the same problem by building a dataframe from dask arrays, then calling .values just before passing it to a dask_ml.LinearRegression model. Anyone figured this out?

I'm having the same problem

I presume you mean an NotImplementedError: Can not add intercept to array with unknown chunk shape from https://github.com/dask/dask-ml/issues/84#issuecomment-503496381. Try dask.DataFrame.to_dask_array(lengths=True) https://docs.dask.org/en/latest/dataframe-api.html#dask.dataframe.DataFrame.to_dask_array
This will compute the chunk sizes and the length of the array.

Use lr.fit(X.values, y.values) instead

authors: Abhishekdutt9 TomAugspurger asifali22 carloszanella jakirkham julioasotodv moody-marlin stsievert thebeancounter xiaozhongtian


text:
Update CONTRIBUTING.md

Ref dask/community#17
This CONTRIBUTING.md is in a slightly different format to the rest because this project has mature contributing guidelines in its own docs and so I'm putting the emphasis on there.

Thanks. I'll investigate the CI failure separately.

authors: TomAugspurger jacobtomlinson