0% found this document useful (0 votes)
26 views

Professional Heroku Programming 1st Edition Chris Kemp instant download

The document is a promotional material for the book 'Professional Heroku Programming' by Chris Kemp and Brad Gyger, which covers various aspects of using the Heroku platform for application development. It includes an overview of Heroku, application management, data storage, programming in different languages, and building mobile and social applications. Additionally, it provides links to other programming-related eBooks available for download.

Uploaded by

gyoopunek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Professional Heroku Programming 1st Edition Chris Kemp instant download

The document is a promotional material for the book 'Professional Heroku Programming' by Chris Kemp and Brad Gyger, which covers various aspects of using the Heroku platform for application development. It includes an overview of Heroku, application management, data storage, programming in different languages, and building mobile and social applications. Additionally, it provides links to other programming-related eBooks available for download.

Uploaded by

gyoopunek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Professional Heroku Programming 1st Edition

Chris Kemp pdf download

https://ebookname.com/product/professional-heroku-
programming-1st-edition-chris-kemp/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming with Miranda Chris Clack

https://ebookname.com/product/programming-with-miranda-chris-
clack/

Programming F 3 0 Second Edition Chris Smith

https://ebookname.com/product/programming-f-3-0-second-edition-
chris-smith/

ASP NET 3 5 Website Programming Chris Love

https://ebookname.com/product/asp-net-3-5-website-programming-
chris-love/

Methodology and Emotion in International Relations


Parsing the Passions 1st Edition Eric Van Rythoven

https://ebookname.com/product/methodology-and-emotion-in-
international-relations-parsing-the-passions-1st-edition-eric-
van-rythoven/
Snowfall at Willow Lake Susan Wiggs

https://ebookname.com/product/snowfall-at-willow-lake-susan-
wiggs/

Physiology The Language of Life and Nature Rick Welch

https://ebookname.com/product/physiology-the-language-of-life-
and-nature-rick-welch/

Industrial Statistics Practical Methods and Guidance


for Improved Performance 1st Edition Anand M. Joglekar

https://ebookname.com/product/industrial-statistics-practical-
methods-and-guidance-for-improved-performance-1st-edition-anand-
m-joglekar/

Forging Two Nations Insights on Sudan and South Sudan


1st Edition Elke Grawert

https://ebookname.com/product/forging-two-nations-insights-on-
sudan-and-south-sudan-1st-edition-elke-grawert/

A Student s Guide to Fourier Transforms With


Applications in Physics and Engineering 3rd ed 2011 3rd
Edition J. F. James

https://ebookname.com/product/a-student-s-guide-to-fourier-
transforms-with-applications-in-physics-and-engineering-3rd-
ed-2011-3rd-edition-j-f-james/
Easy Ways to Lower Your Taxes Simple Strategies Every
Taxpayer Should Know 1st Edition Sandra Block

https://ebookname.com/product/easy-ways-to-lower-your-taxes-
simple-strategies-every-taxpayer-should-know-1st-edition-sandra-
block/
ffirs.indd i 1/10/2013 1:46:29 PM
PROFESSIONAL HEROKU® PROGRAMMING

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv

 PART I AN OVERVIEW OF HEROKU


CHAPTER 1 How Heroku Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2 Architectural Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
CHAPTER 3 Porting Your Applications to Heroku . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

 PART II CREATING AND MANAGING HEROKU APPLICATIONS


CHAPTER 4 Deploying Your Applications to Heroku . . . . . . . . . . . . . . . . . . . . . . . . . . 73
CHAPTER 5 Managing Releases with Heroku . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
CHAPTER 6 Working with Add-Ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
CHAPTER 7 Managing, Monitoring, and Scaling Your Heroku Applications . . . . . . 133

 PART III USING A DATA STORE WITH YOUR HEROKU APPLICATIONS


CHAPTER 8 Using Heroku Postgres as a Data Store for Your
Heroku Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
CHAPTER 9 Using Database.com as a Data Store for Your Heroku Applications . .181
CHAPTER 10 Using Third-Party Data Stores for Your Heroku Applications . . . . . . . 207

 PART IV PROGRAMMING ON HEROKU’S POLYGLOT PLATFORM


CHAPTER 11 Developing with Ruby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
CHAPTER 12 Developing with Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
CHAPTER 13 Developing with Other Supported Languages. . . . . . . . . . . . . . . . . . . . 301
CHAPTER 14 Understanding Buildpacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

 PART V CREATING A NEW GENERATION OF HEROKU APPLICATIONS


CHAPTER 15 Building Mobile Applications with Heroku . . . . . . . . . . . . . . . . . . . . . . . 383
CHAPTER 16 Building Social Applications with Heroku . . . . . . . . . . . . . . . . . . . . . . . . . 411
APPENDIX Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

ffirs.indd i 1/10/2013 1:46:29 PM


ffirs.indd ii 1/10/2013 1:46:30 PM
PROFESSIONAL

Heroku® Programming

ffirs.indd iii 1/10/2013 1:46:30 PM


ffirs.indd iv 1/10/2013 1:46:30 PM
PROFESSIONAL
®
Heroku Programming

Chris Kemp
Brad Gyger

John Wiley & Sons, Ltd.

ffirs.indd v 1/10/2013 1:46:30 PM


© 2013 John Wiley & Sons, Ltd.

Registered offi ce

John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom

For details of our global editorial offices, for customer services and for information about how to apply for permission to
reuse the copyright material in this book please see our website at www.wiley.com.

The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright,
Designs and Patents Act 1988.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK
Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.

Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and
product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective
owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed
to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding
that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is
required, the services of a competent professional should be sought.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other
countries, and may not be used without written permission. Heroku is a registered trademark of Salesforce.com, Inc.
All other trademarks are the property of their respective owners. John Wiley & Sons, Ltd. is not associated with any
product or vendor mentioned in this book.

Heroku product screenshots courtesy of Heroku, Inc.

A catalogue record for this book is available from the British Library.

978-1-118-50899-2 (paperback)
978-1-118-50901-2 (ebook)
978-1-118-50902-9 (ebook)
978-1-118-50903-6 (ebook)

Set in 9.5 /12 Sabon LT Std Roman, by MPS Limited, Chennai

Printed in the United States by Bind-Rite

ffirs.indd vi 1/10/2013 1:46:31 PM


To my fi ancée, Fiona, whose support and
inspiration made writing this book possible;
and my parents, Don and Vlasta, who gave
me the opportunities throughout my life
that made this and all of my
achievements possible.

—Chris

To my wife, Nabila; my son, Cameron; and my


parents, Roger and Judy. Without you all this
wouldn’t have been possible.

—Brad

ffirs.indd vii 1/10/2013 1:46:31 PM


ffirs.indd viii 1/10/2013 1:46:31 PM
ABOUT THE AUTHORS

CHRIS KEMP is a cloud architect, innovator, and entrepreneur with experience developing software
in a number of languages. The bulk of his development experience is with PHP, Java, and the
Salesforce Platform. He started a software development consultancy, Vandelay Enterprises, at the
age of 15, developing applications, mostly on the LAMP stack, for customers around the world.
Chris then moved to the fast-growing Toronto start-up, I Love Rewards (now Achievers), where he
developed rewards and recognition software in PHP and Java, before joining Salesforce.com.
Chris currently works out of Salesforce.com’s Toronto office, as a Senior Solution Engineer on
the Advanced Technical Solutions team, an international team of trusted pre-sales advisors and
architects. He is the worldwide leader of the Heroku Ambassador group, a team of leading Heroku
experts in the company. Chris has developed a number of open source projects in Apex and
Visualforce, including the wildly popular Cloud Swarm application. He is a named inventor on
seven patent applications for innovations developed at Salesforce.com.
Chris holds a B.Sc. in Computer Science (Software Engineering specialist, 0T4) from the University
of Toronto.

BRAD GYGER has extensive experience with various development platforms, including Heroku. Early
in his career, he focused on Java application stacks at Sun Microsystems and then Oracle, and later
migrated to the cloud, fi rst working at platform provider Engine Yard, and then Heroku.
Brad currently leads the Customer Advocacy team at Heroku, where he is tasked with the success of
customer applications running on the platform. This requires working knowledge of all supported
application architectures, languages, frameworks, and tools within the Heroku universe. He works
with customers on a daily basis to ensure that their applications are implemented optimally on the
platform. During his career, Brad has worked with thousands of customer applications and made
sure each one was as successful as possible.
Brad holds a Bachelor of Science degree from Indiana University. He and his family currently reside
in the San Francisco Bay Area.

ffirs.indd ix 1/10/2013 1:46:31 PM


