Make this library Dependency Injection Friendly

it really is a horrible pattern to have to do new SomeType( "aString" ). Things like the Data Store or connection should be configured through Interfaces that provide any properties that may be required like the path to the database or the Mobile Backend.

Hey Dan,
I'm not sure I'm following you.   We already do everything through interfaces.  The IMobileServiceClient is pretty much the only one that you need, and the constructor always takes a URI.  What is your proposal for the pattern and how would this be used?  I commonly create a wrapper service manager to do this for me, and then DI the service manager.
How would you actually see this working that's different?

@adrianhall the constructor for the MobileServiceClient currently takes a string or Uri for the mobile service API along with the "optional" HttpMessageHandler array. The result is that you cannot directly register the MobileServiceClient with DI unless you were to create a new instance and register it as a singleton. What I would propose would be something like the following:
public interface IMobileServiceClientOptions
{
    Uri MobileAppUri { get; }
    IEnumerable<HttpMessageHandler> MessageHandlers { get; }
}

public class MobileServiceClient : IMobileServiceClient
{
     public MobileServiceClient(IMobileServiceClientOptions options)
     {
     }
}

Since the MobileServiceClient is already making a major version bump I would suggest just removing the existing constructors.
The would then open things up for a better DI pattern like:
public class Constants
{
     public const string MobileAppUri = "https://foo.bar.com";
}

public class MyAppMobileServiceClientOptions : IMobileServiceClientOptions
{
    public Uri MobileAppUri { get { return new Uri(Constants.MobileAppUri, UriKind.Absolute); } }
    public IEnumerable<HttpMessageHandler> MessageHandlers { get { return new HttpMessageHandler[]; } }
}

public class App : Application
{
    private void RegisterServices()
    {
        Container.RegisterType<IMobileServiceClient, MobileServiceClient>();
        Container.RegisterType<IMobileServiceClientOptions, MyAppMobileServiceClientOptions>();
    }
}

public class AzureAppService
{
    public AzureAppService(IMobileServiceClient client)
    {
    }
}

You should be creating the MobileServiceClient as a singleton anyway - at least, that is the best practice and recommendation.  If you don't, you lose stateful properties like authentication and push registration.
We tend to advise people to do something like this:
public interface ICloudService
{
    public ICloudTable<T> GetTable<T>();
}

public class AzureCloudService : ICloudService
{
    const string uri = "https://foo.azurewebsites.net";
    private MobileServiceClient client;

    public AzureCloudService()
    {
        client = new MobileServiceClient(uri);
    }

    public ICloudTable<T> GetTable()
    {
        return new AzureCloudTable<T>(client);
    }
}

You can then DI or do a simple ServiceLocator for the AzureCloudService / ICloudService.

@adrianhall totally understand that, and that is the pattern I have followed in the past as well. I realize that my sample above wasn't being clear about marking the IMobileServiceClient as a Singleton. That said, IMHO, I think it's a better practice to have the MobileServiceClient constructed as a Singleton by the Container rather than doing new MobileServiceClient(uri), and especially with that in the ctor of the AzureCloudService

I think I'm being incredibly dense or something then.  I honestly don't see the difference or the benefit that your suggestion brings to the code.  If I can wrap the concrete mobileserviceclient into another class that is dependency injectable, what benefit does making mobileserviceclient dependency injectable bring?

@adrianhall, I recognize there is always more than one way to accomplish something. For example you could do:
Container.RegisterInstance<IMobileServiceClient>(new MobileServiceClient(uri))

Depending on the container you use you may also use some sort of parameter injection to circumvent the issue. That said, relying on interfaces over concrete and primitive types is always a better practice, particularly for testability. Just as an example (and again IMHO) using the AzureCloudService you gave the example of above, that would actually be a bad practice because you are now making the service explicitly reliant on the MobileServiceClient rather than IMobileServiceClient which ends up reducing it's testability.
public class AzureCloudService : ICloudService
{
    private IMobileServiceClient _client { get; }

    public AzureCloudService(IMobileServiceClient client)
    {
        _client = client;
    }

    public ICloudTable<T> GetTable()
    {
        return new AzureCloudTable<T>(_client);
    }
}

Don't get me wrong, if I were going to pick a fight on something for the MobileServiceClient it would be to get the Server packages updated to support AspNetCore. And then to see the Xamarin Connected App templates provide full Online/Offline sync with Token Authentication out of the box that's fully buildable on Mac and PC. I just think, updating the design pattern here, would provide for better design practices.

We merged your PR into the master branch.  It will be released as v4.2.0 within the next couple of weeks.

thanks @adrianhall here I thought that this project had been abandoned.


Redesign according to MVVM

Done by 75db79a...8f0e6c9 (except 4ca16da, ceb002a, and d9f4a97...d1a9ffc).


WSL support

Hi.
It would be good to add support to WSL in the cmake extension.
Thanks.

I definitely need this feature. I installed CMake on Ubuntu WSL but the plugin doesn't recognize it.

+1 for the WSL support.
I tried to change the cmake path, but it didn't worked.
"cmake.cmakePath": "/usr/bin/cmake"

Setting cmakePath pointing to a .bat with
wsl.exe /usr/bin/cmake %*

should works

"cmake.cmakePath": "wsl.exe /usr/bin/cmake"

is working

This doesn't seem to work, at least on the extension v0.0.17, and VS Code v1.44.2.


Gen2 scripts are not started when shelly reboots

Maybe the node must check the state of the script from timr to time and start the script if it is not running.
Find out why scripts are not started automatically

See
https://www.shelly-support.eu/forum/index.php?thread/14810-script-randomly-killed-on-shelly-plus-1pm/&postID=157261#post157261

It seems that the beta fw works

Fixed in FW 20220830-130959/0.11.0-gfa1bc37


fez checkbuild fails on Tomtit

git clone https://github.com/melezhik/Tomtit
cd Tomtit
fez checkbuild
>>= Inspecting ./META6.json
>>= meta<provides> looks OK
=<< File "resources/profiles/perl/install.pl6" in meta<resources> not found in dir
>>= Tomtit:ver<0.1.10>:auth<zef:melezhik> could use some sprucing up

However:
ls -l resources/profiles/perl/install.pl6
-rw-r--r-- 1 root root 126 Jun 15 17:22 resources/profiles/perl/install.pl6

What does your META actually look like?

hi Tony! i guess it is here - https://github.com/melezhik/Tomtit/blob/master/META6.json

@melezhik you have that file listed twice in your META - this is a bug in fez but you should consider removing the dupe too.

Fixed with b0737b9

Thanks @tony-o


catt: override dependency releases

Motivation for this change
Override dependency releases
Things done

Built on platform(s)

