<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>M. E. Patterson - Author, Geek</title>
	<atom:link href="http://mepatterson.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://mepatterson.net</link>
	<description>bestselling author of Devil&#039;s Hand, a supernatural thriller; writer of fictions and web software</description>
	<lastBuildDate>Sun, 18 Dec 2011 23:19:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<!-- google_ad_section_end --><!-- google_ad_section_start -->	<item>
		<title>Devil&#8217;s Hand sales numbers: Dec 2011</title>
		<link>http://mepatterson.net/2011/12/devils-hand-sales-numbers-dec-2011/</link>
		<comments>http://mepatterson.net/2011/12/devils-hand-sales-numbers-dec-2011/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 23:18:58 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Self-Publishing]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://mepatterson.net/?p=301</guid>
		<description><![CDATA[A quick glimpse at my December, 2011 sales figures for Devil&#8217;s Hand: approx. 1500+ copies sold since August 1 release I almost never have a 0-sales day. Usually sell at least 2 copies each day, some days a bunch more, especially when someone does a blog post mentioning me or whatever. 45 reviews on Amazon, [...]]]></description>
			<content:encoded><![CDATA[<p>A quick glimpse at my December, 2011 sales figures for <a title="Devil's Hand" href="http://amzn.to/dhkblg" target="_blank">Devil&#8217;s Hand</a>:</p>
<ul>
<li>approx. 1500+ copies sold since August 1 release</li>
<li>I almost never have a 0-sales day. Usually sell at least 2 copies each day, some days a bunch more, especially when someone does a blog post mentioning me or whatever.</li>
<li>45 reviews on Amazon, mostly five stars</li>
<li>something like 80% Kindle, 10% Nook, 10% paperback (guessing because I&#8217;m too lazy to go count the actual figures)</li>
<li>DH was in the top 50 of Kindle Occult/Horror for about 3 months, dropped off recently as I&#8217;ve been doing less promoting while finishing up book two</li>
<li>recently have started seeing more and more multi-copy orders showing up on BookScan from random indie bookstores/online sellers in various parts of the country. i get a tiny royalty on those &#8216;extended channels&#8217; but it seems to indicate people out there are interested enough to ask their local store to get some copies. (Bookpeople in Austin, TX is already carrying it on both Local Author and Horror shelves)</li>
</ul>
<p>From what I hear, this is all pretty damn good compared to most self-pubbed books, but it&#8217;s certainly not quitting-your-day-job revenue. But then, it&#8217;s also less than 6 months on market.</p>
<p>I&#8217;m hoping to see a significant sales bump when the second book releases in the spring.</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/12/devils-hand-sales-numbers-dec-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Devil&#8217;s Hand is on Blog Tour!</title>
		<link>http://mepatterson.net/2011/10/devils-hand-is-on-blog-tour/</link>
		<comments>http://mepatterson.net/2011/10/devils-hand-is-on-blog-tour/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 15:24:26 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://mepatterson.net/?p=289</guid>
		<description><![CDATA[Just a reminder to all my fans and interested folks that my supernatural thriller, Devil&#8217;s Hand, is currently on blog tour through November. What the heck does that mean, you ask? Well, it means that various reading/writing blogs, book review blogs, and blogs supporting the world of literature will be hosting reviews, interviews, and a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mepatterson.net/wp-content/uploads/2011/10/small_tall_book3d.jpg"><img class="alignleft size-full wp-image-292" title="small_tall_book3d" src="http://mepatterson.net/wp-content/uploads/2011/10/small_tall_book3d.jpg" alt="" width="100" height="160" /></a>Just a reminder to all my fans and interested folks that my <a title="Devil's Hand: a supernatural thriller" href="http://bit.ly/dhx1">supernatural thriller, Devil&#8217;s Hand</a>, is currently on blog tour through November. What the heck does that mean, you ask? Well, it means that various reading/writing blogs, book review blogs, and blogs supporting the world of literature will be hosting reviews, interviews, and a couple giveaways!</p>
<p>Check out my tour schedule <a href="http://www.pumpupyourbook.com/2011/09/23/devils-hand-virtual-book-publicity-tour-octobernovember-2011/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/10/devils-hand-is-on-blog-tour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listening to the Man in Black</title>
		<link>http://mepatterson.net/2011/10/man-in-black/</link>
		<comments>http://mepatterson.net/2011/10/man-in-black/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 14:52:24 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=261</guid>
		<description><![CDATA[But when the moment’s right and the scene is right, the perfect music accompaniment can draw out more nuanced emotion, more complicated behavior, and sometimes a surprise left turn when you were expecting the character to go right.]]></description>
			<content:encoded><![CDATA[<p><a title="By Joel Baldwin (LOOK April 29, 1969. p.74) [Public domain or Public domain], via Wikimedia Commons" href="http:////commons.wikimedia.org/wiki/File:JohnnyCash1969.jpg"><img style="float: right;" src="//upload.wikimedia.org/wikipedia/commons/thumb/f/f2/JohnnyCash1969.jpg/500px-JohnnyCash1969.jpg" alt="JohnnyCash1969" width="150" /></a>In another blog post, I talk about looking for your next door muse – finding that activity or source that inspires and seeds and stretches your brain with new and fascinating ideas. But, in my writing experience, there’s lots more that you can do to put your head in the right space to generate badass fiction. And one of the big things for me has been music.</p>
<p>Now, I’ll admit that some days I find music distracting and have to turn it off and write in silence. For whatever reason, this often seems more conducive to generating the quiet, carefully-plotted creepy scenes. It’s hard to concoct a moment where the protagonist is beset upon by silent, lurking shadows when you’ve got Lady Gaga blasting in the background.</p>
<p>But when the moment’s right and the scene is right, the perfect music accompaniment can draw out more nuanced emotion, more complicated behavior, and sometimes a surprise left turn when you were expecting the character to go right. It’s almost as though the characters themselves can hear the soundtrack, and respond accordingly.</p>
<p><span id="more-261"></span></p>
<p><a href="http://bit.ly/dhx1"><img class="alignleft size-thumbnail wp-image-275" title="dh_proof1" src="http://blog.digimonkey.com/wp-content/uploads/2011/10/dh_proof1-150x150.jpg" alt="" width="150" height="150" /></a>For <a href="http://bit.ly/dhx1">Devil’s Hand</a>, several musicians had pretty direct influence on the story, even going so far as to actually suggest a major plot point with one lyric. Sister Machine Gun’s [R]evolution album figured heavily in the makeup of Trent’s character, especially songs like “Carbon Copy Man” and “Strange.” Albums by Evanescence and Tool were on frequent rotation when working on characters like Celia and the Prince of the Shadow Realms. And other artists snuck in too: Morphine, Beck, Nine Inch Nails, and Bonnie Prince Billy, to name a few.</p>
<p>But no musician influenced <a href="http://bit.ly/dhx1">Devil’s Hand</a> and it’s upcoming sequels as much as Johnny Cash.</p>
<p>As a child of the Appalachians, I have roots that stretch into the soil there and remain connected, even now that I live under the hot sun of Texas. The music of the mountain folk, the bluegrass, and the religion-hued old-style country still speak to some deeper part of me, and I find myself returning to them whenever digging into the world of Trent and Celia and Ramón and the demons. And, for my money, no man draws the listener into that musical world better than Mr. Cash.</p>
<p>From his classics like “Ring of Fire” to his more recent covers of powerful songs like “There Ain’t No Grave” and “Hurt,” Johnny’s voice and styling evoke a deep and complicated relationship between man and God, sin and redemption, and law and rebellion. Of course, these are all direct themes in <a href="http://bit.ly/dhx1">Devil’s Hand</a>. Johnny Cash’s songs, and indeed his own life, reflect the more difficult aspects of stories tied to the Judeo-Christian traditions. It’s simply not that easy to be a pure man of good in a world so dark. Every choice made has both light and dark repercussions. Every path taken can lead to Hell if you don’t pay attention to the road signs.</p>
<p><a title="By Mitsukai at en.wikipedia [Public domain], from Wikimedia Commons" href="http://commons.wikimedia.org/wiki/File:Belial.jpg"><img style="float: right;" src="http://upload.wikimedia.org/wikipedia/commons/e/e9/Belial.jpg" alt="Belial" width="240" /></a>Johnny Cash understood this better than anybody. He walked those roads, turned around, came back, then found himself heading right back down them again. This personal struggle defined his life and music and, instead of burying it behind a glitzy mask and effervescent smile like so many other popular musicians, Cash brought it out, full and clear and uncompromising, in his songs. As far as I’m concerned, Johnny was the musical equivalent of Milton’s Paradise Lost and Dante’s Inferno.</p>
<p>The next time you lay fingers down on your keyboard, ready to build up your newest hero or villain, think about their personal soundtrack. What musician or song encapsulates your fiction in five minutes of tune and lyrics? What speaks to the incidents and decisions and personal demons that drive your character forward, hold them back, haunt their waking hours? What music would make them happy, giddy, jubilant, triumphant?</p>
<p>Yours doesn’t have to be dark and brooding like Cash; that works for me because of the story I’m writing. But maybe your heroine sashays to the sultry sounds of Norah Jones. Perhaps your hero rolls on waves of bass beneath the Los Angeles sun. Your mad scientist works feverishly against the violent, building crescendo of a great symphony. And when an important character dies, is a full military band playing taps, or is a lone vocalist standing just out of sight, her song quiet and forlorn?</p>
<p>When I sit down to write the more challenging, nuanced parts of Trent Hawkin’s journey through the dark reality of the Drawing Thin series, I find myself associating his fictional trials and tribulations to those real ones that faced The Man in Black and the characters that figured in his lyrics. Trent struggles, like Cash and his subjects, with the repercussions of terrible mistakes, with the realities of an imperfect nature, with Faustian choices where the road leads into darkness either way, with the struggle between doing what’s right and doing what must be done. Yet, through it all, Trent never forgets where he came from or who is important to him. The music of Johnny Cash never fails to echo that with grace and perfection and that signature gritty toughness. With The Man in Black backing him up, Trent won’t forget who he really is, no matter what situation I send him into.</p>
<p>With the right soundtrack, there ain’t no grave that can hold Trent down.</p>
<p>&nbsp;</p>
<p><em>M. E. Patterson is an author of horror, sci-fi, and fantasy. His first novel, <a href="http://bit.ly/dhx1">Devil’s Hand</a>, frequently ranks as a <a href="http://amzn.to/dhkaa">Kindle Top 50 bestseller in Horror/Occult</a>. He lives in Central Texas with his wife and dog.</em></p>
<p>&nbsp;</p>
<p><em><span style="color: #999999;">(originally guest-posted on the Jagged Edge blog)</span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/10/man-in-black/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I Sold 100 eBooks in 13 Days</title>
		<link>http://mepatterson.net/2011/09/how-i-sold-100-ebooks-in-13-days/</link>
		<comments>http://mepatterson.net/2011/09/how-i-sold-100-ebooks-in-13-days/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 02:37:45 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Self-Publishing]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[devils hand]]></category>
		<category><![CDATA[e-books]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[sales]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=233</guid>
		<description><![CDATA[In the month of September, I have now sold well over 100 copies of the e-book this month alone. I crossed the 100 mark on the 13th. For the month of September, Devil's Hand's worst Amazon rank was #20,910 for one day...it's been better than 20k for every other day, and it cracked #10,000 for 3 days, once reaching #38 in Horror/Occult. All with a book that's less than 2 full months on the market.]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.digimonkey.com/wp-content/uploads/2011/09/IMG_0533.jpg"><img class="alignleft size-thumbnail wp-image-234" title="Copies of the paperback" src="http://blog.digimonkey.com/wp-content/uploads/2011/09/IMG_0533-150x150.jpg" alt="" width="150" height="150" /></a>On August 1st, I officially launched my debut supernatural thriller, <a title="Official Website of Devil's Hand" href="http://bit.ly/dhx1" target="_blank">Devil&#8217;s Hand</a>, on Kindle, Nook, and in paperback. First month sales were consistent, but small, maybe 1 or 2 a day, sometimes 3 on a good day. That was before I really did any serious promoting outside of an email sent to my mailing list of friends and interested folk, and some Facebook-ing.</p>
<p><strong>In the month of September, I have now sold well over 100 copies of the e-book <em>this month alone</em>. I crossed the 100 mark on the 13th.</strong> For the month of September, Devil&#8217;s Hand&#8217;s worst Amazon rank was #20,910 for one day&#8230;it&#8217;s been better than 20k for every other day, and <strong>it cracked #10,000 for 3 days, once reaching #38 in Horror/Occult</strong>. All with a book that&#8217;s less than 2 full months on the market.</p>
<p>I know a lot of you are probably asking, &#8220;How?&#8221;</p>
<p><span id="more-233"></span></p>
<p>I&#8217;m writing this because, two months ago, I was asking that question too (really, I still am, for months 3, 4, and beyond). But when I went Googling around for other people&#8217;s experiences, I was surprised that I couldn&#8217;t really find anyone sharing their early experiences.</p>
<p>Sure, you get the heavyweights like <a href="http://donovancreed.com/">John Locke</a> (who has <a href="https://www.amazon.com/dp/B0056BMK6K/ref=as_li_ss_til?tag=mepa-20&amp;camp=213381&amp;creative=390973&amp;linkCode=as4&amp;creativeASIN=B0056BMK6K&amp;adid=0784TXZ4PXZX869MVZCG&amp;">a lot of great insights</a>) and <a href="http://amandahocking.blogspot.com/">Amanda Hocking</a> and <a href="http://authormichaelhicks.com/">Michael R. Hicks</a> (who also has a <a href="https://www.amazon.com/dp/B005FU49BG/ref=as_li_ss_til?tag=mepa-20&amp;camp=213381&amp;creative=390973&amp;linkCode=as4&amp;creativeASIN=B005FU49BG&amp;adid=13CPHPV5WEBKK31CH65P&amp;">great book on the subject</a>). I highly encourage you to read their blogs and their books&#8230; they have a lot to teach. Also check out folks like <a href="http://www.thecreativepenn.com/">Joanna Penn</a> and <a href="http://aniaahlbornblogs.wordpress.com/">Ania Ahlborn</a> and numerous others who have been doing well and blogging about their findings. Reading their experiences is a great start.</p>
<p>In talking to other self-pubbed authors, I&#8217;m hearing that many people struggle to hit 100 books sold <em>total</em>. Some have had their books on sale for <em>months</em> and haven&#8217;t cracked 100. So I figured, for whatever it&#8217;s worth, I&#8217;ll share my early self-pubbing experiences because I like the idea of being open and contributing to the greater community of writers. And for the folks not having huge success, but would like to hear about how they might be able to bump 1 &#8211; 2 sales a day up to 5 &#8211; 6, maybe this will help.</p>
<p>Note that I&#8217;m not saying that doing any of this is guaranteed to work for you nor am I saying that it will continue to work for <em>me</em>, even. These are just my experiences in the first 2 months of selling Devil&#8217;s Hand, what has worked well and not so well, and what has gotten me to a pretty solid sales clip for a debut book by an unknown author.</p>
<p>So, here&#8217;s what I&#8217;ve found:</p>
<p><strong>Facebook Ads kinda work. Maybe.</strong> I&#8217;ve built up a pretty good 2,000-person following on Facebook. I&#8217;m starting to see more and more engagement there, and that&#8217;s awesome. I really like my Facebook fans. A good portion of that 2k figure is from running a lot of Facebook Ads just to make people aware of the book and the fan page. This can get expensive, and my sales numbers definitely don&#8217;t get me anywhere close to breaking even on the ad cost, though I&#8217;m getting closer.</p>
<p><em>VERDICT: Try it if you have some cash to burn, I guess, but I&#8217;m betting your mileage may vary depending on the book you&#8217;re selling and your audience. Plus you end up essentially &#8216;buying&#8217; a ton of Likes that never actually result in a sale. In marketing-speak, the conversion rate here seems to be pretty low, but it does convert and builds some awareness and finds you some people that do buy and may be willing to champion the novel.</em></p>
<p><strong>Google Adsense.</strong> A big question mark. Ran some for a while. Didn&#8217;t seem to be working as well as Facebook even. All I know is when I shut off the Google Ads, I didn&#8217;t see any dip in sales, so&#8230;<br />
<em></em></p>
<p><em>VERDICT: Didn&#8217;t seem to have much effect. </em></p>
<p><strong>Twitter.</strong> Yes! Not only have I gotten quite a few direct sales on Twitter just by connecting with people and tweeting about the book, but I&#8217;ve also actually <em>connected</em> with people. I&#8217;ve found other authors whose books I&#8217;m now reading, fans that I would never have targeted but who communicate with me regularly, etc. And it brightens my day when I get to talk one-on-one with awesome people.</p>
<p><em>VERDICT: Totally worth the time. Costs nothing. But you have to work to actually connect with people. Don&#8217;t be an ass and just spam your book link over and over every 10 minutes&#8230; at least put a few hours in-between. Work to make real connections. Talk to people about your book. Ask them about theirs. Comment on the weather. Share fun photos of you doing strange things. Whatever. Be personal, not a sales-bot, even while you&#8217;re selling. </em></p>
<p><strong>Blogging</strong>. Well, you&#8217;re reading this blog, which means you&#8217;ve seen the book links all over the place. Since Amazon doesn&#8217;t tell you about each individual purchaser of your book, there&#8217;s no clear way to know exactly how many people are buying based on their visit here, but when I post a new post, I usually get a small bump in sales the next day or two, so&#8230;</p>
<p><em>VERDICT: You should probably be blogging anyway, if for no other reason than to build your brand. Did it directly influence 100 sales in 13 days? Not sure. But sales go up as blog traffic goes up.</em></p>
<p><strong>Book Website</strong>. On day one, I launched <a href="http://devils-hand.com" target="_blank">devils-hand.com</a> as the &#8220;official&#8221; virtual face of the book. The idea was to pattern it a bit after the sites the big studios throw up to tease interest for upcoming movies. In my Google Analytics, I see a definite upwards trend in traffic to that site coinciding with increasing sales. Of course, it&#8217;s also where all my tweets about the book direct people, so that&#8217;s to be expected.</p>
<p><em>VERDICT: You should do this. It doesn&#8217;t necessarily guarantee any sales increase, but it makes your book into a thing that has an anchor in the virtual world beyond the Amazon page &#8211; one that you can use when telling people to go check out the book. I&#8217;ve gone off to investigate new author friends&#8217; books only to find that they exist solely in Amazon&#8217;s world and may even be hard to find there. Bad!</em></p>
<p><strong>Reviews</strong>. We all want positive reviews, and for good reason. With each new review posted, I see an overall sales increase a few days later. With 14 reviews now, all 4&#8242;s or 5&#8242;s, it&#8217;s that much harder for someone interested in the concept of the book to turn down a $0.99 price point.</p>
<p><em>VERDICT: Do what you can (ethically) to get reviews. Get bloggers to read and review the book. Do a book tour. Talk to other writers and see if they&#8217;d be willing to read your book and give an honest review. Convince a book club to read it. I&#8217;ve gotten reviews by hand-selling the book to people in a billiards hall I frequent and by giving it away on Goodreads to people on the other side of the country. They didn&#8217;t have to write a review, but they read the book, reviewed the book, and are waiting for the sequel. </em></p>
<p><strong>Price Point</strong>. Joanna Penn has dissected this far better than I will bother to here. <a href="http://www.thecreativepenn.com/2011/04/24/99-cent-ebook/" target="_blank">Just read her post.</a> I did, gave the $0.99 price point a try, and it&#8217;s sold well so far. Next month I&#8217;ll put it back to the regular $2.99 and measure to see what effect that has. Definitely a YMMV situation. What&#8217;s right for her, you, or me may be completely different in all cases or even on a book-by-book basis.</p>
<p><strong>Messaging</strong>. This is crucially important. Make sure you know <em>how</em> to talk about your book. Is it a book &#8220;for people who love John Grisham?&#8221; Don&#8217;t just show people a book and say, &#8220;Hey, umm, do you mind buying this?&#8221; That doesn&#8217;t work. You need to give people a reason to <em>want</em> your book. Of course, be honest. Don&#8217;t say, &#8220;J.K. Rowling told me personally that mine was the best book ever&#8221; unless that&#8217;s true, or you will face the wrath of angry reviewers.</p>
<p>Okay, so that&#8217;s a bunch of stuff to think about. And seriously, go read the million-sellers&#8217; books too. They&#8217;re useful and full of good advice. Read Joanna&#8217;s blog.</p>
<p>But hopefully this should give you some sense of what *I* have done to sell 100 books in less than two weeks. Will my sales continue like this? Have I made huge mistakes that will bite my ass later? Did I forget to put my leftover curry from the Thai place in the fridge (oh, shit)?</p>
<p>Who knows?</p>
<p>But I didn&#8217;t title this post, &#8220;How I&#8217;m going to get rich and sell exponentially more every week.&#8221;</p>
<p>This is what I&#8217;ve done to get off to a nice start. My plan is to keep doing what works until it stops working, then adjust.</p>
<p>&#8220;But,&#8221; you say, &#8220;I&#8217;ve done all that stuff and it&#8217;s <em>still</em> not working, months later!&#8221;</p>
<p>Well, I&#8217;d say go back to <a title="Self-publishing is business. Act like an entrepreneur." href="http://blog.digimonkey.com/2011/08/selfpubisbusiness/">my previous post on self-pubbing as a business and putting in your due diligence</a>. Is your book really, truly ready to be out there? Does it stand up well against other books in its niche/genre? Does it look professional? Do you use mostly active sentences instead of passive? Have you, as Stephen King advises, cut out all the adverbs? Answering these truthfully may help you see why it&#8217;s not selling as well as you might have hoped.</p>
<p>Otherwise, your guess is as good as mine.</p>
<p>Keep trying different things! Report back if you find something that works great! Report back if you find a blog on this subject that I missed in my Googling! And feel free to catch up with me here, in the comments, and on Twitter &#8211; <a href="http://twitter.com/#!/mepatterson">@mepatterson</a></p>
<p>Good luck and great sales!</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/09/how-i-sold-100-ebooks-in-13-days/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Self-publishing is business. Act like an entrepreneur.</title>
		<link>http://mepatterson.net/2011/08/selfpubisbusiness/</link>
		<comments>http://mepatterson.net/2011/08/selfpubisbusiness/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 18:07:47 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=216</guid>
		<description><![CDATA[If you&#8217;re thinking about taking the exit off the Bigpublisher Highway and heading into Selfpublishingville, I have a couple of tips that I&#8217;ve picked up from my visit so far. In general, I think these are fairly universal, but hey, your mileage may vary. PUT IN YOUR DUES Okay, so what I&#8217;m not going to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re thinking about taking the exit off the Bigpublisher Highway and heading into Selfpublishingville, I have a couple of tips that I&#8217;ve picked up from my visit so far. In general, I think these are fairly universal, but hey, your mileage may vary.</p>
<p><span id="more-216"></span></p>
<p><strong>PUT IN YOUR DUES</strong></p>
<p>Okay, so what I&#8217;m <em>not </em>going to spout is the oft-repeated advice about never publishing your first manuscript. If you think you have a good first novel, by all means, try and sell it! It probably <em>is</em> garbage and you probably <em>should </em>completely rewrite it from scratch (I did with mine), but just because it&#8217;s your first manuscript doesn&#8217;t mean you have to shelve it. But before you put it out there, put in your dues first.</p>
<p>What do I mean?</p>
<p>I mean <strong>you need to be honest with yourself</strong> and subject your work to the same forces that authors have been doing since before we had this whole self-publishing game. It&#8217;s become faddish to bitch and moan about the big publishers being &#8216;evil&#8217; and agents being &#8216;gatekeepers,&#8217; but the reality is that it&#8217;s all just business. Those folks know business. They know (generally) what is good enough quality to sell (note I didn&#8217;t say &#8216;great&#8217;). And you, Mr. Selfpublisher, are about to jump into the business world as a solo entrepreneur. Don&#8217;t be that guy running around town trying to sell your goofy invention that looks stupid, doesn&#8217;t benefit anyone, and doesn&#8217;t actually work.</p>
<ul>
<li>Submit to agents and/or editors. Get form rejections. Make edits. Get more form rejections. Make edits. Get some personal rejections with assorted kudos.</li>
<li>Get to know the publishing biz, because you&#8217;re about to be part of it. Understand how books are made, from initial concept to objects on shelves to remaindering to six-figure deals.</li>
<li>Maybe hire a professional editor. They cost money, and you should avoid any that &#8220;guarantee&#8221; that they will get you published, but the good ones know their shit and will tell you when your stuff <em>is </em>shit. Accept it, shed a tear, and go back to the drawing board. Because your initial stuff <em>is shit. </em></li>
</ul>
<p><strong>Don&#8217;t assume that you have a brilliantly original story idea (you don&#8217;t), that you are the Next Big Thing (you&#8217;re not), or that you &#8220;don&#8217;t need other people to validate your talent.&#8221;</strong> Maybe you don&#8217;t, but you&#8217;re not going to sell any books either, jackass.</p>
<p>Put in your dues, even (read: especially) for your very first manuscript.</p>
<p>The goal is not to refine your product into the most beautiful and elegant piece of fiction ever crafted (mine is certainly not). <strong>The goal is to make something that can be <em>sold</em> and <em>enjoyed</em> by a reasonably-sized audience, and that will, over its lifespan, create a net <em>positive</em> for your brand (<a href="http://blog.nathanbransford.com/2011/09/on-internet-theres-no-such-thing-as.html">aka You</a>) so that you can <em>sell</em> <em>more books</em>.</strong> Neal Stephenson&#8217;s <a title="The Big U" href="http://en.wikipedia.org/wiki/The_Big_U" target="_blank">first book</a> was not great, by any means, but it was good enough to make people willing to publish/read more of his work. Now he&#8217;s a bestselling author.</p>
<p><strong>WRITING GROUPS</strong></p>
<p>There have long been posts about the various Types of writing groups. &#8220;Puff&#8221; groups where no one ever says a critical thing about your work (avoid like the plague!). Killer groups where the game is to one-up each other with nastier and more soul-crushing criticisms (sometimes useful, but generally teaches you more about the commenter than about your book). But since this post is about self-publishing, I&#8217;m going to discuss a new split in the world of writing groups:</p>
<p><strong>&#8220;There&#8217;s only one way to be a real author&#8221;</strong> groups vs. <strong>&#8220;Brave new world&#8221;</strong> groups.</p>
<p>Maybe controversial, but here goes&#8211;</p>
<p>My own experiences, plus those of others I&#8217;ve talked with, suggest that this split is becoming more and more prevalent. That group of really wonderful people you&#8217;ve joined gives you awesome criticism, helps you refine the hell out of your work, and then when you triumphantly announce the existence of your self-pubbed book on all the major e-stores and they cluck their tongues and chide you for &#8220;cheating&#8221; or &#8220;taking the easy way out&#8221; or &#8220;giving up.&#8221;</p>
<p>As a soccer-playing friend of mine used to say: this is utter horseshit.</p>
<p>Nobody told Steve Jobs he was &#8220;giving up&#8221; because he decided to build his own idea of a computer instead of just joining one of the big boys and working on mainframes.</p>
<p>Now I&#8217;m not saying you&#8217;re Steve Jobs because you self-pubbed your dumb story. Sorry. But <strong>you should take pride in the fact that you are now an author.</strong> Maybe a failing author. Maybe a terrible author with no fans. But you&#8217;re an author. If you put in your dues (see above), there&#8217;s a reasonable chance you&#8217;ve got <em>good enough</em> work that will be a toehold to building a brand.</p>
<p>Your &#8220;one real way&#8221; group can go to Hell if they&#8217;re not interested in supporting you as a published author. And I don&#8217;t mean to say that these groups are entirely composed of &#8220;one real way&#8221;-ers. It&#8217;s usually a couple bad apples with chips on their shoulders. But don&#8217;t let anyone tell you that you shouldn&#8217;t try self-publishing. You <em>should</em> let them tell you that your story is boring, or your character is shit, or your prose isn&#8217;t up to snuff. <strong>They&#8217;re probably right, and you should listen</strong>.</p>
<p>But if you&#8217;ve put in the time and have something that agents are telling you is publishable, <em>publish it!</em> Don&#8217;t let the holier-than-thou group members try to convince you that your work isn&#8217;t publishable until an agent/editor contract is signed. One of those things is quality of creative work&#8230; the other is business. Don&#8217;t confuse them, and don&#8217;t let others confuse them for you.</p>
<p>On the other side of the coin, you&#8217;ve got the &#8220;Brave new world&#8221; groups. They can be equally useful in critiquing your work and telling you when you&#8217;re missing the mark. And, compared to the previous group, they&#8217;ll happily support you when you decide to self-publish. They&#8217;ll trade tips on self-publishing price points, experiences, and marketing efforts, pat you on the back when you announce your 100th sale, etc. etc..</p>
<p>But the downside to some of these groups is that they might be <em>too willing </em>to go indie. It&#8217;s all fine and good to say that now anyone can be an author, but <strong>not everyone who joins a writing group with some convoluted scrawl vomited onto parchment <em>should</em> be self-pubbing</strong>. They&#8217;re just heading for hurt and embarrassment when those 1-star reviews start rolling in (see the recent guy who self-promoted his &#8216;novel&#8217; on Digg and it became a shooting gallery of criticism&#8230; though he probably sold quite a few books&#8230;hmm&#8230;).</p>
<p>Conclusion: take what you can from both types of groups, but again, Put In Your Dues before you chuck anything out there into the ether. Be sure you have a solid product to sell, not some embarrassing screed that will make your mama cry.</p>
<p><strong>MARKETING, ADVERTISING, AND SELF-PROMOTION</strong></p>
<p><a title="Marketing Your First Book" href="http://www.thecreativepenn.com/2010/03/27/marketing-your-first-book-graham-storrs/">Marketing is a plan</a>. You have a plan for how to sell your stuff, you refine the plan, then execute the plan, then measure the plan&#8217;s effectiveness.</p>
<p>Advertising is when you pay money to someone else and they promise to put your stuff in front of lots of people&#8217;s eyeballs.</p>
<p>Self-promotion is when you, valiant businessman, try to put stuff in front of people&#8217;s eyeballs all by your lonesome.</p>
<p>And what&#8217;s weird is that some people will bitch and bitch about you using advertising or self-promotion. I don&#8217;t get it. Business is business. If 100 people see your paid advertisement or self-promotion, 5 people bitch about it, and 10 people buy the thing, then those 5 people can go bite themselves because you just hit 10% sales conversion, which is awesome.</p>
<p>Sure, there are rules in the various advertising forums out there. Be polite. Don&#8217;t spam the same thing over and over. As <a href="http://wilwheaton.typepad.com/">Wil Wheaton says, &#8220;Don&#8217;t be a dick.&#8221;</a> But that doesn&#8217;t mean you need to be a shrinking violet either and avoid advertising or self-promotion because it seems &#8216;unclean&#8217; or &#8216;rude.&#8217; <strong>Hell, Wil Wheaton himself spammed my Google+ stream recently with a self-promoting post about his sci-fi novel. </strong>(and he&#8217;s certainly not lacking in audience already; his <a href="http://twitter.com/#!/wilw">@wilw twitter persona</a> has 1.8 million followers)</p>
<p>That said, notice I mentioned that a marketing plan <em>measures it&#8217;s effectiveness. </em>Seriously. You need to get numbers. If you do a $1,000 ad buy, you damn well better know if it converted 10 people to sales or 100 people. For the former, you&#8217;re spending $100 to get 1 sale. Your book better cost more than $100 in that case. For the latter, you&#8217;re spending $10 to get 1 sale. Better, especially if it&#8217;s your $12 paperback version, but maybe not good enough if you&#8217;re only selling e-books at $2.99. It&#8217;s okay to spend a bunch of ad money just growing <em>awareness</em> for your product, too. In that case, maybe the $1,000 ad buy was worth it (doubtful, though). But you need to have the numbers so you know what you&#8217;re getting. And if your current ad platform isn&#8217;t doing jack for you, dump it and find one that does.</p>
<p><strong>CONCLUSION</strong></p>
<p>So that&#8217;s three broad areas where hopefully I&#8217;ve given you some food for thought. If there&#8217;s a theme to this post, it&#8217;s that you have to keep remembering that writing a novel is <em>storytelling</em>, editing a novel is <em>product refinement</em>, but selling a novel is <strong><em>business</em></strong>. You can do the first two all day long without spending a penny, and there are groups of like-minded people out there willing to help in return for your help with their product.</p>
<p>But once you hit #3, you&#8217;re an entrepreneur. Don&#8217;t be afraid of acting like one.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/08/selfpubisbusiness/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Writing, Marketing, Programming, Designing</title>
		<link>http://mepatterson.net/2011/08/writing-marketing-programming-designing/</link>
		<comments>http://mepatterson.net/2011/08/writing-marketing-programming-designing/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 15:09:05 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=203</guid>
		<description><![CDATA[So I have a confession to make: I do more than just write software. I know! Gasp, right? I&#8217;ll bet no one was expecting that! Yeah, well it&#8217;s true. Per my previous post, I&#8217;m also a (now published) author, a marketer-of-sorts, and in addition to programming, I&#8217;m also reasonably well-versed in design. I&#8217;ve designed more [...]]]></description>
			<content:encoded><![CDATA[<p>So I have a confession to make: I do more than just write software. I know! Gasp, right? I&#8217;ll bet no one was expecting that! Yeah, well it&#8217;s true. Per my previous post, I&#8217;m also a (<a title="Buy a copy of Devil's Hand!" href="http://amzn.to/dhkindle">now published</a>) author, a marketer-of-sorts, and in addition to programming, I&#8217;m also reasonably well-versed in design. I&#8217;ve designed more websites than I can count, I did all the cover art for my book, did the PDF layout for the actual printed book cover, did the interior book typography and layout, all the way down to deciding how to format the chapter headings and whether or not to put italics on the page numbers at the top right/left of each page. Ta da!</p>
<p>Lest this turn into a self-promoting, self-congratulating garbage post, I should probably get to the point why I&#8217;m listing all this: <strong>To succeed in today&#8217;s digital world, I believe you need to learn to do more than one thing. </strong>Hit the jump for more&#8230;</p>
<p><span id="more-203"></span>When I was a kid, I was going to be a scientist someday. Then a writer. Then a movie director. Then a computer programmer. Given my proclivity for pushing plastic keys and messing with calculators, the latter came pretty naturally. But then college: the computer engineering program I entered was focused on compilers and shrink-wrapped software; this whole &#8216;internet&#8217; and &#8216;hypertext&#8217; thing seemed a bit faddish. But that&#8217;s what <em>I</em> was interested in. So I switched to English where, not only did I get to read books and write, but the profs there were actually psyched about HTML &#8212; they saw it as a new future where everyone in the world would read their manifesto on &#8220;British colonial attitudes between the years of 1862 and 1864.&#8221;</p>
<p>Yeah, so, fast-forward to today.</p>
<p>Film industry is changing.</p>
<p>Music is changing.</p>
<p>And now publishing is changing.</p>
<p>Not to mention newspapers, magazines, and everything else related to the printed word. So the question you have to ask yourself, as a programmer, or a writer, or a graphic designer is: <strong>am I learning new things that will help me leverage my top skills in other verticals (to use some biz-speak)?</strong></p>
<p>To come at it another way &#8212; you can do one of the aforementioned things, and that&#8217;s great, and you can probably get people to pay you to do it. But if you&#8217;re a programmer, why not learn to write and kick out a self-pubbed book on programming related to your particular specialty? Or polish up some design skills: at the least, learn some color theory and basic front-end HTML 5. If you&#8217;re a graphic designer, you damn well better be learning HTML and CSS or you&#8217;re sunk as the ad agencies all start going digital/interactive. If you&#8217;re a writer and you&#8217;re still poking your typewriter and ignoring the world of social media, internet publishing, and design, then you&#8217;re going to end up spending a lot of money paying guys like me to do stuff for you when you either (A) self-publish or (B) your Big Publishing publisher tells you &#8220;do the marketing your damn self because we&#8217;re cutting budgets.&#8221;</p>
<p>And I&#8217;m not saying that this secondary or tertiary skill you pick up needs to be polished to diamond clarity. You don&#8217;t need to become <a href="http://nobelprize.org/nobel_prizes/literature/laureates/2010/">Mario Llosa</a> to add some oomph to your programming skills. You don&#8217;t need to become Van Gogh to learn to make website designs that are better than <a href="http://www.angelfire.com/super/badwebs/">this</a>. And you don&#8217;t need to know the ins-and-outs of Ruby&#8217;s eigenclass if you want to improve your ability to do internet marketing for your book.</p>
<p>But you do owe it to yourself to push the boundaries of your comfort zone and go beyond your expertise. It will pay off in dividends.</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/08/writing-marketing-programming-designing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Check out my supernatural thriller!</title>
		<link>http://mepatterson.net/2011/07/buy-my-supernatural-thriller/</link>
		<comments>http://mepatterson.net/2011/07/buy-my-supernatural-thriller/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 16:24:14 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[devils hand]]></category>
		<category><![CDATA[novel]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=198</guid>
		<description><![CDATA[It&#8217;s a bit of a departure from my normal subjects on this blog, but I wrote a book and would love if it readers gave it a try (and passed the word along!) It&#8217;s a supernatural thriller about demons, angels, poker, and armageddon, set in Las Vegas. If you like Tim Powers or Dean Koontz, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://amzn.to/dhkindle"><img class="alignleft size-medium wp-image-200" title="Devil's Hand : a supernatural thriller" src="http://blog.digimonkey.com/wp-content/uploads/2011/07/book_cover_web-197x300.jpg" alt="Devil's Hand : a supernatural thriller" width="197" height="300" /></a>It&#8217;s a bit of a departure from my normal subjects on this blog, but <strong>I wrote a book</strong> and would love if it readers gave it a try (and passed the word along!)</p>
<p>It&#8217;s a supernatural thriller about demons, angels, poker, and armageddon, set in Las Vegas. If you like Tim Powers or Dean Koontz, you&#8217;ll probably dig this.</p>
<p>It&#8217;s only $2.99 for e-readers. $11.95 if you want a for-reals paperback.</p>
<p>ebook for Kindle/Kindle App: <a href="http://amzn.to/dhkindle" rel="nofollow" target="_blank">http://amzn.to/dhkindle</a><br />
ebook for Nook: <a href="http://bit.ly/dhnook" rel="nofollow" target="_blank">http://bit.ly/dhnook</a><br />
paperback: <a title="Devil's Hand - paperback" href="http://amzn.to/qxQEgw">http://amzn.to/qxQEgw</a></p>
<p>And if you buy it, read it, and like it, please drop by Amazon and give it a quick review. Every review helps get it more exposure to readers that might not otherwise ever hear about the novel. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/07/buy-my-supernatural-thriller/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SQL/NoSQL Debate? Why?</title>
		<link>http://mepatterson.net/2011/05/sqlnosql-debate-why/</link>
		<comments>http://mepatterson.net/2011/05/sqlnosql-debate-why/#comments</comments>
		<pubDate>Fri, 27 May 2011 14:03:37 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=194</guid>
		<description><![CDATA[Short post here. I&#8217;m tired of hearing about the SQL/NoSQL &#8220;debate.&#8221; Seriously. I don&#8217;t really understand why there&#8217;s a need to stake out territory and then start a war over techno-ideologies. In my opinion, this debate is like having a debate about cars vs. pickup trucks. There are valid pros/cons to buying cars and valid [...]]]></description>
			<content:encoded><![CDATA[<p>Short post here. I&#8217;m tired of hearing about the SQL/NoSQL &#8220;debate.&#8221; Seriously. I don&#8217;t really understand why there&#8217;s a need to stake out territory and then start a war over techno-ideologies.</p>
<p>In my opinion, this debate is like having a debate about cars vs. pickup trucks. There are valid pros/cons to buying cars and valid pros/cons to buying pickup trucks. In fact, it&#8217;s totally valid for one person to own both a car and a pickup truck! Gasp! I know, it&#8217;s mind-blowing!</p>
<p>I&#8217;ll add that, as a proponent of <a href="http://www.mongodb.org/">MongoDB</a>, I definitely think the right NoSQL database is a better solution in many ways for much of the web-app databasing that was previously handled by relational DBs. But my saying that in no way indicates that I think SQL is dead, relational is dead, or anything of that sort. This is a classic &#8216;right tools for the job&#8217; discussion.</p>
<p>If there&#8217;s any debate at all, maybe it&#8217;s around what, specifically, the best use cases are for each type of database, but I&#8217;d prefer that we stop referring to that as a debate and instead just see it as an ongoing evolution and discussion. Creating conflict where there doesn&#8217;t need to be any solves nothing and makes us all look bad.</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/05/sqlnosql-debate-why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Linux Server Hardening</title>
		<link>http://mepatterson.net/2011/02/basic-linux-server-hardening/</link>
		<comments>http://mepatterson.net/2011/02/basic-linux-server-hardening/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 15:46:27 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=184</guid>
		<description><![CDATA[Some excellent tools and tricks to consider when hardening the security on your Linux server, mostly listed here for my own benefit later: Linux Malware Detector on a daily scan mod_security for Apache moving /tmp to a non-executable partition daily scan with ClamAV&#8217;s clamscan utility moving SSH to a nonstandard port removing the ability for [...]]]></description>
			<content:encoded><![CDATA[<p>Some excellent tools and tricks to consider when hardening the security on your Linux server, mostly listed here for my own benefit later:</p>
<ul>
<li>Linux Malware Detector on a daily scan</li>
<li>mod_security for Apache</li>
<li>moving /tmp to a non-executable partition</li>
<li>daily scan with ClamAV&#8217;s clamscan utility</li>
<li>moving SSH to a nonstandard port</li>
<li>removing the ability for root to login through SSH</li>
<li>(even better) making SSH auth-key-based only, so no user/password logins at all!</li>
</ul>
<p>This setup will at the very least harden your server against the bulk of irritating script-based assaults.  There&#8217;s lots more that can (and should) be done, but I&#8217;m starting to think that most of the things I&#8217;ve just listed are required nowadays (certainly the SSH ones are).</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2011/02/basic-linux-server-hardening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid + Carrierwave + Virus scanning!</title>
		<link>http://mepatterson.net/2010/12/mongoid-carrierwave-virus-scanning/</link>
		<comments>http://mepatterson.net/2010/12/mongoid-carrierwave-virus-scanning/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 17:00:32 +0000</pubDate>
		<dc:creator>M. E. Patterson</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[inherited_resources]]></category>
		<category><![CDATA[mongoid]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://blog.digimonkey.com/?p=174</guid>
		<description><![CDATA[Ever wanted to have your app virus-scan uploads BEFORE you attach them to a model?  My BigAuthor app for writers and agents needed to do exactly that &#8212; I didn&#8217;t want some bozo uploading a virus-laden Word doc and then distributing to all the agents that log in to the site.  So I set to [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to have your app virus-scan uploads BEFORE you attach them to a model?  My <a href="http://bigauthor.com">BigAuthor app for writers and agents</a> needed to do exactly that &#8212; I didn&#8217;t want some bozo uploading a virus-laden Word doc and then distributing to all the agents that log in to the site.  So I set to work&#8230; I thought this was a fun little implementation that I pulled off with relatively little code.</p>
<p><span id="more-174"></span>First, you gotta setup Mongoid with Carrierwave and all that junk.  I&#8217;m not going to explain how all that works.  It&#8217;s not terribly difficult.  <a href="https://github.com/jnicklas/carrierwave">Figure it out</a>.  The salient point is that you should go ahead and get your model and controller all wired up so that Carrierwave processes the file upload and attaches it to your Mongoid model correctly.  For now, ignore the virus-scanning bit and just get that working.  Once you&#8217;re there, read on&#8230;</p>
<p>THE CONTROLLER</p>
<p>The first trick is that you don&#8217;t want to just attach the file to the model anymore, since you want to verify it&#8217;s cleanliness <em>first</em>.  So we need to shunt it to the file system in a temp directory where we can scan it.  </p>
<p>Your &#8216;create&#8217; method on the controller might look something like this (using InheritedResources here for simplicity):</p>
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> create<br />
&nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@project</span> = current_user.<span style="color:#9900CC;">projects</span>.<span style="color:#9900CC;">build</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; shunt_manuscript_through_viruscan<br />
&nbsp; &nbsp; create!<br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>So what we&#8217;re saying is that we shunt the manuscript off before we create the project and save the object to mongo.  Obviously.</p>
<p>Here&#8217;s that method (I&#8217;ve removed some extra code that&#8217;s not relevant to the discussion):</p>
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> shunt_manuscript_through_viruscan<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:manuscript</span><span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; manu = params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:manuscript</span><span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; filename = params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:manuscript</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">original_filename</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># we delete this param now, so it doesn't pass thru to the model immediately</span><br />
&nbsp; &nbsp; &nbsp; params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:project</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:manuscript</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@project</span>.<span style="color:#9900CC;">manuscript_upload_pending</span> = <span style="color:#0000FF; font-weight:bold;">true</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># write it to filesystem immediately, in user-specific tmp dir</span><br />
&nbsp; &nbsp; &nbsp; save_location = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>Rails.<span style="color:#9900CC;">root</span>, <span style="color:#6666ff; font-weight:bold;">Project::MANUSCRIPT_TEMP_DIRECTORY</span>, current_user.<span style="color:#9900CC;">id</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC00FF; font-weight:bold;">FileUtils</span>.<span style="color:#9900CC;">mkdir_p</span> save_location<br />
&nbsp; &nbsp; &nbsp; doctext = manu.<span style="color:#9900CC;">read</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># this next line is necessary since we're using Ruby 1.9 and it's encoding stuff is picky</span><br />
&nbsp; &nbsp; &nbsp; doctext.<span style="color:#9900CC;">force_encoding</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;BINARY&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>save_location, filename<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#996600;">&quot;w:BINARY&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> f.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>doctext<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0066ff; font-weight:bold;">@project</span>.<span style="color:#9900CC;">process_manuscript_upload</span><span style="color:#006600; font-weight:bold;">&#40;</span>filename<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>Okay, so that last line takes us to the next awesome.  We&#8217;ve got a project.  It has a manuscript.  We&#8217;ve shunted it off and written to the filesystem, then deleted the param so it doesn&#8217;t get attached via Carrierwave (yet).  Now we call process_manuscript_upload for that project against that file.  (NOTE: obviously we call this same shunt method in the update action on the controller too)</p>
<p>CLAM AV</p>
<p>Before we can go about willy-nilly virus-scanning things, we ought to have a virus scan solution.  Enter <a href="http://www.clamav.net/lang/en/">ClamAV</a> for Linux.  Suppose you could use any virus scanner you want here, as long as it can be called via command-line and returns reasonable exit codes that differentiate between success (clean) and failure (has virus).</p>
<p>I&#8217;ll leave it up to you to figure out how to install ClamAV on your system. </p>
<p>THE MODEL</p>
<p>So in our Project model, we&#8217;ve added an instance method that gets called after someone has attempted to upload a file through our projects controller.  It does our dirty work using the virus scanner we just installed.</p>
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> process_manuscript_upload<span style="color:#006600; font-weight:bold;">&#40;</span>filename<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; path = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>Rails.<span style="color:#9900CC;">root</span>, <span style="color:#6666ff; font-weight:bold;">Project::MANUSCRIPT_TEMP_DIRECTORY</span>, <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">user</span>.<span style="color:#9900CC;">id</span>.<span style="color:#9900CC;">to_s</span>, filename<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; scan_is_clean = <span style="color:#CC0066; font-weight:bold;">system</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;clamscan #{path}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> scan_is_clean<br />
&nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">manuscript</span> = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">manuscript_upload_pending</span> = <span style="color:#0000FF; font-weight:bold;">false</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">save</span>!<br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">update_attributes</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:manuscript_upload_pending</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; Rails.<span style="color:#9900CC;">logger</span>.<span style="color:#9900CC;">warn</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;[VIRUS DETECTED!] Manuscript uploaded by #{self.user.id.to_s} for project #{self.id.to_s} had a virus!&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># notify the user via email</span><br />
&nbsp; &nbsp; &nbsp; UserMailer.<span style="color:#9900CC;">manuscript_had_virus</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">deliver</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># clean file from filesystem</span><br />
&nbsp; &nbsp; <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; handle_asynchronously <span style="color:#ff3333; font-weight:bold;">:process_manuscript_upload</span></div></div>
<p>Seriously, this is not really complicated at all.  I&#8217;ll break it down:</p>
<ol>
<li>figure out the path to file we want to scan.  scan it using system() shelling out to the &#8216;clamscan&#8217; executable and giving it the tmp path of our file.</li>
<li>if it&#8217;s clean, assign it to manuscript by just opening up the file (carrierwave takes over here &#8212; in my case, I have it write the file to cloud storage, but you could write it locally, or to the database, or whatever), change the Project object so it doesn&#8217;t think it has a pending manuscript anymore, and save</li>
<li>if it&#8217;s got a virus, similarly update the pending attribute, but instead of attaching, we log a big warning, send the user a nasty email, and delete the filthy thing from our filesystem.</li>
</ol>
<p>Easy, right?  And if you don&#8217;t know what that very last line is all about, it&#8217;s DelayedJob.  I like the <a href="https://github.com/collectiveidea/delayed_job">fork from collectiveidea</a>.  Really, you want to background this somehow.  Generally ClamAV is fast as hell, but you don&#8217;t want that process blocking the saving of the user&#8217;s Project.  And that&#8217;s what the &#8216;pending&#8217; attribute is all about.  On my Project new form, I only show the manuscript upload file field if pending is false.  If it&#8217;s true, I instead show a message with a little spinner saying &#8220;Your manuscript is being scanned for viruses&#8221; or something like that.</p>
<p>So hopefully that wasn&#8217;t too tough to follow.  I was delighted at how straightforward it ended up being.  And I&#8217;m sure there&#8217;s some variations on the theme you could use, or wrap all this up in a nice include that just gets stuck on the model (i.e. include VirusScanner or something).  But this is my quick-and-dirty implementation.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://mepatterson.net/2010/12/mongoid-carrierwave-virus-scanning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	<!-- google_ad_section_end --></channel>
</rss>

