.htaccess

PHPのエラー出力設定の変更

.htaccessとは

ApacheなどのWebサーバーの設定を、ディレクトリ単位で変更できる。
.htaccessという名前のテキストファイルをディレクトリに置くだけでそのディレクトリの設定を変更できる。

簡単にパスワードがかけられる、ベーシック認証などでよく用いられる。

共用のレンタルサーバーなど、Webサーバーの設定を変更できないときに有効。

Webサーバーの設定によって、.htaccessで変更できる内容は制限できるので、Webサーバーによっては利用できない機能もある。

$(document).readyとwindow.onload

Javascript

$(document).readyはDOMツリーの構築が完了した時点で発動します。
実装や発動タイミングはブラウザによって変わりますが、原則としてbody.onloadより先に発動します。

この時点ではまだ画像等他のファイルがロード中の場合があり、javascriptとファイルのロードが並列して実行されるのでレスポンスの改善が期待できます。

ただ、画像の加工等、画像ファイルのロードが済んでいることを保証する必要がある場合は、window.onloadを使います。window.onloadは、HTMLで記述した全ファイルのロードが完了してから発動します。

jQuery 1.2.2の記事になりますが、$(document).readyの挙動を解析した記事を紹介します。
http://hkom.blog1.fc2.com/blog-entry-614.html

顔アイコンの書き方

FrontPage

顔文字は次のように書けます。

 &heart;
 ⌣
 &huh;
 &oh;
 &sad;
 &worried;
 &musu;
 &clover;
  • 行中で&heart;と書くと、ハートマーク [heart] に置換されて出力されます。
  • 行中で⌣と書くと、 [smile] に置換されて出力されます。
  • 行中で&huh;と書くと、 [huh] に置換されて出力されます。
  • 行中で&oh;と書くと、 [oh] に置換されて出力されます。
  • 行中で&sad;と書くと、 [sad] に置換されて出力されます。
  • 行中で&worried;と書くと、 [worried] に置換されて出力されます。
  • 行中で&musu;と書くと、 [musu] に置換されて出力されます。
  • 行中で&clover;と書くと、 [clover] に置換されて出力されます。
  • 行中で&cat;と書くと、 [cat] に置換されて出力されます。
  • 文字参照文字は、表示されるときに置換されます。
  • 文字参照文字は、他のインライン要素の子要素になることができます。
  • 文字参照文字は、他のインライン要素を子要素にはできません。

他にSGMLで定義されている文字参照文字(©や®など)が使用できます。

MapboxのMap Matchingを使ってみる

Javascript

Mapbox Map Matching API は、GPSの誤差などで道からずれている移動データを道なりにしてくれるAPIです。

https://www.mapbox.com/help/define-map-matching/

調査で使ってみます。
結論から言うと、あまりいいデータになりませんでした。
量が少ないのかな??

とはいえ、やってみたことをメモとして記録しておきます。

まずは、下記のように横浜駅から弊社への歩きのデータを普通にMap上にポリラインで描画すると、次のようになります。

map_matching_before.png

これを下記のAPIドキュメントを参考にしながらMap MatchingのAPIから結果を取得してみます。
https://www.mapbox.com/api-documentation/#map-matching

結果を取得するURLは次のようになります。

https://api.mapbox.com/matching/v5/mapbox/walking/139.620905,35.4675961;139.6215341,35.4664734;139.6213571,35.4673672;139.6213627,35.4673691;139.6213261,35.4673446;139.6213702,35.4673721;139.6213532,35.4673546;139.6217172,35.4666922;139.6217172,35.4666922;139.6215815,35.4666787;139.6210947,35.4666536;139.6209621,35.4668035;139.6216843,35.4666219;139.6209323,35.4665434;139.6213187,35.4660293;139.6209681,35.4668535.json?access_token=ひみつ

