所有问题

0 投票
1 回答
69 浏览

jenkins-pipeline - Artifactory Continuous integration approach

So far, I have artifactory hooked up to jenkins such that jenkins is pushing up artifacts to artifactory on every push to master. I doubt I'll be able to influence the other devs to alter their behavior and it seems like pushing artifacts to artifactory in this manner is a waste. Enter build retention, which seems like a nice solution.

So what I'm looking for is some advice on the best course of action here. Googling for this hasn't been fruitful.

It seems like a good idea to have, say retention for up to the last 20 or so builds. The artifacts from these builds will be candidates subject to further testing and usage. Then should one be chosen as a release candidate, to be included as part of some superset release package, it seems logical that I would want to ensure that the selected build is retained indefinitely in the interests of traceability and reproducibility. If I did this, all of the interim or otherwise ignored candidate builds would then disappear as part of a retention policy.

Is this a sensible strategy? If so, how would one execute it? I understand how to deploy and set retention policies as per artifactory's documentation but not about the prospect of "unsetting" it on blessed builds. I have read that build promotion can be employed to a achieve something like this but in the context of promotion it seems to imply copying to another repository which isn't necessarily what I am after. (Though I am open to guidance on best practice in this regard.)

Thanks!

0 投票
3 回答
1130 浏览

c++ - Syntax of an un-named function pointer in C++

I was looking into most vexing parse, and I stumbled upon something like this:

This is quite different from the typical syntax of return-type(*name)(parameters). Are the parenthesis present the parenthesis for the parameter list, or are they for the name?

0 投票
1 回答
748 浏览

android - Android NDK - 无法在 Visual Studio 2017 中调试

我今天安装了 Visual Studio 2017(并重新安装了……)并尝试在 C++ 中调试 Android 应用程序。当我在 Microsoft Android 模拟器中以调试模式启动应用程序时,我收到一个错误消息框:

找不到 Android 调试桥 (adb.exe)

无论如何,模拟器正在启动..现在我尝试再次启动应用程序,我在输出中收到此错误消息:

1>安装包出错。设备 '' 无效或未运行。请切换到其他设备,或使用 Android Virtual Device (AVD) Manager 启动兼容的模拟器,或连接兼容的 Android 设备。

1>设备无效或未运行。

注意空的设备名称。

当我在真正的 Android 设备中启动应用程序时,我收到此错误消息框:

无法开始调试。Android 命令“运行方式”失败。可打包的“com.**********************”未知。

故障排除步骤: - 尝试从应用列表启动应用。如果应用不在应用列表中,或者无法启动,这可能表明应用部署存在问题。- 确保您已安装适用于您设备的所有更新。- 安装最新固件或使用最新可用映像刷新设备。即使您已经使用最新版本的 Android,这也会很有帮助,因为无线 Android 升级过程可能会损坏本机调试所需的文件权限。对于许多三星设备,这可以使用 Kies 完成。- 将问题报告给您的制造商。Android 兼容性测试套件“testRunAsHasCorrectCapabilities”针对这种情况进行了测试,可能会失败。

但我的应用程序正在安装在 Android 设备中并且可以启动。

我觉得在 Visual Studio 中开发的 Android 是错误的。我在 C# 中使用 Xamarin Android,它通常运行良好。

有任何想法吗?有人怎么得到同样的错误?

0 投票
1 回答
691 浏览

python - Python program that simulates a full one player game of pig, starting at a totalscore of 0 and playing turn after turn until it reaches 100 points

So here is a sample output: - rolled a 2 - rolled a 1 Pigged out! Turn score = 0 New total score = 0 - rolled a 1 Pigged out! Turn score = 0 New total score = 0 - rolled a 6 - rolled a 6 - rolled a 6 - rolled a 5 Turn score = 23 #So on New total score = 90 - rolled a 6 - rolled a 6 - rolled a 3 Turn score = 15 New total score = 105

And here is how I tried to solve it:

What I tried doing is first making an inner loop that will roll the dice, add the values(except if a 1 comes up, in which case the turn score would be 0) and present it as the turn score.

Then I thought of looping it as a whole till a total turn score of >=100 is reached.

Can someone explain where I went wrong here?