[x x86_64-linux
[ ] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

[ ] For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
[ ] Tested execution of all binary files (usually in ./result/bin/)
21.11 Release Notes (or backporting 21.05 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module

[x] Fits CONTRIBUTING.md.

Result of nixpkgs-review pr 138787 run on x86_64-linux 1

1 package built:

catt


How to check for holidays within an interval of time

I'd like to be able to determine if there are any holidays in the near future, expressed as a timedelta. More generally, maybe just between two dates.
Pseudocode:
NOW_DATETIME = datetime.datetime.utcnow()
SIXTY_DAYS_TIMEDELTA = datetime.timedelta(days=60)

holidays_us = holidays.US()
upcoming_holiday_dates = holidays_us.holidays_before(SIXTY_DAYS_TIMEDELTA)
holiday_dates = holidays_us.holidays_between(NOW_DATETIME, NOW_DATETIME + SIXTY_DAYS_TIMEDELTA)

It's not clear if holidays supports just checking certain dates in order for developers to be able to implement this ourselves. It seems sort of there, except that I wonder what happens due to the year handling if the next sixty days includes both December and January. Based on the design of _add_holiday(), they're seemingly stored in a year-specific fashion:
https://github.com/vacanza/python-holidays/blob/fde28db1d17e05e0853585936b8b8f85e9e38d34/holidays/holiday_base.py#L737
Suggestions?

Hi @dsoprea!

I'd like to be able to determine if there are any holidays in the near future, expressed as a timedelta. More generally, maybe just between two dates.

I don't recall holidays having built-in functionality for that. However, it sounds to me like something that could be useful for the end-users.
PRs welcome. Or you may get lucky if @KJhellico or me will be able to find some time this month. Perhaps, by extending holidays.utils.country_holidays() (and similar) with before_date and after_date args.
Thanks for the idea!

If you could suggest a straightforward approach then I could do it. If it requires research or rewiring then that'd be best left to the maintainers.

Yeah, it's up to you. I believe any PR would require some research of the existing code base, project architecture and generally used approaches. I suggest looking at some of the most recent PRs (perhaps, changes related to HolidayBase would be the most useful).
Just make sure to let us know if you decide to work on this so no work would be done twice.
Thank you @dsoprea!


Readme - Document how to populate the locations in a new server.

See related comments https://github.com/pulibrary/marc_liberation/pull/995#discussion_r562229884
https://github.com/pulibrary/marc_liberation/pull/995#issuecomment-764978075

ssh to the machine as deploy user. Open a rails console. run:
LocationDataService.populate


Properly attach attributes to Param instead of parent ParamList

Fixes #2783, fixes #2781
The problem with let _a = [0,#[cfg(feature = "L")]0]; has already been fixed some time ago it seems:

Syntax Tree for the const item
<EMAIL_ADDRESS><EMAIL_ADDRESS>"let"
<EMAIL_ADDRESS>" "
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>"_a"
<EMAIL_ADDRESS>" "
<EMAIL_ADDRESS>"="
<EMAIL_ADDRESS>" "
<EMAIL_ADDRESS><EMAIL_ADDRESS>"["
<EMAIL_ADDRESS><EMAIL_ADDRESS>"0"
<EMAIL_ADDRESS>","
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>"#"
<EMAIL_ADDRESS>"["
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>"cfg"
<EMAIL_ADDRESS><EMAIL_ADDRESS>"("
<EMAIL_ADDRESS>"feature"
<EMAIL_ADDRESS>" "
<EMAIL_ADDRESS>"="
<EMAIL_ADDRESS>" "
<EMAIL_ADDRESS>"\"L\""
<EMAIL_ADDRESS>")"
<EMAIL_ADDRESS>"]"
<EMAIL_ADDRESS>"0"
<EMAIL_ADDRESS>"]"
<EMAIL_ADDRESS>";"

bors r+


Update Pages “home”

Automatically generated by Netlify CMS

👷 Deploy Preview for ltcblog processing.

Name
Link

🔨 Latest commit
36d60f6766a244daeefdb13efc27634b2823ed6b

🔍 Latest deploy log
https://app.netlify.com/sites/ltcblog/deploys/64f751e78ce2660008acfa19


verbose callback: change the header line

In GitLab by @nmansard on Mar 1, 2019, 14:18
In callback verbose, the header line uses variable names that are non standard.
iter \t cost \t      theta \t    gamma \t  muV \t      muLM \t alpha
I suggest to replace them by explicit names and to add the feasibility (bool).
iter \t cost \t      stop \t    grad \t  xreg \t      ureg \t step \t feas

In GitLab by @nmansard on Mar 1, 2019, 16:22
mentioned in merge request !120

In GitLab by @cmastalli on Mar 4, 2019, 10:48
I disagree with stop and grad, the rest sounds good for me. Explanations can be found here: https://gepgitlab.laas.fr/loco-3d/crocoddyl/merge_requests/120#note_3158.
If you can match nomenclature with the SolverDDP, you might change theta and gamma by d1 and d2, respectively. In any case, we need to document them for users. Probably we can include the documentation task along this proposed change. What do you think?

In GitLab by @proyan on Mar 6, 2019, 10:56
Solved with !120

In GitLab by @proyan on Mar 6, 2019, 10:56
closed

In GitLab by @nmansard on Mar 7, 2019, 08:38
mentioned in commit eed33c0a0091c0035b0062b271a72def620ef312


TLS Private Key Issue

The configured TLS Keychain Identity (Keychain: org.calendarserver.test) cannot be used: Unable to use private key for Keychain identity: org.calendarserver.test - The operation couldn’t be completed. (Internal CSSM error error -2147416032 - Internal error #80010820 at SignTransform_block_invoke /BuildRoot/Library/Caches/com.apple.xbs/Sources/Security/Security-58286.70.14/OSX/libsecurity_transform/lib/SecSignVerifyTransform.c:276)

did you ever find a solution to your problem? I've run into the same thing..

I too am having this problem with macOS Mojava 10.14.6


"Getting started" broken, webpack can't resolve modules

"Getting started" basic setup is broken as of now on my setup
webpack can't resolve:
'strip-ansi', 'sockjs-client', 'core-js/library/fn/object/assign' and 'core-js/library/fn/object/define-property'
Describe the issue / bug.
It worked on January 22-23,
when running npm run dev, right after npm install, it fails at the end and displays the following in red:
      ERROR in (webpack)-dev-server/client?http://localhost:9080
        Module not found: Error: Can't resolve 'strip-ansi' in '[project path]node_modules/webpack-dev-server/client'
         @ (webpack)-dev-server/client?http://localhost:9080 3:16-37
         @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

        ERROR in (webpack)-dev-server/client/socket.js
        Module not found: Error: Can't resolve 'sockjs-client' in '[project path]node_modules/webpack-dev-server/client'
         @ (webpack)-dev-server/client/socket.js 1:13-37
         @ (webpack)-dev-server/client?http://localhost:9080
         @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

        ERROR in ./~/babel-runtime/core-js/object/assign.js
        Module not found: Error: Can't resolve 'core-js/library/fn/object/assign' in '[project path]node_modules/babel-runtime/core-js/object'
         @ ./~/babel-runtime/core-js/object/assign.js 1:30-73
         @ ./~/babel-runtime/helpers/extends.js
         @ ./app/src/renderer/main.js
         @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

        ERROR in ./~/babel-runtime/core-js/object/define-property.js
        Module not found: Error: Can't resolve 'core-js/library/fn/object/define-property' in '[project path]node_modules/babel-runtime/core-js/object'
         @ ./~/babel-runtime/core-js/object/define-property.js 1:30-82
         @ ./~/babel-runtime/helpers/defineProperty.js
         @ ./app/src/renderer/vuex/modules/counters.js
         @ ./app/src/renderer/vuex/modules nonrecursive \.js$
         @ ./app/src/renderer/vuex/modules/index.js
         @ ./app/src/renderer/vuex/store.js
         @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./app/src/renderer/App.vue
         @ ./app/src/renderer/App.vue
         @ ./app/src/renderer/main.js
         @ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server ./app/src/renderer/main.js

The scaffold setup is the following:
? Select which Vue plugins to install vue-electron, vue-resource, vue-router, vuex
? Use linting with ESLint? No
? Setup unit testing with Karma + Mocha? No
? Setup end-to-end testing with Spectron + Mocha? No
? What build tool would you like to use? packager

I received a warning about node version, I'm on 4.7.2, npm install recommended node >= 6.0.0 and the docs recommend >= 6.5.0.
Could it be caused only by versions?
I initially wanted to post an issue about adding jQuery + Foundation JS to this boilerplate as i'm unable to find a way to do that but this is yet another issue that arised while trying to get to that!
How can I reproduce this problem?
Following the Getting started guide found at: https://simulatedgreg.gitbooks.io/electron-vue/content/docs/getting_started.html.
Tell me about your development environment.

Node version: 4.7.0
NPM version: 2.15.11
vue-cli version: $ vue --version 2.8.0
Operating System: Ubuntu (Linux Mint) Linux 64 bit

After diving in a long list of errors and adding modules that were reported to miss, I ended up installing these npm packages with --save-dev in the root folder of the electron-vue project:
strip-ansi
inherits
ansi-regex
debug
url-parse
sockjs
sockjs-client
websocket-driver
websocket-extensions
requires-port
querystringify
original
json3
ms
faye-websocket
eventsource
core-js

NPM version: 2.15.11

It's probably because of this honestly. NPM >= 3.0 uses a flat(ter) hierarchy. Try upgrading that and this might be solved.

@Simon-L
Were you able to try out @citycide's suggestions? If not, I would recommend trying it out with npm-windows-upgrade.

Going to go ahead and close this for now. Feel free to comment back if you are still having issues.


add Project Sasanqua my wip Project)

Description
Project Sasanqua is my wip project.
Features
add Project Sasanqua ASCII art.
Issues
no. maybe...?
TODO
no lol

I forgot that Project Cosmos was the name of the old version. lol

Where can be found this project?
Also adding in alphabetical order could be a good idea

Where can be found this project?
Also adding in alphabetical order could be a good idea

https://projectsasanqua.wordpress.com/
homepage(no download)

Looks good!

Thank you for your contribution!
This PR is merged into hyfetch since this repo (dylanaraps/neofetch) seems no longer maintained.
HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo.
Read the "Running Updated Original Neofetch" section for more info!


Add schema for ControlInfoData.json

Description
I added a schema file for the ControlInfoData.json to make adding new control / control group to it simpler. Now you get nice intellisense for all properties and error message for missing required ones. The schema should be automatically picked up by any reasonable editors.
Motivation and Context
I just happens to know this.
How Has This Been Tested?
The current file reports no mismatch for this schema.
Screenshots (if appropriate):

Types of changes

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)

@marcelwgn Did some changes to it, please review

/azp run

/azp run


Add purge command to ptq

Annoying to login to AWS to do it manually. Also should return status for the SQS queue.

Resolved in 4c4cdf2960c7d8b0a15040f46fd52a14f422a1f8


utils.to_categorical should output a matrix even if input is single element

Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!

[ ] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps

[x] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.

[ ] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps

[x] just copy the script here if it is short

print(np_utils.to_categorical([3]))

[ 0.  0.  0.  1.]

print(np_utils.to_categorical([3, 3]))

[[ 0.  0.  0.  1.]
 [ 0.  0.  0.  1.]]

to_categorical documentation says "Converts a class vector (integers) to binary class matrix."
When a single element is provided, it outputs a vector, why this anomaly? It should still output a matrix just as the documentation specified (and it is the intuitive behavior).

I believe this is a bug.
Given:
from keras.utils import to_categorical print(to_categorical([3]))
In Keras 2.0.8 the result is a matrix:
[[ 0.  0.  0.  1.]]
In Keras 2.1.1 (and perhaps others), the result is an array:
[ 0.  0.  0.  1.]
This undocumented change in behavior breaks a ton of my code.

Yes, it seems that we don't handle the scalar case consistently. It should return a matrix.
@jbrownlee can you provide some examples of code that would break? Why would you call to_categorical with a scalar?

@fchollet thanks for the confirmation, much appreciated.
I have data prep loops that build up the framing of a text sequence prediction problem (e.g. image captioning, translation, text summarization). The loop crawls across the output sequence taking a portion of input for a given sample and the next word as output, a single output integer. This output is then encoded with a call to to_categorical and added to a list as we build up the whole training dataset.
I can pull the encoding out to the end of the loop, it's all just code, nevertheless, the API behavior change broke "finished" code.

I think this fixes it:
https://github.com/fchollet/keras/commit/d956d19fccf6de6344c282218f1b027453785fa9

Right, it's fixed.


[stable/Jenkins] Added jenkins location configuration

What this PR does / why we need it:
Added jenkins.model.JenkinsLocationConfiguration.xml to config map to support setting JENKINS_URL to avoid warnings on first start and manual configuration.
Which issue this PR fixes:
fixes #6513

Its been 2 weeks with no activity on this. Is there something I need to do to get someone to look at this?

/ok-to-test

/lgtm


Add task assignment

A simple way to do this would be to have the UI show the closest worker, where you can set their task.

Done! Work assignment is done at place-of-work.


Crash Bandicoot 2

was surprisingly hard to find any kind of decent image for PIC1 for such a popular game.
Signed-off-by: Ronnie Sahlberg<EMAIL_ADDRESS>

Switch to this. Remasters no bueno


Database schema

This question is very sensitive for different databases details.
Option 1:
create table patient (
  id text primary key,
  resource json
)

pros:

schema can be used by most of the databases which have a json support
All schemas are the same - no need to change the schema

We should think about strict schemas for google big queries (protobuf) or Apache Spark?

Is there a large performance advantage to externalizing id vs. just indexing inside the json? If not, why pull it out rather than leave the ids in the json until the entire resource is converted into a flat representation?

Is there a large performance advantage to externalizing id vs. just indexing inside the json? If not, why pull it out rather than leave the ids in the json until the entire resource is converted into a flat representation?

Yes, it is! Databases need primary keys :(


Offset after hide keyboard during share pop up (only on iOS)

Hello I tried all screenshot and share package and all  have an offset bug like that

To reproduce

take a screenshot
open share pop up
open facebook or gmail
hide keyboard
return to main view to observe the bottom offset (1/3 of height screen )

Issue seems to be link with to the bottom shared pop up of iOS.
It can be reproduce with this package and the example package, but it's also be reproduce with all screenshot and share package
https://pub.dev/packages/share_files_and_screenshot_widgets/example

Hi @nitneuq33
The issue  doesn't reproduce on iOS 14 on the latest master

code sample
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:ui';
import 'package:share_files_and_screenshot_widgets/share_files_and_screenshot_widgets.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter ScreenShot Demo',
      theme: ThemeData(
        primarySwatch: Colors.deepOrange,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo ScreenShot Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Image _image;

  GlobalKey previewContainer = new GlobalKey();
  int originalSize = 800;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SingleChildScrollView(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                RepaintBoundary(
                  key: previewContainer,
                  child: Container(
                    decoration: BoxDecoration(
                        border: Border.all(width: 1.5),
                        borderRadius: BorderRadius.circular(20),
                        color: Colors.deepPurple),
                    padding: EdgeInsets.all(15),
                    margin: EdgeInsets.all(20),
                    width: MediaQuery.of(context).size.width - 40,
                    height: MediaQuery.of(context).size.height,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: [
                        Text(
                          "This is a picture.",
                          style: TextStyle(
                              fontSize: 20,
                              fontWeight: FontWeight.bold,
                              color: Colors.white),
                        ),
                        Image.asset("assets/example.jpg"),
                        Text(
                          "There’s something so whimsical about these beautiful images that incorporate bokeh. It’s almost as if they could be from a different, magical world. We’ve loved watching the submissions fly in for our bokeh-themed Photo Quest by Meyer-Optik-Görlitz and selected 30+ of our favourites beautiful images to ignite your creative spark! The three lucky winners of this Quest are going to receive an incredible prize courtesy of master lens-crafters Meyer-Optik.",
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                  ),
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    Container(
                      child: RaisedButton(
                          child: Text("Take Screenshot!"),
                          onPressed: () {
                            ShareFilesAndScreenshotWidgets()
                                .takeScreenshot(previewContainer, originalSize)
                                .then((Image value) {
                              setState(() {
                                _image = value;
                              });
                            });
                          }),
                    ),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Screenshot!"),
                            onPressed: () {
                              ShareFilesAndScreenshotWidgets().shareScreenshot(
                                  previewContainer,
                                  originalSize,
                                  "Title",
                                  "Name.png",
                                  "image/png",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Image!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.jpg');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.jpg", list, "image/jpg",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Video!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.mp4');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.mp4", list, "video/mp4",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Audio!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.mp3');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.mp3", list, "audio/mp3",
                                  text: "This is the caption!");
                            })),
                  ],
                ),
                _image != null ? _image : Center()
              ],
            ),
          ),
        ));
  }
}

