所有问题

0 投票
2 回答
589 浏览

macos - Qt Quick 是否支持 MacOS 的本机菜单栏?

在我正在做的一个项目中,我已经到了需要一个菜单​​栏(文件、编辑、视图等)与之交互的地步。我在 Mac 上工作,所以我希望能够使用 OS X 中已经提供的菜单栏,但是从我看到的所有文档和已经回答的问题来看,看起来只有 QMainWindow 才正确支持,a Qt Widgets 的一部分,而不是 Qt Quick。Qt Quick 中的 Mac 是否支持本机菜单栏,还是我必须编写一些特定于平台的代码来实现?提前感谢您的帮助!

0 投票
2 回答
167 浏览

android - NullPointerException setOnClickListener

我正在 Android Studio 中开发一个应用程序,但是当我运行它时,我收到以下错误:

我怎样才能解决这个问题?

0 投票
3 回答
234 浏览

haskell - 模拟非矩形阵列

很多时候,您希望数组的性能优于链表,但又不符合矩形数组的要求。

作为一个例子,考虑一个六边形网格,这里用中灰色显示单元格 (3, 3) 的 1 距离邻居和浅灰色的 2 距离邻居。 在此处输入图像描述 假设我们想要一个数组,其中包含每个单元格的每个 1 距离和 2 距离邻居的索引。一个小问题是单元格具有不同数量的 X 距离邻居 - 网格边界上的单元格比靠近网格中心的单元格具有更少的邻居。

(出于性能原因,我们想要一个相邻索引数组——而不是从单元坐标到相邻索引的函数。)

我们可以通过跟踪每个单元格有多少邻居来解决这个问题。neighbors2假设您有一个size数组 R x C x N x 2,其中R是网格行数,C对于列,并且N是网格中任何单元格的最大 2 距离邻居数。然后,通过保留一个额外n_neighbors2的 size数组R x C,我们可以跟踪填充了哪些索引,neighbors2哪些只是零填充。例如,要检索单元格 (2, 5) 的 2 距离邻居,我们只需像这样对数组进行索引:

someNeigh = neighbors2[2, 5, 0..n_neighbors2[2, 5], ..]

someNeigh将是一个n_neighbors2[2, 5] x 2索引数组(或视图),其中someNeigh[0, 0]产生第一个邻居的行,并someNeigh[0, 1]产生第一个邻居的列,依此类推。注意位置的元素

neighbors2[2, 5, n_neighbors2[2, 5]+1.., ..]

无关紧要;这个空间只是填充以保持矩阵矩形。

假设我们有一个函数可以找到任何单元格的 d 距离邻居:

我们如何创建上述数组neighbors2n_neighbors2N假设我们事先知道 2 距离邻居的最大数量 。然后可以修改generateNeighs为始终返回相同大小的列表,因为我们可以用 (0, 0) 填充剩余的条目。在我看来,这留下了两个问题:

  • 我们需要一个填充函数,neighbors2它不是对每个单独的索引进行操作,而是对一个切片进行操作,在我们的例子中,它应该一次填充一个单元格。
  • n_neighbors2应同时填充为neighbors2

欢迎使用repaor 或accelerate数组的解决方案。

0 投票
1 回答
95 浏览

javascript - 如何使用 JavaScript 在浏览器中大致居中突出显示的元素?类似于 鸭鸭

我实现了这个用户脚本(在 MIT/expat 下开源)以启用向上/向下箭头迭代(使用键盘箭头键),就像这个页面 - https://duckduckgo.com/?q=javascript&ia=web(尝试按下向下箭头键几次,然后向上箭头 - js 必须被列入白名单)。

但是,视口始终位于突出显示/选定/活动元素的左上角。什么是让它更像 DDG 的最简单方法,其中活动项目并不总是滚动页面并且大致位于中心?

jQuery 或 Vanilla JS 都可以。

注意:该脚本现在可在此处安装,并且在 metacpan 搜索的上下文中可读且有用,例如https://metacpan.org/search?q=config。请参阅https://userscripts-mirror.org/

0 投票
2 回答
101 浏览

javascript - 反应组件

一般来说,我是 Jest 和 JavaScript 的新手。我有一个包含一些组件的书面 js 代码,我需要为此网站添加一个注销选项。

我有一个 Log Out 组件,但我不确定如何将它添加到 js 代码中。

这是注销组件:

这是我的 WholeScreen 组件:

当我添加它然后运行

我收到一个错误:

我的问题是如何将 LogOut 组件添加到 WholeScreen 组件中以便编译?

提前致谢!

0 投票
2 回答
60 浏览

python - Index out of range while accessing index of the next iteration in loop in python

There are several image files in a directory on which I need to iterate through, where need to access the next iteration value in the current iteration.

I need to iterate over all the items of the img_files_list but when reached at the end of the loop need to properly come out of loop without index out of range exception. Anyone, please point out where do I missed the logic.

0 投票
0 回答
44 浏览

r - 如何在椭圆体的上半部分周围建立一个缓冲区?

我正在寻找的是一种创建比示例中绘制的更大的椭圆体的方法。所以椭圆体应该像一个缓冲区,具有特定宽度的绘图。

