Adding on-the-fly derivers

I am attempting to add on-the-fly driver in the UI.

The coffescript:

btns.append $("", {type:"button"}).html(opts.localeStrings.yearOnly).bind "click", ->
opts.derivedAttributes[c+' Year'] = $.pivotUtilities.derivers.dateFormat(c, "%y")
valueList.toggle(0, refresh)

Notice, the refresh...  of course this does not work because the pivotUI refresh does not make the UI again.  Is there a preferred way to accomplish a complete refresh of the UI?  I figured, a refactor to make refresh render the UI components would be painful.  I wondered if this was handled somewhere... maybe by reloading the entire DIV.  Any ideas would be helpful.

Ok, I figured out a solution by adding a thisOrig to the pviotUI function.

    $.fn.pivotUI = (input, inputOpts, overwrite = false, locale="en") ->
        ....
        thisOrig = this

And then change the button callback to:

   btns.append $("", {type:"button"}).html(opts.localeStrings.yearOnly).bind "click", ->
       opts.derivedAttributesMacros[c+' Year'] = $.pivotUtilities.derivers.dateFormat(c, "%y")
       thisOrig.pivotUI(input,opts)

It seems to work, but I don't know if this is leaking memory in a bad way.

This is a neat idea! I'm not sure if this will leak but if it works for you, awesome :)

I am preparing a pull request, but before I do I wanted to make sure that the on-the-fly derivers could be persisted in the opts object for use without the UI.  Initially, I just added the functions to the opts.derivedAttributes, but the functions cannot be serialized to JSON and used later.  I changed my code it to make a new opts.derivedAttributesMacros that has a format:

 "derivedAttributesMacros": {
    "Create Date Day": {
      "format": "%m-%d-%y",
      "src": "Create Date"
    },
    "Create Date Month": {
      "format": "%m",
      "src": "Create Date"
    }
}

Then in the constructor, the code create the actually entries in derivedAttributes with the deriver functions.  I plan on making other on-the-fly derivers formats other than % based date ones.
I am not married to the name derivedAttributesMacros.  In fact, I don't like the length for the title, but I could not think of a better one.
Do you have a preference?  Also do you like the approach of creating another object or should we combine them into a single object with both functions and format specifiers?

Would these macros somehow pattern-match to attribute contents or would the mapping of macros to attributes be done in the initial function call? I.e. if I have two date fields T1 and T2, would I just be able to specify "activate these macros for dates" or would I have to specify "activate these macros for attributes T1 and T2" ?

I thing making them for each attribute (T1,T2) manually because I don't think the usual use case requires that every date be derived in all possible ways.  For example someone may want T1 (which could be a date/time) to be derived to just day (dropping time) and T2 to be by month, so rather than derive all the dates with with a single formula, I think it is better to be explicit about it, hence the "src" value.
So:

 "derivedAttributesMacros": {
    "T1 Day": {
      "format": "%m-%d-%y",
      "source": "T1"
    },
    "T2 Month": {
      "format": "%m",
      "source": "T2"
    }
}

In that case isn't it just easier to use derived attributes to begin with, without adding all this overhead to allow users to create them within the UI?

The problem is persisting the opts with the functions since they cannot be serialized in JSON.
I have a modification of http://nicolas.kruchten.com/pivottable/examples/onrefresh.html that allows the opt object to be named and shared among several users using the same page by storing it server side.  Its very cool because it behaves like a shared filter in a google spreadsheet where one user can update the view and all users using the same named opt see the changes.
I don't know of another way to securely share the opt between browsers using javascript.  By making a serializable derived attribute spec, it can be shared and persisted for use later.

Check out https://github.com/horner/pivottable/commit/71a6d7ecc57a413af5ba189c19e93989fc381859?diff=unified.
It has the on-the-fly derivers.  Let me know what you think.  I can prepare a pull request if you like.

This is very cool, but honestly I don't think that I would accept the PR into the core of this project, as the use-case seems fairly narrow for the added complexity, especially as compared to just adding the deriver right away in source.

ok, maybe I am not explaining the use case well enough.  Without this change a end-user with data containing date columns must know javascript to analyze the results using different groupings.
Worse yet, a programmer would be wasteful to build a deriver for every date for every combination. For example one person may want to see dates by month, while another user may want to see data compiled by quarter.  It seems wasteful to compute both and all the time.  This gets especially worse if you have more than one date too.
Also, I have been leaning towards fixing the natural sort speed issue by instead allowing an on-the-fly deriver that reverses dates from MM/DD/YYYY to YYYY/MM/DD and then leaving the simpler natural sort take over.  There could also be a on-the-fly deriver to change DD/MM/YYYY to YYYY/MM/DD which would solve the problem of i18n.
The idea would be to declare in the opt structure that a column is a date and then pivotUI/pivot could know to re-arrage the column to work with the natural sort.  The only drawback to this approach is that I think end-users prefer to see MM/YYYY over YYYY/MM in the final column headings.
Anyway, I hope that explains the idea better. If you have not checked it out, I can setup a jsFiddle with this code so you can see how intuitive it is to use.  Also, to see how important having these macros would be without having to resort to javascript.

Oh I definitely understood the idea, but it seems like even with your proposal, the javascript call would have to be hardcoded to the field names to allow for these macros to apply, right?

No, there would be no need to hardcode javascript to make use of the on-the-fly deriver macros. I made a quick video demo so you could see it in action: https://www.youtube.com/watch?v=JaltyHAH6gs
Take a look.  I think it is important to note that I don't think end-users would manipulate JSON, but that a JSON object should be sharable (without javascript) to allow the pivotUI to show derived columns.
Furthermore, I think the code that is in the "onrefresh" demo that removes "bulky default values" and "deletes functions" should be standardized into the pivotUI.  For example we should consider making the onRefresh function return a sanitized config, or at least provide a function in PivotUI to sanitize the object for storage and retrieval.
Let me know what you think.

OK, for the purposes of this conversation let's split up "users" into "Developers" and "End Users" . Developers write software which causes Javascript to be executed in the browsers of End Users, who interact with the resulting pivot table widget.
My understanding is that for an End User to gain access to the new UI elements you are proposing for a given attribute X, a Developer needs to hardcode the name of attribute X in the Javascript which invokes the pivot table. Please correct me if I'm wrong but I believe I asked about this earlier on in the thread and you responded in the affirmative (see the exchange about T1 and T2).
Let's compare this to the situation today, where a Developer could just as easily use the derivers mechanism to create derived attributes up front, which the End User would have immediate access to, without having to use the popup menu and clicking on buttons. This is how I as a Developer have created UIs for my End Users: when attribute X is a date, I suppress attribute X and add derived attributes for year, month, and month-and-day.
So as I see it, your proposal allows me as a Developer to pass along the decision of whether or not to create derived attributes to my End User, for attributes which I still have to pre-specify in source, much as if I was creating the derived attributes myself. Unfortunately, I don't really believe that this additional freedom is worth the additional complexity in this library.
If I've misunderstood, please do correct me though! Your YouTube video is not accessible to me unfortunately (I get a "this video is private" message)

