[BUG] Timeout in share manager RPC call can delay RWX fast failover

Describe the bug
I found this while running some other experiments with fast failover and auto-delete of workload pods.  In one run, the dead share manager pod wasn't deleted until more than 20 sec after the lease went stale.
To Reproduce
Hard to say - appears to be sporadic.  I just enabled fast failover and did a couple of node failures with a single RWX volume and deployment workload.
Expected behavior
Fast failover cleanup sequence does not get delayed waiting for a connection timeout.
Support bundle for troubleshooting

Environment

Longhorn version:   1.7.0-rc3
Impacted volume (PV): There's only one.
Installation method (e.g. Rancher Catalog App/Helm/Kubectl):  Kubectl
Kubernetes distro (e.g. RKE/K3s/EKS/OpenShift) and version:  v1.26.14+rke2r1

Number of control plane nodes in the cluster: 1
Number of worker nodes in the cluster: 3

Node config

OS type and version:  Ubuntu 20.04.4 LTS
Kernel version: 5.4.0-192-generic
CPU per node:
Memory per node:
Disk type (e.g. SSD/NVMe/HDD): SSD
Network bandwidth between the nodes (Gbps):

Underlying Infrastructure (e.g. on AWS/GCE, EKS/GKE, VMWare/KVM, Baremetal):
Number of Longhorn volumes in the cluster: 1

Additional context

longhorn-manager-combined.log
Combined longhorn-manager output from kt.

Some key moments:
[longhorn-manager-n7hcp longhorn-manager] time="2024-08-12T19:25:33Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 702.900013ms ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-bx48j owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:32Z" level=info msg="Interim owner jbm-trial-pool2-254cd2ae-vsblf taking responsibility for stale lease-holder jbm-trial-pool2-254cd2ae-w7rd5" func="controller.(*ShareManagerController).isResponsibleFor" file="share_manager_controller.go:1608" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-w7rd5 shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-n7hcp longhorn-manager] time="2024-08-12T19:25:34Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 1.702418379s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-bx48j owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:32Z" level=info msg="Share manager got new owner jbm-trial-pool2-254cd2ae-vsblf" func="controller.(*ShareManagerController).syncShareManager" file="share_manager_controller.go:361" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-w7rd5 shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-n7hcp longhorn-manager] time="2024-08-12T19:25:34Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 1.702748423s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-bx48j owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:32Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 538.80589ms ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-n7hcp longhorn-manager] time="2024-08-12T19:25:35Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 2.702044941s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-bx48j owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:33Z" level=info msg="Marking share manager pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c delinquent" func="controller.(*ShareManagerController).syncShareManager" file="share_manager_controller.go:397" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-w7rd5 shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-n7hcp longhorn-manager] time="2024-08-12T19:25:35Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 2.702236183s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-bx48j owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:33Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 1.426572965s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

So the share manager is marked as delinquent, but no action is taken.

>> What was this we were hung up on?  This is the share-manager default port (9600).  What was the share-manager client trying to do?  Apparently a mount RPC call?
[longhorn-manager-b6fb8 longhorn-manager] W0812 19:25:53.029831       1 logging.go:55] [core] [Channel #49 SubChannel #50]grpc: addrConn.createTransport failed to connect to {Addr: "<IP_ADDRESS>:9600", ServerName: "<IP_ADDRESS>:9600", }. Err: connection error: desc = "transport: Error while dialing: dial tcp <IP_ADDRESS>:9600: i/o timeout"
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=error msg="Failed to mount share manager volume" func="controller.(*ShareManagerController).syncShareManagerVolume" file="share_manager_controller.go:666" controller=longhorn-share-manager error="failed to mount share manager pod share-manager-pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp <IP_ADDRESS>:9600: i/o timeout\"" node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 20.583225484s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=error volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

and then
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=warning msg="Lease for pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by jbm-trial-pool2-254cd2ae-w7rd5 is stale, expired 20.583383339s ago" func="controller.(*ShareManagerController).isShareManagerPodStale" file="share_manager_controller.go:1547" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=error volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=info msg="Clearing lease pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c held by node jbm-trial-pool2-254cd2ae-w7rd5 for share manager pod cleanup." func="controller.(*ShareManagerController).clearShareManagerLease" file="share_manager_controller.go:748" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=error volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

>> Why is this the first try to delete?
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=info msg="Deleting share manager pod" func="controller.(*ShareManagerController).cleanupShareManagerPod" file="share_manager_controller.go:787" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=error volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c
[longhorn-manager-b6fb8 longhorn-manager] time="2024-08-12T19:25:53Z" level=info msg="Force deleting pod to allow fail over since node of share manager pod is down" func="controller.(*ShareManagerController).cleanupShareManagerPod" file="share_manager_controller.go:797" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-vsblf shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=error volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

Looking at the code, it seems pretty clear that the share manager client was calling share manager on port 9600 to do an RPC mount call, as part of this sequence in syncShareManagerVolume https://github.com/longhorn/longhorn-manager/blob/d4ab0495f8572be2940f64a0b34099aab91b4ce3/controller/share_manager_controller.go#L665-L670
That implies that the controller sync managed to make this call just before the delinquent state was set at time="2024-08-12T19:25:33Z".

cc @PhanLe1010 @ejweber

Yeah, I think I hit this one one time in the past out of many tests. I agree that it is ok to move this ticket to v1.8.0 because:

This issue is rare
The consequence is not too bad. Fast failover is best effort feature, we will fall back to slow path with 20s second delay if this issue happens.
We don't have much time left for the 1.7.0 release

Reading the code and with a quick check with added logging, the reason for this is that share_manager_controller.go does a gratuitous Mount() RPC call in syncShareManagerVolume:  https://github.com/longhorn/longhorn-manager/blob/5b29237ed1e426ad6059ed590646c41e75356185/controller/share_manager_controller.go#L682
The call is there to ensure that a restorative remount is done in case it is necessary, I am sure.  Most of the time, the server checks its internal state and returns immediately:  https://github.com/longhorn/longhorn-share-manager/blob/a0109a0c6b137e757f8cf7c3b88221c22c479ef5/pkg/rpc/server.go#L242-L244.
The sync must have happened after the new owning controller took over, but before it marked the volume as delinquent.  Still trying to piece together the code path for that window.

That implies that the controller sync managed to make this call just before the delinquent state was set at time="2024-08-12T19:25:33Z".

Actually, that can't be true.  The GRPC call would block the sync execution (as it did, in fact, blocking deletion and creation of the replacement share-manager pod.)  The logging shows that we made it to the point of marking the stale volume/node pair as delinquent:
time="2024-08-12T19:25:33Z" level=info msg="Marking share manager pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c delinquent" func="controller.(*ShareManagerController).syncShareManager" file="share_manager_controller.go:397" controller=longhorn-share-manager node=jbm-trial-pool2-254cd2ae-vsblf owner=jbm-trial-pool2-254cd2ae-w7rd5 shareManager=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c state=running volume=pvc-e2a88db5-4baa-4526-8363-2cd9cd9da09c

which is logged just before the call:
https://github.com/longhorn/longhorn-manager/blob/52b7383715e356422dd0d636af73d933c8a89a5f/controller/share_manager_controller.go#L397-L400
The delinquent status is checked in syncShareManagerVolume before making the Mount() GRPC call:
https://github.com/longhorn/longhorn-manager/blob/52b7383715e356422dd0d636af73d933c8a89a5f/controller/share_manager_controller.go#L676-L681
And yet the call is made, so why do we think that isDelinquent is false?  Either the call to set it failed (which should have logged the failure of UpdateLease) or perhaps ClearDelinquentAndStaleStateIfVolumeIsDelinquent was called?

This might have to slip to v1.9.0, given other things in front of it.

@james-munson Please don't directly change the milestone. Can you elaborate more on why you need to put of the fix? Any obstacle? Which tickets are more important?


Vim9: inconsistent results when adding space between logical operator "!" and its operand

Describe the bug
In Vim9 script, adding a space between the logical operator ! and its operand gives inconsistent results.
To Reproduce
vim9script
if ! true
    echom 'OK'
endif

This raises E611:
E611: Using a Special as a Number

vim9script
def Func()
    if ! true
        echom 'OK'
    endif
enddef
Func()

This doesn't raise any error, and the if block is processed:
OK

vim9script
def Func()
    if !true
        echom 'OK'
    endif
enddef
Func()

This doesn't raise any error, but the if block is not processed.
Expected behavior
All of this is inconsistent.
First, the error message at the script level is unclear:
E611: Using a Special as a Number

! accepts a boolean as its operand, so the issue is not that we use a special as a number; the issue is that for some reason, the whitespace is disallowed.
Second, if there is an error message at the  script level, the same error should be raised in a :def function.  That's not the case right now.
Third, in Vim script legacy, a whitespace is allowed between ! and its operand:
if ! v:true
    echom 'OK'
endif

If it's disallowed in Vim9, it should be documented (it's not), and the error message should probably warn the user about the issue:
E1234: White space not allowed after '!'

Similar to what happens when we forget whitespace around other operators:
vim9script
def Func()
    echo 1+2
enddef
Func()

E1004: White space required before and after '+'

Environment

Vim version: 8.2 Included patches: 1-1845
OS: Ubuntu 16.04.7 LTS
Terminal: xterm(360)

If it's disallowed in Vim9, it should be documented (it's not), and the error message should probably warn the user about the issue:

Otherwise, we might get different results depending on whether we've written a space between ! and its operand, without any error being raised, which is confusing.


feat: add set_configs operation to SlurmManager

Implements a simple utility method to be able to set configs in bulk. This is required by the Slurm charms since they generate and set configs in bulk.

@jedel1043 overall, I'm good with the implementation, but I have an idea that I'd like to know your thoughts on.
Why not have set_config(...) just accept a mapping rather than two positional arguments for both key and value? That way we don't need to have two methods that somewhat implement the same functionality. Reason saying is that when I look at a method like set_config(...), I think of snapctl set ... which accepts multiple configuration arguments.
I think it could potentially be better to have just one set_config(...) method that takes in a mapping of multiple configuration options. I see us using set_configs(...) way more often than set_config(...) as we'll likely need to handle a variable amount of configuration options as they come in from relations, actions, etc. rather than granular, single option changes.
Let me know what your thoughts are :smile:

