don't cross the browser and node streams

My best case against conflating the two modes is this incredibly silly change I had to make to npm to get the affected files through standard. I know that window.opener is a thing in browsers, but it has not been and never will be part of node, and this error message (like the one you get for crypto in some contexts) makes no sense unless you know / care about the browser-side problem it's trying to address.
I tried very hard to figure out how to remove / override the relevant global check via code comments, but either I don't understand how eslint applies those overrides, or it's simply not supported. Either way, I get that a lot of code will be browserified at some point and thus should pass the browser checks, but there is no plausible or reasonable reason to run npm in the browser (phrased that way because I know somebody probably is going to try anyway at some point). It should be OK for server-side apps to say "I am a server-only thing".

:+1: io.js / node won't ever have a global window object (jsdom window is assigned explicitely) whereas the browser can have extra globals because of browserify. Being able to turn off browser to prevent issues like the one you just linked seems reasonable.

Another good reason to split these modes apart: as I just discovered, because crypto is a global in the browser, using it without defining it first will cause standard to fail to notice that you haven't imported crypto in your Node module.

Possible resolutions to this issue:

Leave things as they are. @othiym23 - you can tell eslint that opener is writable with a /*global opener:true */ comment at the top of the relevant file. Using /*global opener */ marks opener as read-only; use true to mark it writable. Not an ideal solution because it makes no sense to a node.js user why they should have to add this comment.

Keep the current default behavior, but add --node and --browser flags to restrict the assumed globals to only one environment's globals. Not ideal because we really, really want to avoid adding options. Like, that's sort of the point of standard.

Allow use of any browser global (like we already do), but mark them all as writable. This way, you can do var crypto = require('crypto') and var opener = require('opener') without errors in node. All the browser globals are defined here. This would eliminate all errors and annoyances, but not ideal because it's overly permissive: as @othiym23 mentioned, now standard won't error when any of the browser globals (like open, close, crypto, screen, scroll, stop, top) are accidentally used in node without being defined first.

Disable the browser globals, but mark window and document as read-only globals as a compromise. These aren't really globals in node, so this is overly permissive, but at least it's just limited to TWO globals that we don't check. Then, force all browser code to reference browser globals as properties on window, e.g. window.XMLHttpRequest, window.open, window.crypto, etc. And document would just work: document.querySelector, etc. Not ideal because now browser code becomes wordier, and we're still not checking for improper use of these two variables in node (not a huge deal). Also, if standard is used with non-browserify browser code, it will still incorrectly assume that node globals like require and Buffer are defined.

Any other ideas?

My preference is for 2, although I strongly agree with the goal of keeping configurability and modes to an absolute minimum. My argument in favor is that this is probably the biggest split going through the standard user community – many users are going to be writing code that is meant to work in both the browser and on the server, and smaller groups are going to be working on stuff that's meant for one or the other. The default behavior should stay the same as it is now, to support those users, but having a way to say, "yes, this is code that is only meant to run on the server" or "yes, this is code that is only meant to run in the browser" – that can be changed later – would be really helpful for those of us, like me, who are working with third-party libraries that make assumptions about the environment in which they're going to be used.
Just as a quick note, this would allow browserify users to get warnings for forgetting to shim their node globals in their browser code as well – no process or Buffer required? Whoops!

I think 4 is a nice middle ground. It is a bit annoying to not being able to use open as a variable name in node right now etc. Personally I prefix all global variables with window. in the browser anyways.

I'm vehemently against #2. User-friendly software should not have modes. #3 could cause problems. Although I already prefix all of my browser global variables with window, many don't - so I think #4 will discourage a lot of people from using standard. I realize that this is probably not an eslint option, but an ideal solution seems to be that if a variable is set with the result of a require statement, we could set it as writeable (eslint) as it would seem to me that the intent is pretty clear. This actually may not be that difficult, however it would add more processing time. The way that you'd do it is use something like recast (which in turn uses esprima), scan the source file for require statements that are set to browser globals, prepend the comment  /*global opener:true */. If that's not viable, my vote would be to just stick with #1 (do nothing) for the time being.
The ultimate goal here is to try to encourage standard usage as much as possible, and #1 seems like a minor annoyance compared to the rest.

@jprichardson perhaps writing a custom eslint rule that replaces no-undef with this special treatment would not affect processing time as much?

I thought of another option, 5:

Whitelist window and document globals, as well as all browser globals that begin with an uppercase letter. Examples: Blob, DataView, and HTMLInputElement. Since they're upper case and usually pretty verbose, they're a lot less likely to be used as variable names in node than the lowercase browser globals.

Lower case browser globals like length, open, top would need to be used as window.length, window.open, window.top.
Here's the full list of globals that we could keep whitelisted. Almost all don't seem like they would cause problems in node.

I just published 3.0.0-alpha with option 4. Please give it a try and share your feedback! It resolves @othiym23's original issue without introducing new options. The only exception is that window and document are always assumed to exist, even in node. Small issue, IMO.
npm install<EMAIL_ADDRESS>-g

Wow, eslint just made a change to properly support CommonJS module scope, i.e. using a variable name that is the same as a global is now allowed! ESLint now understands that the local variable shadows the global in node (which we allow), and the "redefining a read-only variable" error goes away!
https://github.com/eslint/eslint/issues/892
This is basically approach 3.

I'm getting 'CustomEvent' is not defined. Will this be added to the whitelist?

Try window.CustomEvent instead
On Fri, Mar 31, 2017 at 1:00 PM Nikos<EMAIL_ADDRESS>wrote:

I'm getting 'CustomEvent' is not defined. Will this be added to the
whitelist?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/feross/standard/issues/46#issuecomment-290683353, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACWlep2kj_YSZArnP-kFQimdKd1_x7FLks5rrNzDgaJpZM4Dmlfc
.


How to import and merge dxf files without mixing them up?

This lib is great and with it I can successfully do read write entity operations.
My goal is to merge multiple dxf files's entities into single one new dxf file, of course each input file's entities should be placed into a seperate location to avoid overlapping.
I couldn't find built in functions to do merge. So after some experiments I came up with such solution:
        static Block ImportDxfAsBlock(string dxfFile)
        {
            DxfDocument doc = DxfDocument.Load(dxfFile);
            Block block = new Block(Hash(dxfFile));
            foreach (Layout layout in doc.Layouts)
            {
                block.Entities.AddRange(doc.Layouts.GetReferences(layout)
                    .OfType<EntityObject>().Select(x => x.Clone() as EntityObject));
            }
            return block;
        }
        static void Main(string[] args)
        {
            string[] inputs = new string[] { "../../../1.dxf", "../../../2.dxf" };
            //merge order matters
            //string[] inputs = new string[] { "../../../2.dxf", "../../../1.dxf" };
            double y = 0;
            DxfDocument doc = new DxfDocument(netDxf.Header.DxfVersion.AutoCad2018);
            foreach (string input in inputs)
            {
                doc.Entities.Add(new Insert(ImportDxfAsBlock(input), new Vector2(0, y)));
                y += 5000;
            }
            doc.Save("../../../merged.dxf");
        }

This code works for most of my dxf files. But a few files got mixed up result.
For example, I have two dxf files:

After merge, I got:

The order of input file also affects the result. I have checked the two files both contain a INSERT entity named *U9, and thouoght it could possibly be the reason but as a beginner of dxf I don't know what to do with it.
Questions

I might have missed some important objects to copy(such as layers, models, attributes?), could you point out?
I tried a python lib ezdxf and it can import entities without mix up, maybe because it has built in importer. Is there any similar function in netdxf? Of course, there are many benifits to use netdxf than ezdxf.
I tried to install by nuget(<IP_ADDRESS>) but no function named doc.Entities, so I included latest source instead. Did I used the lib in the wrong way?

Environment

Win10, net 4.8, netdxf 3.0.0
Minimal reproducible code pushed to github

All named objects, all classes that derive from TableObject, must be unique, there cannot be two with the same name. This is the case of layers, line types, styles,..., and what seems to be the case giving you problems, blocks. Two TableObjects are considered equal if they have the same name, regardless of any other of its internal properties.
When you copy an entity into another document, the named objects in the destination document will have preference over the ones on the original drawing, so any duplicates will have to be solved manually if necessary.
In your post you are talking about a block named "*U9", that corresponds to a dynamic block. There are three kind of blocks that AutoCad internally creates to handle three kinds of entities. Dimensions are represented by the blocks that starts with "*D", Dynamic Blocks starts with "*U", and tables starts with "*T". From those three only Dimensions are fully supported and they will shouldn't give you problems when merging documents, but dynamic blocks and tables are not, any incompatibilities with them will have to be sorted manually.
You will have to rename the blocks giving you conflicts, you can use the Clone method that takes a new name as an argument, since internal used blocks cannot be renamed; and with this new block recreate the Insert entities that used that block.
From your Questions section:

The root of the problem seems to be the duplicate "*U9" block in the original and destination. Problem that will have to be solved manually as explained before.

I do not know anything about "ezdxf", and no I did implemented any method to merge two different drawings. It is not a trivial procedure, you will need to do it yourself and decide what to do with any duplicate named objects.

All I upload is here at Github, I have nothing to do with the releases at nuget. Since version 2.2 many things have changed, read the changelog.txt. The actual source code is for version 3.0 that I have not release yet so consider it a beta.


Remove old swift_dynamicCast implementation

The new implementation has been the default for a while now and
seems to be stable and relatively bug-free.

@swift-ci Please test

All that deleted code. :homer simpson drooling sound:


ci: fix incorrect glob pattern

https://coveord.atlassian.net/browse/KIT-2608

I am testing it thoroughly right now.  oops


build image is missing Ninja, so the -n switch doesn't work

Currently the -n switch is an option, allowing builds with Ninja. This options fails because the ninja-build package isn't installed in the Docker image.

We might want to wait on this until after the Docker versioning is resolved, as a user can still build with Make.

you can update the Dockerfile, it won't break unless you change the DOCKER_VERSION

Right I meant that it won't actually fix the bug until we update the DOCKER_VERSION, unless the user builds the Dockerfile locally.


"Connection was Closed" error after applying AuthorizationPolicy