此外,我想“切断”椭圆体的上部。

知道怎么做吗?

示例取自: http: //www.sthda.com/english/wiki/a-complete-guide-to-3d-visualization-device-system-in-rr-software-and-data-visualization

0 投票
3 回答
356 浏览

ios - 在默认的 UITableViewCell 中显示一个 imageView

当我创建一个新的UITableView时,我可以设置 cell.imageView。理论上,这不是应该显示图像吗?是在 a 中实际显示图像UITableViewCell以创建自定义单元子类的唯一方法吗?

这是我正在使用的代码:

0 投票
1 回答
31 浏览

knockout.js - copy only writable items from Knockout ViewModel

There are several items includes functions and observable variables in my ViewModel But at the time of posting, I need only the writable items.

clone viewModel:

viewModel[name] does not return Observable variable.

0 投票
2 回答
8269 浏览

laravel - RuntimeException 无法扫描“数据库/工厂”Laravel 中的类

我需要在我的项目中安装 Laravel 图表。安装后

我有这个错误:

因此,当我在 App 文件夹中复制我的提供和别名后,我得到了:

任何人都可以帮忙吗?

0 投票
1 回答
232 浏览

html - Trying to make div height based on max content with flexbox and css font-size is ruining flex: auto

I have a flex container with multiple flex items, 2 of which I need to flex grow based on the text so all divs space out the same way.

I was able to accomplish this like this:

SCSS

My upper-text and lower-text need to be different sizes. When I put a font-size into either of those classes, I lose the whole flex grow.

You can try on my codepen https://codepen.io/mxdavis/pen/KxxmKE by inserting font-size: 20px; to between line 24 and 25 (in the a.upper-text class) and you will see the red border no longer ends at the same point like it does when the font is not adjusted. https://codepen.io/mxdavis/pen/dqqzMy

I need the even sized boxes, and the adjusted font size. Flex seems to be the easiest route since upper-text and lower-text cannot be predicted.

Any advice is greatly appreciated.

Thanks!

Update: I realize now if I play with the text sizes and don't make upper and lower texts equal even my first code snippet doesn't work, which is probably why a font increase is throwing it off. Is there a way to accomplish this or should I just set a fixed height and then click to reveal more? https://codepen.io/mxdavis/pen/KxxedE

0 投票
1 回答
700 浏览

typo3 - Typo3 流体模板 如何添加多个模板

我有一个完成的静态 HTML 模板。我需要将其映射到typo3,以便内容是动态的。我遵循以下教程:https ://docs.typo3.org/typo3cms/SitePackageTutorial/FluidTemplates/Index.html

这很好用,但现在我想知道如何更改每个站点的模板?我为每个站点制作了模板,即Gallerie.html、Contact.html,它们链接到相同的布局,因为页眉和页脚总是相同的。我现在如何告诉关于我们的页面使用 Gallerie.html?

我的 setup.typoscript:

目前,它会在每个页面上从 eventmanagement/Resources/Private/Templates/Page/ 加载 Default.html 模板。我现在在 eventmanagement/Resources/Private/Templates/Page/ 中创建了第二个名为 Gallerie.html 的模板,我现在如何将它添加到后端的 Gallerie 页面?

0 投票
1 回答
56 浏览

laravel - "No query results for model [App\Shop\Categories\Category] 1"

No query results for model app\shop\categories\category

0 投票
1 回答
81 浏览

html - How do I remove the space when hovering over a nav link?

I'm new and building one of my first pages. I'm working on the nav for my site. I have it mostly how I want it but when I hover over a link there is a small space to the leftover hover box. its a small space between the border and the hover box. Please help.

So the stack overflow won't let me post the question without talking a little bit more so I am going to ramble a bit. About random things. Talk nonsense until it allows me to post the damn question. I don't know how much detail I need when it won't let me post just a codepen link. It seems much easier to do that.

0 投票
0 回答
135 浏览

android - 2018/09/16 在 android 中使用 gsm:google 4.0.1 的`compile` 仍然存在问题

错误配置'compile'已过时并已替换为'implementation'api

这是我的项目gradle

}

这是我的模块:app

我已经将依赖项从compileto更改为implementation仍然存在这个问题,我希望有人可以帮助我!!!谢谢

改成那个,对我没有帮助

0 投票
2 回答
1217 浏览

java - How to combine two elements in the same arrays?

I have a 2D array that contains as such

My goal is when there are 2 or more elements [a][0] and [a][2] are the same, it will group together and combine the elements as one.

For example, [1][0] and [2][0], r and [1][2] and [2][2], gender are the same.

Thus, it will combine into one as shown below.

{ "r", "name", "gender" , "value", "Female", "Male" },

Thus, my desired output is as follow

What I have is as follow

My question is how can I combine the array as such?

Any help will be much appreciated.

0 投票
0 回答
58 浏览

variables - 八度:For-Loop 创建错误的变量

我想从文本文件中读取参数并将其总结为四个变量。由于参数太多,我决定编写一个 for 循环来自动化它。