flutter doctor -v
[✓] Flutter (Channel master, 1.22.0-10.0.pre.317, on Mac OS X 10.15.6 19G2021
    x86_64, locale en-GB)
    • Flutter version 1.22.0-10.0.pre.317 at
      /Users/tahatesser/Code/flutter_master
    • Framework revision 10febea877 (3 hours ago), 2020-09-23 07:22:10 +0200
    • Engine revision 57ee3d4b32
    • Dart version 2.10.0 (build 2.10.0-156.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.49.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.1

[✓] Connected device (4 available)
    • iPhone 11 (mobile) • 9A8EFBFE-A806-4FF9-ACA5-F3F98D94979D • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64
      • Mac OS X 10.15.6 19G2021 x86_64
    • Web Server (web)   • web-server                           • web-javascript
      • Flutter Tools
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 85.0.4183.102

• No issues found!

Can you please provide your flutter doctor -v and flutter run --verbose logs, and a minimal complete reproducible code sample
Thank you

Thank you, I will try to all upgrade

Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.


[v4] segment-button add click() method (workaround Shadow DOM)

Feature Request
Ionic Info
Directly using @ionic/core version 4.0.0-beta.1 from CDN (e.g. unpkg)
Describe the Feature Request
Now that Ionic components use Shadow DOM, it is more complicated to programmatically access their inner Elements (i.e. use shadowRoot in environments that use Shadow DOM, normal access otherwise).
In some cases this was necessary to workaround some current API shortages.
For instance, programmatically clicking on an <ion-segment-button> (e.g. with .click() method) does not trigger the segment highlight.
Therefore the current workaround is to access its inner DOM, query for the underlying <button> and click() on it.
Without Shadow DOM, it can be as simple as:
document.querySelector('#segmentButtonId button').click()

With Shadow DOM, we have to query the Segment Button first, then query within its shadowRoot.
Handling both environments adds even more code.
Describe Preferred Solution
Add a .click() method on the <ion-segment-button> that gets it highlighted as if user had manually clicked on it.
Describe Alternatives
Expose the underlying <button> somehow?
Related Code
https://next.plnkr.co/edit/IvkXQw5I6LDI3frj?preview

Button "Click on Button 1" programmatically clicks on Segment Button 1, but the latter does not get highlighted.
Button "Click on Button 2" queries for the underlying Button of Segment Button 2 and programmatically clicks on the former; the Segment Button gets properly highlighted. But querying must take care of possible Shadow DOM.

Additional Context
N/A

Hi,
Thanks for your message!
To answer the primary sense of your question, I use the <ion-segment-button> exactly like I would do for an <input type="radio" />.
But thinking further about it and giving more sense to your question, it seems that I am misled by this analogy. If I understand correctly, the common practice in Ionic is to manage the segments button through their parent segment container? It seems that it indeed provides an elegant 2-way binding of the selected value and to execute a callback when it changes, but v4 has a "hole" compared to v3:

<input type="radio" />
UI
Events

User click / tap
Selected
"click"

Programmatic .click()
Selected
"click"

Programmatic checked = true
Selected
None

This shows why the common practice is to programmatically click on the radio input.

<ion-segment-button> v4
UI
Events
<ion-segment> value
<ion-segment> events

User click / tap
Highlighted
"click" + "ionSelect"
Selected button value
"ionChange"

Programmatic .click()
Nothing
"click" only
No change
None

Programmatic checked = true
Highlighted
"ionSelect" only
Selected button value
"ionChange"

Programmatic value = newValue
Highlighted
"ionSelect" only
newValue
"ionChange"

For ion-segment-button v4, using the "ionSelect" event instead of "click" and setting the checked property instead of clicking, we can mimic the behaviour of the radio input.
But the Ionic way seems rather to manage it from the ion-segment value level.
For the sake of completeness, in v3 we could still use the programmatic click to modify the selected value and have the UI highlighted:

<ion-segment-button> v3
UI
Events
<ion-segment> model
<ion-segment> events

User click / tap
Highlighted
Native "click" + Angular "ionSelect"
Selected button value
Angular "ionChange"

Programmatic .click()
Highlighted
Native "click" + Angular "ionSelect"
Selected button value
Angular "ionChange"

Programmatic checked = true
N/A
N/A
N/A
N/A

Programmatic model = newValue
Highlighted
Angular "ionSelect" only?
newValue
Angular "ionChange"

I guess we could live with the current situation, although patching the ion-segment-button hole would improve the analogy with the radio input, and I guess it would also make it easier for UI testing?

Example of UI testing use case: https://github.com/ionic-team/ionic/issues/15337


Only works with npm run start

It only picks up the config if I run npm run start, that is, run the packager manually. If I run react-native run-ios it won't pick it up

Good point! We're planning to refactor graphql-config quite a bit and will take this feedback into account!

I can't archive the app.
This might be related I guess?
I created an issue here: https://github.com/graphcool/babel-plugin-react-relay/issues/20

@schickling Will this ever be addressed or there's a new tool I'm not aware of?

This is most likely an issue with a tool using graphql-config. Are you referring to babel-plugin-react-relay? If so, it's deprecated in favour of Relay Modern's compile system.


Fix file globs for relative paths

Instead of doing:
project.getSourceFiles("**/src/**/*.ts")

Should be able to do:
project.getSourceFiles("src/**/*.ts")
// or
project.getSourceFiles("./src/**/*.ts")
// or
project.getSourceFiles("../otherFolder/**/*.ts") // didn't test, but I think it doesn't work

addExistingSourceFiles works. It's actually getSourceFiles with a glob that doesn't. I've updated above.


FetchConst should probably be public

When you query the status of a download, you get a RequestInfo object that has a status value which is an integer that corresponds to the status codes in FetchConst. However, since FetchConst is not public, there is no way to to perform logic on the status unless the client app hard codes those values.

@jacobtabak the Fetch class implements FetchConst. You you can access the different statuses and error messages like so: Fetch.STATUS_DOWNLOADING or Fetch.ERROR_FILE_NOT_FOUND*. FetchService also extends FetchConst.

Hm, I don't find that very intuitive. What is the point of having those consts live anywhere other than in the place they are defined? It seems like FetchConst should be a public class and all of the members should be public static final.

as tonyo said, the Fetch class implements FetchConst
and Fetch defined public, so don't worry about FetchConst public or not
anyone code different, i cannot see the reason of "FetchConst should be a public class"


binary stl files starting with "solid" in its header

some binary stl files starts with "solid" in its header that confuses a parser which depends on "solid" to tell if it is ascii or binary
made some fixes here, you may like to take a look
https://github.com/ag88/stl-viewer/blob/master/src/hall/collin/christopher/stl4j/STLParser.java

I made the pull request. If we're going to do more development on this library, then the project needs a couple of example STL files for testing purposes.

no worries about my program, i used your code as i find it among the more 'tidy' implementations and in fact it is one of the implementations that works pretty well. while developing my STL viewer (which uses this STL parser) i downloaded various STL files/models from http://www.thingiverse.com/ and tried them out. you may like to check out my stl viewer program as it is after all based on your parser, you could download the various models from http://www.thingiverse.com and try them out :)


Camera retuning this error Error waiting to drain: Connection timed out (-110))

