Debate: Decoupling response and serialization

There are a number of things we could implement much easier if serialization and response would be decoupled, such that BaseResource.serialize returns a dict, not a JSONAPIResponse.

We add a handle_response(data: Any, *args, **kwargs) -> JSONAPIResponse method on BaseResource, which gets called from BaseResource.handle_request with the result of the handler (BaseResource.get, BaseResource.post etc) and returns a JSONAPIResponse object for data.
It also means we're changing the signature of handlers to Union[dict, JSONAPIResponse].

We add a to_response(data: Any, *args, **kwargs) -> JSONAPIResponse method that gets called explicitly from the handler and wraps data in a JSONAPIResponse.
The signature of BaseResource.serialize would change to serialize(.....) -> dict.

Both methods would be accessible to subclasses to override and add custom implementation if needed. Main difference is the implicit behavior of 1).
Also, we would be able to separate arguments needed for serialization and arguments needed to generate responses, in the end possibly allowing more access to the underlying libraries via args and kwargs.
I personally like 2), but resources would probably need to do something like await self.to_response(self.serialize(data)).

If option 2) is the way to go, I propose another helper BaseResource.serialize_to_response which does the serialization and returns the response (pretty much what BaseResource.serialize does now).

I think I agree with option 2.
However, instead of adding another method of to_repsonse, the response in the view can be
        async def post(self, *args, **kwargs) -> Response:
            return await JSONAPIResponse(content=self.serialize(...))

That separates the concern of serializing the data and forming a response.
The user can either subclass JSONAPIResponse or return something else entirely.
It also simplifies the changes internally as well

@khornberg Thank you very much for your input!
Although I tend to agree with you, and started the #9 PR to experiment with this, I would still like to have to_response, in case subclasses would like to override it and do custom things, such as adding more headers maybe.
People will still be able to do what you described, and I will too probably if I would ever need to subclass JSONAPIResponse.
My main concern when it comes to simplicity for this stuff, is that serialize will likely get more complicated as we continue to improve support for jsonapi features (pagination, meta and jsonapi objects for example). There's a chance that response related logic will also grow.
That being said, I'm not 100% happy with #9 because of the kwargs handling in serialize_to_response, so I will definitely revisit that soon and might get rid of serialize_to_response entirely for the sake of simplicity.

I agree with this point as well. I think this method offers a good balance between customizability and ease of use. Like @vladmunteanu said, the option to directly return a JSONAPIResponse in the resource still remains available, whereas to_response offers both a quick way to wrap any dict as a response, and it also allows for overriding in subclasses

I've updated the #9 PR and removed the serialize_to_response method.
Going to look into examples and documentation next.

Fixed in 1.0.0


Change detection to be case-insensitive

The detect file checks for the existence of init.r to determine whether to apply the buildpack.
The check for the existence of the init.r file should be case-insensitive.
Raised from https://github.com/virtualstaticvoid/heroku-buildpack-r/issues/39#issuecomment-168534497

Wasted an hour detecting the problem with buildpack configuration then found this issue locked.


Autosizing not working properly in multiselect

As you will see in your demo as well, when enough items are added for a new line, it takes quite a bit of time for the enclosing element to resize. No clue what is causing it.

I'm very sorry for ignoring this issue for so long. My Github "watch" setting was somehow deactivated without my realizing it and I didn't receive notifications for this project. I'm really behind on issues now unfortunately but I'll try to take a look at this one by the weekend.

when enough items are added for a new line, it takes quite a bit of time for the enclosing element to resize

It looks like AutoSizer is actually just not being notified of the "resize" until you either scroll or mouse over the input row. If you do that right away, it resizes right away. If you don't move your mouse- it never resizes.
Unfortunately, DOM elements don't dispatch resize events and so AutoSizer is built on top of sdecima/javascript-detect-element-resize (which has some limitations). I'm not initially sure of the best way to address this to be honest.

