- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在使用 Eclipse 进行开发时,如果我之前运行/调试过一个应用程序并且没有更改其源代码,那么再次运行/调试同一个应用程序会相当快。
然而,使用 Android Studio 和 Gralde,每次当我尝试运行/调试应用程序时,gradle build 总是会运行,在应用程序启动时额外增加 15~45 秒的延迟(有时会延迟在使用 4 年的 HP i7 笔记本电脑上缩短到 70 秒)。
因此,问题是:有没有办法跳过 Android Studio 的 gradle 构建阶段,或者至少减少运行/调试所需的时间?
注意:我已经配置了 gradle.properties 如下:
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.configureondemand=true
编辑:我的 gradle 构建可能比大多数项目更复杂,因为它有 7 种不同的风格(将扩展到 20 种左右)和 3 种构建类型,并且还包含用于更改 APK 名称的 Groovy 代码(插入当前日期),并根据当前 buildType 自动插入任务以增加版本代码和版本名称。这是完整的 build.gradle(修改为隐藏客户名称):
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
def appendVersionNameVersionCode(applicationVariants) {
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null) {
def PREFIX = "My_APP_"
if (outputFile.name.endsWith('.apk') && !outputFile.name.startsWith(PREFIX)) {
def names = variant.baseName.split("-");
def apkName = PREFIX+names[0]+"_";
if(names[1].equals(android.buildTypes.debugEx.name)) {
apkName += 'debugEx_'
} else {
apkName += new SimpleDateFormat("YYYYMMdd").format(new Date())
}
if(variant.name.toLowerCase().contains(android.buildTypes.release.name)) {
if (outputFile.name.contains('unsigned')) {
apkName += "-unsigned"
} else {
apkName += "_SIGNED"
}
}
if (!variant.outputs.zipAlign) {
apkName += "-unaligned"
}
apkName += ".apk"
println outputFile.name+" --> " + apkName
output.outputFile = new File(outputFile.parent, apkName)
}
}
}
}
}
def retrieveVersionCode(variantName) {
def manifestFile = file("src/$variantName/AndroidManifest.xml")
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
return Integer.parseInt(matcher.group(1))
}
def retrieveVersionName(variantName) {
def manifestFile = file("src/$variantName/AndroidManifest.xml")
def pattern = Pattern.compile(Pattern.quote("versionName=\"") + "(.*?)"+ Pattern.quote("\""))
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
return matcher.group(1)
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
lintOptions {
abortOnError false
absolutePaths false
lintConfig file("lint.xml")
}
defaultConfig {
applicationId "com.app.sportcam"
minSdkVersion 8
targetSdkVersion 21
}
if(project.hasProperty("app.signing")
&& new File(project.property("app.signing")+'.gradle').exists()) {
apply from: project.property("app.signing")+'.gradle';
} else {
println 'Warning, signing credential not found: ' + project.property("app.signing")+'.gradle'
}
buildTypes {
all {
buildConfigField 'String', 'IP', '"192.168.1.1"'
buildConfigField 'String', 'RTSP_IP', '"rtsp://"+IP+"/"'
//debugging
buildConfigField 'boolean', 'DEBUG_DETAILED', 'false'
buildConfigField 'boolean', 'DEBUG_UI_STATE', 'false'
buildConfigField 'boolean', 'INTERNAL_DEBUG', 'false'
buildConfigField 'boolean', 'ENABLE_VIEWSERVER', 'false'
buildConfigField 'boolean', 'INJECT_PTP_PROPERTIES', 'false'
//functional
buildConfigField 'boolean', 'ENABLE_TIME_LIMIT', 'false'
buildConfigField 'boolean', 'HIDE_ACTIONBAR_ON_LANDSCAPE', 'false'
buildConfigField 'boolean', 'ENABLE_VIDEO_DOWNLOAD', 'true'
buildConfigField 'boolean', 'ENABLE_VIDEO_DOWNLOAD_PROGRESS', 'true'
buildConfigField 'boolean', 'ENABLE_VIDEO_DOWNLOAD_CANCEL', 'false'
buildConfigField 'boolean', 'SET_TIME', 'true'
buildConfigField 'boolean', 'SHOULD_SET_CAMERA_MODE_WHEN_TURNING_RECORDING_OFF', 'false'
buildConfigField 'boolean', 'SHOULD_SET_CAMERA_MODE_ON_CONNECTION', 'false'
appendVersionNameVersionCode(applicationVariants)
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
//for customers' testing
debug {
buildConfigField 'boolean', 'ENABLE_TIME_LIMIT', 'true'
}
//for internal testing
debugEx {
buildConfigField 'boolean', 'DEBUG_DETAILED', 'true'
buildConfigField 'boolean', 'INTERNAL_DEBUG', 'true'
buildConfigField 'boolean', 'ENABLE_VIEWSERVER', 'true'
buildConfigField 'boolean', 'INJECT_TEST_PROPERTIES', 'true'
debuggable true
signingConfig signingConfigs.debug
applicationIdSuffix ".debug"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
def time=Calendar.getInstance()
time.add(Calendar.MONTH, 3)
println 'Debug build expiry date='+time.getTime()
productFlavors {
// default BuildConfig variables
all {
buildConfigField 'long', 'TIME_LIMIT', time.getTimeInMillis()+'l'
buildConfigField 'boolean', 'ADD_ABOUT', 'true'
buildConfigField 'boolean', 'FORCE_DEVICE_CHECK', 'false'
buildConfigField 'boolean', 'SHOW_CUR_SELECTION_PREF', 'true'
buildConfigField 'boolean', 'SHOW_CUR_SELECTION_ONSCREEN', 'false'
buildConfigField 'boolean', 'NO_WIFI_SCREEN', 'true'
buildConfigField 'boolean', 'NO_STREAMING', 'false'
buildConfigField 'boolean', 'NO_GALLERY', 'false'
buildConfigField 'boolean', 'INIT_IN_START', 'true'
buildConfigField 'boolean', 'CUSTOM_FUNCTIONS', 'true'
buildConfigField 'boolean', 'ENABLE_TIMEOUT_CONTINUE', 'false'
buildConfigField 'boolean', 'TRANSPARENT_BOTTOM_BAR', 'false'
buildConfigField 'int', 'LOGO_TIMING', '1000'
}
default {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0xFF'
buildConfigField 'boolean', 'ADD_ABOUT', 'false'
applicationId = 'com.app.default'
def variantName='DEFAULT'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_1 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0x0B'
buildConfigField 'boolean', 'FORCE_DEVICE_CHECK', 'true'
applicationId 'com.app.c1'
def variantName='c1'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_2 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0xFF' //TODO not final
buildConfigField 'boolean', 'SHOW_CUR_SELECTION_ONSCREEN', 'true'
applicationId 'com.app.c2'
def variantName='c2'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_3 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0x12'
buildConfigField 'int', 'LOGO_TIMING', '3000'
applicationId = 'com.app.c3'
def variantName='c3'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_4 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0x02'
applicationId = 'com.app.c4'
def variantName='c4'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_5 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0x04'
applicationId = 'com.app.c5'
def variantName='c5'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_6 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0xFF'
applicationId = 'com.app.c6'
def variantName='c6'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
Customer_7 {
//mandatory
buildConfigField 'int', 'CUSTOMER_NAME_PREFIX', '0x14'
buildConfigField 'boolean', 'FORCE_DEVICE_CHECK', 'true'
applicationId = 'com.app.c7'
def variantName='c7'
versionCode retrieveVersionCode(variantName)
versionName retrieveVersionName(variantName)
}
}
sourceSets{
main {
res.srcDirs = ['src/main/res']
}
default {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
}
Customer_1 {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
}
Customer_2 {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
}
Customer_3 {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
res.srcDir 'src/_Strings_/yy'
}
Customer_4 {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
}
Customer_5 {
res.srcDir 'src/_Strings_/xx'
res.srcDir 'src/_Strings_/zz'
}
Customer_6 {
res.srcDir 'src/_Strings_/xx'
res.srcDir 'src/_Strings_/aa'
}
Customer_7 {
res.srcDir 'src/_Strings_/Standard'
res.srcDir 'src/_Strings_/xx'
}
}
}
import java.util.regex.Pattern
def variantNameRegex = Pattern.quote("generate") + "(.*?)"+ Pattern.quote("BuildConfig")
Pattern patternVariantName = Pattern.compile(variantNameRegex);
tasks.whenTaskAdded { task ->
//TODO disables lint
if (task.name.startsWith("lint")) {
println 'Disables lint task: '+task.name
task.enabled = false
}
def m = patternVariantName.matcher(task.name)
if (m.find()) {
def variantName = m.group(1)
def isRelease=false
if (variantName.endsWith('Debug')) {
variantName = variantName.substring(0, variantName.lastIndexOf('Debug'))
} else if (variantName.endsWith('Release')) {
variantName = variantName.substring(0, variantName.lastIndexOf('Release'))
isRelease=true;
} else {
return
}
def taskIncVerCode="increaseVersionCode$variantName"
if(!project.hasProperty(taskIncVerCode)) {
project.task(taskIncVerCode) << {
def manifestFile = file("src/$variantName/AndroidManifest.xml")
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
def versionCode = Integer.parseInt(matcher.group(1))
def manifestContent = matcher.replaceAll("versionCode=\"" + ++versionCode + "\"")
manifestFile.write(manifestContent)
}
}
task.dependsOn taskIncVerCode
if(isRelease) {
def taskIncVerName="increaseVersionName$variantName"
if(!project.hasProperty(taskIncVerName)) {
project.task(taskIncVerName) << {
def manifestFile = file("src/$variantName/AndroidManifest.xml")
def patternVersionNumber = Pattern.compile("versionName=\"(\\d+)\\.(\\d+)\\.(\\d+)\"")
def manifestText = manifestFile.getText()
def matcherVersionNumber = patternVersionNumber.matcher(manifestText)
matcherVersionNumber.find()
def majorVersion = Integer.parseInt(matcherVersionNumber.group(1))
def minorVersion = Integer.parseInt(matcherVersionNumber.group(2))
def pointVersion = Integer.parseInt(matcherVersionNumber.group(3))
def mNextVersionName = majorVersion + "." + minorVersion + "." + (pointVersion + 1)
def manifestContent = matcherVersionNumber.replaceAll("versionName=\"" + mNextVersionName + "\"")
manifestFile.write(manifestContent)
}
}
task.dependsOn taskIncVerName
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:21.0.0'
compile files('libs/eventbus.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/trove-3.0.3.jar')
}
这是 Gradle 控制台输出,通过执行两次运行而生成,没有任何 gralde/代码修改:
Executing tasks: [:ptp_app_base:assembleCustomer_6DebugEx]
Parallel execution with configuration on demand is an incubating feature.
Debug build expiry date=Mon Mar 16 10:39:02 CST 2015
Disables lint task: lintVitalCustomer_1Release
Disables lint task: lintVitalCustomer_2Release
Disables lint task: lintVitalDefaultRelease
Disables lint task: lintVitalCustomer_3Release
Disables lint task: lintVitalCustomer_4Release
Disables lint task: lintVitalCustomer_5Release
Disables lint task: lintVitalCustomer_6Release
Disables lint task: lintVitalCustomer_7Release
Disables lint task: lint
Disables lint task: lintCustomer_1DebugEx
Disables lint task: lintCustomer_1Debug
Disables lint task: lintCustomer_1Release
Disables lint task: lintCustomer_2DebugEx
Disables lint task: lintCustomer_2Debug
Disables lint task: lintCustomer_2Release
Disables lint task: lintDefaultDebugEx
Disables lint task: lintDefaultDebug
Disables lint task: lintDefaultRelease
Disables lint task: lintCustomer_3DebugEx
Disables lint task: lintCustomer_3Debug
Disables lint task: lintCustomer_3Release
Disables lint task: lintCustomer_4DebugEx
Disables lint task: lintCustomer_4Debug
Disables lint task: lintCustomer_4Release
Disables lint task: lintCustomer_5DebugEx
Disables lint task: lintCustomer_5Debug
Disables lint task: lintCustomer_5Release
Disables lint task: lintCustomer_6DebugEx
Disables lint task: lintCustomer_6Debug
Disables lint task: lintCustomer_6Release
Disables lint task: lintCustomer_7DebugEx
Disables lint task: lintCustomer_7Debug
Disables lint task: lintCustomer_7Release
ptp_app_base-Customer_1-debugEx.apk --> MY_APP_Customer_1_debugEx_.apk
ptp_app_base-Customer_1-debug.apk --> MY_APP_Customer_1_20141216.apk
ptp_app_base-Customer_1-release.apk --> MY_APP_Customer_1_20141216_SIGNED.apk
ptp_app_base-Customer_2-debugEx.apk --> MY_APP_Customer_2_debugEx_.apk
ptp_app_base-Customer_2-debug.apk --> MY_APP_Customer_2_20141216.apk
ptp_app_base-Customer_2-release.apk --> MY_APP_Customer_2_20141216_SIGNED.apk
ptp_app_base-default-debugEx.apk --> MY_APP_default_debugEx_.apk
ptp_app_base-default-debug.apk --> MY_APP_default_20141216.apk
ptp_app_base-default-release.apk --> MY_APP_default_20141216_SIGNED.apk
ptp_app_base-Customer_3-debugEx.apk --> MY_APP_Customer_3_debugEx_.apk
ptp_app_base-Customer_3-debug.apk --> MY_APP_Customer_3_20141216.apk
ptp_app_base-Customer_3-release.apk --> MY_APP_Customer_3_20141216_SIGNED.apk
ptp_app_base-Customer_4-debugEx.apk --> MY_APP_Customer_4_debugEx_.apk
ptp_app_base-Customer_4-debug.apk --> MY_APP_Customer_4_20141216.apk
ptp_app_base-Customer_4-release.apk --> MY_APP_Customer_4_20141216_SIGNED.apk
ptp_app_base-i3-debugEx.apk --> MY_APP_i3_debugEx_.apk
ptp_app_base-i3-debug.apk --> MY_APP_i3_20141216.apk
ptp_app_base-i3-release.apk --> MY_APP_i3_20141216_SIGNED.apk
ptp_app_base-i5-debugEx.apk --> MY_APP_i5_debugEx_.apk
ptp_app_base-i5-debug.apk --> MY_APP_i5_20141216.apk
ptp_app_base-i5-release.apk --> MY_APP_i5_20141216_SIGNED.apk
ptp_app_base-Customer_7-debugEx.apk --> MY_APP_Customer_7_debugEx_.apk
ptp_app_base-Customer_7-debug.apk --> MY_APP_Customer_7_20141216.apk
ptp_app_base-Customer_7-release.apk --> MY_APP_Customer_7_20141216_SIGNED.apk
:ptp_app_base:preBuild
:ptp_app_base:compileCustomer_6DebugExNdk UP-TO-DATE
:ptp_app_base:preCustomer_6DebugExBuild
:ptp_app_base:checkCustomer_6DebugExManifest
:ptp_app_base:preCustomer_4DebugBuild
:ptp_app_base:preCustomer_4DebugExBuild
:ptp_app_base:preCustomer_4ReleaseBuild
:ptp_app_base:preCustomer_5DebugBuild
:ptp_app_base:preCustomer_5DebugExBuild
:ptp_app_base:preCustomer_5ReleaseBuild
:ptp_app_base:preCustomer_6DebugBuild
:ptp_app_base:preCustomer_6ReleaseBuild
:ptp_app_base:preDefaultDebugBuild
:ptp_app_base:preDefaultDebugExBuild
:ptp_app_base:preDefaultReleaseBuild
:ptp_app_base:preCustomer_3DebugBuild
:ptp_app_base:preCustomer_3DebugExBuild
:ptp_app_base:preCustomer_3ReleaseBuild
:ptp_app_base:preCustomer_7DebugBuild
:ptp_app_base:preCustomer_7DebugExBuild
:ptp_app_base:preCustomer_7ReleaseBuild
:ptp_app_base:preCustomer_1DebugBuild
:ptp_app_base:preCustomer_1DebugExBuild
:ptp_app_base:preCustomer_1ReleaseBuild
:ptp_app_base:preCustomer_2DebugBuild
:ptp_app_base:preCustomer_2DebugExBuild
:ptp_app_base:preCustomer_2ReleaseBuild
:ptp_app_base:prepareComAndroidSupportSupportV42100Library UP-TO-DATE
:ptp_app_base:prepareCustomer_6DebugExDependencies
:ptp_app_base:compileCustomer_6DebugExAidl UP-TO-DATE
:ptp_app_base:compileCustomer_6DebugExRenderscript UP-TO-DATE
:ptp_app_base:generateCustomer_6DebugExBuildConfig
:ptp_app_base:generateCustomer_6DebugExAssets UP-TO-DATE
:ptp_app_base:mergeCustomer_6DebugExAssets UP-TO-DATE
:ptp_app_base:generateCustomer_6DebugExResValues UP-TO-DATE
:ptp_app_base:generateCustomer_6DebugExResources UP-TO-DATE
:ptp_app_base:mergeCustomer_6DebugExResources UP-TO-DATE
:ptp_app_base:processCustomer_6DebugExManifest UP-TO-DATE
:ptp_app_base:processCustomer_6DebugExResources UP-TO-DATE
:ptp_app_base:generateCustomer_6DebugExSources
:ptp_app_base:compileCustomer_6DebugExJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:ptp_app_base:preDexCustomer_6DebugEx UP-TO-DATE
:ptp_app_base:dexCustomer_6DebugEx
:ptp_app_base:processCustomer_6DebugExJavaRes UP-TO-DATE
:ptp_app_base:validateDebugSigning
:ptp_app_base:packageCustomer_6DebugEx
:ptp_app_base:zipalignCustomer_6DebugEx
:ptp_app_base:assembleCustomer_6DebugEx
BUILD SUCCESSFUL
Total time: 30.303 secs
当前的构建脚本可能不是最高效的,因此将不胜感激关于如何跳过重建或加速重建的两个提示。
编辑 2:我注意到大部分 gradle 构建时间都花在了:
尽管自上次构建以来没有任何变化,但这些步骤似乎仍在运行。
编辑 3:原来的标题是“使用 Android Studio 运行/调试时如何跳过 Gradle 构建”,更改为更好地反射(reflect)问题的症状和补救措施。
最佳答案
原因是我的愚蠢:
我设置了一个 BuildConfig
字段为当前时间,以毫秒为单位,这导致每次 Gradle 运行时生成的 BuildConfig.java
都不一样,导致整个编译/要运行的 dexing/packaging 阶段。
编辑:
对我来说,问题是由执行类似于此的脚本引起的:
productFlavors {
all {
buildConfigField 'long', 'TIME_LIMIT', System.currentTimeMillis() + 'l'
}
...
}
由于 System.currentTimeMillis() 每次都会不同,这意味着每次 Gradle 运行时都会发现源代码已更改,因此会触发一系列操作。通过将脚本更改为:
def time = Calendar.getInstance()
time.set(Calendar.HOUR, 1);
time.set(Calendar.MINUTE, 1);
time.set(Calendar.SECOND, 1);
time.set(Calendar.MILLISECOND, 1);
productFlavors {
// default BuildConfig variables
all {
buildConfigField 'long', 'TIME_LIMIT', time.getTimeInMillis() + 'l'
}
...
}
上面的脚本意味着在同一天运行时会产生完全相同的时间。因此,如果没有其他任何更改,那么之前生成的 APK 将被重复使用,无需重新编译。
关于android - 每次 Gradle 运行时都会编译应用程序,占用大量时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27485624/
您好,我是使用 xampp 的 PHPmyadmin 新手,没有 MYSQL 背景。当我喜欢研究它是如何工作的时,我的脑海中浮现出一个想法,它让我一周都无法休眠,因为我似乎无法弄清楚如何使用 MIN(
Go docs say (强调): Programs using times should typically store and pass them as values, not pointers.
我有一组用户在 8 月 1 日有一个条目。我想找到在 8 月 1 日有条目但在 8 月 2 日没有做任何事情的用户。 现在是 10 月,所以事件已经过去很久了。 我有限的知识说: SELECT * F
我有以下代码,主要编码和取消编码时间结构。这是代码 package main import ( "fmt" "time" "encoding/json" ) type chec
您能详细解释一下“用户 CPU 时间”和“系统 CPU 时间”吗?我读了很多,但我不太理解。 最佳答案 区别在于时间花在用户空间还是内核空间。用户 CPU 时间是处理器运行程序代码(或库中的代码)所花
应用程序不计算东西,但做输入/输出、读取文件、使用网络。我希望探查器显示它。 我希望像 callgrind 中的东西一样,在每个问题中调用 clock_gettime。 或者像 oprofile 那样
目前我的 web 应用程序接收 websocket 数据来触发操作。 这会在页面重新加载时中断,因此我需要一个能够触发特定事件的客户端解决方案。 这个想法可行吗? 假设你有 TimeX = curre
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我有一个 Instant (org.joda.time.Instant) 的实例,我在一些 api 响应中得到它。我有另一个来自 (java.time.Instant) 的实例,这是我从其他调用中获得
如何集成功能 f(y) w.r.t 时间;即 'y'是一个包含 3000 个值和值 time(t) 的数组从 1 到 3000 不等。所以,在整合 f(y) 后我需要 3000 个值. 积分将是不确定
可以通过 CLI 创建命名空间,但是如何使用 Java SDK 来创建命名空间? 最佳答案 它以编程方式通过 gRPC API 完成由服务公开。 在 Java 中,生成的 gRPC 客户端可以通过 W
我有一个函数,它接受 2 组日期(开始日期和结束日期),这些日期将用于我的匹配引擎 我必须知道start_date1和end_date1是否在start_date2和end_date2内 快进:当我在
我想从 Python 脚本运行“time”unix 命令,以计算非 Python 应用程序的执行时间。我会使用 os.system 方法。有什么方法可以在Python中保存这个输出吗?我的目标是多次运
我正在寻找一种“漂亮的数字”算法来确定日期/时间值轴上的标签。我熟悉 Paul Heckbert's Nice Numbers algorithm . 我有一个在 X 轴上显示时间/日期的图,用户可以
在 PowerShell 中,您可以格式化日期以返回当前小时,如下所示: Get-Date -UFormat %H 您可以像这样在 UTC 中获取日期字符串: $dateNow = Get-Date
我正在尝试使用 Javascript 向父子窗口添加一些页面加载检查功能。 我的目标是“从父窗口”检测,每次子窗口完全加载然后执行一些代码。 我在父窗口中使用以下代码示例: childPage=wi
我正在尝试设置此 FFmpeg 命令的 drawtext 何时开始,我尝试使用 start_number 但看起来它不会成功。 ffmpeg -i 1.mp4 -acodec aac -keyint_
我收到了一个 Excel (2010) 电子表格,它基本上是一个文本转储。 单元格 - J8 具有以下信息 2014 年 2 月 4 日星期二 00:08:06 EST 单元格 - L8 具有以下信息
我收到的原始数据包含一列具有以下日期和时间戳格式的数据: 2014 年 3 月 31 日凌晨 3:38 单元格的格式并不一致,因为有些单元格有单个空格,而另一些单元格中有两个或三个字符之间的空格。所以
我想知道是否有办法在我的 Grails 应用程序顶部显示版本和构建日期。 编辑:我应该说我正在寻找构建应用程序的日期/时间。 最佳答案 在您的主模板中,或任何地方。 Server version:
我是一名优秀的程序员,十分优秀!