The main reason is to avoid breaking changes, but if we wanna do them, I think your suggestion would be better, yeah.

The main reason is to avoid breaking changes, but if we wanna do them, I think your suggestion would be better, yeah.

You have the right idea, but I don't think we have to worry about breaking changes right now given that this lib is very much in development, and we'll very much likely be the only consumers. Better to get it how we want it now rather than later when we're stable :sweat_smile:
Let's go ahead with the proposed approach of having set_config(...) accept a mapping rather than two positional arguments so we only have one method for getting configuration options.

#8 adds the set_config(...) functionality where you're able to set multiple Slurm configurations at once.

Superseeded by that then.


auto start does not work after the device was hang

reported by @kr1shna:matrix.org
https://github.com/matrix-org/riot-android-rageshakes/issues/844

Cannot fix this issue : ie the app was not warned that the device was rebooted.


Swift 1.2 compatible

Thanks @alexanderjarvis, but I already have a branch with these changes and more for the upcoming Swift 1.2 release: https://github.com/jpsim/PeerKit/compare/swift1p2.

Thanks, but you also removed the compatibility with older versions of PeerKit at the same time.
On 23 March 2015 at 00:54:53, JP Simard<EMAIL_ADDRESS>wrote:
Thanks @alexanderjarvis, but I already have a branch with these changes and more for the upcoming Swift 1.2 release: https://github.com/jpsim/PeerKit/compare/swift1p2.
—
Reply to this email directly or view it on GitHub.

Yes but you also removed compatibility for the older PeerKit at the same time.

On 23 Mar 2015, at 00:54, JP Simard<EMAIL_ADDRESS>wrote:
Thanks @alexanderjarvis, but I already have a branch with these changes and more for the upcoming Swift 1.2 release: https://github.com/jpsim/PeerKit/compare/swift1p2.

Reply to this email directly or view it on GitHub.

Thanks, but you also removed the compatibility with older versions of PeerKit at the same time.

Indeed. I'm still thinking about how long, if at all, we should keep the old approach.

Agreed. I am happy to move forward. I would like to make the context to be able to be set by a client of PeerKit however (to identify users). Perhaps I'll submit a PR for this when I need it.


Avatars (copy from event app)

Single Avatar added in #34, will need to discuss how the Avatars component belongs here.

Added an example of how to achieve this with CSS: https://vue-components-storybook.developer.bcc.no/?path=/docs/components-bccavatar--docs
Note that the colors are slightly different so we might have to revisit this to be less dependent on the Event app's gender/child context.


caption typography not included on page

There is a 3rd typography caption hat's absent from the docs https://flutter.moon.io/typography

Caption got removed with v1.0.0 as it had limited use-cases.


Hide the username/organization from the dashboard quick links

Description
I always found this widget noisy since long usernames/repos wrap. Now they added icons so I think they're distinguishable enough without the username. These are also the repos you interact with the most, so I suppose you don't need the full repo.
Before

After

The change can apply to the visible items, the rest of the list can stay unchanged.

Screenshot done with:
$$('.color-text-primary.lh-0.mb-2.markdown-title').forEach(x => x.firstChild.remove())
$$('.color-text-primary.lh-0.mb-2.markdown-title').forEach(x => x.firstChild.remove())

Example URL
https://github.com

I'm also confused like @yakov116, and suppose the best we can do is to do this only for your own repos.

I always found this widget noisy since long usernames/repos wrap.

I don't have many repos whose name is long enough to wrap, but in my opinion two lines are fine and three lines are rare.

Now they added icons so I think they're distinguishable enough without the username.

I would say they added it simply to be consistent with issue/pr icons below. 16px avatars are not distinguishable enough on its own, not to say many avatars just don't click.

These are also the repos you interact with the most

Not entirely correct, it is also somehow based on "frecency" i.e. how frequent and when you interact with a repo.

so I suppose you don't need the full repo.

The question is that repo names are almost always shown with <username>/<repo> etiquette, except e.g. on user/repository profile pages. I don't think the potential confusion is worth cleaning up the interface a tiny bit.

Not entirely correct, it is also somehow based on "frecency" i.e. how frequent and when you interact with a repo.

Whatever the exact metric, if they're up there you likely know all of them by name, right? That's why IMHO they should be hidden.

Then let's try, if people don't like it we can just disable it.

Too many feature requests, realistically we’ll never get there. I’m closing those I think aren’t worth it. If it was accepted before, I may still accept a PR in the next 6 months.


testMatchers are ignored in generated tests

We have created Contract with testMatchers according to the documentation. But when tests are generated then wrong assertions are created.
We are using version 1.0.5 because 1.1.2 have to many changes for example added root folder to stubsOutputDir.
For example we have
import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'GET'
        urlPath(path)
    }
    response {
        status 200
        headers {
            header 'Content-Type': value(test(regex('application/json(;.*)?')), stub('application/json;charset=UTF-8'))
        }
        body(events: [[
                                 operation          : 'EXPORT',
                                 eventId            : '16f1ed75-0bcc-4f0d-a04d-3121798faf99',
                                 status             : 'OK'
                         ], [
                                 operation          : 'INPUT_PROCESSING',
                                 eventId            : '3bb4ac82-6652-462f-b6d1-75e424a0024a',
                                 status             : 'OK'
                         ]
                ]
        )
        testMatchers {
            jsonPath('$.events[0].operation', byRegex('.+'))
            jsonPath('$.events[0].eventId', byRegex('^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$'))
            jsonPath('$.events[0].status', byRegex('.+'))
        }
    }
}

and generated test looks like
import com.jayway.jsonpath.DocumentContext
import com.jayway.jsonpath.JsonPath

import static com.jayway.restassured.RestAssured.*
import static com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson

class EventSpec  {

	def validate_listEvents() throws Exception {
		given:
			def request = given()

		when:
			def response = given().spec(request)
					.get(urlPath")

		then:
			response.statusCode == 200
			response.header('Content-Type') ==~ java.util.regex.Pattern.compile('application/json(;.*)?')
		and:
			DocumentContext parsedJson = JsonPath.parse(response.body.asString())
			assertThatJson(parsedJson).array("['events']").contains("['eventId']").isEqualTo("16f1ed75-0bcc-4f0d-a04d-3121798faf99")
			assertThatJson(parsedJson).array("['events']").contains("['operation']").isEqualTo("EXPORT")
			assertThatJson(parsedJson).array("['events']").contains("['operation']").isEqualTo("INPUT_PROCESSING")
			assertThatJson(parsedJson).array("['events']").contains("['eventId']").isEqualTo("3bb4ac82-6652-462f-b6d1-75e424a0024a")
			assertThatJson(parsedJson).array("['events']").contains("['status']").isEqualTo("OK")
		and:
			assertThat(parsedJson.read("\$.events[0].operation", String.class)).matches(".+")
			assertThat(parsedJson.read("\$.events[0].eventId", String.class)).matches("^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\$")
			assertThat(parsedJson.read("\$.events[0].status", String.class)).matches(".+")
		}
}

Why is the wrong assertion created?
You wanted
 jsonPath('$.events[0].operation', byRegex('.+'))
            jsonPath('$.events[0].eventId', byRegex('^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$'))
            jsonPath('$.events[0].status', byRegex('.+'))

you got
assertThat(parsedJson.read("\$.events[0].operation", String.class)).matches(".+")
			assertThat(parsedJson.read("\$.events[0].eventId", String.class)).matches("^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\$")
			assertThat(parsedJson.read("\$.events[0].status", String.class)).matches(".+")

It's exactly the same what you requested.

Yes i have this but i have those additional assertions.
assertThatJson(parsedJson).array("['events']").contains("['eventId']").isEqualTo("16f1ed75-0bcc-4f0d-a04d-3121798faf99")
			assertThatJson(parsedJson).array("['events']").contains("['operation']").isEqualTo("EXPORT")
			assertThatJson(parsedJson).array("['events']").contains("['operation']").isEqualTo("INPUT_PROCESSING")
			assertThatJson(parsedJson).array("['events']").contains("['eventId']").isEqualTo("3bb4ac82-6652-462f-b6d1-75e424a0024a")
			assertThatJson(parsedJson).array("['events']").contains("['status']").isEqualTo("OK")

Our application is not able to return exactly those events with that id.
And also this is only the piece of it our stub have 20 elements in events array. So it is very hard to provide them from real application.

Those assertions are there cause you need to provide also assertions for $.events[1] entries. In your case you can actually create a testMatcher for the whole $.events array and execute byCommand(...) where you will provide the coded assertion. That way you will assert precisely what you need. Does it make sense?

After adding
jsonPath('$.events', byType {
                minOccurrence(1)
            })

I have desired assertions but they are not working.
I do not know if it is connected with this but i have error like this:
Condition failed with Exception:

    assertThat(parsedJson.read("\$.events[0].operation", String.class)).matches(".+")
    |          |          |
    |          |          ORDER_ACK
    |          com.jayway.jsonpath.internal.JsonContext@711a4711
    groovy.lang.MissingMethodException: No signature of method: order.EventSpec.assertThat() is applicable for argument types: (java.lang.String) values: [ORDER_ACK]
        at order.EventSpec.validate_listEvents(EventSpec.groovy:27)

        Caused by:
        groovy.lang.MissingMethodException: No signature of method: order.EventSpec.assertThat() is applicable for argument types: (java.lang.String) values: [ORDER_ACK]
            at order.EventSpec.validate_listEvents(EventSpec.groovy:27)

What the hell is it? :D order.EventSpec.assertThat() looks like a bad import. Can you show the whole generated test? Also the configuration of the plugin?

Generated Specification:
package pwc.v3.mno.order

import com.jayway.jsonpath.DocumentContext
import com.jayway.jsonpath.JsonPath
import pwc.BaseContractSpecification

import static com.jayway.restassured.RestAssured.*
import static com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson

class EventSpec extends BaseContractSpecification {

