Betrayal (The Divine Book Two) – This One’s for the Bears

As you may or may not be aware, I currently donate 10% of all of the royalties I receive from Balance (The Divine Book One) to the Humane Society of the United States (over $700 through this July). I don’t do it as an incentive for people to buy my book, but because it’s something I believe in, and I want to give back what I can. I’ll be choosing charities for every book I publish, until I can’t manage the list anymore, at which point I’ll just send more to the ones I’ve already chosen.

In any case, for Betrayal I’ve selected two charities, both of them involved with animal welfare, and more specifically for the cause of helping wild bears.  Why two? Because I promised my wife I would donate to the WSPA (warning, bear baiting is graphic), and because we also want to support Animals Asia, who are working to end the practice of bear bile farming. I will likely use the same charities for Book Three, to get them both up to 10%, but I didn’t want to wait to start giving to both.

If you have a minute and a love of bears (or just hate to see any living thing suffer), please visit the sites and consider donating as well.

Betrayal will be available on Amazon in July.

 

Balance – 2000 Copies Sold!

I recently passed the 2000 sale mark on Balance, my urban fantasy novel about the war between good and evil, and the one person on Earth who can save mankind from tragedy.  I want to thank everyone who has supported me and my work for your likes, e-mails, comments, etc… I set out just to write a book and provide some entertainment, and I’ve received so much more.

Balance has now been downloaded over 5500 times, including a couple of KDP Select free periods. That’s a lot of visibility, and I’m glad to have it, especially with the first draft of Book Two nearing completion. In case you hadn’t heard yet – it will be released in July.

Thank you all again!

 

Recent Free Days

I just completed my second (and most likely last) round of free promotion on Amazon this Saturday. The promo ran from 4/25 – 4/27. Some thoughts:

1. eBookBooster

I paid $35 to eBookBooster to help me list my free days on all of the relevant sites. I paid for this promotion on April 3rd, giving about 3 weeks for the service to get my book submitted. I was a little disappointed when I started getting confirmations from the free book sites on 4/24 that my book had been submitted, since most of the sites also require X amount of lead time in order to fit the books into their schedules. It did run in a few places, and I did see a huge jump in downloads from my first unannounced free promo days, but in retrospect I think I should have picked out the most popular sites and submitted to them myself to make sure I got space. Still, its a great time saver for not that much money.

2. Results

I saw about 1200 downloads on day 1, moving me up to #152 overall on free, and to #1 in urban fantasy and #5 in contemporary fantasy, plus #9 on science fiction & fantasy overall.. pretty nice.

I averaged around 400 downloads the next two days, for a total of 2062. It’s this outcome that has led me to think that once a book has traction, a one day freebie is probably the most effective.

3. The aftermath

In the hours after the freebie, my overall sales have… stayed right where they were before the freebie. Which is fine, I’ve already sold more copies than I had imagined I would when I published, so I’m pretty happy anyway. Being a nerd who likes numbers though, I find the outcome interesting.

4. Final thoughts

My goal for listing free was to:

1. gain the exposure of having my title listed on the free book sites and tweeted out
2. gain exposure on amazon, listed in the top 20 free on 3 lists
3. get moved around on Amazon’s recommendation que
4. get some numbers to share (like i said, i like numbers)

It’s said that people tend to need to see something 3-4 times before they actually buy it, so the exposure portion may lead to greater mindshare that can’t be quantified in immediate numbers. At the same time, I don’t know that there is a strong value in listing free once you’ve gained a certain level of penetration – at least not until you can back it up with a second title in the series. I’m thinking that $.99 may be a better approach, and it’s one I’ll try in the future.

 

‘Can A One Star Review Really Do That?’ – The Morning After

Yesterday, I published this post about a one-star review I received due to what at the time I thought was user error with the Kindle. It turns out, I was wrong (and am feeling rather sheepish as a result).

Thanks to a commenter to the review on Amazon who goes by the screen name of Fate, I learned that it actually WAS the formatting that caused the reviewer’s ire. Apparently, when you output for Kindle in MS Word, it also adds html color tags to the elements, most often black.  Night mode makes the background black, and text a light grey in order to keep the screen darker for bedtime reading. It is also useful if the white is just too bright and hurts your eyes, as in the case of the reviewer.

While I still would have preferred the user had contacted me directly (either through Amazon or by finding my contact info at the back of the book), the review did work to alert me to the problem, and allow me to fix it. Now you know too.

