先前我在開發軟體時,我設定讓他以 localhost:6000 開啟,結果出現 ERR_UNSAFE_PORT 錯誤,然而用 cURL 卻又一切正常。
經查詢,這是因為 6000 在瀏覽器中被列為 unsafe port。
這個 port 是 linux X11 桌面系統所用的,所以瀏覽器將之限制了。
先前我在開發軟體時,我設定讓他以 localhost:6000 開啟,結果出現 ERR_UNSAFE_PORT 錯誤,然而用 cURL 卻又一切正常。
經查詢,這是因為 6000 在瀏覽器中被列為 unsafe port。
這個 port 是 linux X11 桌面系統所用的,所以瀏覽器將之限制了。
紀錄一下如何在 Data Integration pipeline 中,使用 Transform 轉換欄位名稱。
例如這是我原始 Table
| UU01 | UU02 | UU03 |
|---|---|---|
| 51982064-26f7-435c-a935-bf522ebda29d | 王曉明 | 1 |
| 91d49f51-495d-4d98-833e-a1e090475195 | 張阿榮 | 0 |
| 251e5455-c061-4836-b2d7-ee40b7da4f54 | 陳曉嵐 | 1 |
| 0295db65-b2e3-40ac-b2ec-24798703df1b | 陳大華 | 2 |
而我想轉成:
| id | name | status |
|---|---|---|
| 51982064-26f7-435c-a935-bf522ebda29d | 王曉明 | 1 |
| 91d49f51-495d-4d98-833e-a1e090475195 | 張阿榮 | 0 |
| 251e5455-c061-4836-b2d7-ee40b7da4f54 | 陳曉嵐 | 1 |
| 0295db65-b2e3-40ac-b2ec-24798703df1b | 陳大華 | 2 |
要進行以下修改,要使用 transform
code 如下
from mage_ai.data_cleaner.transformer_actions.base import BaseAction
from mage_ai.data_cleaner.transformer_actions.constants import ActionType, Axis
from mage_ai.data_cleaner.transformer_actions.utils import build_transformer_action
from pandas import DataFrame
if 'transformer' not in globals():
from mage_ai.data_preparation.decorators import transformer
if 'test' not in globals():
from mage_ai.data_preparation.decorators import test
@transformer
def transform(df: DataFrame, *args, **kwargs) -> DataFrame:
"""
欄位轉換,這段程式會根據 mapping 變數的 key / value 轉換匯出的欄位
"""
mapping = {
"UU01": "id",
"UU02": "name",
"UU03": "status"
}
# 實際執行 rename;不存在的欄位會被忽略
df_renamed = df.rename(columns=mapping)
return df_renamed
@test
def test_output(output, *args) -> None:
"""
Template code for testing the output of the block.
"""
assert output is not None, 'The output is undefined'
執行完畢後,就會匯出欄位名稱是 id / name / status
紀錄一下如何在 Data Integration pipeline 中,使用 Transform 轉換欄位值。
例如現在我有 Table 紀錄員工狀態(1:在職;0:離職;2:留職停薪)
| id | name | status |
|---|---|---|
| 51982064-26f7-435c-a935-bf522ebda29d | 王曉明 | 1 |
| 91d49f51-495d-4d98-833e-a1e090475195 | 張阿榮 | 0 |
| 251e5455-c061-4836-b2d7-ee40b7da4f54 | 陳曉嵐 | 1 |
| 0295db65-b2e3-40ac-b2ec-24798703df1b | 陳大華 | 2 |
想讓匯出的 table 的 status 變成「在職/離職/留職停薪」
這是我在開發 Tauri APP 時遇到的問題。以下是我的錯誤訊息:
Uncaught TypeError: Failed to resolve module specifier "@tauri-apps/plugin-store". Relative references must start with either "/", "./", or "../".
我的開發環境是安裝 Android Studio 而不是裝 Android Studio Command line tool。
安裝完畢後並沒有特別安裝額外的 SDK tool
所以沒有 NDK
但今天我要使用 Tauri 來編譯成 Android APK 就需要 NDK 了(NDK 是用來編譯 C/C++ code 用,Tauri 本身是 Rust 寫的,所以有需要)。
使用的 Framework 是Ionic + Vue 3.5
我有兩個頁面,原本的 code 如下
<!-- 第一頁 -->
<template>
<ion-page>
<ion-header >
<ion-toolbar>
<ion-title><h1>Foo</h1></ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<!-- 中略 -->
</ion-content>
</ion-page>
</template>
<!-- 第二頁 -->
<template>
<ion-menu content-id="main-content">
<ion-header >
<ion-toolbar color="tertiary">
<ion-title>Menu Content</ion-title>
</ion-toolbar>
<ion-menu-toggle slot="end">
<ion-button>Close</ion-button>
</ion-menu-toggle>
</ion-header>
<ion-content class="ion-padding">
<!-- 中略 -->
</ion-content>
</ion-menu>
<ion-page id="main-content">
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title> BAR </ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<!-- 中略 -->
</ion-content>
</ion-page>
</template>兩頁的差別在於,第二頁有
<ion-menu/>;第一頁沒有。
這樣的 code ,從第一頁切換到第二頁是正常的
但從第二頁切換回第一頁時,會出現以下錯誤:
<ion-header> 顯示的是第二頁的標題<ion-menu>依舊存在我接手一個 android app,他有使用一個 lib:PageIndicatorview
dependencies {
implementation 'com.romandanylyk:pageindicatorview:1.0.2'
}
執行 gradlew.bat assembleDebug --warning-mode all
後,會回復以下 2 個錯誤訊息
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 9.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.10.2/userguide/upgrading_version_6.html#jcenter_deprecation
at build_c0uup8fmroz422c6id7ruwe51$_run_closure1$_closure2.doCall$original(D:\workspace\app\build.gradle:4)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
at build_c0uup8fmroz422c6id7ruwe51$_run_closure1.doCall$original(D:\workspace\app\build.gradle:2)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
WARNING: The option setting 'android.defaults.buildfeatures.buildconfig=true' is deprecated.
The current default is 'false'.
It will be removed in version 9.0 of the Android Gradle plugin.
To keep using this feature, add the following to your module-level build.gradle files:
android.buildFeatures.buildConfig = true
or from Android Studio, click: `Refactor` > `Migrate BuildConfig to Gradle Build Files`.
> Task :app:checkDebugAarMetadata FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.romandanylyk:pageindicatorview:1.0.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
- https://repo.maven.apache.org/maven2/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
- https://jitpack.io/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
Required by:
project :app