2012年12月6日木曜日

YAML入門

3年の羽毛田です.
今日は,学内企業説明会がありました.

今回,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

  
    haketa
    haketa@example.com
  
  
    watanabe
    watanabe@example.com
  
  
    nishizaki
    nishizaki@example.com
  

このようにxmlよりyamlのほうが簡潔に記述することができたと思います.
各種設定ファイルやログファイルなどの用途に向いているみたいです.

調べているとよくXMLと比較されていますが,まったく別ものと考えるのがよいみたいです.

おわりに

私は,今までXMLやJSONについては学んできましたが,今回はじめて,YAMLというものを扱ってみたことで,これからなにかプログラムを書く際に,どのデータ表現をつかってみたらいいのかを考える選択肢がひろがりました.どんどん新しい知識をつけ,その時に適材適所につかっていけるように努力していきたいです.

そういえば,googleのナレッジグラフが日本でも公開されました!
昨日は,タレントの名前とかスポーツ選手の名前で検索をかけると,横にいろんな情報でてきたのに,さっきためしてもなにもでてこなくなってしまった...

46 件のコメント:

  1. คาสิโนออนไลน์ที่น่าเชื่อถือและมีความเป็นมืออาชีพที่สุดในตอนนี้
    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร สล็อตออนไลน์ กับทางทีมงานของเราเพียงเท่านั้น
    ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
    สมัครสล็อตออนไลน์ >>> Goldenslot
    สนใจร่วมสนุกกับ คาสิโนออนไลน์ คลิ๊กได้เลย
    มีทั้งคาสิโนออนไลน์ หวยออนไลน์ ฟุตบอลออนไลน์ สล็อตออนไลน์ และอื่นๆอีกมากมาย

    返信削除
  2. 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.

    返信削除
  3. 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.

    返信削除
  4. Do you have norton antivirus and facing problem while scanning through norton antivirus and get norton error 8504

    返信削除
  5. 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.

    返信削除
  6. 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.

    返信削除

  7. watching your favorite movies and shows on a bigger screen. Here’s how you can watch Amazon Prime Video on
    TV! amazon.com/mytv

    返信削除


  8. 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.

    返信削除

  9. 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.


    返信削除
  10. 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.

    返信削除
  11. If you are unsure, it is prudent to contact our Malwarebytes tech support center and talk to our engineer. Our toll free number is 1-844-249-4536 and the service remains active at all times on all 7 days of the week. The same number is applicable to all parts of the country.

    返信削除
  12. Amazon.com/mytv is a registration portal of Amazon Prime from which members can watch thousands of movies and TV shows for free from their device some features require a premium subscription. The instant video service can only be watched after registering your device with a simple subscription code. The website for registering on Amazon prime is www.amazon.com/mytv. Amazon Prime Video is one of the most amazing and interesting platforms to watch. With Amazon Prime you can stream unlimited movies and TV episodes on Amazon prime video app.

    amazon com mytv

    返信削除
  13. Now you can Easily Activate Amazon by Amazon.com/mytv. It is a registration portal of Amazon Prime from which members can watch thousands of movies and TV shows for free from their device some features require a premium subscription. The instant video service can only be watched after registering your device with a simple subscription code. The website for registering on Amazon prime is amazon.com/mytv. Amazon Prime Video is one of the most amazing and interesting platforms to watch. With Amazon Prime you can stream unlimited movies and TV episodes on Amazon prime video app. You can Easily Fix Troubleshoot by visiting here.

    amazon com mytv

    返信削除
  14. Activate amazon by visiting our website. Amazon Prime Video allows you to watch on-demand movies and TV shows via an app that you must install on your Samsung TV . You will also get original films, television series, and other entertaining content. To begin with any use of the advantages that come with your www.amazon.com/mytv nomination, it is important that you create a record on a similar platform. However, customers are likewise presented with the option to create a record in the hours of actuating from their membership. Visit here amazon.com/mytv

    www.amazon.com/mytv
    amazon.com/mytv

    返信削除
  15. It is an Application It is very useful for clients in installing all the software and guide updates. At whatever point new updates are accessible, it gives you warnings. Clients can save their ideal guides and areas with Garmin Express and can see the information on the navigation device. Thus, garmin.com/express guarantees fast and exact navigation. This Software gives you Warnings, Offers and item Support. For Setup Garmin Express you need to Visit our website.

    garmin.com/express

    It is an Application It is very useful for clients in installing all the software and guide updates. At whatever point new updates are accessible, it gives you warnings. Clients can save their ideal guides and areas with Garmin Express and can see the information on the navigation device. Thus, garmin.com/express guarantees fast and exact navigation. This Software gives you Warnings, Offers and item Support. For Setup Garmin Express you need to Visit our website.

    garmin.com/express







    返信削除


  16. Most importantly, switch on your Smart TV. Then visit amazon.com/mytv enter code Simple process to activate your Amazon prime video on your smart device or phone. Enter code mytv and click on the enter button. Then you see your Amazon prime account activate and you can easily watch your web shows, movies and videos. it is also essential to enter the application stores and download the official Amazon Prime Video application My TV is an Amazon program that offers a simple interface to the My TV service through Amazon's own websites and software programs. As previously noted, the program uses a simple web interface which enables the user to watch various television stations in the United States and Canada.


    amazon.com/mytv
    amazon.com/mytv enter code



    返信削除
  17. Garmin Express is gps tool which enable you to manage your Garmin GPS device from your computer.


    kindle-com-help in during registration error and My kindle account login are the most common kindle errors, so if you are facing these troubles you simply call.


    hp printer driver download and installation setup · Turn on the HP printer and computer for the first time. · Go to the 123hpcom-printer-setup now, open the search Engine.


    Manage your crypto assets and navigate the markets while on the go. Get full Bitfinex platform functionality on your fingertips with one click bitfinex-login.

    返信削除
  18. Here is the step by step guide to ij.start.canon/setup with screenshots for mac and windows Easy setup process to download Canon Drivers!!

    check out the features of Support.brother.com/windows and also know how to install best USB connection for windows10

    norton.com/setup is a website which will help you to setup Norton antivirus product, Norton security download for windows 10.

    help.microsoft.com is a website which will help you for solving your Microsoft account problems, check out the contact details method for Microsoft talk to a person

    office.com/setup

    返信削除
  19. Webroot Setup SecureAnywhere AntiVirus delivers protection against viruses, spyware, and other online threats.
    Webroot Setup

    Despite the ease with which Venmo sign in allows you to pay rent or split the bill.
    Venmo sign

    What is support.brother.com/windows? Common issues with Brother printers and its solutions.
    support.brother.com/windows

    TD Bank Login gives you 24/7 access and support, whether you're at home or on-the-go.
    TD bank login

    Banking products are provided by Boa Login and affiliated banking services.
    Boa Login

    Go through microsoft365.com/setup webpage, Sign in, and enter the product key.
    microsoft365.com/setup

    help.microsoft.com talk to a person help you with products including Office, Windows, Surface, and more.
    help.microsoft.com talk to a person

    返信削除

  20. help.microsoft.com talk to a person Microsoft is here to help you with products including Office, Windows, Surface, and more. Find articles, videos, training, tutorials, and more.

    Garmin Express is gps tool which enable you to manage your Garmin GPS device from your computer.


    www.kindle.com/support in during registration error and My kindle account login are the most common kindle errors, so if you are facing these troubles you simply call.


    hp printer driver download and installation setup · Turn on the HP printer and computer for the first time. · Go to the 123hpcom-printer-setup now, open the search Engine.


    Manage your crypto assets and navigate the markets while on the go. Get full Bitfinex platform functionality on your fingertips with one click bitfinex-login.

    capital one login to manage your BuyPower Card Earnings or Capital One account.

    To activate mcafee visit www.mcafee.com/activate in browser and Enter your 25 digits McAfee Activation Product Key

    返信削除
  21. AVG AntiVirus FREE is a super-lightweight and advanced cybersecurity solution that won't slow down your Windows PC or drain its battery. www.avg.com/retail anti-virus software, offering protection against viruses and various other malicious threats.

    返信削除
  22. For installing Norton in your PC, Go to the Norton Web link that is www.norton.com/setup and then click install button.

    返信削除
  23. Norton 360 Setup is an all-in-one computer software security suite and provides powerful layers of protection for your Android device against viruses, ransomware, malware, and other online threats.

    返信削除
  24. Contact for help.microsoft.com talk to a person to find solutions to common problems, or get help from an agent. Get help through chat or request a call.

    返信削除
  25. Whenever we all try to find the solution online for something, we always want the easy way so if you got somewhere in micorosft and want a quick solution, you need to contact help.microsoft.com talk to a person.

    返信削除
  26. Kucoin is one of the fastest growing cryptocurrency exchanges in the world that you can buy and sell bitcoin securely. kucoin login to find the next crypto gem.

    KuCoin is an international cryptocurrency exchange based out of Seychelle that currently supports the trading of 250 digital assets. Kkucoin login to find the next crypto gem.

    返信削除
  27. Help getting started with Roku devices, including setup, connecting your device to your TV, linking a Roku device to your account at www.roku.com/link.

    返信削除
  28. youtube com activate you have just go to www.youtube.com/activate. Opening youtube com in tablet, laptop, phone etc. Just go to browser And enter the information they asked through browser then connnect your T.V to youtube.

    返信削除
  29. webroot setup can be completed with insertion of 20-digit Webroot keycode. Webroot SecureAnywhere is one of the popular and widely accepted antivirus software in homes and offices.
    If you're having trouble logging in to microsoft365.com/setup, consider using one of your other Microsoft accounts, such as OneDrive, Xbox Live, Outlook.com, or Skype (if you've already subscribed to these products.
    If your printer is showing offline status and you want to change printerremove offline status for printer then here is a complete guide you have landed upon.
    quickbooks support number For Smooth Working As Accounting & Finance Software
    Download and install or reinstall office.com/setup home and student 2019r

    返信削除
  30. Your blogs are amazing. Keep sharing. I love them Are you also searching for help with my assignment? we are the best solution for you. We are best known for delivering the best urgent assignment help.

    返信削除

  31. you can contect roadrunner support phone number or you can login email in different browser clear all data in your cookies and make disable third party add-ons pup-pops and always enter valid email id and password if still getting problem click this to contect roadrunner support number.

    返信削除
  32. hushmail free account. Provide free trial for premium account of hushmail account that user can feel the services of hushmail and in free account user get 15mb of storage and one email account hushmail sign up.

    返信削除
  33. hush technical support customer service number is always there for your help and support. It will provide you all kind of solutions related hushmail so feel free to hush customer service number. Hushmail make your business better then ever.

    返信削除
  34. disable avast antivirus windows 10 you can go to taskbar whare you can find the avast icon where you can click the avast antivirus to go the avast settings where you can find the disable option you can disable the avast hour or few minutes for temporarily disable avast antivirus, or you can disable for permanent.

    返信削除
  35. timewarner email login. You first have a proper login id and password then you can login it if not then you can go to roadrunner official site where you find to create account where you click and create then login it safely and securely time warner cable webmail login.

    返信削除


  36. Roku.com/link is the page to initiate your streaming device.open the web browser and paste the url Roku.com/link code . A brief to give the Roku.com/link enter code will appear on the screen. Enter the Roku Activation code in the code space to finish the Roku device Activation. In premium content, a user is required to pay some fee. But, it is crucial for the user to create the Roku Account to enjoy all the perks. In this post, you will get in-depth knowledge about Activate Roku device and moreover get queries to all your answers.To find and use your Roku link code , follow this guide. Press the “OK” button to allow the device to automatically set the optimal display,If you mean using roku remote for your TV, go to the setup menu of the roku interface and follow the instructions. There is no code to be entered lately. You will have to scan the spectrum to find correct device type. Not all TV sets in the market are roku remote compatible by the way. Take mine for instance.

    返信削除
  37. Are you looking for the steps to make at twitch.tv/activate ? Then you are in the right place. In recent times, it has been the most viewed gaming channel. So, let us move forward to see the requirements to get into this channel.
    twitch tv activate

    返信削除
  38. HBO Max allows users to stream video on demand, including series, movies, sports, and more in one place. Get all the details about the hbomax.com/tvsignin Enter Code site in this article and stream HBO Max shows on your tv. It is necessary for the activation purpose that you need to enter hbomax com tvsign activation code which is a 6 digit in alphanumeric code. hbomax/tvsignin is an American OTT video streaming system that gives films, television shows, and sports on consumer demand.

    hbomax.com/tvsignin
    hbomax com tvsignin
    hbomax/tvsignin

    返信削除
  39. Be proud of the fact that you have the power to rise above any situation and deliver the best results no matter the circumstances. Excellent work!
    twitch.tv/activate

    返信削除
  40. HBO MAX lets you watch movies, exclusive tv shows and other videos at one place but it only works when it is activated. It is necessary for the activation purpose that you need to enter HBO MAX activation code which is a 6 digit in alphanumeric code. The process to get the HBO MAX activation code is to first open your web browser and go to hbomax.com/tvsignin and your hbo max account by registered email ID. Then check your email box properly and you will find the HBO MAX Activation Code seems like AS17J.

    hbomax.com/tvsignin

    返信削除
  41. Canon’s manufacturer site ij.start.canon is the platform to get the Canon printer software where you can download the latest printer drivers to start your Canon model for printing, scanning, faxing, copying documents, and more. ij start Canon process requires your Canon inkjet printer hardware, canon ij setup or CD, a network connection, router, and a USB Cable. To get started with ij.start canon, follow the instructions mentioned below.

    ij.start.canon

    返信削除

  42. Happy Wheels is a ragdoll-physics-adventure based Flash game created by Jim Bonacci and launched in June of 2010. Players control a selection of various, unique characters with their goal being to get to the finish line, activate a trigger that triggers victory, or collect a required amount of tokens while avoiding being splattered across the level by many hazards and obstacles. Users may create and share their own custom scenarios using the expansive level editor, play some of the over 10 million already-existing user-made levels, or take a look at some of the featured levels – the best levels in the game. The game is most notable for its dark sense of humor and its large amounts of blood and gore. The full version allows you to go to the up-to-date version Download Happy Wheels while the demo stays on v1.10, with limited features.

    返信削除


  43. Prime video offers you unlimited streaming of movies and TV episodes for paid or free subscription. You can enjoy watching all the content on your phones and computers.Prime Video Profiles allows you to create and manage multiple profiles within your account with content personalized separately to each profile. Each profile will have separate recommendations, season progress, and a Watch list based on individual profile activity. Amazon com mytv

    返信削除
  44. Way cool, some valid points! I appreciate you making this article available, the rest of the site is also high quality. Have a fun. 파칭코

    返信削除
  45. Dial our number +1(830) 476-2055 to talk to one of our representatives. He will happily listen to your IT related woes and tell you about amazing support plans that are tailor-made to suit the requirements of our clients. We are always ready with our team of experts to provide all help and support to our customers. You will get 24X7 live support from our company to get rid of all IT related problems. computer help | computer help on phone

    返信削除
  46. printer not activated error code 30 windows 10 update your printer driver reinstall the usb and restart your printer and select as default printer print always in pdf mode upgrade your driver or restart your print spooler service printer not activated error code 41.

    返信削除