C# INI

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Runtime.InteropServices;

namespace INI.IniFiles
{
/* 参考:INIファイルを読み書きするには?
* https://www.atmarkit.co.jp/fdotnet/dotnettips/039inifile/inifile.html
*/
class IniFiles
{
[DllImport("KERNEL32.DLL")]
private static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
uint nSize,
string lpFileName);

[DllImport("KERNEL32.DLL")]
private static extern uint GetPrivateProfileInt(
string lpAppName,
string lpKeyName,
int nDefault,
string lpFileName);

[DllImport("KERNEL32.DLL", EntryPoint = "GetPrivateProfileStringA")]
public static extern uint GetPrivateProfileStringByByteArray(
string lpAppName,
string lpKeyName,
string lpDefault,
byte[] lpReturnedString,
uint nSize,
string lpFileName
);

[DllImport("KERNEL32.DLL")]
private static extern uint WritePrivateProfileString(
string lpAppName,
string lpKeyName,
string lpString,
string lpFileName);

//*******************************************
// GetIniString
//
//*******************************************

///

<summary>
        /// INIファイルから値を取得する
/// </summary>        /// <param name="lpSection">セッション名称
        /// <param name="lpKeyName">キー名称
        /// <param name="lpFileName">INIファイル名
        /// <returns></returns>
public static string GetIniString(string lpSection, string lpKeyName, string lpFileName)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(1024);

uint sLen = GetPrivateProfileString(lpSection, lpKeyName, "", sb, (uint)sb.Capacity, lpFileName);

return sb.ToString();
}

//*******************************************
// GetPrivateProfileInt
//
//*******************************************

///

<summary>
        ///
/// </summary>        /// <param name="lpSection">
        /// <param name="lpKeyName">
        /// <param name="lpFileName">
        /// <returns></returns>
public static uint GetIniValue(string lpSection, string lpKeyName, string lpFileName)
{
// 整数値を読み出す
uint resultValue= GetPrivateProfileInt(lpSection, lpKeyName, 0, lpFileName);

return resultValue;
}

//*******************************************
// WritePrivateProfileString
//
//*******************************************

///

<summary>
        /// INIファイルに値を書き込む
/// </summary>        /// <param name="lpSection">セッション名称
        /// <param name="lpKeyName">キー名称
        /// <param name="lpValue">セットする値
        /// <param name="lpFileName">INIファイル名
        /// <returns></returns>
public static bool SetIniString(string lpSection, string lpKeyName, string lpValue, string lpFileName)
{
long result = WritePrivateProfileString(lpSection, lpKeyName, lpValue, lpFileName);
return result != 0;
}

///

<summary>
        ///
/// </summary>        /// <param name="lpSection">
        /// <param name="lpKeyName">
        /// <param name="lpFileName">
        public static void DelKeyAndData_pair(string lpSection, string lpKeyName, string lpFileName)
{
// 1つのキーと値のペアを削除する
WritePrivateProfileString(lpSection, lpKeyName, null, lpFileName);
}

///

<summary>
        ///
/// </summary>        /// <param name="lpSection">
        /// <param name="lpFileName">
        public static void DelKeyAndData_all(string lpSection, string lpFileName)
{
// 指定セクション内の全てのキーと値のペアを削除する
WritePrivateProfileString(lpSection, null, null, lpFileName);
}

//*******************************************
// GetPrivateProfileStringByByteArray
//
//*******************************************

///

<summary>
        /// キーリスト
/// </summary>        /// <param name="lpSection">
        /// <param name="lpFileName">
        /// <returns></returns>
public static string[] GetKeys(string lpSection, string lpFileName)
{

byte[] ar1 = new byte[1024];
uint resultSize1= GetPrivateProfileStringByByteArray(lpSection, null, "", ar1,(uint)ar1.Length, lpFileName);
string result1 = Encoding.Default.GetString(ar1, 0, (int)resultSize1 - 1);
string[] keys = result1.Split('\0');
return keys;

}

