在numpy中生成缩小范围的1d数组(Generating 1d array of shrinking ranges in numpy)
我想在numpy中生成一个1D数组,如下所示:
In [181]: np.concatenate((np.arange(1, 4), np.arange(2, 4), np.arange(3, 4))) Out[181]: array([1, 2, 3, 2, 3, 3])
在更大范围内,伪代码:
concatenate(1:n, 2:n, 3:n, ..., n:n)
是否有一种矢量化的方式在numpy和/或pandas中这样做?
I want to generate a 1D array in numpy like this:
In [181]: np.concatenate((np.arange(1, 4), np.arange(2, 4), np.arange(3, 4))) Out[181]: array([1, 2, 3, 2, 3, 3])
On a larger scale, in pseudocode:
concatenate(1:n, 2:n, 3:n, ..., n:n)
Is there a vectorized way of doing this in numpy and/or pandas?
原文:https://stackoverflow.com/questions/23545014
最满意答案
如果真的需要部署到lib / ext,最简单的方法是为你的构建提供一个自定义的jdk(称之为Java6_With_MyProduct),在其中提供zipped / tar'gz'ed)jdk。
请您的管理员将其包含在Jenkins配置中。
这样,你的(只有你的版本)会得到你的扩展jdk。
或者,您可以使用-Djava.ext.dirs系统属性来覆盖扩展目录。 那样,你会的
- 将扩展程序作为预建步骤复制到工作区中
- 将原始扩展从$ JAVA_HOME / jre / lib / ext复制到同一目录中
- 将-Djava.ext.dirs = $ WORKSPACE / myextensions设置为MAVEN_OPTS(仅当需要扩展才能实际构建项目时)
- 将-Djava.ext.dirs = $ WORKSPACE / myextensions添加到argLine中以获取surefire和failfast插件
开放的问题是:你真的需要那些扩展来构建你的项目吗?
If it is really necessary to deploy than into lib/ext, the easiest way would be to provide a custom jdk for your build (call it Java6_With_MyProduct), in which you provide the zipped/tar'gz'ed) jdk.
Ask your administrators to include it into the Jenkins configuration.
That way, YOUR (and only your builds) would get your extended jdk.
Alternatively, you could use the -Djava.ext.dirs system property to override the extension directory. That way, your would
- copy your extension into your workspace as a prebuild step
- copy the original extensions from $JAVA_HOME/jre/lib/ext into the same directory
- set -Djava.ext.dirs=$WORKSPACE/myextensions as MAVEN_OPTS (only if the extension is required to actually BUILD the project)
- add -Djava.ext.dirs=$WORKSPACE/myextensions to the argLine for surefire and failfast plugins
The open question is: do your really need those extensions to BUILD your project?
相关问答
更多-
只需使用Jenkins Artifactory插件或Maven Artifactory插件 。 两者都生成一个BuildInfo元数据 ,其中包含您需要的信息以及更多信息。 所有这些信息都附加到工件上,并使工件可追踪,而无需将此信息嵌入文件名或存档本身。 请花一些时间观看此截屏视频 。 它详细解释了您可以获得什么以及为什么它很重要。 Just use the Jenkins Artifactory Plugin or the Maven Artifactory Plugin. Both generate a ...
-
詹金斯和梅文(Jenkins and Maven)[2023-08-08]
屏幕截图中的最后一个选项Local Maven Repository,它是一个下拉列表,您将有其他条目: 本地执行人 本地工作区 默认(指向从您的设置中拾取的那个) 在您的情况下,选择Local to the workspace ,这不是您实际想要的行为。 将其更改为默认值 。 这也是Jenkins传递给maven的原因如下: -Dmaven.repo.local=C:\apps\Jenkins\jobs\SCAVENGER\workspace\.repository 根据上面选择的选项,存储库始终与相关 ... -
您需要将清单文件添加到A.jar文件中,如下所示。 清单文件的内容应该如下所示,其中Main-Class指向您的包名称和A中主类的类名。 将其保存在名为Manifest.mf的文件中 Manifest-Version: 1.0 Main-Class: com.your.package.name.A Class-Path: A.jar B.jar 您可以手动将此文件添加到jar中,方法是将.jar文件更改为.zip,然后打开它并修改现有清单文件的内容(如果有)或将Manifest.mf文件复制到jar / ...
-
没有一个自动化的进程可以为你完成这项任务,因为jar可以包含在不同的依赖项中。 您必须手动将它们添加到您的pom文件。 There isn't an automatted process to do that task for you, because jars can be included in different dependencies. You have to add them manually to your pom file.
-
javac找不到已安装在jre / lib / ext中的jar文件(javac can't find jar files that have been installed in jre/lib/ext)[2021-12-19]
检查一下。 http://www.ntu.edu.sg/home/ehchua/programming/howto/Environment_Variables.html Check this . http://www.ntu.edu.sg/home/ehchua/programming/howto/Environment_Variables.html -
使用jenkins构建的maven没有从本地.m2存储库中获取jar(maven build with jenkins not picking up jar from local .m2 repository)[2022-03-02]
你将jenkins与maven集成的方式是不正确的。 您必须使用artifactory或nexus ,它们都具有足够好用的免费版本。 您构建项目B并将它们部署到上面的存储库管理器,您的项目A从存储库管理器下载它。 针对您的具体问题,请检查 在项目配置中,将检查私有存储库选项 。 这将为每个jenkins执行器创建单独的存储库。 如果jenkins master中的执行者对A和B不同,则不会看到jar文件。 在您的设置中,您无法添加任何从属设备。 所有构建都应该在master上运行。 我希望你不是在不同的奴隶 ... -
如何在Jenkins / Maven构建中管理jre / lib / ext jar?(How do I manage jre/lib/ext jars in a Jenkins/Maven build?)[2023-06-21]
如果真的需要部署到lib / ext,最简单的方法是为你的构建提供一个自定义的jdk(称之为Java6_With_MyProduct),在其中提供zipped / tar'gz'ed)jdk。 请您的管理员将其包含在Jenkins配置中。 这样,你的(只有你的版本)会得到你的扩展jdk。 或者,您可以使用-Djava.ext.dirs系统属性来覆盖扩展目录。 那样,你会的 将扩展程序作为预建步骤复制到工作区中 将原始扩展从$ JAVA_HOME / jre / lib / ext复制到同一目录中 将-Dja ... -
看起来它正在搜索特定于oracle的库,而你正在使用open jdk。 切换到Oracle jdk可能会解决您的问题。 在Jenkins服务器中安装Oracle jdk,并将JAVA_HOME / PATH变量指向Oracle jdk。 Looks like it's searching for a oracle-specific library and you're using open jdk. Switching to Oracle jdk will probably fix your issue. ...
-
将JAR从$ HOME / jre / lib / ext移动到Gradle时出现JDBC错误(JDBC Error when moving JAR from $HOME/jre/lib/ext to Gradle)[2022-01-15]
您可以在Tomcat的配置中定义数据源,而不是将其放入应用程序配置中。 Tomcat具有类加载器的层次结构。 你可以在它的网站上阅读它,但长话短说有三个有趣的类加载器:JDK类加载器(Bootstrap),Tomcat类加载器(系统)和你的应用程序的类加载器(实际上有更多,但让它变得简单)。 将驱动程序的jar放入$ JAVA_HOME / jre / lib / ext /时,将其添加到JDK类加载器中。 将它添加到tomcat / lib时,将其添加到Tomcat类加载器。 当您在应用程序的gradle ... -
将挂毯jar放入tomcat lib目录是不对的?(is it wrong to deploy tapestry jars into tomcat lib directory?)[2023-06-28]
从长远来看,最好拥有自包含的war文件,每个文件都尽可能多地包含它们所需的依赖项,而不是依赖“提供的”依赖项或其他类路径依赖项。 在某些情况下(但不是很多)您需要将jar放在war文件之外,以便服务器可以在启动时访问它们,但这听起来不像其中一种情况。 把Tapestry罐子放在一个共享位置将是一个完全可以忽略的优化。 此外,如果您的某个应用需要不同版本的Tapestry,它可能会在稍后导致问题。 另一个潜在的问题是,如果您切换到不同于Tomcat的应用程序服务器(甚至是不同版本的Tomcat)。 不同的应用 ...