	def validate_listEvents() throws Exception {
		given:
			def request = given()

		when:
			def response = given().spec(request)
					.get(urlPath)

		then:
			response.statusCode == 200
			response.header('Content-Type') ==~ java.util.regex.Pattern.compile('application/json(;.*)?')
		and:
			DocumentContext parsedJson = JsonPath.parse(response.body.asString())
		and:
			assertThat(parsedJson.read("\$.events[0].operation", String.class)).matches(".+")
			assertThat(parsedJson.read("\$.events[0].eventId", String.class)).matches("^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\$")
			assertThat(parsedJson.read("\$.events[0].status", String.class)).matches(".+")
			assertThat((Object) parsedJson.read("\$.events")).isInstanceOf(java.util.List.class)
			assertThat(parsedJson.read("\$.events", java.util.Collection.class).size()).isGreaterThanOrEqualTo(1)
	}

}

Configuration:
contracts {
    targetFramework = TestFramework.SPOCK
    testMode = TestMode.EXPLICIT
    generatedTestSourcesDir = project.file("$project.buildDir/generated-src/test")
    contractsDslDir = file("$project.buildDir/contracts")
    contractsWorkOffline = true
}

and another one
contracts {
    basePackageForTests = 'pwc'
    baseClassForTests = 'pwc.BaseContractSpecification'
}

Which version of sc-contract are you using?

Written in first post: 1.0.5.RELEASE

Yeah, sorry - I think I'm getting blind ;) Can you see if you have the same error in 1.1.3.RELEASE?

The is no 1.1.3.RELEASE. I used 1.1.2.RELEASE. Did not help.

That's super strange... Can you try to generate that in Java and not in Spock and see if it's working fine?

I think it's a bug in Spring Cloud Contract that the static import org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions.assertThat is not added for Spock...  As a workaround you can pass to the gradle configuration the staticImports property.
contracts {
    basePackageForTests = 'pwc'
    baseClassForTests = 'pwc.BaseContractSpecification'
    staticImports = ["org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions.assertThat"]
}

After adding staticImports it works now.
But i think that you could add information to docs that if we want to use testMatchers other assertions will be generated unless we add assertion for whole $.events.

I was more than sure that I've added it to the docs but actually I can't find it ;) I'll fix the spock issue and update the docs

So i think that you can close this issue unless you want to change it to spock issue connected task.

BTW. There is also a problem with those assertions
Condition failed with Exception:

    assertThat(parsedJson.read("\$.events", java.util.Collection.class)).hasSizeGreaterThanOrEqualTo(1)
    |          |          |                                              |
    |          |          |                                              org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: org.assertj.core.api.ListAssert.hasSizeGreaterThanOrEqualTo() is applicable for argument types: (java.lang.Integer) values: [1]
    |          |          [[operation:ORDER_ACK, eventId:e519c8a7-833f-11e7-8c2a-0fe78575f9a5, status:OK, creationTime:2017-08-17T11:33:30.794Z, transactionId:e519c8a7-833f-11e7-8c2a-0fe78575f9a5, parentTransactionId:e519c8a7-833f-11e7-8c2a-0fe78575f9a6, serviceName:PGS, quantity:1, flowId:2b1ab407-ac45-11e6-8a8d-c50e9760d1b6, type:FINAL, messages:[]]]
    |          com.jayway.jsonpath.internal.JsonContext@65ea9ff4
    org.assertj.core.api.ListAssert@1
        at pwc.v3.mno.order.EventSpec.validate_listEvents(EventSpec.groovy:40)

        Caused by:
        org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: org.assertj.core.api.ListAssert.hasSizeGreaterThanOrEqualTo() is applicable for argument types: (java.lang.Integer) values: [1]

You have this problem in which version of sc-contract?

1.1.2.RELEASE

Ping @adamkrol93 ?

I think so. We have
springContractVersion=1.1.2.RELEASE

classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:$springContractVersion"

and
"org.springframework.cloud:spring-cloud-starter-contract-verifier:$springContractVersion",

That is superstrange... Can you ensure that you have the proper import static to SpringCloudContractAssertions.assertThat  in the generated test?

Here are imports in generated tests:
import com.jayway.jsonpath.DocumentContext
import com.jayway.jsonpath.JsonPath
import com.oberthur.dps.pwc.BaseProfileWarehouseContractSpecification

import static com.jayway.restassured.RestAssured.*
import static com.toomuchcoding.jsonassert.JsonAssertion.assertThatJson
import static org.springframework.cloud.contract.verifier.assertion.SpringCloudContractAssertions.assertThat

So that looks fine... Do you still get the same exception? If that's the case I think I'll need a sample project cause I have no idea what's going wrong with this issue

Actually, I think I've managed to find the reason for this! I think that something has changed on the AssertJ side. I know how to fix this - I'll fix it today

Nice. Looking forward to test it.


Modify progression

From @czartchonn.  "Any chance for a option where you can slow down the xp you get? Hate it when you reach the cap early in a game and it adds difficulty too. Maybe a slider or an option for 75% to 50% received.".
I suggest a slider to alter XP received from say 50% to 200% of normal.
I'm happy to have a go at that.  Seems easy enough :)

I always try to find something to slow down progression in most RPG. Almost all suffer from hitting the level cap far too early - making the game a breeze plus taking out the fun of progression. Hope it is easy to do :)

@PhilPJL , what should be fairly easy to do is add a percentage slider and patch the method that grants experience and change result to be original exp * multiplier.

I believe this should go under House Rules. Agree @ChrisPJohn ?

pushed. put under Tools as we already deal with exp. there.

