Any possibility of using this for react native project?

I really appreciate the guiding principles behind this library, have felt some of the pain associated with the drawbacks you all have identified with enzyme, and I'm curious how much work would be involved to get this library to work for a react native project? Given the reliance on DOM testing, I'm guessing it might not be possible or a good idea. Any guidance is greatly appreciated.

Hi @amay!
I'd love react native support, but I have no idea how hard that would be... I know very little about react native. I'm pretty sure the only way to make this work is if you could render react-native components to the DOM. I'm not sure whether there's anything out there which makes this possible though...
I'd love to look at a PR for it so long as it doesn't make this library more complex to use or over-complicate the implementation. Anyone can feel free to investigate this :smile:

Hey @kentcdodds, I had some luck getting this working with some (admittedly nasty) hacking. I will post here in case it is helpful to anyone else:
// in setupTests.js which is configured as jest's setup file.
// Adapted from https://blog.joinroot.com/mounting-react-native-components-with-enzyme-and-jsdom/ and
// https://stackoverflow.com/questions/42039383/how-to-use-enzyme-for-react-native-with-jest

import { JSDOM } from 'jsdom'
// used to fully render native components as react components
import 'react-native-mock-render/mock'

// copy props needed to render HTML from JSDOM window to node's global object
function copyProps(src, target) {
  Object.getOwnPropertyNames(src)
    .filter(prop => typeof target[prop] === 'undefined')
    .forEach(prop => {
      // eslint-disable-next-line no-param-reassign
      target[prop] = src[prop]
    })
}

const { window } = new JSDOM()

global.window = window
global.document = window.document
global.navigator = {
  userAgent: 'node.js',
}
copyProps(window, global)

// react doesn't like some of the props that are set on native components (that eventually are set on DOM nodes, so suppress those warnings
const suppressedErrors = /(React does not recognize the.*prop on a DOM element|Unknown event handler property|is using uppercase HTML|Received `true` for a non-boolean attribute `accessible`|The tag.*is unrecognized in this browser)/
// eslint-disable-next-line no-console
const realConsoleError = console.error
// eslint-disable-next-line no-console
console.error = message => {
  if (message.match(suppressedErrors)) {
    return
  }
  realConsoleError(message)
}

With this, I can get a test like the following to pass in jest:
import React from 'react'
import { StyleSheet, Text, TouchableHighlight } from 'react-native'
import PropTypes from 'prop-types'
import { render, Simulate } from 'react-testing-library'

const Button = ({ onPress, text }) => (
  <TouchableHighlight onPress={onPress}>
    <Text>{text}</Text>
  </TouchableHighlight>
)

test('renders text', () => {
  const { getByText } = render(<Button text="Test Button" />)

  expect(getByText('Test Button').textContent).toBe('Test Button')
})

However,  I can't get calls to Simulat to work because press is not a supported event type in react-dom:
test('invokes onPress prop on press', () => {
  const onPress = jest.fn()
  const { container } = render(<Button onPress={onPress} />)

  Simulate.press(container) // throws error
  // Simulate.click(container) doesn't work because it doesn't trigger press event

  expect(onPress).toHaveBeenCalled()
})

So far I haven't been able to think of any way to extend react-dom/test-utils to send the press event.

Awesome!
I'm pretty sure that you shouldn't have to do the JSDOM stuff because jest will handle that all by default anyway (perhaps in your tests you're specifying a different testEnvironment which is why that's not working).
The console.error stuff is fine but probably not something I want to include in the library, but we could point to an example or some other lib which handles this.
Also the import 'react-native-mock-render/mock' is something I think I don't want included in the library and would rather have that be something you have to do yourself.
As for the simulate stuff, I'm not sure what the code would entail, but you should be able to simply: Object.assign(Simulate, customEventSimulators).
Now that I think about it though, there's not a whole lot that I want to include in the library itself... Perhaps we could just have some examples of the setup you'd need to do to support React Native 🤔

At the very least, I'd like to have people doing things in the wild before we decide on including anything into the core so we have time to decide what works best.

Thanks for the tip on testEnvironment. It was being set to node which is why the JSDOM stuff didn't work.
After doing the research into what was needed to get this working, I definitely agree that it doesn't make sense to try to incorporate these changes as this package is really about DOM testing.
I did end up getting Simulate.press to work w/ again some trickery. I'll post it here in case a future dev wants to go down this road, but I'm okay if you want to close out this issue for now.
Here is the final setupTests.js file for setting up jest to work with this test lib:
import 'react-native-mock-render/mock'
import { Simulate } from 'react-dom/test-utils'

function suppressDomErrors() {
  const suppressedErrors = /(React does not recognize the.*prop on a DOM element|Unknown event handler property|is using uppercase HTML|Received `true` for a non-boolean attribute `accessible`|The tag.*is unrecognized in this browser)/
  // eslint-disable-next-line no-console
  const realConsoleError = console.error
  // eslint-disable-next-line no-console
  console.error = message => {
    if (message.match(suppressedErrors)) {
      return
    }
    realConsoleError(message)
  }
}

function setupSimulatePress() {
  Simulate.press = Simulate.click

  jest.mock('TouchableHighlight', () => {
    // eslint-disable-next-line global-require
    const React = require('react')
    const RealComponent = require.requireActual('TouchableHighlight')
    const TouchableHighlight = props =>
      React.createElement(
        'TouchableHighlight',
        {
          ...props,
          onClick: props.onPress,
        },
        props.children
      )
    TouchableHighlight.propTypes = RealComponent.propTypes
    return TouchableHighlight
  })
}

suppressDomErrors()
setupSimulatePress()

I think that code would make a handy package by itself. I definitely would love to reduce friction for folks testing with React Native, I'm just not 100% certain I want to commit to building-in a RN implementation at the moment. Would you be interested in making your code a package then make a PR to this repo to show how to integrate it?

Super. Thanks @amay! I can't wait to see the package if it turns up on npm :) I'd love to link to it in the README here :)

Hey @amay! Folks are curious to hear how your experiment went! Is this something that'll work for react native?

@kentcdodds @amay any news on this topic? Thanks!

Hey @kentcdodds @hnordt I didn't get to do as an exhaustive of a deep dive as I would have liked for this, but early indications suggest there would need to be some more work put in to get this to work well. The specific issues come down to bridging native behavior to the dom. E.g. you wan't react native's TextInput to behave as expected, so when rendering in the DOM, you need to bind it to an input element and then fixup any differences between how inputs work in RN vs the DOM. And that is just one example.
The react-native-mock-render project I was using doesn't attempt to do anything "smart" when mocking out the react native components, which leaves that up to us to figure out. I ended up tackling some of these issues as they came up, but in no way did I get to a place where I feel like I have a very good solution, and it definitely felt like a lot of work each time an issue came up.
I recently saw the announcement for this project: https://github.com/vincentriemer/react-native-dom, and I'm curious if using that could result in a much better and comprehensive test setup. That project ostensibly does the bridging between react native components to true DOM components, so in theory it could work very well. I haven't had time to test it out unfortunately.

@amay thanks for the quick answer.
I think we might need to clone dom-testing-library and create a native-testing-library. Might need to use something like the "Direct Manipulation API": https://facebook.github.io/react-native/docs/direct-manipulation.html
I think emulating React Native into a fake dom is not a good idea cause you are not testing the app in the real environment it's gonna run, so you won't be confident about your tests anyway.

Any update on this?

I've not been made aware of any progress on making react-testing-library work nicely with react native. I'd love it someone could build something though!

I'm using it by rendering component with react-native-web. It works pretty well but you have to structure your components so you can render what you want to test outside of very RN-specific libs like react-navigation, etc. While there are a few components I can't test, generally I'm able to test most of the ones that have complex business logic. The rendering doesn't look 100% perfect with what's on mobile, but it works for just testing behavior and stuff.
It actually works well enough that this is all you really need:
fireEvent['press'] = (node, init) => {
  fireEvent.mouseDown(node, init);
  fireEvent.mouseUp(node, init);
};

I use fireEvent.press to simulate a press.
Then you just renderIntoDocument your component that uses react-native. Well, you do have to configure tooling to make it work with react-native-web. This is my jest config which I think is all you need:
module.exports = {
  moduleFileExtensions: [
    'web.js',
    'ios.js',
    'mjs',
    'js',
    'json'
  ],
  moduleDirectories: ['<rootDir>/node_modules', 'node_modules'],
  testEnvironment: 'jsdom',
  setupTestFrameworkScriptFile: '<rootDir>/src/setupTests.js',
  testMatch: ['<rootDir>/src/components/mobile/**/*.test.js'],
  moduleNameMapper: {
    '^react-native$': 'react-native-web',
    // Ignore react-art. react-native-web tries to pull it in but we
    // never use or need it, and it throws errors in jsdom
    '^react-art$': 'node-noop'
  },
  globals: {
    IS_REACT_NATIVE: true
  }
};

There might be a few other things I forget, but it mostly just works. The only downsides is you run into problems pretty quickly with stuff that doesn't work under react-native-web, but if you're just looking to test the logic of isolated components, it works well enough. Anything that uses more complex stuff like a native dependency, react-navigation, etc will have to live outside of those components.

Awesome! Thanks James! Have you tried mocking those react native components to be able to test more?
Would anyone like to try this out and verify it works for you as well? Then we can add this to the docs 👌

You can't really mock react-navigation. It's a huge lib and your component will depend on it passing specific things to you. You might be able to mock native modules, depends on what they do, I haven't run in to the need for it yet.
I think I saw some commits in react-navigation talking about web support, but I haven't looked closely yet. Last I tried it didn't work, and didn't care too much about it. I need to test my critical components and I already pull them out of route-specific ones so it doesn't bother me.

Sounds good 👍 thanks again!

@kentcdodds this works for me. I can put up a repo showing the bare minimum setup with a single test.

That's fantastic @thchia! Could you please make a pull request to the README with a little documentation about this along with a link to your repo? Thank you team!