ABOUT THE TECHNICAL EDITOR

GREG NOKES has more than 20 years of experience in systems engineering, ranging from designing
wide area networks to helping high-traffic web applications scale successfully. He has successfully
lead customer-facing as well as highly technical teams on a variety of projects. He is fluent in several
technologies, including cutting-edge web application servers and deployment tools.
Currently, Greg is the Lead Technical Account Manager at Heroku, the premier PaaS provider.
In this role, he helps a large and dynamic group of companies learn the best practices for
optimizing their applications, as well as assists with technical and architectural advice.
Greg enjoys hiking, paintball, and soaking up the surroundings in the beautiful Puget Sound area of
the Pacific Northwest.

ffirs.indd x 1/10/2013 1:46:31 PM


CREDITS

VP CONSUMER AND TECHNOLOGY PROJECT EDITOR


PUBLISHING DIRECTOR John Sleeva
Michelle Leete
COPY EDITOR
ASSOCIATE DIRECTOR—BOOK CONTENT Luann Rouff
MANAGEMENT
Martin Tribe TECHNICAL EDITOR
Greg Nokes
ASSOCIATE PUBLISHER
Chris Webb PRODUCTION EDITOR
Kathleen Wisor
ASSISTANT EDITOR
Ellie Scott PROOFREADER
Nancy Carrasco
ASSOCIATE MARKETING DIRECTOR
Louise Breinholt INDEXER
Jack Lewis
MARKETING MANAGER
Lorna Mein COVER DESIGNER
LeAndra Young
SENIOR MARKETING EXECUTIVE
Kate Parrett COVER IMAGE
© boboling / iStockphoto
EDITORIAL MANAGER
Jodi Jensen

SENIOR PROJECT EDITOR


Sara Shlaer

ffirs.indd xi 1/10/2013 1:46:31 PM


ffirs.indd xii 1/10/2013 1:46:31 PM
ACKNOWLEDGMENTS

THIS BOOK COULD NOT HAVE BEEN POSSIBLE without the vision and incredible dedication from the
uber-smart founders and team at Heroku in developing such an amazing technology and making it
better every day. Salesforce.com’s senior leadership team, especially Marc Benioff, must be thanked
for bringing Heroku into the Salesforce.com family.
The team at Wiley, including Chris Webb, John Sleeva, Luann Rouff, Kate Parrett, Lorna Mein,
and Ellie Scott, have done an outstanding job with all the hard work behind the scenes to make this
book the best it can be. Greg Nokes has also done an incredible job in ensuring this book’s technical
accuracy.
My co-author, Brad, deserves huge thanks for being so patient in teaching me the ins and outs of
Heroku. You are truly an outstanding individual to work with. Your great efforts are massively
appreciated. And we’re both crossing one item off of our bucket lists together!
I would not have had the opportunity to write this book were it not for the foresight of my
manager, Richard Ho, and the support of the Sales Engineering management team at Salesforce.com,
including Dominic Dinardo, Pat McQueen, Anne DelSanto, and Sandy Jones. Your leadership
continues to inspire me to do great things every day. My colleagues have been so supportive
throughout my career at Salesforce.com and deserve big thanks for that.
I also want to thank Will Tran and Craig Kerstiens for lending their Java and Heroku Postgres
wisdom. A big thanks to my cousin, Adam Kemp, for lending me the family cottage and keeping me
company while I wrote the bulk of this book; and to his dad, George, for his valuable legal advice.
And thanks to all my friends for your encouragement and kind words.
The biggest thanks goes to Fiona, for your support and patience while I wrote this book; and to my
family, who raised me and taught me just about everything I know. I can never thank you enough
for all you’ve done for me throughout my life. This book is for you.

—Chris

A BIG THANK YOU TO MY TEAMMATES at Heroku. It has been an inspiration to watch you create
amazing things and empower our community with truly revolutionary technology. Your support
and encouragement have been instrumental in the creation of this book. I hope we do Heroku
proud.
I must thank my co-author, Chris. We met soon after Heroku joined the Salesforce.com family and
clicked immediately. It’s been a lot of fun creating with you, Chris, both within this book and on all
those apps!

ffirs.indd xiii 1/10/2013 1:46:31 PM


A quick thank you to our Technical Editor, Greg Nokes. He’s been a colleague for several years
now, keeping me honest the whole time.
I also want to thank the people at Wiley, especially Chris Webb, John Sleeva, Luann Rouff, Kate
Parrett, Lorna Mein, and Ellie Scott. You have all done a great job supporting Chris and me.
Most of all, I must thank my family. Your love and support has been instrumental in completing this
book.

—Brad

ffirs.indd xiv 1/10/2013 1:46:31 PM


CONTENTS

INTRODUCTION xxv

PART I: AN OVERVIEW OF HEROKU

CHAPTER 1: HOW HEROKU WORKS 3

How the Stacks Stack Up 4


Understanding Dynos and the Dyno Manifold 6
Understanding Dyno Isolation 8
Exploring the Process Model 8
Understanding Erosion Resistance 10
Managing Version Control 11
Understanding the Slug Compiler 12
Routing HTTP Requests 13
Summary 15
CHAPTER 2: ARCHITECTURAL CONSIDERATIONS 17

Building Twelve-Factor Applications 18


Managing Your Application Portfolio with Pace Layering 21
Systems of Record 21
Systems of Differentiation 21
Systems of Innovation 22
Classification 22
Security and Reliability 22
Governance 23
Application Portfolio Management 23
Ensuring Security and Compliance 25
Physical Security and Safeguards 25
Network Security 25
Dyno- and Stack-Layer Security 26
Data Retention 27
Dealing with Security Issues 27
Certifications, Accreditations, and Compliance 27
Understanding Redundancy and Reliability 28
Disaster Recovery and Availability Zones 28
Availability and Transparency 29

ftoc.indd xv 1/10/2013 1:48:57 PM


CONTENTS

Securing Your Heroku Application 31


Use a Strong Password for Your Heroku Account 31
Encrypt All Data in Transit 32
Encrypt Sensitive Data at Rest 32
Use Best Practices for Secure Development 32
Don’t Reinvent the Wheel 32
Verify Security and Compliance Needs with
Third-Party Providers 32
Monitor Your Application’s Logs 33
Encrypting Communications with SSL 33
Piggybacking on Heroku’s SSL Certificate 33
Using SSL Endpoint 34
Storing Static Assets and Using CDNs 36
Storing Static Assets on Amazon S3 36
Speeding Up International Applications with Amazon CloudFront 41
Summary 43

CHAPTER 3: PORTING YOUR APPLICATIONS TO HEROKU 45

Understanding Differences from Traditional Filesystems 46


Ephemeral Filesystems 47
Multi-Dyno Applications 47
Considerations for Porting Existing Applications 47
Choosing a Data Store 48
Using Heroku Postgres as a Data Store 48
Using Database.com as a Data Store 49
Using Add-On Data Stores 50
Using a Third-Party Data-as-a-Service Provider 50
Using Multiple Data Stores 51
Considerations for Porting Existing Applications 51
Managing Sessions 51
Understanding Caching 52
Storing Static Assets 54
Managing Configuration Variables 54
Replacing Web Servers and Containers 55
Managing Dependencies 56
E-Mailing from Your Application 57
Running Cron Jobs 57
Understanding Logging 59
Relying on External Programs 61
Scaling Up versus Scaling Out 62
Binding to Ports 62

xvi

ftoc.indd xvi 1/10/2013 1:48:57 PM


CONTENTS

Managing Long-Running Processes 63


Shutting Down Gracefully 65
Moving Your Domain 66
HTTPS over SSL 66
Considerations for Porting Existing Applications 67
Summary 68

PART II: CREATING AND MANAGING HEROKU APPLICATIONS

CHAPTER 4: DEPLOYING YOUR APPLICATIONS TO HEROKU 73

Installing the Heroku Toolbelt 73


Git 74
Foreman 75
The Heroku Client 76
Interacting with Heroku via
the Command-Line Interface 77
The Magic of git push 79
Post Deploy Hooks 80
Navigating the Heroku Dashboard 80
Changing Your Application’s Name 82
Adding Custom Domains 83
Adding Custom Collaborators 83
Scaling Resources 84
Summary 87

CHAPTER 5: MANAGING RELEASES WITH HEROKU 89

Managing Multiple Environments 90


Managing Configuration Variables 94
Securing Development Environments 97
Versioning and Rolling Back Releases 100
Using Deploy Hooks 102
Managing Planned Downtime
and Custom Error Pages 103
Implementing Continuous Integration 107
Summary 114
CHAPTER 6: WORKING WITH ADD-ONS 115