I encountered this issue and needed a way to solve it. What I ended up doing was to trigger an recalculation of the component's height.
    handleChange(...args) {
        this.props.onChange(...args);
        this.forceUpdateSelectorHeight();
    }

    /**
     * Force update selector height
     *
     * This fixes issues experienced in Chrome/Mac where the
     * React-Virtualized-Select's internal AutoSize Component does not update
     * until the element received a focus/blur event.
     */
    forceUpdateSelectorHeight() {
        // eslint-disable-next-line react/no-find-dom-node
        const element = ReactDom.findDOMNode(this.node);
        if (element) {
            // eslint-disable-next-line no-undef
            element.style.height = window.getComputedStyle(element).height;
            setTimeout(() => {
                element.style.height = 'auto';
            }, 0);
        }
    }

    render() {
        return (
            <VirtualizedSelect
                ref={(node) => { this.node = node; }}
                onChange={this.handleChange}
...

I wonder if something like this might be a good alternative?
https://www.npmjs.com/package/react-resize-aware


Fix broken "remove contributor" modal caused by knockout async problems [OSF-6109]

Purpose
To remove a bug where asynchronous knockout.js data-bind processing is too slow and results in a broken modal being displayed.

Changes
This is a problem that has been encountered before, and I used the same solution that's employed across OSF: using the helper method osfHelpers.applyBindings() instead of the default ko.applyBindings(). As per the usual implementation, I updated the modal content divs to also include the "scripted" class with which the osfHelpers applyBindings method interacts. These changes, both in theory and in all observations thus far, have fixed the bug, and have updated the code to be consistent with the rest of OSF.

Side effects
Though not specified in a ticket, I found the same issue in the code for the Add Contributors modal, and updated it to use the osfHelpers implementation of applyBindings, instead of the default knockout implementation. This should prevent similar bugs with the Add Contributors modal.

Screenshots
Normal Behavior

Behavior caused by OSF-6109

Notes
Because of the specific nature of this bug, the probability of any action reproducing it is extremely low (since it depends on a particular and rare sequences of asynchronous events). I'd only been able to replicate it three times, after ~800 tries. After locally implementing this fix, I gave it another ~1000 tries, and could not reproduce it. This, in addition to how the fix was implemented (in that it's worked in the past and widely used), leads me to believe that this fix works. However, I technically have no way of confirming this 100%. But I truly believe I have tested for it to the best of my ability.
Ticket
[OSF-6109]

Could you merge with develop then invoke karma? There's a post-merge js test that's failing that may, somehow, be related to what you're doing.

Other than the failing test, looks good. 🐧 Pass done.

LGTM. Dropping this in RTM ⚓


Support v2 Taxonomy Routes

Support default taxonomy collections using v2 endpoints.
Many of these changes are adapted from work by @jasonphillips in his fork of the project -- full props to him for pioneering how to adapt the existing infrastructure to the new endpoints.
Tasks before PR can land:

[x] Update library to support querying /taxonomies endpoint for available taxonomies
[x] Update library to support querying /taxonomies/:taxonomy endpoint for taxonomy definition object
[x] Update library to support querying /categories 1st-party taxonomy term collection
[x] Update library to support querying /categories/:id individual category terms
[x] Verify library supports querying for individual category by slug
[x] Update library to support querying /tags 1st-party taxonomy term collection
[x] Update library to support querying /tags/:slug individual category terms
[x] Verify library supports querying for individual tag by slug

Related work, to be executed separately:

Update library to support querying for the terms associated with a post (skate to where the puck will be: depends on WP-API/WP-API#2063)
Verify (via integration test) that library works with hierarchical and non-hierarchical custom taxonomies

Querying by slug is "supported" inasmuch as 23ae892 adds a demonstration of how to do this by combining ?search and iterating over the responses. That's the best we can currently do due to limitations around what the API provides for taxonomies.


Case Converter/Shifter

Description of the new feature / enhancement
By using this feature we should able to select a text and convert its case like UPPERCASE or lowercase or SnakeCase. It shoud have a shortcut to activate and shift the case of the selected text in any application.
Scenario when this would be used?
It can be used when writing a document in notepad, wordpad, office, docs, word.
It can be used while searching in explorer/powertoys run/web search.
It can be used while naming/renaming file/folder in any app.
Supporting information
No response

/dup #907

Description of the new feature / enhancement
By using this feature we should able to select a text and convert its case like UPPERCASE or lowercase or SnakeCase. It shoud have a shortcut to activate and shift the case of the selected text in any application.
Scenario when this would be used?
It can be used when writing a document in notepad, wordpad, office, docs, word. It can be used while searching in explorer/powertoys run/web search. It can be used while naming/renaming file/folder in any app.
Supporting information
No response

I've made a program called QuixCase that allows you easily switch between Sentence Case, UPPERCASE, lowercase, Capital Each Word, and even tOGGLE cASE.


std::stof and std::stol Rounding Issues

When running the following code:
import "println" from "console"

int ten1 = 10;
float tenf = 10.1;
double tend = 10.1;
long tenl = 10.1;

println(ten1 + 10);
println(tenf + 10);
println(tend + 10);
println(tenl + 10);

The following output occurs:
20
20.100000000000001
10
20.100000000000001

A 1 exists at the end. I've isolated where it exactly occurs, but I haven't been able to find out why.

Below C++ code about this situation.
#include <iostream>
#include <iomanip>

using namespace std;

int main() {

	int ten = 10;
	float tenf = 10.1;
	double tend = 10.1;
	long tenl = 10.1;

	cout << ten + 10 << endl;
	cout << setprecision (15) << fixed << tenf + 10 << endl;
	cout << setprecision (15) << fixed << tend + 10 << endl;
	cout << setprecision (15) << fixed << tenl + 10 << endl;

	return 0;
}

Output:
20
20.100000381469727
20.100000000000001
20

This bug is not about your implementation, I think the only thing to do is format the printed values.

@boranyldrm Interesting, thanks for looking into that. I found this comment on stackoverflow also. So I think instead of defaulting all the numbers to have a precision of 15 decimal places, there should be smarter math to ensure we don't go beyond a float's bounds. I think implementing a NTL number might be beneficial for a bigint or something like that.


Update the gulp-uglify config

Hello! The uglify file has remove the quote of property，so throw an error in IE 7. I suggest to modify the uglify options to keep_quoted_props:true. Thanks

Codecov Report

Merging #215 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #215   +/-   ##
=====================================
  Coverage     100%   100%
=====================================
  Files           1      1
  Lines         391    391
=====================================
  Hits          391    391

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 4fa5cdb...426add2. Read the comment docs.


update_user_data not working

Taint aws_s3_bucket_object doesn't trigger cloud-config  user data update, because the source  file name doesn't change.

fixed by https://github.com/xuwang/aws-terraform/commit/4ee995a6888144c17c4f2d8ab64be978f20bd22a.


Kotlin DSL script compilation avoidance ignores internal visibility changes on types

While it does take internal functions into account it doesn't handle internal types.
Expected Behavior
Making an internal type public should trigger recompilation.
Current Behavior
Making an internal type public does not trigger recompilation as the underlying type goes from java public to java public, only some Kotlin metadata changes.
Steps to Reproduce
MCVE available at https://github.com/eskatos/issue-reproducers/tree/main/gradle/issue-24352

git clone https://github.com/eskatos/issue-reproducers.git
cd issue-reproducers/gradle/issue-24352
./gradlew reproduce -i
build.gradle.kts script gets compiled
edit buildSrc/src/main/kotlin/Some.kt commenting the internal visibility modifier
./gradlew reproduce -i
build.gradle.kts is not recompiled as shown in the info log:
Skipping Kotlin DSL script compilation (Project/TopLevel/stage2) as it is up-to-date.

Thank you for providing a valid reproducer.
The issue is in the backlog of the relevant team and is prioritized by them.

Instead of doing our own Kotlin compilation avoidance we should reuse what the Kotlin team has done since then https://youtrack.jetbrains.com/issue/KT-57565

1.9.20-Beta includes the internal prototype, see the KT issue linked above for details

This is blocked on https://youtrack.jetbrains.com/issue/KT-62555 which is now scheduled for Kotlin 2.1.0-Beta1, that's mid-September with the GA late November.


Fix Dropped operator Errors

This PR picks off two dropped errors, one in operator/manager and the other in operator/runner.

 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.You have signed the CLA already but the status is still pending? Let us recheck it.


Schema Change

Major files we modified:

sql_table.h
sql_table.cpp

Major files modified:

sql_table_test.cpp
storage_test_util.cpp

Ready for final code drop 🚀

Closing for now. We will come back to this later. Too many jenkins triggers.


ffmpeg update

WIP
Patch size ~10Mb:
Writing objects: 100% (26/26), 10.17 MiB | 1.86 MiB/s, done.

Update ffmpeg: 2.6.3
Add support for H264 encoding via OpenH264 v1.4.0 library. Library license agreement forbids redistribution of OpenH264 binaries, so you need to download them separatelly if you want to use it: https://github.com/cisco/openh264/releases

OpenH264 not found messages:
http://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/3176/steps/test_videoio/logs/stdio
http://pullrequest.opencv.org/buildbot/builders/precommit_windows32/builds/192/steps/test_videoio/logs/stdio
OpenH264 found (but write is failed, because frames up to 4096x2304 is supported, test uses 4096x4096):
http://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/3180/steps/test_videoio/logs/stdio
http://pullrequest.opencv.org/buildbot/builders/precommit_windows32/builds/193/steps/test_videoio/logs/stdio


MkDocs extra css/js not working

Example: http://tvheadend.readthedocs.org/en/stable/
extra_css: https://github.com/ProfYaffle/tvheadend-documentation/blob/master/mkdocs.yml#L12
This works locally but not on RTD. There may be some bad logic here: https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/doc_builder/backends/mkdocs.py#L55-L77
MkDocs will automatically add all CSS in the docs dir if the user doesn't set a extra_css/js config option. However, RTD manually adds these settings so to MkDocs it appears that the user is explicitly including some and not others.
However, even including it manually as above it isn't working. It is likely that the solution to this is a large refactor of how MkDocs integration works and us making it easier in MkDocs itself for you to do that.

Turns out manually specifying the extra_css does work - I think we just didn't wait long enough. However, the automatic discovery of css and js is still broken by RTD pre-processing.

However, the automatic discovery of css and js is still broken by RTD pre-processing.

We only extend these settings, we don't override them. We don't discover them automatically or at least we don't do that anymore.
Let me know if this is still a problem to reopen this issue.


(TypeScript plugin): Add references path of tsconfig to config

Closes https://github.com/webpro-nl/knip/issues/814

No notes! Great, thanks a lot @taro-28.

:rocket: This pull request is included in v5.34.2. See Release 5.34.2 for release notes.
Using Knip in a commercial project? Please consider becoming a sponsor.


RDKitJS RuntimeError: Aborted(OOM)  abortOnCannotGrowMemory

I am building an interactive page with RDKitJS and React - dynamically plot molecules. When I switch really fast, the app would crash. I think it is related to how .wam file is built.

@PigUnderRoof This is almost certainly not a bug.
Whenever you instantiate a JSMol, you must explicitly call delete() when you are done with it, e.g.:
const mol = RDKitModule.get_mol('CCC');
[...]
mol.delete();

The garbage collector will not automatically free the memory associated to object created by the WASM library, so you will keep leaking memory until you get an OOM.
I am closing this - feel free to reopen if needed.

My bad, thank you very much!


Strange situation with "this" context on the client

Hey, Jagi!
I found a very strange behaviour of the Astronomy class on the client.
I have "User" class, and it have method "getAvatar".
i have "Post" class,and it have relaion with user called "author".
So, on the client,  in template helpers i call:
 avatar:function(){            return this.author().getAvatar(); }
In chrome everything works fine, but in yandex browser (sometimes), or IE (always) i took:

cannot read property getAvatar of undefined

In console:
in Chrome i have author object in '_references' of 'this' context,
in Yandex i have author object, but its fields is undefined (but sometimes it have, and all work fine!).
Can you explain me what im doing wrong?:)
Or...it s not my fault?
P.S. Thank you for a realy good package!

If it works in Chrome and not in Yandex then it means that it's a problem with Yandex browser. I haven't been testing it in that browser. There is probably lack of some feature in JS but I can't tell what as I'm not supporting this browser.

Hello! I tried to check out a few more times , got the details.
When I load the page in chrome for the first time , I get the same problem as in Yandex . In any browser . I tried and Vivaldi . Same. Now it seems to me that the problem is not in the browser . I use the first version of Astronomy

Are you sure that this.author() is a function and it returns object? Have you published authors?

Yes, it is declared in relations block of Post class like in example of documentation
http://jagi.github.io/meteor-astronomy/v1#relations
relations:{
author: {
type: 'one',
class: 'User',
local: 'userId',
foreign: '_id'
}
}
For now i still not delete autopublish package.  Cause it still under dev.
So, this is a not a reason, i suppose.
The interesting thing of this problem - all will work fine if i will load page in a second time.

So the problem is probably publication. Remove the autopublish package and create publication that returns all necessary data.

Ohh...ok:)
Very strange.
I think, i need migrate to Astronomy 2.  Jagi, are you planing to create a relation-package for Astronomy 2, or i can create relations-logic for my own?:)
Thank you so much!