Whoops.  Sorry about the video (https://www.youtube.com/watch?v=JaltyHAH6gs).  I just made it public.  Also, you can play with my changes here: http://horner.github.io/pivottable/examples/onrefresh.html
After playing, you might get a better idea.

OK, I've watched the video and I did in fact misunderstand.
My question now is: how does your code determine which attributes get the new buttons if not via configuration? Is there some type-detection where the pivot table now tests attributes values to find out if they are dates?

oh, yeah... right now I detect if there is a date in the column by looking at the first value in the column (see: https://github.com/horner/pivottable/blob/dev/pivot.coffee#L634) , but that could be explicit (via another option) too.

Oh yeah, and honestly there are really two issues here:

On-the-fly derivers for dates

Storing the config for later use.  As the comment in the example onrefresh (http://nicolas.kruchten.com/pivottable/examples/onrefresh.html) is really not possible: "Instead of showing the configuration in a textarea, one could store the configuration in a cookie or implement a 'save configuration' feature."  Especially if the config has script in it.

could could/should be resolved by specifying that a column is in a specific date format: MM/DD or DD/MM or other.  Or could be detected with a preference based on i18n knowledge.  This approach would also solve the natural sort problem too.  For example, if the column is known to be a date, the natural sort for that data could be biased to date, whereas the cheaper comparison could be used in all other cases.

needs to be fixed with the macro approach... tho as I stated earlier, I am not happy with calling them a macro. ;-(

If I am understanding this the derived attribute macro is to providing pivottablejs the intelligence to understand the data types and provide custom filters. If so then for situations like jupyter pivottable where I cannot/prefer not to code the filter types this would certainly empower the user to perform more powerful ad-hoc analytics.

Some extra thoughts on this issue, with a few years of perspective :)

Type hinting would really help! See #191
The idea of a generic JSON-serializable deriver system is quite a good one
The idea of onRefresh providing a JSON-serializable config is also a good one (it could do the stripping of renderers, aggregators, sorters etc internally)


#35 Fix NotRequest

Coverage remained the same at 88.838% when pulling 87bea336a07da7ec6e53e1d7b5db1e8e1d8ef3be on fix-not-request into 8af26c3805f2b047c9e5754846b271a4ccf10c2f on master.


In work section, table of contents link navigate improperly

In the work section, the automatically-generated table of contents links link to their proper locations, but without first expanding the work section (i.e. "Read More" button).

No longer an issue.


i don't want to register this component as global,is there a way to use it on demand?

you can use Vue Async component:
https://vuejs.org/guide/components/async.html


opentok.archives.all(options) does not support filtering by session ID

The OpenTok REST API now lets you filter by session ID when getting a list of archives: https://tokbox.com/developer/rest/#listing_archives. (You pass in a sessionId query parameter when calling the REST API method.) The opentok.archives.all(options) method in the OpenTok Ruby server SDK does not support this session ID filter.

OpenTokAdapter.client.archives.all.select { |a| a.session_id == call.session_id }
This can help temporarily.


id_token-only scenario with automatic silent renew

Similar issues have been raised here, still I need guidance finding the right solution.
I am using the Azure AD's OIDC interface directly + implicit flow to fetch user data. The way it works is that everything there is to know about the user is returned in the id_token (which should be fine), so there is no need for an access_token to query the user info endpoint.
However, the silent renew is built around the access token, so it won't work in my id_token-only case.
If I try to request an access_token from Azure AD, I also need to specify an additional scope (for accessing the graph api, etc), otherwise I get an error. Since I only need profile data, adding something else just to get an access_token is impractical.
I'd appreciate any help finding a solution to this.

Why do you need to keep requesting an id_token? Once you have authentication, it's up to your client app to decide the user's session lifetime.
But if you really want to do this, then you can manually trigger a silent request with signinSilent on the UserManager.

Any update?

Managed to renew the id_token manually, using the signingSilent call, as you suggested.

Once I have authentication, I am sending the id_token to the backend in an http header as a proof of identity on each request. The backend then verifies the JWT and resolves the local user permissions based on the sub claim, and executes/denies the actual request.
Since my app is not dealing with user-owned data, I just need a backend-trusted identity - which is solved by trusting the same IDP as the one the frontend requests the token from.
Generally speaking, if I used the id_token only once, then dealt with session management locally, what's the expiration on the id_token for?
Also, would it make sense to extend the automatic silent renew to the id_token as well? Given my specific scenario, I don't see anything wrong with the idea, especially that MS AD does not let me do things differently.

Generally speaking, if I used the id_token only once, then dealt with session management locally, what's the expiration on the id_token for

The id token expiration only needs to be long enough to deliver from the token server to your app. It helps prevents replay.

Also, would it make sense to extend the automatic silent renew to the id_token as well

No, as I think session management is up to the client app. Id token is just a snapshot of proof of identity. Perhaps a bad example, but when you go to a bar or a club that has a bouncer you only need to show your id at the door. Once you're in the trusted perimeter then all the staff inside trusts you've met the age requirement.

Fine example, just a bit of a pity I don't get to experience that anymore ;)
So, normally the id_token should be exchanged for something else (another token) that the app itself controls, I guess?
And the way it is done right now (using the id_token to access a service) is basically a shortcut that spares a few additional round trips (thinking about renewal also). Not sure about at what cost just yet.
Looking at all the additional logic for access/refresh tokens, renewals + the lack of it when it comes to the id_token.  Is it assumed then that the user's identity does not change as often as e.g my app's rights to access that data?

So, normally the id_token should be exchanged for something else (another token) that the app itself controls, I guess?

Yes, and for a SPA where there's typically no server-side UI framework, and only an API somewhere, then the SPA mainly relies on the access_token for that "session" (but id_token does provide good identity info to the UI).

the SPA mainly relies on the access_token for that "session"
I thought about doing that, but it seemed wrong to use that access_token in the SPA, as it was issued to give access to the user's data at the IDP, not to secure some 3rd party API.

Well, maybe i wasn't clear -- you send the access token to the API. The JS should not read the contents of it.

Great, thanks!

Thank you brockallen for clearing azure AD access_token role. I managed to get renew working with OIDC client and azure AD. Here is settings what I used. Response type must be id_token token to get access_token and scope must contain something more tha only openid. Now I get access_token and id_token and renew starts to working.
authority: https://login.microsoftonline.com/${tenant},
accessTokenExpiringNotificationTime: 600,
includeIdTokenInSilentRenew: true,
silentRequestTimeout: 10000,
extraQueryParams: {
grant_type: 'client_credentials',
resource: 'backend application id from azure registered application'
},
client_secret: 'backend seckret key from azure',
client_id: 'frontend application id from azure registered application',
redirect_uri: ${window.location.origin}/auth/login/aad/callback,
response_type: 'id_token token',
scope: 'openid https://graph.microsoft.com/.default',
loadUserInfo: false,
clockSkew: 60,
automaticSilentRenew: true,
silent_redirect_uri: ${window.location.origin}/silent-refresh.html,
metadata: {
issuer: https://sts.windows.net/${tenant}/,
authorization_endpoint: https://login.microsoftonline.com/${tenant}/oauth2/authorize,
token_endpoint: https://login.microsoftonline.com/${tenant}/oauth2/token,
jwks_uri: 'https://login.microsoftonline.com/common/discovery/keys',
end_session_endpoint: https://login.microsoftonline.com/${tenant}/oauth2/logout
},
signingKeys: [
here keys from https://login.microsoftonline.com/common/discovery/keys
]
}


Create an admissions page

Create an aesthetic admissions page for HDU.
You can also create an application form that can be submitted for enquiries.
You can refer to the Figma vision of this project for inspiration.

@Sayed-Afnan-Khazi  may i know didn't the issue in not tagged hacktoberfest?

The PR should be counted for hacktoberfest since the repository has the hacktoberfest tag, don't worry. 😄 @Prithwi32

Fine😅😊


Improvements to structured logs error tooltip

Changes:

Prevent browser from displaying a browser tooltip of Exception details along with the exception popup tooltip. We just want our popup.
Reduce tooltip height to help avoid going of screen in lower resolutions. It's a bit taller now that it includes a title.
Remove RabbitMQ specific property lookups, e.g. ex.Message. No longer needed with https://github.com/dotnet/aspire/pull/2157

Microsoft Reviewers: Open in CodeFlow

images?

Before:

After:

@adamint Please take a look.

Sorry for the delay, yes this should be ok!


Prevent the world generator selection from reverting

Only explicitly selected modules get set on the config.  This checks instead the selected modules from the UI which respect dependencies.

Excellent! Had another user report for this come up just a day or two ago ... :-)

Refer to this link for build results (access rights to CI server needed):
http://jenkins.terasology.org/job/TerasologyPRs/172/
Hooray Jenkins reported success with all tests good!


Update list of hypervisors in architecture doc

As mentioned in https://github.com/kata-containers/documentation/issues/566, the list of supported hypervisors in the architecture doc is (now) incomplete.

Let's go ahead and create a new hypervisor document, highlighting what devices are leveraged per VMM, as well.  This will help create a more cohesive story, and hopefully help end users with deciding which VMM or hypervisor works best for them.


add missing @Override annotations and remove redundant cast to int

It causes compilation warnings with ErrorProne

This PR is trivial, can you please merge it?

Thanks :)


Type aliases within classes

Flow could really do with a way to define type aliases within a class, for example;
class C<T> {
  type Ts = T[];
}

I've put a lot of effort into avoiding the need for this feature, but it's been really hard to avoid:

I'd actually prefer to use functions, but functions don't support generics in the same way that classes and object types do, where you can pass in the types you want to be used.
I tried constructing the class within a factory class that receives the generic arguments, and which has an anonymous function within the factory method that creates the class (genius I thought :smile:) but this led to subtle errors that eventually caused me to give up on this approach.
I tried living without type aliases, but this first led to me having almost unreadable type definitions, and finally led to me having to weaken some type definitions that had become hundreds of characters long, and were completely unreadable.

Nobody else has yet requested this feature yet, so maybe I'm just doing things wrong?

Quite useful, specifically for the use case of a type depending the type from polymorphic classes.

It could also be helpfull in terms of this issue: #235. For example, now, as a workaround, it is suggested ( (here #307 by @jeffmo) to do something like that:
type funcArg = {a: string, b: string};
var myfunction = ({a, b}:funcArg) => { ... }

But currently it is not applicable to class methods because we can not define type aliases inside class definitions.

Agreed with @sebnow, this would be helpful to simplify type annotations inside polymorphic classes.

Agreed, this feature is very useful for generate type just like @dchambers mention.
Currently, I use a workaround like following. But it look is so ugly, and it may cause other compile error if there has more complex types.
class C<
    T,
    Ts: Array<T> = Array<T>
> { }


HomeKit automations won't start the robot

I can start the robot manually in the Home app, ask Siri to turn it on or use Shortcuts, all of these work reliably both when I am at home or remotely, but home automations are always unable to start the robot. For example the robot won't start for the "time of day" or "people leave" automations.
There is no error codes in the homebridge logs, nor was I able to spot any commands there when the time of day occurred.
Any idea on how to fix it?

Hi @martindinicolino,
I recall having similar issues like a year ago. The plug-in worked just fine, but for some reason, the automations randomly worked.
After a lot of investigation, it just happened that I had an iPad as my Home hub, and it was pausing the HomeKit service for memory/battery reasons 🤷. The problem went away the moment I bought an Apple TV. I guess it would also be solved with a HomePod Mini (also cheaper).
Is your Home hub also an iPad?

Hi @afharo,
thank you very much for your reply.
As a matter of fact I am using an iPad as my home hub (but it is constantly plugged in and all other automations work normally, the only ones that don‘t work are the ones associated with this plugin).
Sadly Homepods are not sold in the country i currently live in, but if i can get my hands on one i‘ll let you know what happens.

