A (Long) Month Of eBook Marketing…

So it’s been a busy month for me marketing Gwen’s books (actually 5 weeks, but I treated myself to a nasty flu/cold for one of those weeks.)

I decided to focus on getting reviews, jazzing up her book website, and also a Facebook page for Gwen’s books.

The results?

Total cost – under $500, but that’s because I traded labor for money, and did it all on my own – manually contacting potential reviewers, customizing the website, coordinating sales and reviews, and of course, doing all the design and copy writing. Oh, and digging into Facebook big time (for example, reading both the 1st and 3rd edition of Ultimate Guide to Facebook Marketing.) I’m guesstimating that’s solid results for about 1/10th the cost of hiring others…

High points:

  • Getting 1 penny likes to the Facebook page when advertising. They didn’t last long, but it was fun to get likes at that rate. Contrasted sharply with some 25 cent ones (and higher) that I stopped ASAP (low cost Facebook marketing means constantly monitoring your account!)
  • Digging into the Facebook ad system to specify exactly the types of fans we wanted, so the likes meant we were getting real cozy mystery fans and not generic ‘likes.’
  • Finally getting the look of the site nailed down, including all the artwork (like logos) needed for the Facebook page (we even bought some PLM magnetic calendars for 2018 as well as promotional mugs, something we’ve talked about for years.)
  • Getting about 1,300 to download Gwen’s first book for free with a call to action over five days, leading to the bulk of the reviews, some good sales of book #2, and a really solid fan base.

The effort was so much fun I’m actually considering a “soup to nuts” one stop shop for ebook authors – from cover design, manuscript editing and formatting to Facebook promotion and review solicitation, and so forth. Just a minor issue of finding the time…

Next month?

Back to my long-awaited (by me) audio app, due REAL SOON NOW. And for Gwen’s book? Time to focus on the email side of things, and build up Gwen’s email list in time for the release of book 3 – Codename: “Pear Tree.”

Gwen Pankhurst’s “The Plant Lady Twigs To Villainy” FREE ‘Till October 27th

As part of my nascent book promotion efforts, Gwen’s first book in her series is temporarily free for Kindle, from today through Oct 27, 2017.

The goal is reviews – lots and lots of reviews – since reviews let others know if the book is right for them.

So download it, read it, enjoy it…

…and PLEASE leave a review!

The Amazon.com link is here, and if you prefer Amazon.ca, the link is here (for everyone else, just go to your amazon, and search on”Gwen Pankhurst” to see the books.)

Enjoy!

Ready For A Second Heaping Helping Of “The Plant Lady” In Action?

For you Plant Lady Mystery fans, the suspense is over – Gwen has finished her second novel, “The Plant Lady Cracks A Nut!”

To quote the book blurb:

Local mall “Plant Lady” Eden Tywyn is desperate to escape her past. But her past keeps showing up and threatening to destroy her future. Strange accidents, odd behavior from people she thought she knew, and the feeling of being watched make her think that her time in the quaint town of Packard Falls may soon be over. But until then, something strange is definitely going on, something that threatens her friends and the future peace of Packard Falls. Is it enemies from her life before, or something even more sinister? Eden must find out the truth – but will she find it in time?

You can get in paperback or immediately on Kindle via the links below – get it now, devour it in an afternoon, and then leave a stellar review so others can enjoy the series!

A DIY Stand For Your (Solved?) Rubik’s Cube

Although I haven’t talked about my Rubik’s Cube solution for awhile now, I recently dug out my cube and tried to solve it by memory – and succeeded. Slow, but successful, so I’m quite pleased.

Of course, what better way to showcase your solved Rubik’s Cube than with a fancy stand? Although eBay sells nice plastic stands that tilt the cube for best effect (see the listings below), I recently read how to make my own out of cardboard.

Here’s how:

  1. Draw a perfect square on a piece of paper, then another one centered inside it (see diagram.)
  2. Cut out the dark gray area (and optionally the light gray area too.)
  3. Crease the lines and bring the tab to the other side, causing the paper to form a pyramid.
  4. Glue the tab to the side, and add a cube to display.

Some thoughts about the design:

  • The center light gray can be cut out or kept – if kept, bend it so it folds into the stand, forming a pyramid-shaped “cup” for the cube to rest in. This adds a bit of strength to the stand.
  • Since the ‘dip’ cannot be deeper than the stand, you’ll understand why the center square cannot be larger than the edges (mathematically, the width of the inner square must be less than 1/2 the width of the larger square.)
  • Secure the tab well with glue or staples – as the Rubik’s cube rests, it is in effect a wedge trying to split the stand apart. A very light wedge, true, but it puts pressure on the stand, so secure it well.
  • Another variation is instead of a table, the dark gray area is kept, and then glued/stapled directly behind one of the other sides as a large “tab.” This gives more surface for the glue, and more stickability.
  • Try a few out with paper to get the feel for it (and pick a size) and then make one in cardboard.

Enjoy!

How To Add A Title To Images In The NextGEN Gallery Plugin