It's better to create relations logic by yourself. I had the relations package for v2 in plans but I don't know how it will go as things change very fast in JS world and with GraphQL things will change too. So probably there gonna be some changes in the future in how Astronomy works. We will see, time will show.

Ok.
Thank you and good luck!)


Does it support tmux 3.2?

I am having problems using these configuration with tmux 3.2. I have been using them on previous versions with no problem. After upgrading to 3.2, now none of the functionalities work. Tmux starts on default configurations and I get no error or warnings. I am running on Mac OS 11.3.1. Any help is appreciated.

I am also seeing the same issue. I have a basic green bar along the top and various fixes on other issues are not working.

@ashkan-leo I appear to have resolved this issue by removing all tmux config (backup the .tmux.conf.local file first):
~/.tmux.conf
~/.tmux (existing git directory)
~/.tmux.conf.local

Then I reinstalled this config:
cd
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .

I then overwrote the new .tmux.conf.local file with my previous .tmux.conf.local config.
It all appears to be working now.

I'll close the issue. I got it fixed by reinstalling! Thanks for the great work!


Logout functionality for stakeholder and student

Implemented Logout Functionality for Stakeholders and Students
Description:

Added logout functionality for both stakeholders and students.

@Harshdev098
Give me labels like gssoc extd, level3, hacktoberfest,etc