Though this is closed, linking a library which looks very promising for people who land here (haven't used the linked library in prod yet). https://github.com/callstack/react-native-testing-library


Edits to Slack, Before Starting, What you get

Here's the next chunk. I rebased. Cherry pick what you're ok with.

Updates should address your comments.


Switch cargo build working directory to the Manifest (cargo.toml) directory

The output directory (target-dir) is left unchanged.
Changing the cwd to the directory of the Manifest, has the advantage that
cargo can pick up .cargo/config.toml files in the source tree.
In the future this would also allow corrosion to respect rust-toolchain.toml
and other rustup toolchain overrides.
Closes #150

The CI is failing though (when Corrosion is used as a library)

The CI is failing though (when Corrosion is used as a library)

Fixed. The test requires Cargo >= 1.56, since that is when support for the env key was added. I had a look at the other available keys in 1.46.0, but nothing really stood out in terms of being suitable for a simple test if the config.toml was read.


Add JuiceFS to File System section

Please refactor your change to only add JuiceFS and not change all of the other lines

Sorry for the mis, I have fixed it, thank you for review! 🤝


Dismiss All Alert settings

the alert keep showing up when even another view controller shows up, thus made such changes.
usage:
[RKDropdownAlert dismissAllAlert];

great idea, thanks


Update aws-java-sdk-bundle to 1.12.667

About this PR
📦 Updates com.amazonaws:aws-java-sdk-bundle from 1.12.660 to 1.12.667
Usage
✅ Please merge!
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

⚙ Adjust future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "com.amazonaws", artifactId = "aws-java-sdk-bundle" } ]

Or, add this to slow down future updates of this dependency:
dependencyOverrides = [{
  pullRequests = { frequency = "30 days" },
  dependency = { groupId = "com.amazonaws", artifactId = "aws-java-sdk-bundle" }
}]

labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

Superseded by #3101.


More readable pad values

When the SceCtrlData.Lx value changes, the length of the value can change (from 1 character to 3 characters) so the string for Ly moves to the right by one or two characters.
The SceCtrlData.Lx and Ly are unsigned char so the value are between 0 (one character length) and 255 (3 characters length). It's more readable by fixing the size for the value to 3 characters wide so the string to Ly does not move.

I have written the same PR on pspsdk repository.

Thanks! That's a nice change.


Applying carpet to a table uses all carpet in stack

Description
You only need 1 peice of carpet to apply it as a table cloth, however if you are holding a stack of say 3 carpet, the whole stack will be used when applying a tablecloth.
Reproduction

hold multiple pieces of carpet in your hand
click on a table to apply it as a table-cloth
once applied, it will have used all the carpet in your hand

Duplicate of #25687


⚠ fix unsafe lifecycle warnings

close #71
close https://github.com/react-component/animate/pull/73
close #78
ref: https://github.com/ant-design/ant-design/issues/9792

Coverage decreased (-0.2%) to 82.556% when pulling e6903c75255cfcb8f540d33c9f4b2a6edf6ac0f0 on fix-unsafe-warnings into 42f1576ac1cd4600fd8aa6820abf3bce3631abf9 on master.


Accessibility (WCAG level AA):  Stylesheet deliberately turns off focus indicator on links

To repro:

Navigate to http://nuget.org
Using the keyboard only (i.e. not eh mouse), tab to one of the links on the page.

Result:  The status bar in your browser (if enabled) will indicate that you've tabbed to a link, but there will be no focus indicator shown onscreen to indicate which link currently has focus.
Expected:  This should be visible.  The presence of a focus indicator is a AA requirement in WCAG.
Note:  This is controlled by CSS.  In Site.css, there is a setting on all a elements that sets "outline: none", which is what triggers this behavior.  Getting a focus indicator to appear around link elements can be done by removing this rule.

We have a new gallery design.


feat: support negative strides for idamax and isamax

Resolves #2792. Towards #2464.
Description

What is the purpose of this pull request?

This pull request enhances existing JS ndarray implementation of blas/base/idamax and blas/base/isamax to support negative strides.
Related Issues

Does this pull request have any related issues?

NA
Questions

Any questions for reviewers of this pull request?

No.
Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.
Checklist

Please ensure the following tasks are completed before submitting this pull request.

[x] Read, understood, and followed the contributing guidelines.

@stdlib-js/reviewers

Done, this PR can have a final review.


Add Solution for Knapsack Problem using Dynamic Programming in C++,Python

Is your feature request related to a problem? Please describe.
I would like to propose adding a solution for the Knapsack problem using dynamic programming to the repository. The Knapsack problem is a classic optimization problem where given a set of items with weights and values, the goal is to determine the most valuable combination of items to include in a knapsack without exceeding its weight capacity.
Describe the solution you'd like
The proposed solution will utilize dynamic programming techniques to efficiently solve the problem. It will include a C++ implementation that can handle a varying number of items and a given knapsack capacity.
Describe alternatives you've considered
The solution will follow the dynamic programming approach, where a 2D table will be used to store intermediate results. It will utilize memoization to avoid redundant calculations and improve performance. The algorithm will determine the optimal combination of items and calculate the maximum value that can be obtained within the given constraints.
Additional context
This implementation will be thoroughly tested using different test cases to ensure correctness and efficiency. Additionally, proper documentation and comments will be provided to facilitate understanding and future contributions.
I believe that adding this solution to the repository would be valuable for anyone studying or working on algorithms in C++. It will serve as a useful reference for the Knapsack problem and dynamic programming techniques.
Please let me know if there are any specific guidelines or requirements for contributing to the repository, and I would be happy to address them.

Greetings!
In Knapsack problem, we are given N items and those items has some weight and profit associated with it. We are also given a bag with capacity W which can hold at most W weight in it. Our target is to put the items into the bag such that the sum of profits associated with them is the maximum possible.
I am capable of solving this issue using both the recursion and memoization methods of Dynamic Programming using C++.
@manu31shukla kindly assign me  this issue for SSOC'23 season 2.
I will also add suitable comments so that it is clearly understandable by the reader.
Thanks.

Ok ok ..no issue
On Tue, 30 May 2023, 16:11 Manu Shukla, @.***> wrote:

Hey @Myworld21 https://github.com/Myworld21 , I actually initiated this
issue to work on it further after getting permission from @Kumar-laxmi
https://github.com/Kumar-laxmi .
—
Reply to this email directly, view it on GitHub
https://github.com/Kumar-laxmi/Algorithms/issues/688#issuecomment-1568205460,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AZ5PEU4O74SEUP66UGCDSKDXIXFF3ANCNFSM6AAAAAAYRJS3PM
.
You are receiving this because you were mentioned.Message ID:
@.***>

Kindly implement Fractional Knapsack (because 0/1 Knapsack has been implemented in all the languages)
Assigned!
@manu31shukla : C++ & Python


Bump bugsnag-android to v5.7.0

Enhancements

Support native stack traces in the ANR plugin
#972

Bug fixes

Check additional JNI calls for pending exceptions and no-op
#1142
Move free() call to exit block
#1140
Replace strncpy() usage with safe function call
#1149
Prevent NPE when delivering internal error reports
#1150

Closing in favour of next android release


Update full-text-search.md

Syntax error in "Recruitment scenario-searching for job candidates that have experience working with SQL Server" example.

@awickham10 : Thanks for your contribution! The author(s) have been notified to review your proposed change.

#sign-off
@Jak-MS Hi, can you please Merge this now-Approved PR 3321 now.  Thanks.

@MightyPen: I'm sorry - only the author of this article, @pmasl, can sign off on your changes. But we do have an exception process - if you are on the Microsoft content or product team for this product area, you can ask the PR review team to review and merge it by sending mail to the techdocprs alias.

Just merge it.


Fix @typescript/vfs module path

In @typescript/vfs package.json module points to non existing file.
This is package content when loaded from npm:

And there's no ./dist/typescript-vsf.esm.js. Shouldn't it be pointing to ./dist/vsf.esm.js?

Yeah, I agree - thanks!

Yeah, I agree - thanks!


Plotting Questions

All-
I fit a model : ebm.fit(X,y). Then I am able to see overall feature importance running:
import plotly
plotly.tools.set_credentials_file(username='XXX', api_key='123')
import plotly.plotly as plotly_py
ebm_global = ebm.explain_global()
plotly_py.iplot(ebm_global.visualize())

Question 1: Is there a way to see more than the default top features?
Then if we pass an index into visualize, we get the shape of the effect of that feature:
plotly_py.iplot(ebm_global.visualize(0))
I can see local explanations:
ebm_local = ebm.explain_local(X,y)
plotly_py.iplot(ebm_local.visualize(20))

QUESTION 2: IS it possible to get this data back and not plot it?
Question 3:
How does the above differ from show()? I have been unable to get this to work but it looks like the only difference is a drop down selector?

Hi Brian,
Thanks for the questions! We'll work backwards through the questions as they're all related:

Question 3: How does the above differ from show()?

