今天,Visual Studio Code 开始向我展示一个弹出窗口:
需要 Java 11 或更高版本才能运行。请下载并安装最新的JDK。
我需要使用 JDK 8(在 Apache Beam 上工作,这是最后一个受支持的版本)。我一直在努力解决这个问题,直到出现这个问题之前都没有遇到任何问题。
我已经通读了这篇文章并实现了那里提到的要点。
这是我在 Visual Studio Code 上的工作区设置(我已经仔细检查了路径)
{
"java.configuration.updateBuildConfiguration": "disabled",
"java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home",
"default": true
},
{
"name": "JavaSE-11",
"path": "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home",
}
]
}
Run Code Online (Sandbox Code Playgroud)
其他有用的信息:
? echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
Run Code Online (Sandbox Code Playgroud)
和
? which java
/usr/bin/java
Run Code Online (Sandbox Code Playgroud)
尽管我已经在 Visual Studio Code 上成功运行 JDK 8 一段时间了,但今天开始发生这种情况。我不记得更新 Visual Studio Code,所以我不确定为什么现在显示它,因为显然弹出窗口自 4 月中旬以来一直显示(在vscode-java Gitter 频道上询问)。
我正在将 Poetry 与 VSCode 一起使用,并且在运行此命令时遇到错误
\nimport apache_beam as beam\nfrom apache_beam.options.pipeline_options import PipelineOptions\n\nwith beam.Pipeline(options=PipelineOptions()) as p:\n pass # build your pipeline here\nRun Code Online (Sandbox Code Playgroud)\n错误是
\nTraceback (most recent call last):\n File "/path/to/pipeline.py", line 2, in <module>\n import apache_beam as beam\nImportError: No module named apache_beam\nRun Code Online (Sandbox Code Playgroud)\n我的pyproject.toml是
[tool.poetry.dependencies]\npython = "^3.7"\npytest = "^5.4.3"\napache-beam = "^2.23.0"\nRun Code Online (Sandbox Code Playgroud)\n当我跑步时poetry install,我只得到这个
\xe2\x9e\x9c poetry install\nInstalling dependencies from lock file\n\nNo dependencies to install or update\nRun Code Online (Sandbox Code Playgroud)\n这让我认为apache-beam安装正确。
我使用 …
我正在尝试使用 Apps 脚本将一个长一维数组写入工作表中的一列,但无法使其工作。尝试过 setValues() 但它需要一个二维数组。
function writeArrayToColumn() {
var mainSheet = SpreadsheetApp.getActiveSheet()
var array = ["M", "C", "D", "F", "R", "S", "Q", "V", "G"]
var range = mainSheet.getRange(2, 1, array.length, 1)
range.setValue(array)
}
Run Code Online (Sandbox Code Playgroud)
这仅在前 9 个单元格中写入“M”,而不是在 1 个单元格中写入“M”,在 2 个单元格中写入“C”,依此类推。如果我使用 setValues() 我得到一个错误:
Cannot convert Array to Object[][].
Run Code Online (Sandbox Code Playgroud)
Stack Overflow 上也有类似的问题,但没有人能回答这个问题。
在运行docker-compose以启动我的应用程序时,npm ERR! missing script: start尽管指定了启动脚本,但还是得到了提示。
package.json是
{
"name": "myapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~2.6.3",
"ejs": "~2.5.6",
"express": "~4.15.2",
"mongoose": "^4.11.1",
"morgan": "~1.8.1",
"serve-favicon": "~2.4.2"
}
}
Run Code Online (Sandbox Code Playgroud)
和docker-compose.yml是
version: "2"
services:
web:
build: .
volumes:
- ./:/app
ports:
- "3500:3500"
Run Code Online (Sandbox Code Playgroud)
有两件事对我来说没有意义:
不确定是否需要,但Dockerfile是
FROM node:argon
RUN mkdir /app
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
EXPOSE 3500
ENV PORT …Run Code Online (Sandbox Code Playgroud) 我正在尝试安装我在这里找到的代理重新加密方案的python实现.
在运行时$ sudo python setup.py install我收到错误
fatal error: 'openssl/aes.h' file not found
有一些这样的问题(这个或这个(不适用于mac))但没有一个答案解决了我的问题.
我试过了(所有这些都来自我发现的答案):
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography再试;brew install openssl 并再次尝试;brew reinstall python 并再次尝试;选项1.退回
Requirement already satisfied: cryptography in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: six>=1.4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: setuptools>=11.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: cffi>=1.4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied: pyasn1>=0.1.8 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from …Run Code Online (Sandbox Code Playgroud) 我在 C++ 中实现了一个 print_array 函数,并使用 gdb 来调试它。for 循环中似乎存在问题,但我真的不明白为什么。
代码是:
void print_array(const int array[], const int length) {
cout << "[";
for (int i=0; i<length; i++) {
// Last element
if (i == length-1) {
cout << array[i] << "]" << endl;
} else {
// Any other element
cout << array[i] << ", ";
}
}
cout << endl;
}
Run Code Online (Sandbox Code Playgroud)
主要功能是:
int main() {
int array[] = {1, 3, 5, 7, 9, 15, 15, 16, 40, 70};
int length = …Run Code Online (Sandbox Code Playgroud) 的结构my_dir是
??? README.md
??? main
? ??? functions
? ? ??? __pycache__
? ? ??? my_function.py
? ??? pipeline.py
? ??? options
? ? ??? pipeline_options.py
? ??? transforms
? ??? __pycache__
? ??? my_transform.py
??? poetry.lock
??? pyproject.toml
??? tests
Run Code Online (Sandbox Code Playgroud)
在pipeline.py:
from main.functions.my_function import MyFunction
Run Code Online (Sandbox Code Playgroud)
在my_function.py:
import apache_beam as beam
class MyFunction(beam.DoFn):
...
Run Code Online (Sandbox Code Playgroud)
我已经读到这里类似的问题,包括这一个这是解决我目前。另请阅读此Python的进口。
当我跑步时pipeline.py,我得到
Traceback (most recent call last):
File "pipeline.py", line 7, in <module>
from …Run Code Online (Sandbox Code Playgroud) 我安装了 spark 但是当我pyspark在终端上运行时,我得到了
/usr/local/Cellar/apache-spark/2.4.5_1/libexec/bin/pyspark: line 24: /Users/miguel/spark-2.3.0-bin-hadoop2.7/bin/load-spark-env.sh: No such file or directory
/usr/local/Cellar/apache-spark/2.4.5_1/libexec/bin/pyspark: line 77: /Users/miguel/spark-2.3.0-bin-hadoop2.7/bin/spark-submit: No such file or directory
/usr/local/Cellar/apache-spark/2.4.5_1/libexec/bin/pyspark: line 77: exec: /Users/miguel/spark-2.3.0-bin-hadoop2.7/bin/spark-submit: cannot execute: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我试过再次卸载和安装(spark、java、scala),但它一直抛出这个错误。也在这里和 GitHub 问题上搜索过,但找不到任何有用的东西。
附加信息:
brew doctor
(myenv) C02YH1U3FSERT:~ miguel$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file …Run Code Online (Sandbox Code Playgroud) 我有以下 ElGamal 加密方案
const forge = require('node-forge');
const bigInt = require("big-integer");
// Generates private and public keys
function keyPairGeneration(p, q, g) {
var secretKey = bigInt.randBetween(2, q.minus(2));
var publicKey = g.modPow(secretKey, p);
const keys = {
secret: secretKey,
public: publicKey
}
return keys;
}
// Generates a proxy and a user key
function generateProxyKeys(secretKey) {
const firstKey = bigInt.randBetween(1, secretKey);
const secondKey = secretKey.minus(firstKey);
const keys = {
firstKey: firstKey,
secondKey: secondKey
}
return keys;
}
// Re-encrypts
function preEncrypt(p, …Run Code Online (Sandbox Code Playgroud) python ×3
encryption ×2
node.js ×2
apache-beam ×1
apache-spark ×1
c++ ×1
docker ×1
elgamal ×1
encoding ×1
gdb ×1
java ×1
macos ×1
npm ×1
openssl ×1
string ×1