2021年12月26日日曜日

Excle,Access Mysql 接続手順

Excle,Access Mysql 接続手順


Sub sql()

    Dim cn As New ADODB.Connection

    cn.ConnectionString = "Driver={MySQL ODBC 8.0 Unicode Driver};" & _

                          "Server=localhost;" & _

                          "Database=mysql;" & _

                          "User=root;" & _

                          "Password=toor"

    cn.Open

    Dim rn As New ADODB.Recordset

    rn.Open "select User,Host from mysql.user", cn

    Do Until rn.EOF

        Debug.Print rn("Host"), rn("User")

        Debug.Print rn!host, rn!user

        rn.MoveNext

    Loop

    rn.Close

    cn.Close

End Sub


その2

Sub samp2()

   Dim cn As New ADODB.Connection

    cn.Open "DRIVER={MySQL ODBC 8.0 Unicode Driver};Server=localhost;Database=mysql;User=root;Password=toor"

    Dim rn As New ADODB.Recordset

    Set rn = cn.Execute("select * from mysql.user")

    Do Until rn.EOF

        Debug.Print rn!host, rn!User

        rn.MoveNext

    Loop

    Debug.Print "samp2"

    rn.Close

    cn.Close

End Sub




2021年3月20日土曜日

MySQL 利用

mysql 利用

mysql ダウンロード

mysql-8.0.23-winx64.zip

初期化

mysqld --initialize

or

mysqld -I

サービス登録

mysqld --install MYSQL80

mysqld --remove MYSQL80

サービス起動

NET START MYSQL80

初期パスワード下記のファイルにある

C:\mysql864\data\DESKTOP30c.err