Access Tokenは別途Mapboxで登録して取得してください。

 {
  "matchings": [
    {
      "confidence": 2.7299273952507974e-12,
      "geometry": "mgnwEavdsYbAH@MVAEcB\\s@R?fA`AgAaAS?]r@YOIPBRBFCICQHQXN\\s@R?\\Z??JHfA`A@V_@v@g@i@GGuAqA\\s@R?h@d@fA`A@V_@v@MOLNATTLFNr@lCPIy@cD|@uBEE{AqAsAzC",
      "legs": [
        {
          "summary": "",
          "weight": 139.2,
          "duration": 139.2,
          "steps": [],
          "distance": 193.4
        },
        {
          "summary": "",
          "weight": 84,
          "duration": 84,
          "steps": [],
          "distance": 116.6
        },
        {
          "summary": "",
          "weight": 6.7,
          "duration": 6.7,
          "steps": [],
          "distance": 9.4
        },
        {
          "summary": "",
          "weight": 2.9,
          "duration": 2.9,
          "steps": [],
          "distance": 4
        },
        {
          "summary": "",
          "weight": 3.4,
          "duration": 3.4,
          "steps": [],
          "distance": 4.8
        },
        {
          "summary": "",
          "weight": 6.2,
          "duration": 6.2,
          "steps": [],
          "distance": 8.6
        },
        {
          "summary": "",
          "weight": 62.8,
          "duration": 62.8,
          "steps": [],
          "distance": 87.2
        },
        {
          "summary": "",
          "weight": 0,
          "duration": 0,
          "steps": [],
          "distance": 0
        },
        {
          "summary": "",
          "weight": 6.1,
          "duration": 6.1,
          "steps": [],
          "distance": 8.5
        },
        {
          "summary": "",
          "weight": 88.9,
          "duration": 88.9,
          "steps": [],
          "distance": 120.7
        },
        {
          "summary": "",
          "weight": 4,
          "duration": 4,
          "steps": [],
          "distance": 5.5
        },
        {
          "summary": "",
          "weight": 92.5,
          "duration": 92.5,
          "steps": [],
          "distance": 128.3
        },
        {
          "summary": "",
          "weight": 75.6,
          "duration": 75.6,
          "steps": [],
          "distance": 102.4
        },
        {
          "summary": "",
          "weight": 200.3,
          "duration": 200.3,
          "steps": [],
          "distance": 275.4
        },
        {
          "summary": "",
          "weight": 106.3,
          "duration": 106.3,
          "steps": [],
          "distance": 147.6
        }
      ],
      "weight_name": "duration",
      "weight": 878.9000000000001,
      "duration": 878.9000000000001,
      "distance": 1212.3999999999999
    }
  ],
  "tracepoints": [
    {
      "alternatives_count": 0,
      "waypoint_index": 0,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.620974,
        35.467588
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 1,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621427,
        35.466538
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 2,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621488,
        35.467334
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 3,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621391,
        35.467305
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 4,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621349,
        35.467293
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 5,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621399,
        35.467308
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 6,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621488,
        35.467334
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 7,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621621,
        35.46675
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 8,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621621,
        35.46675
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 9,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621565,
        35.466689
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 10,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621048,
        35.466684
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 11,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621086,
        35.466723
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 12,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621568,
        35.466693
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 13,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.620918,
        35.466552
      ]
    },
    {
      "alternatives_count": 0,
      "waypoint_index": 14,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.621361,
        35.466003
      ]
    },
    {
      "alternatives_count": 1,
      "waypoint_index": 15,
      "matchings_index": 0,
      "name": "",
      "location": [
        139.620989,
        35.466881
      ]
    }
  ],
  "code": "Ok"
 }

描画してみると、次のようになります。

map_matching_after.png

あれれ、ただ単にデータが減っただけみたいですね。
もともとは38個あった緯度経度データが、14個に減っています。

なぜなぜ~。
日本はまだまだデータが少ないからなのか、そもそものデータが少ないのか。
謎ぽよです。

ちょっとわかりませんね。

Hello world!

WordPress へようこそ。これは最初の投稿です。編集もしくは削除してブログを始めてください !