You're right, the only difference is the drop down -- it just makes it a little easier to find the features you're looking for. If you call show with a list (ex: show([explanation]) it will launch a dashboard to enable comparisons. What errors are you running into with the show method?

QUESTION 2: IS it possible to get this data back and not plot it?

Yes, you can. Every explanation object supports a .data() method, which returns the raw data used to generate the visualization. So in your example, you can call ebm_global.data() to get the overall feature importances, or ebm_global.data(1) to get the data for the graph in feature 1 (the same applies for ebm_local).

Question 1: Is there a way to see more than the default top features?

Right now, our built in "summary" visualization only includes the top features, but you can easily call ebm_global.data() to get the scores for every feature, then use any plotting library of your choice.

That's fantastic!
I wont stress much about the issues with show in my environment then.
Last plotting questions, any plans in the roadmap to generate the feature shape curves with a local value highlighted (a vertical line) as in the original Ga2M paper?

We don't have plans to support this directly in the code right now, but you can manipulate the Plotly objects with a bit of code to add it in. Here's a quick example:
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()

ebm_global = ebm.explain_global(name='EBM')
instance = X_test[:1]
feature_index = 0 # Feature graph to visualize

feature_plot = ebm_global.visualize(feature_index)  # Plotly object
plot_data = ebm_global.data(feature_index)   # Raw data pre-visualization

y_min = min(plot_data['scores'])
y_max = max(plot_data['scores'])

feature_plot['layout']['shapes'] = [{
    'type': 'line',
    'x0': instance.iloc[0][feature_index],   # Value of the feature for instance 0
    'y0': y_min,
    'x1': instance.iloc[0][feature_index],
    'y1': y_max,
    'line': {    # Customize the line
        'color': 'red',
        'width': 3,
        'dash': 'dot'
    }
}]

iplot(feature_plot)

which will produce this:

You can play around with the style and shape of the line quite a bit -- here's the documentation for the plotly shapes API: https://plot.ly/python/shapes/


feat(connector): display metrics to grafana

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?

display cpu and ram usage of connector node on grafana
added source rows received metric for connector node

Checklist For Contributors

[ ] I have written necessary rustdoc comments
[ ] I have added necessary unit tests and integration tests
- [ ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features #7934).
- [ ] I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
[ ] All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

[ ] I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

[ ] My PR DOES NOT contain user-facing changes.

Click here for Documentation
Types of user-facing changes
Please keep the types that apply to your changes, and remove the others.

Installation and deployment
Connector (sources & sinks)
SQL commands, functions, and operators
RisingWave cluster configuration changes
Other (please specify in the release note below)

Release note

IIRC, the existing code has some problems with measuring CPU time and RAM usage, please double check


code cleanup

cleaning up code which blocks grunt from running properly with all tests
see https://github.com/lirantal/meanio/tree/cleanup-jshint-warnings for fixes

@timelf123 @liorkesos Recommend closing, we aren't even using grunt anymore.

+1
On Jul 29, 2016 5:31 PM, "ADSKLowenthal"<EMAIL_ADDRESS>wrote:

@timelf123 https://github.com/timelf123 @liorkesos
https://github.com/liorkesos Recommend closing, we aren't even using
grunt anymore.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/linnovate/meanio/issues/5#issuecomment-236195945, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAO9I32mLgD8Kub5u3zT6THoJxyFbKc0ks5qag6ugaJpZM4CkGle
.


Missing LICENSE and README.md in pypi

To help the spread of packaging this tool, it would be cool to have LICENSE and README.md in pypi published tar.gz.

Fixed. Thanks for letting me know!


Add test for unsubscribing from resources

This is a great start, and the test passes which is awesome. Well done for this! I think the test can be improved before a merge though. Specifically for it to move from imperative steps to declarative steps.

Thank you!
Good to see that the implementation is there.
I think that declarative steps would definitely be more ideal.

The main issue is in the given statements. The two And's contain actions and should just be a declaration of state.
High level, the test could be written as:
Given I am subscribed to multiple clusters from a server
When i send a new request for a single resource
Then I should get a response with only that resource

To have it be written in our yaml style, it could be condensed to 4 steps:
Given a target setup with snapshot matching yaml...
And an established subscription that was initiated with request matching yaml...
When i send a new request matching yaml...
Then i get a response matching yaml...

I am not happiest with my wording of the second step, but that is the general gist. What do you think?

This sounds good. I'll see what I can do :raised_hands:

I've updated the test in 0502c15, as per what I the previous message
I think I'm ready for review :smile:
cc @zachmandeville

thank you for this, @BobyMCbobs

Woohoo!
Thanks for the merge :raised_hands:


Translation of README.md Chinese

I translate it when I'm learning this

Hi @zigerZZZ, thank you very much.

I have made a note on the English README that your translation is available.

@zigerZZZ  Please let me know if my note is incorrect. Is it correct to say "Chinese translation" or is it a specific form of Chinese language?

@sgrvinod Sure, that's the correct form.Or you can explain it with "中文翻译", as Chinese characters are more likely to catch their eyes who speaking Chinese

Thanks, I added it.


Add ZSA Voyager Layout

Pretty self-explanatory PR. Just add a layout for ZSA Voyager

Messed up the commit naming :( will fix and force push at home, heads up


Can I set (mock) the response body?

Hi!
I'm currently using "supertest" to test some express routes in my Node.js application. (I'm also using sinon and chai.)
I was wondering if the is a way to mock the response so that I don't have to rely on a real HTTP connection to my routes and to any other external services that they might call.
Something like this:
`
const request = require('supertest');
const server = require('./server');
const expectedJson = { 'message': 'Hi!' };
  request(server)
      .post('/some/route')
      .expect(200)
      .**magicFunctionThatSetsTheResponseBody(expectedJson)**
      .end(function(err, res){
         expect(res.body).to.equal(expectedJson);
         if (err) {
          return done(err);
         }
         done();
      });

`
The idea behind this, is to verify if nothing has changed within the functionality (controller, etc) that is called within that given route.

@mayacr86  if you are using sinon then you should be able to mock the response on the server-side.
I think that falls outside the scope of supertest. supertest would make the request to a "server", other libs are able to mock the server to provide a test response.

Thanks for the quick response @mikelax !
Here's the "issue"...
I have use sinon.stub to mock Node's http module on other unit test, and that works... But when I try to do the same and combine it with "supertest", I keep getting the same error over and over... Here is a snippet of the code:
`
// Unit Testing related imports
const chai = require('chai');
const expect = chai.expect;
const sinon = require('sinon');
// Functionality related imports
const http = require('http');
const PassThrough = require('stream').PassThrough;
describe('My Service Spec', function () {
// Stub for the http module.
let stubHttpRequest;
beforeEach(function () {
stubHttpRequest = sinon.stub(http, 'request');
});
afterEach(function () {
http.request.restore();
});`

@mayacr86  have you tried yielding the stubbed request  [I have used the Unauthorized code below as an example]
     stubHttpRequest.yields({statusCode:401});

I am using the get method to a route that calls a methos that sets some JSON data in the response object.
var request = require('supertest');
var sinon     = require('sinon');
var spy=sinon.spy();
describe('simple test of about route with params',function(){
	var server;
	beforeEach(function () {
  		server = require('../server').server;
	});

it ('matches the response JSON when the about page is called',function(done){
	var getSpy=sinon.spy(server,'get');
	const expectedJson = {"data":{"username":"hellojv"}};

 	request(server)
    	.get('/about/jv')
    	.expect(200)
    	.end(function (err, response) {
	 sinon.assert.match(response.body, expectedJson);
	done();
	});
});
});

The sinon spy is passed the 'server' that encapsulates the server.js and which contains the express route and is invoked by 'supertest'. In the server.js, a call to a method populates the response object. Please check out the full example here


LinkedIn icon not showing up. Share links in posts are not showing up

Hi, all of my other social links are showing up except for linked in. Same with 'share with facebook', 'share with twitter' etc.

If the one you're seeing the issue in is this, it looks fine to me. Are you running any adblock or anything?


AWS CloudFormation service role policy size error

When trying to create AWS Policy for docker swarm, the response in console I get is:
An error occurred: Cannot exceed quota for PolicySize: 5120
Proposed changes
Shrink EC2 actions to ec2:* to reduce policy size.

@frenchben ptal

@jakubknejzlik Thank you for the suggestion.
You're more than welcome to apply the ec2:* to your policy, but we want to stay as explicit as we can on what permissions are required and thus can't merge this change.
If you would like to instead split the policy into chunks that can be created within AWS, it would be better IMHO

Please address @FrenchBen's comments in a new PR if you still wish to propose this change.


Create protocol to interface w/ remote members of the team re: kanban

Hmm, so I think there's a couple ways to approach this.
First and foremost, and regardless of how we decide to accomplish this, I
think it's important that we document how we do standups somewhere so it's
in writing. I know http://ipfs.io/ keeps track of their project/product
management systems in https://github.com/ipfs/pm. We tried a similar thing
with https://github.com/hackedu/pm, but ended up dropping the system they
were using.
One idea is to do our standups in IRC every morning, but I'm worried that
at the speed we're trying to accomplish things (and how much changes day to
day), we'd run into some serious communication breakdowns.
What if we continue to do standups every morning in person, but document
that process in hackedu/meta so people outside of the organization know
what's up?
Thoughts?
/cc @jonleung @MaxWofford @gemmabusoni
On Tue, Aug 18, 2015 at 12:37 PM, David Fontenot<EMAIL_ADDRESS>wrote:

Assigned #100 https://github.com/hackedu/meta/issues/100 to @zachlatta
https://github.com/zachlatta.
—
Reply to this email directly or view it on GitHub
https://github.com/hackedu/meta/issues/100#event-385746733.

--
Zach Latta
hackEDU |<EMAIL_ADDRESS>

@zachlatta, I think that is a good start!

@zachlatta I'm down with that.

Closing this since it seems we've standardized on using Google Hangouts at 9AM every morning.


Android Open and Save String to/from Google Drive SDK

I have read allot about Google drive integration and I want to save STRING into Google drive and also to retrieve, I have used this demo please anyone provide me demo for my requirement
i have read that, but how can i retrieve the data that i saved?
that only saved the data to drive, is there any code to get that particular data

You can use the AppData folder for storing that type of data. Consider this sample for an example of creating AppData.


feat(FSADT1-1349): Create client for staff Step 1 - Individuals

Description
Adds the front-end side of "Step 1 - Individuals" on create client for staff.
Also fixes the use of undefined/null values on our dropdown component.
Fixes FSADT1-1349
Type of change

[ ] 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 not work as expected)
[ ] This change requires a documentation update
[ ] Documentation update

How Has This Been Tested?

[ ] New unit tests
[ ] New integrated tests
[ ] New component tests
[ ] New end-to-end tests
[ ] New user flow tests
[ ] No new tests are required
[ ] Manual tests (description below)
[ ] Updated existing tests

Checklist

[x] I have read the CONTRIBUTING doc
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
[x] Any dependent changes have already been accepted and merged

Further comments

Thanks for the PR!
Deployments, as required, will be available below:
Any successful deployments (not always required) will be available here
Please create PRs in draft mode.  Mark as ready to enable:

Analysis Workflow

After merge, new images are deployed in:

Merge Workflow

Thanks for the PR!
Deployments, as required, will be available below:
Any successful deployments (not always required) will be available here
Please create PRs in draft mode.  Mark as ready to enable:

Analysis Workflow

After merge, new images are deployed in:

Merge Workflow

The DTO structure was updated according to the new definitions.
And the ID type calculation (to the value expected by the Legacy application) was undone, since the backend is now expecting independent values for ID type and province.


drop support for hub command

