The Valley of Fear is the fourth and final Sherlock Holmes novel by Sir Arthur Conan Doyle. It is loosely based on the Molly Maguires and Pinkerton agent James McParland. The story was first published in the Strand Magazine between September 1914 and May 1915. The novel starts with Sherlock Holmes receiving a cipher message from Fred Porlock, a pseudonymous agent of Professor Moriarty. After Porlock sends the message, however, he changes his mind for fear of Moriarty's discovering that he is a traitor. He decides not to send the key to the cipher, but he sends Holmes a note telling of this decision. From the cipher message and the second note, Holmes is able to deduce that it is a book cipher and that the book used for the encryption is a common book, large (with at least 534 pages), printed in two columns per page, and standardised. An almanac fits these conditions exactly. Holmes tries the latest edition of Whitaker's Almanac, which he had only received a few days earlier, and fails; he then tries the previous edition. With this almanac, Holmes is able to decipher the message as a warning that "some devilry is intended against one "Douglas", a country gentleman residing at Birlstone House. Unlike many of the other Holmes novels, mostly linear entertainments, Doyle crafted The Valley of Fear as "two parts and a coda and carefully stage managed the elements of fear and terror". Famous works of the author Arthur Conan Doyle: A Study in Scarlet, The Sign of the Four, The Adventures of Sherlock Holmes, The Memoirs of Sherlock Holmes, The Hound of the Baskervilles, The Return of Sherlock Holmes, The Valley of Fear, His Last Bow, The Case-Book of Sherlock Holmes, Stories of Sherlock Holmes, The Lost World.