The Heroku Add-On Ecosystem 116


Architectural Considerations 117
Exploring Popular Add-Ons 117

xvii

ftoc.indd xvii 1/10/2013 1:48:57 PM


CONTENTS

SQL-Based Data Stores 118


NoSQL-Based Data Stores 118
Search 119
Logging and Monitoring 120
Installing Add-Ons 121
Installing Add-Ons from the Heroku Dashboard 122
Installing Add-Ons from the Command-Line Interface 125
Creating Add-Ons 127
Summary 131
CHAPTER 7: MANAGING, MONITORING, AND SCALING
YOUR HEROKU APPLICATIONS 133

Adding Custom Domains 133


Viewing Logs and Associated Tools 136
Managing and Tuning Performance 140
Performance Management with New Relic 141
Performance Tuning Guidelines 145
Leveraging the Heroku API 145
Administration Options 146
Mobile 146
Multi-Accounts 149
Heroku Manager 150
Summary 153

PART III: USING A DATA STORE WITH YOUR HEROKU APPLICATIONS

CHAPTER 8: USING HEROKU POSTGRES AS A DATA STORE


FOR YOUR HEROKU APPLICATIONS 157

Getting Started with Heroku Postgres 159


Understanding Continuous Protection 159
Understanding Automated Health Checks 160
Creating a Higher-Availability Database Architecture 160
Creating Databases 161
Forking Databases 164
Creating Database Followers 164
Managing Databases 166
Monitoring Databases 166
Choosing the Right Plan 167
Deleting Databases 168
Backing Up Data 169

xviii

ftoc.indd xviii 1/10/2013 1:48:58 PM


CONTENTS

Importing Data 171


Using Advanced Features 173
Sharing Information with Data Clips 173
Using hstore for Schema-Free Data Storage 174
Cancelling Queries 176
Creating a Sample App 176
Summary 179
CHAPTER 9: USING DATABASE.COM AS A DATA STORE
FOR YOUR HEROKU APPLICATIONS 181

Getting Started with Database.com 182


Creating a Database 183
Importing and Exporting Data 188
Managing Your Database 191
Creating a Sample Application 193
Managing Users 198
Authenticating Users 198
Using Advanced Features 199
Understanding Profiles and Sharing 199
Enforcing Data Integrity with Validation Rules 200
Automating with Workflow Rules 201
Managing Change with Test Databases 202
Storing Files 203
Automating with Apex Triggers 203
Leveraging Social Graphs 204
Summary 204

CHAPTER 10: USING THIRD-PARTY DATA STORES


FOR YOUR HEROKU APPLICATIONS 207

SQL-Based Options 207


MySQL 208
Alternative Postgres — JustOneDB 215
NoSQL-Based Options 217
MongoDB 218
Redis 220
Apache Cassandra 222
Apache CouchDB 224
Attaching Existing Data Stores 226
Summary 229

xix

ftoc.indd xix 1/10/2013 1:48:58 PM


CONTENTS

PART IV: PROGRAMMING ON HEROKU’S POLYGLOT PLATFORM

CHAPTER 11: DEVELOPING WITH RUBY 233

Understanding Ruby 234


Installing Ruby on Your Local Workstation 234
Managing Dependencies 235
Creating an Application with the Rails Framework 238
Writing the Application 238
Signing Up for a Twilio Account 244
Deploying the Application to Heroku 244
Testing the Application 247
Creating an Application with the Sinatra Framework 248
Writing the Application 248
Deploying the Application to Heroku 251
Testing the Application 253
Using Delayed Job for Background Jobs 253
Setting Up Delayed Job 255
Deploying the Application to Heroku 257
Testing Delayed Job 258
Caching with Ruby 261
Porting Ruby Applications to Heroku 263
Summary 265
CHAPTER 12: DEVELOPING WITH JAVA 267

Understanding Java 268


Writing Enterprise Applications on Heroku 268
Installing the Java Development Kit 271
Installing on Windows 271
Installing on Mac OS X 272
Installing on Linux 272
Managing Dependencies 272
Writing a Containerless Application with Embedded Jetty 275
Writing an Application with the Spring Framework
and Hibernate on Tomcat 281
Writing an Application with the Play Framework 286
Deploying a WAR File Directly to Heroku 294
Additional Considerations 295
Porting Java Applications to Heroku 296
Session Management and Caching 297
Memory Management 298
Continuous Integration 298
Summary 298
xx

ftoc.indd xx 1/10/2013 1:48:58 PM


CONTENTS

CHAPTER 13: DEVELOPING WITH OTHER SUPPORTED LANGUAGES 301

Developing with Python 302


Additional Considerations 309
Developing with Node.js 311
Additional Considerations 317
Developing with Clojure 319
Additional Considerations 326
Developing with Scala 328
Additional Considerations 334
Developing with Groovy Using the Grails Framework 336
Additional Considerations 341
Developing Non-Facebook Applications on PHP 343
Additional Considerations 346
Summary 349

CHAPTER 14: UNDERSTANDING BUILDPACKS 351

How Buildpacks Work 352


bin/detect 353
bin/compile 353
bin/release 358
Developing .NET Applications on Heroku 359
Developing Perl Applications on Heroku 362
Packaging Binary Buildpack Dependencies 366
Creating Custom Buildpacks 370
Building the Blassic Binary on Vulcan 370
Creating the Build Scripts 373
Pushing Your Buildpack to a Public Git Repository 376
Creating and Deploying Your Application to Heroku 377
Summary 380

PART V: CREATING A NEW GENERATION OF HEROKU APPLICATIONS

CHAPTER 15: BUILDING MOBILE APPLICATIONS WITH HEROKU 383

Understanding Mobile Development Architectures 384


Native Mobile Applications 384
HTML5 Mobile Applications 386
Hybrid Mobile Applications 387
Using a Central Data Repository for Mobile Applications 388
Writing an HTML5 Mobile Application 389
Creating the Back End 390
Creating the Front End 394
xxi

ftoc.indd xxi 1/10/2013 1:48:58 PM


CONTENTS

Using Toolkits and Add-Ons for Mobile Application


Development 405
StackMob 405
Parse 406
RhoConnect 407
PubNub 409
BoxCar 409
Summary 409

CHAPTER 16: BUILDING SOCIAL APPLICATIONS WITH HEROKU 411

Writing Facebook Applications with PHP 412


Creating a Facebook Canvas Application 412
Writing the Contest App Code 416
Deploying the Application to Heroku 424
Making Heroku Applications Social
with the Chatter API 429
Creating a Shadow Object in Database.com 430
Summary 444

APPENDIX: ADDITIONAL RESOURCES 445

The Heroku Website 445


The Heroku Dev Center 446
Professional Heroku Programming’s
GitHub Repository 447
Log a Ticket with Heroku Support 447
Heroku Ninja 448
Heroku Java 449
Stack Overflow 450
Heroku Community Google Group 451
Heroku IRC Channel 451
Heroku’s Twitter Accounts 452
Heroku’s Official Blog 453
Heroku News 454
Heroku on Facebook 455
Heroku Status 455
Heroku Postgres 456
Heroku Add-Ons 457
Heroku Add-On Provider Site 458
Database.com User Guide 459
Developer Force Integration 460
Force.com Discussion Boards 461

xxii

ftoc.indd xxii 1/10/2013 1:48:58 PM


CONTENTS

Heroku’s Github Site 461


Heroku API Documentation 462
Heroku Partners 463
Heroku Beta Program Sign-Up 464
Heroku Success Stories 464
Heroku on Vimeo 465
Heroku Waza 466
The Twelve-Factor App 467
James Ward’s Blog 468

INDEX 469

xxiii

ftoc.indd xxiii 1/10/2013 1:48:58 PM


Exploring the Variety of Random
Documents with Different Content
"As sure as I can be from your word-painting. Jerry—Judas suits
him much better—is just what you say: an innocent, butter-won't-
melt-in-my-mouth sort of brat who looks like an angel and acts like a
denizen of the infernal regions. And now I remember," went on Dick,
"the little brute spoke to me after you left me when we talked in the
Park. He was then bare-footed and selling matches."

"This boy must be the same," said Bernard, thoughtfully. "He also
had bare feet and carried boxes of matches in his hand."

"It's Judas sure enough!" muttered Conniston, pulling his


mustache and staring gloomily into the fire. "I wonder what he was
doing in that galley? You followed him?"

"Yes, because he mentioned the Red Window. But for that I


should have suspected something wrong. I don't care about
following strange urchins. But only Lucy knew about the Red
Window."

"She might have told Beryl."

"What do you mean?"

