所有问题
unit-testing - How to set up active theme for plugin test in October Cms
I'm trying to write a test for twig filter.
To do that I need to load a theme from a fixture folder
plugins/matchish/myplugin/tests/fixtures/themes/test
Here how I set up the test
Now I'm getting an error active theme not found
python - Is there a way to enter a specific INTEGER (for example, 3) and have python print same amount of characters (like, entering 3 and printing "aaa" out)
If i entered an integer numeral, like 3, I would like the computer to print the same amount of a particular character, in this case, a. So I want the output to look something like this: (Sorry I am extremely new to python)
codeigniter - How to do a live user activity tracking function on Codeigniter?
I'm looking for how to tracking user activity (Example: XXX commented on the post/ XXX signed in/XXX shared a post or etc; XXX are registered User/IP address) on my Codeigniter website.
Is it have any recommendations for doing this function because I already researched a few days and get no idea.
python - Python recursion didn't give correct result for "sum of left leaves"
I wrote a code for the leetcode problem "108. Sum of Left Leaves" using recursion. It didn't give me the expected result.
When the input is [3,9,20,null,null,15,7]
I expected a 24 to be returned, but the code only gave me 9
sql - How do I write this postgres query for a has-many relationship?
We have a classroom table. And each classroom has many classroom users.
A classroom_user has a kind attribute, which is either teacher or student. Each classroom_user is associated with a user_id from the Users table.
What I'm looking for: I want to find all of the classrooms for a given teacher and student.
python - Refer related model field in model layer
I am try to refer 'spot_price' of model 'Spot' in model 'Basis' in django model layer, How can I manage this?
I have designed view.py to automaticaly render the templates. so I am not able to modifty any view.py to choose data like 'models.B.objects.get().field'.
and more, str is set to indicate the date, so, in the django backstage admin, the 'spot' field display would be 'date' formate, how would be change to 'spot_price'?
model Spot
need to refer the model Spot'spot_price by date, cause date is unique but spot_price is not
I expect the Basis.query.data would to like 'date: 2019-04-25, major_future_contract_close_price: 100.0, spot: 96.5, basis: 3.5'
reactjs - 更新后 Create-react-app 创建不带组件的 App.js
今天我更新了我的节点、npm 和 create-react-app 版本,现在每次我创建一个新应用程序时,App.js 不附带组件,它只是创建一个函数,如下所示。
之前
3.0.0 create-react-app 版本有变化吗?
Nodejs版本:v10.15.3
Npm 版本:6.4.1
firebase - 如何在具有两个条件的文档中查询 firebase 数据库?
我有一个包含以下文档的数据库:
我想查询将来发生的事件并具有userID 123. 我正在使用这个 golang FireBase 库,并且我已经弄清楚了如何单独做这些事情:
但我不知道如何将两者结合起来。我将如何组合这两个过滤器?
更新结构
android-service - 如何在android系统中禁用iGnss
我正在我的平台上调试 ANDROID 9 系统中的 Gnss 服务。我不编译android/hardware/interfaces/gnss,所以这个服务不应该启动。但是当系统启动时,我看到了这个日志:
init:从 pid:1065 (/system/bin/hwservicemanager) 接收到 'android.hardware.gnss@1.1::IGnss/default' 的控制消息 'interface_start' init:找不到服务托管接口 android.hardware.gnss@1.1 ::IGnss/default init:从 pid:1065 (/system/bin/hwservicemanager) 接收到 'android.hardware.gnss@1.0::IGnss/default' 的控制消息 'interface_start' 初始化:找不到服务托管接口 android。 hardware.gnss@1.0::IGnss/default
为什么 gnss 服务启动了,不像我预期的那样没有启动。任何人都可以帮助禁用此服务,或者告诉我 gnss 的初始化位置。我不想在系统启动时启动这个 gnss。
谢谢。
arrays - 查找总和与给定值相差最小的对/三元组
这个问题有两种变体。
给定 2 个整数数组,从每个数组中选择单个元素,使它们的总和与给定整数值 V 的距离(数值上)最小。总和可以大于 V。
给定 3 个整数数组,从每个数组中选择单个元素,以使它们的总和(在数值上)与给定整数值 V 的距离最小。总和可以大于 V。
我知道它们分别有一个简单的 O(n^2) 和 O(n^3) 解决方案,我想问一下是否有任何方法可以优化运行时间。
python - 有没有办法从 Python 中的 datetime 对象中提取时间?
我想从 Python 中的 datetime 对象中提取时间值。这是我使用的代码:
代码显然有问题,因为我收到此错误:
我正在使用 Python 3,我需要转换大约 30000 个日期时间值。
python - 在脚本运行一段时间后出现两个错误,keyerror 和 typeerror
在无限的 while True 循环中运行这段代码后,它随机崩溃并抛出以下两个错误:
TypeError: string indices must be integers
Keyerror: l (this is the letter "L", FWIW)
这里的问题是它有效,然后就崩溃了。有时它会在 while True 循环的第一次迭代后崩溃,有时它可以运行长达 20 分钟才崩溃。
这是一段代码。它正在从 Bitmex 提取 OHLC 价格数据。它的作用是获取最后 30、1 分钟的蜡烛,然后从所有 30 根蜡烛中找到最低的“最低”价格。如果您通过导入 bitmex、json 和请求来尝试它,那么每次手动尝试都应该没有问题。当它在循环上运行时,它会随机崩溃。有任何想法吗?
jsf - 日历值即使在使用 JSF 更改时为空,也会出现
我的 xhtml 上有一个日历标签,最初它有一些价值,当我使用鼠标选择信息并删除它时,更改事件仍然传递旧的 bean 对象数据。我怎样才能得到它为空或空
这是我的代码
如何做到这一点?
c# - 在 wpf prism 中调用 dispose 方法后未释放内存
我已经从一个窗口导航到另一个模式窗口。有 10 个可观察的集合。关闭窗口后,我将 null 设置为所有可观察的集合。但是在任务管理器中,内存并没有减少。当我打开模态窗口时,增加了 25 mb,但是当我关闭窗口时,仅在处理所有可观察的集合后才减少 1mb 或 2mb。
请建议我我做错了什么。请分享您的宝贵建议。我还检查了 Visual Studio 诊断工具中的内存消耗。
javascript - Bootstrap 4:用于响应式导航栏的独立折叠 js
我用 Bootstrap 4.3.1 制作了一个小型网站,除了带有切换按钮的响应式导航栏的折叠插件外,不需要任何 javascript。
Bootstrap 4 不再有定制器,所以我被迫加载jquery-3.3.1.slim.min.js69 kiB 和bootstrap.min.js57 kiB,这导致下载 126 kiB Javascript 用于小屏幕上的交互式菜单切换按钮。
我能做些什么来减少我的用户的 javascript 下载大小吗?
java - 在Maven Spring项目中将不同的属性文件加载到persistence.xml中
我有一个场景,我必须根据部署应用程序的环境将不同的方言、提供程序加载到我的 persistence.xml 文件中。
例如
在一个环境中我使用 Oracle11g,而在另一个环境中我使用 MySql8。我希望我的 persistnece.xml 看起来像这样。
然后有两个单独的属性文件(first.property,second.property)并使用我的 pom.xml 中的构建配置文件选择其中一个。例如-
因此,根据选择的配置文件,它将排除一个 .property 文件并从另一个文件中读取。
所有这一切的问题是值从属性文件返回为空。(不再)
我在这里遗漏了什么还是有更好的方法来做这种事情?
更新 -
这对于阅读方言值很有效。但是,我无法阅读 Provider !
是否也可以从属性文件中读取 Provider 值?
javascript - 如何用破折号分割字符串并删除任何外部空格?
目标:我想用破折号分割一个字符串,其中每个数组项不包括任何空格。
例子:
字符串 --> "CL - 目的地 - 机场税"
我试过了 :
预期的:
实际的:
如何轻松删除任何外部空间?
tsql - 如何从 DB2 IBM 导出结果 SQL
您对如何从 DB2 Power 8 导出大数据文件有任何想法吗?大小约为 5 亿条数据行。遇到了通过文本、打印和文件导出的选项。打印不是我的选择。text 选项返回我拆分的文本文件(字段)。至于文件选项,我无权设置新库以将文件保存在 DB2 中。
也用过导航器,由于大小,它没有响应..
感谢您的任何帮助。
excel - 仅当它们与查找中的类别 ID 匹配时,如何在 excel 中对值求和
假设我有这样的产品类别查找:
而且我还有一个仅使用产品名称的购买清单,如下所示:
我想生成这样的汇总:
我尝试了多种方法来解决这个问题,例如:
Excel不喜欢第一个。它说公式不正确,但我不明白为什么。第二个产生#VALUE。对此的任何帮助将不胜感激。提前致谢!
node.js - 无法读取未定义的属性“ClientSession”
出于某种原因,我在尝试运行我的节点应用程序时遇到了 clientSession 错误。我正在使用 node、express、angular 和 mongo。
有没有人认识到错误并有任何想法我可以查看?
arrays - 使用 groovy 将 xml 数据排序到数组中
我从一个经常更新的 XML 文件中获取一些数据,我需要从 XML 文件中获取数据并将其解析为一个数组并以非常特定的方式对其进行排序。
XML 文件看起来像这样。(将显示更多数据,混乱但相似)
我需要如下创建一个数组(按分支名称排序+在“-A”之后按数字排序,如果存在周期,则忽略周期之后的内容)
这就是我所拥有的,我在这个 groovy 脚本中缺少什么?