Here is the output I get when I run it: Well, hello there. -rolled a 3 Score is 0 -rolled a 2 Score is 0 -rolled a 6 Score is 0 Pigged out! Better luck next time! Final score is: 11 -rolled a 6 Score is 0 -rolled a 4 Score is 0 -rolled a 5 Score is 0 -rolled a 2 Score is 0 -rolled a 2 Score is 0 -rolled a 4 Score is 0 -rolled a 2 Score is 0 -rolled a 3 Score is 0 -rolled a 4 Score is 0 -rolled a 4 Score is 0 Pigged out! Better luck next time! Final score is: 47 -rolled a 6 Score is 0 -rolled a 5 Score is 0 -rolled a 6 Score is 0 -rolled a 5 Score is 0 -rolled a 6 Score is 0 Pigged out! Better luck next time! Final score is: 75 -rolled a 3 Score is 0 -rolled a 2 Score is 0 -rolled a 6 Score is 0 -rolled a 6 Score is 0 -rolled a 4 Score is 0 -rolled a 2 Score is 0 Pigged out! Better luck next time! Final score is: 98 -rolled a 6 Score is 0 -rolled a 4 Score is 0 -rolled a 2 Score is 0 -rolled a 3 Score is 0 Pigged out! Better luck next time! Final score is: 113

0 投票
0 回答
518 浏览

c# - 将数据集序列化为 XML - 缺少具有空值的列

我正在将新系统与旧系统集成,部分要求是以 XML 格式编写缓存数据。我已经反编译了遗留系统并设法尽可能接近需求数据格式。

这就是遗留系统的作用:

输出如下所示:

这表示数据库表行中的所有值。请注意<KEY1 />- 这是一个包含null值的字段。

当我做同样的事情时(关于我如何获取 XML),我只获取其中包含值的字段,没有空字段:

但是表模式是一样的,这里我应该也看到<KEY1 />and<INTEGER />等字段。

这是我的 C#:

当我通过此调试并查看 的最终状态时resultDataSet,我可以看到所有列都可用: 在调试中检查时,所有列都可以在列列表中使用

但只有那些具有价值的人才能通过 XML。反序列化时如何在 XML 中显示空列?编辑:这里是遗留系统代码:https ://gist.github.com/trailmax/0100bd6926f311fae277848ce7624e98 - 我看不出我在做什么不同,但他们得到空列而我没有。只有他们在 .Net 3.5 上,而我在 4.7.1 上

0 投票
1 回答
369 浏览

python-2.7 - AttributeError:“Mul”对象没有属性“eval”

在下面的代码中,它计算了量子谐振子的本征态,并且 mr 和 gaussq 的乘积等于基态,我试图获得本征态,并制作一个包含每个子图的图.

但是,运行代码会返回:

代码示例:

0 投票
1 回答
398 浏览

windows - 为什么当我在提示中输入某些内容时,CMD 会说“= 此时出现意外”并关闭?

我最近看了一个 VSauce 2 视频,其中包含一个你总能赢的游戏,我制作了一个程序,玩家可以在其中与计算机玩游戏。问题是当轮到用户时,当你输入一个数字(或任何东西)时,程序就会关闭。我和一个也编程的朋友试图解决这个问题,但没有任何效果。觉得你能帮上忙?

这是不断搞砸的代码块:

每个 GOTO 都去到其他存在的地方

0 投票
1 回答
44 浏览

xamarin - Are there any performance issues with storing application settings as an App() static variable vs using the properties dictionary?

I'm currently storing application specific variables like this:

When my application starts I load these values from a table in a database and when they change I change the value plus update the database.

Here I understand there's a different way to do this:

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/application-class#Properties_Dictionary

But when I try to code this using the same code as in the Xamarin example page it gives me an error:

Can someone tell me how I can fix this error and also is it more efficient to use the properties dictionary vs storing the information in a SQLLite database?

0 投票
4 回答
539 浏览

php - Remove items count from my account orders table in Woocommerce

I need to remove this item count text in my orders table at the my account page, because I don't need it:

enter image description here

The text at Gesamtsumme should be changed from:

234,35€ for 1 Artikel

to

234,35€</p>

I've tried it with deleting it in the file but I want to do this via my functions.php because this is better I think.

0 投票
1 回答
49 浏览

matlab - 如何在Matlab中找到剩余月份的平均值

你能帮我这个Matlab代码吗?例如,我想获得剩余月份的平均值,

假设我的年份是从六月到五月(不是一月到十二月)。

当 t= Jun 时,我的期望值将是下个月(7 月)到明年 12 个月周期(5 月)结束的平均值。这个过程应该再次重复,例如,如果 t = Apr 那么预期值只是 May。但是当 t = May 时,我的预期值将再次重复为从 6 月到 5 月的平均值。

谢谢你。

在此处输入图像描述

0 投票
1 回答
239 浏览

angular - Angular: nested div clicked

