sample code
new interface class:
// sample class
class S {
void Function(String)? onABC;
void Function(int)? onDEF;
STTCallback({this.onABC, this.onDEF});
}
--nothing here--
new interface class:
// sample class
class S {
void Function(String)? onABC;
void Function(int)? onDEF;
STTCallback({this.onABC, this.onDEF});
}
本文整理了兩篇論文中的相關內容,並重點探討 Label Smoothing 的概念、實現方式與效益。兩篇論文分別是:
testparm
有的字元不是utf8
忽略錯誤亂碼
f.read().decode('utf-8','ignore')
Dart does not currently have an arbitrary base logarithm function, only base e (log). This is most likely inherited from JavaScript, which also only provides these two.
In general, the logarithm at one base, b1, can be found using the logarithm at any other base, b2 as logb1(x) = logb2(x) / logb2(b1).
# Flutter build failed on andorid platform
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':path_provider_android:androidJdkImage'.
> Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: D:\Android_SDK\Sdk\platforms\android-35\core-for-system-modules.jar.
> Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path C:\Users\XXXXXXXXX\.gradle\caches\transforms-3\cc12c5242eac95612f50f56c
5a36d784\transformed\output\temp\jmod --add-modules java.base --output C:\Users\XXXXXXXXX\.gradle\caches\transforms-3\cc12c5242eac95612f50f56c5a36d784\transformed\output\jdkImage --disable-plugin syst
em-modules}
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
BUILD FAILED in 6s
Running Gradle task 'assembleDebug'... 7.6s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] This is likely due to a known bug in Android Gradle Plugin (AGP) versions less than 8.2.1, when │
│ D:\XXXXXXXXXXXXXXXXX\android\settings.gradle, │
│ in the 'plugins' closure (by the number following "com.android.application"). │
│ Alternatively, if your project was created with an older version of the templates, it is likely │
│ in the buildscript.dependencies closure of the top-level build.gradle: │
│ D:\XXXXXXXXXXXXXXXXX\android\build.gradle, │
│ as the number following "com.android.tools.build:gradle:". │
│ │
│ For more information, see: │
│ https://issuetracker.google.com/issues/294137077 │
│ https://github.com/flutter/flutter/issues/156304 │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
DBSCAN(Density-Based Spatial Clustering of Applications with Noise)是一種基於密度的聚類算法,適用於發現具有任意形狀的聚類,並能有效處理噪聲數據點。
DBSCAN 使用兩個主要參數來進行聚類:
log:
std::string
是有效的 UTF-8env->NewStringUTF()
只能處理有效的 UTF-8 字符串。如果 transcribeMelBuffer
返回的 std::string
不是 UTF-8,則應該先進行轉換。例如:
std::string result = engine->transcribeMelBuffer(sampleVector);
// 確保 result 是 UTF-8
if (!isValidUTF8(result)) {
return env->NewStringUTF("Error: Invalid UTF-8 output");
}
return env->NewStringUTF(result.c_str());
@Composable
fun SampleSpinner(
list: List<Pair<String, String>>,
preselected: Pair<String, String>,
onSelectionChanged: (selection: Pair<String, String>) -> Unit
) {
var selected by remember { mutableStateOf(preselected) }
var expanded by remember { mutableStateOf(false) } // initial value
Box {
Column {
OutlinedTextField(
value = (selected.second),
onValueChange = { },
label = { Text(text = "My List") },
modifier = Modifier.fillMaxWidth(),
trailingIcon = { Icon(Icons.Outlined.ArrowDropDown, null) },
readOnly = true
)
DropdownMenu(
modifier = Modifier.fillMaxWidth(),
expanded = expanded,
onDismissRequest = { expanded = false },
) {
list.forEach { entry ->
DropdownMenuItem(
modifier = Modifier.fillMaxWidth(),
onClick = {
selected = entry
expanded = false
},
text = {
Text(
text = (entry.second),
modifier = Modifier
.wrapContentWidth()
.align(Alignment.Start)
)
}
)
}
}
}
Spacer(
modifier = Modifier
.matchParentSize()
.background(Color.Transparent)
.padding(10.dp)
.clickable(
onClick = { expanded = !expanded }
)
)
}
}
@Preview(showBackground = true)
@Composable
fun SampleSpinner_Preview() {
MaterialTheme {
val entry1 = Pair("Key1", "Entry1")
val entry2 = Pair("Key2", "Entry2")
val entry3 = Pair("Key3", "Entry3")
SampleSpinner(
listOf(entry1, entry2, entry3),
preselected = entry2,
onSelectionChanged = { selected -> /* do something with selected */ }
)
}
}
在 Android 開發的世界中,UI 元件的設計歷來是開發者最重要的工作之一。傳統上,Android 使用 XML 布局來定義界面,然而,這種方法相對繁瑣,且缺乏靈活性。為了解決這些問題,Google 推出了 Jetpack Compose,一個基於 Kotlin 語言的 UI 架構,旨在使 UI 開發更加簡單、直觀、和靈活。
Jetpack Compose 的核心概念是“聲明式 UI”,這意味著開發者只需要描述界面應該是什麼樣的,框架會自動處理 UI 的更新和渲染。這種方式使得代碼更加簡潔且易於維護。
This is a blog home page demo.
To use this layout, you should set both layout: BlogHome
and home: true
in the page front matter.
For related configuration docs, please see blog homepage.