I am using the camera plugin version [camera: ^0.5.8+2] and one of our app users Is getting this error.
CameraException(CameraAccess, CAMERA_ERROR (3): waitUntilIdle:1656: Camera 1: Error waiting to drain: Connection timed out (-110))

Model details are as follows:
{"model":"SM-J720F","platform":"Android",,"version":"10167","manufacturer":"samsung","serial":"unknown",}
Please help. Regarding this, I am getting this error almost every day.

Hi @Shivamtruein
could you provide your flutter doctor -v and flutter run --verbose log (with hitting the error)?
does it happen with this example https://pub.dev/packages/camera#-example-tab-?
if no, could you provide a complete minimal reproducible code sample and describe steps to reproduce it?

@VladyslavBondarenko The problem is I don't have the device. I get these logs with the API embedded. On my phone, it never happened.

Similar to https://stackoverflow.com/questions/40036509/recording-video-not-working-with-camera2-api-on-samsung-note5-after-using-imager, seems to be a device-specific

Then, could you please tell me how to fix this in the flutter code?

I'm runninng into this issue using the latest ^0.9.4+5 version on my Google pixel 4.

Getting this issue, currently on poco devices. Commenting  just to bump the issue

Any updates?
Devices:

Redmi Note 8 Pro Model: QP1A.190711.020
SM-G935F Model: R16NW
SM-A730F Model: PPR1.180610.011
NTN-LX1 Model: HONORNTN-L21CQ

CameraException: CameraException(CameraAccess, CAMERA_ERROR (3): waitUntilIdle:1675: Camera 0: Error waiting to drain: Connection timed out (-110))
File "camera_controller.dart", line 444, in CameraController.startImageStream

Still relevant
Devices:

POCO X4 Pro 5G, model 2201116PG
Xiaomi Redmi Note 11 Pro 5G, model 2201116SG
POCO X3 NFC, model M2007J20CG
Samsung Galaxy S8 +, model SM-G955F

It happens every time the camera is used in my current implementation for these devices. It results in a black screen.
PlatformException(CameraAccess, CAMERA_ERROR (3): waitUntilIdle:1824: Camera 0: Error waiting to drain: Connection timed out (-110), null, null)
Crashed in non-app: message_codecs.dart in StandardMethodCodec.decodeEnvelope within flutter
android_camera.dart in AndroidCamera._startPlatformStream at line 307 within camera_android

For the 2 first devices, another error is also thrown which may be related:
CameraException(error, Attempt to invoke virtual method 'void android.media.ImageReader.setOnImageAvailableListener(android.media.ImageReader$OnImageAvailableListener, android.os.Handler)' on a null object reference)
camera_controller.dart in CameraController.takePicture at line 400 within camera