"Never mind. Go on with your tale."

"Well, I followed the boy. He kept a little ahead of me, and


several times when I got lost in the fog he reappeared."

"Judas is as clever as his father, the Accuser of the Brethren. How


long were you getting to Crimea Square?"

"Allowing for stoppages, three-quarters of an hour. All the trouble


took place about a quarter to eleven."

"Did you see the Red Window?"

"I saw a red glare in a window on the first floor. I don't suppose
the glass was red, but think some red material must have been
placed over a lamp and that placed close to the window."

"Might have been a blind," mused Dick, "and yet when Beryl
looked and his friend Mrs. Webber they saw no Red Window. Are
you sure?"

"I am certain," responded Gore, emphatically. "When I saw the


Red Window I was convinced that Lucy had sent for me, and,
thinking that she had persuaded my grandfather to relent, I would
have entered the house for a personal interview but that Mrs. Gilroy
came out."

"Could you be seen from the house?"

"I don't think so, the fog was very thick remember."

"Was any signal given?"

Bernard looked hard at his friend. "You think it was a trap?"

"I am certain. Was there any signal?"

"A peculiar kind of whistle. Something like this!"

Gore whistled in a kind of ascending scale shrilly and in a


particularly high key. The effect on Conniston was strange. He
jumped up from his seat and walked hurriedly to and fro.

"Judas," he said. "I remember when I was down here that the
little scamp had a kind of whistle like that—something like it. Listen!"
Conniston whistled also, and Bernard nodded.

"That's it," he declared; "the whistle was given twice."

"Then the boy was Judas. He used to signal to Victoria in that


way when the pair were up to their pranks. Wait!" Conniston opened
the door and whistled loudly in the same way. Twice he did this.
Shortly after the second time the pattering of steps was heard and
Victoria came running up the stairs with a lighted candle in her
hand. She looked white and scared.

"Did you expect to see Jerry?" asked her master, blandly.

The girl stared and turned even whiter than she was. "I thought it
was Jerry, sir," she murmured, leaning against the balustrade. "He
used to whistle like that when he came home!"

"I learned it from Jerry," said Conniston, mendaciously, "and I


tried to see if it would bring you. Go downstairs, girl. There's nothing
wrong."

Victoria stared at Conniston with a suspicious look in her hard


eyes, and then with a toss of her head ran down the stairs. Dick
returned to the room and shut the door. "What do you think now?"

"It was Judas sure enough," said Bernard.

"Of course. And the signal was given to someone in the house to
intimate that you were outside. Who came out?"

"Mrs. Gilroy?"

"Ah! Then she must have been waiting for the signal. By the way,
you always seemed mixed over Mrs. Gilroy. When we first met you
said that she didn't like you. Then you said she was your friend. Now
which do you think she is?"

"I can hardly say. She always pretended to be my friend. I was


never sure of her."

"Then you can be sure of her now. She is your bitter enemy."

"I am afraid so," sighed Gore, remembering the accusation.

"Well," said Dick, resuming his seat, "what next?"


"Mrs. Gilroy came out screeching 'Murder!' She dragged me
upstairs and into the sitting-room——"

"Did you notice if there was a red lamp in the window?"

"No. I was too horrified by the sight of my dead grandfather. I


loosened the handkerchief round the throat——"

"That was a bandana, Sir Simon's own, and was produced at the
inquest. What about the one over the mouth?"

"The one steeped in chloroform? I don't know. I had it in my hand


when Mrs. Gilroy accused me. Then I lost my head. I must have
dropped it."

Conniston looked disappointed. "That's a pity," said he. "I fancied


you might have unconsciously taken it with you. You see, it was a
white handkerchief and Sir Simon never used one of that color. If
there happened to be a name on the corner——"

"It would be that of the assassin. Is that what you mean?"

"Yes, that is what I mean. The assassin must have used his own
handkerchief."

"Why do you think that?"

Dick made an impatient gesture. "Why, it's the most natural thing
he would do," was his reply. "He enters the room, and talks with Sir
Simon. In his pocket he has the handkerchief steeped in chloroform
and uses it unexpectedly. It's as clear as day."

"Why do you think the assassin is a man?"

"I'll tell you that later. Go on."

"There's nothing more to say. Mrs. Gilroy said that I was the
assassin and tried to hold me. The policeman came and arrested
me. Seeing what a fix I was in I bolted."

"You should have stood your ground," insisted Dick.

Bernard rose and in his turn paced the room. "Man alive, how
could I do that?" he said irritably. "The position was dangerous
enough to appal the bravest man. Mrs. Gilroy accused me, saying
that I had been in the kitchen and had left there about six; that I
had returned after ten and killed my grandfather. Also the
housemaid Jane recognized me as the soldier who had been
courting her. Not only that, but she addressed me as Bernard. Can't
you see how strong the circumstantial evidence was and is? I did not
get to Durham's before seven, and I was by myself before that. I
can't prove an alibi then, and I left at ten, after which hour Mrs.
Gilroy said I had come into the house. In three-quarters of an hour
there was ample time for me to kill my grandfather. It is barely a
quarter of an hour's walk from Durham's house on Camden Hill to
Crimea Square. I could not prove an alibi, nor could you or Durham
have helped me. I was at Durham's in the evening, but where was I
before six and after ten? Dick, had I stayed I should have been
hanged. These thoughts flashed through my mind and I made a
dash for liberty, so that I might have time to think out my position.
How I gained this refuge you know. And here I have been thinking
ever since how to extricate myself from the dilemma and prove my
innocence. I can't see how to do it, Dick. I can't see how to act."

"Steady, old boy. Come and sit down and we'll thresh out the
matter."

He led Bernard back to the chair, into which the poor fellow threw
himself with a weary sigh. Conniston could not but acknowledge that
the case against his friend was very strong. As he could not prove an
alibi, the evidence of Mrs. Gilroy, of the cook, and page, and
housemaid, would probably hang him. And also a sufficient motive
for the crime might be found—by the jury—in the fact that Bernard
had quarrelled with his grandfather and had been disinherited. Then,
to perplex affairs still more, Judas had disappeared, and the Red
Window, on the evidence of Beryl and Mrs. Webber, was non-
existent. Certainly the lady declared she saw it, but afterwards she
thought she had been mistaken. In the interval someone must have
removed the red light. But that was a detail which could be argued
later. In the meantime it was necessary to fix, if possible, the identity
of the soldier who had haunted the kitchen and who apparently so
strongly resembled Bernard as to be mistaken for him by Jane.

"It's a plot," said Conniston, at length, while Bernard gazed


despairingly into the burning logs. "This fellow who resembled you
and who took your name is the assassin."

"How do you make that out?"

"Why! He was in the kitchen before six and was sent for by your
grandfather. He at once left. Then he came back after ten and was
admitted by Mrs. Gilroy, who might have made a mistake."

"She could not mistake another man for me."

"I don't know. This fellow evidently was your double, or at least
was made up to resemble you. But that would not be easy," added
Conniston, staring at his friend, "for you have no beard or mustache,
and it is difficult to make up like another chap without such aids. At
least I should think so. And remember the lamp in the hall did not
give a very good light—so Durham told me. The housemaid saw you
only in that light, and therefore might have mistaken you for the
fellow who courted her. Mrs. Gilroy——"

"She saw me in the full glare of the light in the sitting-room. She
recognized me."

"Yes. But according to her evidence she only admitted your


double just after ten and introduced him into the sitting-room. She
did not see him save under the hall lamp."
"That is true. But my grandfather would soon detect the
imposition."

"Quite right," rejoined Dick, smoothly, "he did, and then the
assassin murdered him after stifling him with the chloroform."

"But you forget my grandfather was a passionate man. He might


and probably would have made a scene. Mrs. Gilroy below would
have heard the row and would have come up."

"She may be lying when she declares she heard nothing,"


admitted Dick. "On the other hand, the assassin may have crossed
directly over to your grandfather and have stifled his cries by placing
the handkerchief at once over his mouth. Then he could strangle him
at his leisure and clear out, as he did."

"And then Mrs. Gilroy runs up, finds the dead, and rushes out to
accuse me. I must have been brought in the nick of time," said
Bernard, ironically. "No, Dick, there's more in it than that. Mrs. Gilroy
is in the plot whomsoever contrived it."

"Why, Beryl contrived it. He wanted the money."

"Was he in the house at the time?"

"No. He didn't commit the crime himself, if that is what you mean.
He with Miss Randolph was at the Curtain Theatre, which is near
Crimea Square. He drove up in his friend's Mrs. Webber's carriage
just when the row was on."