So many people jumped in with help and support in light of the review. To everyone on Amazon, Goodreads, and here on my blog who pitched in, you have my sincere thanks and appreciation.

When I was ready to publish, I used the ‘Building Your Book For Kindle’ document that Amazon provides to format my book. This morning I searched through it for night mode, or anything that may have warned me of this issue ahead of time.  I may have missed it, but I didn’t see anything.

I also used the online Kindle Previewer to check my book before I published it. This previewer doesn’t offer mode switching.

Yesterday, when I corrected the book, I downloaded the actual Kindle app for Mac, and used the downloadable Kindle previewer to output the html to .mobi format. At that point I was able to review the content in night mode, although the Kindle app crashed three times in the process.

In any case, let this be a lesson:

Check your book in the different modes before you publish.

As for sales… we’ll have to wait another day or two to determine how much of an effect the poor review may have had (and now I wonder how many returns were due to the night mode issue). What I can say right now is that I sold 26 books yesterday (up from 15 after the review), with 14 of those sales coming between 9:00 pm PST and 7 am PST, after a couple of positive reviews gave me back my half star.

Coincidence? Possible, but I’m not convinced.

 

Can A One-Star Review Really Do That?

UPDATE: I’ve added a new post detailing the outcome of the issue here.

The Situation

I got my first one-star review for Balance yesterday. I feel congratulations are in order.

Actually, I’d be fine with the one-star review, if it had anything at all to do with the book.

Instead, it is from a user who is apparently frustrated with the way his kindle is functioning, and he says that he is unable to read my book because it hurts his eyes. The problem is, the review reads as though it’s the formatting of the book that’s causing the issue, not the device itself. From what I understand (and I’m pretty technical, but I don’t know everything), this simply isn’t possible.

(You can read the review here if you’d like)

That’s the windup. Here’s the pitch.

The Numbers

March Sales (U.S.)

Purchased Returned P-R Borrowed (Select)
967 20 947 52

April 01 Sales (U.S.)

Purchased Returned P-R Borrowed (Select)
33 0 33 6

That’s before the one-star review. An average of 32 books per day sold or borrowed. I’m super happy with that, no complaints at all.. it’s beyond what I ever expected.

April 02 Sales (U.S.)

Purchased Returned P-R Borrowed (Select)
46 0 46 8

The Results

That’s the cumulative total. If you do the math, its 15 books sold or borrowed, the day the one-star review hit (it was published at 1 am PST). I’ve been tracking daily totals, and the lowest I’ve had in the six weeks prior was 23. Also, Tuesday is typically one of my BEST sales days. I understand that there is an ebb and flow, and I’m pretty content with 15, but it irks me to think that this review could be crashing my sales at all. Like I said, it would be one thing if it was actually about the book, but since it’s about the device the reader was trying to read the book on…

Conjecture

A few of thoughts on HOW it could be affecting sales.

1.Visual star-rating went from 4 1/2 stars (4 filled, 1 half-filled), to 4 stars.. There’s one big ole’ empty star staring out at viewers who see the book in a list. It’s at 4.2 overall.. point one more and I’d have that little halfie back :)

2.Star rating affects position in recommendation que (I don’t know if this is true)

3.Viewers read the review and think my book is formatted incorrectly, and they’re going to have trouble reading it

Conclusion

It could just be a coincidence; it’s only one day after all. At the same time, I’m an analytical sort of fellow, so I couldn’t help but analyze.

In the end, I’m left waiting in the hopes that a few more positive reviews will push it out of sight for the majority of users, and blogging about it so I can get other people’s thoughts on the whole situation, and maybe make some lemonade out of the lemon.

Do you think that’s the right thing to do? Have you had a similar experience? Do you have any advice, or other thoughts?  Please share.

Balance – 1000 Copies Sold

I started writing Balance with the idea that I would self-publish it to Amazon when it was done. I told myself that if I could just sell 25 books a month, I would be pleased.

Here I am about seven weeks later, and I’ve crossed the 1000 sales threshold. Holy crap!

What’s more, I’m on track to donate over $300 dollars to the HSUS in the next two months (Amazon pays out 60 days after the sales month).

An extra special thanks to the people who have left me reviews either on Amazon or Goodreads, and to the people here who have liked my facebook page. You guys are awesome!

In celebration of the achievement, Balance will be on sale for $2.99 at Amazon for a limited time.

 

Facebook Fan Page

