// 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');
}
}
2021年3月3日水曜日
fetch() Ajax
2020年9月27日日曜日
JavaScript 気になるメソッド .reverse() .concat()
JavaScript 気になるメソッド
Array.reverse()
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
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/
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/
一覧画面はアドレスバーに
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);
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>
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>
登録:
コメント (Atom)