The robot actually started yesterday (so far the only time it worked), but today it didn't and I found the following logs:
[5/16/2021, 4:19:22 AM] [homebridge-xiaomi-roborock-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Serial Number' was slow to respond! See https://git.io/JtMGR for more info.
[5/16/2021, 7:01:53 AM] [homebridge-xiaomi-roborock-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Firmware Revision' was slow to respond! See https://git.io/JtMGR for more info.
[5/16/2021, 9:45:03 AM] [homebridge-xiaomi-roborock-vacuum] This plugin slows down Homebridge. The read handler for the characteristic 'Serial Number' was slow to respond! See https://git.io/JtMGR for more info.
not sure if this is related or not;
anyhow https://git.io/JtMGR suggests to report the issue to the developer

Hi @martindinicolino,
It looks like the robot is taking too long to reply (maybe due to some network issues?). I've created https://github.com/homebridge/homebridge/issues/2931 to find out what's the timeout Homebridge enforces for showing that slow-log.

Following your recommendation I decided to have a HomePod mini shipped to me from a friend abroad, it arrived on Friday.
I was thinking to wait a week and see how it affects the automations before coming back to you (the good news is that so far it hasn't missed any time of day automations, so thank you very much for that suggestion! away from home automations still aren't working, but apparently a lot of iOS 14 users seem to have that issue, so I suppose that's causing it for me as well).
I do however still see the error messages in the logs:
[5/24/2021, 3:22:30 AM] [Xiaowa E Series] ERR getState | {"code":"timeout"}
[5/24/2021, 3:23:00 AM] [Xiaowa E Series] ERR getState | {"code":"timeout"}
[5/24/2021, 3:23:30 AM] [Xiaowa E Series] ERR getState | {"code":"timeout"}
I'm not too sure on the network issues tbh, the router, Homebridge and robot are all in the same room and I haven't noticed any.
Thank you so much for looking into this and let me know if I can do anything to help from my end.

I'm glad that it worked for you!

[5/24/2021, 3:22:30 AM] [Xiaowa E Series] ERR getState | {"code":"timeout"}

Oh! I notice that model does not support the getState request. That's the reason for the {"code": "timeout"}. I have a task somewhere to stop requesting that for that model to avoid that annoying noise. Please, let me know if there's anything else in the future.


Define FHIR (target) format from NCAs

Bundles of type Transaction are not retained on the server and are not reusable. Should that really be the choice?
Solution to be found and documented. This is not replacing any other possible ways for NCAs to provide the data, but should be the target format because the EMA FHIR format is our pivot.

Some questions to help find answers:

Why transactions? Does EMA guidance specify that? Seems a weird choice, with all the FHIR constraints that come with a transaction.
Why even Bundles? Where do we specify that the Bundles are the unit of exchange? Should be documented - and evaluate impact of the options.
If a transaction, we can add something to the transaction to make it traceable
Is anyone assuming that the server is the "master" repository? That seems poor in terms of data governance.

I guess we're talking about UFIS, right? My replies are about UFIS.

Transaction Bundle was used in the only EMA example we had at the time of starting work. Type of bundle was never discussed. So there is no decision behind it.
Some of the early examples did not use bundles at all, but creating, submitting and correcting data was easier with bundles (resources referencing eachother need to be created in the right order - it's easier for a machine than a human).
However, it is not anywhere in the specifications that you have to use bundles. My examples use bundles, because it lets the user see the whole product data together in the IG.
Does not need to be transaction.
If you only have input from manually altered csv-s and manually created fhir resources, then the server is the master repository, I think. It's not how it would work in the real world, but in this environment it seems somewhat inevitable.

@costateixeira to discuss and test the Document approach

options are:
Collection: The bundle is a set of resources collected into a single package for ease of distribution that imposes no processing obligations or behavioral rules beyond persistence.
Batch: The bundle is a set of actions - intended to be processed by a server as a group of independent actions.
Transaction: The bundle is a transaction - intended to be processed by a server as an atomic commit.
Document: The bundle is a document. The first resource is a Composition.
from this, my inclination is either a Collection or Document bundle. This depends on the meaning - are these resources put together to form a complete product (collection) or is there a need for more formal authoring, sections, like a description which would be in Composition (document)?

@rlindstrm you are able to put some sense into the many premade opinions. can you push for this? I think i can't really help if this is just diverging due to unclarity. The approach you havebeen mentioning (starting with the cases/ purposes) seems to have some effect.

Ok, Collection if Transaction bundle is problematic for some reason. Not going for Documents right now, too much rework.
Here, decided.
For retrieving, we rely on https://hl7.org/fhir/R5/medicinalproductdefinition-operation-everything.html


andTee() / andThrough() to handle side-effects a bit easier (from issue #445)

closes #445
Hi @supermacro!
I opened an issue with a suggestion about 2.5 months ago (Jan 17) but I think you have been very busy and I thought maybe a real code would save your time :)
I got a feedback comment in the original issue thread and I ended up having these two methods.

andTee()

andTee(f: (t: T) => unknown): ResultAsync<T, E>
// Usage: validate below returns ResultAsync
validate(userInfoInput).andThen(buildUser).andTee(logEvent).andThen(notifyUserRegistration)....

andThrough()

andThrough<F>(f: (t: T) => ResultAsync<unknown, F>): ResultAsync<T, E | F>
// Usage: validate below returns ResultAsync
validate(userInfoInput).andThen(buildUser).andThrough(persistUser).andThen(notifyUserRegistration)....

Both return the original input okAsync<T> upon success, but in case of error, andTee() ignores the error whereas andThrough() returns the new error errAsync<F>. The former is suitable for such as logging when you don't want to stop the main logic upon trivial side-effect failure and the latter is suitable when you want to stop the main logic upon a critical side-effect failure such as DB insertion error.
Origianlly I was going to use  the name andTee for no.2 above that passes error value in case of an error but considering the original meaning of "tee", even the error should not come back to the main "pipe" so I used the name for no.1 above instead. (But as I wrote in the original issue, there could be better names.)
And was also written in the original thread, this can be done with the current APIs but these two new methods will make it possible to write and understand each step of the logics more vividly (IMO) and I personally have cases I want to rewrite code with andThrough() for DB persistence as I explained here :)
Thanks in advance!

@supermacro can you take a look on this please? It's quite useful feature to avoid boilerplate

@supermacro bump :)

https://github.com/supermacro/neverthrow/issues/496

Hi @supermacro , have you had a chance to look at this PR? Thank you!

@m-shaka thank you for the comment, I will get back to you after making updates.

@supermacro Hey Gio, I think andTee is a nice name, but what do you think of the name andThrough? Do you have any other ideas?

Hi @m-shaka and @supermacro , I updated the PR based on the suggestions as well as README. Thanks

Both names are ok with me! Don't think it's fair for me to come in so late and opine strongly here. Great job everyone .. and thanks for your patience :)


Use Translation with mushroom-template-card

Hey,
is it possible to use the translation from: https://github.com/ekutner/home-connect-hass?tab=readme-ov-file#local-vs-server-
into a mushroom-template-card?
I would like to show the operation state in a mushroom-template-card, but then i see the BSH key.
Is it possible to reuse the translation?
Example
    type: custom:mushroom-template-card
    primary: Waschmaschine
    icon: mdi:washing-machine
    secondary: |-
      {{states("sensor.xxx_bsh_common_status_operationstate")}}
    icon_color: |-
      {% if is_state('sensor.xxx_bsh_common_status_operationstate','BSH.Common.EnumType.OperationState.Run') %}
        blue
      {% else %}
        grey
      {% endif %}

It's a HA limitation. You can try using the "Custom templates" integration from HACS, which is supposed to add such functionality but I haven't tested it myself, or you can switch so server translation mode.

Works nice :). Thanks for the quick answer

you can use
{{       state_translated('sensor.874020537388015735_laundrycare_washer_option_spinspeed')       }}
instead of states()


how can i access multi html when dev

As I've already configed two html with new HtmlWebpackPlugin
var pages = [
  {
      title: 'index',
      showErrors:false,
      hash:true, //prevent cache
      template: __dirname + "/static/kitchensink/template.html",
      chunks:['kitchensink','vendors'],
  },
  {
    filename: "test.html",
    chunks:['main','vendors'],
  }
]

for(var i = 0, len = pages.length; i < len; i++){
  base.plugins.push(new HtmlWebpackPlugin(pages[i]));
}

but I cannot find out where to get in page 2 ( it is test.html in here).
How can I do it?

"where to get in?"


how to print string which in slice  (html/template)

What version of Go are you using (go version)?

$ go version
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/angelandy/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/media/angelandy/4f95d6b7-a5ba-4a10-9232-6017dcced1d8/angelandy/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go-1.12"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.12/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build271133787=/tmp/go-build -gno-record-gcc-switches"

Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env

What did you do?
package main
import (
"os"
"text/template"
)
func main() {
// Define a template.
const tmpl = this is a test {{.list[1]}}
// Prepare some data to insert into the template.

var UserList = []string{
	"aaaaa",
	"bbbbb",
	"ccccc",
	"ddddd",
}
td := map[string]interface{}{
	"name":    "test",
	"list":    UserList,
}

// Create a new template and parse the letter into it.
t := template.Must(template.New("tmpl").Parse(tmpl))

t.Execute(os.Stdout, td)

}

What did you expect to see?
i want : "  this is a test bbbbb"
What did you see instead?

but It failed
panic:
unexpected bad character U+005B '[' in command

We don't use the issue tracker for questions.  Please see https://golang.org/wiki/Questions.
In this case the problem is that the template language doesn't support indexing like [1].
I think what you want is https://play.golang.org/p/Xxn_ksCzWJL.

well,  thank you very much


Feature Request: Add the ability to import or export lists from GDDL to GD

Is your feature request related to a problem? Please describe
No
Describe the solution you'd like
Add the ability to import and export lists to/from GDDL to/from the base game. This might be tricky to do, but would make GDDL lists more useful. Add an option to sort from lowest to highest / highest to lowest tier or enjoyability.
Describe alternatives you've considered
Manually doing it but that's slow
Additional context
No response
I am running the latest version of the mod

[X] Yes, I am

This idea sounds genuinely cool, I'll look into it

Also if you could, add the ability to sort GD lists by tier


Shall we reactivate on Bitcoin Cash chain?

https://github.com/Bitcoin-ABC/bitcoin-abc/issues/110

Yes please! :+1:

I'm afraid I haven't worked on Lighthouse for quite a while, but it's fully open source except for the name/logo, so anyone who wanted to can go ahead and fork it then resurrect it on the Bitcoin Cash chain. You'd need to start with making a bitcoinj release that supports Cash.

Cool, thanks for that info.  I’m not technical enough to know, but there might be some way to move it forward as part of Dumo, a funding platform we’ve been working on at letsdumo.com.  Would love any thoughts, and I’ll send my partner/CTO over this way.

'You'd need to start with making a bitcoinj release that supports Cash.' -Mikehearn.
So there would be much work to do.
I am willing to sponsor this movement. --->bitcoinj on BCC --->lighthouse on BCC
So how much do you guys suggest that I sponsor it with? $5k, $10K, $50k?
Thank you.

Converting bitcoinj to a cash version should not be tremendously complicated.  The two main changes are the DAA and the TX sigs.  (there may be a few minor ones like LOW_S).


[DiscordCoreAPI] to v1.90 and [Jsonifier] to v0.9.7

DiscordCoreAPI Changes:
-Swapped out all instances of std::vector for Jsonifier::Vector to increase performance.
-Updated the CMakeLists.txt script.
-Updated the UnorderedMap and UnorderedSet classes to improve performance.
-Added a ThreadWrapper class to compenstate for lack of std::jthread support on Clang16 on MacOS.
-Added a CountedPtr class for counting the ThreadWrapper's StopToken references.
-Removed LightString class in exchange for using Jsonifier::String for increased performance.
-Replaced the cached objects with UniquePtr-stored object-types to save memory.

-Updated the Vector class to fill its implementation out.
-Updated the Iterator and ConstIterator implementations as well as the iterator-related members of the String, StringView and Vector classes.