Don't make all PRs with same branch, its not a good practice it will include the previous changes you have done for another PR

@ygowthamr make another PR for fixing this issue


Add feedforward UI hints to command sequences (e.g. "Move note")

Please select if your request is either something new or an enhancement

[x] Enhancement of an existing Feature.
[ ] Request of a new feature.

Please select the area your request applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

[x] Workspace - VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
[x] Lookup - Dendron's Lookup Command
[ ] Views - Dendron Preview, Tree View, Side Panels in the UI
[ ] Schema - Dendron Schemas
[ ] Pod - Data import from / export to Dendron
[ ] Publish - External Site Publish
[ ] Markdown - Markdown features, such as syntax support and features

Is your feature request related to a problem? Please describe
When running multi step commands in Dendron I find myself wondering things like "Did I choose the correct command?", "Oh, this does not look right, I better cancel.".
E.g. when moving a note to another vault using Dendron: Move note the next step in the process shows the current name of the note without any prompt regarding what I should do.

Describe the solution you'd like
I would be of great help if feedforward hints were available for all choices in a command sequence.
E.g. for Dendron: Move note, messages like "Press enter to keep the current name" and "Choose destination vault next" should be displayed.
Some commands, such as "Create New" have descriptions below the command name. This would be a good place to put the feedforward hints.
Describe alternatives you've considered
N/A
Additional context
N/A

Thanks for the suggestion! Adding a small description to move note seems easy enough, so I'll go ahead and add one. Are there any other commands where you noticed missing descriptions? Let me know and I can add those too.

Hey, I have a PR coming to add some descriptions. What do you think?

I opted not to add all the description to the create new item because I think that would be more confusing if you type a new name. I think the title saying that you're picking which notes to move makes it clearer that you'll be moving these notes, what do you think?


React-tools deprecated

https://facebook.github.io/react/blog/2015/06/12/deprecating-jstransform-and-react-tools.html

?

Sorry, it relates to a fork that can lint jsx. Is there jsx support?