所有问题

0 投票
3 回答
755 浏览

macos - 具有匹配宽度 DocumentView 的 NSScrollView

首先,我想说我已经查看了很多其他资源来尝试实现这一点,但我所查看的似乎没有任何帮助。

例如:使用自动布局自动增长 NSScrollView 的文档视图?

我有一个在 Interface Builder 中创建的 NSScrollView 并设置约束以填充它所在的窗口:滚动视图的顶部、左侧、右侧和底部设置为等于超级视图的顶部、左侧、右侧和底部(其中是 Xamarin 中的 viewcontroller 使用的 xib 视图)。

我想要的文档视图是一个简单的 NSView,它在我的 viewcontroller 的 ViewDidLoad 中动态填充了 NSImageViews:

因为我不一定知道有多少项目,_projects也不知道将加载到每个项目中的图像的高度imageView,虽然我知道预期的比例,但直到运行时我才知道我的 documentView 的高度.

我希望将documentView' 的宽度调整为与NSClipView每次调整滚动视图所在的封闭窗口(因此也调整滚动视图)的大小时相同。至于 的高度,我希望它由我在 中填充documentView的 s 的大小来确定,这就是高度约束与宽度相关的原因。imageViewdocumentView

我玩过AutoresizingMask, documentView,NSClipView滚动视图等。我尝试为所有内容设置TranslatesAutoresizingMaskIntoConstraintstofalse并添加约束以将左侧、右侧和顶部设置为documentView等于NSClipView. 当我这样做时,视图似乎甚至没有出现。我似乎无法弄清楚这一点。

我也试过在不使用 NSImageViews 的情况下这样做:

0 投票
1 回答
292 浏览

sql - Syntax error while fetching table list from teradata using python

For learning purpose, I am trying to fetch table list from Teradata in Python with the following code:

The above works fine but when I try to fetch the table list based on a Database name then things are not working:

getting:

It has been couple of hours trying to figure it out but not able to get through it. Its very stupid to ask this but please advice where am I going wrong.

0 投票
1 回答
1724 浏览

javascript - Taking 2 clicks to set variable in v-tab with Vuetify

I am using Vuetify and vuejs to create 3 tabs. I'm dynamically switching between tabs by binding to the href of a v-tab. I'm just changing the speed variable each time I click on a tab. For some reason the speed variable, lags behind by one click. So even though I click on the expedited tab the speed variable is still stuck on standard until I click again, and THEN it is set to expedited and the tab works like normal. Here is my code, and there are no errors..

Any idea why my speed variable is not getting updated on the first click?

0 投票
1 回答
345 浏览

powershell - PowerShell Test If a Filename From a List Exists Somewhere In a Directory and Export Missing

I've researched this and haven't been able to come up with a solid solution. Basically, I have a separate hard drive containing thousands of music files. I have a CSV list with the names of all the files that should be in the hard drive. Example:

My List

I want to be able to test if each of the files on my list exist in the hard drive, and if not, export it to a separate "missing files" list. The thing is each of the files in the hard drive exist under multiple folders.

As my script is now, I am trying to test if the path exists by using join-path. Here is my code right now - it's returning all of the files in the directory instead of just the missing files:

How do I account for the sub-directories that vary with each file?


Edit - Resolved

0 投票
2 回答
1915 浏览

python - Conditionally sort a single column in ascending and descending order in Pandas

I have 98,000 USA home street addresses that I need to sort in 'walking' order, i.e. listed in the order that you would walk, down one side of the street and then cross the street and walk back.