"Yes." Bernard passed his hand across his forehead. "I should
have remembered that. I was in the hall at the time with the hand of
the policeman on my shoulder. But I have grown so confused, Dick,
that it's all like a dream."

"A nightmare rather. But why do you think Mrs. Gilroy is——"
"Is in the plot. Because, before she accused me, she said to
herself, but loud enough for me to hear, 'It's the only way!'"

"Ha, ho!" said Conniston, excited, "you can swear to that."

"Of course I can. But I can't swear in the dock, and that is the
only place I'm likely to occupy should I be caught."

"Is Mrs. Gilroy a friend of Beryl's?"

"I can't say that she was ever anyone's friend. She even seemed
to hate my grandfather, although he was so good to her. She and
Lucy were always quarrelling, and though she behaved civilly to me,
I was—as I said before—never sure of her."

"You can certainly be sure of her now. But I can't help thinking
Beryl had something to do with this plot. He had a lot at stake. I
have heard tales about his gambling that would open your eyes.
Durham made it his business to find out when he heard that Sir
Simon intended to disinherit you in favor of Beryl."

"Durham has always been my friend," said Bernard, wearily. "But


as Beryl was out of the house he can't have anything to do with the
crime."

"I'm not so certain of that. He might have set things in train, and
then have arranged the theatre business so as to provide himself
with an alibi."

"You think he hired someone to represent me?"

"I do, though, as I say, it would be hard for anyone to disguise


himself like you. You haven't a double, have you?"

"Not that I ever heard of," said Gore, unable to restrain a smile;
"but they say everyone has a double."
"Well, we must hunt out yours. If we find the soldier who
resembled you, and who called himself by your name, we will be
able to prove that he committed the crime."

"But how can you go to work?"

"I hardly know, Bernard. I must ask Durham. Meantime you can
stay here. And there's Judas. I'll make it my business to hunt him
out. I daresay he was employed by Beryl also."

"How you harp on Beryl."

"Because I am sure he has everything to do with the matter. It


was a carefully-arranged trap, and you have fallen into it. What Mrs.
Gilroy expects to gain I can't think. However, Beryl has found himself
mistaken over the money. The new will—so Durham told me to tell
you—was burnt by the old man, and so the old one, giving you all,
stands. Both Mrs. Gilroy and Mr. Beryl are left out in the cold. And
that is all the better for your safety."

"Why?" asked Bernard, looking puzzled.

"Because the person they hired to do the business—your double—


will expect to be paid a large sum. If not, he will round on them."

"You forget. If he confesses he puts a rope round his own throat


according to your theory."

"True enough. But there's Judas. He'll have his pound of flesh, or
make an unholy row."

"Dick," said Bernard, seriously, "it's impossible that a lad of


thirteen can be such a villain as you make him out to be."

"I tell you that lad is a born criminal, and if he goes on as he is


doing he'll come to the gallows, where, according to his
grandmother, his forefathers suffered before him. Judas is as
cunning as a fox, and very strong as to his will. Also, he is greedy of
money——"

"You describe a man of experience."

"I don't know where Judas got his experience," said Conniston,
coolly, "but as Mrs. Gamp said of Bailly, junior, 'All the wickedness of
the world is print to him.'"

"I can't believe it of such a lad."

"You'll have an opportunity of testing it some day," retorted the


young lord. "I only hope Victoria doesn't correspond with Judas. If
she does, she'll tell him about a stranger at Cove Castle, and Judas,
having seen you with me in the Park, will be quite sharp enough to
put two and two together. Then there will be trouble."

"But why should he connect me with the crime unless——"

"Unless he knows all. He does. You are a marked man, Bernard.


However, it's getting late. We'll talk of this to-morrow. I must go and
see Durham, and bring him down ostensibly for shooting."

"I wish you would bring Alice over," said Bernard. "My heart aches
for a sight of her sweet face."

"And dearly her face has cost you," said Conniston. "However, I'll
ask my dear aunt to come over, and bring Alice. As Miss Berengaria
is a relative, it will be thought nothing out of the way. We'll save you
yet, Bernard; only I wish we had that one piece of evidence—the
handkerchief you lost. When that is found we shall know who is
guilty."
CHAPTER XI
MRS. GILROY'S PAST
After making Lucy the mistress of the Hall until the return of its
legal master, Mark Durham returned to town. Having regard to the
fact that Beryl had taken up his quarters at the Conniston Arms—for
what purpose the lawyer could not determine—he thought it wiser
not to arouse the crafty young man's suspicions by a visit to Cove
Castle. Certainly this was a somewhat over-strained sense of
caution, since, being Conniston's lawyer, he could easily have gone
there without it being thought odd. But Durham knew that Julius,
driven to desperation by the loss of the fortune, would stop at
nothing to accomplish his wish to obtain it. Did he learn that Bernard
was still alive he would undoubtedly blackmail him. And in the
present position of the case, when the truth could not be arrived at,
Bernard, for his own safety, would be obliged to make terms. And
such terms as Beryl would demand could not be granted.

Durham therefore returned to his business, and at once set to


work. So far he had done all that he could to settle the government
of the property during Gore's absence, and it now remained to take
such steps as would unravel the intricacy of what appeared to be a
plot to oust him from his rights. That Julius was at the bottom of the
whole affair Durham was certain, and that Julius had his eye on him
he conjectured. Therefore it behooved him to move cautiously lest
Beryl should counterplot him. And as in this game, which dealt with
the issues of life and death, Durham's cards were all on the table
and Beryl's were concealed, the chances of victory lay with the latter.
And if Julius won, he would certainly have no mercy. Conniston had
written a letter directed to the London office stating in full the
conversation which had taken place between him and Sir Bernard.
Durham was therefore in full possession of all facts not known to
Julius, and after turning over these in his mind he concluded that it
would be best to start with an examination of Jane Riordan, the
delinquent housemaid. She could not possibly be in the plot, as he
had seen how simple a woman she was when at the inquest.
Therefore she certainly, for some strange reason, believed Bernard
to be the young soldier who had courted her. She had sworn to his
photograph, and had addressed him in the hall of the Crimea Square
house by his name. Apparently—here Durham thought with
Conniston—some person had been impersonating Bernard, so the
lawyer sent a message to Miss Riordan asking her to call. Then he
intended to question her as to the personality and speech of the
double.

The housemaid arrived dressed in her best and looking rather


downcast. She was evidently nervous, and could not think what the
lawyer wanted with her. Like all her class she had a wholesome
horror of legal procedure, and always kept out of the clutches of the
law. But it appeared that for her share in receiving a follower she
had been dismissed by her master, Mr. Jefferies. Being without a
situation she grasped at the chance afforded of seeing Durham, and
hoped by working on his sympathies to secure a new one. But for
this want she would probably have refused the invitation. As it was
she duly appeared, and was accommodated with a seat beside
Durham's desk. He then proceeded to question her, thinking a plain,
straightforward examination would best get at the truth.

"Now then," said Durham, wheeling round his chair so that he


could look her in the face. "You know I am the solicitor of Sir
Bernard Gore, who is accused of the murder of his grandfather. In
spite of the evidence given, I do not believe he is guilty."

"I don't think so either, sir," sobbed Jane, who had got out her
handkerchief at the mention of the name.

"You never knew him."


"Yes, I did. He courted me for nearly a month. And a sweet young
man he was, the very best I ever walked out with."

Durham eyed her keenly. Apparently she was speaking as she


believed, and he considered that the double must resemble Bernard
in a marvellous degree to make the housemaid thus sure of his
identity with the accused young baronet. "You misunderstand me,"
he said mildly. "However, I'll come to the point presently. You must
answer me as though you were in a witness-box."

"Yes, sir," said Miss Riordan, timidly. "But, please, before I speak,
could you help me to a new situation? Mr. Jefferies dismissed me
because I walked out with Bernard and received him in the kitchen."

"Hum," said Durham, reflectively. He did not know very well what
to say at the outset as he was by no means prepared to promise to
assist her off-hand. But on consideration he saw the necessity of
keeping so valuable a witness under his own eye and away from
Beryl, always supposing Beryl to be mixed up in the matter. He
therefore made up his mind swiftly, and in his answer gained Jane's
goodwill. "Yes, I can help you," he said; "my housekeeper wants a
housemaid. I will give you my address and a letter to her. Go to
Camden Hill and if your character is satisfactory she will engage
you."

"Oh, thank you, sir," said Jane, effusively. "I'm sure my character
is all that can be desired, save in this last trouble. But Bernard was
such an agreeable——"

"There! there!" interrupted Durham, cutting her short, "we won't


