Ubuntu 24.04.4 LTS (GNU/Linux 6.17.0-14-generic x86_64)
Wifiの設定
設定ファイの変更
> sudo nano /etc/netplan/50-cloud-init.yaml
設定内容の反映
> sudo netplan try
Ubuntu 24.04.4 LTS (GNU/Linux 6.17.0-14-generic x86_64)
Wifiの設定
設定ファイの変更
> sudo nano /etc/netplan/50-cloud-init.yaml
設定内容の反映
> sudo netplan try
設定から個人用設定>背景で画像を選択した場合に表示される履歴の削除
説明で書くとなんか良く分からんので、
これです(笑)現状ではレジストリから削除するしか無さげです。Windows powershellで実行するには次の通り。
Remove-ItemProperty -Path Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers\ -Name BackgroundHistoryPath[0-4]
短く書くこうとすれば、もう少し短くなる要素はありますが、基本的な書き方だとこうなるかと。
注意点として、設定画面の上記の設定を出したままで削除するとなんか設定画面が反応しなくなります。設定画面など、不要なwindowは閉じた状態で実行した方が良いでしょう。なお、レジストリを削除してもこの画面を開くとBackgroundHistoryPath0~4デフォルト値が追加されます。
それと、BackedUpWallpaperPathに設定されている画像のパスとファイル名が保存されています。
背景のカスタマイズには画像以外にも設定できるのですが、変更する時に作成されるのかと思っていましたが、確認したところ作成されなかったので、アップデートや新規インストールの時にMicrosoftからの広告が出るときにでも設定されているのかもしれません。
DIR=$(cd $(dirname $0); pwd)
DIR=$(realpath $(dirname $0))
pwdを使用する場合は、実在しているディレクトリのみ。
realpathはオプション指定で実在している必要はない。
現時点(2025/06)では設定ではできなくなくなってしまった。
検索したあとに表示されるurlに「&udm=14」を追加するとAI表示はなくなる。
検索したときに表示されるタブが「すべて」になっているとAI表示も行われてしまうため、これを「ウェッブ」とすることで表示がされなくなる。
アドオンも「&udm=14」で検索すると色々出てくるが、このぐらいならアドオンによるリスクを負わなくてもいいような気もする。
https://atmarkit.itmedia.co.jp/ait/articles/2411/15/news036.html
ANSIかUTF-8(BOM付き)のどちらか。
Unix系のではテキストファイルはUTF-8(BOM付き)は正しく処理されない。
Visual Studio CodeではテキストファイルはUTF8NoBOMで保存される。Ascii文字以外の文字が含まれると文字がPowerShellは正しく処理されない。
結論として、
PowerShellスクリプトでAscii文字以外を使用するには、UTF-8(BOM付き)にする必要がある。PowerShellスクリプトファイルはBOMがないファイルはANSIとして処理される。
https://learn.microsoft.com/ja-jp/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.5
Write-Host 非推奨
Write-Verbose ユーザー側でVerbose パラメーターで出力を指定できる。
Write-Output 出力される。
https://learn.microsoft.com/ja-jp/powershell/utility-modules/psscriptanalyzer/rules/avoidusingwritehost?view=ps-modules
構文
-split <String>
-split (<String[]>)
<String> -split <Delimiter>[,<Max-substrings>[,"<Options>"]]
<String> -split {<ScriptBlock>} [,<Max-substrings>]
Max-substrings
PowerShell 7以降:マイナス指定で末尾から数えて処理される。
https://learn.microsoft.com/ja-jp/powershell/module/microsoft.powershell.core/about/about_split?view=powershell-7.5
| 関数 | 呼び出し元の参照 (thisは省略可能) | 戻り値 | 用途 |
|---|---|---|---|
| apply | this | 呼び出し元のインスタンス | プロパティ設定 |
| also | it | 呼び出し元のインスタンス | プロパティ設定 |
| let | it | ラムダの結果 | メソッドの実行 nullチェック |
| run | this | ラムダの結果 | メソッドの実行 |
| with | this | ラムダの結果 | メソッドの実行 |
[Kotlin]スコープ関数 apply,also,let,run,withの使い分け https://pouhon.net/kotlin-sfunction/1392/
初期化タイミングを変数を初めて使用する時に初期化する
lateinit、by lazy
プリミティブ型には使用できない。
varで宣言する必要がある。
必ずnon-nullとなる。
class MainActivity : AppCompatActivity() {
private lateinit var textView: TextView
override fun onCreate(saveInstanceState: Bundle?) {
super.onCreate(saveInstanceState)
textView = findViewById(R.id.text_view) // ここで初めて初期化される
}
// …
}
varで宣言するので、再代入には注意すること。
by lazy
型の制限はない。
valで宣言する必要がある。
nullable / nun-nullどちらでも可能
対象のプロパティが初めて呼び出されたときに初期化される。
初期化されたら必ず同じ値を返す。
class MainActivity : AppCompatActivity() {
private val userData: User? by lazy { fetchUserData() }
override fun onCreate(saveInstanceState: Bundle?) {
super.onCreate(saveInstanceState)
userData?.let { showUserData(it) } // ここで初めて初期化される
}
// …
}
ビューをlazyで初期化した場合、変更を加えても反映されない。
プロパティーにnullが入る可能性がある場合はlazyを使う必要がある。
by lazyは初期化処理を記述する必要があるので、記述上各メソッドの処理はスッキリさせることができる。
Qiita 【Android】lateinitとby lazyの使い分け【Kotlin】 https://qiita.com/u-dai/items/a31c5c2a7d5c7ed2cc47
トリガー条件不明。
motionはカメラから画像が指定したFPS以下の場合、不足したフレームを複製させてパディングするようなパラメータがあるが、実際のところ不足しているフレームは単純に抜け落ちるだけで保管もされない。
そのために落ちているのかもしれないが、よくわからない。
が、実際にこのエラーが表示されている状態でもファイル出力がされていたので、無視していいのかもしれない。
なお、部屋を暗くしたらこれが発生して落ちていた。
状況としては動作検知後、録画し始めて19時17分22秒あと、1分程度経ってからエラーが出始め、落ちていた。
[1:ml1:F] [NTC] [EVT] [Apr 02 19:17:22] event_newfile: File of type 8 saved to: /tmp/motion/C270_2/20220402191722F-10.mp4
[1:ml1:F] [NTC] [ALL] [Apr 02 19:17:22] create_path: creating directory /tmp/motion/C270_2
[1:ml1:F] [NTC] [EVT] [Apr 02 19:17:22] event_create_extpipe: pipe: ffmpeg
[1:ml1:F] [NTC] [EVT] [Apr 02 19:17:22] event_create_extpipe: cnt->moviefps: 10
[1:ml1:F] [NTC] [EVT] [Apr 02 19:17:22] event_newfile: File of type 8 saved to: /tmp/motion/C270_2/20220402191722F-10
[1:ml1:F] [NTC] [ALL] [Apr 02 19:17:22] motion_detected: Motion detected - starting event 10
[1:ml1:F] [ERR] [ENC] [Apr 02 19:18:52] ffmpeg_put_frame: Error while writing video frame
[1:ml1:F] [ERR] [EVT] [Apr 02 19:18:52] event_ffmpeg_put: Error encoding image
[1:ml1:F] [ERR] [ENC] [Apr 02 19:18:52] ffmpeg_put_frame: Error while writing video frame
[1:ml1:F] [ERR] [EVT] [Apr 02 19:18:52] event_ffmpeg_put: Error encoding image
[1:ml1:F] [ERR] [ENC] [Apr 02 19:18:52] ffmpeg_put_frame: Error while writing video frame
[1:ml1:F] [ERR] [ENC] [Apr 02 19:20:02] ffmpeg_put_frame: Error while writing video frame
[1:ml1:F] [ERR] [EVT] [Apr 02 19:20:02] event_ffmpeg_put: Error encoding image
[1:ml1:F] [NTC] [ALL] [Apr 02 19:20:22] preview_save: different filename or picture only!
ログの抜粋はこんな感じ
作られたファイルとログは矛盾点はなかった。
もしかすると、pipeで渡しているフォーマットがまずいのかもしれないが、出力され始めるタイミングがずれているのと、フレームレートは10FPSと低めにしているのでそれなりなはずなのだが…
use_extpipe on
でpipeで外部エンコーダを利用するとon_movie_endイベントでファイル名をパラメータとして渡したときに、拡張子がついていたりついてなかったりする。
トリガー条件が不明。
ログ(/var/log/motion/motion.log)を見てみると event_newfile: でファイル名が出力されているので見てみると、extpipeを使い始めたタイミングで2回ファイル名が出力されているように見える。extpipeがonでも拡張子があったりなかったりする。
問題がなさそうな時
[1:ml1:F] [NTC] [EVT] [Apr 01 19:58:26] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401195826F-01.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 19:59:08] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401195829F-01-05.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:02:28] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401200228F-02.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 20:02:58] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401200228F-02-04.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:11:02] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401201102F-03.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 20:14:02] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401201112F-03-02.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:14:26] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401201425F-04.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 20:15:06] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401201426F-04-02.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:15:28] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401201528F-05.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 20:16:54] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401201531F-05-01.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:16:56] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401201656F-06.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 20:17:57] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401201712F-06-07.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 20:21:46] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401202145F-07.mp4
問題が発生している前後では拡張子がないファイルが作成されている感じになっている。
[1:ml1:F] [NTC] [EVT] [Apr 01 22:26:47] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401222647F-02
[1:ml1:F] [NTC] [EVT] [Apr 01 22:27:31] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401222649F-02-05.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 22:38:21] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401223821F-01.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 22:38:21] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401223821F-01
[1:ml1:F] [NTC] [EVT] [Apr 01 22:38:58] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401223822F-01-07.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 22:42:45] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224245F-02.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 22:42:45] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224245F-02
[1:ml1:F] [NTC] [EVT] [Apr 01 22:45:45] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401224251F-02-05.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 22:45:45] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224545F-03.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 22:45:45] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224545F-03
[1:ml1:F] [NTC] [EVT] [Apr 01 22:47:29] event_newfile: File of type 1 saved to: /tmp/motion/C270/20220401224646F-03-02.jpg
[1:ml1:F] [NTC] [EVT] [Apr 01 22:47:30] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224730F-04.mp4
[1:ml1:F] [NTC] [EVT] [Apr 01 22:47:30] event_newfile: File of type 8 saved to: /tmp/motion/C270/20220401224730F-04
動作させてるバージョン。
pi@rasp3b:~ $ motion -help
motion Version 4.1.1, Copyright 2000-2017 Jeroen Vreeken/Folkert van Heusden/Kenneth Lavrsen/Motion-Project maintainers
解決策としてはイベント中の処理スクリプトで拡張子を付加して対応したが、少々気持ち悪い動作というか多分バグ。仕様としては拡張パイプを使用した場合の拡張子がついてしまっているのがおかしいかな。
pi@rasp3b:~ $ FILENAME=ABCDEF.GHI
pi@rasp3b:~ $ echo ${FILENAME##*.}
GHI
pi@rasp3b:~ $ FILENAME=ABCDEF.
pi@rasp3b:~ $ echo ${FILENAME##*.}
ファイル名に拡張子がない場合は同じ文字列になる。
pi@rasp3b:~ $ FILENAME=ABCDEF
pi@rasp3b:~ $ echo ${FILENAME##*.}
ABCDEF
拡張子しかない場合も同じものとなる。
pi@rasp3b:~ $ FILENAME=.XYZ
pi@rasp3b:~ $ echo ${FILENAME##*.}
XYZ
libsqlite3-0:armhf 3.27.2-3 armhf SQLite 3 shared libraryスクリプトのpython3上でバージョンの確認
php-sqlite3 2:7.3+69 all SQLite3 module for PHP [default]
php7.3-sqlite3 7.3.14-1~deb10u1 armhf SQLite3 module for PHP
libaprutil1-dbd-sqlite3:armhf 1.6.1-4 armhf Apache Portable Runtime Utility Library - SQLite3 Driver
libqt5sql5-sqlite:armhf 5.11.3+dfsg1-1+rpi1+deb10u3 armhf Qt 5 SQLite 3 database driver
pi@rasp4b4g:~ $ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.27.2'
>>> exit()
Bad: new password is too simple
$ sudo passwd pi
:app:lintVitalRelease FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:lintVitalRelease'. > Could not resolve all files for configuration ':app:lintClassPath'. > Could not find com.android.tools.lint:lint-gradle:26.1.4. Searched in the following locations: file:/C:/Android/SDK/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.pom file:/C:/Android/SDK/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.jar file:/C:/Android/SDK/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.pom file:/C:/Android/SDK/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.jar file:/C:/Android/SDK/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.pom file:/C:/Android/SDK/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.jar https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.pom https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.4/lint-gradle-26.1.4.jar Required by: project :app * 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 14s 17 actionable tasks: 1 executed, 16 up-to-date
allprojects {赤い文字の部分が追加されていました。
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}