So as I’m modding Gwen’s site, I had a problem: In the lightbox for each page, the art was displayed when you clicked on it, but with only a description, not a title.

A few years back, I had made a mod to the NextGEN gallery plugin to manage it, but with WordPress plugin updates, it had been wiped out; as well, the plugin seems to have been rewritten, making the issue moot.

The key to fix it is to make sure the tag in the galleries includes a title along with the description – the file I modded was found in

/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php

And the actual change I did was found in here:

<div class="ngg-gallery-thumbnail">
  <a href="<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE))?>"
    title="<?php echo esc_attr($image->description)?>"
    data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
    data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
    data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
    data-title="<?php echo esc_attr($image->alttext); ?>"
    data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
    data-image-slug="<?php echo esc_attr($image->image_slug); ?>"
    <?php echo $effect_code ?>>
      <img
        title="<?php echo esc_attr($image->alttext)?>"
        alt="<?php echo esc_attr($image->alttext)?>"
        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
        width="<?php echo esc_attr($thumb_size['width'])?>"
        height="<?php echo esc_attr($thumb_size['height'])?>"
        style="max-width:100%;"
    />
  </a>
</div>

I changed line #03 to add the title:

title="<?php echo esc_attr($image->alttext),": ",esc_attr($image->description)?>"

Voila – a title below each lightbox image – as the screen shot below shows.

I even tried with with <strong> (or <b> if your theme handles it properly) to bold the title:

title="<?php echo "<strong>",esc_attr($image->alttext),":</strong> ",esc_attr($image->description)?>"

But in the end, adding html within a <img> tag parameter didn’t feel right, so I went back.

Some caveats with this method:

  • It works because the title= parameter in the <img> tag is used by the FancyBox lightbox code to caption the images. If you use one of the other lightboxes in NextGEN, this may not work.
  • Likewise, it’s for the Basic Gallery display – if you want it to work for another type of gallery and this doesn’t work, then plan to spelunk your way through the code looking for the appropriate place to patch.
  • And of course, patches will disappear with the new update. So make the change, check it out, and then backup the file (maybe even the whole plugin.) And plan to fix it every update.

Enjoy!

You Should Be Paranoid – Your Printer IS Talking About You Behind Your Back…

Steganography is a fascinating/unnerving subject – hiding private messages in plain sight. It smacks of something from the Cold War and Microdots, or making invisible ink from lemon juice. But it’s very real – and an example of how it was used recently to find a leak is this article on ars technica. In this case, the NSA leaker included a scanned document, and the printer printed its serial number in very small light yellow dots on the page. The eye missed it but the NSA could use it to track the printer and even time of day it was printed, leading to an arrest.

So if you send printed letters, you might as well sign them – your printer is going to anyways…

Here’s (One Way) How You Wait For An Image To Load In Javascript

Tinkering with some Javascript for the header on Gwen’s art page, I came across an interesting point – what do you do if you want to run a script as soon as an image is loaded?

Some of the issues:

  • Your browser can load parts in whatever order it wishes – so if your Javascript file loads before your image, you’re too soon.
  • If you try to use an onload event in Javascript, they don’t always work – specifically, if the image is already in the browser cache, you won’t have the event fire.
  • If you DO use an event, and the image is loaded before the Javascript is loaded, then the event fires with no code to react to it.
    Philosophical Question: If an image of a tree loads in a browser and no jquery is around to respond to the .onload, does it count?
  • If you set an arbitrary time limit to ‘wait and see’, there’s always going to be a slow connection out there that takes even longer.
  • And once you move to more complicated web pages (for example, frameworks like WordPress) you have even less control over when and how your Javascript will be loaded and run.

The comic below makes fun of ‘wait and see’ programming:

commitstrip.com

However, here is one solution, using the <img> onload event (which in testing seems to fire on all occasions):

  • Put the images you need as <img> tags in the HTML of your page. You can hide them with CSS tags (visibility:hidden; display:none;) if necessary.
  • In the page’s <head> section, add this javascript:
    <script type="text/javascript">
    var loadingFlags=[1,1];
    function setLoadingFlags(i){loadingFlags[i]=0;}
    </script>

    For each image, decide on an index (making sure ‘loadingFlags‘ has enough entries to handle them all), and then include them with an onload handler:

    <img src="imgA.gif" id="myimg0" onload="setLoadingFlags(0)" />
    <img src="imgB.gif" id="myimg1" onload="setLoadingFlags(1)" />

    …etc.

  • Now your Javascript can run anywhere,anytime, since the <img> onload is always called, whether in the cache or not. Until these flags are zero, they aren’t loaded. This makes your Javascript easier, since you don’t have to worry about sequencing:
    function processImages()  
    {
      if ( loadingFlags[0] || loadingFlags[1] )
      {
        // check often until loaded
        window.setTimeout(processImages,50);
        return;
      }
      // both found - do your work
    
    }
  • As long as the call to load this Javascript comes after the variable setup in the HTML, you should be OK, since it will just call over and over until both flags are set to 0 via onload.
  • Need to reload images? The ids are added to the <img> tags in the example above for just that reason. You set the flags again to 1, change the .src address, and then poll until they turn to 0.
    function loadSomeMore()  
    {
      loadingFlags[0]=1;
      document.getElementById("myimg0").src="imgX.gif";
      loadingFlags[1]=1;
      document.getElementById("myimg1").src="imgY.gif";
      window.setTimeout(processImages,50);
    }