So… I added a fan page on Facebook centered around my writing, because maybe you’re on Facebook, and maybe you’re a fan, and maybe you want to I don’t know say.. ‘like’ me or something…

Well, now you can. I’ll also be using the page to keep those interested up to date on progress with the next novel, release dates, and whatever else results from being on the worlds biggest social network.

I hope you stop by.

http://www.facebook.com/mrforbes.author

 

Yeoman, Karma, jQuery, Require, Backbone, SASS, Mocha, Dust, i18n… oh my!

I’ve added a skeleton file directory / config to github in order to perhaps save you time in setting up an application using the tools listed in the title.

https://github.com/mrforbes/yeoman-backbone-stack

The main reason I added it was because getting Testacular Karma working with require was not as straightforward as I had originally assumed it would be, owing to the fact that you need to tell Karma which files to include, but require wants to include them all asynchronously. The workaround is in the karma.conf.js file:

files = [
  MOCHA,
  MOCHA_ADAPTER,
  REQUIRE,
  REQUIRE_ADAPTER,
  'app/scripts/config.js',
  {pattern: 'test/lib/chai.js', included: false},
  {pattern: 'test/test.js', included: false},
  {pattern: 'app/nls/*', included: false},
  {pattern: 'app/nls/**/*', included: false},
  {pattern: 'app/templates/*', included: false},
  {pattern: 'app/scripts/*.js', included: false},
  {pattern: 'app/scripts/libs/*.js', included: false},
  {pattern: 'app/scripts/plugins/*.js', included: false},
  {pattern: 'test/spec/*.js', included: false},
  'test/test-main.js'
];

 

The included:false command tells Karma the files will be there, but it doesn’t inject them into the head, which leaves require to do its thing.

The second spot to notice is test/test-main.js… This is where all of the actual test files need to be added, instead of in the karma.conf.js file. You still need to alert Karma to them ( {pattern: ‘test/spec/*.js’, included: false} ), but you don’t want them loaded that way.

Here’s test-main.js:

require({
  // !! Karma serves files from '/base'
  deps: ['app','main'],
  baseUrl: '/base/app/scripts'
}, [
/* test runners go in here */
'../../test/spec/example',
'../../test/spec/i18n',
'../../test/spec/router',
'../../test/spec/index'
], function() {
  window.__karma__.start();
});

 

Pretty self-explanatory. Karma will wait to start until all of the specs have been loaded.

So.. if you have the need, grab the repo. Keep in mind this is a skeleton not a finished app, so some of the structure decisions are likely not optimal, and definitely not final. Move stuff around to suit your style / needs.

 

UPDATE 3/11/2013: I’ve updated the git repository to the Yeoman 1.0 beta. The 1.0 version of yeoman has some major changes in it, so the new application framework reflects those changes.

I’ve also added the following:

  1. JsHint watching
  2. Karma through Grunt (watching through Grunt)
  3. Debug code removal (grunt-groundskeeper)
  4. Backbone form validation, model binding, and deep model libraries
  5. Dust templates were always there, but I never mentioned them in the original post

UPDATE 5/3/2013: Testacular has been renamed Karma (for which I am thankful). I changed my references to match.

Getting Started with Testacular – A Tutorial

I’ve recently discovered the Testacular javascript unit testing test runner. It’s built on node.js, and if you’re into unit testing (you should be) and streamlining your workflow (you should be), it will really help light a fire under your butt and jack your productivity.

This tutorial is for basic installation only. The best place to learn more is to watch the screencast.

If you haven’t already, you’ll need to install node.js.  You can get it here for the OS of your choice.

Once you have node installed, you just need to follow the simple install instruction on the testacular web site. I’ll save you the click though, just do this:

node install -g testacular

 

Ok, it’s not THAT simple, but only because you also have the option of installing the unstable build. If you’d like to use qunit, you’ll want to do that (at least at the time of this writing). Here’s the command:

node install -g testacular@canary

 
As of the writing of this post, stable is at 0.4, unstable at 5.8 (stables are always even). If you want stable with qunit support, wait for 0.6. you can check your version once you install with:

testacular --version

 
Ok, so the next thing you need to do is set up the config file. You can do this from the command line via:

testacular init

 
This will give you a nice setup flow where you can choose to do some stuff. Or you can skip it all and fill in the resulting .js file yourself.  Here are the 3 most important config settings (remember, this is a basics tutorial)

files = [
    QUNIT,
    QUNIT_ADAPTER,
    ..
]