[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: !i0i1<%P_<hu

パスワード変更

SET PASSWORD = 'toor'

php.ini

extension=mysqli

extension=sqlite3

extension_dir = "ext"

MySQLの使い方

https://www.dbonline.jp/mysql/

%HOMEPATH%\\Desktop\php8\php -S 192.168.11.110:80 -t %HOMEPATH%\Desktop\eiloto

2021年3月19日金曜日

Windows での OpenSSH

Windows での OpenSSH

sshd.exe。リモートで管理されるシステム上で実行されている必要がある SSH サーバー コンポーネントです。

例 net start sshd

ssh.exe: ユーザーのローカル システム上で実行される SSH クライアント コンポーネントです

ssh-keygen.exe: SSH 用の認証キーを生成、管理、および変換します

ssh-agent.exe: 公開キーの認証に使用される秘密キーを格納します

ssh-add.exe: サーバーで許可される一覧に秘密キーを追加します

ssh-keyscan.exe: 複数のホストから公開 SSH ホスト キーを収集するのに役立ちます

sftp.exe: セキュア ファイル転送プロトコルを提供し、SSH 経由で実行されます

例 sftp pi@192.168.3.3

scp.exe: SSH で実行されるファイル コピー ユーティリティです

例 scp G20210318.mp4 pi@192.168.3.3:\var/www/html/qq/temp

例 >scp pi@192.168.3.3:\var\..\temp\G20210318.mp4 c:\users\nuc\desktop


end

2021年3月6日土曜日

phpでWebServerを動かす方法

php -S 192.168.11.113:8080 -t ../memo

 -S <addr>:<port> Run with built-in web server.

 -t <docroot>     Specify document root <docroot> for built-in web server.


PHP 8.0.2 (cli) (built: Feb  3 2021 18:36:40) ( ZTS Visual C++ 2019 x64 )

Copyright (c) The PHP Group

Zend Engine v4.0.2, Copyright (c) Zend Technologies

Google-code-prettify

Google-code-prettify

 <script src='https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=sunburst'/>


<pre class="prettyprint">

ここにコードを書く

</pre>


//

function T_Searchfom(arrayVal) {
    // arrayVal 指定した値が含まれるまで探し
    // clearInterval(W_T_Searchfom);
    const TAG = 'T_Searchfom->';
    let tempArr = arrayVal.concat();
    if (typeof (W_T_Searchfom) == 'number') {
        clearInterval(W_T_Searchfom);
    }
    W_T_Searchfom = setInterval(function () {
        let cont = 0;
        but[0].click();
        var temp = gnum();
        tempArr.forEach(function (e) {
            if (temp.indexOf(e) >= 0) {
                cont++;
            }
        })
        console.info(TAG, ' clearInterval(W_T_Searchfom)  ' + arrayVal.toString());
        if (cont == arrayVal.length) {
            clearInterval(W_T_Searchfom);
            console.info(TAG, temp);
            console.info(TAG, ' T_cpt2([' + temp + ',57,0])  ');
        }
    }, 200)
}
//


2021年3月3日水曜日

fetch() Ajax

// XMLHttpRequest()
function F_httprequest() {
    let req = new XMLHttpRequest();
    let url = '/' + CSVFile + '?key=' + Math.floor(Math.random() * (1 - 100) + 100);
    req.onreadystatechange = function () {
        if (req.readyState == 4 && req.status == 200) {
            let ajaxText = req.responseText;
            F_create_master(ajaxText);
            F_read_ajax(ajaxText);
        }
    }
    req.open("GET", url, true);
    req.send(null);
}

// fetch()
async function testFetch() {
    let pim = fetch('/' + CSVFile + '?key=' + Math.floor(Math.random() * (1 - 100) + 100));
    pim.then(function (msg) {
        msg.text().then(function (ajaxText) {
            console.log(TAGLine, 'step1');
            F_create_master(ajaxText);
            F_read_ajax(ajaxText);
        }).then(function () {
            console.log(TAGLine, 'step2');
        }).catch(function () {
            console.log(TAGLine, 'catch');
        })
    }).catch(function (e) {
        console.log(TAGLine, 'URLerror');
        console.log(e);
    })
}

// fetch() async await
async function testFetch() {
    let url = '/' + CSVFile + '?key=' + Math.floor(Math.random() * (1 - 100) + 100);
    let opt = {
        method: 'GET',
        headers: {
            // "Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
        },
        // body: 'key=8080',
    };
    try {
        let pri = await fetch(url, opt);
        pri.headers.forEach(function (value, key) {
            console.log(key, value);
            // content - length 20949
            // content-type text/csv
            // date Fri, 05 Mar 2021 17:36:09 GMT
            // last-modified Fri, 05 Mar 2021 16:02:52 GMT
            // server SimpleHTTP/0.6 Python/3.9.0
        })
        let csvt = await pri.text();
        F_create_master(csvt);
        F_read_ajax(csvt);
    } catch (error) {
        console.log('error');
    }
}

2020年9月27日日曜日

JavaScript 気になるメソッド .reverse() .concat()

JavaScript  気になるメソッド
Array.reverse() 
reverse メソッドは呼び出した配列オブジェクトの要素をその内部で反転させ、配列を書き換えます。そして、書き換えられた配列を戻します。

Array.concat()
新しい配列に連結する配列や値です。すべての valueN 引数が省略された場合、 concat は呼び出された既存の配列のシャローコピーを返します。詳しくは下記の解説をお読みください。

例 値渡しの感じ
console.log('fns7(  [' + tx7 + ']  )' );
console.log('fns7(  [' + tx7.concat().sort((a, b) => a - b) + ']  )' );


https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/concat


end

2020年2月13日木曜日

VisualStudioCodeでのコード整形 Shift + alt + f

VisualStudioCodeでのコード整形 Shift + alt + f
sublime SublimeAStyleFormatter コード整形 Ctrl+ alt + f

C++ 始まり

MinGW
http://www.mingw.org/



end


2019年11月23日土曜日

PythonでWebServerを動かす方法

PythonでWebServerを動かす方法

python -m http.server --bind 192.168.11.111

python -m http.server --bind 192.168.11.111 --directory C:\FFmpeg

python -m http.server 80 --bind 192.168.11.111 --directory C:\FFmpeg

downloads
https://www.python.org/downloads/release/python-380/

2019年11月7日木曜日

chrome コマンドの一覧を表示する方法

about:about

一覧画面はアドレスバーに
about:about
と入力すると確認できます。

パソコンに接続されている従来のプリンタを Google クラウド プリントに追加できます。
chrome://devices/

2019年10月20日日曜日

在前台运行服务

在前台运行服务

https://developer.android.com/guide/components/services#Foreground

Intent notificationIntent = new Intent(this, ExampleActivity.class);
PendingIntent pendingIntent =
        PendingIntent.getActivity(this, 0, notificationIntent, 0);

Notification notification =
          new Notification.Builder(this, CHANNEL_DEFAULT_IMPORTANCE)
    .setContentTitle(getText(R.string.notification_title))
    .setContentText(getText(R.string.notification_message))
    .setSmallIcon(R.drawable.icon)
    .setContentIntent(pendingIntent)
    .setTicker(getText(R.string.ticker_text))
    .build();

startForeground(ONGOING_NOTIFICATION_ID, notification);

2019年10月8日火曜日

网络安全配置

网络安全配置

https://developer.android.com/training/articles/security-config


NetworkSecurityConfig: No Network Security Config specified, using platform default

res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">ekidata.jp</domain>
    </domain-config>
</network-security-config>


<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
     <application android:networkSecurityConfig="@xml/network_security_config"
                        ... >
            ...
    </application>
</manifest>
   




2019年9月1日日曜日

android 音声の周波数を作成

android 音声の周波数を作成

byte b = (byte)(Math.sin(bufferIndex/2*Math.PI(SamplingRate /Frequency))

角度 =bufferIndex /2*Math.PI(4400/800);
byte値(音声のビット、B辺) = (byte) (Math.sin(temp) * 120(C辺);

    private void hz() {
        byte[] bs = new byte[44100];
        Double temp;
        for (int i = 0; i < bs.length; i++) {
            temp = i / 2 * Math.PI / (44100 / Double.parseDouble("800"));
            bs[i] = (byte) (Math.sin(temp) * 120);
        }
        audioTrack.play();
        while (true) {
            audioTrack.write(bs, 0, bs.length);
        }
    }


    private void hz() {
        byte[] bs = new byte[44100];
        Double temp;
        for (int i = 0; i < bs.length; i++) {
            temp = i / 2 * Math.PI / (44100 / Double.parseDouble("800"));
            bs[i] = (byte) (Math.sin(temp) * 120);
        }
        audioTrack.play();
        while (true) {
            audioTrack.write(bs, 0, bs.length);
        }
    }
SamplingRate =44100
Frequency =800

SamplingRate =44100
Frequency =44100

SamplingRate =360
Frequency =4

https://docs.google.com/spreadsheets/d/1IvCVmJ_WYIhO6PaumFV5mpf3XDIjgu4TwmDbSwwLuK8/edit?usp=sharing




2019年8月9日金曜日

minSdkVersion 28

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.kankanla.pi28"
        minSdkVersion 28
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

compileSdkVersion 29

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.kankanla.pi292"
        minSdkVersion 29
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

2019年8月5日月曜日

DialogFragment 生命周期

DialogFragment  生命周期

 I/###  DialogF: onCreate 1
 I/###  DialogF: onGetLayoutInflater 2
 I/###  DialogF: onCreateDialog 3
 I/###  DialogF: onCreateView 4
 I/###  DialogF: onStart 5
 I/###  DialogF: onResume 6


 I/###  DialogF: onCancel 7
 I/###  DialogF: onPause 8
 I/###  DialogF: onStop 9
 I/###  DialogF: onDestroyView 10
 I/###  DialogF: onDestroy 11
 I/###  DialogF: onDetach 12



2019年7月11日木曜日

Understand the Activity Lifecycle 生命周期




生命周期

package com.kankanla.m20190711m_recorder;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    private final String T = "###  MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(T, "1 onCreate");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onStart() {
        Log.i(T, "2 onStart");
        super.onStart();
    }

    @Override
    protected void onResume() {
        Log.i(T, "3 onResume");
        super.onResume();
    }

    @Override
    protected void onPostResume() {
        Log.i(T, "4 onPostResume");
        super.onPostResume();
    }

    @Override
    protected void onPause() {
        Log.i(T, "5 onPause");
        super.onPause();
    }

    @Override
    protected void onStop() {
        Log.i(T, "6 onStop");
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        Log.i(T, "7 onDestroy");
        super.onDestroy();
    }

    @Override
    protected void onRestart() {
        Log.i(T, "8 onRestart");
        super.onRestart();
    }
}





2019年7月7日日曜日

自動バックアップ

自動バックアップ
SharedPreferencesが再インストール時にリセットされない

bmgr
https://stuff.mit.edu/afs/sipb/project/android/docs/tools/help/bmgr.html

Auto Backup for Android codelab
https://codelabs.developers.google.com/codelabs/android-backup-codelab/#0

Data backup overview
https://developer.android.com/guide/topics/data/backup

<manifest
    <application
         android:allowBackup="true"

adb shell bmgr enabled
adb shell bmgr enable <true|false>
adb shell bmgr list transports
adb shell bmgr backupnow <PACKAGE>
adb shell bmgr backup <PACKAGE>
adb shell bmgr run

adb shell bmgr restore <TOKEN> <PACKAGE>










2019年7月5日金曜日

adb shell dumpsys jobscheduler

adb shell dumpsys jobscheduler


Active jobs:
  Slot #0: inactive since -9m38s404ms, stopped because: app called jobFinished
  Slot #1: inactive since -11m39s487ms, stopped because: cancel() called by app, callingUid=10049 uid=10049 jobId=43
  Slot #2: inactive since -11m39s594ms, stopped because: cancel() called by app, callingUid=10049 uid=10049 jobId=183
  Slot #3: inactive since -3h35m29s108ms, stopped because: last work dequeued
  Slot #4: inactive since -3h45m4s586ms, stopped because: last work dequeued
  Slot #5: inactive since -3h45m4s848ms, stopped because: app called jobFinished
  Slot #6: inactive
  Slot #7: inactive
  Slot #8: inactive
  Slot #9: inactive
  Slot #10: inactive
  Slot #11: inactive
  Slot #12: inactive
  Slot #13: inactive
  Slot #14: inactive
  Slot #15: inactive

mReadyToRock=true
mReportedActive=false
mMaxActiveJobs=6

PersistStats: FirstLoad: 78/11/9 LastSave: 67/6/4




2019年6月9日日曜日

AdRequest.addTestDevice


AdRequest.Builder builder = new AdRequest.Builder();
builder.addTestDevice("7026FA2EC1DC7E60FBEA02C64D33BD8B");
builder.addTestDevice("53185CF5BFA5B2121DF7FA86E7064C22");
builder.addTestDevice("78957C13BCC9AA1AC5D8462F2DEC083A");
builder.addTestDevice("C9517774AEB25C5D4B40D8175F152E03");