Desired df results, sort ascending for odd street numbers, then switch to descending sort for even. [sorry, first stackoverflow question, don't qualify yet to copy image of Jupyter notebook]

4 columns: number,street,town,even

desired outcome for column 'number': 1231 1233 1235 1237 1239 1238 1236 1234 1232 1230

0 投票
1 回答
40 浏览

cron - 会错过 shebang 停止脚本运行

我有一个 crontab 作业来清除 /var/log/nginx 文件夹中的日志。crontab 是这样设置的:

logcleanup.sh 脚本非常简单,只有两行:

我想脚本将在每晚 23:15 运行。但是,它不会被执行,大于 50 MB 的文件仍在日志文件夹中。这是因为没有射帮“ #!/usr/bin/env bash”造成的吗?

谢谢。

0 投票
2 回答
921 浏览

android - 更改组合图表图例顺序,MPAndroidChart

我使用 PhilJay 的 MPAndroidChart 库来创建组合图表(线和条)。我想更改情节的图例顺序。从像这样的默认选项: 默认选项 到这个: 订单已更改

我已阅读文档并尝试更改 setDrwaOrder 但没有发生任何更改。

¿ 一些帮助或建议?

0 投票
1 回答
3243 浏览

jestjs - 所有测试都通过了 100% 的覆盖率,但 jest 返回退出代码 1

我研究了--detectLeaksand --detectOpenHandles,它确实引发了一些错误,但输出中没有明显的问题。

我有一个 monorepo,我在 docker / 管道中的 jenkins 中运行 jest。

这是我的笑话配置:

这里发生了什么?

在本地,它确实返回 0 退出代码并打印:

0 投票
0 回答
25 浏览

angular - 将PNG作为图标

嗨,我有按页面之间简单导航的代码。

我现在需要将图标切换为 PNG,例如:
之前: 之后: 在此处输入图像描述
在此处输入图像描述

和黄油作为圆形按钮。

希望得到帮助!

0 投票
1 回答
39 浏览

java - 如何指定一次使用哪个模式?

我正在使用本地数据库在 JDBC、MySql 中学习基本的 CRUD,问题是对于每个 CRUD 方法,我必须指定要使用的架构。有没有办法将它放置一次?当我将使用 h2 数据库对其进行测试时,这将成为一个问题。

` 公共类 DbConnection 实现 ConnectionProvider{

} The Provider: 公共接口 ConnectionProvider {

}`

我在哪里指定它:`public void createTableSubjects(MysqlDataSource dataSource){

`

0 投票
1 回答
39 浏览

coq - Current required number of arguments for unfolding by `simpl`

The Coq Reference Manual details how to use the Arguments directive with a / to mark a constant to be unfolded by the simpl tactic only if enough arguments are supplied.

Is there a way to see how many arguments arguments a constant currently requires to be unfolded?

Similarly, is there a way to see if a constant was flagged to never be simplified by simpl?

0 投票
1 回答
249 浏览

haskell - What do you use for base case for Int -> Int -> [Int] in haskell?

Say for example you have

And its Type conversion was

How would you establish a base case for two inputs to another list type like [Int]

0 投票
3 回答
1857 浏览

html - How to add a line as a pseudo element when using flex-box

I would like to add a vertical line between each circle, however when using a :before pseudo element this doesn't show the border. When I remove the flex box parent then the lines appear.

How can I achieve this without having to remove the flexbox, as I need to have the text in line with the numbered circles.

https://jsfiddle.net/p3gt02yb/1/

0 投票
1 回答
4912 浏览

scala - Move files between hdfs directories as aprt of spark scala application

I am facing problem when moving files between two HDFS folders in a spark application. We are using Spark 2.1 version and Scala as programming language. I imported org.apache.hadoop.fs package and 'rename' method as a work around for moving files as I couldn't find method to 'move files between hdfs folders' in that package. Code is as below.

the move files method is called in another method which has other application logic and I need to remove required files from source directory before proceeding with the logic.

That move_files step is getting executed, without any errors but file is not moved out from source folder to target folder. Program Execution is moving on with the logic which is erroring out due to presence of bad files in the source folder. Please suggest any other way to move files between folders in hdfs or point out where I am doing mistake in the above code.

0 投票
1 回答
10755 浏览

unit-testing - 业力日志级别值

我在运行单元测试时使用 Karma 作为测试运行器,在查看Karma 配置文档时,我注意到存在不同级别的日志记录。

目前,我们的代码库使用:logLevel: config.LOG_INFO,

有理由使用这个而不是其他的吗?

可能的值:

  • config.LOG_DISABLE
  • config.LOG_ERROR
  • config.LOG_WARN
  • config.LOG_INFO
  • config.LOG_DEBUG

另外,有人知道每个日志级别的作用吗?

0 投票
1 回答
55 浏览

mysql - MySQL 查询优化 - 加速|索引使用

我有以下 MySQL 查询需要超过一天才能执行:

子查询需要 21 秒才能运行并返回 11035 行。我有以下索引:

Table Non_unique Key_name Seq_in_index Column_name Collat​​ion Cardinality Sub_part Packed Null Index_type Comment Index_comment

0 a 1 wob1 1 ED A 756095 无 无 BTREE
1 a 1 wob2 1 SN A 2268287 无 无 BTREE
2 a 1 wob3 1 ED A 756095 无 无 BTREE
3 a 1 wob3 2 SN A 9073150 无 无 BTREE
4 a 1 wob4 1 NUMBER A 18146301 无 无 是 BTREE
5 a 1 wob5 1 SN A 2268287 无 无 BTREE
6 a 1 wob5 2 编号 A 18146301 无 无 是 BTREE

EXPLAIN给出:

# id, select_type, table, type, possible_keys, key, key_len, ref, rows, Extra

'1', 'PRIMARY', 'a', 'ALL', NULL, NULL, NULL, NULL, '18146301', '使用 where'

'2', 'DEPENDENT SUBQUERY', 'b', 'index_subquery', 'cfg2', 'cfg2', '47', 'func', '6', '使用 where'

为什么不使用索引?如何加快查询速度?

0 投票
1 回答
24 浏览

tsql - 组合表变量的更新

如果可能的话,我想知道如何组合这两个 UPDATE 语句以及这是否会节省性能。查询当前在 3 秒内执行,但将继续增长。

如果您在我的 CASE 和 WHERE 语句中知道更整洁、更优雅的过滤,则可以加分。

谢谢

0 投票
0 回答
173 浏览

coq - QuickChick 不起作用

我已经按照 QuickChick 的 GitHub 页面上给出的说明使用 opam 安装了 QuickChick:

https://github.com/QuickChick/QuickChick

安装成功后,我尝试运行 QuickChick 教程

https://github.com/QuickChick/QuickChick/blob/master/examples/Tutorial.v

并且 Coq 返回了以下错误消息

错误: 找不到绑定到逻辑路径匹配后缀 <> 和前缀QuickChick的物理路径。

当我试图处理这条线时

从 QuickChick需要导入QuickChick。

我在 Ubuntu 16.04 上运行 Coq 8.8、Opam 1.2.2、Ocaml 4.04.0 和 Coq-QuickChick 1.0.1。是否有一些我缺少的配置?

0 投票
0 回答
312 浏览

c++ - 没有可用于 std::unique_ptr 的适当默认构造函数std::unordered_map 内部

这是我之前帖子的延续:(对不起,问题链)

没有可用于 std::unique_ptr 的适当默认构造函数

我遇到了类似的错误,这次是std::unique_ptr在一个std::unordered_map容器中:(对不起,我必须把整个代码)

错误信息是:

error C2512: 'std::unique_ptr<SDL_Texture,void (__cdecl *)(SDL_Texture *)>::unique_ptr': no appropriate default constructor available

这与上一个问题绝对相似,但有一个例外:唯一指针位于容器内部。我在想也许我可以把它std::unique_ptr<SDL_Texture, decltype(&SDL_DestroyTexture)>放在一个包装类中,并为编译器提供一个包装类的默认 ctor。但这肯定很麻烦,不知道有没有更好的办法。

另一件事是我使用了很多.get(),我现在明白这是错误的,因为它只返回唯一指针内的原始指针的副本。也许我应该使用.reset().

0 投票
2 回答
37 浏览

origen-sdk - 如何根据封装处理不同的引脚名称

我们通过解析 xml 设计文档将引脚导入到 dut 模型中,该文档根据包列出了不同的引脚名称:

这是同一个引脚,只是根据其封装的不同名称。在我的 ruby​​ 流文件中,根据测试插入,我设置了包,以便在访问 dut 模型引脚时获得正确的引脚。

目前有没有办法访问相同的引脚但根据包更改其名称?如在使用上述示例时,我将如何获得这种行为?

我在origen 文档中看到有包范围和函数范围的属性,但似乎没有办法根据我看到的包重命名引脚,假设我正在正确阅读文档。

此功能是否需要扩展包范围的属性功能?或者有没有通过一些花哨的别名更简单的方法?

谢谢

0 投票
2 回答
1295 浏览

python - 从 csv DataFrame 行中删除 nltk 停用词

我正在尝试从从 .csv 读取的以下 DataFrame 中删除停用词。它基本上是一长串二元组及其在洗发水标签数据集中出现的频率。

目标是在“word1”或“word2”列中出现停用词时删除整行。

然而,到目前为止,当它与来自 nltk 的德语停用词匹配时,我什至没有设法删除仅基于列“word1”的行。

我使用的代码是基于先前在此处回答的问题。

我得到的错误是: AttributeError: 'list' object has no attribute 'split'

我完全理解我在这里有错,因为我不理解被调用的函数。我正在尝试在一边做课程的同时加深对 pandas 和 nltk 的理解,但这并没有真正去任何地方:)

