【iPhone/Android】富士山 にいくなら「富士山」アプリ 🏔

GPSが内蔵されたスマホと地図を連携させるのは非常に便利ですが。

「富士山行くなら間違いなくこのアプリがいいよ。」とあちこちから言われます。

きつい登山中にややこしい画面操作のアプリは使うのが面倒ですが。

【iPhone/Android】富士山にいくなら「富士山」アプリ

👉 「富士山 - 富士登山に役立つ地図アプリ」をApp Storeで hatena-bookmark

【iPhone/Android】富士山にいくなら「富士山」アプリ
👉 富士山 - 富士登山に役立つ地図アプリ - Google Play のアプリ hatena-bookmark

【iPhone/Android】富士山にいくなら「富士山」アプリ

【iPhone/Android】富士山にいくなら「富士山」アプリ

富士山に特化しているので、すごく良いです。

登山口へのアクセス方法や山小屋、天気の情報もすぐに確認できます。

製造元は「ヤマレコ」さんです。

👉 ヤマレコ-登山やハイキング、クライミングなどの記録を共有できる、登山の総合コミュニティサイト hatena-bookmark

WEBブラウザでもアクセスできます。

 

🏔 いちいちスマホを操作する余裕がない

実際、登山中は、疲労、汗、格納場所、手袋などでいちいちスマホを手で操作するのが面倒すぎます。

水を飲む時のペットボトルの取り出しや蓋の開閉でさえだるい。

そんなとき、現在の状況を音声で教えてくれる機能が便利です。

【iPhone/Android】富士山にいくなら「富士山」アプリ

他人のスマホから時刻と標高の音声を聞くことが多かったのですが、

このアプリだったんですね!

今年は、このアプリで登ってみたいと思います!


スマホスタンド(充電不可)を作ってみたが、まあまあ使っている 📱

お香の香りって夏でも涼しげでいいですよね。



日本香堂 かゆらぎ 白檀 香立付 ホワイト 単品 40個 (x 1)

これの空き箱を木工用ボンドでくっつけちゃいます。

ただそれだけ。

台数が多くなると、立てておいた方が省スペースですし、視認性も良いですし。



日本香堂 かゆらぎ 白檀 香立付 ホワイト 単品 40個 (x 1)

ロック画面は常時時計表示にしておくのがおすすめです。

👉 Jake Wharton さん「Android12、ロック画面 / 常時表示の時計が良い。」  hatena-bookmark


【Android Studio】[File] - [Project Structure] - [Suggestions] で「Update」する dependencies の妥当性 💉

Suggestions に表示されてるので Update する。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件


androidx.navigation:navigation-compose:2.7.0-beta01

  ↓

androidx.navigation:navigation-compose:2.7.0-beta02

はい、NG です。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件

なんでや!?

 

💉 エラーメッセージ 「5 issues were found when checking AAR metadata」

エラーメッセージを見てみる。


5 issues were found when checking AAR metadata:


  1.  Dependency 'androidx.navigation:navigation-common:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).


  2.  Dependency 'androidx.navigation:navigation-runtime:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  3.  Dependency 'androidx.navigation:navigation-common-ktx:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  4.  Dependency 'androidx.navigation:navigation-runtime-ktx:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  5.  Dependency 'androidx.navigation:navigation-compose:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

長いですが要するに、


androidx.navigation:navigation-compose:2.7.0-beta02

が依存している以下、


androidx.navigation:navigation-common:2.7.0-beta02
androidx.navigation:navigation-runtime:2.7.0-beta02
androidx.navigation:navigation-common-ktx:2.7.0-beta02
androidx.navigation:navigation-runtime-ktx:2.7.0-beta02

は、


Android API 34

以上を必要としているので使えません。

ということのよう。

 

💉 なぜ私は、Android API 33 だったけか

「Flamingo」なのでそれが最新安定版。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件

Android Studio Flamingo | 2022.2.1 を使ってる場合、33 までです。

👉 Android Studio Flamingo | 2022.2.1  |  Android Developers hatena-bookmark

 

💉 まとめ

Android Studio の Suggestion ダイアログ

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件


[File]

  |

[Project Structue]

  |

[Suggestions]

は、Android Studio までを含めた全ての依存性を考慮していない

Version Catalog (toml) ですが、なんだか不便です。

👉 【Android Studio Flamingo】dependencies をバージョンアップデートするときに確認するべき3つの相性 hatena-bookmark


【WordPress】自分のブログで「無効なトラフィック」を発生させないための Adsense タグ記述

混乱してます。

