今日は,学内企業説明会がありました.
今回,RubyでTwitterのクローラを書いてた際にトークンとかをYAMLデータとして,ほかのところに保持して,それを読み込んで使用しました.
Rubyを使って書いたのが初めてで,YAMLがなにかわかっていなかったので,ここでまとめつつ理解を深めようと思います.
YAMLとは
構造化されたデータを表現するためのフォーマットで,目的はXMLと似ています.特徴として,XMLと比べて書きやすく,わかりやすいという点があります.
Rubyでは,Ruby 1.8から標準ライブラリに含まれています.他にもいろんな言語でライブラリを用いて使うことができるみたいです.
詳しい書き方とかは下のURLを参照してみてください.
http://jp.rubyist.net/magazine/?0009-YAML
例としてXMLより書きやすく,わかりやすいと書いているので,実際に比較してしてみます.
yaml
users: - name: haketa mail: haketa@example.com - name: watanabe mail: watanabe@example.com - name: nishizaki mail: nishizaki@example.com
xml
このようにxmlよりyamlのほうが簡潔に記述することができたと思います.haketa haketa@example.com watanabe watanabe@example.com nishizaki nishizaki@example.com
各種設定ファイルやログファイルなどの用途に向いているみたいです.
調べているとよくXMLと比較されていますが,まったく別ものと考えるのがよいみたいです.
おわりに
私は,今までXMLやJSONについては学んできましたが,今回はじめて,YAMLというものを扱ってみたことで,これからなにかプログラムを書く際に,どのデータ表現をつかってみたらいいのかを考える選択肢がひろがりました.どんどん新しい知識をつけ,その時に適材適所につかっていけるように努力していきたいです.そういえば,googleのナレッジグラフが日本でも公開されました!
昨日は,タレントの名前とかスポーツ選手の名前で検索をかけると,横にいろんな情報でてきたのに,さっきためしてもなにもでてこなくなってしまった...
คาสิโนออนไลน์ที่น่าเชื่อถือและมีความเป็นมืออาชีพที่สุดในตอนนี้
返信削除โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
เพียงแค่คุณสมัคร สล็อตออนไลน์ กับทางทีมงานของเราเพียงเท่านั้น
ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
สมัครสล็อตออนไลน์ >>> Goldenslot
สนใจร่วมสนุกกับ คาสิโนออนไลน์ คลิ๊กได้เลย
มีทั้งคาสิโนออนไลน์ หวยออนไลน์ ฟุตบอลออนไลน์ สล็อตออนไลน์ และอื่นๆอีกมากมาย
E-commerce research paper writers are hard to come across them for those in need of E-commerce Essay Writing Services and trade and e-commerce writing services.
返信削除Medical coursework writing service seekers have been on the rise lately since most learners need Medical Research Paper Services, nursing research writing services and medical essay writing services.
返信削除Do you have norton antivirus and facing problem while scanning through norton antivirus and get norton error 8504
返信削除Finding the best powerpoint presentation online services and PowerPoint Presentation Writing Services is not easy unless one is keen to establish a reputable powerpoint presentation assignment writing service provider & powerpoint presentation coursework writing services.
返信削除Custom biology coursework writing service seekers have been on the rise lately since most learners need Biology Assignment Writing Services, biology essay writing services and biology research writing services.
返信削除
返信削除watching your favorite movies and shows on a bigger screen. Here’s how you can watch Amazon Prime Video on
TV! amazon.com/mytv
返信削除Users can install mcafee antivirus on their computer and keep protected by this kind of infection. Download and Install Mcafee through mcafee.com/activate . Sign in to your Mcafee account, activate Mcafee and enter Mcafee 25 digit activation code. create your Mcafee account to manage your Mcafee subscriptions.
返信削除Watch Prime Video on Amazon My TV, users have to enter a 6-digit registration which you can visiting Amazon.com/mytv .Amazon Prime video is amazon streaming platform which is the main competitor of Netflix and other global streaming channels. You can watch your favorite movies and shows without any ads using amazon prime video. With the help of your Amazon Activation Code , users can easily activate their subscriptions on their smart TVs.
Just dial 1-877-916-7666 irrespective of your location to reach our popular and trusted tech support centre. Your call is attended by our qualified engineer who gives authentic resolutions in a step by step manner.
返信削除