yu nkt’s blog

nkty blog

I'm an enterprise software and system architecture. This site dedicates sharing knowledge and know-how about system architecture with me and readers.

O'Reilly Online Learningにあるe-bookのページ数カウント

O'Reilly Online Learning

オライリーの本が、サブスクで読み放題のサイトです。

www.oreilly.com

ほとんどは英語版ですが、一部、和訳されたものも読めます。 オライリー本だけでなく、マニング本など、他の出版社のものまで読めます。

ACMの会員だと、特典として、O'Reilly Online Learningが見れます。 今は知りませんが、私が加入した4,5年前は、O'Reilly Online Learningの年会費より、ACMの会員の年会費のほうが安い、という意味不明な状況でした。

紙の書籍におけるページ(数)は分からない

勉強会などで、技術書を読む機会があり、その際、翻訳や要約をするのですが、その担当者を決める際に、ページ数が必要です。 しかし、O'Reilly Online Learningは、各章ごとに1つのwebページとなっており、紙の書籍のページ、という概念はありません。 そのため、分量がいまいちわからないため、翻訳・要約の分担がしにくいという悩みがありました。

ページ数カウント

そこで、文字数からページ数をカウントするアプリを作りました。

github.com

ブラウザにGreasemonkeyなどのアドオンを入れて、 main.js の内容をコピーすれば、ブラウザのコンソールに、以下のような章・節ごとのページ数の概算値が出ます。

Chapter 1. Introduction, 2.8, 5054
    Defining Software Architecture, 2.2, 3906
    Expectations of an Architect, 0.5, 843
        Make Architecture Decisions, 0.9, 1578
        Continually Analyze the Architecture, 0.7, 1271
        Keep Current with Latest Trends, 0.4, 700
        Ensure Compliance with Decisions, 0.7, 1309
        Diverse Exposure and Experience, 0.7, 1298
        Have Business Domain Knowledge, 0.7, 1236
        Possess Interpersonal Skills, 0.8, 1364
        Understand and Navigate Politics, 1.6, 2806
    Intersection of Architecture and…, 1.4, 2557
        Engineering Practices, 4.9, 8731
        Operations/DevOps, 1.0, 1740
        Process, 1.1, 1963
        Data, 0.5, 895
    Laws of Software Architecture, 0.9, 1678

1800文字を1ページとして、概算値を出しています。

今は自分がほそぼそとメンテしていますが、元々は、kubernetes/istio界隈で活躍されているt-ideさんにベースを作成して頂いたものです。スペシャルサンクスです。