Bug description
Getting error "Connection was closed" after applying authorization policy. I want a micro-service to only allow incoming traffic from a single micro-service and deny all others by default.
[X ] Configuration Infrastructure
[X] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[X] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure
Expected behavior
We have a sample application that represents an online mart. It's divided into multiple micro-services/services; inventory, cart, catalog, front-end, mysql, mongo and a gateway that is responsible for forwarding traffic from external world to these micro-services. I want to ensure that only those services can access each other that are supposed to rest should deny all by default.
Steps to reproduce the bug
Following are the manifests that we used:
Gateway:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: istio-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 443
        name: https
        protocol: HTTPS
      tls:
        mode: SIMPLE
        serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
        privateKey: /etc/istio/ingressgateway-certs/tls.key
      hosts:
        - "gateway-dev.DOMAIN"
        - "web-dev.DOMAIN"
    - port:
        number: 80
        name: http
        protocol: HTTP
      tls:
        httpsRedirect: true
      hosts:
        - "gateway-dev.DOMAIN"
        - "web-dev.DOMAIN"

VirtualService:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: gateway-dev-virtualservice
  namespace: istio-system
spec:
  hosts:
    - "gateway-dev.DOMAIN"
  gateways:
    - istio-gateway
  http:
    - route:
        - destination:
            host: gateway.nordmart-dev-apps.svc.cluster.local

mTLS:
apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
  name: default
  namespace: nordmart-dev-apps
spec:
  peers:
    - mtls: {} #this will set mTLS mode to : STRICT
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: default
  namespace: nordmart-dev-apps
spec:
  host: "*.nordmart-dev-apps.svc.cluster.local"
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL

AuthorizationPolicy:
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: catalog-policy
  namespace: nordmart-dev-apps
spec:
  selector:
    matchLabels:
      app: catalog
  rules:
    - from:
        - source:
            principals: ["cluster.local/ns/nordmart-dev-apps/sa/gateway"]
      to:
        - operation:
            methods: ["*"]

Sample URL: https://gateway-dev.DOMAIN/api/products
Response: {"error":"Connection was closed"}
Logs from gateway:
Jan 08, 2020 7:21:26 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
Jan 08, 2020 7:21:27 AM io.vertx.servicediscovery.kubernetes.KubernetesServiceImporter
SEVERE: Error while interacting with kubernetes
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:61)
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:52)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:538)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:64)
	at io.vertx.servicediscovery.kubernetes.KubernetesServiceImporter.lambda$start$1(KubernetesServiceImporter.java:99)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
	at io.vertx.core.impl.TaskQueue.lambda$new$0(TaskQueue.java:60)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Failed to connect to /<IP_ADDRESS>:443
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:189)
	at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:173)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)

You can view the repository against which this is deployed here: https://github.com/stakater-lab/nordmart-dev-apps/tree/master/releases-istio
Version (include the output of istioctl version --remote and kubectl version and helm version if you used Helm)
Kubectl: Client v1.15.3, Server v1.14.8
helm: v2.11.0(client & server)
Istio: Operator(v1.4.0), helm chart(v1.4.2)
How was Istio installed?
I have tried with both helm charts & istio-operator and the same issue persists. Currently, i am using istio-operator.
Environment where bug was observed (cloud vendor, OS, etc)
I think this is cloud irrelevant but i have tried on AKS and EKS.

The gateway log seems indicating it has some problems talking to kubernetes:
SEVERE: Error while interacting with kubernetes
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.

This shouldn't be caused by Istio authorization policy. Could you enable the Envoy RBAC debug logging for app: catalog and trigger some requests to see if there is anything wrong in the log? Check this tutorial for doing so.
It's also worth to try to disable the mTLS to see if this error continues (you need to delete the authorization policy as well). I'm a little bit suspecting it may be somehow related to mTLS but not sure.

Yes maybe but this issue occurs only after applying authorizationpolicy and as soon as i delete it things work as they are supposed to. Can you take a lot at the manifests, maybe i am doing something wrong here ?
 Tried moving AuthorizationPolicy to istio-system as well but still the same issue.

I confirm the same behaviour happening with istio 1.4.6. i disabled mTLS and had the same effect.

Same issue here. I have three pods -> App, db, dbadmin. When I apply an Authorizationpolicy on App (see below). The app cannot connect to the DB and even the dbadmin can't connect to the DB. Both throwing a "connection terminated unexpectedly" or "connection closed"
---
apiVersion: "security.istio.io/v1beta1"
kind: "AuthorizationPolicy"
metadata:
  name: sb-allow-auth
spec:
  selector:
    matchLabels:
      app: sb-identity
  action: ALLOW
  rules:
    - to:
      - operation:
          paths: ["/.well-known/jwks.json"]
      - operation:
          methods: ["POST"]
          paths: ["/auth", "/users"]
      - operation:
          methods: ["GET"]
          paths: ["/.well-known/jwks.json"]
    - from:
      - source:
          requestPrincipals: ["*"]

@TimVosch not sure about this but I haven't seen this in any cluster that I have, however, the propagation takes seconds here (Usually <1m).


navigationBarView.statusBarStyle = .LightContent not working

When having SideNavigationViewController as the windows root controller navigationBarView.statusBarStyle = .LightContent is not working, what I had to do is to override that class and implement the following to make it work:
import UIKit
import MK

class TMSideNavigationViewController: SideNavigationViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.setNeedsStatusBarAppearanceUpdate()
        //        self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
    }

    override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return .LightContent
    }

    override func prefersStatusBarHidden() -> Bool {
        return false
    }

}

please note that I have "View controller-based status bar appearance" set to "YES" in the plist

Hi @sohayb, you should set the "View controller-based status bar appearance" to "NO"
Let me know :)

Yeah that worked! Apparently, "YES" is the default as well, because I didn't set it at first.
Thanks a lot!

Same problem.But i don't get you :(

You have to set the value in the info.plist file.


IFD Integration

Fixing #5