Hey I was going to do that :(
Anyway check out https://github.com/ChrisPJohn/SolastaCommunityExpansion/blob/ScaleExperienceReceived/SolastaCommunityExpansion/Patches/SrdAndHouseRulesContext/GrantExperienceExecutePatcher.cs

Shouldn't have gone for a bike ride.

Glad you are back riding 😜

Will change to your math round fix

It's not so easy after all because of FunctorGrantExperience which can grant enough XP to move all characters up to a specific level.  We need to disable scaling in that scenario, but a simple flag set on Prefix and reset on Postfix doesn't work because the functor logic is async.  Ideas?

I believe this is done and in the released build, so closing the request.


Automate Token Pricing

Problem
Token Asset Pricing currently requires an explicit manual effort which could be eliminated.
The current token listing process is fragmented between a few different files (e.g., ibc-assets.ts, chain-infos.ts, prices.ts, images/tokens/, etc.). In addition, some users or teams prefer to use the Osmosis frontend to add liquidity, which may require that the token listing process requires multiple rounds (one for adding the (chain and) token details, and another for defining the pricing for the token).
The Osmosis Frontend currently uses two ways different way to get the price of a token. In some cases, the token's price can be determined by sending an Id to CoinGecko's API, which can be specified in the Chain-infos.ts file; while in other cases, the price can be derived by looking at the Osmosis-local exchange rate between a token and another token with known price, which is defined in the prices.ts file.
Solution
With a clear algorithm and sufficient liquidity of the new token in a set of pools that can ultimately be swapped for OSMO, we could automate the process of defining this manually. This would reduce the extra round required to complete a token listing, eliminate the need for a prices.ts file, provide higher quality and adaptable prices, and reduce the number of calls to external APIs (e.g., CoinGecko).
As an additional benefit, this could also be used to service the function determining Osmosis gas fees in the form of tokens that aren't OSMO (because that fee payment really gets swapped to OSMO in the backend).

Closing since it's an idea in ClickUp. Can reopen if pursued.


Not able to use pip-accel both globally and inside a virtual environment

I've installed pip-accel globally, but when I try to use it inside a virtual environment I get this error:
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip_accel/cli.py", line 56, in main
    accelerator = PipAccelerator(config)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip_accel/__init__.py", line 109, in __init__
    self.validate_environment()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip_accel/__init__.py", line 141, in validate_environment
    """, environment=environment, prefix=sys.prefix)
EnvironmentMismatchError: You are trying to install packages in environment #1 which is different from environment #2 where pip-accel is installed! Please install pip-accel under environment #1 to install packages there.

This is caused by validate_environment, which doesn't make much sense. Since pip-accel uses pip under the hood, why should I have to install another version of pip-accel inside every virtual environment? The kicker is that if pip-accel is already installed globally, pip won't even let you install it inside a virtual environment. It's either one or the other.

This is caused by validate_environment, which doesn't make much sense.

Clearly it was a conscious choice to add that code, so just saying "it doesn't make much sense" is not the best way to start this conversation :-).

Since pip-accel uses pip under the hood, why should I have to install another version of pip-accel inside every virtual environment?

When you create a virtual environment the virtualenv tool will automatically install a copy of pip inside the virtual environment. Unfortunately pip-accel doesn't get the same treatment, because virtualenv doesn't know about pip-accel.
In older versions of pip-accel this used to bite unsuspecting users which is why the check was added; mixing global installations and virtual environments can cause a wide variety of issues, some of them very obscure and non-obvious, so shielding users from this mistake seemed like the only reasonable option.

The kicker is that if pip-accel is already installed globally, pip won't even let you install it inside a virtual environment. It's either one or the other.

This is not an absolute truth, it's a bit more subtle (IIUC):

Old versions of virtualenv will (by default) create virtual environments that can also import packages that are installed system wide. This is the --system-site-packages command line option.
New versions of virtualenv will (by default) create virtual environments that can't import packages that are installed system wide. This is the --no-site-packages command line option.

I assume that with the new behavior you should not be seeing this problem at all; pip should be able to install pip-accel just fine because it will realize that the pip-accel installed system wide is not visible inside the virtual environment.

Clearly it was a conscious choice to add that code, so just saying "it doesn't make much sense" is not the best way to start this conversation :-).

Sorry about that! Should have added ".. to me."

New versions of virtualenv will (by default) create virtual environments that can't import packages that are installed system wide. This is the --no-site-packages command line option.

Ok, it turns out I am using --no-site-packages but the virtualenv can still see them due to how my PYTHONPATH is setup. So I guess my options are to reset PYTHONPATH or uninstall pip-accel globally.

I have more experience in (ab)using $PYTHONPATH than I care to share here ;-) but on the upside I have run into this exact same issue before, so I can give some hints:

Stop customizing $PYTHONPATH because it will bite you again :-). I know this isn't always an option (it wasn't in my use case), but I thought I should mention it anyway!

Clear the $PYTHONPATH before invoking pip. One simple way to do so is to run pip as follows:
 $ PYTHONPATH= pip install pip-accel

This will clear the environment variable for this single command, but leave it untouched for the remainder of your shell session.

Change your pip installation command as follows:
 $ pip install --ignore-installed pip-accel

I hope one of these suggestions helps, please let me know! Maybe I can turn this into a bit of documentation (which is really more relevant to pip than to pip-accel, but given that pip-accel wraps pip maybe I should document this anyway).

Great, thanks for the additional options. I went with the first, since I don't need the path customization any longer. It's working now! However, I think it would be great if there was a way to use pip-accel globally :).


Update dependencies

Update dependencies to use newest JsonSchema.Net
I tried following the pattern in JsonSchema repository for keyword changes, and also fixed anything that was causing build breaks:

Json.More does not provide JsonNode.Copy any more -- replaced it with native JsonNode.DeepClone
JsonNull was replaced by .net's null
JsonPointer does not have .Segments property any more and itself is an enumerable of segments
Use WeaklyTypedJsonConverter for all keywords, following the pattern in JsonSchema.Net
Lazily initialize Draft4MetaSchema as keywords need to be registered before its initialization
I am not entirely sure why NullableKeywordJsonConverter change was required, but without that it was serializing nullable as "nullable": "nullable": true

@gregsdennis sorry I did not notice your PR, I'll close this one


Consumption of messages pause after 10mins

In my application I create 3 consumers each consuming from 8 partitions (total 24).
Application runs smoothly by consuming message for around 10mins from startup.
Then I get 1 or 2 INFO messages like the following in my logs:
INFO  [2016-01-26 01:40:07,221] org.apache.kafka.clients.consumer.internals.AbstractCoordinator: Attempt to heart beat failed since the group is rebalancing, try to re-join group.
Resulting in consumption lag to be increased and after a while a portion of the consumer/partitions begin to consume messages again, some other consumer/partitions seem to never start again.
I am on the default parameters (for dispatchers). Is these a bug? or is it related to my configurations?
Please let me know with ideas/comments and if there are extra stuff you need so I could elaborate
Thanks in advance

Hi @dmtrs, are you using reactive Kafka 0.9?

@kciesielski

Yes I am using kafka 0.9
I am using auto commit

Yesterday I got a smooth run for about 3 hours with 1 Consumer instead of 3.
I will try to run more tests on this.
Do you think changing the kafka thread pool options will help?

@dmtrs I don't think it's related, but if it's not a problem then why not. I'm suspecting that it's caused by this Kafka bug I pasted, unfortunately the only option to verify is to build last Kafka snapshot from sources.

@kciesielski thats exactly what I did. Running smoothly for almost an hour with rebalancing events.
For future references the steps I did where:

Download the trunk branch from apache/kafka
Build the clients package
Added it on my lib/ directory (simple project for my sbt)
Used the following in my build.sbt file:

libraryDependencies += "org.xerial.snappy" % "snappy-java" % "<IP_ADDRESS>"
libraryDependencies += "net.jpountz.lz4" % "lz4" % "1.2.0"
libraryDependencies += "org.apache.kafka" % "kafka-clients" % "<IP_ADDRESS>" % "provided"

libraryDependencies ++= Seq(
  "com.softwaremill.reactivekafka" %% "reactive-kafka-core" % "0.9.0"
  exclude("jline", "jline")
  exclude("org.apache.kafka", "kafka-clients")
)

Closing the issue

Hi, we also have this issue, but with 5 minutes delay instead of 10. We found that the config "metadata.max.age.ms" with 3000ms correct this bug. Is it really a bug? Can you confirm this? Thank you.


Fixes "next week" and similar modifier + unit pairs in nlp()

Fixes #87 for which I had previously employed a workaround in my application to pre-process transform next month to in 1 month. I am submitting this as a pull request in the hope of some feedback or additional test cases. nlp() is somewhat under-tested; while I was able to find and fix a few resulting issues there are probably more cases to test. I would like to have a few eyes on this before I merge it in.
Adjacency of modifier and unit
It would not be acceptable to pull out standalone units as dates; simply mentioning the word "week" does not imply a specific date. Instead I required that these units be immediately preceded by a modifier, such that next week parses as a date but neither A week is a long time nor Next I will rest for a week parse as dates.
Handling of number + unit pairs was not consistent
One detail of the orginal nlp implementation stuck out to me. In the code that processes matches, there is a comment about proximity of terms and making logical combinations of phrases. Inside the loop, only phrases representing a date or time are parsed (excluding the third type, units). Only on the last iteration were units considered (if date or time or units: outside the loop vs if date or time: inside the loop).
I added units within the loop, which could be a source of regression errors if there was a specific reason for that decision. I noticed that the test for nlp was passing only because the number + unit phrase in 5 minutes coincidentally appeared as the last matched phrase in the test. Move that sentence (And in 5 minutes I'm going to eat some food!) to the beginning of the test string and the test fails.
@geoffreyfloyd, it was a few years ago but do you happen to remember if there was a reason the units were only checked outside the loop in 9401d0d1b6b400710af66fc9dc01d137288cdb3a?
Postfix modifiers?
In some locales such as Spanish the modifier follows the unit. For example, the English phrase next month could be any of the following in Spanish: el próximo mes, el mes que viene, el mes siguiente. I am unsure whether parsedatetime supports such postfix modifiers in parse(), but this commit will not support that format.

To answer my own question, "ago" is an English postfix modifier that does work in parse. Most of the modifiers wouldn't make sense in natural language without a numeric value, but "prior" is one that could be used as prefix or postfix. "The prior month" and "the month prior" might both be legitimate phrases, in which case "the month prior" fails with my current implementation.
Perhaps a better solution would be to determine what logic might be needed to define valid combinations of formats as alluded to in the TODO.

First, let me say that I really appreciate you taking the time to work on this - I love this project a lot but haven't had the time to really give the code a good refreshing.
I took a quick look at the code and it feels right, but i'm going to let some of the others weigh in.

Looks good to me too. But be caution with text like "next 5d", "last 3h". The word boundary in RE_UNITS_ONLY may cause mismatch (just instinct, haven't test it).

Fortunately I think that any cases with numbers like that are handled by QUNITS and UNITS. Since the number will come before the unit (at least in English...), UNITS and QUNITS matches will always take precedence over a standalone unit based on how the nlp parsing works (test all cases against the substring, take the closest to index 0 as the match, then move the substring start to the end of that match and start again).
I think that I am satisfied enough with this to merge since it fixes a few very common expressions, but I'll tumble it around in the back of my mind for the rest of the day. It's not perfect but I feel that prescribing valid sequences of matches would take much more effort to get right.
I'm concerned that it should be at the bottom rather than the top of nlp, since leftmost_match is replaced only if the previous match is > the current index, not >=. It could override something else if there is a longer phrase that starts with a unit. Alternatively, maybe in all cases leftmost_match should be replaced if the index matches but the current phrase is longer than the one already in leftmost_match... I should be able to find some test cases along that line of thought.

Agreed. There's no obvious bug or error in your code. I think it's good for merge and people can submit issues if they have encountered any problem.

+1 for merge - and your hunch about needing to be at the bottom feels right

Thanks for the review!

I know this is almost a month late, but to answer, there was no logic to excluding the unit test within the loop. It was a bug. Kudos for the fixes and strengthening the tests.

clarification for future readers is never late - thanks for the update!


Small corrections in the text

Changed "© 2017 FOSS@Amrita" to " © amFOSS'18".

There was a small merge conflict. I have fixed it for the time being. Please do confirm that there are no such conflicts again will writing a pull request again. :)


InternalError when run the initial project created by react-native-cli

When I used react-native-cli to create my first react-native project and run it in XCode. It just failed and showed some errors.

Error messages shown in terminal:
[01:21:41] <START> fs crawl
Error: failed to parse query: must use ["allof", expr...]
    at BunserBuf.<anonymous> (/Users/Song/tmp/Awesome/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/index.js:93:23)
    at emitOne (events.js:77:13)
    at BunserBuf.emit (events.js:169:7)
    at BunserBuf.process (/Users/Song/tmp/Awesome/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/bser.js:289:10)
    at /Users/Song/tmp/Awesome/node_modules/react-native/node_modules/sane/node_modules/fb-watchman/bser.js:244:12
    at doNTCallback0 (node.js:407:9)
    at process._tickCallback (node.js:336:13)

Environment

iojs 3.0.0
Xcode Version 6.4 (6E35b)
watchman 3.3.0

Having the same problem. I tried updating watchman to the HEAD version but didn't fix. When I brew uninstall watchman I get
<START> fs crawl
<END>   fs crawl (2903ms)

but with watchman installed, it hangs forever on
<START> fs crawl

and I get the same issue as @foolyoghurt

If I change the react-native version to 0.6.0（now I use 0.9.0） in package.json and delete node_modules to rerun npm install, it works. However, cmd + R doesn't refresh as expected.

I have the same issue.
It seems is related with https://github.com/facebook/watchman/issues/134.

Moving project out of my Dropbox folder resolves the issue for me.

@AbrahamAlcaina I update the latest watchman but it still doesn't, now I just use nodemon -e js -x "npm start" to restart the service when some javascript file changes.

I solved It doing a downgrade of iojs from 3.0 to 2.5.

Was having the same issue. I uninstalled watchman & installed it again.

I've downgraded iojs from 3.0 to 2.4 and reinstall the lastest watchman, but it still doesn't work. There seems to have some problem with watchman, but I don't know why Facebook can not fix this problem and why they use watchman(I find so many errors related to watchman when I use google)

@foolyoghurt - watchman is well suited for Facebook's needs internally but maybe not always the best for oss users :(
If you create a new project does that work? When you install watchman, try installing from head: brew uninstall watchman && brew install watchman --HEAD

I had this problem when trying to run a new React Native app. @brentvatne helped me on Slack.
A lot of combinations didn't work, and what I ended up doing was go to install watchman from source:
https://facebook.github.io/watchman/docs/install.html
I'm running on Node 4.1.0, NPM 2.14.3, Yosemite.

I was encountering this same issue with react-native 0.11.1 and Node 4.1.0. I tried all the solutions others mentioned in the thread to no avail, including rolling back to previously working versions of my project and previously working versions of node and dependant node modules. Attempting to reinstall watchman, react-native and other modules had no effect. It was only after I completely removed NVM and reinstalled NVM, Node 4.1.0 and then all project dependancies that I was able to run my project without getting this error. I am now good to go on react-native 0.11.1 with Node 4.1.0.

@graemeasher did you perhaps reinstall xcode as well? I've tried blowing away everything node, including the versions I had in brew, and reinstalled. Still having that error.
Are you creating projects via react-native init 'name'? or do you have it cloned? What version of XCode are you using? Did you have anything to do with Python path for some of the node modules?
Sorry about the bombardment of questions.

@dzjin I did not reinstall Xcode. And yes I am creating projects via react-native init. I was running Xcode 7.0.1 on OSX 10.10 at the time of my last post. I am now running 10.11.1 with no issues. No Python involved to the best of my knowledge.

Reinstalling nvm and watchman solved it for me. Running Xcode 7.0.1 and OSX 10.11.

I had the same error, for me it had to do with some strange issue in OS X where a directory was capitalized but also somehow not capitalized at the same time. I solved the issue by renaming the directory.

@facebook-github-bot answered

jsierles commented on Mar 20, 2016
@facebook-github-bot answered

Hey @jsierles, I am also getting this error and can not find a way to fix it. Could you, please, pin me to the answer?


Separate extractor installation and configuration steps

Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/725
Originally created by @gtsiolis on 2019-06-18 18:04:19

Problem
Currently, when you try to install and add settings for a new extractor the steps are combined in a modal dialog. This causes confusion on whether the user is ready to add settings data or they should wait for the loading indicator to finish (which never does).
Proposal

Upon clicking Install, keep the spinner along a text label Installing within the button.
Do not force open the modal dialog for adding configuration.
Only once the installation is finished, update the buttons following the current behavior and show Account Settings and Uninstall buttons.

View 6 previous comments from the original issue on GitLab


transactions for a block should be listed in the order that they exist in the block

"d33b00cb796d3fd510470a2dff741a5534c457d6e9468fc57dd122cbaeb2351c",
"02c8ede0b6c950a2067ab31fbfe162bf9614712fe673bd15ad4e55bbe54afbbb",
"98e93843c1d442e276761b387c260d0e620011b823f32b65eb28073c7a1fccf7",
"b8d2725b2f8e65de95a78114e6ac1dc728208a5989d1e5d65761197798bc2ca2"

vs

we will have to add a sequence number column in chainquery. Currently we don't store this value for a transaction so there is no way for explorer to sort them properly. Will create/link issue.

I don't see a column indicating sequence number in Chainquery. https://chainquery.lbry.io/api/sql?query=SELECT%20*%20from%20transaction%20WHERE%20block_hash_id=%225faccc32a3fd3b9fb62589df94775cd8f2fb5b0fc5207820f6986ae84a16db72%22%20LIMIT%2010
Is there an issue to add it ?

I don't see a column indicating sequence number in Chainquery. https://chainquery.lbry.io/api/sql?query=SELECT%20*%20from%20transaction%20WHERE%20block_hash_id=%225faccc32a3fd3b9fb62589df94775cd8f2fb5b0fc5207820f6986ae84a16db72%22%20LIMIT%2010
Is there an issue to add it ?


Contract testing for finders

I had to tweak the output slightly and some of the dummy data in the test to make
it valid. I've made a change in govuk-content-schemas to cover the
additional fields in specialist-publisher finders, hence the build failure. Once this is merged, it should pass: https://github.com/alphagov/govuk-content-schemas/pull/32

Tests are now passing


Export selected objects

Is it possible to export a selection of objects? It would be nice to have an export of objects in some folder (so export all objects within folder). Or does an jArchi script already exists for this functionality?

Hi, what export format did you have in mind?

Oh yes sorry, just the ordinary csv-export. And I am already happy with just the 'elements' csv format.

Hi, the CSV export implementation exports all elements, relations, and properties for the whole model so it would be difficult to re-write that code for a specific use case. There may be a jArchi script out there that does this, though.

Yes I know, I was hoping I could have / find that script 'out there'... Or maybe that it is simple to change the standard script to work only on a selection of objects but I am not able to change the script in this way.

The examples jArchi script (is the same as the standard export functionality in Archi I presume?)

The examples jArchi script

I guess you mean the "Export to Excel" one. If so, you could change this part:
$("element").each(function(e) {
    excel.set(0, 0, current_row, e.name);
    excel.set(0, 1, current_row, e.documentation);
    excel.set(0, 2, current_row, e.id);
    excel.set(0, 3, current_row, e.type);
    excel.set(0, 4, current_row, e.specialization == null ? "" : e.specialization);

    current_row++;
});

Instead of using $("element") as the selector ("all elements") you could change it to get the currently selected folder and all elements in that folder.
If you get stuck, it's probably best to discuss on the Archi Forum, as there are some jArchi experts who might offer some advice.

Assuming that you select a folder in the models tree, the jArchi selection will give you the selected folder. Then you can use children to get the child elements:
selection.children().each(function(e) {

(Reference - https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Collection)

Magnificent! I did not know where to look, and it works now. Thank's a lot!!

You're welcome. If you do get into jArchi more, please do discuss on the Archi Forum! :-)


Add a License to Project

Hey,
I wonder what kind of license I should add to this project.

I added the LICENSE file


[QUESTION] Notification not working

Hi there,
I can't get the notifications to work, I followed the attached procedure:
(menu + config + route + controller)
https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Special-Menu-Items#navbar-notification
For the moment I just copy/paste the code before continuing to implement with my database.
and I'm just this:

I must have missed a step, or misunderstood something
        [
            'type'         => 'navbar-notification',
            'id'           => 'my-notification',
            'icon'         => 'fas fa-bell',
            'url'          => 'notifications/show',
            'topnav_right' => true,
            'dropdown_mode'   => true,
            'dropdown_flabel' => 'All notifications',
            'update_cfg'   => [
                'route'  => ['notifications.get', ['param' => 'val']],
                'period' => 30,
            ],
        ],

Route::get('notifications/get', 'NotificationsController@getNotificationsData')->middleware(['auth'])->name('notifications.get');
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class NotificationsController extends Controller
{
    /**
     * Get the new notification data for the navbar notification.
     *
     * @param Request $request
     * @return Array
     */
    public function getNotificationsData(Request $request)
    {
        // For the sake of simplicity, assume we have a variable called
        // $notifications with the unread notifications. Each notification
        // have the next properties:
        // icon: An icon for the notification.
        // text: A text for the notification.
        // time: The time since notification was created on the server.

        $notifications = [
            [
                'icon' => 'fas fa-fw fa-envelope',
                'text' => rand(0, 10) . ' new messages',
                'time' => rand(0, 10) . ' minutes',
            ],
            [
                'icon' => 'fas fa-fw fa-users text-primary',
                'text' => rand(0, 10) . ' friend requests',
                'time' => rand(0, 60) . ' minutes',
            ],
            [
                'icon' => 'fas fa-fw fa-file text-danger',
                'text' => rand(0, 10) . ' new reports',
                'time' => rand(0, 60) . ' minutes',
            ],
        ];

        // Now, we create the notification dropdown main content.

        $dropdownHtml = '';

        foreach ($notifications as $key => $not) {
            $icon = "";

            $time = "{$not['time']}";

            $dropdownHtml .= "{$icon}{$not['text']}{$time}";

            if ($key < count($notifications) - 1) {
                $dropdownHtml .= "

";
            }
        }

        // Return the new notification data.

        return [
            'label'       => count($notifications),
            'label_color' => 'danger',
            'icon_color'  => 'dark',
            'dropdown'    => $dropdownHtml,
        ];
    }
}

I tried to do dump and die, but I never get the stop. An idea ?

I have errors in the console obviously

Ok find, since laravel 8 the controller path must be absolute:
Route::get('notifications/get', 'App\Http\Controllers\NotificationsController@getNotificationsData')->middleware(['auth'])->name('notifications.get');

Hi @SMEWebify
I couldn't figure it out. could you help me please?

@hi @sayedahmadnawid
Simply the class is poorly defined in the routes file.
Do you have a specific case?
Regards


Remove firebase_analytics

I've submitted my APK for inspection to the exodus service.
It detects the signatures of firebase_analytics.
How can we remove the code entirely? We're not using analytics.
https://reports.exodus-privacy.eu.org/en/reports/91532/

Are you using any Firebase?

Nope.
name: Okuna
description: Social Network

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 0.0.52+59

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  html: ^0.14.0+2
  expandable: ^2.2.2+3
  uuid: ^2.0.1
  flutter_image_compress: ^0.6.3
  inview_notifier_list:
    git:
      url: https://github.com/OkunaOrg/inview_notifier_list.git
      ref: c74749a052f91fbdd11fad959c2c59d0d10c7695
  connectivity: ^0.4.4
  flutter_widgets: ^0.1.6
  http_retry: ^0.1.1+3
  flutter_exif_rotation: ^0.2.2
  video_thumbnail: ^0.1.5+1
  flutter_ffmpeg: ^0.2.7
  open_iconic_flutter: ^0.3.0
  shared_preferences: ^0.5.2
  flutter_markdown: ^0.2.0
  file_picker: ^1.3.8
  sentry: ^2.2.0
  screen: ^0.0.5
  back_button_interceptor: ^4.0.1
  flutter_colorpicker: any
  intercom_flutter: ^1.0.11
  device_info: ^0.4.0+1
  flutter_pagewise: ^1.2.2
  tinycolor: ^1.0.2
  onesignal_flutter: ^2.0.2
  flutter_advanced_networkimage: ^0.5.0
  dcache: ^0.1.0
  validators: ^1.0.0+1
  url_launcher: ^4.0.1
  uni_links: ^0.1.4
  flutter_slidable: "^0.4.9"
  flutter_cache_manager: ^1.1.1
  cached_network_image: ^1.1.1
  timeago: ^2.0.9
  public_suffix: ^1.2.0
  pigment: ^1.0.3
  photo_view: ^0.4.2
  flutter_svg: ^0.13.0
  flutter_secure_storage: ^3.1.2
  mime: ^0.9.6+2
  http: ^0.12.0
  intl: ^0.15.7
  rxdart: ^0.18.1
  video_player:
    git:
      url: https://github.com/999eagle/plugins.git
      ref: feature/caching
      path: packages/video_player
  sprintf: "^4.0.0"
  image_picker: 0.6.1
  image_cropper: ^1.0.1
  shimmer: ^1.0.0
  share: ^0.6.1
  path: ^1.6.2
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.7.0
  intl_translation: ^0.17.1

@eseidel @csells Does flutter integrate analytics without users knowing?

@escamoteur definitely not.
I don't know anything about this tool or the heuristics it uses.  Have you tried running it an empty Flutter project (e.g. flutter create)?

@eseidel is it possible that a package could contain analytics? I don't know if you have to register an app fingerprint for analytics.

Will test it with an empty project, brb.

@escamoteur One Signal package uses Firebase Analytics.

@lifenautjoe OK Problem solved


Nested Resources in Rails

Hi,
I'm trying to figure out how to implement swagger in my rails app. I have it working for top level resources, but for nested resources I can't find a solution.
Let's say I have:
resources :products do
    resources :slots
end

How do I structure the
swagger_controller :slots, "Slot Management"

for building my slots methods based on my slots controller actions?
The documentation just refers to a simple top level resource (users).
Appreciate any advice you can give
thanks
Steve

Similar issue here.
If I have the follows in my routes:
resources :users do
  resources :user_rooms
end

With this path: /users/:id/user_rooms.json
resources :organization do
  resources :users do
    resources :user_rooms
  end
end

And with this path: /organization/:id/users/:user_id/user_rooms.json
I only get the first route in my documentation and not the second. Can I explicitly document these two variations of the same endpoints?


dashboard example: minor fix

dashboard.css (and rtl version) contain rules for .sidebar-sticky, but these are not being applied currently.

Reading .position-sticky on the same elements makes me wonder if the CSS shouldn't be dropped, instead of adding the class name in markup?
Thoughts, @julien-deramond? Might be a leftover from peeviois refactors.

Confirm what's been said by @ffoodd: .sidebar-sticky has been removed in https://github.com/twbs/bootstrap/commit/0ca2cf4ccac251bfd97c767f5608fa012673d5c3 in favor of .position-sticky.
In this PR @techvanity you can drop .sidebar-sticky rules in both dashboard.css/dashboard.rtl.css files rather than using .sidebar-sticky in the markup.

I think the RTL is generated, isn't it?

I think the RTL file is generated, isn't it?

Yep it is possible to modify dashboard.css and then to run npm run css-prefix-examples-rtl to regenerate/modify dashboard.rtl.css.

@julien-deramond and @ffoodd I beg to differ. Those styles are important, especially setting height and overflow-y so that the sidebar is scrollable when number of items is large. I just tested it - scrolling breaks upon removing that css.

You're right indeed we can see the issue while reducing the window vertically. So I'd say you can keep your modification (addition of .sidebar-sticky) and remove in both CSS files the unused/useless rules. I haven't tested it but I'm thinking of padding-top already set with .pt, probably position: relative and some others.

Made the requested changes.
Thanks


Added -version flag support (fixes #30)

Codecov Report

Merging #31 into master will decrease coverage by 1.33%.
The diff coverage is 14.28%.

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
- Coverage   32.18%   30.85%   -1.34%
==========================================
  Files           2        2
  Lines          87       94       +7
==========================================
+ Hits           28       29       +1
- Misses         59       64       +5
- Partials        0        1       +1

Impacted Files
Coverage Δ

main.go
13.33% <14.28%> (+0.17%)
:arrow_up:

Continue to review full report at Codecov.

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


keyof for arrays

TypeScript Version:  2.5.3
Would it be possible to have something like the keyof  operator for arrays? The operator would be able to access the values in the array.
Code
With object we can do the following:
const obj = {one: 1, two: 2}
type Prop = {
  [k in keyof typeof obj]?: string;
}
function test(p: Prop) {
  return p;
}

test({three: '3'}) // throws an error

Could we do something like the following with arrays?
const arr = ['one', 'two'];
type Prop = {
    [k in valuesof arr]?: string;
  }
function test(p: Prop) {
  return p;
}

test({three: '3'}) // throws an error

@bezreyhan I came across this issue while searching around for something else. I don't know if this will be useful to you two months later but I think this will do essentially what you want as long as you don't need to save the array in a variable beforehand:
function functionGenerator<T extends string, U = { [K in T]?: string }> (keys: T[]): (p: U) => U {
  return (p: U) => p
}

const testFun = functionGenerator(['one', 'two'])

testFun({one: '1'}) // no error
testFun({two: '2'}) // no error
testFun({three: '3'}) // error as expected because 'three' is not a known property

If you do need the array in a variable, it looks like this will work:
function literalArray<T extends string>(array: T[]): T[] {
    return array
}

const arr = literalArray(['one', 'two'])

const testFun2 = functionGenerator(arr)
testFun2({one: '1'}) // no error
testFun2({two: '2'}) // no error
testFun2({ three: '3' }) // error as expected because 'three' is not a known property

Here is a link of those examples in the playground: Link

@kpdonn  Thanks. But I have problem with this
const functionGenerator = <T extends string, U = { [K in T]?: string }>(keys: T[]): U => {
  return keys.reduce((oldType: any, type) => ({ ...oldType, [type]: type }), {})
}
const data = ['one', 'two']
const testFun = functionGenerator(data)
testFun.one
testFun.three << also work

Using resolveJsonModule, would it be possible to get the type of an array from a JSON file without explicitly declaring the type of the JSON module and losing typechecking on its data?

@kpdonn I find your solution very interesting.
Any idea how to have the same result with an array of object instead of an array of string ?
The following code passes typescript diagnostic. However, the last line should throw an error.
function functionGenerator<T extends {name: string}, U = { [K in T['name']]?: string }>(keys: T[]): (p: U) => U {
  return p => p;
}

const testFun = functionGenerator([{name: 'one'}, {name: 'two'}]);

testFun({ one: '1', two: '2' }); // no error
testFun({ two: '2' }); // no error
testFun({ three: '3' }); // error expected but type diagnostic passes

@kpdonn I find your solution very interesting.
Any idea how to have the same result with an array of object instead of an array of string ?
The following code passes typescript diagnostic. However, the last line should throw an error.

If anyone is interested, I found the solution of my problem:
function functionGenerator<
  V extends string,
  T extends {name: V},
  U = { [K in T['name']]?: string }
>(keys: T[]): (p: U) => U {
  return p => p;
}

const testFun = functionGenerator([{name: 'one'}, {name: 'two'}]);

testFun({ one: '1', two: '2' }); // no error
testFun({ two: '2' }); // no error
testFun({ three: '3' }); // throws an error

Is there anything wrong with doing the following:
`
export type Things = ReadonlyArray<{
readonly fieldA: number
readonly fieldB: string
readonly fieldC: string
...other fields
}>
type Thing = Things[number]
`
When I do that, type Thing has the correct type. Obviously you wouldn't want to do this by default, but I find myself in the situation where I have something generating array types, but sometimes I want functions to take a single value of that array. The above syntax is kind of weird, but it seems to do the job?

Typescript 3.4 made things better:
const myArray = <const> ['foo', 'bar'];
type MyArray = typeof myArray[number];

👍

@benneq Thanks for that hint. I'm now able to make a type without having to create an enum
const pages = <const> [
    {
        label: 'homepage',
        url: ''
    },
    {
        label: 'team',
        url: ''
    }
];

// resulting signature = function getUrl(label: "homepage" | "team"): void
function getUrl(label: (typeof pages[number])['label']) {}

getUrl('homepage') // ok
getUrl('team') // ok
getUrl('bad') // wrong

Is there a way to do what @Serrulien posted, but also with types defined for each object in the array?
Something like:
type Page = {
  label: string;
  url: string;
};

Then enforce that type of each object of the const array.  With an array of many elements, it would help to avoid type errors in any individual object.

That‘s easy, and you don‘t need const for it:
const pages: Page[] = [
    {
        label: 'homepage',
        url: ''
    },
    {
        label: 'team',
        url: ''
    }
]

@fabb, right, but I wanted to combine that with something like this to have a type with all the valid labels:
type Labels = (typeof pages[number])['label'];

Without the const, the type is just string

I guess you have to decide between your literal defining the type, or explicit typing without const.

I am trying to use keyof like so:
type Events = [
  'repo:push',
  'pullrequest:unapproved',
  'pullrequest:approved',
  'pullrequest:updated',
  'pullrequest:rejected',
  'pullrequest:fulfilled',
  'pullrequest:created'
  ]

export interface InterosTag {
  [key: string]: {
    [key: keyof Events]: {   // but this does not work
      "jenkins-job": string,
      "deploy": boolean,
      "eks-key": string
    }
  }
}

any help appreciated

@ORESoftware look at @benneq‘s answer above.

@falb i tried earlier today but it didnt work, how would I use it in the context of my code above?

@ORESoftware do it like this:
const events = ['repo:push', 'pullrequest:unapproved', 'pullrequest:created'] as const

export interface InterosTag {
    [key: string]: {
        [key in typeof events[number]]: {
            'jenkins-job': string
            deploy: boolean
            'eks-key': string
        }
    }
}

@fabb ok that worked, I missed the in operator when I tried last time. The remaining problem is it forces me to have all the keys present, not just a subset of the keys.
I fix that, I tried using:
  type Events = typeof events[number];

    [key in Partial<Events>]: {
            'jenkins-job': string
            deploy: boolean
            'eks-key': string
        }

but Partial is not the right operator. I am looking for a subset of the array values.

@ORESoftware you are holding it wrong ;-)
type EventData = Partial<
    {
        [key in Events]: {
            'jenkins-job': string
            deploy: boolean
            'eks-key': string
        }
    }
>

noob here, based on the suggestions here Im trying to write a helper function to check if an object has the required keys

const requiredKeys = <const>[
    'key1',
    'key2',
    'key3'
];

function hasKeys(
  unknownObject: { [key: string]: any },
  requiredKeys: readonly string[]
): unknownObject is { [key in typeof requiredKeys[number]]: unknown } {
  return Object.keys(requiredKeys).every(
    required => unknownObject[required] !== undefined
  );
}

this works but unknownObject ends up being typed as [x: string]: unknown;, any ideas?

 It's curious, if you extract { [key in typeof requiredKeys[number]]: unknown } into a named type, it works as expected:
const requiredKeys = <const>[
    'key1',
    'key2',
    'key3'
];

type YAY = { [key in typeof requiredKeys[number]]: unknown }

function hasKeys(
  unknownObject: { [key: string]: any },
  requiredKeys: readonly string[]
): unknownObject is YAY {
  return Object.keys(requiredKeys).every(
    required => unknownObject[required] !== undefined
  );
}

const maybeYay: { [key: string]: any } = { key1: 1, key2: 2, key3: 3, otherKey: "other" }
if (hasKeys(maybeYay, requiredKeys)) {
    console.log(maybeYay.key1) // compiles fine
}

that is interesting, seems as though typescript isn't quite smart enough to be able inspect the arguments type?
anyway thanks for your help @benneq  and @fabb

So I was playing around and I figured it out.
function objectHasKeys<T extends string>(
  unknownObject: { [key: string]: unknown },
  requiredKeys: readonly T[]
): unknownObject is { [Key in T]: unknown } {
  return requiredKeys.every(
    required => unknownObject[required] !== undefined
  );
}

function test(thing: { [key: string]: unknown }) {
  const required = <const>['A', 'B']
  if (!objectHasKeys(thing, required)) return
  thing // <-- this is typed as { A: unknown, B: unknown }
}

Is there a way to get a literal type from an iterative operation?
function getValues<T>(object: T, keys: (keyof T)[]) {
  return keys.map((key) => object[key]);
}

const result = getValues({ "1": 1, "2": 2, "3": "three" }, ["1", "3"]);

typeof result; // (string | number)[]

I want the literal type of the result.
typeof result; // [1, "three"]

I'd also like to create a generic type to represent this function
type GetValues<T, K extends readonly (keyof T)[]> = {
  (object: T, keys: K): T[K[number]][];
};

// produces (1 | "three")[], instead of [1, "three"]
type Values = GetValues<{ "1": 1, "2": 2, "3": "three" }, ["1", "3"]>;

This is the release note with the relevant info about the solution (which @benneq mentioned)

Using const does not solve the problem for me.
function getValues<T, K extends readonly (keyof T)[]>(
  object: T,
  keys: K
): T[K[number]][] {
  return keys.map(key => object[key]);
}

const result = getValues(
  { "1": 1, "2": 2, "3": "three" } as const,
  ["1", "3"] as const
);

typeof result; // produces (1 | "three")[], instead of [1, "three"]

I'm trying to get a literal type from an operation on a literal type. I think the issue is K[number] will return a union type which has no understanding of order.

@daniel-nagy T[K[number]][] results in an array, but you want a tuple. You can keep the tuple type when you take advantage of mapped type support used like this: { [P in keyof T]: X } where T is the tuple. As far as I have understood, the keyof T is the tuple array index (since arrays in js are just objects with indexes as keys), and this syntax builds a new tuple with the same indexes.
All together this nearly works as expected:
function getValues<T, K extends readonly (keyof T)[]>(object: T, keys: K): { [P in keyof K]: T[K[P]] } {
    return keys.map(key => object[key]) as any
}

While the result type is now correctly [1, "three"], TypeScript shows an error: Type 'K[P]' cannot be used to index type 'T'.. I think this is a bug in TypeScript, maybe related to #21760. @ts-ignore? 😬

@daniel-nagy see the updated code with a workaround for the type error 👆

in the latest ts "version": "3.9.6"
export const extraKeys = ['app', 'title', 'package', 'deeplink', 'url', 'logo', 'image', 'type'] as const;

export type Extra ={
  [key in typeof extraKeys[number]]: string;
};

For a value, I found that I can use:
const keys = ['app', 'title', 'package', 'deeplink', 'url', 'logo', 'image', 'type'] as const;
type Key = typeof keys[0]

For what I am doing, something like this is sufficient:
type Prop<AcceptableKeys extends Array<string>> = {
  [key in AcceptableKeys[number]]: string;
};

function test(prop: Prop<["one", "two"]>) {
  return prop;
}

test({ three: "3" }); // throws an error

I specifically need this functionality for generating specific APIGatewayProxyEventV2 types for lambda integrations:
type Request<
  PathParameters extends Array<string>,
  QueryParameters extends Array<string>,
  Body extends Record<string, unknown>
> = {
  pathParameters: {
    [key in PathParameters[number]]: string;
  },
  queryStringParameters: {
    [key in QueryParameters[number]]: string;
  };
  body: Body;
};

type TestBody = {
  c: string;
};

type TestRequest = Request<["a"], ["b"], TestBody>;

const testOne: TestRequest = {
  pathParameters: { a: "foo" },
  queryStringParameters: { b: "bar" },
  body: { c: "baz" },
};
// No error

const testTwo: TestRequest = {
  pathParameters: { a: "foo" },
  queryStringParameters: { bee: "bar" }, // Throws an error
  body: { c: "baz" },
};

For simple array, I do this (add "readonly type")
export type ValuesOf<T extends readonly any[]>= T[number];

export const ALL_BASIC_FUNCTIONS_NAMES = ["sub", "add", "div", "mul"] as const

I use two approaches:
// Option 1: If object stores different types
type SomeType = {
  a: number;
  b: string;
}

const typeVar: SomeType = {
    a: 10,
    b: 'string'
}

// used for typechecking
type SomeTypeKey = keyof SomeType;

// create an array to be used in runtime
// disadvantage is that properties need to be repeated
const keys: SomeTypeKey[] = ['a', 'b']; // type checked
let isValidKey = keys.includes('c' as SomeTypeKey)

// Option 2: start from keys array definition, in case all values have the same type

const myKeys = ['foo', 'bar'] as const; // as const does the magic
type MyKey = typeof myKeys[number]; // = 'foo' | 'bar'

type MyMap = Record<MyKey, string>;
type MyMap2 = { [key in MyKey]: string };

I just managed to make my function return a type checkable object:
const indexKeys = <K extends string>(keys: readonly K[]) => {
  type Result = Record<K, number>;

  const result: Result = {} as Result;

  const {length} = keys;

  for (let i = 0; i < length; i++) {
    const k = keys[i];

    result[k] = i;
  }

  return result;
};

Here the type checker will complain:
// Property 'zz' does not exist on type 'Result'.
const {aa, zz} = indexKeys(['aa', 'bb']);

As mentioned above by @7kms this works to change an array into a type
const arr= ['foo', 'bar'] as const;
const myVar:typeof arr[number] = "foo"

// Hovering over myVar shows:
// const myVar: "foo" | "bar"


Problems with third party uvr models

I have problems with using third party uvr models.
When I loading and started third party uvr models (e.g. 17_HP-Wind_Inst-UVR.pth from uvr_models), that then an error appears:
server console:
Traceback (most recent call last):
  File "/home/user/parent-folder/infer/modules/uvr5/modules.py", line 101, in uvr
    del pre_fun.model
UnboundLocalError: local variable 'pre_fun' referenced before assignment

web window:
...
stg3_full_band_net.aspp.conv5.conv.1.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).

why is this happening? after all, the processing of models should be the same.
Some models from via the link above is correcy worked (e.g. 6_HP-Karaoke-UVR.pth).
I understand what this project don't intended for UVR how main instrument, but i think what connecting other uvr models not the most complex algorithm.
Also I  readed code uvr part, and noticed that for onnx model was written separate function. Why? This doesn't allow connect third party oonx models
about the software:latest version of the rvc project (branch is main)

Hi uvr séparation works only with provide/downlaod base uvr from rvc project. If you want use fancy uvr go to download uvr5 and mvsep.com.

I started looking for third-party uvr models because the standard ones were cracking after separation. But I realized what was going on and no longer need to use third-party uvr models. The problem was solved by reducing the volume of the input file
This issue may be closed for me


[stable/kured] add apps apigroup for daemonsets

Signed-off-by: Doug Winter<EMAIL_ADDRESS>What this PR does / why we need it:
Daemonset resources are moving to the apps apigroup, so we need to add this to the role used.
Checklist

[x] DCO signed
[x] Chart Version bumped
[x] Title of the PR starts with chart name (e.g. [stable/chart])

Tested on my test cluster, and working.

/ok-to-test
/lgtm


S.e.x (18)+ Oviya Tamil Actress mms viral Lea𝚔ed video telegram

S.e.x (18)+ Oviya Tamil Actress mms viral Lea𝚔ed video telegram
Oviya's latest video has taken social media by storm, captivating viewers and sparking widespread discussions. This young digital creator has garnered significant attention for her engaging content, particularly with her recent Spiderman-themed video that has gone viral. Fans are eagerly searching for where to watch the full video, turning to platforms like Instagram, X (formerly Twitter), and Discord for access.
As the buzz around Oviya grows, fans are actively sharing their reactions online. The viral success of her video highlights the powerful role of social media in propelling creators into the spotlight. With her unique style and creativity, Elif has quickly become a notable figure in the digital landscape, leaving many eager to learn about her future projects and content.
Bigg Boss Tamil Season 1 contestant and actress Oviya’s alleged intimate video goes viral online. Alleged footage of the actress being in a compromising situation with a man has been leaked on X (formerly Twitter), which some claim to be hers while others argue it is a deepfake.
As the video has gone viral, several people are shocked by whether it is actually the actress in the video or someone altered visuals just to cyber-attack her. Even though a clarification about the authenticity of the video is yet to be made, Oviya has also not responded to the same, making the situation unclear.
The actress Oviya, aka Helen Nelson, is an actress who has worked in several movies over the years, including languages like Tamil, Malayalam, Telugu, Kannada, and Hindi. The Malayalee actress, originating from Thrissur, Kerala, made her debut back in 2007 with the Prithviraj Sukumaran starrer Kangaroo.
Later on, the actress continued her career with movies like Puthiya Mukham and Apporva, subsequently leading to her debut in Tamil with the movie Naalai Namadhe.
Over the years, the actress has played roles in several movies across languages, including [Kamal Haasan]R Madhavan starrer Manmadan Ambu, Yash’s Kirataka, Sivakarthikeyan starrer Marina, Kalakalappu, and many more.

fghrtt

fdgdrgr


Reduce use of methods of StateAgeFunction in IDE model

Motivation / Current Behaviour
In this issue we want to examine if it is better regarding run time to reduce the use of the methods of StateAgeFunction when solving the model. We proceed as follows. See run time results in the comments.

Currently, whenever we calculate a sum to compute flows or compartments, we determine the support_max via the corresponding StateAgeFunction. We have observed that the StateAgeFunction is accessed a lot in simulations and this may be an issue regarding performance. This did not lead to a significant reduction in run time, see comment.

Enhancement description
Compute the necessary support_max values once at the beginning of the simulation and store them. We want to try out if this has an impact on performance.
Additional context
No response
Checklist

[X] Attached labels, especially loc:: or model:: labels.
[x] Linked to project

After storing the necessary values for the flows and the force of infection time we made the following measurements (for the same example as above):

On this branch: 153.672 seconds
On main: 186.976 seconds
These two measurements were done directly after another to make results somehow comparable.


Determine and calculate Overawards

Additional Context

Further analysis docs are located in the analysis folder.
This ticket is the fundamental changes for overawards, remaining UI-related tickets will be done in #1355.
Overawards are generated only for loans.
Overawards are generated when the student received more money than he is supposed to receive.
Grants are not paid twice but they do not generate overawards in case more money than the student is entitled was already paid.
All possible deductions for loans and grants are always per award code in the same way that the overaward balance is also per award code.
When the e-Cert is generated the money is considered disbursed/paid/sent.

Acceptance Criteria
Overawards generation (loans only)

[x] Once a reassessment happens on an application that already had money disbursed (paid), the amount already paid must be subtracted from the new assessment generated. For instance, if the student already received $2000 for CSLF and a reassessment happens where the new values indicate that the student is entitled to receive only $1500 the CSLF will have its value defined as 0 (zero) and an overaward of $500 will be added to the student account.
[x] While calculating the total amount already paid to the student, the "overaward amount" (subtracted during e-Cert generation) is added to the "effective amount" because it should be considered part of what the student received. The "overaward amount subtracted' is money that the student is being paid but before e-Cert generation, it is used to deduct student debt, and the deduction is made with "student money".
[x] The deductions must happen as much as possible from the sooner disbursement. For instance, if the student already received $2000 and there will be two disbursement schedules for CSLF where schedule 1 is defined as $1500 and schedule 2 is defined as $1500 the disbursements will look as below (no overawards generated for this case but it servers to illustrate how the deduction happen).

Disbursement Schedule 1: Award = $1500 | Deduction $1500 = 0 (ducuted as much as possible from the first schedule)
Disbursement Schedule 2: Award = $1500 | Deduction $500 = $1000

Grants reassessments

[x] Grants already paid should not be paid again but if the value already paid is greater than the amount that the student is entitled to after the reassessment no overaward is generated. For instance, assuming that the student already received $2000 for CSPT and after the reassessment, the new CSPT was defined as $1500. In this situation, the student will not receive any money in the new assessment for CSPT but the $500 extra already received will not generate an overaward.

Overall criteria

[x] The overawards are calculated during the execution of the save-disbursement-schedules worker when the disbursement schedules are created.
[x] The overaward balance is only applied (deducted) upon e-Cert generation.
[x] The award effective value is only calculated during the e-Cert generation.
[x] If the student has a restriction with the action type Stop full time BC funding this will force the effective values for "BC Loans" and "BC Grants" to be 0(zero) and no overawards deductions will happen because the student will not be receiving any money.
[x] "BC Total Grant" (BCSG) will be calculated during e-Cert generation.
[x] "Canada Loans" should not generate overawards if the amount is less or equal to CAD$250.00.
[x] A reassessment only produces an overaward if the application had some money sent(disbursed) already. Applications that have all their disbursements in a 'Pending' state will be freely recalculated but will never generate an overaward.
[x] The effective value for every award considering amounts already paid, overawards and possible restrictions are calculated altogether during the e-Cert generation in one single transaction. An error during the DB operations or during the e-Cert file upload to to SFTP will cause the DB transaction rollback.

DB Migrations

[x] Create a new OA table (sims.disbursement_overawards).
[x] Add status for disbursement schedules to Cancel Non-Sent Disbursements (Pending, Sent, Cancelled)

Pending: status for every created disbursement schedule record;
Sent: updated upon e-Cert generation when the awards are considered "paid";
Cancelled: if a record was on a Pending status and the application was reassessed or if the application was cancelled.

[x] Add new columns to the sims.disbursement_values to store the overaward-related values.

disbursed_amount_subtracted: for a reassessment, when a disbursement was already sent (paid), this column will store the amount that will be subtracted from an award during the e-Cert generation. For instance, if during the first assessment, the student received $5000 and during the reassessment, this value was $6000, the student in this column will store the value of the $5000 that was already paid, which will result in the student receiving only $1000.
overaward_amount_subtracted: during the e-Cert generation, if the student has any overaward balance this column stores the amount of the overaward that will be deducted from this award. For instance, if the student is entitled to receive CSLF $5000 but has an overaward balance for the CSLF of $2000, the student will receive only $3000.
effective_amount: Value resulted from the calculation between the award value_amount, disbursed_amount_subtracted and overaward_amount_subtracted. This is the value that was sent on the e-Cert and effectively paid to the student.

Overawards cancellation during application cancellation

[x] When an application is cancelled by the student, the application status is immediately changed to "Cancelled" (no changes in the current process) and an entry is added to the queue cancel-application-assessment to cancel the workflow instance, if present, and check for possible overawards cancellation.

[x] Soft delete records from sims.disbursement_overawards that are associated with the assessment being cancelled and that are not associated with any award. A record associated with an assessment and with an award means that it is a deduction that happened during the e-Cert generation which also means that the award was already sent to be paid to the student. These records are not cancelled.
[x] Any disbursement schedule in 'Pending' state must be changed to 'Cancelled'.

Overawards cancellation during application edit

[x] When a student edits an application a new copy of the same application is generated (no changes in the current process) and during this process, the overawards cancellation must happen in the same way that they would happen if the student was cancelling the application.

How to cause some loans assessment variations to create overawards

Create an offering with 6 months with the start date today or in the near past or near future (less than 5 days ahead). Add tuition values as 80,000 (later we will reduce tuition values to cause overawards).
Create a student application with this offering, approve NOA and confirm COE to make it completed and ready for disbursement.
Trigger the e-Cert generation. Considering the disbursement schedule is around today, the application is completed, and the student has a valid MSFAA, and all others requirements, the disbursement should happen.
After the disbursement happened, request an offering change to reduce the number of weeks (2 months) and the tuition values (cut values by half).
Go to AEST portal and approve the offering change request to force the reassessment to happen. The new values generated by Canada/BC loans should be reduced in a way where what was already paid is greater than the money that the student will be receiving in the reassessment.

Verified through database.  We will need to run through some more tests once we have the UI in place.


ch.sock: connect: no such file or directory

I used CDI to do it. But there are some problems.

the Dockerfile is:

FROM ubuntu:jammy AS rootfs
RUN apt-get update -y && \
    apt-get install -y --no-install-recommends systemd-sysv udev lsb-release cloud-init sudo openssh-server && \
    rm -rf /var/lib/apt/lists/*

the vm.yaml:

apiVersion: virt.virtink.smartx.com/v1alpha1
kind: VirtualMachine
metadata:
  name: test-vm
spec:
  instance:
    memory:
      size: 4Gi
    kernel:
      image: smartxworks/virtink-kernel-5.15.12
      cmdline: "console=ttyS0 root=/dev/vda rw"
    disks:
      - name: ubuntu
      - name: cloud-init
    interfaces:
      - name: pod
  volumes:
    - name: ubuntu
      persistentVolumeClaim:
        claimName: rootfs-dv
      #dataVolume:
      # volumeName: ubuntu
    - name: cloud-init
      cloudInit:
        userData: |-
          #cloud-config
          password: password
          chpasswd: { expire: False }
          ssh_pwauth: True
  networks:
    - name: pod
      pod: {}

when I apply the vm.yaml,the pod is runinng, but it would quit or block later.
I try to solve the problem.

use kubectl logs -f vm-test-vm-xxx:
it looks like successfuly, but the pod will quit later.

use kubectl describe vm test-vm :

@wavemomo There're some missing steps between the Dockerfile and the data volume? How did you create the image for CDI to import?

@fengye87 Thanks for your reply firstly. Here are my steps to create/import image.

create image:

truncate -s 10G input_raw
mkfs.ext4 input_raw
mkdir rootfs
mount input_raw rootfs/
docker create --name ubuntu-rootfs ubuntu-rootfs
docker export ubuntu-rootfs | tar -xvf - -C ./rootfs/
umount ./rootfs
qemu-img convert -f raw input_raw -O qcow2 output_rootfs.qcow2

import into datavolume:

curl -v --insecure -H "Authorization: Bearer $TOKEN" --data-binary @/root/virtink/rootfs.qcow2 https://$(kube ip):31001/v1alpha1/upload

@wavemomo I followed your steps but could not reproduce the same problem. Both my VM and the VM pod stayed in the Running state, but I did see the VM didn't start up normally since there's no login prompt. I think there's something missing in the Dockerfile. I'll look into it further. Could you confirm that you create and start the VM after the data volume has been completed imported? And what version of Virtink are you using?

@fengye87 Yes,  the VM and the VM pod would stay in the Running state but it would block.(but actully, I start the VM first time, the VM pod would quit after login prompt) And the version of Virtink in my cluster is v0.10.1.

By the way, can you share your steps of building image and rootfs if it's different from mine?

@wavemomo I used your Dockerfile and your steps to build the image, the only difference is that I was using the http download method of CDI instead of uploading.

@fengye87 But my Dockerfile is not different from the official example given?

@wavemomo There's a difference. See the highlighted line below. That could be the cause.

@fengye87 I try to use the Dockerfile of official example, the error is :

@wavemomo You should use the /rootfs dir as the image's root when use the official rootfs image.

@fengye87 How to use the /rootfs dir as the image's root?  Thanks very much

@wavemomo You can spin up the container, run your steps inside the container (skip the docker part, just copy /rootfs to the image's mount point), and copy the qcow2 image to host. You may need to run apk add qemu-img first to install qemu-img inside the container.