我有一个电子存储库(https://github.com/MartinBarker/RenderTune),当使用命令提示符运行时,它曾经在 Windows 10 上正常工作。几个月后,我回到了一台配备 Nvidia GPU 的全新 Windows 10 机器上,电子应用程序在启动时在窗口中打印了一个错误:
Uncaught TypeError: Cannot read properties of undefined (reading 'getCurrentWindow')
Run Code Online (Sandbox Code Playgroud)
运行 ffmpeg shell 命令也会导致错误,并且在命令提示符终端中输出以下消息:
[14880:1207/145651.085:ERROR:gpu_init.cc(457)] Passthrough is not supported, GL is disabled, ANGLE is
Run Code Online (Sandbox Code Playgroud)
我在我的其他 Windows 笔记本电脑上检查了运行与我的存储库的 master 分支相同的代码,并且在本地运行时运行得非常好。
看来这可能是最近的问题?我发现它在各种论坛中进行了讨论: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1944468
我尝试将我的全局电子 npm 包升级到更新的版本: electro@16.0.4 ,但错误仍然出现。
当用户扩展浏览器窗口时,我希望我的css flexboxes最多有3列.使用我当前的代码,它向内正确弯曲,没有最小列数,但是当向外扩展时,它将始终自动将所有flexbox扩展为一行. http://jsfiddle.net/oq6prk1p/581/
在这种情况下,我试图只使用css文件来实现这一点,并且根本不编辑html文件.到目前为止,这是我最接近的:
html文件:
<main class="twit-container">
<article class="twit">
<div class="twit-icon">
<i class="fa fa-bullhorn"></i>
</div>
<div class="twit-content">
<p class="twit-text">
Sitting in web dev... This class is so awesome!
</p>
<p class="twit-attribution">
<a href="#">CSMajor2017</a>
</p>
</div>
</article>
<article class="twit">
<div class="twit-icon">
<i class="fa fa-bullhorn"></i>
</div>
<div class="twit-content">
<p class="twit-text">
text
</p>
<p class="twit-attribution">
<a href="#">BeaverBeliever</a>
</p>
</div>
</article>
<article class="twit">
<div class="twit-icon">
<i class="fa fa-bullhorn"></i>
</div>
<div class="twit-content">
<p class="twit-text">
text
</p>
<p class="twit-attribution">
<a href="#">NewtonRulez</a>
</p>
</div>
</article>
<article class="twit"> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用纯 javascript 制作 Spotify 身份验证流程,以便用户可以登录,然后我可以为他们的帐户添加新的播放列表。根据我阅读的说明,我使用了一个身份验证弹出窗口,一旦他们登录,URL 中就会有访问令牌。我现在有一个弹出窗口,用户可以使用它进行身份验证,一旦他们这样做,URL 中就会有访问令牌。
我需要从弹出窗口中获取 url 并将其保存为全局变量,但我无法弄清楚如何在 javascript 中执行此操作。
https://codepen.io/martin-barker/pen/YzPwXaz
我的 codepen 打开一个弹出窗口let popup = window.open(
,我可以在弹出窗口中运行一个函数来检测用户何时成功通过身份验证和 url 更改吗?在这种情况下,我想保存解析的 url 并关闭我的弹出窗口
我的javascript代码如下:
async function spotifyAuth() {
let result = spotifyLogin()
}
//open popup
function spotifyLogin() {
console.log("inside spotifyLogin, opening popup")
let popup = window.open(`https://accounts.spotify.com/authorize?client_id=5a576333cfb1417fbffbfa3931b00478&response_type=token&redirect_uri=https://codepen.io/martin-barker/pen/YzPwXaz&show_dialog=true&scope=playlist-modify-public`, 'Login with Spotify', 'width=800,height=600')
}
//get url from popup and parse access token????
window.spotifyCallback = (payload) => {
console.log("inside window? ") //this line never appears in console
popup.close()
fetch('https://api.spotify.com/v1/me', {
headers: { …
Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个 nodejs 网站,该网站将返回用户选择的任何音频文件的长度(以秒为单位)。到目前为止,我可以使用 mp3、wav 和 flac 文件。但它不适用于所有 .m4a 或 .aif 文件
我的带有 javascript 的 HTML 页面的代码如下:
choose audio file to get length:
<input style="cursor: pointer;" type="file" id="file" multiple="multiple" />
<script>
//when files are selected:
$("#file").change(async function (e) {
console.log('file(s) selected')
//get files
var files = e.currentTarget.files;
//get number of files
var numberOfFiles = files.length;
//for each file
for (i = 0; i < numberOfFiles; i++) {
console.log(`songs[${i}].type=`, files[i].type)
//get file length
let songLength = await getSongLength(files[i]);
console.log('songLength=', songLength)
} …
Run Code Online (Sandbox Code Playgroud) 所以我试图用Howler.js来测试播放音频文件.当我运行这个html文件并按下按钮时,我在控制台中收到错误消息"必须使用任何新的Howl传递源文件数组."
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Play Sound</title>
<script src='./howler.js/dist/howler.js'></script>
</head>
<body>
<button id="btn">Play</button>
<script>
var pong = new Howl({urls: ['sound.mp3', 'sound.ogg']});
document.getElementById('btn').onclick=function(){pong.play();}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有两个相邻的框,Box1(左)有一些文本,Box2(右)有很多文本:
如何通过在框 1 上填充更多空白来使框 1 延伸到与框 2 相同的高度?我正在努力使两个盒子的高度相同;我的代码如下所示:
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="card mb-4 box-shadow">
<!-- BOX1 -->
<div class="card-body">
box 1 data here
</div>
</div>
</div> <!-- /col -->
<div class="col-md-8">
<div class="card mb-4 box-shadow">
<!-- BOX2 -->
<div class="card-body">
box 2 data here
box 2 data here
box 2 data here
</div>
</div>
</div> <!-- /col -->
</div> <!-- /row -->
</div>
Run Code Online (Sandbox Code Playgroud)
我有一个工作的 html/js 数据表示例 jsfiddle,它有两个用于导出数据的工作按钮;excel 和 csv。我像这样声明我的数据表:
$('#example').DataTable( {
dom: 'Bfrtip',
columns: [
{ data: 'name' },
{ data: 'surname' },
{ data: 'position' },
{ data: 'office' },
{ data: 'salary' }
],
buttons: [
{
extend: 'excelHtml5',
text: 'excel',
exportOptions: { modifier: { page: 'current' } }
},
{
extend: 'csvHtml5',
text: 'csv',
exportOptions: { modifier: { page: 'current' } }
}
]
} );
Run Code Online (Sandbox Code Playgroud)
在这种情况下会出现两个默认按钮。在我的 html 中,我有两个想要连接到数据表的自定义按钮元素:
<button id='excelExport'>click this to export excel</button><button id='csvExport'>click this to export csv</button> …
Run Code Online (Sandbox Code Playgroud) 我对 SQL 查询相当陌生,并且正在查询 aws athena 数据库。
我的第一个查询将返回给定一些参数的每个独特品牌:
-- query1
SELECT DISTINCT brand
FROM "database"
WHERE product_gap = 'yes' AND store_name = 'petco'
Run Code Online (Sandbox Code Playgroud)
返回这样的列表:
# brand
1 Drs. Doink and Foink
2 Zkukit!
3 Willow
4 Freshz
5 Aquatic Land
6 UniLaws
7 Seraz
.....
Run Code Online (Sandbox Code Playgroud)
依此类推 553 行。如果我选择任何品牌,例如“Seraz”并运行第二个查询,它将返回该品牌的“merch1”列的不同计数
-- query2
SELECT COUNT (DISTINCT merch1)
FROM "database"
WHERE product_gap = 'yes' AND store_name = 'petco' AND brand='Seraz'
Run Code Online (Sandbox Code Playgroud)
返回:
# _col0
1 2
Run Code Online (Sandbox Code Playgroud)
其中 _col0 是 seraz 的 merch1 的不同计数。
我的问题是如何组合我的查询,以便对于来自 query1 的每个唯一品牌结果,它都会运行 …
我尝试使用该[] = []
方法在 JavaScript 中交换两个对象值,但下面的代码失败并显示错误"message": "Uncaught TypeError: Cannot set property '9' of undefined",
let dataObj={"reg_price":2, "reg_price_alt":5, "ex":9}
console.log("before: ", dataObj)
[dataObj.reg_price, dataObj.ex] = [4, 5];
console.log("after: ", dataObj)
Run Code Online (Sandbox Code Playgroud)
我缺少一些语法吗?我不明白为什么这个简单的代码不起作用。
我制作了一个测试包并将其上传到这里的pypi: https: //pypi.org/project/martin-test-package-11122/0.0.1/
我的包文件的代码__init__.py
是这样的:
import os
import sys
print("inside martin's test pip package")
print("the script has the arg %s" % (sys.argv[1]))
Run Code Online (Sandbox Code Playgroud)
当我在本地运行该文件时,python3 __init__.py testArgument
它只会按预期打印参数输出。
我安装了我的软件包,pip3 install martin-test-package-11122==0.0.1
并通过运行 pip3 freeze 验证了它的安装。
如何从命令行运行已安装的软件包?我正在尝试使用命令调用我安装的包,例如python3 -m pip3 martin-test-package-11122 commandLineArg
从我的文件中获取输出,__init__.py
就像在本地运行它一样。但是这个 -m 命令只会导致错误/usr/bin/python3: No module named pip3
我一直在谷歌上尝试找到这个,我能找到的最接近的是这个stackoverflow 问题,它说要运行python3
,import pip3
但即使尝试也不起作用。
我制作了一个pip包并上传到这里:
https://pypi.org/project/audacityDiscogsExporter/0.1.0/
如果我运行pip install audacityDiscogsExporter==0.1.0
或pip install audacityDiscogsExporter
收到错误消息:
martin@MSI:/mnt/c/Users/marti/Documents/projects/package$ pip install audacityDiscogsExporter
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that …
Run Code Online (Sandbox Code Playgroud)