///

<summary>
        /// セクションの一覧
/// </summary>        /// <param name="lpFileName">
        /// <returns></returns>
public static string[] GeSections(string lpFileName)
{
// 指定ファイルのセクションの一覧を得る
byte[] ar2 = new byte[1024];
uint resultSize2 = GetPrivateProfileStringByByteArray(null, null, "", ar2, (uint)ar2.Length, lpFileName);
string result2 = System.Text.Encoding.Default.GetString(ar2, 0, (int)resultSize2 - 1);
string[] sections = result2.Split('\0');
return sections;
}
}
}

-------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace INI.IniFiles
{
class IniProc
{
public static void Proc()
{
string FilePath = @"C:\MyFile.ini";

//string s = IniFiles.GetIniString("Section1", "KEY1", FilePath);
IniFiles.SetIniString("Section1", "KEY1", "AAAA", FilePath);
IniFiles.SetIniString("Section1", "KEY2", "BBBB", FilePath);
IniFiles.SetIniString("Section1", "KEY3", "1", FilePath);
IniFiles.SetIniString("Section2", "KEY2", "AAAA", FilePath);
IniFiles.SetIniString("Section3", "KEY3", "AAAA", FilePath);

//-----------------------
// 文字列を読み出す
//-----------------------
StringBuilder sb = new StringBuilder(1024);
string sSection = "Section1";
string sKey = "KEY1";

string sRes = IniFiles.GetIniString(sSection, sKey, FilePath);

Console.WriteLine("{0}に含まれる{1}の数値: {2}", sSection,sKey, sRes);

//-----------------------
// 数値を読み出す
//-----------------------
sSection = "Section1";
sKey = "KEY3";

uint uiRes = IniFiles.GetIniValue(sSection, sKey, FilePath);
Console.WriteLine("{0}に含まれる{1}の値: {2}", sSection, sKey, uiRes);

//-----------------------
// Sectionリスト
//-----------------------
string[] sections = IniFiles.GeSections(FilePath);
foreach (string section in sections)
{
Console.WriteLine("このファイルに含まれるセクション名: {0}", section);
}
Console.WriteLine("");

//-----------------------
// keyリスト
//-----------------------
sSection = "Section1";
string[] keys = IniFiles.GetKeys(sSection, FilePath);
foreach (string key in keys)
{
Console.WriteLine(
"{0}セクションに含まれるキー名: {1}", sSection,key);
}
Console.WriteLine("");

}
}
}

Excel SQL

http://mukaer.com/archives/2010/10/17/excelsqlvlookup/
http://yizndev.blogspot.jp/2015/01/excel-sql.html
https://qiita.com/acknpop/items/cd4a6fe32bf6af409aa3

Const oRow = 2     'OutPutCellRow
Const oColumn = 1  'OutPutCellColumn
Const SQLCell = "B1"

Sub ESQL()
    
    Dim sql
    Dim str

    'SQL(B1セル)
    sql = Range(SQLCell).Value

    'ツール → 参照設定 →
    ' Microsoft ActiveX Data Objects 2.8 Library
    'チェック
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim xl_file As String

    xl_file = ThisWorkbook.FullName '他のブックを指定しても良し

    Set cn = New ADODB.Connection
    
    cn.Provider = "MSDASQL"
    cn.ConnectionString _
        = "Driver={Microsoft Excel Driver (*.xls)};" _
            & "DBQ=" & xl_file & "; ReadOnly=False;"
    cn.Open

    
    Set rs = New ADODB.Recordset

    rs.Open sql, cn, adOpenStatic
    
    
    'フィールドNAME表示
    For i = 0 To rs.Fields.Count - 1
        Cells(oRow, i + 1).Value = rs(i).Name
    Next
    
    'カラム表示
    j = oRow + 1
    Do Until rs.EOF
      '1 レコード毎の処理
        
        For i = 0 To rs.Fields.Count - 1
            Cells(j, i + 1).Value = rs(i).Value
        Next

        j = j + 1
        rs.MoveNext
    Loop


    rs.Close
    cn.Close

