mori– Author –
-
C#樹林
[C#]Generating Unique Identifiers (GUID)
Overview This article explains how to generate a GUID (Globally Unique Identifier), which is used when unique values are needed, such as for database primary keys, temporary filenames, or session IDs. By using the standard .NET Guid.NewG... -
C#樹林
【C#】ユニークな識別子(GUID)を生成する
概要 データベースの主キー、一時ファイル名、セッションIDなど、重複しない一意な値が必要な場合に利用される GUID (Globally Unique Identifier) を生成する方法です。 .NET標準の Guid.NewGuid() メソッドを使用することで、バージョン4(ランダムベー... -
C#樹林
[C#] Setting and Deleting Environment Variables Dynamically within a Running Process
Overview This article explains how to dynamically add, change, or delete environment variables that are valid only within the current process during application execution. By using the Environment.SetEnvironmentVariable method, you can i... -
C#樹林
【C#】実行中のプロセス内で環境変数を一時的に設定・削除する
概要 アプリケーションの実行中に、そのプロセス内でのみ有効な環境変数を動的に追加、変更、または削除する方法です。 Environment.SetEnvironmentVariable メソッドを使用することで、外部ライブラリの設定値をコードから注入したり、テスト実行時のみ挙... -
C#樹林
[C#] Managing External Configuration and Handling OS Differences Using Environment Variables
Overview This article explains how to retrieve environment variables to manage application configuration information (such as API keys and database connection strings) separately from your source code. By using System.Environment.GetEnvi... -
C#樹林
【C#】環境変数を活用して設定情報を外部化し、OS間の差異を吸収する実装手法
概要 アプリケーションの構成情報(APIキー、DB接続文字列など)をソースコードから分離して管理するための、環境変数の取得方法を解説します。 System.Environment.GetEnvironmentVariable を使用することで、Windows/Linux/macOSといった異なるプラット... -
C#樹林
Optimizing Parallel Processing by Getting the Number of Logical Processors in C#
Overview This article explains how to get the number of logical processors (logical cores) on the machine where your application is running. This information is used to optimize the degree of parallelism (number of threads) based on hard... -
C#樹林
【C#】論理プロセッサ数を取得して並列処理を最適化する
概要 実行環境のマシンが搭載している論理プロセッサ(論理コア)の数を取得する方法です。 Parallel.ForEach や PLINQ などで並列処理を行う際、ハードウェアのリソースに合わせて並列度(スレッド数)を最適化するために利用されます。 仕様(入出力) ... -
C#樹林
[C#]Getting OS Version and Platform Information of the Running Environment
Overview This article explains how to obtain information about the Operating System (OS) type and version where your application is currently running. By using the standard System.Environment class, you can identify platforms such as Win... -
C#樹林
【C#】実行中のOSバージョンやプラットフォーム情報を取得する
概要 アプリケーションが現在実行されているオペレーティングシステム(OS)の種類やバージョン情報を取得する方法です。 標準の System.Environment クラスを使用することで、Windows、Linux、macOSなどのプラットフォーム判別や、詳細なバージョン番号(... -
C#樹林
[C#]Getting Caller Method Name, File Path, and Line Number
Overview This implementation allows you to identify "where" and "by whom" a method was called within your program. By using .NET's standard Caller Information Attributes, you can automatically receive source code information about the ca... -
C#樹林
【C#】呼び出し元のメソッド名・ファイルパス・行番号を取得する
概要 メソッドが「どこから」「誰によって」呼び出されたかをプログラム内で特定する実装です。 .NET標準の Caller Information Attributes(呼び出し元情報属性)を使用することで、ログ出力やデバッグ時に、呼び出し元のソースコード情報を引数として自... -
C#樹林
[C#]Converting and Formatting Byte Arrays to Hexadecimal Strings
Overview This implementation converts binary data (byte[]) into readable hexadecimal strings, which is useful for debugging logs or displaying hash values (MD5/SHA256). It covers both direct conversion using standard .NET methods and for... -
C#樹林
【C#】byte配列を16進数文字列(Hex)へ変換・整形出力する
概要 デバッグ時のログ出力や、ハッシュ値(MD5/SHA256)の表示などで、バイナリデータ(byte[])を可読性のある16進数文字列に変換する実装です。 .NETの標準メソッドを使用した一括変換と、可読性を高めるための整形出力(スペース区切りや改行)の両方... -
C#樹林
[C#] Proper Handling of Base64 Conversion and Encoding for Text Data
Overview To convert text data into Base64 format, you must first convert the text into a byte array. This article explains the implementation pattern for correctly converting between strings and Base64 by combining System.Text.Encoding a... -
C#樹林
【C#】テキストデータのBase64変換処理とEncodingの正しい扱い方
概要 テキストデータをBase64形式に変換するためには、一度バイト配列を経由する必要があります。 本記事では、System.Text.Encoding と System.Convert を組み合わせ、文字列とBase64を正しく相互変換する実装パターンを解説します。 仕様(入出力) 入力... -
C#樹林
[C#] Converting Between Byte Arrays and Base64 Strings
Overview This article explains how to implement Base64 encoding, which is essential for handling binary data (such as images, PDFs, or encrypted keys) in text formats like JSON or HTTP headers. By using the standard System.Convert class,... -
C#樹林
【C#】byte配列とBase64文字列を相互に変換する
概要 バイナリデータ(画像、PDF、暗号化されたキーなど)をJSONやHTTPヘッダーなどのテキスト形式で扱う際に必須となる、Base64エンコーディング処理の実装方法です。 標準ライブラリの System.Convert クラスを使用し、バイト配列とBase64文字列の相互変... -
Linux樹林
[Linux] Bundle and Encrypt Files with the zip Command
Overview The zip command is used to compress and archive files into the ZIP format. This format is highly compatible and is the standard for exchanging data with Windows environments. It allows you to combine multiple files into one whil... -
Linux樹林
【Linux】zipコマンドで複数のファイルをまとめて圧縮・暗号化する
概要 Windows環境などとのデータ受け渡しにおいて、最も互換性が高く標準的に利用される「ZIP形式」でファイルを圧縮・アーカイブするためのコマンドです。 ディレクトリ構造を保ったまま複数のファイルを一つにまとめたり、パスワードをかけて簡易的なセ... -
Linux樹林
[Linux] High Compression and Extraction with the bzip2 and bunzip2 Commands
Overview The bzip2 command uses the "Burrows-Wheeler Transform" algorithm to compress (encode) and decompress (decode) files. While it is slower than the standard gzip command, it offers a higher compression ratio. Compressed files typic... -
Linux樹林
【Linux】bzip2/bunzip2コマンドでファイルを高圧縮・展開する
概要 ファイルを「Burrows-Wheeler変換」というアルゴリズムを用いて圧縮(エンコード)・展開(デコード)するコマンドです。 Linux標準の圧縮形式としては、gzipよりも処理速度は劣りますが、より高い圧縮率を実現できるのが特徴です。拡張子には一般的... -
Linux樹林
[Linux] Compress and Decompress Files with the gzip and gunzip Commands
Overview The gzip and gunzip commands are the standard tools for handling the .gz file format in Linux. gzip is used to compress files, and gunzip is used to decompress (extract) them. It is important to note that unlike the ZIP format i... -
Linux樹林
【Linux】gzip/gunzipコマンドでファイルを圧縮・展開する
概要 Linuxで最も標準的に利用されるファイル圧縮形式「.gz」を作成、および展開するためのコマンドです。 gzip はファイルを圧縮し、gunzip は展開(解凍)を行います。 注意点として、WindowsのZIP形式などとは異なり、このコマンド単体では「複数のファ... -
Linux樹林
[Linux] Create, Compress, and Extract Archives with the tar Command
Overview The tar command is used to bundle multiple files or directories into a single file called an "archive," or to extract files from such an archive. The name comes from "Tape ARchive," but today it is the standard tool in Linux for... -
Linux樹林
【Linux】tarコマンドでアーカイブの作成・圧縮・展開を行う
概要 複数のファイルやディレクトリを1つのファイル(アーカイブ)にまとめたり、そこから元のファイルを取り出したりするためのコマンドです。 「Tape ARchive」に由来しますが、現在はテープだけでなくバックアップファイルの作成や、ソースコードの配布... -
Linux樹林
[Linux] Encode and Decode Data with the base64 Command
Overview The base64 command is used to convert binary or text data into Base64 format—a string consisting of only 64 types of alphanumeric characters and symbols—and to decode that data back to its original form. This command is the stan... -
Linux樹林
【Linux】base64コマンドでデータをエンコード・デコードする
概要 バイナリデータやテキストデータを、Base64形式(64種類の英数字と記号のみで構成される文字列)に変換(エンコード)したり、逆に元のデータに戻したり(デコード)するためのコマンドです。 メールへのファイル添付、Web APIでのデータ送受信、Basi... -
Linux樹林
[Linux] Convert Binary Files to Text and Back with uuencode/uudecode
Overview These commands allow you to convert binary files (such as images, executables, or compressed archives) into an "ASCII text format" that can be pasted into email bodies or text-based forums. You can then use the corresponding com... -
Linux樹林
【Linux】uuencode/uudecodeでバイナリファイルをテキスト変換・復元する
概要 バイナリファイル(画像、実行ファイル、圧縮アーカイブなど)を、メール本文やテキスト掲示板などに貼り付けられる「ASCIIテキスト形式」に変換(エンコード)し、それを元のバイナリに戻す(デコード)ためのコマンド群です。 現在では base64 コマ...