-
Linux樹林
[Linux] Moving and Renaming Files with the mv Command
Overview The mv (move) command is used to change the location of files and directories or to rename them. In Linux, renaming a file and moving it to a different path are fundamentally the same operation within the file system; therefore,... -
Linux樹林
【Linux】mvコマンドでファイルの移動と名前変更を行う
概要 mv(move)コマンドは、ファイルやディレクトリの場所を移動したり、名前を変更(リネーム)したりするためのコマンドです。 Linuxにおいては「場所を変えること」と「名前を変えること」はファイルシステム上では同質の操作として扱われるため、どち... -
Linux樹林
[Linux] Displaying the Current Working Directory Path with the pwd Command
Overview pwd (Print Working Directory) is a command that displays the "absolute path" of the directory you are currently working in. Linux directory structures can become deep and complex, and depending on terminal prompt settings, the c... -
Linux樹林
【Linux】pwdコマンドで現在の作業ディレクトリパスを表示する
概要 pwd(Print Working Directory)は、現在作業しているディレクトリの「絶対パス」を表示するコマンドです。 Linuxのディレクトリ構造は深く複雑になりがちで、ターミナルのプロンプト設定によっては現在の場所が省略表示(例: ~/.../src)されてしま... -
C#樹林
[C#] How to Specify Headers (Accept / Content-Type) in HttpClient
Overview When communicating with a Web API, you must inform the server about what data format you want to receive (Accept) and what format you are currently sending (Content-Type) via HTTP headers. In HttpClient, common request headers a... -
C#樹林
【C#】HttpClientでヘッダー(Accept / Content-Type)を指定する方法
概要 Web APIと通信する際、サーバーに対して「どのような形式のデータが欲しいか(Accept)」や「どのような形式のデータを送っているか(Content-Type)」をHTTPヘッダーで伝える必要があります。 HttpClient では、共通のヘッダーは DefaultRequestHead... -
C#樹林
[C#] Directly Converting JSON from a URL into an Object
Overview When retrieving data from a Web API, the traditional two-step process of "downloading as a string and then deserializing" can be shortened into a single step using the GetFromJsonAsync method. By utilizing System.Net.Http.Json, ... -
C#樹林
【C#】URLからJSONを取得して直接オブジェクトに変換する方法
概要 Web APIからデータを取得する際、従来の「文字列としてダウンロードしてからJSONデシリアライズを行う」という2段階の手順を、GetFromJsonAsync メソッドを使用することで1ステップに短縮できます。 .NET 5以降で標準化された System.Net.Http.Json ... -
C#樹林
[C#] Efficiently Downloading and Saving Files from the Web Without Consuming Memory
Overview This implementation uses HttpClient to download binary files such as images, PDFs, and ZIP files and save them to local storage. Instead of loading the entire dataset into memory using GetByteArrayAsync, we use GetStreamAsync an... -
C#樹林
【C#】Web上のファイルをメモリを圧迫せずにダウンロード・保存する方法
概要 HttpClient を使用して、画像、PDF、ZIPなどのバイナリファイルをダウンロードし、ローカルディスクに保存する実装です。 GetByteArrayAsync で全データをメモリに読み込むのではなく、GetStreamAsync と Stream.CopyToAsync を使用してストリームと... -
C#樹林
[C#] Asynchronously Retrieving Web Page HTML with HttpClient
Overview This is the most fundamental implementation for accessing a specified URL (web page) and retrieving the response body (HTML or text) as a string. By using the GetStringAsync method of System.Net.Http.HttpClient, you can complete... -
C#樹林
【C#】HttpClientでWebページのHTMLテキストを非同期に取得する
概要 指定したURL(Webページ)にアクセスし、レスポンスボディ(HTMLやテキスト)を文字列として取得する最も基本的な実装です。 System.Net.Http.HttpClient の GetStringAsync メソッドを使用することで、HTTP GETリクエストの発行から文字列への変換ま... -
C#樹林
[C#] Safely and Concisely Building URL Query Strings with Parameters
Overview When calling Web APIs, adding multiple query parameters (?key=value) to a base URL manually can become tedious. Managing separators (? and &) and ensuring proper URL encoding is error-prone. By using the QueryHelpers class i... -
C#樹林
【C#】パラメータ付きURLクエリ文字列を安全かつ簡潔に組み立てる方法
概要 Web APIの呼び出しなどで、ベースとなるURLに対して複数のクエリパラメータ(?key=value)を付与する際、手動で文字列連結を行うと区切り文字(? や &)の管理やURLエンコードの処理が煩雑になります。 Microsoft.AspNetCore.WebUtilities パッケ... -
C#樹林
[C#] Converting Between Objects and JSON (System.Text.Json)
Overview This article explains how to use the standard .NET library System.Text.Json to convert C# objects into JSON strings (serialization) and vice versa (deserialization). It covers practical settings such as preventing Unicode escapi... -
C#樹林
【C#】オブジェクトとJSONを相互変換する方法(System.Text.Json)
概要 .NET 標準ライブラリである System.Text.Json を使用して、C#のオブジェクトをJSON文字列に変換(シリアライズ)したり、その逆(デシリアライズ)を行ったりする方法です。 日本語を含む文字列の文字化け(Unicodeエスケープ)防止や、キャメルケー... -
C#樹林
[C#] Safely Handling HTML Special Characters with Encoding and Decoding
Overview HTML encoding is the process of converting special characters like < and > into a harmless format known as character entities (e.g., < and >). This is a critical security measure used to prevent Cross-Site Sc... -
C#樹林
【C#】URLで使用できない文字をエンコード(エスケープ)する方法
概要 日本語やスペース、特殊記号を含む文字列を URL のパラメータ(クエリ文字列)として安全に使用するために、パーセントエンコーディング(URLエンコード)を行う方法です。 .NET には複数のエンコードメソッドが存在しますが、現代の標準的な用途(RF... -
C#樹林
[C#] How to Safely Handle HTML Special Characters via Encoding and Decoding
Overview This process involves converting special characters such as < and > into a harmless format (character entities) when displaying user input on a web page. This is called escaping. It is used to prevent Cross-Site Scripting ... -
C#樹林
【C#】HTML特殊文字をエンコード・デコードして安全に扱う方法
概要 ユーザーからの入力テキストをWebページ等で表示する際、< や > などの特殊文字を無害な形式(実体参照)に変換(エスケープ)する処理です。 クロスサイトスクリプティング(XSS)攻撃を防いだり、HTMLタグとしての誤解釈による表示崩れを防ぐ... -
C#樹林
[C#] How to Log SQL Executed by EF Core to the Console
Overview This implementation allows you to visualize the SQL commands that Entity Framework Core (EF Core) executes in the background. This is useful for debugging and performance analysis. By using the LogTo method in the DbContext conf... -
C#樹林
【C#】EF Coreが実行するSQLをコンソールに出力して確認する方法
概要 Entity Framework Core (EF Core) が裏側でどのようなSQLを発行しているかを可視化し、デバッグやパフォーマンス分析を行うための実装です。 DbContext の設定で LogTo メソッドを使用し、標準出力(コンソール)にリアルタイムでクエリ情報を流しま... -
C#樹林
[C#] How to Set Command Timeout in Entity Framework Core
Overview This article explains how to set the waiting time (timeout) for Entity Framework Core (EF Core) when executing SQL against a database. By extending the timeout value, you can prevent intentional disconnections (TimeoutException)... -
Linux樹林
【C#】EF Coreでコマンドタイムアウト値を設定する方法
概要 Entity Framework Core (EF Core) がデータベースに対してSQLを実行する際の待機時間(タイムアウト)を設定する方法です。 デフォルト(通常30秒)よりも長い時間がかかる集計処理や一括更新処理を行う場合に、意図的な切断(TimeoutException)を防... -
Linux樹林
[Linux] Efficiently Changing Directories with the cd Command
Overview The cd (change directory) command is a shell built-in tool used to change your current working directory. The Linux file system is organized in a tree structure. To perform file operations or execute commands, you must be able t... -
Linux樹林
【Linux】cdコマンドで作業ディレクトリを効率的に移動する
概要 cd(change directory)は、現在作業している場所(カレントディレクトリ)を変更するためのシェル組み込みコマンドです。 Linuxのファイルシステムはツリー構造になっており、ファイル操作やコマンド実行を行うには、適切なディレクトリへの移動が不... -
Linux樹林
[Linux] Visualizing Directory Structures as a Tree with the tree Command
Overview The tree command is a tool that displays the hierarchical structure of files and subdirectories in a visual "tree" format. Unlike the recursive listing of ls -R, which can be hard to follow, tree allows you to understand the ent... -
Linux樹林
【Linux】treeコマンドでディレクトリ構造をツリー状に可視化する
概要 treeコマンドは、ディレクトリ内のファイルやサブディレクトリの階層構造を、視覚的な「木構造(ツリー)」として表示するツールです。 ls -Rなどの再帰的なリスト表示では把握しにくいフォルダの全体像や、ファイルの配置関係を一目で理解するのに役... -
Linux樹林
[Linux] List, Sort, and Filter Files Using the ls Command
Overview The ls (list segments) command is one of the most frequently used tools in Linux. It lists the files and subdirectories within a directory. Beyond just listing names, it allows you to check detailed information such as permissio... -
Linux樹林
【Linux】lsコマンドでファイル一覧を表示・ソート・フィルタリングする
概要 ls(list segments)は、ディレクトリ内のファイルやサブディレクトリの一覧を表示する、Linuxで最も頻繁に使用されるコマンドの一つです。 単に名前を列挙するだけでなく、ファイルの詳細情報(権限、所有者、サイズ、更新日時)を確認したり、表示...