[x] Changes comply with the maintainer guide
[x] SHA512s are updated for each updated download
[x] The "supports" clause reflects platforms that may be fixed by this new version
[x] Any fixed CI baseline entries are removed from that file.
[x] Any patches that are no longer applied are deleted from the port's directory.
[x] The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
[x] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:
x64-windows
x64-windows-static

Thanks for the updates!


fix: The cpu usage is too high.

syncer_loki.go line 221,
'default' -- 'syncer.buffer.len() >= syncer.maxBatchSize', If the condition is not met, it will fall into an infinite loop.
Add a row of sleep, 'time.Sleep(time.Duration(10) * time.Millisecond)'

LGTM

Codecov Report

Merging #5 (1ccafcb) into master (69ef586) will decrease coverage by 0.17%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master       #5      +/-   ##
==========================================
- Coverage   86.83%   86.65%   -0.18%
==========================================
  Files           2        2
  Lines         486      487       +1
==========================================
  Hits          422      422
- Misses         48       49       +1
  Partials       16       16

Impacted Files
Coverage Δ

syncer_loki.go
76.87% <0.00%> (-0.45%)
:arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Nested transition rendered inside v-slot never leaves

Version
3.0.1
Reproduction link
https://jsfiddle.net/ta5128rw/
Steps to reproduce

Click go User Index
Click Home

What is expected?
User Index (or rather the container) to fade out then Home to fade in
What is actually happening?
Content disappears and nothing can be displayed anymore

Coming from https://github.com/vuejs/vue-router-next/issues/537
When using a different transition mode, as the default one, you can clearly see that the leaving element is removed right away, without triggering the leaving transition.
The first wrapping router-view is not needed to reproduce the bug, it's only needed inside the Child component. The bug does not exist when no wrapping component (router-view) is used
Workaround
Wrap the nested router-view (inside Child component) with an element like a div

The suggested workaround doesn't work for me. I have updated the original JSFiddle and created a Jist (I was having a few memory leaks at the time console logging the ALL of the hooks from transitions on JSFiddle). It randomly doesn't enter into components.
The workaround with using div as a wrapper on this seems to be ok.
If the router failing in this case because the transition hooks are not working correctly?
Thanks

I'd say this is expected behavior... since RouterView is indeed returning an array from its render function (thus becomes a fragment root).
What would fix is is changing RouterView's render function so that it returns a single root when possible: https://jsfiddle.net/yyx990803/myv5e6zd/


Fix gradient accumulation when using overwrite_with_gradient during float8 training

Ref implementation:
https://github.com/google/flax/pull/3623
We should use ops.maximum for gradient accumulation with overwrite_with_gradient=True variables.
This PR also fixes a potential bug in gradient accumulation where directly using self._accumulated_gradients may mismatch with the filtered grads in the code path.
The new test test_overwrite_with_gradient_with_gradient_accumulation can only pass after the changes.

Codecov Report
Attention: Patch coverage is 72.72727% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 55.27%. Comparing base (1937d48) to head (ee70fe5).
Report is 1 commits behind head on master.

Files
Patch %
Lines

keras/src/backend/jax/optimizer.py
0.00%
2 Missing :warning:

keras/src/backend/tensorflow/optimizer.py
0.00%
2 Missing :warning:

...ckend/torch/optimizers/torch_parallel_optimizer.py
0.00%
2 Missing :warning:

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #19534       +/-   ##
===========================================
- Coverage   79.38%   55.27%   -24.12%
===========================================
  Files         496      496
  Lines       44056    44076       +20
  Branches     8160     8167        +7
===========================================
- Hits        34975    24362    -10613
- Misses       7220    18130    +10910
+ Partials     1861     1584      -277

Flag
Coverage Δ

keras
55.27% <72.72%> (-23.97%)
:arrow_down:

keras-jax
?

keras-numpy
55.27% <72.72%> (-0.17%)
:arrow_down:

keras-tensorflow
?

keras-torch
?

keras.applications
?

keras.applications-jax
?

keras.applications-numpy
?

keras.applications-tensorflow
?

keras.applications-torch
?

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


Password maximum usage period, minimum usage period applied.

Description
Password maximum usage period, minimum usage period applied.

Users cannot log in after the maximum password usage period and must change the password through the password change dialog.

Users cannot change it again within the minimum period of use after changing the password. (but Administrator can change the password.)

Related Issue :
How Has This Been Tested?

add password period config to application.yaml
For testing, the minimum password usage period is 5 minutes, and the required change period is 10 minutes.

polaris:
  user:
    password:
      requiredChangePeriod: PT10M           # The password must be changed within that period. (ISO 8601 Duration Format)
      minimumUsePeriod: PT5M               # The password cannot be changed again within that period. (ISO 8601 Duration Format)

register userA
approve user using admin.
logout and wait 10 minutes.
login with userA
see change password dialog.
login with userA.
change password in 5 minutes.
see error. ("you cannot change password")

Need additional checks?
Types of changes

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

Checklist:

[ ] I have read the CONTRIBUTING document.
[ ] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
[ ] I have added tests to cover my changes.

Additional Context

deploy to 1


Popularity Boosting/Pagerank

I would think this would work work well given the closed ecosystem of a site search.  ElasticSearch has a tutorial on this.

There are two ways of achieving this with lunr currently:

Apply a boost to an entire document at index time, how to calculate the boost is entirely application specific but something similar to the votes described in the ElasticSearch tutorial would be possible.
Apply a boost to the score after Lunr returns query results. The same logic as above would apply.

In the first option this boost would apply to all queries, in the second it could be different with subsequent queries.
Is there a use case that wouldn't be covered by the above options?
I think the approach in the ElasticSearch tutorial makes sense when you can't bring you calculation to the data, but I don't think this is the case with Lunr since it is an in-memory in-process library, rather than a full blown service. I'm happy to be proved wrong though!

No, #1 is totally reasonable.  I guess this should be a plugin?  I'm kinda sad that Lunr doesn't grok HTML, it would be interesting to add heuristics for headers, etc.
Related note: I'm guessing there aren't any metrics that can be used to benchmark algorithmic enhancements?

Closing for now, will do so when there is a solid HTML processing plugin.


Clicking connected dots will trigger onConnect event

🐛 Bug Report
As title says.
console output:
Warning: Encountered two children with the same key, `reactflow__edge-1-1`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
    in g (created by EdgeRenderer)
    in svg (created by EdgeRenderer)
    in EdgeRenderer (created by GraphView)
    in div (created by FlowRenderer)
    in FlowRenderer (created by GraphView)
    in GraphView (created by ReactFlow)
    in StoreProvider (created by ReactFlowWrapper)
    in ReactFlowWrapper (created by ReactFlow)
    in div (created by ReactFlow)
    in ReactFlow (at App.js:49)
    in div (created by Context.Consumer)
    in EmotionCssPropInternal (at App.js:38)
    in App (at src/index.js:9)
    in StrictMode (at src/index.js:8)

To Reproduce

connect two nodes
click any dot on one of the nodes

Expected behavior
Should not trigger onConnect event
Link to repl or repo
https://codesandbox.io/s/react-flow-demo-ddxhf?file=/src/App.js
envinfo
package version: 6.1.1
OS: 64bit Mac OS X 10.14.6 18G6020

Hi, I think this is the expected behaviour. If you want to prevent nodes being connected to themselves, you can do a check in your onConnect, something like params.source !== params.target. Anyway, we should take a look into the duplicate key warning separately.

Hi, I think this is the expected behaviour. If you want to prevent nodes being connected to themselves, you can do a check in your onConnect, something like params.source !== params.target. Anyway, we should take a look into the duplicate key warning separately.

@chrtze Hi, thank for your reply, but I still think there is a misunderstanding. IT IS a CLICK action, not CONNECT, thus it would be weird to get a onConnect event.

You are right, in that case we should think about adding a threshold for checking if the user has dragged. Thanks for clarifying!

I had the same issue, in my use case, a node could not connect to itself, so preventing the connection solved the issue. But I also agree clicking on handle should not trigger connect.

I could image that this will be fixed when we merge #543. Otherwise we can add a flag hasMoved in order to check if user has moved the mouse or just clicked.

This will be fixed in the next version. You can already try it out with npm install react-flow-renderer@next. #657

released in 7.0.0


Datagrid Contextmenu is broken in latest alpha

Describe the bug
The ContextMenu when you edit a cell doesn't get styled anymore.
To Reproduce
Have a look at the demo app

Expected behavior
ContextMenu should be styled like any other ContextMenu :smile:
Screenshots
see above
Environment(please complete the following information):

MahApps.Metro version latest alpha
OS: Windows 7
Visual Studio 2019
.NET Framework tested with different

Happy coding
Tim

@timunie This doesn't work in v1.6.5 either.


[typescript] Correct type definition for Theme creation

The TypeScript type definition of createPalette does not conform to the actual JavaScript code. I corrected the definition accordingly.

I extended this PR to adapt all type definitions involved in

createMuiTheme
createPalette
createBreakpoints
createTypography
createMixins

to the current JavaScript definitions of these functions.

Any clue about the failed Codecov test? Looks like a Codecov bug to me.

@TorstenStueber Thanks for updating all these typings 🙌
Regarding the coverage. Not quite sure why is did go down o.O Especially because it shows Select.js as one of the files. Maybe rebase your branch with upstream/v1-beta will help?

Something is wrong with codecov. He has been following this behavior for days now 🤔 . Let's merge anyway :).


CDC incremental scan pollutes rocksdb block cache

Bug Report
CDC incremental scanner sets fill caches (the default behavior of a scanner), it pollutes block cache, and slows down online read services.
https://github.com/tikv/tikv/blob/06c3e76eab84482d49a36d634fb2a6c05995f54b/components/cdc/src/endpoint.rs#L1094-L1097
What version of TiKV are you using?
4.0.13 and 5.0.2
Steps to reproduce

Run TiCDC
What did you expect?
Do not add blocks to block cache.

hey @overvenus , is this issue unassigned? If so, I can help to fix it.

@xuhui-lu Yes, this issue have not been assigned to somebody, you can pick this issue. Thanks 👍

hey @overvenus , is this issue unassigned? If so, I can help to fix it.

Try /assign. The bot will assign this issue to you.

/assign

@xuhui-lu Hi, do you have time to fix this issue in tomorrow? We plan to release its fix in the next release, and tomorrow we will freeze the code.

yea, I will do that tomorrow.


Added duechiacchiere.it

This PR is:

[x] Adding a new domain
[ ] Updating existing domain size
[ ] Changing domain name
[ ] Removing existing domain from list
[ ] Website code changes (512kb.club site)
[ ] Other not listed

[x] I used the uncompressed size of the site
[x] I have included a link to the GTMetrix report
[x] The domain is in the correct alphabetical order
[x] This site is not a ultra lightweight site
[x] The following information is filled identical to the data file

I confirm that I have read the FAQ section, particularly the two red items around minimal pages and inappropriate content and I attest that this site is neither of these things.

[x] Check to confirm

- domain:
  url:
  size:
  last_checked:

GTMetrix Report: https://gtmetrix.com/reports/duechiacchiere.it/x8DjezrS/

GTMetrix Report: https://gtmetrix.com/reports/duechiacchiere.it/x8DjezrS/

Thank you! I'd be interested in helping run this project from time to time. Let me know how I can contribute.

@gerlandotermini thanks for your kind  offer! There's currently not much backpressure on the PRs, and I don't think we need another full-time maintainer. Some issues occasionally pop up however, like the ones that are open right now. We're happy to take PRs of any kind!

@garritfra thank you, I'll keep an eye on PRs then. Again, thank you for this project and for promoting a more sustainable web!

@gerlandotermini you mean you keep an eye on issues? Sorry if I got you wrong! 🙂

@garritfra yes, that's what I meant 😅 (sips more coffee)


feat: INFRA-344 keep requisite files ignored and improve build script

Some checks failed because file auth_secret is missing. I create it in build.sh, but it would probably be better to manage that in the code which I will do.


Django cms3.7 does not work with Content Security Policy without "unsafe-inline" in script-src

In order to support CSP, we cannot use 'unsafe-inline' in script-src , but if we do not add 'unsafe-inline' (script-src: 'self' ), it will show error on each

Hi @macolo ,
Any status on that issue?)

It would be fantastic to support CSP, but the work involved is significant.


Create Blog “next-1”

Automatically generated by Netlify CMS

👷 Deploy Preview for nostalgic-blackwell-179c00 processing.
🔨 Explore the source changes: c25ff680786cdf994c016e7c69372e2b1598824f
🔍 Inspect the deploy log: https://app.netlify.com/sites/nostalgic-blackwell-179c00/deploys/61e4ffef5deb180008e9a0d2


Added casting between datetime and number types

Codecov Report
Attention: Patch coverage is 45.83333% with 52 lines in your changes missing coverage. Please review.

Project coverage is 78.90%. Comparing base (a1faaf4) to head (3584e69).

Files
Patch %
Lines

...main/java/tech/ydb/jdbc/impl/YdbResultSetImpl.java
38.23%
42 Missing :warning:

...main/java/tech/ydb/jdbc/common/MappingSetters.java
52.63%
6 Missing and 3 partials :warning:

...ain/java/tech/ydb/jdbc/common/TypeDescription.java
83.33%
0 Missing and 1 partial :warning:

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #60      +/-   ##
============================================
+ Coverage     78.80%   78.90%   +0.10%
- Complexity     1794     1819      +25
============================================
  Files            56       56
  Lines          4752     4803      +51
  Branches        483      503      +20
============================================
+ Hits           3745     3790      +45
- Misses          793      795       +2
- Partials        214      218       +4

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


solved the linting issue in pdf_watermarkadder/main.py folder that is causing the flake8 linker checks to fail for other PR also

Fixes what ?
Due to some linting error in pdf_watermarkadder/main.py file causing the flake8 linker check to fail in when anyone is making a PR on new scripts even though they have no errors in their own script.
Issue no.(must) -#956

[x] One Change in one Pull Request

I am open to suggestions if any and if not then please merge it as it would not cause the error for other who are adding new scripts and please add "hacktoberfest-accepted" label to it. Thank You

This is solving other error in other folders but still there is one error which is shown in the ./watermark_maker/main.py but locally I have tested that and there is no such error flake8 is not giving any error on linting, I guess that issue is caused due to the version difference.

@Davda-James It's solved now by upgrading the python version + actions, by #974


Support an RPC structure of API

Hi there!
I am realy sad that OpenAPI specification does not support RPC style of API, because of path centric structure. There is so many tools to describe REST API, but there is no such to describe RPC API. And recently your initiative have appeared with Open API ideology, but without supporting of RPC API style. Why? Could you add it to nearest release?

RPC style APIs could be a side effect of #574. An unfortunate side effect, IMHO.

@webron it seems like that implementation of operations really solves issue of describing RPC API. There is can be some details related to JSON RPC 2.0, for example, but I hope you cover most cases.
Thank you, and if it possible to take part in testing of your new realease, I would glad to join.

Parent: #586.

Following a different thread, it's unlikely #574 will resolve it as it's controlled by the content of the request, not the structure of it. Moving it under #586.

I use swagger spec to describe JSON-RPC in a hacky way, storing method names in paths keys and ignoring non-post operations. Hack is enabled by x-service-type vendored flag.

@vearutop that sounds interesting—do you have an example you could share?

basePath is used for endpoint value.
x-service-type specifies how to treat swagger.json file.
For this vendor extension we have a patched swagger-ui which envelopes original request to something like {"jsonrpc": "2.0", "method": "getSimpleV1", "params": {"id":3}, "id": 1}.
That simple we benefit from swagger spec and tools not only for our REST, but also for JSON-RPC services.
{
  "swagger": "2.0",
  "x-service-type": "json-rpc",
  "info": {
    "title": "DummyAPI",
    "version": "master~dirty"
  },
  "host": "",
  "basePath": "/rpc",
  "schemes": [
    "http",
    "https"
  ],
  "paths": {
    "getSimpleV1": {
      "post": {
        "tags": [
          "V1"
        ],
        "summary": "Simple Get",
        "description": "Get simple by ID",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/SimpleGetParameters"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "request success",
            "schema": {
              "$ref": "#/definitions/Simple"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Simple": {
      "type": "object",
      "properties": {
        "id_simple": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "SimpleGetParameters": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        }
      }
    }
  }
}

That's a little disappointing, I was really hoping to see something interesting, like folding of the parameters into the existing document, with clever uses of the flags.  Having to use a different library to pull meaningful data is unfortunate.

Sorry, @wparad, I did not mean to make you sad (mind hacky way disclaimer).
Not sure I got you right, by "folding of the parameters into the existing document" do you mean having JSON-RPC envelope structures built in schema definition? What is "different library"?

@vearutop, could you clarify, your API has structure according to JSON RPC 2.0 or you are just using RPC style for URL resources?

@SvyatoslavVasiliev, API is serving valid JSON RPC 2.0 structures.
JSON RPC enveloping (including batch requests) is done by client and server according to spec.
method, params and result is defined and validated by swagger.json path, post-parameters and post-responses-200 accordingly.
Endpoint URI is defined in swagger.json as basePath.
Service host is dynamic and loadbalanced, so it is not present in swagger.json.
Actually this swagger.json is not valid, since it does not have / at the beginning of paths keys.
But this approach made possible to achieve "compatibility" with least effort.

@vearutop, thank you, as I am looking for some tool to specify my JSON RPC API, I will try your approach in swagger. But unfortunately, as @wparad already said, standard swagger library won't be able to work with it fully. For example if I try to upload your specification in on-line swagger editor I won't able to make API requests, because of wrong auto generated URL.

hi @webron, I was wondering if there's any update on this issue? thanks!

Hi, same here. I would really be glad to hear that OpenAPI (Swagger) can handle JSON RPC style APIs.

+1000
REST = SQL Web API != Computer Science + Information Technology + Computational Science
Trying to implement google maps in sql may help to understand the most stubborn soul.
Data manipulation and, side by side, function call is a must.
By the way json-rpc 2 is pretty simple, good and stable.

OpenAPI provides JSON Schema to describe a wide range of payloads.  If an API provider decides to create a single path item object with many different payloads in order to tunnel procedure calls, then OpenAPI can do that.  The support for JSON Schema oneOf in OpenAPI V3 will make that even easier.
If people want to build tooling that map those payloads into UI as if they were different path item objects, then they are free to do so.  I don't believe that the OpenAPI spec should try and standardize a mapping between those payloads and native HTTP constructs.  If there is sufficient community support to standardize that mapping then I would encourage that community to create it and encourage tool builders to support it.

@darrelmiller
I have to admit it's a bit harsh to understand all the terms you cite for an outsider for now o:
(But i have a second screen diffusing the linux foundation mooc at this same amazing time, and sure, that will help to catch in the long run).
I will follow your tips and wait/contribute example from/to the community.
By the way, thanks for the quick answer, and what a good teasing for the v3!

I ended up using @vearutop 's approach. We have a single endpoint for JSON-RPC calls that each have a different method. But I've explained how we resolved it in the main "info" > "description" section of the following OAS3 that I've pushed here:
https://github.com/ltfschoen/swagger/blob/master/scon_substrate_0.4.0_swagger.json
It can be viewed with Swagger UI here: https://app.swaggerhub.com/apis-docs/scon/substrate/0.4.0
And I also imported into Readme.io here: https://substrate.readme.io/v1.0.0/reference

I ran into this issue recently too and ended up here from swagger-api/swagger-codegen#4274. I finally have something that is working relatively well for what I am doing so I created a JSON-RPC 2.0 OAS sample gist for anyone else that may benefit from it. You can copy/paste it into http://editor.swagger.io/ to experiment with it.
There is a simple POST that includes a JSON-RPC param. I also showed how to use a ref (in conjunction with allOf) to avoid duplicating the method, id and jsonrpc properties.
Copy of gist:
{
  "x-send-defaults": true,
  "openapi": "3.0.0",
  "x-api-id": "json-rpc-example",
  "info": {
    "title": "JSON-RPC OpenAPI",
    "version": "1.0.0",
    "description": "Example of how to describe a JSON-RPC 2 API in OpenAPI"
  },
  "servers": [
    {
      "url": "http://<IP_ADDRESS>:3000"
    }
  ],
  "paths": {
    "/examplePost": {
      "post": {
        "operationId": "examplePost",
        "deprecated": false,
        "summary": "Example of JSON-RPC2 Post",
        "description": "Example post using JSON-RPC params.",
        "tags": [
          "JSONRPC"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "method",
                  "id",
                  "jsonrpc",
                  "params"
                ],
                "properties": {
                  "method": {
                    "type": "string",
                    "default": "examplePost",
                    "description": "Method name"
                  },
                  "id": {
                    "type": "integer",
                    "default": 1,
                    "format": "int32",
                    "description": "Request ID"
                  },
                  "jsonrpc": {
                    "type": "string",
                    "default": "2.0",
                    "description": "JSON-RPC Version (2.0)"
                  },
                  "params": {
                    "title": "Parameters",
                    "type": "object",
                    "required": [
                      "jsonParam"
                    ],
                    "properties": {
                      "jsonParam": {
                        "type": "integer",
                        "default": 1,
                        "description": "A param to include"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/examplePost2": {
      "post": {
        "operationId": "examplePost2",
        "deprecated": false,
        "summary": "Example of JSON-RPC2 Post",
        "description": "Example post using JSON-RPC params. Also uses a ref to avoid duplicating properties.",
        "tags": [
          "JSONRPC"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/examplePost"
              }
            }
          }
        }
      }
    }
  },
  "x-headers": [],
  "x-explorer-enabled": true,
  "x-proxy-enabled": true,
  "x-samples-enabled": true,
  "x-samples-languages": [
    "curl",
    "node",
    "ruby",
    "javascript",
    "python"
  ],
  "components": {
    "schemas": {
      "JsonRpcRequired": {
        "type": "object",
        "required": [
          "method",
          "id",
          "jsonrpc"
        ],
        "properties": {
          "method": {
            "type": "string",
            "default": "examplePost",
            "description": "Method name"
          },
          "id": {
            "type": "integer",
            "default": 1,
            "format": "int32",
            "description": "Request ID"
          },
          "jsonrpc": {
            "type": "string",
            "default": "2.0",
            "description": "JSON-RPC Version (2.0)"
          }
        },
        "discriminator": {
          "propertyName": "method_name"
        }
      },
      "examplePost": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JsonRpcRequired"
          },
          {
            "type": "object",
            "properties": {
              "params": {
                "title": "Parameters",
                "type": "object",
                "required": [
                  "jsonParam"
                ],
                "properties": {
                  "jsonParam": {
                    "type": "integer",
                    "default": 1,
                    "description": "A param to include"
                  }
                }
              }
            }
          }
        ]
      }
    }
  },
  "tags": []
}