I have a nested div. Both has a (click) event.

If I click outer then I get foo(1). If I click inner I get foo(2) and then foo(1).

  1. How can I make it the angular way to only get foo(2) if I click inner?

  2. How can I make inner to ignore any click in inner?

    click="" or click="false" does not work.

0 投票
1 回答
499 浏览

php - Does null coalescing operator call a function twice?

The null coalescing operator (??) returns its first operand if it exists and is not NULL, and otherwise returns its second operand.

If the first operand is a function or method call, does the operator call the function call twice?

As an example, say the function get_name() returns a string value or null.

$name = get_name() ?? 'no name found';

So is get_name() called once and the value stored ready to assign it to the variable ($name) or when the ?? is activated due to the function returning a value that is true for isset(), does ?? call on the first operand a second time to get the value?

0 投票
1 回答
446 浏览

java - Spigot Material WOOL doesn't exist anymore

I'm working on a big spigot plugin with a menu made with an inventory, and in this inventory, I add wools like choices for the player.

I use the following line to create my ItemStack:

But I have the following error since spigot was updated in 1.13:

Does someone know why, and how to update through the correct way?

0 投票
2 回答
104 浏览

javascript - How to avoid binding object in JS?

I am not sure what's going on with this, probably I am doing something wrong, but to be honest, I cannot see what's the point. Just take a look at this code and see what happens:

The output for the object2 should be {one: "one", "two": two"}, however it returns {one: "one", "two": two", "three": "what?"}

So why is this happening? I am not modifying object2, but it gets updated after the push of new value. How can I solve this? I just want to keep the object2 like before. Thanks

0 投票
1 回答
110 浏览

spring - 是否可以在 Spring Boot 中的路径检查的最后降低请求映射的优先级?

我有以下方法可以处理所有与其他路径不匹配的请求。

但是,它被称为路径之类的/css/style.css/images/logo.png导致它们不加载。是否可以将其推到较低的优先级,使其成为匹配的最后一条路径?我需要处理像/tag/channel.

在 Rails 中,这相当于将路径移动到routes.rb.

0 投票
2 回答
3122 浏览

c# - How to check if an array contains a value stored in a variable

I tried googling for the answer but at no avail. I'm new to coding in general, c# in particular and I'm trying to get head of the game by practicing.

So, what I am trying to do is to check if an array contains / has the same value that is stored in a variable previously declared. If it has, the code will do something, if it hasn't, the code will do something else altogether. What's the easiest way to accomplish what I want to do?

Thank you very much.

0 投票
2 回答
272 浏览

scala - Aux Pattern for higher-kinded types

EDIT: Here is a much simpler formulation of the problem, using Foo as an example of the Aux pattern which does work:


Old formulation of the question:

Apologies for the convoluted example below. I essentially want to duplicate the Aux pattern for higher-kinded types.

The scala:

This is what I expect to happen in that last line:

  • We're searching for a TestResult[Boolean]
  • testing says we need a Contr[Boolean] for some Contr provided by Wrapper
  • Wrapper gives a single instance of Contr[_] = Foo.Aux[Int, String, ?]
  • So compiler is searching for a Foo.Aux[Int, String, Boolean]
  • There is a single such instance provided by Foo
  • So the whole thing compiles

Here is my build.sbt in case I am missing something:

0 投票
1 回答
64 浏览

javascript - Mobile-responsiveness, works on the web, doesn't work on mobile devices

I have a website, girlsjustwannahavefont.com

The website is almost done, but the functionality is questionable on mobile devices. When I click on the 'view my process' button on mobile devices, it doesn't work? But it works fine on the web. Can any HTML, CSS, JavaScript god shed some light as to why that's happening? To clarify, the button doesn't work on Safari or when it was tested on my iPhone.

This is the CSS code for the modal.

And this is the JavaScript code to be executed when that button is clicked.

0 投票
3 回答
93 浏览

python - How can I fix this program? (python)

My task is to make a program.

In the code there is variable called num1, num1 has to be digits only and with the length of 5.

The code should print every digit in num1 and their sum.

The problem here is that if num1's length is not 5 it's not working, as well if there is chars in num1 that aren't digits.

It seems like the problem is in the condition.