talk of that just now. This last episode of your career will not stand
in the way of my housekeeper engaging you. I'll make that clear to
her in my letter. Come now, will you answer my questions?"

"Yes, sir. Any you like to ask," said Jane, delighted at the granting
of her petition, and privately thinking Durham a sweet gentleman.
"Good!" said the lawyer in an official manner. "What is your
name?"

"Jane Riordan."

Durham noted this and her other answers down.

"You were how long at Mr. Jefferies?"

"Six months, sir."

"When did you first see this soldier?"

"Bernard, sir. In the Park, about a month before Sir Simon came."

"How did he become acquainted with you?"

Jane giggled and looked down. "Well, sir," she said, blushing, "I
am not bad-looking and Bernard—"

"He called himself Bernard?"

"Yes, sir. He said he was a corporal in the Imperial Yeomanry. He


had seen me in Crimea Square."

"In this house?"

"No, sir. Leaving the house. He said he had come several times,
being taken with my looks, and that he always wanted to know me.
As he was so handsome, sir, and spoke so civil, we walked out. He
treated me to tea in the Park, and then I asked him to meet cook.
He accepted at once, sir, and most willingly."

"I daresay," muttered Durham, seeing in this meeting how the


scamp had forced his company on the girl so as to enter the house
likely to be occupied by Sir Simon. "And he came?"

"Many times, sir—oh! many times, and made himself so agreeable


that cook was quite jealous."
"Who did he say he was?"

"Well, sir, he did nothing but hint, saying he was a gentleman of


high rank, as could be seen from his manners, and that he had
enlisted because of a quarrel he had with his grandfather. But I
never knew he was Sir Simon's grandson until I lost him," sobbed
Jane. "Oh, dear me, and to think I would have been Lady Gore, with
diamonds and fine clothes, had he lived."

"Hum!" said Durham, digging the point of his pencil into the
blotting paper, "so he practically told you the story of Sir Bernard."

"Yes, sir, as I afterwards learned it. And wasn't that natural, sir,
seeing he was Sir Bernard?"

"Are you sure he was?"

Jane stared. "Why, sir, he was always frightened when Mrs. Gilroy
came down to the kitchen and said she was his enemy, and that if
she saw him he could never marry me. I didn't know what he meant
at that time, but I see now. She would have said who he was. I used
to hide him in cupboards, and once in the coal cellar. Cook and
William never told, being sympathetic like!"

"Did he speak in educated manner?"

"Like the gentleman he was, sir, having been educated at Eton."

"When you saw him in the grasp of the policeman did you
recognize him? Was he the same man who courted you?"

Jane stared again and looked puzzled. "There isn't two, sir, that I
know of," she said; "and now," with a fresh burst of tears, "there
isn't one, seeing he is drowned. Oh dear, dear me. Yes, sir, I knew
him at once, although the light was bad. And when I would have
seen him plainer, Mrs. Gilroy would not let him be brought under the
lamp."
"Oh, indeed," said Durham, making a note of this. "Look here,"
and he held out a large portrait of Bernard, different to that shown
at the inquest. "You recognize this, I suppose?"

"That's my Bernard, sir."

"Is it a good likeness?"

Jane examined the photograph closely. "Not what I'd call a very
good one, sir, neither was the other. There's a look wanting."

"What sort of a look?"

"Well, sir, you might call it a roguish look, of a gentleman who


had seen life and had been gay. This portrait is sad and horrid
looking. I should have been afraid to be courted by Bernard if he
had looked like this. But he was always bright and full of larks. Then
he has not got a spot on his chin as he has here. I suppose he cut
himself shaving when he had this done."

Durham started. Here was a means of identification. Bernard had


a rather large mole on the left of his chin. "Didn't the man who
walked out with you have this spot?" he said, purposely adopting the
word she had used.

"No, sir. He had a chin like a new-born infant, smooth and white."

"Did he ever write you a letter?"

Jane blushed again. "Just a short note making an appointment,


sir," she said, feeling in her breast, "it being early for love letters,
and me being a most respectable young lady. I carry it next my
heart."

Durham took the note she handed him without hesitation, and
glanced through it. The writing was not unlike that of Bernard's, yet
he saw very plainly that it lacked several characteristics which
distinguished that of Gore. The note simply asked Jane to meet the
writer on Sunday at the Marble Arch, and was signed "Bernard."

"I'll give you a sovereign for this," said Durham, quietly.

"Thank you, sir," said Jane, accepting without a moment's


hesitation. "Of course, Bernard's dead now, so there's no use
keeping his letters, but if he'd been alive I'd have kept them on the
chance of his not making me Lady Gore!"

"Did he wear any rings?" asked Durham, paying the money and
putting the letter away.

"Three, sir. Two gold and one silver."

This was another point of difference. Bernard hated rings and


never by any chance wore any, not even a signet ring. But by this
time Jane's information was exhausted, and Durham concluded her
examination for the moment. He would be able to resume it later
when necessary, and congratulated himself on the fact that he had
secured Jane as his housemaid. When brought face to face with the
real Bernard she would be able to see the difference between him
and his double. And then she might also be able to recognize the
double should he be found. Just as he was dismissing Jane with a
letter to his housekeeper a clerk brought in a name written on a
piece of paper. "Mrs. Gilroy," said Durham to himself, wondering
greatly. "Tell her to come in," he said aloud, and ushered Jane out
quickly by another door. It would never have done to have let Mrs.
Gilroy meet her, seeing that the Hall housekeeper was hostile to
Bernard. So Jane departed rejoicing, and Durham went back to his
desk well satisfied.

"Bernard never wrote this note, as it is different in many ways to


his writing," he murmured. "Bernard never wears rings, and he has a
mole on his chin which this double apparently lacks. Without doubt
the impersonation has been very clever. But I wonder how I am to
find the double."
Before he could reply to this perplexing question, the clerk
showed in Mrs. Gilroy, as demure and sly-looking as ever. She was
richly dressed in black silk, much better dressed in fact than she had
ever been during the life of her master. Also Durham noted that
there was an aggressive air about her which he had not noticed
before. Perhaps this was due to her receipt of an annuity. She was
not a lady, and yet she could not be called common. Durham had
never examined her carefully before, but now that she was
dangerous to Gore's interest he looked at her carefully. A strange
woman and a dangerous was his verdict. He proceeded to feel his
way cautiously, wondering what she had come about.

"It's to see me about your annuity?" he said, tentatively.

"Yes," replied Mrs. Gilroy, coldly, and took the seat which had
been vacated by Jane. "My beggarly annuity?"

The lawyer, who had taken up his position before the fire with his
hands under the tails of his frock coat, turned to look at her. The
bitterness of the tone startled him. "What do you mean?"

"Mean!" echoed Mrs. Gilroy, with a vindictive glitter in her pale


eyes. "That Sir Simon promised me five hundred a year for life."

"Oh, you must be mistaken," said Durham, quickly. "He never said
you were to have more than one hundred."

"He might not to you, but he did to me," said the housekeeper,
doggedly. "I have a right to five hundred."

"I think not," said the lawyer, calmly. "And let me tell you, Mrs.
Gilroy, that Sir Simon did not place your name at all in the second
will. Had it been executed, you would not have had even the one
hundred you despise. Therefore, you may congratulate yourself"—he
watched her face while speaking—"that Sir Simon changed his mind
about disinheriting his grandson."
The woman's eyes glittered still more maliciously and a color rose
in her bloodless cheeks. "Oh!" she said, with icy disdain, "so Sir
Simon would have deprived me of my rights, would he? It's lucky
he's dead, or he'd find himself on the wrong side of the hedge with
me."

"Ah!" Durham resumed his seat and waited to hear what would
come forth. And something would come out not easily attainable at
other times, for Mrs. Gilroy was apparently losing her temper. This
was most extraordinary for her, as she was usually cautious. But
since the death of her master, who had kept her in check, she
seemed to be a much more reckless woman. The lawyer had always
wondered what bond held Sir Simon and the housekeeper together,
and now there seemed some likelihood that he would learn, if he
held his tongue and allowed full play to that of Mrs. Gilroy.

"I knew how it would be," she muttered. "I guessed he would
play me false. He never was worth a kekaubi."

"You are a gipsy," said Durham, looking up.

"What makes you say that?"

"Kekaubi is Romany for kettle. You wouldn't use it unless—"

"Who I am is nothing to you," interrupted Mrs. Gilroy, sharply.

"Yet you don't resemble the Romany!" said Durham, looking at


her drab appearance. "Your eyes are pale and your hair—"

"Let my appearance be, Mr. Durham. I am here for justice, not to


hear my looks discussed. Sir Simon left me one hundred a year. I
want you as the executor of the estate to make it the five hundred
he promised me."

