Unless there is a specific prohibition on a book's catalog page, we put programming examples online to be used. The source of the code should be noted in any documentation and as a comment in the program itself. The attribution should include author, title, publisher, and ISBN. For further information, see our Policy on Re-Use of Code Examples.