问题是,循环只创建了一个名称错误的变量“ans”而不是“machnumber”。这是我的代码,也许你可以看到任何失败:

这是文本文件:

我会欢迎你的帮助。

一切顺利,

迈克尔

0 投票
2 回答
1238 浏览

android - Toolbar won't display as action bar in Android Studio

I'm currently trying to implement a NavigationDrawer within my application and have been following the Android Developer guide as to how this is implemented.

However, when trying to set a custom Toolbar as the ActionBar, the Toolbar does not display within the application, almost as if the setSupprtActionBar() method does not do anything.

I think it is an issue with setting the themes as .NoActionBar somewhere incorrectly but I have tried changing them but have had no success.

EDIT: Following ʍѳђઽ૯ท's suggestions, here is the updated code which still does not show the toolbar.

Here is my MainActivity.java:

Here is my activity_main.xml:

Here is my styles.xml:

And here is my AndroidManifest.xml:

0 投票
1 回答
953 浏览

python - 如何使用线程并行压缩迭代器?

假设我有N个生成器,它们产生一个 items 流gs = [..] # list of generators

我可以很容易地将它们放在一起,从:zip中的每个生成器中获取一个元组生成器。gstuple_gen = zip(*gs)

这会依次调用next(g)每个,并将结果收集到一个元组中。但是,如果每个项目的生产成本都很高,我们可能希望在多个线程上并行工作。ggsnext(g)

我怎样才能实现pzip(..)这样做?

0 投票
2 回答
104 浏览

javascript - Use hover on div and mouseout at same time

I am working with jQuery hover and mouseout script but issue is that when I set hover on div when mouseout is working, div gets hide, and visible continuously (blinking).

How to overcome this problem?

Here is my code:

0 投票
1 回答
6217 浏览

java - Spring Batch JpaItemWriter vs HibernateItemWriter 以及为什么在使用 HibernateItemWriter 时需要 HibernateTransactionManager

我正在使用 Spring Boot 项目开发 Spring Batch。我的问题是,当我如下使用 HibernateItemWriter 时,为什么需要来自 LocalSessionFactoryBean 的 HibernateTransactionManager 和 SessionFactory?

应用程序.java

批处理配置.java

这是因为如果我没有包含它,并且使用以下代码从 EntityManagerFactory 获取 SessionFactory

我会收到“没有正在进行的交易”错误。但是,当我使用 JpaItemWriter 时,情况并非如此。

但是根据我对 Spring Batch 的理解,在块处理中,已经提供了一个默认的事务管理器。

为了使用 HibernateItemWriter,是否必须从 LocalSessionFactoryBean(来自 hibernate)提供 HibernateTransactionManager 和 SessionFactory?

而且,JpaItemWriter 和 HibernateItemWriter 之间的主要区别是什么?我已经对这两者进行了研究,Jpa 是关于如何使用注释方式指定实体等的规范,而 hibernate 是 Jpa 的实现之一。不过,我对此还不是很清楚。与默认 jpa 相比,hibernate 是否具有更多功能?比如 SearchCriteria 等?

0 投票
1 回答
2034 浏览

google-apps-script - 在同一独立脚本中使用 SpreadsheetApp 和 FormApp 时出错

我正在尝试运行一个简单的脚本,该脚本在同一个独立的 Apps 脚本文件中打开一个 Google 电子表格和一个 Google 表单。似乎该脚本只能授权 FormApp,而不能授权 SpreadsheetApp。授权范围不授予操作电子表格的权限。

错误如下:

您无权调用 openById

如果我分别运行两行(通过删除一行或另一行),则脚本正常工作。

按照示例代码.gs:

遵循列出的脚本范围:

https://www.googleapis.com/auth/forms

请注意,应用脚本不要求电子表格范围。

奇怪的是,如果我将有界脚本创建到电子表格或表单中,那么脚本可以正常工作。该问题仅发生在独立脚本上。

我没有使用 @OnlyCurrentDoc注释

0 投票
2 回答
1117 浏览

c# - Data not binding in Xamarin forms Listview group

I am using List view Grouping in Xamarin forms, but some how data is not binding. I am using Xamarin Forms 3.1 latest version. My code is :

And my view model is

FacilityGroup Class code is :

And Facility class is :

I am binding data like :

I don't understand what is wrong with my code. Any help will be appreciated. Thanks.

0 投票
4 回答
1168 浏览

python - 如何在 python 3 的任意列表中找到缺失的数字?

我试图在任意列表中找到丢失的数字。在有序列表中,我的代码工作正常,但在任意列表中不起作用。这是我的代码:

输出是:

但是当a被排序时,输出结果很好:

我的代码有什么问题,我该如何解决?PS。我知道我可以对列表进行排序并解决问题,但我希望它也可以在任意列表上工作。

0 投票
0 回答
851 浏览

php - WP List 表不显示数据 [Wordpress]

我正在尝试创建一个插件来使用 WP List Table 向所有用户显示他们的电子邮件和角色但是没有显示信息,它计算了我在数据库中有多少用户但没有显示,请告知:

我在 PHP 方面没有经验,但是,我已经检查了所有内容,但问题仍然存在