"I don't know that he promised you that sum," said the solicitor,
"and even if he did I cannot give it to you. The money now belongs
to Sir Bernard Gore."
"He is supposed to be dead."

"You put it rightly," replied the man. "He is supposed to be dead,


but until his dead body is found I will administer the estate on his
behalf. But I have no power to help you."

Mrs. Gilroy seemed struck by this view of the case. "Suppose Sir
Bernard isn't dead?" she asked.

Durham felt a qualm and suppressed a start with difficulty. Had


this dangerous woman discovered the fugitive at Cove Castle. "Do
you know if he is alive?" asked Durham, quietly looking at her.

"Perhaps," said Mrs. Gilroy, who seemed to be thinking. Then she


rose. "I don't know that I need bother you further," she said.

"Will you tell me why you demand this money?"

"Because Sir Simon promised it to me."

"On what grounds."

"On very good grounds."

"Will you tell me what they are?"

"Will you give me the five hundred a year if I do?" she countered.

"That is out of my power. When Sir Bernard appears I will speak


to him on the subject if your claim is a good one."

"My claim is an excellent one," she burst out, raising herself to


her full height. "It is the claim of a wronged woman!" She paused. "I
want to ask you about the will," she said. "Is it worded that the
money is left 'to my grandson.'"

"To my grandson Bernard Gore."

"The name is mentioned."


"It is. The money is clearly left to Sir Bernard."

"Sir Bernard," she sneered. "Why give him a title to which he has
no claim? The money may be his, else I would not tell you what I
now do tell you. My son is the baronet—my son Michael."

Durham stared at her, quite taken aback. "What on earth are you
talking about, Mrs. Gilroy?" he demanded.

"Mrs. Gilroy," she echoed with scorn. "I shall no longer use a false
name. I am Mrs. Walter Gore."

"Impossible. Walter Gore was married to Bianca Tolomeo!"

"He was married to me first," said Mrs. Gilroy, rapidly. "Yes, you
may stare, but I am the lawful wife of Walter Gore and my son
Michael is the heir. He is the image of his father. There's no trickery
about the matter."

"The image of his father," cried Durham, a sudden light breaking


in upon him. "And Walter Gore was tall, slim, the image of his son
Bernard. Mrs. Gore, or Mrs. Gilroy, or whatever you call yourself, was
it your son who murdered his grandfather?"

The woman became livid. "No, I swear he didn't. He is in


America."

"He is in England, and he masqueraded as Bernard when courting


Jane the housemaid," said Durham, excitedly. "You say yourself he
resembled Walter Gore. Bernard is exactly like his father, so Michael
must resemble him sufficiently to pass as him."

"It is absolutely false!" cried Mrs. Gilroy, seeing she had fallen into
the trap of her own words. "My son is in America. You shall not
prove him guilty. I opened the door to Bernard."

"To Michael. You perhaps mistook him for Bernard."


"A mother can't mistake her own son. But Michael is the heir. I
shall write to America and bring him home. I can prove my marriage
with Walter Gore."

"Do so by all means," said Durham, recovering his wits. "I am


acting for Sir Bernard, and he shall not lose the title if I can help it. I
see you are playing a deep game, Mrs. Gilroy, but you have let out
too much. I shall now search for Michael, your son, and see if he
was not in London on the night of the twenty-third of October."

Mrs. Gilroy, pale and looking like a tigress at bay, drew back to
the door without a word. Before Durham knew of her intention she
opened it and slipped away. He did not seek to detain her.
CHAPTER XII
THE NEW PAGE
Things went very smoothly at Gore Hall after Durham had
established Lucy as its mistress during the absence of Bernard. The
girl herself firmly believed that her cousin was dead and assumed
deep mourning. She had been fond of Bernard in a sisterly way, and
felt his loss deeply. It was her outspoken affection that provoked a
quarrel between her and Julius, and which led to the breaking of
their engagement. Lucy had a high temper, which had been kept in
subjection during the life of Sir Simon. But now that she tasted the
sweets of power she was not disposed to allow Julius to treat her as
he chose.

Mrs. Gilroy came back from her visit to the lawyer in rather a
dejected frame of mind. She saw that she had gone too far and had
given Durham an inkling as to the possibility of Michael having
masqueraded as Bernard. The housekeeper had thought her position
unassailable, knowing that she had married Walter Gore; and
although there was a flaw in the circumstances upon which she built
her claim, yet she trusted to her own cleverness to conceal this from
the too-clever lawyer. But, apart from this, the fact that he
suspected someone of passing himself off as Bernard startled her,
and opened an abyss at her feet. On leaving the office she judged it
best to lower her crest for the moment and to wait patiently to see
what would transpire. Mrs. Gilroy was a well-educated woman and
very astute, therefore she hoped to gain her ends by craft if not by
force. So far she had failed, but she did not intend to abandon her
claim for one failure.
As it was, she came back to the Hall and behaved herself much
better than she had ever done before. She was respectful to Lucy,
and did not display her impatience of commands that she had
hitherto done. No one could have been meeker, and although Miss
Randolph did not like or trust the woman, she had no fault to find
with her in any way.

Lucy suffered severely from the shock of Sir Simon's tragic death,
and from the supposed death of Sir Bernard. In fact, the matter so
preyed on her nerves that she became prostrate, and Dr. Payne had
to be called in. He was a handsome and popular young doctor who
had practiced in Hurseton. As this was the first time he had been
called to the Hall, he was naturally very pleased, and was very
attentive.

"A complete rest is what you need," he said to Miss Randolph. "I
think you should keep to your bed as much as possible, and I will
give you a tonic. Naturally you suffer from the terrible circumstances
of Sir Simon's death." He thought a moment and then continued, "A
cheerful companion would do you good. Shall I ask Miss Malleson to
come over."

"Is she cheerful?" asked Lucy languidly. "I fear not, doctor. She
was engaged to my cousin, and his death has made her sad."

"Probably, but she bears up wonderfully. But that she is in


mourning one would hardly guess she had sustained such a loss.
Was she very much attached to Mr. Gore?"

"Yes. I never saw a more attached couple. Did you ever meet
him?"

"Once at Miss Plantagenet's. You know I am great friends with the


old lady. I often visit her, not professionally, for she is as healthy as a
trout in a pond."

"Is Alice—Miss Malleson also well?"


"In very good health, and appears resigned to her loss."

"I should have thought she would have felt it more," said Lucy,
perplexed. "Alice has such a tender heart."

Dr. Payne was doubtful. So far as he saw, Miss Malleson was


remarkably cheerful under her sorrow. "She is philosophic, Miss
Randolph, and that is wise. I think, however, if you would have her
over to see you, it would do both her and yourself good."

"I shall write a note to her to-day," said Lucy. "I am very fond of
her, and we get on very well together. Poor Alice. I wish Bernard had
lived, so that he could have married her."

"From what I read in the papers it is just as well Mr. Gore did not
live," said Payne, rising to take his leave. "If he was guilty—"

"Ah!" said Lucy, raising herself with animation from the sofa upon
which she was lying. "If he was guilty. There it is, doctor. I do not
believe he was. Bernard had a high temper, but he could not always
control it, and was a kind-hearted boy. He is innocent I am sure."

"How are you sure, my dear Lucy?" asked a third voice, and she
looked up to see Julius standing in the doorway. He came forward.
"Forgive me if I heard a few words of your conversation. But I have
just come in. Dr. Payne, I hope I see you well."

"Quite well," said the doctor, who did not like Beryl, thinking him,
in schoolboy phrase, "a sneak." "I am just going, Mr. Beryl."

"Are you ill, Lucy?" asked Beryl, with affection.

"I have an attack of nerves," she replied pettishly. "Poor Bernard's


death has shaken me."

"It is just as well he did die, though."


"I have been saying that," said Payne; "but I must take my leave.
I will come and see you again, Miss Randolph, and remember what I
told you. Rest and cheerful company—Miss Malleson's for choice."

He departed smiling, and they heard him gallop off. When the
sound of the horse's hoofs died away, Julius, who was looking out of
the window, turned abruptly to Lucy. "Why do you think Bernard is
innocent?" he asked.

"Because, if he is guilty, his action gives the lie to his whole life,
Julius," she replied, raising herself on her elbow. "I can't believe he
killed my uncle."

"Sir Simon is not your uncle," said Beryl, jealously. "You are only a
distant relative."

"Perhaps my marriage with you may make me a nearer one."

"If we ever do marry," said Julius, gloomily.

"So far as I am concerned I should like to break the engagement,


Julius. We were never suited to one another."