This almost works...
I had to do a little trick.
So when node2nix runs, it runs npm install.
When npm install runs, it actually runs: preinstall, install postinstallandprepare`.
If I add npm run build to preinstall. This ensures that the build runs before installation. This is required in order to build the dist, as I believe node2nix must inject a postinstall command that sets up the symlinks for the bin.
However this actually breaks npm install, since this then tries to compile before we have even installed any of the dependencies.
The proper place to put npm run build is in prepare script. This runs before prepublish, publish, postpublish.
But then nix-build ./release.nix -A application fails.

Relevant:

https://stackoverflow.com/a/42076477/582917
https://github.com/svanderburg/node2nix/issues/149

There are a couple solutions here.

Build dist ahead of time before running nix-build, then you don't use the --development flag, and you build only with the dependencies not devDependencies, this is how we used to do it, and we committed dist to source.

This defeats the purpose of IFD
Easy to do, just remove the nix-gitignore.gitignoreSource

Make nix do the actual build. This means node2nix to first get development dependencies... then run the build.

This is what we want, we want Nix to do the full building including the fetching of dependencies.
However the final package shouldn't include all of the dev dependencies... it should only have what is needed.

If all dependencies that are needed to build the dist are in devDependencies, then as soon as the build is done, another derivation can basically extract out the dist via a publish or npm pack and use that as the output. Then use node2nix for the normal dependencies.
Anyway this is not usable for now since the npm install is broken.

Need to hack node2nix so that the bin magic gets redesigned. Because however it is done, it should really be done AFTER prepare stage.

It must be reiterated that this is only relevant for Node packages that exposes executables. It is pretty useless for packages that don't expose executables.
For example if one were to be using webpack, node2nix is not relevant at all. Instead you might use Nix to run webpack instead and produce the dist directory directly. That will be interesting to try for the typescript-demo-spa.

So there's a way to create a minimal Nix package. That would be extracting the dist and bin and node_modules out of the $out built from the derivation.
Of course we would also need to inject in a preinstall command to build it. That way the derivation is actually building stuff into a temporary directory.
Anyway the build directory can then be dropped, since the files are copied, and there are no symlinks pointing back.
This package can then be packaged up for other situations too, and targeting different releases. It may even be possible to build our own docker representation too. And eventually other kinds of target platforms.

@robert-cronin this still requires some work to be done. Especially in order to properly integrate nix and especially if js-polykey can be packaged in docker. Leaving it for now as there are other higher priorities... but we will need to resolve this eventually.

Neat! I've re-used your IFD and tried to align it a bit with callCabal2nix here https://gist.github.com/sorki/e23c3462f60e0b6a1eaa7d9fc3ac5480
I'm not going to use this for now due to sandbox false requirement, instead using a projects fork with nix files added https://github.com/otevrenamesta/matrix-appservice-slack/commit/9edd9153653434472300b2b0a0b2a4cd83172b01.

Neat! I've re-used your IFD and tried to align it a bit with callCabal2nix here https://gist.github.com/sorki/e23c3462f60e0b6a1eaa7d9fc3ac5480
I'm not going to use this for now due to sandbox false requirement, instead using a projects fork with nix files added https://github.com/otevrenamesta/matrix-appservice-slack/commit/9edd9153653434472300b2b0a0b2a4cd83172b01.

Hey if you see my previous comments you can see that node2nix doesn't work for docker. So that has to be fixed first.

Hey if you see my previous comments you can see that node2nix doesn't work for docker. So that has to be fixed first.

Regarding the docker build, I think the problems lies within the different handling of symlink'd directory between dockerTools and node2nix.
In an application build, $out/bin is a symlink.
~/m/T/result ❯❯❯ ll
total 9.0K
lrwxrwxrwx 25 root root 21 Jan  1  1970 bin -> lib/node_modules/.bin
dr-xr-xr-x  3 root root  3 Jan  1  1970 lib

In a docker build, <container_root>/bin is a plain directory.
[nix-shell:~/matrix.ai/TypeScript-Demo-Lib/container]$ ll
total 34
dr-xr-xr-x 2 root root 3 Jan  1  1970 bin
dr-xr-xr-x 3 root root 3 Jan  1  1970 lib
dr-xr-xr-x 3 root root 3 Jan  1  1970 nix
drwxr-xr-t 2 root root 2 Jan  1  1970 tmp

Therefore the symlink inside bin/ breaks.
# Application build
~/m/T/result ❯❯❯ ll bin/
total 512
lrwxrwxrwx 2 root root 64 Jan  1  1970 typescript-demo-lib -><EMAIL_ADDRESS>
# Docker build
[nix-shell:~/matrix.ai/TypeScript-Demo-Lib/container]$ ll bin/
total 1
lrwxrwxrwx 1 root root 64 Jan 15 11:56 typescript-demo-lib -><EMAIL_ADDRESS>

Regarding the docker build, I think the problems lies within the different handling of symlink'd directory between dockerTools and node2nix.
In an application build, $out/bin is a symlink.
~/m/T/result ❯❯❯ ll
total 9.0K
lrwxrwxrwx 25 root root 21 Jan  1  1970 bin -> lib/node_modules/.bin
dr-xr-xr-x  3 root root  3 Jan  1  1970 lib

In a docker build, <container_root>/bin is a plain directory.
[nix-shell:~/matrix.ai/TypeScript-Demo-Lib/container]$ ll
total 34
dr-xr-xr-x 2 root root 3 Jan  1  1970 bin
dr-xr-xr-x 3 root root 3 Jan  1  1970 lib
dr-xr-xr-x 3 root root 3 Jan  1  1970 nix
drwxr-xr-t 2 root root 2 Jan  1  1970 tmp

Therefore the symlink inside bin/ breaks.
# Application build
~/m/T/result ❯❯❯ ll bin/
total 512
lrwxrwxrwx 2 root root 64 Jan  1  1970 typescript-demo-lib -><EMAIL_ADDRESS>
# Docker build
[nix-shell:~/matrix.ai/TypeScript-Demo-Lib/container]$ ll bin/
total 1
lrwxrwxrwx 1 root root 64 Jan 15 11:56 typescript-demo-lib -><EMAIL_ADDRESS>

And this can be fixed by turning on the keepContentDirlinks flag for dockerTools.buildImage.
    # When copying the contents into the image, preserve symlinks to
    # directories (see `rsync -K`).  Otherwise, transform those symlinks
    # into directories.
    keepContentsDirlinks ? false,

And this can be fixed by turning on the keepContentDirlinks flag for dockerTools.buildImage.
    # When copying the contents into the image, preserve symlinks to
    # directories (see `rsync -K`).  Otherwise, transform those symlinks
    # into directories.
    keepContentsDirlinks ? false,

@nzhang-zh can you explain the difference between this and #16?
I'm guessing since we have 2 problems: docker builds and build staging of dev dependencies, we can have 2 separate MRs? One to simply solve the first, and the second requires more effort?
Both problems can use the IFD style.

@nzhang-zh can you explain the difference between this and #16?
I'm guessing since we have 2 problems: docker builds and build staging of dev dependencies, we can have 2 separate MRs? One to simply solve the first, and the second requires more effort?
Both problems can use the IFD style.

the difference between this and #16?

#16's description has a summary of what it does. It is a copy of our previous workaround for js-polykey. It invokes npm run build at build stage with dev dependencies linked into the build directory as node_modules.

This PR offers a simpler fix than IFD to the node2nix build problems using this as the main reference.
Changes:

Add -d flag to node2nix call when generating nix files to include dev dependencies.
Symlinks node2nix's generated dependencies into build directory and run npm run build.
Creates a bin/typescript-demo-lib executable script that refers to the actual exe script in dist .
Copy dist and bin into $out in install phase.

we can have 2 separate MRs? One to simply solve the first, and the second requires more effort?

Sounds like a good plan. But the simple solution for docker actually works on top of the current IFD branch.

Both problems can use the IFD style.

The docker issue doesn't really require IFD. It is a dockerTools usage issue rather than node2nix issue. But the solution does build on top of the IFD branch.

the difference between this and #16?

#16's description has a summary of what it does. It is a copy of our previous workaround for js-polykey. It invokes npm run build at build stage with dev dependencies linked into the build directory as node_modules.

This PR offers a simpler fix than IFD to the node2nix build problems using this as the main reference.
Changes:

Add -d flag to node2nix call when generating nix files to include dev dependencies.
Symlinks node2nix's generated dependencies into build directory and run npm run build.
Creates a bin/typescript-demo-lib executable script that refers to the actual exe script in dist .
Copy dist and bin into $out in install phase.

we can have 2 separate MRs? One to simply solve the first, and the second requires more effort?

Sounds like a good plan. But the simple solution for docker actually works on top of the current IFD branch.

Both problems can use the IFD style.

The docker issue doesn't really require IFD. It is a dockerTools usage issue rather than node2nix issue. But the solution does build on top of the IFD branch.

Ok then @nzhang-zh get this PR ready to be merged first, squash and rebase and also clean up anything I didn't miss.
So this will solve the docker problem at least first, and will this solution here work for js-polykey as well?
I think @robert-cronin will need to first get rid of webpack and revert js-polykey back to a normal CLI-related project and synchronise its project metadata with typescript-demo-lib style.
Then we can test integration back into Matrix OS to ensure that js-polykey is still working properly and this time as a container...

Ok then @nzhang-zh get this PR ready to be merged first, squash and rebase and also clean up anything I didn't miss.
So this will solve the docker problem at least first, and will this solution here work for js-polykey as well?
I think @robert-cronin will need to first get rid of webpack and revert js-polykey back to a normal CLI-related project and synchronise its project metadata with typescript-demo-lib style.
Then we can test integration back into Matrix OS to ensure that js-polykey is still working properly and this time as a container...

Then after we merge this, we then redo #16 but based on IFD instead, and the goal there would be to produce the final executable output without the dev dependencies and only any non-dev dependencies.

Then after we merge this, we then redo #16 but based on IFD instead, and the goal there would be to produce the final executable output without the dev dependencies and only any non-dev dependencies.

Also can any #16 be synthesised into this PR?

Also can any #16 be synthesised into this PR?

Another attempt.

Turned off node2nix generated npm install and added our own npm run build and npm install in postInstall
Build is done using dev ifd and the dev dependency is replaced with production dependency after npm run build and npm install in postInstall as well

Another attempt.

Turned off node2nix generated npm install and added our own npm run build and npm install in postInstall
Build is done using dev ifd and the dev dependency is replaced with production dependency after npm run build and npm install in postInstall as well

Squash rebase please.

Squash rebase please.

Awesome!
@robert-cronin please review. We can start applying this to js-polykey.

Awesome!
@robert-cronin please review. We can start applying this to js-polykey.


docs: update contributing docs to add path flag

Summary

update contributing docs to show how to run test runner on specific files
Test Plan

Thank you!


Pooling Layer of PyTorch functional result in wrong graph

Describe the bug
The issue arises in complex architectures like InceptionV3, when functional pooling layers are used in a module that has multiple layer processed in parallel.
In this case, the graph representation is incorrect.
To Reproduce
Steps to reproduce the behavior:
import torchvision
from rfa_toolbox import create_graph_from_pytorch_model, toggle_coerce_torch_functional

# disable the raise condition and treat all functional layers as convolutional layers with kernel_size=3 and stride_size=2
toggle_coerce_torch_functional(True, kernel_size=3, stride_size=2)
model = torchvision.models.inceptionv3()
graph = create_graph_from_pytorch_model(model)
visualize_architecture(graph, "inceptionv3", input_res=32).view()

Additional context
To avoid people making false assumption due to this bug, this is currently classified as a raise-Condition and will crash the graph-creation if not actively disabled, like in the example code.
This bug can be avoided easily by not using pooling-layers from torch.functional and instead use the object-equivalents in torch.nn

A potential fix has been found by decomposing the string representation of JIT-compiled-graph.
It will take a few days to implement though.

This issue has been addressed and solved with the release of https://github.com/MLRichter/receptive_field_analysis_toolbox/releases/tag/v1.4.0
Pooling layers are now no longer absorbing other ops or getting absorbed.
Also, kernel and stride sizes are now directly pulled from the compute graph for this type of layer.
The insights gained from this may be used later extract such meta-information from other layers as well in future releases.


rebase the master from docker/distribution

ref https://github.com/deis/builder/issues/344

Will this PR allow the various components that use this library to talk to the relatively old build of Minio that we use?

yes...if you see my commit are on top of the rebase and i would be doing more intense testing before making changes to the repos where this is used before changing to use this specific commit as we are currently pinning to use a specific commit

can we rebase off an official release, please? I'd rather not support production registries off master.

closing in favor of #14


Dependency Resolution failure on Android Studio, Distro: Arch Linux

I am trying to use hover on my project using Kotlin, but I get the following error on gradle build. It works fine on windows but fails on Linux
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform artifact 'android-sdk.aar (com.hover:android-sdk:0.17.0-rc13)' to match attributes {artifactType=jar} Show Details Affected Modules: FugeeDoc-app   ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform artifact 'android-sdk.aar (com.hover:android-sdk:0.17.0-rc13)' to match attributes {artifactType=jar} Show Details Affected Modules: FugeeDoc-app   ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform artifact 'android-sdk.aar (com.hover:android-sdk:0.17.0-rc13)' to match attributes {artifactType=jar} Show Details Affected Modules: FugeeDoc-app   ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform artifact 'android-sdk.aar (com.hover:android-sdk:0.17.0-rc13)' to match attributes {artifactType=jar} Show Details Affected Modules: FugeeDoc-app   ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform artifact 'android-sdk.aar (com.hover:android-sdk:0.17.0-rc13)' to match attributes {artifactType=jar} Show Details Affected Modules: FugeeDoc-app

Hi @EdwardMuturi , try adding @aar to the dependency like this: com.hover:android-sdk:0.17.0-rc13@aar. If that doesn't work could you please paste your build.gradle contents here?

here is my module gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "techfugees.hackathon.fugeedoc"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation("com.hover:android-sdk:0.17.0-rc13@aar") {
        transitive = true
    }
//    implementation 'com.hover:android-sdk:0.17.0-rc13@aar'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation("androidx.activity:activity-ktx:1.0.0-alpha05")
    implementation("androidx.fragment:fragment-ktx:1.1.0-alpha05")
    implementation("com.google.android.material:material:1.1.0-alpha04")
    implementation("androidx.recyclerview:recyclerview:1.1.0-alpha03")
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
}

As you can see, I have tried adding it as a single dependency(the commented line) still no success

Though downgrading to gradle 3.1.4 works
after hours of debugging :laughing:

Sorry about that! It is strange because we are using the android gradle tools version 3.3.1 with gradle 4.10.1
We do have an Android X variant as well, maybe that is part of the issue. You can switch to that by using implementation("com.hover:android-sdk:0.17.0-rc13-androidx@aar") { transitive = true }

using the above steps still gets an error
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'android-sdk-0.17.0-rc13-androidx.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Failed to transform file 'android-sdk-0.17.0-rc13-androidx.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to transform file 'android-sdk-0.17.0-rc13-androidx.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Failed to transform file 'android-sdk-0.17.0-rc13-androidx.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'android-sdk-0.17.0-rc13-androidx.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

So I decided to stick with downgrading to gradle 3.1.4 option
NB: Can you update the hover docs for android X support for future devs

Ok, thanks for the info. I'll actually leave this open till we can figure out why that is happening.
Yes, we will add a note to the docs.

Perhaps this solution will work: https://stackoverflow.com/questions/51795731/failed-to-transform-file-some-lib-release-aar-to-match-attributes-artifacttyp

thanks, I'll try to recreate the bug then follow up with it

changed our dependencies to support lib v28 and everything works okay.
seems like the issue is when using android x

Great, thanks!


LLD

lld is a really important linker.The RISCV backend linker has been developed by many engineer all of the world.But the RISCV vector extension seems quiet.

👌

sure in
https://plctlab.github.io/PLCT-Roadmap-2021.html

sure in
https://plctlab.github.io/PLCT-Roadmap-2021.html


Datastore document IDs not returned on datastore.runQuery()

Just upgraded to the latest datastore package w/ Promises. When I run datastore.runQuery(myQuery), the result is an array containing the queried documents and cursor information. The documents do not contain any identifying information, and I don't see is any way to retrieve the IDs of those documents as I could before.
How should I go about getting these document IDs?

I believe this is caused by the change introduced in https://github.com/GoogleCloudPlatform/google-cloud-node/pull/1682. Can you try that?

That's the problem - Thanks so much!

No problem, sorry we haven't found a great way to document breaking changes. Thanks for being patient!


teach brew about mksh

[x] Have you followed the guidelines in our Contributing document?
[x] Have you checked to ensure there aren't other open Pull Requests for the same change?
[x] Have you added an explanation of what your changes do and why you'd like us to include them?
[ ] Have you written new tests for your changes? Here's an example.

[x] Have you successfully run brew tests with your changes locally?

Teach brew about mksh.
Before:
$ brew info openssl                                                                                [120/120]
openssl: stable 1.0.2r (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2r (1,795 files, 12.1MB)
  Poured from bottle on 2019-05-03 at 14:10:40
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:

For pkg-config to find openssl you may need to set:

After:
$ brew info openssl
openssl: stable 1.0.2r (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2r (1,795 files, 12.1MB)
  Poured from bottle on 2019-05-12 at 20:24:19
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.kshrc

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

Thanks so much for your first contribution!  You rock, @minusf!


Folding

Need to sync vscode folds to neovim. from the initial look onDidChangeTextEditorVisibleRanges could be used with :{range}fold command
Rebind neovim folding keys/commands to call vscode folds commands

Perhaps add a note about folding not being supported just now to known issues in README?

Any progress on this? Opening folds makes this extension almost unusable for me.

@pianocomposer321 This one is very tricky, because the folding API has a sad story in vscode. The range event is very generic and there are many limitations/issues with it.

I found this solution on another issue. It's actually for vscodevim, but I like this extension much better, and it still works for it, with a few changes. Instead of changing the keybindings in vscode's keybindins.json do this:
if exists('g:vscode')
nnoremap j :call VSCodeCall('cursorDown')
nnoremap k :call VSCodeCall('cursorUp')
endif
I was ssssoooo happy that this works, and I don't know why nobody ever thought of it before! it doesn't even slow vscode down!

You need <cr> on the ends, but anyway good workaround, if you don't use something like 10j. Although this could be modified by looking into v:count and calling it in the loop (but cursor movement may be slow in this case). Alternative way is the cursorMove command which supports jump count, but it opens folds as i remember correctly

I meant to use , forgot that when typing it. But it is in my init.vim.
Actually, things like 10j do work, but a little slower than before.

So I actually have noticed a bit of a lag, but a much bigger problem is that remapping the keys to cursorDown and cursorUp makes the neovim instance think that the cursor is on a different line then it is in some cases. This causes problems like dd deleting the wrong line, yy yanking the wrong line, etc.
There is another solution that I think may work, but I don't know how to implement it. Pressing gj and gk skip over folds as they should, but in my init.vim I actually had already mapped j and k to gj and gk before I started using vscode neovim, but vscode neovim does not seem to use those mappings. Any ideas?

I just solved my own problem. I just changed nnoremap j gj to nmap j gj. Not sure why this doesn't cause an endless loop, or why it solves the problem, but it works!

gj/gk are mapped to cursorMove command this why it solves your problem. Looks like vscode devs have finally fixed cursorMove to skip over folds. nnoremap j gj skips these custom mappings so they're trying to use native neovim's gj which is same as j because set nowrap

Actually, they haven't fixed it. I just did some experiments and it only skips folds when you specify "by": "wrappedLine". Anyway, I'm really glad this works, because cursorMove seems to be a lot more efficient than cursorDown and cursorUp.

So, I determined that the lag I was experiencing with both of my solutions didn't have anything to do with the vscode commands, there is actually lag with VSCodeCall(). So I changed by keybindings.json to make j and k call cursorMove instead of doing it in the init.vim. This works and solves the lag, but it does break things like 10j and 10k.
So I have two questions. First, is VSCodeNotify any more efficient than VSCodeCall? And secondly, if not, do you know of any way to fix 10j etc?

First, is VSCodeNotify any more efficient than VSCodeCall
In this case yes, should be. The main difference the notify one is not blocking. For VSCodeCall neovim sends an event to the extension, the extension handles it, awaiting a result of vscode.commands.executeCommand(...), then sends it back to neovim. While it's doing all of this, neovim is blocked and doesn't process any inputs, means if you press and hold j the second j won't be handled until a response comes from the first one.
VSCodeNotify is "send and forget". However using it may produce a cursor jitter since an events are handled independently and they be out of order. But it may be not case for simple j/k movement, so i'd try it.

And secondly, if not, do you know of any way to fix 10j etc?
No way. VSCode keybindings don't accept dynamic pre-chords. Using a simple extension specially for this potentially may work in theory, but in reality it needs to listen to type vscode event and vscode allows to utilize it only by single extension.

Thank you. VSCodeNotify takes care of the lag. It doesn't look quite as nice - the cursor looks like it skips a few lines when I press and hold j, but that's much better than overshooting a line of code.

The more I tried it, the more I noticed the cursor jitter becoming a problem. So I tried disabling all extensions except neovim, and this solved the problem. I tracked down the extension that was causing the lag, and I found out it was Bracket Pair Colorizer 2, which makes sense because it has to redraw colors for the brackets every time the cursor enters a different bracket pair. I should have thought of this in the first place. I am not having any problems now!
btw, I did change VSCodeNotify back to VSCodeCall in my init.vim and have not noticed any problems so far.
Thank you for all your help!

I'm not quite following all the discussion about VSCodeNotify and related internals. What exactly do I need to do to get indent folding to work? I'd really appreciate it if someone could summarize the workaround.

@6a68 just set nmap j gj and nmap k gk in ~/.config/nvim/init.vim (potentially with restriction of exists('g:vscode')) and also set Vscode-neovim: Neovim Init Path to ~/.config/nvim/init.vim or equivalent.

nmap j gj and nmap k gk works, thx! I use ctrl + shift [ and ] to fold code in vscode,  but when I use za, it shows: No fold found, I have add set foldmethod=indent to init.vim, any solution?

I have add set foldmethod=indent to init.vim, any solution?

This option is hardcoded.

Note that the mapping of j and k to gj and gk does work for folds, but it breaks the use of those keys while recording macros.
Here's a workaround I use that avoids breaking macros:
    " Get folding working with vscode neovim plugin
        if(exists("g:vscode"))
            nnoremap zM :call VSCodeNotify('editor.foldAll')<CR>
            nnoremap zR :call VSCodeNotify('editor.unfoldAll')<CR>
            nnoremap zc :call VSCodeNotify('editor.fold')<CR>
            nnoremap zC :call VSCodeNotify('editor.foldRecursively')<CR>
            nnoremap zo :call VSCodeNotify('editor.unfold')<CR>
            nnoremap zO :call VSCodeNotify('editor.unfoldRecursively')<CR>
            nnoremap za :call VSCodeNotify('editor.toggleFold')<CR>

            function! MoveCursor(direction) abort
                if(reg_recording() == '')
                    return 'g'.a:direction
                else
                    return a:direction
                endif
            endfunction

            nmap <expr> j MoveCursor('j')
            nmap <expr> k MoveCursor('k')
        endif

The downside with this is that navigating through folds is broken while recording a macro.

Note that the mapping of j and k to gj and gk respectively does work for folds, but it breaks the use of those keys while recording macros.
Here's a workaround I use that avoids breaking macros:
    " Get folding working with vscode neovim plugin
        if(exists("g:vscode"))
            nnoremap zM :call VSCodeNotify('editor.foldAll')<CR>
            nnoremap zR :call VSCodeNotify('editor.unfoldAll')<CR>
            nnoremap zc :call VSCodeNotify('editor.fold')<CR>
            nnoremap zC :call VSCodeNotify('editor.foldRecursively')<CR>
            nnoremap zo :call VSCodeNotify('editor.unfold')<CR>
            nnoremap zO :call VSCodeNotify('editor.unfoldRecursively')<CR>
            nnoremap za :call VSCodeNotify('editor.toggleFold')<CR>

            function! MoveCursor(direction) abort
                if(reg_recording() == '' && reg_executing() == '')
                    return 'g'.a:direction
                else
                    return a:direction
                endif
            endfunction

            nmap <expr> j MoveCursor('j')
            nmap <expr> k MoveCursor('k')
        endif

The downside with this is that navigating through folds is broken while recording a macro.

when I press 'o' my cursor jump to folded function, how would you fix that?

Note that the mapping of j and k to gj and gk respectively does work for folds, but it breaks the use of those keys while recording macros.
Here's a workaround I use that avoids breaking macros:
    " Get folding working with vscode neovim plugin
        if(exists("g:vscode"))
            nnoremap zM :call VSCodeNotify('editor.foldAll')<CR>
            nnoremap zR :call VSCodeNotify('editor.unfoldAll')<CR>
            nnoremap zc :call VSCodeNotify('editor.fold')<CR>
            nnoremap zC :call VSCodeNotify('editor.foldRecursively')<CR>
            nnoremap zo :call VSCodeNotify('editor.unfold')<CR>
            nnoremap zO :call VSCodeNotify('editor.unfoldRecursively')<CR>
            nnoremap za :call VSCodeNotify('editor.toggleFold')<CR>

            function! MoveCursor(direction) abort
                if(reg_recording() == '' && reg_executing() == '')
                    return 'g'.a:direction
                else
                    return a:direction
                endif
            endfunction

            nmap <expr> j MoveCursor('j')
            nmap <expr> k MoveCursor('k')
        endif

The downside with this is that navigating through folds is broken while recording a macro.

This code provides the same functionality as the code above minus the fold control bindings and the vscode check.
That is to say it will allow you to use j and k to navigate past folds without breaking macros in most cases.

The solution from @yogeshdhamija and @SubaruArai suffers from the issue that the cursor aligns after navigation up/down to the rightmost column of the line with smallest width. That's different from vim usual navigation. Example of the issue with those workarounds:
https://user-images.githubusercontent.com/14967831/220864268-37f922af-22b6-4df4-9382-5676acaee3c5.mp4
Does any of the workarounds not have this issue? Maybe I missed something.

Could https://github.com/microsoft/vscode/issues/36638 help with this issue?

@SubaruArai, thank you for this solution, works like a charm! 🎉
The only downside is that it breaks the zb, zz, zt navigation commands for me. Does anybody know how to restore them, possibly via further custom keybindings?

I found this solution on another issue. It's actually for vscodevim, but I like this extension much better, and it still works for it, with a few changes. Instead of changing the keybindings in vscode's keybindins.json do this:
if exists('g:vscode') nnoremap j :call VSCodeCall('cursorDown') nnoremap k :call VSCodeCall('cursorUp') endif
I was ssssoooo happy that this works, and I don't know why nobody ever thought of it before! it doesn't even slow vscode down!

Help me so much!!!!

Reference for future PR: really good information on folding https://github.com/vscode-neovim/vscode-neovim/pull/993.

Note that the mapping of j and k to gj and gk respectively does work for folds, but it breaks the use of those keys while recording macros.
Here's a workaround I use that avoids breaking macros:
    " Get folding working with vscode neovim plugin
        if(exists("g:vscode"))
            nnoremap zM :call VSCodeNotify('editor.foldAll')<CR>
            nnoremap zR :call VSCodeNotify('editor.unfoldAll')<CR>
            nnoremap zc :call VSCodeNotify('editor.fold')<CR>
            nnoremap zC :call VSCodeNotify('editor.foldRecursively')<CR>
            nnoremap zo :call VSCodeNotify('editor.unfold')<CR>
            nnoremap zO :call VSCodeNotify('editor.unfoldRecursively')<CR>
            nnoremap za :call VSCodeNotify('editor.toggleFold')<CR>

            function! MoveCursor(direction) abort
                if(reg_recording() == '' && reg_executing() == '')
                    return 'g'.a:direction
                else
                    return a:direction
                endif
            endfunction

            nmap <expr> j MoveCursor('j')
            nmap <expr> k MoveCursor('k')
        endif

The downside with this is that navigating through folds is broken while recording a macro.

This code provides the same functionality as the code above minus the fold control bindings and the vscode check. That is to say it will allow you to use j and k to navigate past folds without breaking macros in most cases. Macros will still be broken when navigating past folds. vim.keymap.set only works with neovim 0.7.0+
local function moveCursor(direction)
    if (vim.fn.reg_recording() == '' and vim.fn.reg_executing() == '') then
        return ('g' .. direction)
    else
        return direction
    end
end

vim.keymap.set('n', 'k', function()
    return moveCursor('k')
end, { expr = true, remap = true })
vim.keymap.set('n', 'j', function()
    return moveCursor('j')
end, { expr = true, remap = true })

if vim.v.count == 0 and vim.fn.reg_recording() == "" and vim.fn.reg_executing() == "" then

I added vim.v.count == 0 condition check to make 10j work normally

Note that the mapping of j and k to gj and gk respectively does work for folds, but it breaks the use of those keys while recording macros.
Here's a workaround I use that avoids breaking macros:
            nmap <expr> j MoveCursor('j')
            nmap <expr> k MoveCursor('k')
        endif

The downside with this is that navigating through folds is broken while recording a macro.

This will cause an issue when holding down a direction key  and then hitting CTRL would snap the cursor backwards. I suspect because g has a delay to see what the next key is.
using nnoremap  if possible addresses this.

for the MoveCursor solution can cause a slight problem if you are holding down a direction key and then hitting cltr immediately which can happens alot if you use CTRL shortcuts.
using nnoremap instead of nmap if possible to get around this.

I add this to my keymap.lua，it work well for me:
local function mapMove(key, direction)
  vim.keymap.set('', key, function()
    local count = vim.v.count
    local v = 1
    local style = 'wrappedLine'
    if count > 0 then
      v = count
      style = 'line'
    end
    vscode.action('cursorMove', {
      args = {
        to = direction,
        by = style,
        value = v
      }
    })
  end, options)
end

mapMove('k', 'up')
mapMove('j', 'down')

Is there a solution in visual mode to navgiate across folded area with j/k?

@pinkfrog9 https://github.com/vscode-neovim/vscode-neovim/issues/58#issuecomment-1775424814

@pinkfrog9 #58 (comment)

@xiyaowong I am using the above approach. But it only works in normal mode.

@pinkfrog9 Sorry, I forgot that this plugin doesn't support visual mode either.

@pinkfrog9 make a lua script hackKeymap.lua
-- vim script 中的 cursorMove 不支持 select 参数
-- 所以这里通过lua脚本，同样调用 cursorMove，但是可以传递 select 参数
-- !但仍然存在问题：
-- 1. cursorMove 会破坏 visual line 模式，所以 visual line 模式只会保留一次，然后就会变成 visual 模式
-- 2. 文档中存在有中文时，移动过程中，col 会出现偏移，导致选区不准确
-- local vim_api = vim.api
-- 行内移动
local function moveInLine(d)
    require('vscode-neovim').action('cursorMove', {
        args = {{
            to = d == 'end' and 'wrappedLineEnd' or 'wrappedLineStart',
            by = 'wrappedLine',
            -- by = 'line',
            -- value = vim.v.count1,
            -- value = vim.v.count,
            value = 0,
            select = true
        }}
    })
    return '<Ignore>'
end

-- 行间移动
local function moveLine(d)
    -- local current_mode = vim.api.nvim_get_mode().mode
    require('vscode-neovim').action('cursorMove', {
        args = {{
            to = d == 'j' and 'down' or 'up',
            by = 'wrappedLine',
            -- by = 'line',
            value = vim.v.count1,
            -- value = vim.v.count,
            select = true
        }}
        -- not work
        -- callback = function()
        --     -- cb()
        --     if current_mode == 'V' then
        --         vim.schedule(function()
        --             vim_api.nvim_input('V')
        --         end)
        --         -- vim_api.nvim_input('V')
        --         -- vim_api.nvim_feedkeys('V', 'x', false)
        --         -- vim_api.nvim_feedkeys('V', 'v', true)
        --         -- debug.debug()
        --         -- return 'V'
        --     end
        --     -- return '<Ignore>'
        -- end
    })
    return '<Ignore>'
end

local function move(d)
    return function()
        -- 获取当前编辑模式
        local current_mode = vim.api.nvim_get_mode().mode
        -- Only works in charwise visual and visual line mode
        -- if current_mode ~= 'v' and current_mode ~= 'V' then
        --     return 'g' .. d
        -- end

        -- 因为 moveCursor 会破坏 visual line 模式，所以 visual line 模式只会保留一次，然后就会变成 visual 模式
        -- 因此这段逻辑在一次选区的动作中只会执行一次
        if current_mode == 'V' then
            moveLine(d)
            if d == 'j' then
                moveInLine('end')
            else
                moveInLine('start')
            end
        else
            -- 获取当前选区的标记的位置（<）
            local start_pos = vim.api.nvim_buf_get_mark(0, "<")
            local end_pos = vim.api.nvim_buf_get_mark(0, ">")
            -- 提取列号 和 行号
            local start_line = start_pos[1]
            local start_col = start_pos[2]
            local end_line = end_pos[1]
            local end_col = end_pos[2]

            -- 获取光标当前列号
            local cursor_col = vim.fn.col('.')
            -- 获取当前行最大列号
            local line_end_col = vim.fn.col('$')
            -- 获取选区的结束行文本内容
            local selected_end_line_text = vim.fn.getline(end_line)
            -- 获取当前光标位置的行号和列号
            -- 参数 0 表示当前窗口
            local cursor = vim.api.nvim_win_get_cursor(0)
            -- 提取行号
            local current_line = cursor[1]

            -- 如果选区只有一行，而且整行内容都已被选中
            -- 那么在执行完行间移动后，就将新行的光标移动到行首或行尾
            -- 实现模拟 visual line 的效果
            -- 最后直接返回，不再执行下面的逻辑
            if start_col == 0 and end_col + 1 == #selected_end_line_text and start_line == end_line then
                moveLine(d)
                if d == 'j' then
                    moveInLine('end')
                else
                    moveInLine('start')
                end
                return '<Ignore>'
            end

            -- 其他情况
            moveLine(d)

            -- k方向，向上移动
            -- 如果选区的结束行行内容被全选中，那么在执行完行间移动后，就将新行的光标移动到行尾
            -- 实现模拟 visual line 的效果
            if end_col + 1 == #selected_end_line_text and current_line < end_line then
                moveInLine('start')
                -- return 'V'
            end
            -- j方向，向下移动
            -- 如果选区的开始行行内容被全选中，那么在执行完行间移动后，就将新行的光标移动到行首
            -- 实现模拟 visual line 的效果
            if start_col == 0 and current_line > start_line then
                moveInLine('end')
                -- return 'V'
            end
        end
        return '<Ignore>'
    end
end

vim.keymap.set('v', 'gj', move('j'), {
    expr = true,
    noremap = true,
    silent = true
})
vim.keymap.set('v', 'gk', move('k'), {
    expr = true,
    noremap = true,
    silent = true
})

local function moveCursor(d)
    return function()
        -- 当 v.count 为 0 时，表示没有使用数字修饰符，此时可以执行自定义的移动
        -- 否则，执行原生的移动，如 10j
        if (vim.v.count == 0 and vim.fn.reg_recording() == '' and vim.fn.reg_executing() == '') then
            return 'g' .. d
        else
            return d
        end
    end
end

-- 依赖于 gj 和 gk 的定义，所以要放在 gj 和 gk 的后面
vim.keymap.set('', 'k', moveCursor('k'), {
    expr = true,
    remap = true,
    silent = true
})
vim.keymap.set('', 'j', moveCursor('j'), {
    expr = true,
    remap = true,
    silent = true
})

and config your init.vim like:
if exists('g:vscode')
    " hack vscode keymap with support of folding code block
    lua require('hackKeymap')
else
    " some other config
endif

@lfire This is beautiful mate - Been trying to find a solution that works comfortably for a while and between this and #983 and the solution given by @jemorriso and @Laurensdc this is almost a perfect full setup.
Only leaves fold hanging - scrolling with C-e & C-y in vscode causing vscode to hitch (I presume because it's treating it as if the fold was still open).

Simple remap of j/k to gj/gk did NOT work for me.
vim.remap.set("n", "j", "gj")

I'm using luascript for my config, not sure if that matters.  Adding @road2coder 's code works for me. Thanks!

@pinkfrog9 make a lua script hackKeymap.lua
-- vim script 中的 cursorMove 不支持 select 参数
-- 所以这里通过lua脚本，同样调用 cursorMove，但是可以传递 select 参数
-- !但仍然存在问题：
-- 1. cursorMove 会破坏 visual line 模式，所以 visual line 模式只会保留一次，然后就会变成 visual 模式
-- 2. 文档中存在有中文时，移动过程中，col 会出现偏移，导致选区不准确
-- local vim_api = vim.api
-- 行内移动
local function moveInLine(d)
    require('vscode-neovim').action('cursorMove', {
        args = {{
            to = d == 'end' and 'wrappedLineEnd' or 'wrappedLineStart',
            by = 'wrappedLine',
            -- by = 'line',
            -- value = vim.v.count1,
            -- value = vim.v.count,
            value = 0,
            select = true
        }}
    })
    return '<Ignore>'
end

-- 行间移动
local function moveLine(d)
    -- local current_mode = vim.api.nvim_get_mode().mode
    require('vscode-neovim').action('cursorMove', {
        args = {{
            to = d == 'j' and 'down' or 'up',
            by = 'wrappedLine',
            -- by = 'line',
            value = vim.v.count1,
            -- value = vim.v.count,
            select = true
        }}
        -- not work
        -- callback = function()
        --     -- cb()
        --     if current_mode == 'V' then
        --         vim.schedule(function()
        --             vim_api.nvim_input('V')
        --         end)
        --         -- vim_api.nvim_input('V')
        --         -- vim_api.nvim_feedkeys('V', 'x', false)
        --         -- vim_api.nvim_feedkeys('V', 'v', true)
        --         -- debug.debug()
        --         -- return 'V'
        --     end
        --     -- return '<Ignore>'
        -- end
    })
    return '<Ignore>'
end

local function move(d)
    return function()
        -- 获取当前编辑模式
        local current_mode = vim.api.nvim_get_mode().mode
        -- Only works in charwise visual and visual line mode
        -- if current_mode ~= 'v' and current_mode ~= 'V' then
        --     return 'g' .. d
        -- end

        -- 因为 moveCursor 会破坏 visual line 模式，所以 visual line 模式只会保留一次，然后就会变成 visual 模式
        -- 因此这段逻辑在一次选区的动作中只会执行一次
        if current_mode == 'V' then
            moveLine(d)
            if d == 'j' then
                moveInLine('end')
            else
                moveInLine('start')
            end
        else
            -- 获取当前选区的标记的位置（<）
            local start_pos = vim.api.nvim_buf_get_mark(0, "<")
            local end_pos = vim.api.nvim_buf_get_mark(0, ">")
            -- 提取列号 和 行号
            local start_line = start_pos[1]
            local start_col = start_pos[2]
            local end_line = end_pos[1]
            local end_col = end_pos[2]

            -- 获取光标当前列号
            local cursor_col = vim.fn.col('.')
            -- 获取当前行最大列号
            local line_end_col = vim.fn.col('$')
            -- 获取选区的结束行文本内容
            local selected_end_line_text = vim.fn.getline(end_line)
            -- 获取当前光标位置的行号和列号
            -- 参数 0 表示当前窗口
            local cursor = vim.api.nvim_win_get_cursor(0)
            -- 提取行号
            local current_line = cursor[1]

            -- 如果选区只有一行，而且整行内容都已被选中
            -- 那么在执行完行间移动后，就将新行的光标移动到行首或行尾
            -- 实现模拟 visual line 的效果
            -- 最后直接返回，不再执行下面的逻辑
            if start_col == 0 and end_col + 1 == #selected_end_line_text and start_line == end_line then
                moveLine(d)
                if d == 'j' then
                    moveInLine('end')
                else
                    moveInLine('start')
                end
                return '<Ignore>'
            end

            -- 其他情况
            moveLine(d)

            -- k方向，向上移动
            -- 如果选区的结束行行内容被全选中，那么在执行完行间移动后，就将新行的光标移动到行尾
            -- 实现模拟 visual line 的效果
            if end_col + 1 == #selected_end_line_text and current_line < end_line then
                moveInLine('start')
                -- return 'V'
            end
            -- j方向，向下移动
            -- 如果选区的开始行行内容被全选中，那么在执行完行间移动后，就将新行的光标移动到行首
            -- 实现模拟 visual line 的效果
            if start_col == 0 and current_line > start_line then
                moveInLine('end')
                -- return 'V'
            end
        end
        return '<Ignore>'
    end
end

vim.keymap.set('v', 'gj', move('j'), {
    expr = true,
    noremap = true,
    silent = true
})
vim.keymap.set('v', 'gk', move('k'), {
    expr = true,
    noremap = true,
    silent = true
})

local function moveCursor(d)
    return function()
        -- 当 v.count 为 0 时，表示没有使用数字修饰符，此时可以执行自定义的移动
        -- 否则，执行原生的移动，如 10j
        if (vim.v.count == 0 and vim.fn.reg_recording() == '' and vim.fn.reg_executing() == '') then
            return 'g' .. d
        else
            return d
        end
    end
end

-- 依赖于 gj 和 gk 的定义，所以要放在 gj 和 gk 的后面
vim.keymap.set('', 'k', moveCursor('k'), {
    expr = true,
    remap = true,
    silent = true
})
vim.keymap.set('', 'j', moveCursor('j'), {
    expr = true,
    remap = true,
    silent = true
})

and config your init.vim like:
if exists('g:vscode')
    " hack vscode keymap with support of folding code block
    lua require('hackKeymap')
else
    " some other config
endif

But there is still a small issue, vscode action cursorMove not support vim visual line mod, and it'll break to visual mod.

In my practice, this is currently the best way, hope this helps you！
There was an MR(#502) before, but unfortunately: it’s outdated

@lfire This only works in visual mode and worked perfectly but not working in normal mode.

I seem to have a more comfortable solution, but this method has a drawback: if the previous or next line of the cursor line is a folding range after switching from visual-line mode to normal mode, moving in the folding direction will cause the fold to open. But in other aspects, the experience is the same as neovim to the greatest extent. Unlike the hackKeymap.lua script mentioned above, this solution uses the real visual-line mode. Because the vscode-neovim plug-in has bound gj gk to CursorMove, I directly used the remap method. I don't know if my solution is correct.
vim.api.nvim_create_autocmd("ModeChanged", {
    callback = function()
        local current_mode = vim.fn.mode()
        if previous_mode == 'V' and current_mode == 'n' then
            -- 从 visual-line 模式 切换到 normal mode
            vim.keymap.set({ "n", "x", "o" }, "e", function()
                vim.cmd("normal! j")
                vim.keymap.set({ "n", "x", "o" }, "e", "gj", { remap = true, silent = true })
            end, { remap = false, silent = true, desc = "Move Down" })

            vim.keymap.set({ "n", "x", "o" }, "u", function()
                vim.cmd("normal! k")
                vim.keymap.set({ "n", "x", "o" }, "u", "gk", { remap = true, silent = true })
            end, { remap = false, silent = true, desc = "Move Down" })

            vim.keymap.set({ "n", "x", "o" }, "E", function()
                vim.cmd("normal! 5j")
                vim.keymap.set({ "n", "x", "o" }, "E", "5gj", { remap = true, silent = true })
            end, { remap = false, silent = true, desc = "Move Down" })

            vim.keymap.set({ "n", "x", "o" }, "U", function()
                vim.cmd("normal! 5k")
                vim.keymap.set({ "n", "x", "o" }, "U", "5gk", { remap = true, silent = true })
            end, { remap = false, silent = true, desc = "Move Down" })
        end
        previous_mode = current_mode
    end
})

With all the Neovim lua approaches here, I thought I'd share my workaround in keybindings.json.
/* keybindings.json */
{
  // vim: folds
  { "key": "z a", /* toggle fold */ "command": "editor.toggleFold", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z o", /* unfold */ "command": "editor.unfold", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z O", /* unfold recursively */ "command": "editor.unfoldRecursively", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z c", /* fold */ "command": "editor.fold", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z shift+r", /* unfold all */ "command": "editor.unfoldAll", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z shift+c", /* fold recursively */ "command": "editor.foldRecursively", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z shift+m", /* fold all */ "command": "editor.foldAll", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z shift+v", /* fold all except */ "command": "editor.foldAllExcept", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 1", /* set fold level */ "command": "editor.foldLevel1", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 2", /* set fold level */ "command": "editor.foldLevel2", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 3", /* set fold level */ "command": "editor.foldLevel3", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 4", /* set fold level */ "command": "editor.foldLevel4", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 5", /* set fold level */ "command": "editor.foldLevel5", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 6", /* set fold level */ "command": "editor.foldLevel6", "when": "editorTextFocus && neovim.mode == 'normal'" },
  { "key": "z 7", /* set fold level */ "command": "editor.foldLevel7", "when": "editorTextFocus && neovim.mode == 'normal'" },
}

  // passthrough
  { "key": "z z", "command": "vscode-neovim.send", "args": "zz", "when": "editorTextFocus && neovim.mode != insert" }
}

Caveats:

can't type z when doing r z (replace character).
Any other z<something> keybindings need to have passthrough key bindings (like the last line).

If I need to navigate over folds frequently, I'd rather create the fold with Neovim by typing zf{motion} or {Visual}zf, which corresponds to the foldings provided by the VSCode.
https://github.com/user-attachments/assets/f22d2ba6-95fa-4154-bd53-9a787e866b45


ALF Automation

Brackets: Please merge this pull request created by ALF. @ArturOledzki @pantkowiak @ybayer FYI

@walfgithub The conversion is looing weird.. Can you take a look..

@walfgithub can you give us more context on what this change is about?

@prafulVaishnav @abose I am not really sure but I think @walfgithub is some kind of bot created by Adobe

@abose This change is due to this PR

Ok, got it.  the change looks odd.

String that look like "[7693766] !é=<English version of string>=!" are temporary placeholders used in the localization process. These are used to mark that a string still needs to be localized and also provides a longer string (because many languages strings are longer than English) to verify UI is not broken.
Another commit will be coming from WALF soon with final translations.
Be sure that these are all fixed before final release.

Thanks @redmunds . The new transalations are submitted now, so merging.


Enhancement on Rancher UI timeout in HA deployment

What kind of request is this (question/bug/enhancement/feature request):
enhancement
Steps to reproduce (least amount of steps as possible):

Deploy Rancher in HA deployment
Issue shutdown or docker stop command on one of the Rancher VMs
Try refresh the Rancher UI after issued the command

Result:
Rancher UI will become unresponsive for around 1 ~ 3 minutes
Other details that may be helpful:
default timeout in Rancher ingress  (nginx.ingress.kubernetes.io/proxy-connect-timeout: "30")

After talking to @cloudnautique, it looks like the relatively high - 30s - periodSeconds value was put to address an initial container start. If we dial it down, then we might need to increase initialDelaySeconds (currently 60 seconds) https://github.com/rancher/rancher/blob/master/chart/templates/deployment.yaml#L109


Paths not working as expected with --find-links

Hello,
The behaviour of --find-links seems to have changed, possibly with #7912 (shipped in version 0.4.19). In version 0.4.18, the following line works to install a .whl stored in a local directory e.g. Sentiment Analysis/en_core_web_sm/en_core_web_sm-3.7.1-py3-none-any.whl:
uv pip install --find-links="Sentiment Analysis/en_core_web_sm" en_core_web_sm

However, in versions >0.4.18, the following error is printed:
error: invalid value 'Sentiment' for '--find-links <FIND_LINKS>': relative URL without a base

It looks like it is treating the file path as a URL and also splitting it on the space character?

Thanks, that's a bug on my part.


Update desktop tutorial

Hi Roshan,
I have updated the tutorial for Github Desktop.  Please take a look and merge it to the master.
Thanks,
Cherian.

How do I resolve the conflicts?

Thank you for your time and effort you spend on this @cheriannet.
Merging this.

No problem. It was fun and a huge learning experience for me. Thank you for creating and maintaining this project in Github.


honor ZED_LAKE in the Python client

Verifying python client respecting the ZED_LAKE environment variable
First start the Zed lake any port but the default.
zed lake serve -l :9888 -R ../lake-root

Set the ZED_LAKE environment variable to localhost:9888.
ZED_LAKE=http://localhost:9888

Create a pool called Demo.
zapi create Demo

(This zapi command respected the environment variable)
Load data in the Demo pool.
echo '{hello: "world"}' | zapi load -use Demo@main -

(This zapi command also respected the environment variable)
I then copied the python code from the README, put it in a file called main.py, and ran it.
python3 main.py

And it worked.
{'hello': 'world'}


add basic thread support

Any advice, will with more feature,
come from uvbook, thread-create.lua
local uv = require('luv')

local hare_id = uv.new_thread()
local tortoise_id = uv.new_thread()
local step = 10

uv.thread_create(hare_id,function(step)
    local ffi = require'ffi'

    local sleep
    if ffi.os=='Windows' then
        ffi.cdef "void Sleep(int ms);"
        sleep = ffi.C.Sleep
    else
        ffi.cdef "unsigned int usleep(unsigned int seconds);"
        sleep = ffi.C.usleep
    end
    while (step>0) do
        step = step - 1
        sleep(1000)
        print("Hare ran another step")
    end
    print("Hare done running!")
end, step,true,'abcd','false')

uv.thread_create(tortoise_id,function(step)
    while (step>0) do
        step = step - 0.5
        print("Tortoise ran another step")
    end
    print("Tortoise done running!")
end,step,'abcd','false')

print(hare_id==hare_id,uv.thread_equal(hare_id,hare_id))
print(tortoise_id==hare_id,uv.thread_equal(tortoise_id,hare_id))

uv.thread_join(hare_id)
uv.thread_join(tortoise_id)

Thanks for getting this started.  I'll look into it.

I'm a little concerned about threads having access to side-effects like print, especially if that's via libuv.
I think we could make something like web-workers quite safely.  We could even use uv_async to send messages between threads.

Yes,thread and work need more think and good design,it it long term work,now just begin.

It hard work to make lua script  as work_cb and after_work_cb. serial callback code everytime will a lots of CPU time

Hi @creationix,  When I read http://nikhilm.github.io/uvbook/threads.html#inter-thread-communication, I realize that
uv_async_t is design for ITC(inter-thread-communication) , main loop thread create it and share it with thread or threadpool.
But according https://github.com/luvit/luv/blob/master/src/async.c#L31-L52 and https://github.com/luvit/luv/blob/master/docs.md#uv_async_t--async-handle
, after uv.new_async create async object,we have no method to pass to sub or others threads.
When try to code http://nikhilm.github.io/uvbook/threads.html#inter-thread-communication with luv, it cause async.c design or find a way share userdata.
In my options, async should behind in thread.c and work.c, maybe will broken freezed code.

work demo
local uv = require('luv')

local ctx = uv.new_work(
    function(n) --work,in threadpool
        local uv = require('luv')
        local t = uv.thread_self()
        print(t)
        uv.sleep(100)
        return n*n,n
    end,
    function(r,n) print(string.format('%d => %d',n,r)) end    --after work, in loop thread
)
uv.queue_work(ctx,2)
uv.queue_work(ctx,4)
uv.queue_work(ctx,4)
uv.queue_work(ctx,4)
uv.queue_work(ctx,4)

uv.run('default')
uv.loop_close()


Include alpha and beta components out of the box

For FINERACT-970, I am (need to) use gcloud beta builds triggers run XYZ in my YAML using this GitHub Action, but this currently fails due to "beta components" not being installed - and their automatic installation apparently not "just" working out of the box.
I'll see if I can fix this just by adding --quiet, but would there be any downside to just always including "beta components" in the image of this action? -- Or could/should --quiet perhaps by made true by default in this image?
#103 seems to be somewhat related to this.

Can you run gcloud components install beta in your script? The problem is that the alpha/beta components are just as large as the main one, so installing one or both doubles or triples install time.

@sethvargo yup, just figured that (before reading this), and done so in https://github.com/apache/fineract/pull/901 - that seems to works great, see here. Just FTR to future reader: Using --quiet didn't work (https://github.com/apache/fineract/pull/900).
I'm closing this. (Re-open if you think there is still any follow-up action required.)


[ufo3] fix tests and replace guideline.fontInfo by guideline.font

Requires https://github.com/unified-font-object/ufoLib/pull/39

tests: guideline.getParent() can return guideline.font since e87e0c
tests: use unicode_literals in tests_imageSet
tests: update identifier tests to match 71516c
glyph: replace guideline.fontInfo by guideline.font as in e87e0c

Tests broken. At least we know the CI is working! :)

To be perfectly honest. I have no idea how this autotesting works. I should probably do some research. :)

@typesupply Thanks!
What about unified-font-object/ufoLib#39?


GetBlob on archive tier blob should fail

Which service(blob, file, queue, table) does this issue concern?
Blob
Which version of the Azurite was used?
3.31.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
Docker. From mcr.microsoft.com/azure-storage/azurite:3.31.0
What's the Node.js version?
As in the container. It is v20.10.0.
What problem was encountered?
GetBlob on an archive tier blob succeeded. It should fail.
Steps to reproduce the issue?

Upload a block blob
Change tier to archive
GetBlob succeeds, which it should not according to the documentation.

Ref: https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob#remarks

The debug log contains request made with Azure Storage Explorer and might contain requests for listing blobs as well.
debug.log
Have you found a mitigation/solution?
No

@kfcss
Thanks for raising this issue!
It looks archive tier fail request still no implemented in Azurite.
Azurite welcome contribution!
It would be great if you could raise a PR to fix this.


Decide whether to apply clippy to codebase

We of course don't need to adopt the suggestions whole cloth, but we should see whether we can get a good signal-to-noise ratio coming from Clippy.

Just like rustfmt, clippy's behavior tend to change over time. New checks are constantly being added, and false positives are removed.
Clippy is a fantastic tool, and everybody should enable it in its text editor, but forcing the clippy output to be clean on make test would be annoying.
This would force people to use a specific version of the toolchain to work on Lucet. And this is not great.
Right now, the test suite cannot run unless a specific version of Rust is installed, which is neither the current stable one, nor the one provided by Linux distributions.
Just because of the rustfmt check.
And unlike rustfmt which is pretty stable, clippy is quite frequently broken on nightlies. But we shouldn't prevent people running rust-nightly, or a different version of clippy, from being able to seamlessly hack the Lucet code.
Clippy outputs quite a few interesting warnings (and, currently, will stop its analysis due to a fatal error in lucet-analyze). We should address them, and welcome any contribution that improves clippy-cleanliness.
But I think we shouldn't enforce it like we do with rustfmt.

I'm frustrated that rustfmt's behavior changes over time, and that our current install of it isn't on stable (because we decided to wait for 1.34.1).
Frank's recommendations for clippy use are spot on with my experiences.

Looks like we are all on the same page :)

Going to keep this open, even though we aren't planning to include it in CI. I still want to see what it can find when we drive it manually.


Add EPANET and SWMM result reading examples and unit tests.

This is a simple pull request, which adds unit tests and notebooks for already existing functionality and fixes a few issues to make them work.

@ecomodeller Good suggestion. I added the tests.


extract union of all keys of objects in a tuple.

TypeScript Version:  3.9.0

Search Terms:
mapped type tuple object keys
union of keys of all objects in a tuple
Code
type A = [{
  b: 'b'
}, {
  a: 'a',
}];

type B = {
  [i in Extract<keyof A, number>]: keyof A[i];
}[Extract<keyof A, number>];

function b(b: B) {
  b // is type never, should be "a" | "b"
}

My thinking:
{ [i in Extract<keyof A, number>]: keyof A[i]; }
// should map to
["a", "b"]

// so indexing that resulting tuple
[Extract<keyof A, number>]

// should return
"a" | "b"

Can be worked around by hard coding expected tuple lengths ...
type Indices = 0 | 1 | 2 ...;
type B = {
  [i in Indices]: keyof A[i];
}[Indices];

Expected behavior:
I would like to extract a union of all the keys found in any of the objects in a tuple. It should return "a" | "b", not never.
Actual behavior:
type B is never.

See #13298; this is not supported and will not be.

Is that what I’m trying to do? I’m not looking to get a tuple from a union. I’m trying to get a union from a tuple. I also showed how it’s possible with a workaround. Am I misunderstanding the issue you linked?

type A = [{
  b: 'b'
}, {
  a: 'a',
}];

type Keys1<T extends { [n: number]: unknown }> = T[number];
type Keys2<T> = T extends T ? keyof T : never;
type Keys<T extends { [n: number]: unknown }> = Keys2<Keys1<T>>;

// "b" | "a"
type B = Keys<A>;

Thanks for the quick turnaround on a solution!
I’m curious, why is the T extends T required?
Is there a reason why my original example doesn’t work or is it a bug?
Thanks again! You rock.

You need to distribute the union out and do the key extraction on each part, rather than taking keyof on the union as a whole

Yeah that makes sense. I thought I was doing that by taking keyof each item in the tuple and union of the results. Guess not? Feel free to close if you consider this resolved. Thanks again.

It's tricky to predict when things will distribute like you expect and when they won't. The behavior in the OP is as intended, I believe.


Resolve test_registry tests from raiden/[...]/test_registry

Go over old raiden/[...]/test_registry and rebuild the tests that that are missing.  sub #92

[ ]  assess if tests have to be rebuild
[ ] if yes, rebuild them

test_registry - some of it should have been covered by https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network_registry.py#L94, but it seems I messed up the test, so it must be fixed to actually test token_to_token_networks and not secret_registry_address & chain_id

add a separate test for calling createERC20TokenNetwork twice with the same token -> should fail
event test is already covered by https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network_registry.py#L112

test_registry_reject_empty_address - covered by https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network_registry.py#L62
test_registry_nonexistent_token - covered by https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network_registry.py#L62
test_all_contracts_same_version - covered by multiple tests:
https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network_registry.py#L13-L15
https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_token_network.py#L6-L7
https://github.com/raiden-network/raiden-contracts/blob/d6e7f6d08ff3a0c723b83600cae851bb479d137d/raiden_contracts/tests/test_secret_registry.py#L9-L11


Only One GPU is Active When Using Four GPUs for Testing on a Different Dataset with nuscene.pth from PTV3

Hello,
I've encountered an issue while testing the nuscene.pth model from PTV3 on a different dataset. Despite setting the number of GPUs to 4, it appears that only one GPU is actively running during the test. I'm unsure if this behavior is expected or if it indicates a potential problem with the multi-GPU setup or model compatibility.
Is it normal for only one GPU to be active under these settings, or should all four GPUs be utilized for testing? Any guidance or insights on this matter would be greatly appreciated.
Thank you.

Hi, all four GPUs should engage with the testing process. Did you set "CUDA_VISIABLE_DEVICES=0,1,2,3" or start the test process with our script/test.sh?

Thank you for your previous response; it has been very helpful. However, I've encountered a new issue while continuing my work with the ptv3 project and attempting to apply nuScenes dataset parameters to other datasets.
Specifically, when I apply the parameters from nuScenes to other datasets, I notice that the number of points in the results is less than in the original data. Additionally, the structures of origin_segment and segment do not match, leading me to suspect that some points may have been lost during the data processing or augmentation phase.
I appreciate any guidance or suggestions you could offer on this new problem. Thank you once again for your support.

Hi, if you mean cached results in the exp folder, for the current version of Pointcept, we only save the first downsampled predictions for the dual grid-sampling testing strategy. When we need to resume testing, these downsampled results will be mapped back to the shape of orgin_segment. While for future versions, we will add more options.

Thank you for your reply. Just to confirm, does this mean that full testing capabilities are not yet available in the current version?

I mean that the results from the test process are already "full testing capabilities". Just the cached prediction is downsampled for saving the local disk.

Hi, all four GPUs should engage with the testing process. Did you set "CUDA_VISIABLE_DEVICES=0,1,2,3" or start the test process with our script/test.sh?

Could you please explain the difference between these two methods?
I used "CUDA_VISIBLE_DEVICES=0,1,2,3" for testing, only one GPU was engaged in the process.
Then I used script/test.sh for testing, but still, only one GPU was engaged in the process.
My command is :
CUDA_VISIBLE_DEVICES=5,6,7 sh scripts/test.sh -p python -g 3 -d scannet -n semseg-pt-v2m2-0-base -w model_best
Is there anything wrong with my command?
How can I resolve this issue?

Looks correct for me. How about:
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}
sh scripts/test.sh -p python -g 3 -d scannet -n semseg-pt-v2m2-0-base -w model_best

Looks correct for me. How about:
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}
sh scripts/test.sh -p python -g 3 -d scannet -n semseg-pt-v2m2-0-base -w model_best

It's still not working. I don't know why


Consistently getting "git am failed, likely because of an in-progress 'git am' or 'git rebase'"

Hi there! I'd like to use your gh extension, but I can't seem to get past the below.  Am I missing anything? Thanks!
$ DRY_RUN=1 UPSTREAM_REMOTE='origin' GITHUB_USER='<org>' gh cherry-pick origin/<branch> <pr>

+++ Updating remotes...
Fetching origin
Fetching origin
+++ Creating local branch automated-cherry-pick-of-#104-origin-22.03.10-release-1647630777
Branch 'automated-cherry-pick-of-#104-origin-22.03.10-release-1647630777' set up to track remote branch '22.03.10-release' from 'origin'.
Switched to a new branch 'automated-cherry-pick-of-#104-origin-22.03.10-release-1647630777'
+++ Downloading patch to /var/folders/bc/m16t7t31117_scz1zv30bt600000gq/T/tmp.BHw5MiMX/104.patch (in case you need to do this again)

+++ About to attempt cherry pick of PR. To reattempt:
  $ git am -3 /var/folders/bc/m16t7t31117_scz1zv30bt600000gq/T/tmp.BHw5MiMX/104.patch

Patch format detection failed.
!!! git am failed, likely because of an in-progress 'git am' or 'git rebase'

+++ Aborting in-progress git am.

I've verified that no am or rebase operations are in progress, and still get this every time, even when I start on the main branch with no changes:
$ git status
On branch automated-cherry-pick-of-#<pr>-origin-<branch>-1647630777
Your branch is up to date with 'origin/<branch>'.

nothing to commit, working tree clean
$ git am  --abort
fatal: Resolve operation not in progress, we are not resuming.
$ git rebase --abort
fatal: No rebase in progress?

If it's the first time you run with this extension, and there is an in-progress am, on cleanup stage it will abort so that you don't see the state in-progress later.
What's the output you run git am -3 /var/folders/bc/m16t7t31117_scz1zv30bt600000gq/T/tmp.BHw5MiMX/104.patch after the script failed? Or can you provide a reproducible repo and branch so that I can dig into it?

@lizziemac yes. That's possible your auth account doesn't have permission to access that pr you'd like o cherry pick.
You can run gh auth status to see whether it's the account with required permission.

I'll close this issue later as information delivered above. If it's not the case and there're other questions. Feel free to comment or reopen then.


Create apple and oranges.cpp

this is the solution for apple and oranges

Sorry, this repo is not accepting pull requests at the moment.


FEAT: Add nbconvert conversion from IPYNB to HTML

This PR adds the ability to compile html from a collection of generated notebooks using nbconvert. This supports the use of templates to allow for customisation of pages during the conversion process.
To allow this functionality add the following keys to conf.py configuration file.
`# generate html from IPYNB files
jupyter_generate_html = True
jupyter_html_template = "/path-to-template.tpl"`
This PR also has all the code of :-  https://github.com/QuantEcon/sphinxcontrib-jupyter/pull/170 on top of which it is built.

@AakashGfude thanks for all your work on this branch!
I have just setup this PR for visibility of this new upcoming feature. Can you update the description with how to configure and use the html conversion. Thanks.

@AakashGfude thanks for all your work on this branch!
I have just setup this PR for visibility of this new upcoming feature. Can you update the description with how to configure and use the html conversion. Thanks.

Done

@AakashGfude if this is the thing you sent me, I think it's good to go on our end.

thanks @AakashGfude this is looking great. Can you update CI or do you need me to look into that?

thanks @AakashGfude. When you get the chance can you update docs to include this feature.

thanks @AakashGfude. When you get the chance can you update docs to include this feature.

@mmcky had written the conf variables needed at the end of the Configuration heading in  README.md . and had modified the summary to include the functionalities. Do tell me if I should add something more.

hey @AakashGfude would you mind updating this PR to remove the conflicts?

@AakashGfude let me know when you get this updated via slack and then I will merge and start updating the build server and getting preview updated.

thanks @AakashGfude. This is a great addition.


Plop 3.x.x fails to recognize ".ts" extension

Likely caused by #45
When running npx plop command or npx plop message-handler, Plop no longer recognizes ".ts" as a valid file extension:
$ npx plop command
[PLOP] Something went wrong with reading your plop file TypeError: Unknown file extension ".ts" for /home/dsleung/discord-bot/plopfile.ts
    at new NodeError (node:internal/errors:371:5)
    at Object.file: (node:internal/modules/esm/get_format:72:15)
    at defaultGetFormat (node:internal/modules/esm/get_format:85:38)
    at defaultLoad (node:internal/modules/esm/load:13:42)
    at ESMLoader.load (node:internal/modules/esm/loader:303:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:58)
    at new ModuleJob (node:internal/modules/esm/module_job:63:26)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:244:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Change to plopfile.js, replace the types with jsdoc annotation:
export default function (
	/** @type {import('plop').NodePlopAPI} */
	plop
) {
}

Should be much faster too.