Please tell me what is not good in my program (I'm still a beginner in python) EDIT : Thanks for the help! i appreciate it, i got along with it, the new code is the right one. :D

0 投票
2 回答
2142 浏览

sql - Postgresql COALESCE with String Literals does not work as expected

I'm trying to output and label a column total from a rollup.

The query works fine and generates a total as expected, but the column value that I would expect to be 'Total' shows up as [null].

There's a good chance it's probably some lack of understanding on my part, but then there's this that says that PostgreSQL's COALESCE is non-standard and makes me wonder if it's really me.

To quote:

COALESCE on row types

The spec defines COALESCE(X,Y) as a syntactic transformation to CASE WHEN X IS NOT NULL THEN X ELSE Y END (it leaves open the question of whether X is really evaluated twice by disallowing non-deterministic expressions or expressions with side effects in this context). A consequence of this is that the rather odd rules for null tests of row types are applied. PostgreSQL applies only the "is not the null value" test to X. Accordingly, if X is a row value containing null columns, PostgreSQL will return X, while the spec would require returning Y.

(Lovely explanation, right?)

I also ran across some information that indicates that COALESCE data types have to match, otherwise the function fails silently. (!)

I would expect the string literal 'Total' to be interpreted as a varchar, and column_1 is defined in the database as a varchar(12), but at this point I am not sure of much of anything, and any help would be most appreciated.

0 投票
2 回答
678 浏览

sql - 将列转换为行值的表转置

我有下表:

我想把它转置/转成这种格式

我将如何在 Vertica 中执行此操作?此外,如果想要将输出旋转/转置回原始视图,我该怎么做?

0 投票
0 回答
276 浏览

node.js - Angular Universal - 服务器和客户端中的不同 URL 类

我有一个 Angular Universal 应用程序,我想在服务器和客户端中重用代码。问题是我似乎无法使用URL该类在两种环境中正常工作。

在我的代码中,我有如下一行 -

当我以这种方式使用它时,我会在我的 Express 服务器控制台中打印出 Exception -

ERROR { ReferenceError: URL 未定义

为了解决这个问题,我添加了节点 URL 导入,例如 -

但是,如果我这样做,我会在客户端的 JS 控制台中收到错误 -

TypeError: url__WEBPACK_IMPORTED_MODULE_2__.URL 不是构造函数

不确定如何在客户端和服务器环境中使用 WHATWG URL。任何帮助/指针表示赞赏。

0 投票
1 回答
628 浏览

android - 如何使用嵌套的 Json 数组响应解析 Json 对象

我是 Android 中 Api 的新手。我使用 Json 对象处理 Api 响应,但没有使用嵌套对象。我很困惑如何使用 Json 对象中的嵌套 Json 数组来做到这一点。我看到了一些教程,但仍然感到困惑。

例如。以下是我的 Json 回复:

我知道外部大括号表示对象,而其他方括号是 json 数组,但我很困惑如何解析它。我使用 Retrofit lib tho

更新:

我尝试使用 POJO,但是当我调试应用程序时,断点在 ApiInterface 对象创建时中断,没有任何消息。早些时候我在正文中得到了 null 而没有任何错误(我已经硬编码了我想在 @PATH 中传递的值)。

  • 当我尝试使用带有值的 @Path 时,我的 Url 给出错误(不能有替换块。对于动态查询参数,请使用 @Query。)

我的网址: https : //places.cit.api.here.com/places/v1/discover/search?at= {LAT/LONG}&q=police-emergency&Accept-Language=en-US%2Cen%3Bq%3D0。 9&app_id={APP_ID}&app_code={AP_CODE}

我导致的实施不起作用。

任何概念或帮助将不胜感激.. 提前致谢。

0 投票
1 回答
30 浏览

regex - 正则表达式模式不匹配

我有一个应该遵循的模式:

它以一个单词(ie-apple)开头,后跟一个冒号 ( :),然后它应该是 ( word1orword2word3),并且在 EOL 处不应该有任何逗号。(苹果:word1)

我正在使用如下模式:

但是,如果我输入如下一句话,它就会失败:

在上面的例子中(failed_word)没有遵循模式,它应该失败但它通过了。

有人可以建议吗?

谢谢

0 投票
1 回答
428 浏览

java - IndexOutOfBoundsException error while trying to print first 4 elements of an ArrayList

...output:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 1 out-of-bounds for length 1 at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source) at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source) at java.base/java.util.Objects.checkIndex(Unknown Source) at java.base/java.util.ArrayList.get(Unknown Source) at HelloWorld.main(HelloWorld.java:27) ...output

My program is a to-do list and is as follows:

...Java............................................
import java.util.Scanner; import java.util.ArrayList;

...Java......................................................................

I get the above error message as soon as I write the to_do.get(i) at the very end of the program.

Another bonus question is how to end the while loop without affecting the output of the final ArrayList?