Some cautions:

  • The example code here uses two images, but the idea can be limited to 1, or expanded to as many as necessary. Of course, lots of large images loading in the background all at once will to endear you to visitors, So take note of your bandwidth!
  • If an image doesn’t load (broken link for example,) then you’ll need a plan for what to do next. For example, use a counter to check how long the wait has been, and do something else if the images don’t load.
  • In theory (and testing) the <img> onload is reliable. But like loading, there may be a failure. Always plan for what to do if this happens, and try to have a test routine in place.

Although this code won’t solve every issue, it might help with the occasional synchronization issues between .js and .html files. Hope it helps!

What I like About C/C++

The last article mentioned VB .net and its plusses (!) – now it’s time for why I like C/C++:

  • It has longevity. 45 years old and still in use. Will we be saying that about many languages today? So it’s an investment in code (and education) that will last and last and last.
  • It’s ubiquitous. You need code? You can usually find a C version of it – quick. And if you ever read those programming indexes, you’ll know that while the big news is how much Haskell or Erlang or Rust or Swift has grown over the last month, few people talk about the perennial favorite always near the top – guess who?
  • It’s fast. With fast computers, speed isn’t the issue it was twenty years ago, but there’s always a need for faster code somewhere. One of my favorite things is to take a code routine that I need faster, and tweak it. For C it’s a real treat. You feel that you are making a difference. Even ++i versus i++ has a performance penalty associated with it. For “coding to the metal” (when necessary) it’s great.
  • It’s the grandfather/greatuncle to just about every language. Javascript? Python? PHP? Java? Drop down into any of those code bases and it will seem familiar right away (not perfect – but familiar.) Arguably, I’d say that a good foundation in C++ will make most of the popular languages easier to ramp up on.
  • It low level (if you want). Want high level features like collections? Bring in the STL. Need a GUI? Pull in a library like GTK or Cocoa. But you can still tweak a routine or two when needed – a great combination of high/low level performance you won’t find easily elsewhere. In fact, when I need performance in a VB program, I’ll still code the occasional C DLL to handle it.
  • It has portability. When I wanted to program the microcontroller device Arduino, guess what? The tool chain was in C. Easy peasy to do my first programs, and I could even reuse code from elsewhere. The result was a very fast rampup.

This just scratches the surface. I’m glad I have had exposure to a number for programming languages, but I’m grateful I got a training in C early on. And despite all the new languages coming out almost daily, I expect to program in C for quite awhile…

What I like About Visual BASIC .net

I admit I’ve used BASIC my whole life in one way or another. As a kid, it came on all the computers. As an adult, Microsoft’s Visual BASIC 6 was a revolutionary way to design Windows programs. And today, VB is the ‘other way’ to program in .net – not as hot as C#, but perfectly usable.

And better, I believe – here’s why:

  • Syntax. I like C’s terse syntax. But sometimes I tire of adding ‘;’ after everything. And I didn’t realize that until I had worked in VB .net for awhile. And having the IDE manage the formatting, while a tad controlling, saves me space-space-spacing to reformat lines all the time (and yes I know most everyone has a prettyprinting option in their IDE, but it’s funny how often “don’t bother using it – it’s just one line” pops up in coding…)
  • Case insensitive. It seems small, until you use it for awhile. If I create a variable called “buffLen”, I can write “bufflen” everywhere, and the IDE will automatically adjust it to “buffLen”. Like the “;” key, not having to hit the shift key is noticeable when I go back to C.
  • It gets the job done. Don’t get me wrong – I like C/C++ and I’ve done most of my development in it. But whereas C can feel like tuning a high performance car at times, VB feels like popping into the van for a trip to the store. You still need to change the oil – but one takes a lot less effort to do things with. And for most programming tasks, just getting it done is fine. For example, GUIs work at human speeds – so is the extra performance of hand-tuned C worth it in that case?
  • The IDE. This should be multiple points, but the Microsoft IDE makes it very easy to program VB. Start typing, and it prompts with the obvious choice. Can’t remember that object’s function name? Press the period, and a list pops up. Same for variables. And I’ve already mentioned the autoformatting and variable case insensitivity.
  • It’s portable(ish) A huge benefit of C is portability. With Microsoft’s foray into Linux, Mac, and Handhelds (via Xamarin) the knowledge of .net is leveraged. Time will tell if they extend support for VB, but let’s hope.

I’m not a fan of propriety languages, but the convenience of VB for projects has me moving to it as my goto language for little glue programs in my work. It’s faster to prototype and test, gives me a GUI simply, and has a very good collection of collections (lists, dictionaries, etc) so I get small apps up and running quickly.

You may disagree – but choice is the spice of life, so perhaps you’ll prefer the next article, where I discuss C/C++ and why I like it – because I can have two (or more) favorites…