Output of flutter doctor -v:
[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-GB)
    • Flutter version 3.3.4 on channel stable at /Users/jean-francois/Documents/workspace/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (2 weeks ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jean-francois/Library/Android/sdk
    • Platform android-33, build-tools 30.0.3
    • ANDROID_HOME = /Users/jean-francois/Library/Android/sdk
    • Java binary at: /Users/jean-francois/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8609683/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Users/jean-francois/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8609683/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/jean-francois/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7678000/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.72.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • AC2003 (mobile) • <IP_ADDRESS>:5555 • android-arm64  • Android 11 (API 30)
    • macOS (desktop) • macos             • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)    • chrome            • web-javascript • Google Chrome 106.0.5249.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Hello, is there any news regarding the issue? has been solved in the new version?

Faced it with a pixel 3
flutter doctor -v:
[!] Flutter (Channel stable, 3.7.3, on Microsoft Windows [Version 10.0.19044.2604], locale en-US)
    • Flutter version 3.7.3 on channel stable at D:\sdk\flutter
    ! Warning: `flutter` on your path resolves to D:\sdk\flutter_store\stable\bin\flutter, which is not inside your current Flutter SDK checkout at D:\sdk\flutter. Consider adding D:\sdk\flutter\bin to the front of your path.
    ! Warning: `dart` on your path resolves to D:\sdk\flutter_store\stable\bin\dart, which is not inside your current Flutter SDK checkout at D:\sdk\flutter. Consider adding D:\sdk\flutter\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision<PHONE_NUMBER> (3 weeks ago), 2023-02-08 15:46:04 -0800
    • Engine revision 248290d6d5
    • Dart version 2.19.2
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at D:\sdk\android
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = D:\sdk\android
    • Java binary at: D:\Program Files\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.18)
    • Visual Studio at D:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.32802.440
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\Program Files\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] VS Code, 64-bit edition (version 1.76.0)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.60.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.2604]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 108.0.5359.125
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 110.0.1587.57

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

