In time of war, truth is always replaced by propaganda.
戦時中は、真実はプロパガンダによって常に置き換えられる。
|
|
|
Semakin di depan
In time of war, truth is always replaced by propaganda.
戦時中は、真実はプロパガンダによって常に置き換えられる。
|
|
|
混乱から抜け出すと、単純明快になる。
|
飛行機の機材番号からその飛行機の写真を取得するため、以前はGoogleのSerach APIを使ってましたが、マイナーな航空会社の場合、はずれが多く課金もされので、ふさわしいのを探してましたところ、見つけました。
Home : https://www.planespotters.net/
API DOCUMENT : https://www.planespotters.net/photo/api
< 特長 >
1) アカウントキーなしで使えます。
2) 最新の1枚の情報が取得出来ます。
3) サムネイルのサイズは2種類
4) 写真の保存は禁止
5) 応答結果の保存は24時間以内
< Terms of use >
The use of photos in your website or application cannot be an exclusive paid, premium or member-only feature. Each area that will include photos must be publicly and freely available to all users. Thumbnail sizes used in your website or application must be the same across all access levels.
Each photo must be attributed to the photographer and the thumbnail linked back to the original page at Planespotters.net in accordance with our general Terms of Use.
API responses must not be stored for more than 24 hours.
All URLs, including image sources and links to photos, must remain unchanged and as provided in the API response.
Image files must not be stored on your servers or inside your application and must be served from the original URL provided in the API response.
< 利用規約 >
ウェブサイトまたはアプリケーションでの写真の使用は、有料、プレミアム、またはメンバー限定の機能であってはなりません。 写真を含む各領域は、公開され、すべてのユーザーが自由に利用できる必要があります。 Web サイトまたはアプリケーションで使用されるサムネイルのサイズは、すべてのアクセス レベルで同じでなければなりません。
各写真は写真家に帰属し、サムネイルは一般的な利用規約に従って Planespotters.net の元のページにリンクされている必要があります。
API 応答は 24 時間以上保存しないでください。
画像ソースや写真へのリンクを含むすべての URL は変更せず、API 応答で提供されているとおりにする必要があります。
画像ファイルは、サーバー上またはアプリケーション内に保存してはならず、API 応答で提供された元の URL から提供する必要があります。
|
|
公式ドキュメントはこちら
< コード例 >
pagination: true,
paginationSize: 20,
paginationSizeSelector: [10, 20, 30, 50, 100, 200, true],
paginationCounter: "rows",
paginationMode: "local",
paginationInitialPage: 1,
< 画面例 >
TabulatorのtopCalcプロパティを使えば集計値の表示が出来ます。
ビルトインで用意されたプロパティを使ってみました。
公式ドキュメントはこちら
sum, avg, count, maximum, minmum, concatenate が使えます。、
< コード例 >
sumとcount
// 機材数 //
{
topCalc: "sum",
title: "Fleet",
field: "fleet_size",
hozAlign: "right",
width: 46,
formatterParams: {thousand: ","},
formatter: function (cell, formatterParams, onRendered) {
if (cell.getValue() <= 0) {
return ""
}
else {
return numeral(cell.getValue()).format("#,###")
}
},
//width: 50,
sorter: "number",
cssClass: "cell_num_onlytext_navy"
},
// 旅客貨物定時国際タイプ記号列挙 //
{ topCalc: "count",
title: "Type", field: "type", hozAlign: "center", width: 50
},
< 画面例 >
Tabulatorで集計行の表示が、topCalc で簡単に出来て使ってましたが、ビルトインのプロパティにない集計が必要になり作ってみました。
公式ドキュメントはこちら
Group byした結果のアイテム数
メジアン
0や空白を除外した集計
などです。
< コード例 >
実は別関数にしたところ、うまく動かないので、カラムのプロパティに記述してます。
0以下除外平均
topCalc: function (values, dtoata, calcParams) {
// 0 (データは-1)を除外した平均 //
let cnt = 0
let sum = 0
values.forEach(function (value) {
/*console.log("--- value")
console.log(value)
console.log("--- data")
console.log(data)*/
let val = value === -1 ? 0 : value
if (val > 0) {
cnt++;
sum = Number(sum) + Number(val)
}
})
//alert(sum + ":" + cnt)
if (sum > 0 && cnt > 0) {
const res = Math.round(sum / cnt * 10) / 10
return res;
}
else {
return 0
}
}
0以下除外メジアン
topCalc: function (values, data, calcParams) {
// 0 -1を除外したメジアン //
let targets = []
values.forEach((value) => {
console.log(value)
//let val = value.replaceAll(",", "")
let val = value < 0 ? 0 : value
val = parseInt(val)
if (val > 0) {
targets.push(val)
}
})
console.log(targets)
const half = Math.floor(targets.length / 2);
if (targets.length % 2) {
return targets[half];
}
else {
return (targets[half - 1] + targets[half]) / 2;
}
}
Group by アイテム数
topCalc: function (values, data, calcParams) {
let manuCnts = {}
values.forEach((tmp) => {
manuCnts[tmp] = (manuCnts[tmp] || 0) + 1;
})
console.log("--- manufac")
console.log(manuCnts)
return Object.keys(manuCnts).length + " Manufactures"
}
< 画面例 >
|
社会を明朗ならしむる第一条件は、言論の絶対自由だ
|
アメリカ人の言葉に「時は金なり」とありますが、むしろ「時は金よりも尊し」と述べたい。
|
|
|
|
結局、妥協したのである。もともと生きるとは妥協することである
|
努力している人を笑うこと。 それは、何よりも最低な行為である
|
|
コメントを投稿するにはログインしてください。