2020-01-01から1年間の記事一覧

Download file is blocked on IE11 and Chrome

Environment Windows 10 version 1903 build 18362.900 IE 11.900.18362.0 Chrome 83.0.4103.116 Issue IE11 shows error "Your current security settings do not allow this file to be donwloaded." when download a file. Chrome shows error "Failed - …

IE11とChromeでファイルをダウンロードできない

環境 Windows 10 version 1903 build 18362.900 IE 11.900.18362.0 Chrome 83.0.4103.116 症状 IE11でファイルをダウンロードすると「現在のセキュリティ設定では、このファイルをダウンロードできません。」というエラーが表示される。 Chromeでファイルを…

keyboard not working correctly with Synergy client on macOS

Environment Synergy 1.11-stable-55ec3105 Synergy server: Windows 10 version 1903 build 18362.900 Synergy client: macOS 10.14.6 (18G1012) Problem Following problems occurred on macOS with Synergy client. Cursor key and Function key is OK. B…

macOSでSynergyクライアントを動作させた際にキーボードの入力ができない

環境 Synergy 1.11-stable-55ec3105 Synergyサーバ: Windows 10 version 1903 build 18362.900 Synergyクライアント: macOS 10.14.6 (18G1012) 症状 Synergyクライアントを動作させているmacOSで以下の症状が発生する。 マウスは正常に動作する。 カーソルキ…

Check the string is exist or not in a file and use it in the Windows Batch file

Summary Do something in the Windows Batch file depend on that some string is exist or not in a file. Batch file We'll find string "sample" in the file sample.txt. @echo off find "sample" sample.txt echo ERRORLEVEL=%ERRORLEVEL% if %ERRORLEV…

バッチファイル: ファイル内の特定の文字列が存在するかどうかチェックする

概要 Windowsのバッチファイルで指定したファイル内に特定の文字列が存在するかどうかチェックし、処理を分ける。 バッチファイル サンプルファイルsample.txtから文字列"サンプル"を検索する。 @echo off find "サンプル" sample.txt echo ERRORLEVEL=%ERRO…

Xamarin: XMLの書き出し