@thephez Thanks a lot for your gist, very interesting and helpfull. One point that I don't understand is that using json-rpc, we use to always call the same url, kind of "/json-rpc", because the url doesn't matter as we are using the method name as discriminant.
Meanwhile on your example, the 2 calls you described are hitting 2 different urls


Predicate serialization POC.

PR not going to be merged, it is just a POC.
The main idea is to investigate a possibility to serialise and deserialise predicates.
While serialisation is fairly simple deserialisation is quite complex, and seems not possible for common case without reflection.
The POC demonstrates the possibility to serialise predicates having 'AND', 'OR', and comparisons with a value. Adding another types of operations probably will require significant work.
Each type supposed to be evaluated with predicates will require to implement KeyPathMappingProvider protocol.
Predicate is serialised to unordered JSON, so serialisation of the same predicate will always give the same serialised data.
For example
  let predicate = #Predicate<Monster>() { monster in
      (monster.level == 80) && (monster.name == "Orc") && (monster.hp == 100)
  }

is serialised to
["&&","&&","==","level",80,"==","name","Orc","==","hp",100]

It is just flattened tree, one possible change is to use nested arrays, then it will look like
["==",["&&",["==","level",80],["==","name","Orc"]],["==","hp",100]]

{
   "msg":"Transaction",
   "predicate":{
      "op":"AND",
      "lhs":{
         "op":"EQ",
         "lhs":{
            "op":"VALUE",
            "type":"UInt64",
            "value":"123456789"
         },
         "rhs":{
            "op":"VAR",
            "type":"UInt64",
            "value":"instrument"
         }
      },
      "rhs":{
         "op":"EQ",
         "lhs":{
            "op":"VALUE",
            "type":"UInt64",
            "value":"987654321"
         },
         "rhs":{
            "op":"VAR",
            "type":"UInt64",
            "value":"account"
         }
      }
   }
}

Alternative short term implementation of serialisation that's a bit shorter:
        let serializedPredicate = predicate.debugDescription
        print("\(serializedPredicate)")

Gives output like:
(((\Transaction.user == Optional(7291186307628716032)) AND ((\Transaction.account == Optional(7291186307628726272)) OR (\Transaction.account == Optional(7291186307628943360)))) OR ((\Transaction.account == Optional(7291186307628726272)) OR (\Transaction.id ==<PHONE_NUMBER>628943360)))

Ok.

Wouldn't implementing codable give us a JSON?

I would say a particular format depends on the used coder but not implementing Codable protocol.

I would say a particular format depends on the used coder but not implementing Codable protocol, so if we will use JSONEncoder then will get JSON.

You are correct, my comment was related to "My suggestion is to have next format" - which is basically a JSON, and I suggested that we get it for free if implementing Codable (then using a JSON encoder).

Is this PR relevant anymore?


Can not see the images on the web page

in the http://facebook.github.io/react-native/docs/embeded-app.html#content
2 images link is broken.
I think It should use relative path instead of absolute path.

I have just submitted a PR #633 .


Enforce HSTS on every response

We received a low-level alert from one our security scanners that the HSTS header was missing in some marginal cases (like on an error response). This PR should in theory make sure it is always returned.