方法はいろいろあると思いますが、

まずは、

管理者のアクセス時には広告を表示させない。

ということがシンプル。

 

📝 WordPress 組み込み関数によるタグ記述

以下を使うといい。


current_user_can( string $capability, mixed $args ): bool

👉 current_user_can() | Function | WordPress Developer Resources hatena-bookmark

管理者でログインしている状態を判別したい場合は、


current_user_can('administrator')

で、アクセスしている人を判別できます。

 

📝 WordPress テンプレートに埋め込む場合

自動広告の場合は以下のように埋め込みます。


<?php if (!current_user_can('administrator')): ?>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXX",
    enable_page_level_ads: true
  });
</script>
<?php endif; ?>

自動広告ではない場合でも同じように、


<?php if (!current_user_can('administrator')): ?>
// Adsense コード
<?php endif; ?>

の形式で書けば管理者からのアクセス時には表示されません。

 

📝 WordPress ウィジェットに埋め込む場合

functions.php で定義しておきます。


// functions.php
function adsense_shortcode() {
	$code = '
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXX" crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-XXXXXXXXXX"
     data-ad-slot="YYYYYYYYYY"
     data-ad-format="auto"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
';

  return current_user_can('administrator') ? '' : $code;
}
add_shortcode('adsense', 'adsense_shortcode');

ウィジェット側ではショートコード形式で呼び出します。


<div>[adsense]</div>

管理者でログインしていない場合は空文字を表示します。

 

📝 まとめ

管理者としてログインしていないブラウザでは有効ではありません。

逆にいえば、管理者としてログインしてなければ参照できます。

レイアウトなど確認したいときでも、最小限にしておくべきです。

クリックは当然禁物です。


【ImageMagick】グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

こういうやつ。背景は透明。

コピペで貼り付けるだけでサムネとかSNS画像を作成できます。



 

🖌️ 作り方

ImageMagick で作ります。


brew install imagemagick

まず、透明背景画像を作成します。


magick -size 2000x200 xc:none \
output.png

透明な画像が生成されました。

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

続いてこれにテキストを書き込みます。

フォントは「LINE-Seed-JP_OTF-ExtraBold」、フォントの輪郭の線の色と太さは「white」、「10」とします。


magick -size 2000x200 xc:none \
-font LINE-Seed-JP_OTF-ExtraBold \
-pointsize 160 \
-fill none -stroke white -strokewidth 10 \
-annotate +10+160 "お手軽簡単!" \
output.png

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

👉 LINE Seed hatena-bookmark

さらに、この輪郭線の上に「black」で「2」の線を重ねます。


magick -size 2000x200 xc:none \
-font LINE-Seed-JP_OTF-ExtraBold \
-pointsize 160 \
-fill none -stroke white -strokewidth 10 \
-annotate +10+160 "お手軽簡単!" \
-fill none -stroke black -strokewidth 2 \
-annotate +10+160 "お手軽簡単!" \
output.png

グラデーションな色で塗りつぶした縁取り極太テキスト画像

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

さらに、この上に、グラデーションの色「red-orange」で塗りつぶされたテキストを重ねます。


magick -size 2000x200 xc:none \
-font LINE-Seed-JP_OTF-ExtraBold \
-pointsize 160 \
-fill none -stroke white -strokewidth 10 \
-annotate +10+160 "お手軽簡単!" \
-fill none -stroke black -strokewidth 2 \
-annotate +10+160 "お手軽簡単!" \
-tile "gradient:red-orange" \
-annotate +10+160 "お手軽簡単!" \
output.png

グラデーションな色で塗りつぶした縁取り極太テキスト画像

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

最後に、不要なまわりの透明部分を取り除きます。


magick -size 2000x200 xc:none \
-font LINE-Seed-JP_OTF-ExtraBold \
-pointsize 160 \
-fill none -stroke white -strokewidth 10 \
-annotate +10+160 "お手軽簡単!" \
-fill none -stroke black -strokewidth 2 \
-annotate +10+160 "お手軽簡単!" \
-tile "gradient:red-orange" \
-annotate +10+160 "お手軽簡単!" \
-trim \
output.png

グラデーションな色で塗りつぶした縁取り極太テキスト画像って使えるよな

 

🖌️ まとめ

変更になりそうなパラメータは引数にしておきます。

あと実行後は、プレビューで開いてすぐ確認できるようにしておきます。



お好みの各引数は選択肢として ショートカットにしておけばターミナルを使う必要もない。

それなりのデザイン的なアプリで作るのもいいですが、ササっと作りたい人はどうぞ。