清除 DataFrame 中的停用词后,目标是将其写入新的 CSV。但那是为了以后的阶段。

编辑:标题更改以进行澄清

0 投票
2 回答
1796 浏览

javascript - 没有值的 LitElement 渲染模板

我有一个简单的例子来展示我所看到的:https ://stackblitz.com/edit/lit-element-example-3pdnwk?file=index.js 。

基本上,当第一个子元素呈现时,text属性设置正确。然而,在第二次渲染时,text属性是undefined第一个,然后更新为正确的值。

这打破了能够依赖于_firstRendered()将正确的值分配给属性的能力。

我真的在这里做点什么吗?

更新:这是使用lit-html 文档中提供的类似方法的更好示例:https ://stackblitz.com/edit/lit-element-issue?file=index.js

0 投票
2 回答
58 浏览

vb.net - 可变整数值

这只是我在这里的第二篇文章。我非常享受我的逗留。

我对此代码有疑问

基本上,这些控件所在的表单位于选项卡控件中,该选项卡控件具有删除不需要的页面的选项。唯一的问题是,如果删除了其中一个具有这些控件的页面,那么在运行时选择字体颜色时,我会得到一个“索引超出数组边界”。我试过使用 Tabpage1.visible = false 但这实际上并没有从控件中删除页面选项卡。我希望就如何使整数范围以不同的整数结尾或以某种方式使我自己更容易获得一些指导。我只是一个业余编码员,所以大多数更复杂的东西都让我有点不知所措,但我在谷歌和其他网站上找到的所有“答案”都没有用。

我想我还不能嵌入图像,所以它建立了这个链接。

0 投票
2 回答
3532 浏览

pulumi - 如何控制 Pulumi 中的资源创建顺序

我正在尝试创建一些资源,并且需要强制执行某种创建顺序。例如创建一个aws.s3.Bucket用于存储日志,然后才能将其用作aws.cloudfront.Distribution.

使用Pulumi时如何控制资源创建顺序?

0 投票
1 回答
1031 浏览

firefox-addon-webextensions - WebExtensions:browser.webRequest.onCompleted 永远不会触发

我正在使用带有以下后台脚本的Firefox WebExtensions API

从 加载脚本后about:debugging,我在 DevTools 中看到以下输出:

来自浏览器扩展的你好世界

我没有看到任何输出 - 没有数据browser.webRequest.onCompleted.addListener,也没有“添加的侦听器”消息。

我怎么做browser.webRequest.onCompleted

为了完整起见,我manifest.json的如下: