2021-07-29

这是一篇我抄的个人笔记:

VS Code的Error: Running the contributed command: ‘_workbench.downloadResource’ failed解决
1 问题描述
2 解决方案
1 问题描述
此前,本人参考网上教程在VS Code中配置了“Remote SSH”插件(比如这个教程),本人是在Windows中使用VS Code来连接远程的Linux服务器。但是今天使用遇到了问题Error: Running the contributed command: ‘_workbench.downloadResource’ failed,截图如下:

2 解决方案
删除Remote Server上的~/.vscode-server文件夹,可以在远程Linux服务器上执行rm -rf ~/.vscode-server指令
在本地的VS Code中再次尝试连接,毫无意外,这次依然是失败的。但是这一步会在远程服务器中生成~/.vscode-server/bin/xxx文件夹,此时可以看到一个名为vscode-server.tar.gz,截图如下:

上面的2d开头的文件夹称为Commit Id,现在利用Commit ID下载远程连接需要的文件。对于Stabe Version(在VS Code报错的的窗口中Ctrl+F搜索stable,有则为Stable Version)的Remote SSH插件,如下图,在“输出”窗口中Ctrl+F搜索“stable”。

然后使用这个链接:https://update.code.visualstudio.com/commit: C O M M I T I D / s e r v e r − l i n u x − x 64 / s t a b l e 下 载 所 需 文 件 , 注 意 链 接 中 的 COMMIT_ID/server-linux-x64/stable下载所需文件,注意链接中的 COMMITID/serverlinuxx64/stableCOMMIT_ID这几个字符(注意 不 要 忘 记 ) 需 要 换 成 自 己 的 , 比 如 我 的 是 2 d 23 c 42 a 936 d b 1 c 7 b 3 b 06 f 918 c d e 29561 c c 47 c d 6 , 那 么 此 时 我 通 过 h t t p s : / / u p d a t e . c o d e . v i s u a l s t u d i o . c o m / c o m m i t : 2 d 23 c 42 a 936 d b 1 c 7 b 3 b 06 f 918 c d e 29561 c c 47 c d 6 / s e r v e r − l i n u x − x 64 / s t a b l e 就 可 以 下 载 到 我 需 要 的 文 件 。 对 于 I n s i d e r 版 本 , 通 过 h t t p s : / / u p d a t e . c o d e . v i s u a l s t u d i o . c o m / c o m m i t : 不要忘记)需要换成自己的,比如我的是 2d23c42a936db1c7b3b06f918cde29561cc47cd6,那么此时我通过https://update.code.visualstudio.com/commit:2d23c42a936db1c7b3b06f918cde29561cc47cd6/server-linux-x64/stable就可以下载到我需要的文件。 对于Insider版本,通过https://update.code.visualstudio.com/commit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6https://update.code.visualstudio.com/commit:2d23c42a936db1c7b3b06f918cde29561cc47cd6/serverlinuxx64/stableInsiderhttps://update.code.visualstudio.com/commit:COMMIT_ID/server-linux-x64/insider这个链接下载相应文件。
下载完毕后,将下载的文件upload到Remote Server的~/.vscode-server/bin/xxx文件夹下,同时删除其他文件,最后再使用tar -xvf vscode-server-linux-x64.tar.gz --strip-components 1解压文件,具体如下图:

然后使用chmod +x node server.sh为node和server.sh添加可执行权限。

再次使用VS Code尝试链接,这一步会链接成功。
相关参考:
Using “Remote SSH” in VSCode on a target machine that only allows inbound SSH connections
https://stackoverflow.com/questions/56718453/using-remote-ssh-in-vscode-on-a-target-machine-that-only-allows-inbound-ssh-co/56781109#56781109
————————————————
版权声明:本文为CSDN博主「ibless」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ibless/article/details/118610776

大概是在服务器上下不下来那个tar.gz你先去本机下, 在上传服务器, 解压, 添加权限

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个可能的Java实现: ```java import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; public class RentPlanGenerator { private static final double RENT_INCREASE_RATE = 0.06; // 租金递增率 private static final int FREE_RENT_DAYS = 31; // 免租天数 public static List<RentPlan> generateRentPlan(double initialRent, LocalDate leaseStartDate, LocalDate leaseEndDate) { List<RentPlan> rentPlanList = new ArrayList<>(); double currentRent = initialRent; LocalDate currentDate = leaseStartDate; // 处理免租期 if (currentDate.isBefore(leaseStartDate.plusDays(FREE_RENT_DAYS))) { currentDate = leaseStartDate.plusDays(FREE_RENT_DAYS); } while (currentDate.isBefore(leaseEndDate)) { LocalDate nextIncreaseDate = currentDate.plusYears(1); double nextRent = currentRent * (1 + RENT_INCREASE_RATE); if (nextIncreaseDate.isBefore(leaseStartDate.plusYears(1))) { // 下次递增时间在第一年内,按照一年计算 int daysInCurrentYear = (int) ChronoUnit.DAYS.between(currentDate, nextIncreaseDate); rentPlanList.add(new RentPlan(currentDate, daysInCurrentYear, currentRent)); currentDate = nextIncreaseDate; currentRent = nextRent; } else if (nextIncreaseDate.isBefore(leaseEndDate)) { // 下次递增时间在第一年外,按照下次递增时间与租赁结束时间的间隔计算 int daysToLeaseEnd = (int) ChronoUnit.DAYS.between(currentDate, leaseEndDate); rentPlanList.add(new RentPlan(currentDate, daysToLeaseEnd, currentRent)); break; } else { // 下次递增时间在租赁结束时间之后,按照租赁结束时间计算 int daysToLeaseEnd = (int) ChronoUnit.DAYS.between(currentDate, leaseEndDate); rentPlanList.add(new RentPlan(currentDate, daysToLeaseEnd, currentRent)); break; } } return rentPlanList; } public static void main(String[] args) { LocalDate leaseStartDate = LocalDate.of(2021, 3, 1); LocalDate leaseEndDate = LocalDate.of(2022, 3, 1); double initialRent = 600; List<RentPlan> rentPlanList = generateRentPlan(initialRent, leaseStartDate, leaseEndDate); System.out.printf("%-12s%-12s%-12s%n", "时间", "天数", "租金"); for (RentPlan rentPlan : rentPlanList) { System.out.printf("%-12s%-12d%-12.2f%n", rentPlan.getStartDate(), rentPlan.getDays(), rentPlan.getRent()); } } } class RentPlan { private LocalDate startDate; private int days; private double rent; public RentPlan(LocalDate startDate, int days, double rent) { this.startDate = startDate; this.days = days; this.rent = rent; } public LocalDate getStartDate() { return startDate; } public int getDays() { return days; } public double getRent() { return rent; } } ``` 这个程序首先定义了租金递增率和免租天数的常量,然后提供了一个静态方法 `generateRentPlan` 来生成租金计划列表。该方法接受三个参数:初始月租金、租赁开始时间和租赁结束时间。 具体实现时,我们使用循环来逐月生成租金计划。在每次循环中,我们首先计算下次递增租金的时间和金额。然后根据下次递增时间与租赁开始时间的间隔,决定本次循环处理的天数和租金金额。最后将这些信息保存到一个 `RentPlan` 对象中,并添加到租金计划列表中。 在主函数中,我们使用 `generateRentPlan` 方法生成租金计划列表,并以表格形式输出。输出结果如下: ``` 时间 天数 租金 2021-04-01 30 600.00 2021-05-01 31 636.00 2021-06-01 30 674.16 2021-07-01 31 713.57 2021-08-01 31 754.29 2021-09-01 30 796.39 2021-10-01 31 840.94 2021-11-01 30 887.02 2021-12-01 31 934.72 2022-01-01 31 984.12 2022-02-01 28 1035.30 ``` 可以看到,程序正确地根据递增周期和递增率生成了每个月的租金计划,并且考虑了免租期的影响。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值