browsers = ['PhantomJS'];

// enable / disable watching file and executing tests whenever any file changes
autoWatch = true;

 
The first two files are variables set in testacular which wire up your testing framework. 0.5.8 has OOTB support for jasmine, mocha, and qunit. The rest of the files would be your scripts and their tests.
At this point, you’ll want to add your files. For example if you had a helloWorld.js and a spec/helloWorld.js file, you would do:

files = [
    QUNIT,
    QUNIT_ADAPTER,
    helloWorld.js,
    spec/helloWorld.js
]

 

If you know your tests will all be in the spec folder, you can also use wildcards:

files = [
    QUNIT,
    QUNIT_ADAPTER,
    helloWorld.js,
    spec/*.js
]

 

Next, you need to choose the browsers you want to run the tests in. You do this by either adding environment paths to the browser application/exe, or by setting symlinks. I’ve only done this in windows so far, by adding (for example) CHROME_BIN = ‘path to chrome.exe’ to my local environment variables (you can go to control panel/search and type in ‘environment variable’ if you aren’t sure where to add this).

browsers = ['PhantomJS'];

 
One of the best things about testacular is that you can have it watch for file changes, and rerun your tests when it detects a change. This way you have a constant monitor to whether or not you are screwing anything up, and can react immediately without having to launch a browser or type into the command line. Awesome.

// enable / disable watching file and executing tests whenever any file changes
autoWatch = true;

 
So, now you have your test runner setup, you have your testing framework ready to go.. all you have to do is start the test server:

testacular start

 
Now go in and add some tests, save your files, and watch the magic happen. Testacular can also integrate with build servers like Jenkins (which we use at Linksys), but that’s perhaps fodder for another post.

Also of note, Testacular is a part of the awesome Yeomen, which I’ll be diving into soon.

Web Performance Optimization Tip – jQuery + Document Fragments

Here’s the setup…

You have a REST API returning a JSON object filled with a bunch of data that you want to put into a list. It looks vaguely like this:

[{1234:{name:'bob'}},{5678:{name:'karen'}}]

 

Two names for brevity, but the list can be N length.

Let’s say you want to put this into a simple list of names.

Here’s the way I still see way too many devs doing it:

<html>
<body>
<ul class="names"></ul>

<script>
$(function(){
  var restResponse = [{1234:{name:'bob'}},{5678:{name:'karen'}}];

  $.each(restResponse,function(index,value){
       $('.names).append('<li>'+value.name+'</li>'); 
  }); 
});
</script>
</body>
</html>

 

It works.. and its not really THAT bad for two names.. but what if you had 100, or 1000? Especially if you are developing for mobile, you need to use this, or you’re killing your performance over one fairly simple block of know-how.

That know-how is called document fragments. I’m not going to go in depth on what document fragments are, you can check out the post on the subject by John Resig here.

The short version is that they are DOM elements you can create in memory, that don’t cause screen redraws when you manipulate them.
The benefit: You can add LOTS of nodes to them in memory, write them to the screen, still keep them in memory, remove them from the screen, still keep them in memory, and manipulate them as some kind of awesome phantom DOM object. Seriously, document fragments are bad-ass, and if you want to be bad-ass, you need to know how to use them. Not only that, but jQuery makes it stupendously easy to work with them.

Let’s go back to the example… What if we make some minor modifications?

<html>
<body>
<div class="names"></ul>

<script>
$(function(){
  var restResponse = [{1234:{name:'bob'}},{5678:{name:'karen'}}];
  var $ul = $('<ul>');
  $.each(restResponse,function(index,value){
       $ul.append('<li>'+value.name+'</li>'); 
  }); 
  $('.names').append($ul); // or you could do $ul.appendTo('.names') whatever makes you smile.
});
</script>
</body>
</html>

 

Do you see what I did there? Here it is in super slow-mo:

var $ul = $('<ul>');

 

Yes, that made a document fragment of an unordered list. That’s all it took. You can also add attributes to it like this:

var $ul = $('<ul>',{id:'listOfNames'});

 

Then we loop through our JSON object and stick each list item into the fragment:

 $.each(restResponse,function(index,value){
       $ul.append('<li>'+value.name+'</li>'); 
  });

 

Then we stick it onto the screen.

$('.names').append($ul); // or you could do $ul.appendTo('.names') whatever makes you smile.

 

If you’ve been making this mistake, stop now and go refactor your code.