概要 XamarinでSystem.Xml.XmlDocumentを使用してXMLの書き出しを行う。 docs.microsoft.com サンプルコード void TestWriteXmlDocument() { // XMLの生成 XmlDocument doc = new XmlDocument(); XmlElement bookElement1 = doc.CreateElement("book"); XmlE…

Xamarin: XMLのパース

概要 XamarinでSystem.Xml.XmlDocumentを使用してXMLのパースを行う。 docs.microsoft.com サンプルXML テスト用に以下のXMLファイルをリソースIDXamarinTest.SampleXmlFile.xmlでプロジェクト内に追加する。 参照: www.wired-cat.com <books xmlns = "http://www.contoso.com/books" > </books>

Xamarin: HTTP POSTリクエスト

概要 XamarinでSystem.Net.Http.HttpClientを使用してHTTPのPOSTリクエストを行う。 docs.microsoft.com サンプルコード static readonly HttpClient client = new HttpClient(); private static async Task HttpRequestPostAsync() { Dictionary<string, string> parameters</string,>…

Get a string from other file and use it for the variable in your Windows Batch file

Summary Get a string from other file and use if for the variable in your Windows Batch file. In this example, we'll get application version number string from build.gradle file that used for Android application development. Sample build.gr…

Xamarin: AndroidでHTTPリクエストを行うと"Java.IO.IOException: Cleartext HTTP traffic to XXX not permitted"エラー

概要 Android 9以上を対象したアプリでHTTP通信を行うと発生するエラーの対応方法。 詳細 Androidの"対象Androidバージョン"を9.0(API level 28)以上にした場合、HTTPリクエストを行うと以下のエラーが発生する。 Java.IO.IOException: Cleartext HTTP traff…

Xamarin: iOSでHTTPリクエストを行うと"App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file."エラー

概要 iOS 9以上ではApp Transport Securityの導入により、HTTPリクエストを実行するとエラーが発生する。その対応。 Info.plistの設定変更 <プロジェクト名>.iOS以下にあるInfo.plistを開き、以下の設定を追加する。 NSAppTransportSecurityについては以下を…

Xamarin: エラー"System.NotSupportedException: Encoding 932 data could not be found. Make sure you have correct international codeset assembly installed and enabled."

概要 System.Net.Http.HttpContent.ReadAsStringAsync()メソッドを使用した際に以下のエラーが発生した場合の対応方法。 System.NotSupportedException: Encoding 932 data could not be found. Make sure you have correct international codeset assembly …

バッチファイル内で別ファイルからバージョン番号を取得して変数として使用する

概要 バッチファイル内で使用する変数として、別ファイル内に書かれているバージョン番号を取得して使用する。 以下ではAndroidアプリ開発で使用するbuild.gradleファイル内からバージョン番号を取得する。 build.gradleファイル 以下のversionName "1.0.0"…

Xamarin: HTTP GETリクエスト

概要 XamarinでSystem.Net.Http.HttpClientを使用してHTTPのGETリクエストを行う。 docs.microsoft.com サンプルコード static readonly HttpClient client = new HttpClient(); // A) async void OnButtonClicked(System.Object sender, System.EventArgs e…

Xamarin: ファイル読み書き

概要 ファイルの読み書きを行う。 サンプルコード System.IO.Fileクラスを使用する。 public MainPage() { InitializeComponent(); // サンプルファイルパスの取得 String documentDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);…

How to deal with out of memory problem while create thumbnail by PDFKit

iOS

Summary PDFKit has a method thumbnailOfSize: for create thumbnail but when you create thumbnail of all page by this method, memory consumption is increasing and it's cause of app crash. Solution You have to release PDFDocument instance tha…

Add any files in your iOS application bundle and use it in the app.

iOS

Outline You can add any files in your iOS application at build phase and use it in the app. Add files Add any files to your Xcode project. The following example add text file sample.txt. When you add files to the Xcode project, Xcode add t…

iOS版PDFKitでメモリ消費を押さえながらサムネイルを生成する

iOS

概要 iOS版PDFKitではPDFPageクラスにサムネイル生成用のメソッドthumbnailOfSize:が用意されている。このメソッドを使用して全ページのサムネイル画像を生成していくと、PDFによってはメモリ消費量がどんどん増加していき、アプリがクラッシュする。 解決策…

iOSアプリ内に埋め込んだファイルをプログラムから利用する

iOS

概要 アプリ内に任意のファイルを埋め込んでおき、プログラムからそのファイルにアクセスして利用する。 ファイルの追加 Xcodeプロジェクト内にファイルを追加する。以下ではテキストファイルsample.txtを追加している。 ファイルを追加すると、自動的にプロ…

Xamarin: 無料のAppleアカウントで実機iOSデバイスにアプリをインストールする

概要 Apple Developer Program(年間11,800円)に登録せずに無料のAppleアカウントで実機のiOSデバイスにアプリをインストールする。 手順 Xamarinプロジェクトを作成する。 通常通り、Xamarinプロジェクトを作成します。以下ではアプリケーションIDがcom.comp…

Xamarin: ログ出力

概要 XamarinのiOS, Androidアプリでログ出力する方法。 OS共通のAPI デバッグ用ビルドの場合のみ出力するAPI。 System.Diagnostics.Debug.WriteLine("System.Diagnostics.Debug.WriteLine"); デバッグ用とリリース用ビルドで出力するAPI。 System.Diagnosti…

Xamarin: ファイルパスの取得

概要 iOS, Androidのシステムディレクトリを取得する。 iOS, Android共通のAPI Xamarin.Essentials.FileSystem及びSystem.Environment.SpecialFolderを使用することができる。 サンプルコード System.Console.WriteLine("FileSystem.CacheDirectory=" + File…

Xamarin: JSONのエンコード、デコード

概要 XamarinでJSONのエンコード、デコードを行う。 依存関係 NuGetでSystem.Text.JSONを追加する必要があります。 *System.Text.JSONについては以下に説明があります。 docs.microsoft.com サンプルコード public MainPage() { InitializeComponent(); Stri…

Xamarin: プロジェクト内のリソースファイルを読み込む

概要 プロジェクト内に任意のファイルを配置し、それをアプリ内で読み込んで使用する。 プロジェクト内に任意のファイルを追加 プロジェクト内に任意のファイルを追加する。 *以下ではSampleText.txtを追加している。 追加したファイルのプロパティを開き、…

Amazon RDS: How to resolve problem that slow query log is stop on the Cloud Watch

AWS

Problem Amazon RDS can output slow query log to Cloud Watch. The cause is unclear but this log is sometimes stop. You can check log is working correctly by SQL below. select sleep(5); *The argument value of the sleep function (5 in above e…

Amazon RDS: スロークエリのログが出力されなくなった時の対応方法

AWS

症状 Amazon RDSではCloud Watchにスロークエリのログを出力することができる。 原因は分からないが、このスロークエリのログが出力されなくなってしまう場合がある。スロークエリが正常に出力されているかどうかは、以下のSQLを実行して確認できる。 select…

How to detect Chrome on iOS by JavaScript when "Request Desktop Site" setting is enabled.

Problem When the setting of "Request Desktop Site" of Chrome on iPhone is enabled, navigator value is changed that not include text CriOS. So you cannot detect browser is Chrome by JavaScript. *This problem and solution is checked on Chrom…

iOS版Chromeで「PC版サイトを見る」を有効にしている場合にJavaScriptでChromeであることを検知する

問題 iPhone版Chromeでは設定で「PC版サイトを見る」を有効にした場合、navigatorで取得できる情報が変化し、CriOSが含まれなくなるのでChromeであることが分からなくなる。 *Chrome 80.0.3987.95で確認。 iPhoneで取得可能なユーザーエージェント iPhone版C…

SQLite3: How to know transaction is already started

You can use get_autocommit() to know transaction is already started or not. When transaction is started: This function return 0 because auto-commit is disabled. When transaction is not started: This function return non-0 because auto-commi…