it happens on 0.10.3+2 on real device galaxy note 20
any further solution?
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.0 22A380 darwin-x64, locale ko-KR)
    • Flutter version 3.3.10 on channel stable at /Users/dumbo/fvm/versions/3.3.10
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (4 months ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/dumbo/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 69.0.5
    • Dart plugin version 222.3345.108

[✓] VS Code (version 1.77.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • SM N981N (mobile) • R3CN902948E • android-arm64  • Android 13 (API 33)
    • macOS (desktop)   • macos       • darwin-x64     • macOS 13.0 22A380 darwin-x64
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 111.0.5563.146

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Hi. Does this issue persist in the latest camera packages?

Here are only some models, many users have encountered this problem.
HONOR PLAY 20  、Android 10
V2183A、Android 13
V2046A、Android 13
JLN-AL00、Android 12
JEF-AN20、Android 12
M2010J19SC、Android 10
KOZ-AL00、Android 10

I have a user running into this issue on
Google Pixel 4a, Android 13

I sometimes face this on Poco X2.
Not reproducible every time.
Happened for me only 2 times.
Both of the time it happened, when I freshly open the app and directly went to the feature which needs camera
Both of the times app has camera permission already
If I go back and come again, then it works fine

Hi there, is there any solution to this problem?


Facet by author

Making the assumption that "author" and "creator" are the same roles, facet by creator functionality exists. Closing this ticket.


Look into documentation site for UI tests

This is a placeholder for checking into JSDoc based static site builders for our frontend tests. Something similar to what Longhorn does here

This was completed. static site generation was imported into CI and is available at https://harvesterhci.io/tests/integration/


Promises executor dominates over timeouts

First, some table-setting:
var canceled = false;

const loop = () => {
  if (!canceled) {
    console.log("looping");
    new Promise((resolve, reject) => loop());
  }
};

setTimeout(() => { console.log("canceling"); canceled = true; }, 5);
loop();

This does what you would expect: it loops for a while and then cancels.
So does the following:
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.scalajs.concurrent.QueueExecutionContext
import scala.scalajs.js.timers

object Test {
  def main(args: Array[String]): Unit = {
    var cancel = false
    val exec: ExecutionContext = QueueExecutionContext.timeouts()
    def loop(): Unit = {
      if (!cancel) {
        println("looping")
        exec.execute(() => loop())
      }
    }

    timers.setTimeout(5.millis) { println("canceling"); cancel = true }
    loop()
  }
}

Again, loops for a little while and then cancels.
This, however, loops forever:
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.scalajs.concurrent.QueueExecutionContext
import scala.scalajs.js.timers

object Test {
  def main(args: Array[String]): Unit = {
    var cancel = false
    val exec: ExecutionContext = QueueExecutionContext.promises()        // <---- this is the only difference!
    def loop(): Unit = {
      if (!cancel) {
        println("looping")
        exec.execute(() => loop())
      }
    }

    timers.setTimeout(5.millis) { println("canceling"); cancel = true }
    loop()
  }
}

It appears that if any outstanding work is available on the promises queue, it will dominate over the timeouts queue. My guess without looking at the code is that this is a consequence of a well-intentioned optimization within ScalaJS itself which fails to yield, since it definitely doesn't reproduce within Node.

Thanks for the detailed report!
FTR, the code is here:
https://github.com/scala-js/scala-js/blob/430f915c1d6cf454f77cf2d78909ea42165a8648/library/src/main/scala/scala/scalajs/concurrent/QueueExecutionContext.scala#L46-L62
There's nothing that obviously tries to short-circuit the event loop. We explicitly call then for every job, which is always supposed to yield to event loop. But perhaps it doesn't for already-completed Promises?

I dug deeper myself! It appears that both then and the Promise constructor are evaluated eagerly! My JS example is actually super weird because if you remove the console.log, it just immediately blows the stack. In other words, Promise in JS is really a lot more like Promise in Scala and a lot less like Future. A bit of googling around finds a fair number of posts where people suggest using setTimeout(..., 0) as a workaround for this problem. In other words, exactly what timeouts() already does.
But at any rate, this implies that promises in and of itself is actually not a valid executor. I haven't yet found a way to get JavaScript to reliably bounce through the event queue without using setTimeout.

fyi - V8 has separates queues for tasks, microtask queue (used e.g. for promise.then) and macrotask queue (used e.g. for setTimeout):
https://javascript.info/event-loop
The spec for promises and jobs deliberately doesn't restrict how priority should work for different types of tasks:
https://www.ecma-international.org/ecma-262/11.0/index.html#sec-jobs

fyi - V8 has separates queues for tasks, microtask queue (used e.g. for promise.then) and macrotask queue (used e.g. for setTimeout):

The fact that I can get things to stack overflow by using then on a resolved Promise implies that it's not bouncing to any queue, prioritized or otherwise. I did some more research yesterday, and I think the only general solution to this involves a polyfill: https://github.com/YuzuJS/setImmediate My preferred solution would be for ScalaJS to simply have this (or a port of it) as its global executor, since promises don't really do what is needed to satisfy the contract and timeouts is far too slow.

The fact that I can get things to stack overflow by using then on a resolved Promise implies that it's not bouncing to any queue, prioritized or otherwise.

If that is true, that's a huge bug in V8, and we should report it if it hasn't already been reported. Because that is clearly violating the specs of Promises.

If that is true, that's a huge bug in V8, and we should report it if it hasn't already been reported. Because that is clearly violating the specs of Promises.

It's like, all over StackOverflow (recursive constructor), so it's certainly not an unknown thing. I think it's also very telling that the polyfills for setImmediate don't bother touching Promise at all.
Hunting around a bit, I think that @oleg-py hit it right on the head: this is a difference between the micro- and macrotask queues. The microtask queue, by spec, doesn't trampoline until all tasks are exhausted. Which is to say that if you have an eager microtask which enqueues an additional microtask callback, the stack depth will increase proportionally. This is in contrast to macrotasks, which tick each time (source: the first paragraph of this section). This isn't a violation of the spec, it's just what Promises do: they're just a continuation monad, nothing more.
ExecutionContext needs to reliably trampoline, and you can make a pretty strong argument that it needs to reliably yield. Thus, I believe that setImmediate is a more appropriate solution.

It's like, all over StackOverflow (recursive constructor), so it's certainly not an unknown thing. I think it's also very telling that the polyfills for setImmediate don't bother touching Promise at all.

The link you mention explains that the constructor runs synchronously, but that a callback to then always runs asynchronously. This is also my understanding of the spec. We use then for all tasks in an execution context precisely to force a new job. If nested then calls cause a stack overflow exception, that's an engine bug. That should take care of the trampolining aspect, which I agree must work for execution contexts.

Now, I agree with the microtask v macrotask explanation. That explains why endless chains of then will prevent any setTimeout from executing. If indeed we want to also guarantee yielding to the macrotask loop, we still have two strategies:

Use setImmediate
Use Promises most of the time, and once in a while (every ms?) use setImmediate.

I'm reluctant to abandon the Promise approach, because Promise is exactly the correspondant to Scala's Futures. People writing plain JavaScript are using Promises all the time. Why is it not an issue for them? If it's not an issue for them, how come it's an issue for us?

Use Promises most of the time, and once in a while (every ms?) use setImmediate.

What's the advantage to this though? Why not just always use setImmediate? The only reason to not use setImmediate is you need polyfills to achieve it in a cross-platform manner, but if you're still going to use it at least once, then you haven't avoided that problem. From my understanding, setImmediate's performance (when natively available) is on par with a tick of the microtask loop.
I do believe we need to use the macrotask loop, otherwise neither timers nor IO will work correctly. This is basically a matter of fairness in scheduling.

I'm reluctant to abandon the Promise approach, because Promise is exactly the correspondant to Scala's Futures. People writing plain JavaScript are using Promises all the time. Why is it not an issue for them? If it's not an issue for them, how come it's an issue for us?

It's not an issue for them for two reasons. First, you don't see JavaScript applications that are as pervasively Promise-ified as you see with Cats Effect IO, or arguably even Future. Second, most JavaScript applications on the server side are trivially IO-bound (because if they were compute bound, they wouldn't be using node in the first place), and on the client side are primarily event and rendering driven. This scenario doesn't arise very frequently with the two most common applications for the language, though it certainly does arise, which is why so many people use the setImmediate polyfill!
Also remember that most people using Promises are doing it precisely to wrap up asynchronous callbacks. If you create a Promise which wraps setTimeout, your thread of execution is going to bounce through the macrotask loop regardless of Promise's semantics, and I would be willing to bet that this describes about 99% of how people use Promise in JS.
I would also disagree with the characterization that Promise is the JavaScript analogue of Future. It really isn't. Promise is the JavaScript analogue of Future where you evaluate everything with the parasitic executor rather than global. If you do that naively on the JVM, you'll end up with awful fairness and extremely high latency on request/response cycles.
The scenario where pure Promise usage falls down is precisely the scenario we're seeing here: a long-running compute chain which needs to frequently yield control back to the event loop so as to handle IO and/or timers. This kind of scenario works just fine with setImmediate, and also works fine (but very slowly) with setTimeout, but it does not work with Promise. Scala's ExecutionContext implicitly promises to handle this type of situation (because, absent pathological implementations, it does handle this type of situation when running on the JVM), which is why I think it is correct to simply use setImmediate every time.

i think setImmediate is what's needed here, too - but https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate says  "This method is not expected to become standard, and is only implemented by recent builds of Internet Explorer and Node.js 0.10+. It meets resistance both from Gecko (Firefox) and Webkit (Google/Apple)." and relying on a polyfill that abuses postMessage and might have to rely on that one working as expected for a long time feels quite wrong to me.

there's no way to regain fairness by most often using queueMicrotask (or it's equivalent using a resolved promise) and only sometimes using setTimeout, right?

That would help. If you want to straight-up avoid polyfills, it's not a horrible thing to do. It's still going to affect timer granularity to a significant degree, but perhaps that doesn't matter so much. Like, setImmediate is available in NodeJS, which is the only place where timer granularity is unclamped, so… in a sense only periodically yielding back to the macrotask queue isn't necessarily horrible.
The trick is how do you figure that out? Like we have no way of knowing, within the ExecutionContext framework, when we've run a long series of microtasks without yielding to the macrotask queue. If we could figure that out, then in theory we could just ensure we yield once every ~4 ms (the minimum clamp on setTimeout). As it stands though, the best thing we can do is probably just yield stochastically, or try to keep some general rolling metrics on the EC as we use it. That seems… complicated.
Is that really better than the polyfill? Like, if you look at the implementation, it's actually relying on some relatively robust mechanisms all things considered. By "robust" I mean "literally what the Chrome team suggests you use instead of setImmediate".

For anyone who finds this issue who is looking for a cargo-cultable quick fix… Cats Effect now has a partial implementation of a setImmediate polyfill, wrapped up in an ExecutionContext. It works in all modern browsers and NodeJS, though it doesn't presently support web workers. In all unsupported cases it falls back to setTimeout. https://github.com/typelevel/cats-effect/blob/series/3.x/core/js/src/main/scala/cats/effect/unsafe/PolyfillExecutionContext.scala
To be clear, my preferred solution here is still to upstream this functionality, since I do believe that setImmediate (and analogues) is a better match for ExecutionContext's semantics than Promise.then is, but if ScalaJS leadership determines otherwise (their knowledge is far beyond mine on these matters), CE can maintain the alternative.

FWIW Scala.js' HTML executor also needs to work around this:
https://github.com/scala-js/scala-js/blob/v1.1.1/test-bridge/src/main/scala/org/scalajs/testing/bridge/HTMLRunner.scala#L129-L132

At this point, I observe the following:

This seems to be a genuine issue (both cats-effect and the Scala.js HTML executor which are at quite the opposite end of the Scala spectrum have this issue).
setImmediate is not going to happen (most discussions seem to be from around 2013/2014).
https://github.com/YuzuJS/setImmediate (or the port in Cats Effect) seems to rely on too much non-standard stuff to be viable for Scala.js core.

So I think trying to build an execution context that yields every once in a while to the macrotask queue is the best we can do.
I can take a stab at this.

So I think trying to build an execution context that yields every once in a while to the macrotask queue is the best we can do.

There's a new wrinkle in this btw. The only way you can reliably yield to the macrotask queue in a cross-platform fashion would be to use setTimeout, but timeouts are now disabled in Chrome on non-foreground tabs, and I don't think the microtask queue is similarly hampered. This is going to be a particular challenge because of the limited information inside of ExecutionContext, which can really only see opaque thunk submissions. So the only implementation route is likely just setting up a counter and yielding once every 1024 (or something) submissions.
The problem is that you're going to end up messing significantly with sequencing and interleaving between parallel operations this way, since in any race between two Futures, one will get hit by the setTimeout while the other might not be, depending on how they're constructed. Future is certainly less susceptible to this than IO (where it's effectively a guarantee that this will happen), but it still seems likely to cause user-visible confusion.
One route you could take, if you really don't want to do the full setImmediate polyfill, is to just rely on the two features which Cats Effect's variant does: setImmediate (in NodeJS and IE9) and postMessage. The latter is extremely standard and available in all JS environments which have a DOM, while the former is intrinsically wired into a ton of NodeJS functionality and really isn't going anywhere. Remember that the reason (cited by the standards committee) that setImmediate isn't being added to the standard is the fact that it's easy to polyfill, so the spec authors clearly expect us to be doing these types of things.
The only downside to the above is you basically have to detect the webworker environment and fall back to setTimeout (or use MessageChannel), because setImmediate won't exist and postMessage will do the wrong thing. But, IMO, this seems a lot more reliable and less confusing (to users) overall, despite the fact that it's ugly AF to implement.
(speaking of which, I'm still in the hunt for a good way to run ScalaJS within web workers in a CI environment, for exactly this reason)

There's a new wrinkle in this btw. The only way you can reliably yield to the macrotask queue in a cross-platform fashion would be to use setTimeout, but timeouts are now disabled in Chrome on non-foreground tabs, and I don't think the microtask queue is similarly hampered.

Thank you for pointing this out.
Knowing this quite shifts my perspective on this: We might have to accept that there isn't a good default ExecutionContext that Scala.js (core) can provide that reliably works on the web.
Note that Scala.js has it as an explicit goal to not rely on DOM APIs, but only things standardized in ECMAScript (setTimeout being a notable exception here).
Maybe we should look at this from a different angle:

Can we provide a good ExecutionContext for the web outside of Scala.js?
Yes, by putting what is in Cats Effect in a separate scalajs-web-execution-context (or similar) library.
Can we prevent Scala.js users to shoot themselves in the foot by using the ExecutionContext provided by Scala.js proper?
Unclear.

QueueExcecutionContext is probably sufficiently obscure that no further action is needed.
ExecutionContext.global OTOH is a natural choice for a lot of code and would do the wrong thing. We could add a compiler emitted warning that it is not good for use in DOM environments, but I suspect it will be mostly annoying and not prevent a lot of problems :S

@sjrd what are your thoughts on this? ATM I think the best we can do in Scala.js core is somehow warn when ExecutionContext.global is used (of course with all the caveats that warnings with need for silencing bring :S).

I'm still very uneasy about this whole thing. I have reread the whole discussion here. It I have to reluctantly agree that Promises are not a right fit for an ExecutionContext, unfortunately. At the same time, using anything else is a strong departure from our existing policy in Scala.js core not to use anything that is not standard in ECMAScript (or about to become standard, behind flags in ESFeatures).
Yes, setTimeout is special here, but note that so far we only use it:

for javalib stuff directly related to timers (i.e., java.util.Timer): if setTimeout is not supported, that API will not be supported, but that's kind of expected from a user point of view
for ExecutionContext when Promises are not available (so, never with an ECMAScript 2015+ engine)

In addition, all the engines that support timers support setTimeout with the same API. They don't have 3 or 4 different ways of doing the same thing.
I would like to say that other than that, we stick 100% to ES 2015. However I also have to admit that 1 case of polyfilling a non-ECMAScript API leaked into our implementation, a long time ago: using performance.now() when available to implement j.l.System.nanoTime():
https://github.com/scala-js/scala-js/blob/88a19cf1be1421ffed94e968dd76018d77eb8095/javalanglib/src/main/scala/java/lang/System.scala#L72-L92
At least that one has a compliant fallback (if less precise).
Using even a polyfill of setImmediate would be a qualitative departure from our policy. I believe this is not acceptable. If we do it, we'll have a precedent to accept all sorts of other polyfills like that to implement "stuff": default locale, time-related things, who knows what.
Remains the option of warning against Execution.global. But then what would we suggest instead? We could tell people to use QueueExecutionContext if they know what they're doing. But already that is annoying for cross-platform code (JVM/JS). We would probably have to publish at least another library with something portable-ish. But then what I also fear is that libraries will start indiscriminately depending on that, and we'll be back with the same problem that we have today: that the ecosystem basically relies on something that doesn't always work. (Or, if it uses the setImmediate polyfill, that the ecosystem basically relies on something that is non-standard, which is almost as bad as if it were implemented in Scala.js core.)
ATM I don't see any real solution. All the choices we have are damned.

Remains the option of warning against Execution.global. But then what would we suggest instead?

I wouldn't actually suggest something else (for portable usage). Simply allow users to disable the warning (ideally with the existing @nowarn mechanism). So if one needs portable code providing an ExecutionContext (which is an assumption I'd be willing to challenge, but let's keep it for now), ExecutionContext.global still works, it just needs an acknowledgment that it will not necessarily work as expected on the web (in "pure" JS engine OTOH it would).

Hum, yes, I guess that makes sense.

I wasn't aware of the policy against polyfills. That design decision makes a ton of sense and I support it.
My thoughts for what they're worth… Leave the Promises executor in place exactly as it is, but warn whenever it (or global) is used. In the warning, point users to a separate library which ports setImmediate to ScalaJS. I'm happy to offer the PolyfillExecutionContext from Cats Effect as the starting point.
It's definitely clear that promises as an executor cause some serious problems in certain common types of execution modalities, but the problems aren't severe or ubiquitous enough (IMO) to warrant full on removal. A disableable warning and a blessed separate library seems best.

@djspiewak would you be willing to publish the execution context of Cats Effect separately? If yes, I'll be happy to implement the relevant compiler warnings and point folks to it.
@sjrd would that work for you?

Yes, that sounds reasonable.

Ping @djspiewak

Ping @djspiewak

Sorry! Missed this. And yes I'm quite willing to do that. This would also make it a little easier to facilitate contributions from people who may have relevant knowledge on it, but who would rather not dive into Cats Effect itself.

Sorry! Missed this. And yes I'm quite willing to do that. This would also make it a little easier to facilitate contributions from people who may have relevant knowledge on it, but who would rather not dive into Cats Effect itself.

Absolutely! Web execution scheduling and Cats Effect seems to be two quite different pairs of shoes. In that case, I'll start investigating options of how we can warn when the global execution context is used.

Absolutely! Web execution scheduling and Cats Effect seems to be two quite different pairs of shoes. In that case, I'll start investigating options of how we can warn when the global execution context is used.

It seems that from a user interface POV, we have the following options to disable a warning when importing ExecutionContext.global (or it's implicit variant).

@nowarn in 2.13.x, something else for earlier versions (con: different per scala version)
Compiler option (con: global*, potentially unintuitive)
Magic import (con: JVM compat, unintuitive)
Our own annotation (con: JVM compat, unintuitive on 2.13.x)

I'm not 100% sure if a global enable/ disable is a bad thing: Essentially, a given piece of JS code either needs to run on a web runtime or not.

@sjrd opinions?

I think we should offer the global compiler option and an @nowarn-based solution. Users on recent enough versions of Scala would be encouraged to use the latter, and others could use the former.
Solutions that are not JVM compatible are not useful, IMO.

@gzm0 @sjrd Now that we've finally implemented webworker support, we're getting ready to extract the polyfill executor into its own project. Would you like to host the repository under the scala-js org? I don't think it makes that much sense under typelevel.

It is a good question. If we're going to point to that library from a compiler-emitted warning, I guess it makes sense to put it under the scala-js organization.
@djspiewak What name should we give to that repository?
@gzm0 WDYT?

SG. Name: web-execution-context?

web-execution-context or maybe even macrotask-execution-context? I'm not sure how widely-known these semantics are.

I guess macrotask-execution-context is more accurate, since it also supports some non-Web environments.
All the repos in this org start with scala-js-, so scala-js-macrotask-execution-context? Although it's a bit of a mouthful :p

Maybe scala-js-macrotask-executor? Still a lot but considerably less :-P

@djspiewak as a follow-up on the discussion on this cats-effect issue, I have indeed added the possibility to specify an execution context in specs2 and tried it out on your specification and now timeouts work ok. On the other hand it does not make sense to open up that possibility in specs2 so that the only execution context which would make sense there is the one provided by cats-effect. This is why I was about to suggest to go ahead with the extraction of that execution context in its own library but I can see that everyone already agrees that this is a good idea!
When this will be done I will add a dependency in specs2 so that this execution context is used by default when ScalaJS is used. Would that be ok with you or do you still think that overriding the execution context in specs2 is desirable? (feel free to move that part of the discussion to specs2)

Maybe scala-js-macrotask-executor? Still a lot but considerably less :-P

Works for me. If there are no objection, I'll create it tomorrow.

Once it's created, we can start working on moving stuff over. The infrastructure will take the longest, and we need some sort of test suite since it's currently just relying on the Cats Effect tests.

Additional thought: you should probably toss a scalafmt config in there. Also any preferences on package name for the executor itself?

Also any preferences on package name for the executor itself?

org.scalajs.macrotaskexecutor would make sense.

Since you guys are talking of Promise.then, not sure if this came up yet, but then is also leaking memory when chaining in Chrome and Firefox (but not Safari)  ...
https://alexn.org/blog/2017/10/11/javascript-promise-leaks-memory.html
I realize that setImmediate is not standard, but it is a de-facto standard on Node.js, whereas on top of browsers setTimeout is throttled to err on the side of UI responsiveness. In other words, in the browser using setTimeout(0) is the right choice, whereas on top of Node.js using setImmediate is the right choice.
However, there is no instance in which Promise.then is the right choice, and using it in place of setImmediate is just as non-standard as using setImmediate, because the fact is that browsers cannot agree on its implementation.
BTW — Monix has been using setImmediate in its Scheduler.global whenever available, ever since I ported it to Scala.js. Nobody complained.

Who is this waiting on? @djspiewak, do you simply need a repo under the scala-js org or is there anything else needed? (seems like scala-js/scala-js-macrotask-executor does not exist).

@gzm0 We're waiting on the repository creation. :-) Once that happens, we can PR the basic skeleton pretty quickly. It'll need GHA approval from an admin unless y'all give us write/admin access, but after that things should smooth out.

I created https://github.com/scala-js/scala-js-macrotask-executor and added you as a maintainer.
I'll leave it up to @sjrd how to organize permissions.

The above project now contains the polyfill executor implementation, as well as almost all the associated testing and CI infrastructure. The only thing it's missing at present is the infrastructure for testing under webworker environments, which we're working on.
Incidentally, doing this uncovered the fact that the polyfill is not working on jsdom. It doesn't fail anything, but it falls back to setTimeout (with the associated clamping). We'll see if that's fixable (seems doable, since postMessage should be present in that environment).
Plan of record here is the following: https://github.com/typelevel/cats-effect/issues/2314

Quick update: since yesterday we now have WebWorker infrastructure running, as well as patched the polyfill for JSDOM.

I'll leave this issue open to track the culmination of @gzm0's compiler warning idea. In the meantime, over in polyfill land, I'll open an issue to track the drive towards 1.0.0.

QQ is there already a readme somewhere that explains why using the global execution context is potentially bad? I doubt I'll come up with something short enough for an error message. So I was thinking to just refer to a page.

Does the readme at https://github.com/scala-js/scala-js-macrotask-executor work?

I doubt I'll come up with something short enough for an error message.

"The global execution context is based on Promises, which exhibit unfair semantics with respect to other elements of the event loop, such as I/O events, timers, and UI rendering. It is recommended that users employ the macrotask executor, to be found here: https://github.com/scala-js/scala-js-macrotask-executor"
Ish?


Possible for custom '?' character, or none at all?

I couldn't find a way to modify the very first character '?'. Is there a way?
Thank you.

Currently no, but I aggree, it would make sense to add a prefix and maybe also a postfix option. Will look into it.
But if you want to make a PR for adding these option feel free to do so 🙂

Thanks, the library is fantastic either way. Thanks for creating it!

Glad you like it!


Feature request: "script receiver"

Dear Developers,
I don't know if it is possible to implement but I would be interested in having a sort of "script" receiver, which would execute a user-defined (bash) script on alert events, like:
receivers:

name: script
script_configs:

script: /home/user/myalert.sh

If possible, working in a way that alert.sh either get alert json string as argument, or it would be even greater that the script could be templated (with like some {{label=''}} stuff).
I ask it because with using webhook I have to deploy another component to receive alert POSTs
(nor I can configure webhook to send GET/PUT/... with the desired content) and do something special I need.
In this way alertmanager would be more flexible. As I remember Zabbix can also run scripts on triggers.
What do you think?
Best regards,
Akos Hajnal

Hi Akos,
I get that the webhook is another hop, which is an inconvenience to setup.
Templating the script itself is not possible from a security perspective.
I'm open to discuss this and would like to hear more opinions and whether
more people feel a need for something similar.
Fabian
On Tue, May 17, 2016 at 11:16 AM ahajnal<EMAIL_ADDRESS>wrote:

Dear Developers,
I don't know if it is possible to implement but I would be interested in
having a sort of "script" receiver, which would execute a user-defined
(bash) script on alert events, like:
receivers:

name: script script_configs:

script: /home/user/myalert.sh

If possible, working in a way that alert.sh either get alert json string
as argument, or it would be even greater that the script could be templated
(with like some {{label=''}} stuff).
I ask it because with using webhook I have to deploy another component to
receive alert POSTs
(nor I can configure webhook to send GET/PUT/... with the desired content)
and do something special I need.
In this way alertmanager would be more flexible. As I remember Zabbix can
also run scripts on triggers.
What do you think?
Best regards,
Akos Hajnal
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/prometheus/alertmanager/issues/354

I'm against scripts, too much of a reliability threat (how well do you deal with 100 forks+exec of a script per second?) and there's the security risks too. There's nothing stopping development of a webhook utility that runs scripts.

Hi Fabian,
To add some further details... In my special case, I would like not only to monitor something and get alerts from Prometheus-Alertmanager but to react actively on events - using as few components as possible. Script is something that can be quite active. What about a REST receiver, or a more generic receiver in which users can configure HTTP method/headers/payload? This avoids forks+exec and is similar to webhooks.
Akos

There's nothing stopping development of a webhook utility that runs scripts.

I've written exactly this. It takes a script as arg and listens on http for prometheus webhook. Will try to open source it and ping you.

Hi discordianfish,
That will be a definitely useful tool not just for alertmanager.
Akos

@ahajnal Just opened it up: https://github.com/imgix/prometheus-am-executor

Looks great!

Not sure if you guys looked at monit.
https://mmonit.com/wiki/Monit/ConfigurationExamples
Which provides option for exec, pretty helpful.


Missing Files freeze the game

Sorry, it's my first time submitting an issue, so I may be wrong on the analysis of the issue.
I was playing the offline mode, and my game suddently freezed. I checked in Devtools and find this error :

And, it's true, the file is missing in local on my computer, so I checked in the code of pokerogue, the file is also missing.
I exported my data, and imported them on a local server I created following the instructions from : https://github.com/pagefaultgames/pokerogue to run locally
There I tried to reproduce the bug, but unfortunately, I didn't. It did work on my server (I have the file_not_found, but the game continue like nothing happened).

I don't know if you can do anything about this, since it seems that pokerogue-app, and my local server don't work the same.
But still, thank you for your work!

I have the same issue, the workaround I found to continue my playtrough was to just duplicate a random battle-anim ("absorb.json" for example) and rename it to the one the game is trying to find

I'll have to look into this one more; it might just be a matter of adding some error handling.

Similar issue, this one is for battle-anims/zippy-zap.json

Similar issue, this one is for battle-anims/zippy-zap.json

I had the same issue when my Eevee evolved to Espeon and it tried to learn Glitzy Glow.

I think I might've resolved this issue; try the latest version.

Unfortunetly the problem persists. I have this same problem when Eevee evolves into Umbreon and tries to learn "Baddy bad" and when reaching encounter 90, where sadly I am now stuck.

@MisterInSayne Please use the workaround I provided in the meantime, its super simple to setup. Then a quick game reload will work to continue your progress

Unfortunetly the problem persists. I have this same problem when Eevee evolves into Umbreon and tries to learn "Baddy bad" and when reaching encounter 90, where sadly I am now stuck.

Just to clarify, you downloaded the new version of the app, not just the latest offline files, right? I posted a new app version with some fixes for stuff like that. Someone gave me a session save with zippy zap, and that one worked on the new version just fine. Of course, it could be some other issue, so I just want to make sure!

This may be a separate issue, but my game is freezing as well. The first time was after I chose an item and it was supposed to switch to the next battle, the second time I was teaching my Bloodmoon Ursaluna a move and it froze on "And..."
I don't have the knowledge of HTML/json stuff needed to figure out if the cause is the same as it was for the others here or if it's a separate, related issue.

@EarthBet the best way to check is to go to the top left menu when the game freezes, click on "toggle console", and send a printscreen of the console tab there, that should give all relevant information :)

@Admiral-Billy thanks for the quick work. I am checking now if it solved it on my cases as well, will report here later Today

@Admiral-Billy I confirm, you have fixed my issue!
Thank you for your work!

Froze again, this time I checked the console.
Failed to load resource: net::ERR_FILE_NOT_FOUND
images/battle_anims/PRAS-%20PsychicBG.png:1
I tried to copy and paste and rename a different animation to be the missing one, but the file already existed. I thought maybe there wasn't a space between Psychic and BG like there were in other PRAS- Move BG.png files, so I tried renaming the copy to PRAS- PsychicBG.png instead, but it still froze.

Are you sure you have taken the new version with the fix? https://github.com/Admiral-Billy/Pokerogue-App/releases/tag/v2.0.1
Sorry to ask, but our issues look alike, and for me, the fix worked

I assumed that downloading latest files for the game updated the game, but in retrospect I'm probably wrong. I'll try updating.

Thank you, that fixed it

Alrighty, I'll close this for now since it seems like I stomped the issue. For any curious people, the online version gracefully handles missing animation files, but for some reason offline doesn't. I band-aid fixed this by just intercepting calls for missing files and returning an empty json file, but if there's a better fix out there let me know!

@Admiral-Billy I saw your comment today so I did the Download latest files for offline then did a run but it looks like the bug is still a thing?

I reloaded in case the fix just wasn't being used and the 2nd time round I got a different error


Uninstall question

Will uninstall remove anaconda, conda, cuda and all installed packages?

Uninstall will leave models on your drive.