not 100% about merging this, but issues like #163 and #149 show that integrating with hub complicates things and can produce unexpected results or confusion. Such as creating a repo on github, when you meant to create on on gitlab

Given that this is a Gitlab command, it makes sense to have two different commands for different contexts. This might also open the door for more git plugin style use?

I did go ahead with https://github.com/zaquestion/lab/pull/168 which should help prevent confusion. I'm fairly in agreement that git's plugin style would be nice, but I don't have a good way to support both atm and I strongly not wanting to do the extra typing when first looking for a tool like this.
In any case, I'm going to defer bringing these changes in for the time being, as personally I still get a lot of utility out of the passthrough and I think #168 strikes on a big part of the issue.


MM-41812 Fix instances of CreatePost being leaked

*sigh*
Ticket Link
https://mattermost.atlassian.net/browse/MM-41812
Closes https://github.com/mattermost/mattermost-server/issues/19549
Release Note
Fixed a memory leak caused by the post textbox

Cherry pick is scheduled.


Lack of integrity verification of downloaded external dependencies

Hey,
My name is Maciej Mensfeld and I run a research security project called WhiteSource Diffend.io.
I've noticed, that this library downloads some external resources and uses them. While it's a totally common pattern, what is lacking here is integrity verification.
You could verify the integrity of the downloaded file before using it by comparing the file hash to a hardcoded, expected file hash.
This is essentially what package managers do to verify the integrity of downloaded packages.
Doing this would prevent attack scenarios in which raen is manipulated.
Have a great day :)
ref https://my.diffend.io/npm/naen-cli/0.0.1#d2h-954720-533

Hey thanks!
Yeah we had placed too much trust in Github here.  So while the file is produced from a tagged signed commit, we don't check that github sent the same file.
He have tried using IPFS in the past since the file is content addressed and has that built in, however, we found that a public gateway can still send corrupted bytes (though very rarely).
We copied this library originally from here: https://github.com/rustwasm/wasm-pack/blob/master/npm/binary.js
And it seems they are doing it too.


Casst/plugin ready fix

Background
On first installation of the plugin to TeamCity any builds that were started, finished or interrupted before the plugin was ready to be used (i.e. BuildListener registered and opentelemetry object instantiated) triggered the following error in TeamCity server.log:
WARN - Error in event handler: Error calling method BuildServerListener.buildStarted for listener com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener: java.lang.NullPointerException (enable debug to see stacktrace)
Results
A method was added pluginReady() that will be checked on buildStarted(), buildFinished() and buildInterrupted()
that will only continue those triggered methods if the plugin has been instantiated and is ready to take data.
Before
In TeamCity server.log on plugin installation:
WARN - Error in event handler: Error calling method BuildServerListener.buildStarted for listener com.octopus.teamcity.opentelemetry.server.TeamCityBuildListener: java.lang.NullPointerException (enable debug to see stacktrace)
After
No error in TeamCity server.log experienced on plugin installation or update.
How to review this PR
Please confirm sanity of code changes
Pre-requisites

[x] I have considered informing or consulting the right people
[x] I have considered appropriate testing for my change.

 Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.1 out of 2 committers have signed the CLA.:white_check_mark: casstait:x: Cassandra TaitCassandra Tait seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.You have signed the CLA already but the status is still pending? Let us recheck it.

I can add an additional message in the buildStarted method if the plugin is not ready abd have Loggers.SERVER.error("Build start triggered for and plugin not ready. This build will not be traced")
What do you think?

I can add an additional message in the buildStarted method if the plugin is not ready and have Loggers.SERVER.error("Build start triggered for and plugin not ready. This build will not be traced")
What do you think?

Not too fussed about missed ones at the start.  I'd suggest it's an info though, not an error. (dont forget a full stop at the end!)
I'm more thinking about the error at the end - it feels like it is relatively expected in certain circumstances (ie, plugin just starting), so it shouldn't be an error.
I'd recommend thinking about it in terms of "Error means waking someone up at night to fix it". Things like this are pretty "recoverable".


Fix typo (remove duplicate word 'should')

[x] I have read freeCodeCamp's contribution guidelines.
[x] My pull request has a descriptive title (not a vague title like Update index.md)
[x] My pull request targets the master branch of freeCodeCamp.
[x] None of my changes are plagiarized from another source without proper attribution.
[x] All the files I changed are in the same world language (for example: only English changes, or only Chinese changes, etc.)
[x] My changes do not use shortened URLs or affiliate links.

Congrats @nikolasbroman on your first pull request (PR)! 🎉
Thank you for your contribution to the page! 👍
We're happy to accept these changes, and look forward to future contributions. 📝


Can I Use Keyed Hashing Mode With Using Same Key?