Beryl's vanity was hurt. "Why did you accept me then?"

"What else could I do? It was Sir Simon's wish that we should
marry, and, owing to my circumstances, I had no choice in the
matter. During his life I was merely a puppet. But you do not care
for me."

"I do. I swear I do."

"Although you swore for an hour, I should never believe you.


There is only one thing in this world you love, Julius, and that is
money. You told Sir Simon about Bernard being in love with Alice,
that the poor boy might be disinherited."
Beryl did not deny the charge. "I believe you are in love with
Bernard yourself," he said.

"No. Bernard and I are like brother and sister. But he is dead, so
you need not cast stones at his memory."

"Are you sure he is dead?" asked Beryl, warming his hands.

Lucy sat up on the sofa and pushed the loose hair back from her
forehead. "Why do you say that?" she asked sharply.

Julius stared at the fire. "I can't understand Durham's attitude,"


he said evasively. "He must know that Bernard is dead, seeing that
the coat and hat were found on the banks of the river. No man could
have lived in the cold and the fog. Yet if Durham was sure he would
not hold the estate against Bernard's coming."

"Mr. Durham requires proof of the death," rejoined Lucy, sharply;


"and until then, he is bound to administer the estate according to
the will. As Bernard's body has not been found, there is always a
chance that he may have escaped."

"I sincerely trust not."

"Ah! You always hated Bernard."

"On the contrary, I speak for his good. What's the use of his
coming to life when he must suffer for his crime?"

"I don't believe he committed it," said Lucy, doggedly.

"You have no grounds for saying that," said Julius, pale with rage.

"I don't need grounds," retorted the genuine woman. "Bernard


always was as kind-hearted as you were—and are, the reverse."

"I am not hard-hearted," snapped Beryl. "I always do good—"

"When it is to your own benefit."


"Not always. For instance, I am down here to get a small boy a
post with Miss Plantagenet as a page."

"That is very good of you," said Lucy, scornfully.

"Ah, you see I can do a kind action. This boy is a grandson of


Lord Conniston's housekeeper, Mrs. Moon."

"At Cove Castle," said Lucy, with some color in her face. "I know."

"Do you know Lord Conniston?" asked Julius suspiciously.

"I have met him once. He seems to be a most delightful fellow."

"What a delightful speech for a lady," said Beryl. "Conniston is a


scamp. I heard he enlisted in the Lancers."

"It shows how brave he is. Every man worth calling a man should
go to the front."

"Perhaps you would like me to go," sneered Julius.

"You would never have the pluck," said Lucy, quickly. "All your
ends in life are gained by cunning, not by bravery."

"Lucy, if you talk to me like that—" began Beryl, and then


restrained himself with an effort. "It is no use our quarrelling. Let me
show you that I am not so careless of others or so hard-hearted as I
seem to be. Miss Plantagenet wants a page. I found this lad in
London selling matches. He was a messenger boy at a tobacconist
called Taberley, and Lord Conniston got him turned out of the
situation."

"I don't believe that."

"It is true. The boy told me himself. He will tell you if you like to
see him."
"I don't want to see him. Lord Conniston is too kind a man to
behave in that way. He was fond of Bernard."

"And that makes him perfect in your eyes," said Beryl, looking
savage. "See here, Lucy, Conniston has left the army—so you see he
is not so brave as you think."

"He left so as to seek after Bernard," said Lucy, quickly. "Mr.


Durham told me so."

"To seek after Bernard," said Julius, slowly, "and I believe Bernard
may be alive after all."

"In which case you would give him up to the police."

"No," said Julius with an emotion which did him credit, "I should
never betray him. Lucy, if you can find out from Lord Conniston or
Durham that Bernard is alive, let me know and I'll see what I can do
to help him."

"How can you help him when you believe him guilty?"

"I might help him to escape. I don't want to see him hanged."

"He won't be hanged if Lord Conniston and Mr. Durham can save
him."

"Ah!" Julius started to his feet. "Then he is alive."

"I can't say. I have no reason to think he is. But I am hoping


against hope," said Lucy, rising. "I merely state what was said. Mr.
Durham and Lord Conniston both told Alice that Bernard was
innocent."

"They will find it difficult to prove that," sneered Beryl, with a


white face. "I believe the fellow is alive after all. If he is I'll make it
my business to find out where he is."
"And then?" asked Lucy, starting up and facing Beryl.

"Then it depends upon Bernard himself."

"Ah! You would make him pay money to save himself."

"I have a right to a portion of the estate."

"You have not," said Miss Randolph, clenching her fists and all her
languor gone. "Bernard is the owner of Gore Hall and of all the
property, and of the title also. If he is alive, as I sincerely hope, his
name will be cleared."

"And then you will throw me over and try to become Lady Gore."

"I throw you over now," said Lucy, losing her temper and coloring
hotly. "How dare you speak to me like this, Julius! I will no longer be
bound to you. I never loved you, but I have always tried to see the
best side of you. But you have no good side. You are a mean,
cowardly serpent, and if Bernard is alive I shall do my best to defend
him from your snares."

"But Lucy—"

"Don't speak to me, and don't dare to call me again by that name.
I give you back your ring—here it is!" She wrenched it from her
finger. "Now leave the house, Mr. Beryl. I am mistress here."

Julius looked at the ring which she had thrown at his feet, and
laughed. "You take a high tone," he said sneeringly. "But remember
that if Bernard is dead the money goes to charities—"

"So much the better. You do not get it."

"Nor you either. You will have to turn out of this luxurious home
and live on the pittance Sir Simon left you."

"Would I be better off if I married you?"


"I think you would. I have not much money now, but I will have
some—a great deal some day."

"By blackmailing Bernard," said Lucy, indignantly.

Julius picked up the ring and slipped it into his waistcoat pocket
calmly. "We don't know that Bernard is alive. But the fact of
Conniston leaving the army and from Durham's attitude I shrewdly
suspect he is, and in hiding. I shall find out where he is, and then it
depends upon him whether he is hanged or prefers to live abroad on
a portion of his money."

"The lesser portion. I know the price of your silence," said Lucy,
vehemently. "You will want the Hall and a large income."

"All I can get," rejoined Beryl, quietly. "And you have refused to
share my fortune with me."

"Yes. I will have nothing to do with you. And remember that if I


catch you plotting I will tell Mr. Durham."

"You can tell him the whole of this conversation," snarled Beryl. "I
am not afraid of Durham. If Bernard is alive, he'll have to pay up or
be hanged."

"He is innocent."

Julius shrugged his shoulders and walked to the door. There he


paused to utter a final insulting speech. "I don't know whether you
intend to marry Bernard or Lord Conniston," he said, "but I wish,
which ever it is, joy of a spitfire."

"And an honest woman," said Miss Randolph, wrathfully, for the


reference to Conniston touched her nearly; "but you go too fast. You
can't yet prove that Bernard lives."

"I go to do so," sneered Julius, and bowed himself ironically out


of the room, leaving Lucy furious both with him and with herself.
She was angry with herself because she felt that in speaking of
Conniston she had colored. And as a matter of fact she greatly
admired the young lord, even though they had only met once, for
Conniston was one of those irresistible men who appeal to women.
Lucy thought—but it matters little what she thought. All she knew
was that her engagement to Julius, which had always weighed on
her conscience, was at an end. "I am free now—free," she said,
stretching her hands. "Oh, what an escape I have had from that
wicked man. He has shown his hand too plainly. I will put Mr.
Durham on his guard, and"—here she blushed—"and Lord
Conniston."

Julius, walking towards the Bower, was also angry with himself. As
Lucy thought, he had shown his hand too clearly. "It would have
been better," he considered, "to have held my tongue. I should have
done so had she not goaded me into speech. She will tell Durham
and that interfering Conniston and put them on their guard. Well"—
he laughed and looked at the small boy trotting beside him—"I am
equal to both."

The boy was a handsome, innocent-looking little fellow, rather


undersized. With his clear skin, his fair hair and wide blue eyes he
looked like the conventional picture of a cherub. No one would have
suspected that such a childish creature was a born criminal. But his
mind had not yet had time to work on his face, and the mask of his
childhood—for he was only thirteen—concealed his evil nature
successfully. In a few years, when his passions worked their way
through the mask, his face, now so smooth and innocent, would be
wrinkled and sinful. His mind would have marked plainly its signet on
the smooth surface. But at present he looked charmingly innocent,
although he already knew much more about life than was good for
him. Julius, in order that the lad might make an impression on Miss
Plantagenet, had dressed him in a new suit, and pleased with
himself—for much of the boy remained in this precocious criminal—
young Jerry trotted along smiling.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like