@whabib Thanks for bringing this up! We should add some tests for this; I can add them myself (I'll cherry pick your commit into a PR and add the tests as a separate commit), or you can do so yourself by amending your commit. Just let me know what option you prefer 😄

@krallin Hi Thomas! By all means, go ahead cherry pick the commit and write the tests.  If I do it, it will probably take a couple of weeks.

Closing in favor of #79.


Request: Some way to ignore a review of a crate if it's by the author of that crate.

Basically the author of a work is often blind to the problems of a work. If there's a bug that they put in there on accident, they're obviously not going to see it during review because they'd fix it if they did see it.
I know that the identities aren't currently linked to anything so there's no for sure way to determine if the ID of a review is connected to the person who wrote the crate being reviewed, but even a best effort system (such as looking at the git URL of the ID and looking at the authors, repository, and homepage entries in the crate's Cargo.toml file) would probably be helpful here.

Since there's no reliable way to do it, it's better to embrace it than try to fight it. A review of the author is better than no review at all since it at least certified that the author knows about this release, and the content digest is the same as the author expected.
Eventually there would be more and more reviews so reviews and the author is not any more reputable than you or your WoT is willing to make them.

Would be opt-in flagging the review yourself make sense, like in understanding: author (or coauthor)? Not sure if that fits precisely in "understanding", could just as well be a separate field that indicates whether the reviewer has not contributed code, contributed some code or contributed a major portion of the code.
I think that it'd make sense to have self-reviews published, but currently don't publish reviews on my own crates as the review might appear disingenuous. The possibility to indicate that would remove that impediment to writing reviews, and considering the points you made would not require any immediate changes in the reported trust.

@chrysn
Right now I'm of the opinion that this is not a problem at all, for many reasons. And potential "solutions" introduce more problems than their "solve".
At least until something is decided to change, I would not hold on reviewing own crates. It's not disingenuous. The official party line is that it is encouraged. If anyone trusts you as a reviewer of other's people code, they trust you to do a decent job writing/reviewing your own code as well. Eventually, people should be using verify --redundancy N anyway, and biases of the authors are going to disappear in the wisdom of the crowd.


Combine download and export options together

After meeting review on Oct 7 2024, we realized that the current download option at menu bar is confusing and should be unified. Now there is only one button at the top representing download and export together and when hovered, opens the following two options:

Export Execution Result (export only CSV to dataset)
Download All Operators Result (Download all operators result as zip file)

https://github.com/user-attachments/assets/6b07a533-7107-4711-bab3-cc468c9bccd7

Looks good in general! I think it would be nice to not show the nz-menu-items if the download button is disabled.

Thanks, I fixed that and also made sure that the button turns to enable on real-time when the workflow is executed

I’ve tested the code, and it appears that the download button at the top becomes active even when I haven’t executed the workflow. Also, the button does get deactivated when I pause the workflow, but some of the sink operators still produce results. It seems that the issue is related to the recent changes involving the real-time check functionality, which currently seems quite buggy.
Could you please either improve the reliability of the function or, if it proves too complex to fix at the moment, consider reverting the change and addressing it in a separate PR?
Thanks!

Thanks for your detailed explanation Chris. Do you know when that feature will be finalized? I can put this PR on draft till that finish

I’ve tested the code, and it appears that the download button at the top becomes active even when I haven’t executed the workflow. Also, the button does get deactivated when I pause the workflow, but some of the sink operators still produce results. It seems that the issue is related to the recent changes involving the real-time check functionality, which currently seems quite buggy.
Could you please either improve the reliability of the function or, if it proves too complex to fix at the moment, consider reverting the change and addressing it in a separate PR?
Thanks!

Thanks for your detailed explanation Chris. Do you know when that feature will be finalized? I can put this PR on draft till that finish

The feature that I mentioned is what you added in this PR. ("the button turns to enable on real-time")

I’ve tested the code, and it appears that the download button at the top becomes active even when I haven’t executed the workflow. Also, the button does get deactivated when I pause the workflow, but some of the sink operators still produce results. It seems that the issue is related to the recent changes involving the real-time check functionality, which currently seems quite buggy.
Could you please either improve the reliability of the function or, if it proves too complex to fix at the moment, consider reverting the change and addressing it in a separate PR?
Thanks!

Thanks for your detailed explanation Chris. Do you know when that feature will be finalized? I can put this PR on draft till that finish

The feature that I mentioned buggy is the feature you added in this PR. ("the button turns to enable on real-time")

Ok, got it. Currently, the previous version is available in master with no issue. In this regard, I keep working on this till its fully fixed.

@kunwp1 I fixed the issue of turning on the button when you move across workflows. Also, I removed Observable from workflow export service since it was redundant.
https://github.com/user-attachments/assets/cdacf66f-4ac2-4e42-85b5-5f0f64825b7a

I believe this PR is incomplete as the behavior of the top download button currently has two options: download to the dataset and download to the local device. However, these two options aren't consistent. The top button should ideally download all results from the sink operators. Yet, in its current form, the implementation only allows downloading a single result to the dataset, which feels quite limiting and confusing.
Additionally, I’m wondering if the scope of this PR is intended solely to combine the top panel button. We also need to update the right-click menu on operators to allow users to download individual operator results to the dataset. This suggests that part of the functionality currently in the top download button should be relocated to the right-click menu.
Based on our discussion on Tuesday, I think the following approach would improve usability:

Remove the dropdown menu on the top download button.
Instead, add a dropdown menu in the pop-up window where users can specify the destination (options: dataset or local device).
If "dataset" is selected, prompt users to specify the dataset.

To summarize:

Move the existing "Export Execution Result" functionality to the right-click menu.
Add a destination dropdown menu to the pop-up window.
Enable downloading all results to the dataset.

I’d like to hear your thoughts. To me, this PR feels too narrow in scope.
Here is the screenshot for the draw.io's interface.

Hi Chris,
I implemented the functionalities as you mentioned.
The only issue I see here is exporting non-csv files to dataset, it works on the backend so I guess its out of scope of this PR.
https://github.com/user-attachments/assets/a7f37d25-16a1-4119-b48b-202f124be0d7


Update getting-started.md

What: Added "go install ..." to upgrade instructions
Why: https://blog.gobuffalo.io/buffalo-v0-9-4-released-5d2327a4742e "how to section" says to , but getting-started.md doesnt.

Thanks.


VSTest and MSBuild: document enableDefaultLogger parameter

https://github.com/microsoft/azure-pipelines-tasks/pull/14331 added an enableDefaultLogger parameter to the VSBuild tasks, but it's not mentioned here.
cc @anatolybolshakov who made the change.

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

ID: 29f86c97-f534-50ad-bfb1-a2cf78c7af94
Version Independent ID: acea40e3-512b-4d9a-9389-71b8b24327be
Content: Visual Studio Build build and release task - Azure Pipelines
Content Source: docs/pipelines/tasks/build/visual-studio-build.md
Product: devops
Technology: devops-cicd-tasks
GitHub Login: @vijayma
Microsoft Alias: vijayma

Thanks for letting us know. This issue is fixed in our new task reference, which is generated using the task source code and includes all task inputs, including any aliases here:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/vsbuild-v1?view=azure-pipelines
Please check it out and let us know what you think. Thank you.


garbage-collect does not purge unused layers

Issue
I am trying to shrink a registry that has been in use for a while. The garbage-collect function is not working as expected as it leaves ~30k entries in the _layers for certain repositories.
I have run a regclient/regbot script that prunes old tags, and the repository being examined contains only ~55 tags. --delete-untagged is used to ensure each tag points to (at most) a single revision, so there are also only 55 entries in _manifests/revisions for the repository.
When I fetch one of the manifests referenced using the sha256 from _manifests/revisions I get a normal looking json manifest with about 10 layers.
What I expect
Given 35 revisions, and manifests with 10 layers each, I expect, at most 350 entries in _layers/sha256 for this repository. Instead, there are 35k entries in _layers/sha256.
Config
registry:2 is run as a container with the following config mounted. S3 storage is provided by Minio.
etc/docker/registry/config.yml
version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  delete:
    enabled: true
  s3:
    accesskey: REDACTED
    secretkey: REDACTED
    region: us-east-1
    regionendpoint: http://s3.example.com
    bucket: registry
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3

@chrisbecke the _layers directory is metadata, it's arguable that GC should remove these links, but the actual data (and thus, most of the storage) is deleted.

--delete-untagged is used to ensure each tag points to (at most) a single revision

This option does not do that — tags cannot point to multiple manifests by design.

I wrote a tool to validate my registry more exhaustively and it did find that most _layers/sha256 references point to blobs that do not exist.
Holistically the orphan entries in _layers don't cost a lot, but in a repo where ci/cd builds are frequent, having a folder grow past 30k entries actually does start to consume not insignificant resources on the server.

tags cannot point to multiple manifests by design.

I might not understand the purpose of _layers but I do know that{repo}/_manifest/tags/{tag}/index/sha256 contains the revision history for a tag that has been pushed multiple times with different manifests. Ideally it only contains one entry, and garbage-collect --delete-untagged will trim it down to the single entry that matches {repo}/_manifests/{tag}/current/link.
This mechanism means that, even if you only push :latest, you can pull specific revisions if you know that hash:
e.g. docker pull some_image@sha256:{digest}

Holistically the orphan entries in _layers don't cost a lot, but in a repo where ci/cd builds are frequent, having a folder grow past 30k entries actually does start to consume not insignificant resources on the server.

@chrisbecke that's correct, we could change the issue titled to something like "garbage-collect does not remove repository layer links" or something similar and focus on that. I'm not opposed to removing these links, but garbage collection already takes quite a while to run as registry size increases, and adding steps to this process only makes that worse. Any fix here would need to be as judicious with resources as we can.
Yes, garbage collection does clear the tag indexes of removed manifests.
I don't want to get bogged down on a tangent, but the tag indexes are not what allows images to be pulled by digest: that's the repositories/<name>/_manifests/revisions/<algorithm>/<hex digest>/link directory. For reference, registry/storage/paths.go is the most complete documentation of the filesystem structure.

For some installations, this is a serious problem.....
https://cloud-native.slack.com/archives/CC1E09J6S/p1689254834026319

@pkalemba this link points to a signup-protected page. Is there an open version?

See also: https://github.com/distribution/distribution/issues/3266

This is also a problem for us, as the continuous increase in number of files does slow down our registry mirrorring and more importantly our backup to tape storage. The last one examines each file separately, at last count we had hundreds of thousands of files in _layers that did not actually needed to be backupped. I get that this is less of a problem for backups to s3 as those can use bulk list endpoints but even then shaving off a large number of files that need to be mirrorred does save time and bandwith.
If the garbage collect deletes a blob, it has already determined those blobs are not used by anything. Removing those entries under _layers should not require too much additional work, right? It might need an additioneel sweep over the _layers directory for any layers using that address, but at least the s3 storage should be able to handle that quite efficiently with a bulk list operation.

I think this is a pretty serious problem. Unreferenced layer links are not necessary to keep. They should be removed during the garbage collection phase.
This places a burden on some slightly larger registries, which have access to this repository through the API interface, but in fact the only tags are actually deleted.
In fact, every time you delete a tag, should check to see if there are other tags.


3.14.4 addresses CVE-2022-0778

Experiment to see if 3.14.4 passes

Warnings

:warning:
Please add the JIRA issue key to the PR title (e.g. MB-123)

  Generated by :no_entry_sign: dangerJS against 829c4c284a5ef453cb224cf02d21dfc4dba281a1

It looks like the update to 3.15.x was done automatically with [at]Dependabot. If we would like this in sooner, rather than later, then maybe it makes sense to downgrade to 3.14.x. I'm not sure on what the difference is between those minor versions, but if it's not important to our project, I'm all for the path of least resistance here.
=> Dependabot upgrading to 3.15.0 from 3.14.2


Possible data loss at stream end in -w4 -l2

I got an excellent bug report from @unixdj with detailed, minimal steps to reproduce data loss at the end of the stream:
$ echo -n aaaa | ./heatshrink -e -w4 -l2 | ./heatshrink -d -w4 -l2
a   # should be "aaaa"

A [regression test][1] has been added.
[1]: https://github.com/atomicobject/heatshrink/blob/develop/test_heatshrink_dynamic.c#L919
This is not currently known to occur under any other combinations of settings except -w4 -l2, the absolute minimum.
A change that fixes this without breaking reverse compatibility would be strongly preferred.

The encoder is correct, the problem is in the decoder. The tag bit (1) plus the window size (4) plus the lookahead size (2) is only 7 bits, and the decoder can end up in a state where it has 7 bits of unprocessed data, but the end of input stream takes precedence and it prematurely indicates that it has completed.
This will not happen under any other configuration because everything else will use at least 8 bits, causing things to be buffered correctly.

I'm considering closing this by increasing the minimum lookahead size to 3, rather than adding special cases. Thoughts, @unixdj?

Resolved by 15ebaddc064e60a36b8e4f46b90c0a5a69940123 . The minimum lookahead needs to be increased to 3, because otherwise a state can occur at the end of the input whose interpretation is ambiguous, leading to either a few bytes being discarded or the last byte being repeated incorrectly.

Increasing minimum lookahead size fixes the issue, of course.
The problem with the encoder is that it encodes "a" as [0xb0 0x80], which, if the decoder is fixed not to handle the case above, may be interpreted by the decoder as:
1        tag bit: literal follows
01100001 'a'
0        tag bit: backref
0000     backref index 1
00       backref count 1

and decoded as "aa".  The encoder, however, would never produce such stream (though it would make sense to).  So in order to handle this correctly, there are two solutions:
(a) Make the decoder disregard backreferences shorter than the encoder would produce.
(b) Make the encoder fill the empty bits in the last byte with ones instead of zeroes, so the encoder would finish in the HSDS_YIELD_LITERAL state.
I would say that option (b) seems most conceptuallly sound.

Indeed. I discovered that "aa" issue while investigating the root cause of the original issue, as well.
(b) seems like a good choice, and IIRC you've already done some investigation along those lines. If that covers all the cases, then the minimum length won't need to be increased after all.
Option (a) reminded me that there may be an opportunity to improve the compression ratio slightly (breaking reverse-compatibility), added as issue #17.

Yes, I've tried (b), and I reckon it covers all the corner cases.  Here's the code:
https://github.com/atomicobject/heatshrink/compare/master...unixdj:eof42


FORTECH-53: Popup renders unnecessary text in body

Feature Added
Bug fixed on Popup component.
Comments
Removed unnecessary "centered" text from Popup. Updated tests.
Enact-DCO-1.0-Signed-off-by: Stanca Pop<EMAIL_ADDRESS>

Checklist
npm run parse - Pass ( Known parse errors: ThumbnailItem, useChainRefs )
npm run test-ui - Pass


End dimension issue

End portal and ender dragon don't generate after deleting the world

enable scan-legacy in paper.yml to fix this


How to properly remove a widget from gui

This is a little followup to #23. I'm wondering how can I remove a widget from its parent (completely destroy the widget).
From the comments in the code I suppose I should be using the following to destroy eg. button with label:
KW_DestroyWidget(widget, 1);

However this sometimes throws an error ("Segmentation fault") as can be seen the following GIFs. It seems to be random, sometimes it fails, sometimes it's fine.
By clicking any of the buttons I want to remove them with KW_DestroyWidget.

... or here

... or here

The error backtrace is always the same:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libKiWi.dylib                 	0x000000010b77d5be CalculateMouseOver + 30 (KW_eventwatcher.c:15)
1   libKiWi.dylib                 	0x000000010b77db0d MouseReleased + 253 (KW_eventwatcher.c:104)
2   libKiWi.dylib                 	0x000000010b77deff KW_ProcessEvents + 367 (KW_eventwatcher.c:151)
3   test-widget-removal           	0x000000010b653d2a main + 922 (test-widget-removal.c:66)
4   libdyld.dylib                 	0x00007fff9f302235 start + 1

Test source code:
#include "SDL.h"
#include "KW_gui.h"
#include "KW_button.h"
#include "KW_scrollbox.h"
#include "KW_renderdriver_sdl2.h"

void MouseDown(KW_Widget * widget, int button) {
    KW_DestroyWidget(widget, 1);
}

int main(int argc, char ** argv) {
    SDL_Window * window;
    SDL_Renderer * renderer;
    KW_RenderDriver * driver;
    KW_Surface * set;
    KW_GUI * gui;
    KW_Font * font;
    KW_Rect geometry = {0, 0, 480, 320};
    KW_Widget * frame, * button;
    int i;
    SDL_Event ev;
    size_t len = 0;

    /* initialize SDL */
    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_CreateWindowAndRenderer(geometry.w, geometry.h, SDL_WINDOW_RESIZABLE, &window, &renderer);
    SDL_SetRenderDrawColor(renderer, 100, 200, 100, 1);
    driver = KW_CreateSDL2RenderDriver(renderer, window);
    set = KW_LoadSurface(driver, "tileset.png");

    /* initialize gui */
    gui = KW_Init(driver, set);
    font = KW_LoadFont(driver, "SourceSansPro-Semibold.ttf", 12);
    KW_SetFont(gui, font);

    geometry.x = (unsigned)(geometry.w * 0.0625f);
    geometry.y = (unsigned)(geometry.h * .0625f);
    geometry.w *= .875f;
    geometry.h *= .875;
    frame = KW_CreateScrollbox(gui, NULL, &geometry);

    geometry.x = 10; geometry.y = 0; geometry.h = 40; geometry.w = 230;

    for (i = 0; i < 10; i++) {
        button = KW_CreateButtonAndLabel(gui, frame, "Text label", &geometry);
        KW_AddWidgetMouseDownHandler(button, MouseDown);

        geometry.y += geometry.h;
    }

    /* create another parent frame */
    while (!SDL_QuitRequested()) {
        while (SDL_PollEvent(&ev)) {
            if (ev.type == SDL_WINDOWEVENT && ev.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
                geometry.w = (unsigned)ev.window.data1;
                geometry.h = (unsigned)ev.window.data2;
                geometry.x = (unsigned)(geometry.w * 0.0625);
                geometry.y = (unsigned)(geometry.h * .0625);
                geometry.w *= .875f;
                geometry.h *= .875;
                KW_SetWidgetGeometry(frame, &geometry);
            }
        }
        SDL_RenderClear(renderer);
        KW_ProcessEvents(gui);
        KW_Paint(gui);
        SDL_RenderPresent(renderer);
        SDL_Delay(1);
    }
    KW_ReleaseFont(driver, font);
    KW_Quit(gui);
    KW_ReleaseSurface(driver, set);
    SDL_Quit();

    return 0;
}

I suppose removing a widget inside its event callback function breaks mouse over itrration by changing its parrent children widget. Could you test the following, to confirm: store widget in a temporary variable and call KW_DestroyWidget in your main loop instead of calling it directly in the click callback.

I tried this and it seems to be fine. I haven't seen any crash after few tries:
// ... the rest of the code
    int removed = KW_FALSE;
    KW_Widget *tmp_widgets[10];

    for (i = 0; i < 10; i++) {
        button = KW_CreateButtonAndLabel(gui, frame, "Text label", &geometry);
        KW_AddWidgetMouseDownHandler(button, MouseDown);

        geometry.y += geometry.h;

        tmp_widgets[i] = button;
    }

    /* create another parent frame */
    while (!SDL_QuitRequested()) {
        while (SDL_PollEvent(&ev)) {
            if (ev.type == SDL_WINDOWEVENT && ev.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
                geometry.w = (unsigned)ev.window.data1;
                geometry.h = (unsigned)ev.window.data2;
                geometry.x = (unsigned)(geometry.w * 0.0625);
                geometry.y = (unsigned)(geometry.h * .0625);
                geometry.w *= .875f;
                geometry.h *= .875;
                KW_SetWidgetGeometry(frame, &geometry);
            }
        }
        SDL_RenderClear(renderer);

        if (removed == KW_FALSE) {
            for (i = 0; i < 10; i++) {
                KW_DestroyWidget(tmp_widgets[i], KW_TRUE);
            }
            removed = KW_TRUE;
        }

        KW_ProcessEvents(gui);
        KW_Paint(gui);
        SDL_RenderPresent(renderer);
        SDL_Delay(1);
    }
// ... the rest of the code

Great. It kind of confirms what I was thinking. Widget destruction must be postponed until event processing finishes. I'll find some time to work on this. Thanks for your report!


SW-6280 Observation planting site history IDs in API

Update the observation query and search APIs to include the planting site
history ID that was active at the time the observation started. Clients can
use it to fetch the correct historical site map for a given observation.

[!WARNING]
This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

#2663  👈 (View in Graphite)
#2662
#2661
#2660
#2659
#2645
main

This stack of pull requests is managed by Graphite. Learn more about stacking.

Merge activity

Dec 6, 11:17 AM EST: A user started a stack merge that includes this pull request via Graphite.


Legend rendering problems in RTL mode

C3 version: 0.4.18
D3 version: 3.5.40
Browser: Chrome
OS: Windows 10

Hi
I have a problem with properly rendering legend in RTL mode. Below  there is a picture that shows the problem.
URL to picture: https://photos.app.goo.gl/XZDxJUoaynKdmM326

Any news about supporting RTL mode?

just add direction ltr in chart div like this.

just add direction ltr in chart div.

Kudos @2tallah , works fine


Request: customizable ghc-mod command

For my NixOS setup, I need to wrap commands in nix-shell, e.g. nix-shell --run 'ghc-mod check foo.hs --' instead of ghc-mod check foo.hs --. It would be very helpful if the commands that this plugin executes were customizable, rather than assuming they can be the same across all environments.

Workaround for other Nix users hitting this problem: I added this script which I've called ghc-mod-nix-shell to my PATH, then configured Atom to use ghc-mod-nix-shell instead of ghc-mod as the ghc-mod command.
#!/usr/bin/env bash

# Source .bashrc because this script is intended to be
# used by editors, e.g. Atom which doesn't source .bashrc,
# and we need NIX_PATH to be set correctly.
source ~/.bashrc

# Walk up the FS hierarchy until we find a shell.nix
while [ "$PWD" != "/" ] && [ ! -f shell.nix ]; do
    cd ..    echo "$PWD"
done

# If we didn't find a shell.nix, give up.
if [ "$PWD" = "/" ]; then
    (>&2 echo "No shell.nix found")
    exit 1
fi

# Arg list trick:
# https://stackoverflow.com/questions/3104209
ARGS=$(printf "%q"" " "$@")

# Run ghc-mod inside nix-shell
nix-shell --run "ghc-mod $ARGS"

The drawback to the approach I've taken so far is that it requires polluting PATH with a wrapper for every program that might need to be run inside nix-shell (things other than ghc-mod). I'd rather have a more generic wrapper, but this requires a little more flexibility in the way haskell-ghc-mod is configured.

Long story short, it's not that simple. There's a lot of commands, and those can be used in dfferent contexts (e.g. interactive/non-interactive). Adding customization to all of those is an overhead I'm personally not prepared to cope with, and I suspect most users aren't either.
What you could do in terms of simplification is create a directory e.g. ~/bin/nix-wrappers, create a single script like this (say, nix-wrap):
#!/usr/bin/env bash

# Source .bashrc because this script is intended to be
# used by editors, e.g. Atom which doesn't source .bashrc,
# and we need NIX_PATH to be set correctly.
source ~/.bashrc

# Walk up the FS hierarchy until we find a shell.nix
while [ "$PWD" != "/" ] && [ ! -f shell.nix ]; do
    cd ..    echo "$PWD"
done

# If we didn't find a shell.nix, give up.
if [ "$PWD" = "/" ]; then
    (>&2 echo "No shell.nix found")
    exit 1
fi

# Arg list trick:
# https://stackoverflow.com/questions/3104209
ARGS=$(printf "%q"" " "$@")

# get a filename this is executed with
execf="$(basename $0)"
mydir="$(dirname $0)"

# Remove this script's basedir from PATH
PATH=":$PATH:"
PATH=${PATH//:$mydir:/:}
PATH=${PATH#:}
PATH=${PATH%:}

# Just in case
export PATH

# Run $execf inside nix-shell
nix-shell --run "$execf $ARGS"

Then you could symlink nix-wrap to ghc-mod and whatnot (in the same directory or otherwise). Up to you if you want to add this dir to PATH or not, you could make due with adding that to 'Additional Path Directories'.

Thanks, good idea.
Maybe there's a way to make it a little more flexible without the difficulty of full generality? Like a ghcModFlags setting that's a list of strings to be prepended to the arg list for all calls?

Depends on what "a little" is exactly. Arbitrary command line with argument substitution is kinda out of the question for a number of reasons. Configurable --with-ghc etc is a possibility. Not sure if that would help any on NixOS though.

Okay, so I've implemented support for arbitrary ghc-mod options. See https://github.com/atom-haskell/haskell-ghc-mod#advanced-configuration. It's a little bit convoluted, but I didn't want to expose this in package settings directly; besides, per-project configuration may come in handy someday (which would be impossible with package settings).

@lierdakil @chris-martin If the failure case in nix-wrap just runs the command as is, then you can just use symlinked versions of ghc-mod, ghc-modi, hlint, cabal, etc. for any project with or without stack.

I use this with Atom and it works well. I made some tweaks to allow running the command from the original directory but using the shell.nix file found in a parent.

/cc @fresheyeball, I believe this might be relevant to the question you asked on #ghc-mod


Proguard issue Android

the issue is explained here #258

Closing this issue as we are archiving this sample. Please see https://github.com/microsoftgraph/msgraph-training-android for an Android sample.


(Solution Needed) Find average of two given numbers

I'll like to claim the issue. Happy to contribute!