.
.
.
hashN-2 = blake3(counterN-2, key)
hashN-1 = blake3(counterN-1, key)
hashN = blake3(counterN, key)
lets say attacker knows this hash results and also counters. Can attacker say anything about what will be hashN+1 result without bruteforcing 256 bit key? (yes i am trying to make cipher. because i am curious. but i didn't ask cipher. it is only about blake3 keyed hashing mode for properly using it)

Can attacker say anything about what will be hashN+1 result without bruteforcing 256 bit key?

No, they can't. If they could, that would represent a serious flaw in BLAKE3, as it would with any other keyed cryptographic hash function. Specifically, keyed BLAKE3 is intended to behave like a "pseudorandom function".
For what it's worth, it might be slightly more natural to use BLAKE3's extended output to generate a pseudorandom stream, rather than incrementing a counter on the input side. That's what I'm doing e.g. here: https://github.com/oconnor663/bessie.


Update free-programming-playgrounds.md to add some online compiler links

What does this PR do?
Add resource(s) | Improve repo
For resources
Description
Added some more online compiler links for Java, C#, and R programming language
Why is this valuable (or not)?
Online compilers are necessary to evaluate a code or a program instantly, so I thought of adding it, which will help other students.
How do we know it's really free?
The changes that I have made (the links which I have added) are completely free for usage
For book lists, is it a book? For course lists, is it a course? etc.
Checklist:

[x] Read our contributing guidelines.
[x] Search for duplicates.
[x] Include author(s) and platform where appropriate.
[x] Put lists in alphabetical order, correct spacing.
[x] Add needed indications (PDF, access notes, under construction).
[x] Used an informative name for this pull request.

Follow-up

Check the status of GitHub Actions and resolve any reported warnings!

Thanks, and welcome to free-programming-books!

@eshellman please add hacktoberfest accepted label, this is my first time contributing, so it will be a great help

@eshellman please add "hacktoberfest accepted" label so that it can be counted as my first time participating in Hacktoberfest! Thank you!

@eshellman

@eshellman please add "hacktoberfest accepted" label so that it can be counted as my first time participating in Hacktoberfest! Thank you!

@eshellman this one

@eshellman please add "hacktoberfest accepted" label so that it can be counted as my first time participating in Hacktoberfest! Awaiting your response! Thank you!

@eshellman please add "hacktoberfest accepted" label so that it can be counted as my first time participating in Hacktoberfest! Awaiting your response! Thank you!

@eshellman please consider this

@eshellman please add hacktoberfest accepted label to this PR so that it can get eligibility for hacktoberfest


Undocumented IP addresses required for South UK

When running migrator.exe import /importfile:'import.json' against South UK the following IP addresses are reported as required but are not doucumented on this page:
<IP_ADDRESS>

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

ID: 4fa0ebd3-8437-8508-5a8d-462186fcce80
Version Independent ID: efe892fe-387e-0a61-fe7d-33d2ac99dfa9
Content: Import migrate process from on-premises to Azure DevOps - Azure DevOps
Content Source: docs/migrate/migration-import.md
Product: devops
Technology: devops-migrate
GitHub Login: @KathrynEE
Microsoft Alias: kaelli

@BlackstarSolar  - Thank you for the correction. I will update the article.


Unknown Keras loss function logcosh

Issue Description
Please describe our issue:

Expected behavior: logcosh loss function is supported
Actual behavior: Error message: org.deeplearning4j.nn.modelimport.keras.exceptions.UnsupportedKerasConfigurationException: Unknown Keras loss function logcosh. Please file an issue at http://github.com/deeplearning4j/deeplearning4j/issues.

Version Information
Please indicate relevant versions, including, if relevant:

Deeplearning4j version - 1.0.0-beta5
Platform information (OS, etc) - Windows 10
CUDA version, if used - N/A
NVIDIA driver version, if in use N/A

Additional Information
Where applicable, please also provide:

Full log or exception stack trace (ideally in a Gist: gist.github.com)
pom.xml file or similar (also in a Gist)

Contributing
If you'd like to help us fix the issue by contributing some code, but would
like guidance or help in doing so, please mention it!

Need to add this it appears: https://www.tensorflow.org/api_docs/python/tf/keras/losses/log_cosh


Get User ID of the Skype Channel

I am using skype channel and need to know how to get the logged in user name and pass it to the bot. During debugging I figured out that I can only pull the display name and not the userID or the email ID. Can anyone assist on this.
Thanks
Aniruddha

@anirudhaditya
I don't think skype share such info as it affects user privacy.
v3 version of the API provides the unique user ID per bot.
you can access those by using
session.message.user.id
session.message.address.user.name

More about message.address JSON Please check this post

This is not currently a feature of bot framework.  You may however, be able to access this information via the skype API or the graph api depending on your use case

Can we get the Skype user profile info?

How can we get user information (User id) with Skype API?


Support for multiple datasets

Description
This PR adds support for multiple datasets in DictionaryDataModule and FastDictionaryLoader. I have also extended a bit the tests and the docstrings and added a couple of working doctest examples.
Status

[x] Ready to go

if i understand it correctly now if you pass a single dataset the behaviour is the same as before, while if you pass a list of dataloaders it will return a dictionary of dictionaries ['dataset0': X, 'dataset1': Y], is this right?

Exactly right!

for me you can merge it!

Great! Merging then.


Documents for Highly Available Topology

What documentation would you like to be added:
Add some documents about how to deploy the HA（highly available） Karmada.
Why do you think this document is needed:
I believe that Karmada is capable of high availability because I have heard that some users have already done so, but so far, there are no relevant docs in Karmada that describe how to deploy a high availability control plane.
Many users would need this document, such as :

https://github.com/karmada-io/karmada/discussions/3773
TBD

Where do you think the document should be placed:

[ ] Highly Available Topology Overview

this document could be placed at https://github.com/karmada-io/website/tree/main/docs/installation/ha-installation.md
reference: Kuberentes Options for Highly Available Topology

[ ] Creating Highly Available Karmada with karmadactl

this document could be placed at https://github.com/karmada-io/website/tree/main/docs/installation/ha-installation-with-cli.md
reference: Creating Highly Available Clusters with kubeadm

[ ] Creating Highly Available Karmada with helm chart

this document could be placed at https://github.com/karmada-io/website/tree/main/docs/installation/ha-installation-with-helm-chart.md

[ ] Creating Highly Available Karmada with karmada-operator

this document could be placed at https://github.com/karmada-io/website/tree/main/docs/installation/ha-installation-with-operator.md

[ ] Does Karmada support high availability(HA) deployments?

add an item to FAQ at https://github.com/karmada-io/website/blob/main/docs/faq/faq.md

/assign

I have successfully created a karmada cluster and a member cluster on my local machine using kind. I also registered the member cluster to the karmada. But when I try to deploy karmada with HA using kubectl karmada init --karmada-apiserver-replicas 3 --etcd-replicas 3 command. It give me the following error.
error: for data security,when etcd storage mode is hostPath,etcd-replicas can only be 1
Is there a solution to create multiple etcd storages with hostPath storage mode?

Hi @Affan-7
Thanks for your choose the Karmada.
I'm not an expert in this area. However, based on the error message, my suggestion is that you could try to resolve the problem by using a storageclass or an external etcd.

https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/

Using a single replica of etcd in a production environment is dangerous.
If you plan to use Karmada in a production environment, please let us know at the earliest opportunity.
If you have any more questions, feel free to create an Issue or join our official Slack channel at any time.


Using USB Serial Facade

I am using the SL4a 5x04 and Python 2.7.9 onn my Nexus 7 (android 5.1) and am trying to access the USB with the example script given here: https://github.com/kuri65536/sl4a/blob/master/android/USBHostSerialFacade/samplescripts/testpl2303.py
However, android.usbserialGetDeviceList() gives an error saying that the RPC is not recognized. The exact error is:
Result(id=1, result=None, error=u'com.googlecode.android_scripting.rpc.RpcError: Unknown RPC.')
I used the latest releases for both SL4A and Python available on GitHub.
Any hints?

lease check below in the document (USBHostSerialFacade.md):

USB Serial devices were not handled by Android kernel.

BTW, What device you use?
This information is helpful for me.
Some tablets grab the usb-devices in kernel level.
In this situation, you will not be able to treat devices with usb serial facade
and you can use serial device in pySerial module via /dev/ttyUSB0
(I'm really not sure because I have not met such devices grabbed by kernel.)

Thank you for your reply. I am afraid I don't understand what "USB serial devices were not handled by Android kernel" means. I am under the impression that with the USBHostSerialFacade we should be able to use the USB port on android devices just as the Java android usb module, No?
I have tried it on my ASUS Google Nexus 2012 running Android 5.1 as well as my Samsung Galaxy Core II running Android 4.4 but it gives the same error. To me it seems that the distribution apk doesn't include the RPC function for USB handling. But again, I don't have much of a background here.

To me it seems that the distribution apk doesn't include the RPC function for USB handling

oh, no I forget to enable USB Facade in FacadeConfiguration.java.
I made binary soon, just wait for minutes.
(but I trying fix another issue today, please wait.)

Thanks. Please let me know and I will be happy to test it again.

I fixed to enable facade and binary is now updated: [https://github.com/kuri65536/sl4a/commit/58dea62a878d1270ebca6b5b18d8d97aeb9b3eb7]
My question is what the serial device did you want to use, so
I'm interested in what serial device you will use.
Especially, Running arduino with this facade is the very useful information for sl4a or python users.
BTW, handled by kernel is shown in app as above (devices in linux tab)::
https://lh4.ggpht.com/XtDQ1Uo8zMfBLl9LLhh8HLBhObZVbLRvdLMwRz7G_dQIo2yLisBfIR0AUdYiBuJML3Q=h900
The devices in linux tab will not be handled from Android USB API.

Thanks. I have just tried to connect my USB flash disk and at least it recognized it now but of course read or write doesn't work. I am planning to try it with my PIC18F4550's USB. Let's see what happens. I will let you know about it. If you know more about this, I will be grateful if you share it with me.

Oh and can you please put the help file on using the usb facade here?

Sorry, there is no document for USB facade... I make it later (please don't expect comes soon).
I had work with PIC24F USB-CDC in native Android app.
I forget the successed or failed work with facade. but trials were remained in code.

I tried it with PIC18F4550. It does pick up the device (device id, vendor id) but actual connection and transfers do not seem to work. Any ideas?
Thanks in advance.

Let me know about your device status.

What your device USB Class? This facade may be work with USB-CDC only.
How do you connect your device to PC? Terminal emulater (like teraterm, putty)?
Out device connect to PC, this appear to COM? in Windows. then we see data in putty.

In this (Android USB Host) system, USB Implementation must be written in java code.
your device is not configured to USB-CDC, new facade was needed.

close this is old post.


[dlr] fix dlr publish location

Description
Brief description of what this PR is about

If this change is a backward incompatible change, why must this change be made?
Interesting edge cases to note here

Codecov Report

Merging #923 (91b7bbc) into master (6bad05e) will increase coverage by 0.02%.
The diff coverage is n/a.

:exclamation: Current head 91b7bbc differs from pull request most recent head 4b19304. Consider uploading reports for the commit 4b19304 to get more accurate results

@@             Coverage Diff              @@
##             master     #923      +/-   ##
============================================
+ Coverage     70.28%   70.30%   +0.02%
- Complexity     5079     5084       +5
============================================
  Files           501      501
  Lines         22431    22431
  Branches       2334     2334
============================================
+ Hits          15766    15771       +5
- Misses         5419     5427       +8
+ Partials       1246     1233      -13

Impacted Files
Coverage Δ
Complexity Δ

...gine/src/main/java/ai/djl/dlr/engine/DlrModel.java
53.12% <0.00%> (-3.13%)
4.00% <0.00%> (ø%)

api/src/main/java/ai/djl/util/Platform.java
43.47% <0.00%> (-2.18%)
8.00% <0.00%> (ø%)

api/src/main/java/ai/djl/repository/Artifact.java
91.37% <0.00%> (-1.73%)
37.00% <0.00%> (-1.00%)

...g/src/main/java/ai/djl/serving/util/Connector.java
55.40% <0.00%> (-1.36%)
21.00% <0.00%> (ø%)

...ngine/src/main/java/ai/djl/mxnet/jna/LibUtils.java
42.23% <0.00%> (-1.25%)
15.00% <0.00%> (ø%)

...ne/src/main/java/ai/djl/mxnet/jna/StringArray.java
92.85% <0.00%> (ø)
9.00% <0.00%> (-1.00%)

...e/src/main/java/ai/djl/mxnet/jna/PointerArray.java
94.11% <0.00%> (ø)
8.00% <0.00%> (-1.00%)

...rc/main/java/ai/djl/paddlepaddle/jni/LibUtils.java
51.14% <0.00%> (ø)
14.00% <0.00%> (ø%)

api/src/main/java/ai/djl/inference/Predictor.java
90.38% <0.00%> (+2.88%)
24.00% <0.00%> (+1.00%)

api/src/main/java/ai/djl/training/Trainer.java
94.89% <0.00%> (+3.06%)
34.00% <0.00%> (+1.00%)

... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bad05e...4b19304. Read the comment docs.


Prisma Client : Create Explict wrapper.js

An solution to -:https://github.com/prisma/prisma/issues/19611

Hi @xonx4l and thanks for your desire to contribute, we appreciate it! However, we have to close this PR since it doesn't actually solve or implement anything.
Do I understand it correctly that you just wanted to share your perspective on what kind of API you'd like to see? If that's the case, it's best to leave a comment with your proposal in the issue. Of course opening a PR right away is also fine — but then that PR needs to contain at least a proof of concept implementation.
Also, perhaps a better issue to leave the feedback in might be https://github.com/prisma/prisma/issues/15397, since the linked issue (https://github.com/prisma/prisma/issues/19611) is about a proposal for explicit wrapper for JSON values, which your examples don't seem to be about.


md-checkbox inside reactive form checked by default in reactive form

Bug, feature request, or proposal:
bug
What is the expected behavior?
In the form module only one checkbox is checked by default in a reactive form..
What is the current behavior?
Both checkboxes are checked by default.
What are the steps to reproduce?
http://plnkr.co/edit/XPXMnw?p=preview
What is the use-case or motivation for changing an existing behavior?
I need to control checkboxes
Which versions of Angular, Material, OS, browsers are affected?
see plnkr
Is there anything else we should know?

That's because of the way you're setting up the associated FormControl. The first argument is the initial value, which in your case is "tcp" and "udp". Both of them get cast to true, hence the checked checkbox. If you want to initialize one checked and one not checked, you have to use this:
private protocolArray: FormArray = new FormArray([
  new FormControl(true),
  new FormControl()
]);

Ah gotcha. I wasnt aware that FormArrays only return booleans. I had to tweak my code a good bit but I worked around it. Thanks

I came across this issue while looking for a way to bind a checkbox to a property of a FormControl's value. In case anyone else ends up here the same way, I'm going to take a stab at clearing up issue @JDillon522 was having.
The problem wasn't that FormArray returns Booleans (it doesn't), it's that md-checkbox treats it's bound FromControl value as truthy. @JDillon522's sample defined the form array this way:
private protocolArray: FormArray = new FormArray([
    new FormControl('tcp'),
    new FormControl('udp')
]);

Note that 'tcp' and 'udp' are non-empty strings and therefore truthy. As such, md-checkbox would display both values as checked.  While my problem was a little different, the truthy evaluation of the FormControl's value property tripped me up as well.
That said, you can bind md-checkbox to something besides the control's value using md-checkbox's @Input value attribute described here: https://material.angular.io/components/component/checkbox. If you go this route, you will also need to bind a callback to @Output change and manually set the sub-property's new value. And remember to call your FormControl's setValue() method to ensure that the form updates propagate normally.


Bullet collision objects for rigid bodies with mesh hierarchies are incorrect.

🐛 Bug
The current implementation creates rigid objects from loaded meshes by directly indexing into asset memory. Meshes are shifted to align object center of mass with origin (as required by Bullet physics) and then consumed directly to create collision objects. This works for single mesh objects (such as our test dataset). However, if the loaded object has a hierarchy of meshes including transforms (such as the Wayfair dataset), we should build a compound collision object encapsulating this hierarchy.
Note: rendering and kinematics work, this bug only concerns the underlying physical collision mesh used for simulation.
Command
./build/viewer --enable-physics --debug-bullet -- "NONE"
To Reproduce
Steps to reproduce the behavior:

 Pull the bullet-debug-draw branch (to get Bullet debug visualization) #298
Edit: on master now.
Add objects (such as wayfair objects) with a mesh transformation hierarchy to the default.phys_scene_config.json file.
Modify viewer.cpp to set objects to KINEMATIC upon creation:

void Viewer::addObject(std::string configFile) {
...
    physicsManager_->setObjectMotionType(physObjectID, physics::MotionType::KINEMATIC);
...
}

./build/viewer --enable-physics --debug-bullet -- "NONE"
Add objects with 'o' and remove with 'u'

Results show bullet collision meshes (white wireframes) do not match rendered objects:

Expected behavior

Collision object meshes should align with rendered object meshes.
Additional context

Relevant redesign and solution is in progress.
System Info
Please copy and paste the output from the
environment collection script
(or fill out the checklist below manually).
You can run the script with:
# For security purposes, please check the contents of collect_env.py before running it.
python habitat_sim/utils/collect_env.py

OS (e.g., Linux):
How you installed PyTorch (conda, pip, source):
Build command you used (if compiling from source):
Python version:
GPU models and configuration:
CUDA version:
PIP/conda dependencies packages versions
Any other relevant information:

Meshes are shifted to align object center of mass with origin (as required by Bullet physics)

This is kinda sad (I couldn't believe it at first, had to double-check). All posts about this I found are from ~2011, one saying that Bullet 3 should have this fixed, others suggesting using btCompoundShape (and the overhead coming from it) to work around this. Did really no improvement happen to this since then? :D

Meshes are shifted to align object center of mass with origin (as required by Bullet physics)

This is kinda sad (I couldn't believe it at first, had to double-check). All posts about this I found are from ~2011, one saying that Bullet 3 should have this fixed, others suggesting using btCompoundShape (and the overhead coming from it) to work around this. Did really no improvement happen to this since then? :D

My understanding is that the collision object itself (the compound shape or single collision mesh) is expected to have origin == COM. Partly this is due to the relationship between linear and angular terms as the COM will be the point around which a rigid body rotates, so it should also be the center of rotation for the object's local frame. It is possible that Bullet could have provided a method for setting the COM and handling the coordinate frame transforms internally, but instead that construction falls on the user (maybe this could be considered an opportunity to take advantage of pre-processing speedups?). For us, this means either shifting the mesh or applying transforms in the collision object hierarchy. There will be some overhead (compared to baking the meshes into a single collision shape), but it should not be much compared to the already costly mesh/mesh collision.


Trigger Handler Updates

Added Owned by Namespace field to Trigger Handler so HEDA and other packages can isolate their Trigger Handlers for the purpose of default management. Also added the Owned by Namespace field to the TDTM_Token class.
Implemented hashCode() and equals() methods for the TDTM_Token custom type of the TDTM_Global_API class. The enables the use of sets helping to optimize the default configuration comparison algorithm. Added a handlerId field to the Token class to track when a handler could be updated instead of inserted into the database.
The setTdtmConfig() method of the TDTM_Global_API class was also updated with a new signature to accepts a List of tokens as well as a String to represent the "Namespace" of fields
Created TDTM_Manager class. This class will be instantiated when updating or installing new default TDTM triggers. Upon instantiation, the TDTM_Manager will contain the existing configuration and you can pass in a Set of tokens to compare against the current configuration to update/insert/delete. Also added a simple method on TDTM_Manager which accepts a map of Trigger Handlers and returns a TDTM_Token set.
Finally, the install script was modified to target upgrades to 1.36 so the Owned by Namespace field can be utilized moving forward for HEDA managed trigger handlers.
All these updates were important because if a developer of a package wanted to write their own Trigger Handlers to utilizeTDTM they would also have to write the code to retrieve then update and save them.
TL;DR; - The way HEDA internally manages Trigger Handlers has been modified. These modifications have been exposed via the TDTM_Global_API class so others using TDTM can utilize the same management for their own Trigger Handlers.
Critical Changes
Changes

Enhanced the TDTM framework to prevent unintentional changes to Trigger Handlers used by other, non-HEDA packages. Use the new Owned by Namespace field on the Trigger Handler custom object to identify the package that manages a specific handler. Refer to the TDTM_Global_API documentation for more information: http://developer.salesforce.org/HEDAP/ApexDocumentation/TDTM_Global_API.html

Issues Closed

Testing Instructions:

Deploy Metadata to new Org
Run updated code inside Install Script lines [54-56] (https://github.com/SalesforceFoundation/HEDAP/blob/feature/dr-trigger-handler-manage/src/classes/STG_InstallScript.cls#L54-L56)
Verify trigger handlers were added
Make an arbitrary change to handler definitions in TDTM_DefaultConfig. You could even delete some entries for testing.
Run code from lines [76-78] (https://github.com/SalesforceFoundation/HEDAP/blob/feature/dr-trigger-handler-manage/src/classes/STG_InstallScript.cls#L76-L78)
Verify the updates you made before were persisted to the existing handlers in the DB.

Other exploratory testing should be done using the techniques above to verify functionality.

@lianeyee take a peek at my TLDR in the opening comment. It sums up what is happening fairly well.
I am not sure of the best place to document/communicate these changes or how they should be placed in the release notes.
@jacebryan

@davidjray @jacebryan I've not looked into TDTM much before today. Much to my (pleasant) surprise, it appears we have this doc about it:
http://developer.salesforce.org/HEDAP/ApexDocumentation/TDTM_Global_API.html
Anyone know how this gets updated and by whom?

Carlos says the docs are auto-generated from ApexDocs annotations in the code. If annotations can handle describing the changes, then for release notes, ca we say something like:
Enhanced the TDTM framework to prevent unintentional changes to Trigger Handlers used by other, non-HEDA packages. Use the new Owned by Namespace field on the Trigger Handler custom object to identify the package that manages a specific handler. Refer to the TDTM_Global_API documentation for more information: http://developer.salesforce.org/HEDAP/ApexDocumentation/TDTM_Global_API.html

@ceiroa the build failures were due to the "setTdtmConfig()" method I removed from the TDTM_Config class. The test class that was failing relied on the tokenCache to disable the trigger. The old setTdtmConfig() method overwrote the cache with the incoming token list. We shouldn't do this anymore, of course, because we now accept configurations from multiple namespaces. So basically, I de-coupled the setting of the config from the TDTM_Config class.
This is ready to re-review.

Looks great, @davidjray. I think the new conceptual separation between TDTM_Config, TDTM_Manager, and TDTM_Global_API is very clean now. I just have one question (in the comments), and we should be good to go after that.

When namespace is null the TDTM_Manager will search for Trigger handlers where Namespace is null, basically null becomes the namespace. I am taking advantage of this to configure the HEDA Trigger Handlers on when Orgs are upgraded to include these changes.


feat: Biome v1.9.0

Summary

[ ] Blog post draft for the 1.9 release
[x] Merge website PRs labeled "Merge on release".

We should mention the company that funded 1k USD for the development of GraphQL

@Conaclos since you merged the other PRs here instead (it was preferable to not do that), remember to merge this PR using "merge and commit" strategy instead, otherwise we lose the commits coming from the other PRs

since you merged the other PRs here instead (it was preferable to not do that), remember to merge this PR using "merge and commit" strategy instead, otherwise we lose the commits coming from the other PRs

I will rebase and merge without squashing.


Remove multipath-tools package since it causes scheduling latency due as its RTPRIO is 99

TL;DR: Ubuntu by default has a real-time service with a rtpriority of 99 (maximum possible) that can cause scheduling latency of around ~150us. We should remove the multipath-tools package to remove that service, as it seems not necessary.
cc: @carlossvg @LanderU
The Problem
As a part of my benchmarking and testing for some blog posts I'm writing, I've noticed that the maximum latency of the Raspberry Pi 4 when running cyclictest while running stress-ng -c 4 is around 250us. This is actually quite high, as if you have a process that supposed to happen at 1kHz, you lost 25% of your compute time. I then figured I will trace the system via ftrace to see what's causing the problem:
# stress-ng -c 4 # (In a separate terminal)
# trace-cmd start -p wakeup_rt cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 -D 60s
  plugin 'wakeup_rt'
# /dev/cpu_dma_latency set to 0us
policy: fifo: loadavg: 3.48 1.36 0.69 8/173 12907

T: 0 (12904) P:80 I:200 C: 149982 Min:     15 Act:   29 Avg:   24 Max:     313
T: 1 (12905) P:80 I:200 C: 149801 Min:     16 Act:   26 Avg:   54 Max:     434
T: 2 (12906) P:80 I:200 C: 149613 Min:     16 Act:   68 Avg:   37 Max:     280
T: 3 (12907) P:80 I:200 C: 149425 Min:     18 Act:   92 Avg:   68 Max:     266
# trace-cmd stop
# trace-cmd show
# tracer: wakeup_rt
#
# wakeup_rt latency trace v1.1.5 on 5.4.140-rt64
# --------------------------------------------------------------------
# latency: 400 us, #345/345, CPU#1 | (M:preempt_rt VP:0, KP:0, SP:0 HP:0 #P:4)
#    -----------------
#    | task: cyclictest-12905 (uid:0 nice:0 policy:1 rt_prio:80)
#    -----------------
#
#                    _------=> CPU#
#                   / _-----=> irqs-off
#                  | / _----=> need-resched
#                  || / _---=> hardirq/softirq
#                  ||| / _--=> preempt-depth
#                  ||||| / _--=> preempt-lazy-depth
#                  |||||| / _-=> migrate-disable
#                  ||||||| /     delay
# cmd     pid      |||||||| time   |  caller
#     \   /        ||||||||   \    |  /
stress-n-12898     1dN.h4..    1us :    12898:120:R   + [001]   12905: 19:R cyclictest
[omitted for brevity]
stress-n-12898     1d...3..   57us : cpu_have_feature <-__switch_to
multipat-1456      1d...3..   58us : finish_task_switch <-__schedule
[omitted for brevity]
multipat-1456      1d...3..  382us : update_curr_rt <-put_prev_task_rt
multipat-1456      1d...3..  383us : update_rt_rq_load_avg <-put_prev_task_rt
multipat-1456      1d...3..  384us : pick_next_task_stop <-__schedule
multipat-1456      1d...3..  384us : pick_next_task_dl <-__schedule
multipat-1456      1d...3..  385us : pick_next_task_rt <-__schedule
multipat-1456      1d...3..  389us : __schedule <-schedule
multipat-1456      1d...3..  389us :     1456:  0:S ==> [001]   12905: 19:R cyclictest

Note that with ftrace enabled, the entire system is slower, which explains why I'm seeing a latency of ~434us as measured by cyclictest and 400us as measured by wakeup_rt. However, the above log shows that we spent most of the time in multipat-1456, which we can find out is:
$ ps -e -o pid,class,rtprio,comm | grep 1456
   1456 RR      99 multipathd

This is a process scheduled with SCHED_RR with a priority of 99. No wonder it can get ahead of cyclictest when being scheduled, which I set to a priority of 80 (as this is common for RT applications). A look at the Ubuntu docs, it seems like multipathd is something that is involved with multi-path storage. While I'm not familiar with what it is, I don't think it is relavent to the RT base image for robotics (or even other RT applications).
Bonus picture: here's some kernelshark visualization of multipathd (blue) jumping in front of cyclictest (green). The two black lines before the blue bar (multipathd) are Marker A and Marker B respectively, which has a delta of 0.000197482s (197us). This is expected as cyclictest is constructed to wake up every 200us. This periodicity is kept very well (as indicted by the regular appearance of the green lines), until the appearance of multipathd, which steals the CPU by 139us.

Testing the solution
So I disabled multipathd and verified that it is dead:
# systemctl mask multipathd
# systemctl stop multipathd
# ps aux | grep multipath
ubuntu     13061  0.0  0.0   7692   616 pts/2    S+   17:10   0:00 grep --color=auto multipath

Then I started cyclictest with stress-ng again
# stress-ng -c 4 # (In a separate terminal)
# cyclictest --mlockall --smp --priority --interval=200 --distance=0 -D 15m

policy: fifo: loadavg: 6.79 6.17 4.06 5/166 13260

T: 0 (13103) P:80 I:200 C:4499997 Min:     13 Act:   18 Avg:   20 Max:     132
T: 1 (13104) P:80 I:200 C:4499803 Min:     13 Act:   16 Avg:   19 Max:     115
T: 2 (13105) P:80 I:200 C:4499606 Min:     13 Act:   21 Avg:   20 Max:     136
T: 3 (13106) P:80 I:200 C:4499435 Min:     13 Act:   16 Avg:   19 Max:     138

This is significantly better result than the 250us nominal that I saw with multipathd running.
After a bit of investigation, multipathd is coming from the Ubuntu base image. I'm not sure why it is installed on the Raspberry Pi image, as it is definitely not on my desktop system. We can remove this package on image building to prevent this service from being installed.
root@rpi4-image-build:/# apt list --installed | grep multi

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

multipath-tools/now 0.8.3-1ubuntu2 arm64 [installed,local]

Sorry I haven't gotten around to the command line builder yet. I got a branch, but as you can see I keep getting distracted by other stuff.

I agree to remove multipath-tools. I saw it on htop and I was thinking of removing it too.
What I would do is check if there are other real-time processes in the system we could remove. For everything, we remove we should add a note in the instructions and the release notes so people are aware what are the differences with the Ubuntu base image. Ideally, we should be able to get as good results as with Raspbian (see https://www.osadl.org/Latency-plot-of-system-in-rack-4-slot.qa-latencyplot-r4s1.0.html?shadow=1).
Btw, the kernelshark picture is great, this is the kind of analysis I expected to do using ros2tracing and compass. Once your blogpost is ready please share it in the RTWG :)

@shuhaowu @carlossvg, yeah, we can sudo systemctl disable multipathd in our build process.

I created the PR to remove it.

@carlossvg I looked at the results you linked and it is not obvious to me if they stressed the system at the same time as running cyclictest. My personal testing seem to replicate their latency plot when the system is idling (left plot):

Under stress, with a RT kernel, the situation is a bit worse. The above right plot was actually generated before I removed multipathd. With multipathd removed, the distribution has not been changed, although the maximum has been significantly reduced:

I have data with various kind of benchmarking here: https://github.com/shuhaowu/rt-demo/blob/master/data/cyclictest-rpi4/plot.ipynb. Maybe it's worthwhile documenting that stuff somewhere as well.

Oh! I forgot to mention in the last post, but there doesn't seem to be any additional processes running with the RT priority on the system that shouldn't be:
ubuntu@ubuntu:~$ ps -e -o pid,class,rtprio,comm | grep RR
ubuntu@ubuntu:~$ ps -e -o pid,class,rtprio,comm | grep FF
     10 FF       1 rcu_preempt
     11 FF       1 rcub/0
     12 FF       1 rcuc/0
     13 FF      99 posixcputmr/0
     14 FF      99 migration/0
     18 FF      99 migration/1
     19 FF      99 posixcputmr/1
     20 FF       1 rcuc/1
     25 FF      99 migration/2
     26 FF      99 posixcputmr/2
     27 FF       1 rcuc/2
     32 FF      99 migration/3
     33 FF      99 posixcputmr/3
     34 FF       1 rcuc/3
     42 FF      50 irq/11-fe00b880
    101 FF      99 watchdogd
    109 FF      50 irq/43-PCIe PME
    110 FF      50 irq/43-aerdrv
    111 FF      49 irq/43-s-aerdrv
    114 FF      50 irq/44-xhci_hcd
    121 FF      50 irq/29-VCHIQ do
    149 FF      50 irq/22-DMA IRQ
    150 FF      50 irq/24-DMA IRQ
    151 FF      50 irq/15-fe204000
    153 FF      50 irq/17-fe804000
    154 FF      50 irq/25-DMA IRQ
    155 FF      50 irq/30-mmc1
    157 FF      50 irq/30-mmc0
    158 FF      49 irq/30-s-mmc0
    218 FF      50 irq/18-fe980000
    277 FF      50 irq/18-fe980000
    278 FF      50 irq/18-dwc2_hso
   1490 FF      50 irq/36-eth0
   1491 FF      50 irq/37-eth0
   1686 FF      50 irq/16-ttyS0

One thing we might want to do for an application is probably tune the priority of the IRQ handlers. 50 looks like a sane default, but if an application is running at priority 80, then there's a chance that the IRQ handler never runs. For example, an RT application that needs USB probably need to ensure the priority of IRQ handler for it is properly tuned. This is application dependent so it probably belongs more in an advice section as opposed to be done here by default.

@carlossvg I looked at the results you linked and it is not obvious to me if they stressed the system at the same time as running cyclictest. My personal testing seem to replicate their latency plot when the system is idling (left plot):

@shuhaowu This is a good question. According to this https://www.osadl.org/Latency-plots.latency-plots.0.html, the latency plot would correspond to the green bar between 8:00 and 12:00. If this is the case the experiment includes some simulated load.

I have data with various kind of benchmarking here: https://github.com/shuhaowu/rt-demo/blob/master/data/cyclictest-rpi4/plot.ipynb. Maybe it's worthwhile documenting that stuff somewhere as well.

I took a look at the demo you are working on and I'm really interested in two of the topics you cover:

Stressing approaches comparison: I would like to select a default stressing approach we can reuse as a default one for the experiments. Stressing the CPUs is a good start but it's very limited. I like the hackbench and the OSADL simulated workload approaches. On the other hand, stress-ng is very complete and we should be able to simulate every scenario with it.
Data passing demos: I'm interested in documenting all the different options and provide examples for ROS 2 applications

One thing we might want to do for an application is probably tune the priority of the IRQ handlers. 50 looks like a sane default, but if an application is running at priority 80, then there's a chance that the IRQ handler never runs. For example, an RT application that needs USB probably need to ensure the priority of IRQ handler for it is properly tuned. This is application dependent so it probably belongs more in an advice section as opposed to be done here by default.

Yep. In the case of ROS 2 applications using the network stack, this is something important to take into account. For example, in that case, I would keep the application priority above 50 and the network IRQs priorities above the application thread priorities. Here is an interesting talk related to that topic. https://www.youtube.com/watch?v=-pehAzaP1eg There is a discussion at the end related to running the system IRQ thread priorities. Something we could do is to add a script to tune the network (and other) IRQ thread priorities and affinities. Then we can refer to this script in the documentation.

I just finished writing my blog post (part 2/4) about this: https://shuhaowu.com/blog/2022/02-linux-rt-appdev-part2.html. I'll share it in the RTWG later as well. It should contain nothing this group doesn't already know about, tho. That said, it's designed for a separate audience (robotics people interested in RT, and perhaps other RT people like audio/low-latency game emulation). There's also a part 1(https://shuhaowu.com/blog/2022/01-linux-rt-appdev-part1.html), which is even more generic.

I took a look at the demo you are working on and I'm really interested in two of the topics you cover:

Stressing approaches comparison: I would like to select a default stressing approach we can reuse as a default one for the experiments. Stressing the CPUs is a good start but it's very limited. I like the hackbench and the OSADL simulated workload approaches. On the other hand, stress-ng is very complete and we should be able to simulate every scenario with it.

Maybe there's interest in defining a "standard" set of benchmarks to run by running cyclictest along with stress-ng (and maybe others). I'm not sure if this is possible, as every application is different. That said, providing a starting point could be nice, as I don't think anywhere else has a standard set defined. The tests I did in that repo is based on various talks and articles i've seen.

Data passing demos: I'm interested in documenting all the different options and provide examples for ROS 2 applications

This is an area that I feel is under-explored, especially in robotics-related RT: how to pass data. I've seen a few conference talks about this (see this one as a starting point), but they're mostly focused on audio programming. I'm currently playing with their techniques in my rt-demo repo, and I'll likely finish it over the next few weeks. I'm hoping I'll summarize all of my knowledge in part 4 of the blog series above.

Something we could do is to add a script to tune the network (and other) IRQ thread priorities and affinities.

Definitely something we can do. Another thing I would love to do, is be able to figure out exactly which irq handlers you need to tune given a particular application. I'm not an expert in tracing this stuff yet, so perhaps once I learn it I'll write i as a part 5 of my series :smile: .

This was done.


Remove dependency on packaging library

From these two comments I understand a PR removing the dependency on packaging would be welcome:

https://github.com/pipxproject/pipx/pull/361#issuecomment-583654680
https://github.com/pipxproject/pipx/issues/339#issuecomment-583532860

@clbarnes had already done a lot of work here, I only put together this short PR to make a small step forward.
I am enthusiastic pipx user and I maintain a few packages in the Alpine Linux distribution. I would like to see pipx packaged for Alpine Linux. As a first step I've been taking a look at the dependencies and a couple of PRs came to mind. This seemed to be a straightforward place to start.

Local testing
Clone the "pipx" source and start a container with access to that directory:
git clone git@github.com:pipxproject/pipx.git &&
cd pipx &&
podman run -ti -v .:/srv:z fedora:31

Inside the container run the tests:
cd /srv
dnf install --assumeyes python3-pip git
python3 -m pip install --upgrade pip
python3 -m pip install git+https://github.com/cs01/nox.git@5ea70723e9e6 nox
python3 -m pip install -e .
python3 src/pipx --version
pipx --version
rm -rf .nox  # to clear other runs (different Python versions or distributions)
nox -l
nox -s tests-3.7

To get output like:
✂
========================== 69 passed, 1 skipped in 225.59s (0:03:45) =====================================
nox > Session tests-3.7 was successful.
✂
nox > Session cover was successful.
nox > Ran multiple sessions:
nox > * tests-3.7: success
nox > * cover: success

CI is picking up on a formatting mistake I've made, I'll have that fixed ASAP.

That's the CI passing; I didn't realise at first the project uses black. I am a fan too :-)

Thank you! Looks good to me. And thanks for helping get it packaged for Alpine Linux.

Nice cleanup!


[Bug]: import statement outside of module (get-info-on-pdf)

Installation Method
Docker
The Problem
8b16ed84d0a631ba1ff3a6dc689c4d7925ed2d0c introduced an import statement in the HTML for get-info-on-pdf
Version of Stirling-PDF
0.31.0
Last Working Version of Stirling-PDF
0.30.0
Page Where the Problem Occurred
http://localhost/get-info-on-pdf
Docker Configuration
No response
Relevant Log Output
Uncaught SyntaxError: Cannot use import statement outside a module (at get-info-on-pdf:940:17)

Additional Information
No response
Browsers Affected
No response
No Duplicate of the Issue

[X] I have verified that there are no existing issues raised related to my problem.

I cant reproduce this issue

https://stirlingpdf.io/show-javascript does not have this issue since js/fetch-utils.js isn't imported as a module, it is loaded using a regular script tag:
              <script src="/js/fetch-utils.js"></script>
              <script>
                document.querySelector('#pdfInfoForm').addEventListener('submit', function(event){
                  event.preventDefault();

                  // Fetch the formData
                  const formData = new FormData(event.target);

                  fetchWithCsrf('api/v1/misc/show-javascript', {
                    method: 'POST',
                    body: formData
                  }).then(response => response.text())
                  .then(data => {
                    // ...
                  })
                  .catch(error => {
                    console.error('Error:', error);
                  });
                });
              </script>

https://stirlingpdf.io/get-info-on-pdf is affected because js/fetch-utils.js is imported inside a script tag that is missing type="module":
              <script>

                import { fetchWithCsrf } from 'js/fetch-utils.js';

                document.getElementById("pdfInfoForm").addEventListener("submit", function(event) {
                  event.preventDefault();

                  const formData = new FormData(event.target);

                  fetchWithCsrf('api/v1/security/get-info-on-pdf', {
                    method: 'POST',
                    body: formData
                  }).then(response => response.json()).then(data => {
                    displayJsonData(data);
                    setDownloadLink(data);
                    document.getElementById("downloadJson").style.display = "block";
                  }).catch(error => console.error('Error:', error));
                });

                // ...
              </script>

Importing js/fetch-utils.js as a module wouldn't work since it doesn't export the fetchWithCsrf() method.

Sorry yes was looking at wrong thing, working on many tickets at once 😞


fix: let s3-url be compatible

https://github.com/aurora-opensource/streetscape.gl/issues/547

 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.SlahserZ seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.You have signed the CLA already but the status is still pending? Let us recheck it.


proposal: cmd/go: generate allow arguments to span multiple lines

Go does encourage use of generated code by using go generate and the respective //go:generate build comments.
Working with implementing optional interfaces that a go object might chose to provide to extend a base interface type at runtime, I've come across the need to write long build comments like https://github.com/andig/evcc/blob/master/internal/vehicle/vehicle.go#L28
For readability it would be great if these could be supplied as multi-line comment. This could look like this:
//go:generate go run ../../cmd/tools/decorate.go
//-p vehicle -f decorateVehicle -b api.Vehicle -o vehicle_decorators
//-t "api.ChargeState,Status,func() (api.ChargeStatus, error)"
//-t "api.VehicleRange,Range,func() (int64, error)"

I would like to propose to allow multi-line comments, given that the comment marker // is not followed by a space ( ).

The backslash version https://github.com/golang/go/issues/46050#issuecomment-835299092 is better than the non-backslash version, but even then we will run into issues with continued strings and such. It will just lead to more and more weird corner cases. Given that the usual thing is "go:generate go run x.go" why not put all that complexity into x.go where you have a real parser? Or even "go:generate bash x.bash". It doesn't seem like we need multiline input as a feature here when it can be moved to a better place.

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

Given that the usual thing is "go:generate go run x.go" why not put all that complexity into x.go where you have a real parser? Or even "go:generate bash x.bash".

To play the devil's advocate for a moment: interpreters like bash might not be installed, and go run isn't particularly fast for large binaries as it needs to link every time. Though, arguably, that's something we could improve in go run itself.
Largely, I agree that the complexity should be put elsewhere, if it doesn't comfortably fit into a single line.

Thank you for taking the time to comment so extensively.
Performance was never my concern, more readability. I appreciate the comments above, especially the use if the GOFILE and GOPACKAGE variables that I wasn‘t aware of. It seems that moving parsing into the action generator shouldn‘t be too complicated. I‘d prefer this approach over writing yet another stub that calls the actual generator.
Based on the options lined out I‘d be happy to withdraw this proposal.

For reference: https://golang.org/pkg/cmd/go/internal/generate/

No change in consensus, so declined.
— rsc for the proposal review group


Integration Testing

We are trying to simulate the drag and drop event, but when one item is selected(mouse on hold to it) the visibility is set to hidden. We were able to simulate drag and drop because of this reason. Is there a walk around to it. FYI, we are using
driver.execute_script(js + "$('#one').simulateDragDrop({ dropTarget: '#bin'});")

I get a similar problem with cypress, I can't drag and drop the element (using mousedown, mousemove and mouseup).

Did anyone find solution for it ?

I was able to get around it with cypress by initiating the mousedown event and the clicking somewhere else on the screen. That will trick the mouse to move there which will cause a drag, and then trigger a mouse down event again ending the transition.
`
cy.get('[data-testid="draghandle3"]')
.trigger("mousedown")
cy.getTestElement('somewhereElseOnThePage').click();`
Ideal, nope, but it got the job done and correctly tested the list I was trying to test.
NOTE: To prevent unexpected side effects, click on something without an event listener, I grabbed some text on the page above my list and clicked on that. Nothing happened except my item got moved to the top of the list.


Symbolic Questions "Correct" or "Incorrect" status not reloaded.

Whilst old answers are saved, the "Correct" or "Incorrect" text is not - neither is the feedback, though this is less essential . . .

Actually, it turns out this depends if you're navigating directly to the page, or if you're coming from another page. If it's a direct navigation (or hard-refresh of the current page) the "Correct"/"Incorrect" message is properly loaded.
Any other way of reaching the page and it is not.

Fixed.


Molecular weight calc

Issue Id you have worked upon -
#153
Briefly explain your program logic -
Using Regular expression, the molecules are parsed and the molecule weight is calculated.
Considered brackets and crystallization(i.e. chemical formula having '.')
Screenshots(Attach 2 screenshots of your own input and output) -

By raising this PR I affirm that -

[x] My code follows the guidelines of this project.

[x] I have performed a self-review of my own code.

[x] I have commented my code.

[x] My code gives the correct output.

[x] I affirm that I strictly follow contributing guidelines and code of conduct.

Congratulations 🎉 @hiren2599 on your contribution.
Thanks for adding value to this repository. 😊
Let's celebrate this fest 😃 by providing more developers 👨💻👩💻 an opportunity to contribute. Help us make this repository reach far and more by sharing this to your friends and colleagues.
Your efforts can make difference.

Hey 👋, may you also encourage us by clicking the star icon on the repository main page. ⭐

I apologize for the delay in my response, and I appreciate your understanding.


getMailTemplate() method returns Systems default translation template instead of orders language translation

Description
Users receive english email instead of german email when you change order status in admin panel.
This happens when german is a second language and the default language of the shop is english.
Users Order is also marked as a german order (see attached screen)
Possible Solution
use orders language ID to determine mail template translation instead of context language ID.
Additional context
in vendor/shopware/core/Checkout/Order/Api/OrderActionController.php mehtod getMailTemplate()
running:
dd($context, $order->getLanguageId()); returns:

2fbb5fe2e29a4d70aa5854ce7ce3e20b is english language ID  and used to get the template
ad1b980561b2463b9bb2242adefe33f9 is the german language ID which is linked to the order but not used to retrieve the mail template here.

Can't be reproduced in trunk