End Sub

Sub ClearCells()

    Dim lRow    'LastCellRow
    Dim lColumn 'LastCellColumn

    lRow = Cells(oRow, oColumn).End(xlDown).Row
    lColumn = Cells(oRow, oColumn).End(xlToRight).Column


    '文字クリア
    ActiveSheet.Range(Cells(oRow, oColumn), Cells(lRow, lColumn)).ClearContents


End Sub

用語:CXX

officer:役員

【CEO : Chief exective officer 】
 最高経営責任者

【CAO : Chief accounting officer 】
  最高会計責任者
【CAO : Chief administrative officer 】
  最高総務責任者

【CIO : Chief Infomation officer 】
  最高情報責任者

【CTO : Chief Technical officer 】
  最高技術責任者
【CTO : Chief Technology officer 】
  最高技術責任者

【CFO : Chief Financial officer 】
  最高財務責任者

プロセス、スレッド、タスク

【プロセス】
 実行単位(.exe)

【スレッド】
 プロセス内部
 例)A,Bのプロセスの場合
  ・CPU:シングル/スレッド:シングル
     [  A  ][  B  ]

  ・CPU:シングル/スレッド:マルチ
     [A][B][A][B][A][B][A][B]

  ・CPU:マルチ/スレッド:マルチ
     [  A  ]      [  B  ]

【タスク】
 OSから見た処理単位
 参考:イケてるエンジニアになろうシリーズ 〜メモリとプロセスとスレッド編〜 – もろ …

用語

【 CAT : computer aided testing 】
コンピュータを応用した製品検査

【 ICT : Infomation and Communication Technology 】

【 CSR : Corporate social responsibility 】

【 コンプライアンス : compliance 】
遵守

【 パンデミック : pandemic 】
 感染症が世界規模で同時に流行すること

【 AR : Augment Reality 】
 拡張現実
 ありのままに知覚される情報に、
 デジタル合成などによって作成された情報を付加し、
 人間の現実認識を強化する技術

【 TBD : To Be Datermind 】

【 HMD : Head Mounted Display 】

【 NPI : New Product Introduction 】
 新製品立ち上げ

【 PDI : Pre Derivery Inspection 】
 事前納品検査
 (綿密な)調査、検査

【 EMS : Electronics Manufactureing Service 】
 電子機器受託生産
 ・【 OEM : Original Equipment Manufacture 】
    設計は、発注元。生産のみ行う形態
 ・【 ODM : Original Design Manufacture 】
    設計、生産の両方を行う形態

【 JDM : Joint Design Manufacture 】
 共同開発製造

【 リテラシー : literacy 】
 読み書き能力
 与えられた材料から必要な情報を引き出す
 ・【 コンピューターリテラシー 】
    コンピュータについての知識、能力
 ・【 情報リテラシー 】
    情報機器を利用して膨大な情報の中から
    必要な情報を抜き出し活用する能力

IE:Webページ保存

「ツール」「インターネットオプション」「セキュリティ」「レベルのカスタマイズ」
・アクティブスクリプト [●]無効にする

ショートカット

【セルコピー】
 上セル:ctrl + D (Downにコピー)
 左セル:ctrl + R (Rightにコピー)

【複数セルに同時入力】
 ctrl + Ent

セルのサイズ

高さ・・・標準フォント+α
幅・・・標準フォントで表示できる文字数

cm換算
 1point 1/72インチ(1インチ=2.54cm)
= 2.54/72 cm
= 0.03528 cm

・高さ 1cm
 1cm/0.03528(cm/point) = 28.3point

・幅 1cm
 サイズ11(11point)の場合
 0.03528 x 11 = 0.39cm/文字
1cm/0.39(cm/文字) = 2.57文字