Featured

Looking for Bitcoin, Ethereum, & Blockchain related stuff?

I’ve just moved everything over to https://rampantsmoke.wordpress.com/

So go there if you’ve just followed a link to here 🙂

Mark

 

Advertisements

A little bit of git(hub)

Today I walked through this GitHub course https://try.github.io/.

I’m determined to put more effort in as I’m finally working mostly on a MacBook Pro and going command(o) all the way!

My weakness is understanding how to connect to my hosting, checkout the files I need, and push them back.

That’s phase 1.

The end goal being I want to be able to move an entire site from one domain to another using only the command line!

I think that will take me a while unless I can find a mentor or a course which guides me through it.

Any suggestions? Send ideas my way!

Mark

Beginners Guide to North Korea

kim-jong-un-floppy-disk-58b8f4e33df78c353c45334c

kim-jong-un-cartman

Thanks to the podgy dictator, Kim Jong-un, attention on North Korea at the moment is pretty exciting. ‘Exciting’ in the sense that threatening the world with a nuclear attack is exciting.

North Korea has been on my radar for about a decade, because it’s a black hole. I used to make a joke to clients about how social media is compulsory: either you do it, or someone else will do it for you, and how if you want to avoid it, the only thing you can do is move to North Korea.

No-one laughed now I think about it.

I also recall seeing a satellite map of the Earth at night and how North Korea was pitch black squished between every other country which speckled in electrical activity.

Then came the stomping goose-step marches by the army, and the flashing of coloured pieces of card in the stands of sports events mimicking a LED effect of 8-bit graphics in perfect synchronicity.

‘Wow!’ I thought at the time, ‘They are so skilled!’

Fast forward to today, and I no-longer think ‘wow’ to anything done in N. Korea. I didn’t know then that every single resident is effectively being held hostage by a mass-murderer. And that it is absolutely imperative to the survival of you and three generations of your family to show complete loyalty to the ‘Dear Leader’ and the country. And that everyone is spied upon by everyone else, so there is no personal space to escape other than in your mind. Step out of line and everything is either punishable by a lengthy prison sentence or death.

On the upside, if you threaten everyone with death for their entire life, eventually, as we’ve seen by plenty of defectors, people stop fearing death.

‘Death’ becomes a bit like forgetting to buy a train ticket or speeding. Travel back and forth across the border with China is only a bribe away–guards are so poor that they will never turn down a chance to benefit.

In fact, life is so hard outside of the capital Pyongyang, that prison isn’t much different to daily life anyway.

Pyongyang, btw, is nothing more than a brochure for western guests. Tourists can visit and come away thinking, ‘Oh, it’s not too bad. People are friendly.’ etc. But that’s the plan. Dupe the stupid tourists into believing that they’re in a ‘normal’ country, when in reality you couldn’t be further from it.

During the famine in the 90s, only the well-off little chubby school kids were wheeled out in front of the aid agencies to show that things ‘weren’t so bad’.

In the winter, it wasn’t uncommon for people to dig up radishes with their hands and eat them to clean their teeth.

During the height of the Famine, Cannibalism was on the menu, as often the very young and very old were the first to die, and that’s a lot of meat to waste when you could be next.

Another thing which amazed me: there’s 25 million people in the country and if it were to collapse (toppling the dictator, etc), China and S.Korea couldn’t handle that many people flooding across the border to find work and live. Because of this they ‘allow’ a proportion to come across each year (defectors, that is) to manage the problem, but neither side wants too-many! 

Why doesn’t everyone defect? You ask. Many can’t handle the ‘freedom’ and simply go back. ‘Back’ will mean ‘prison’ (or Death) btw, but hey-ho!

What’s the solution? Businesses need to step in and set up factories.

A country who have been starved of all resources, are used to working for pennies (if that), and who have been slaves for their entire lives, are the perfect workforce. Better than those wealthy Chinese! Give a N.Korean a job to do and it will be perfectly executed as fast as possible (remember that threat of death, which never really worked?).

Am I being cruel to suggest this? No. N.Koreans would be the most efficient/cost effective production line in the world for decades to come, and they frickin’ need it!

Liberating N.Koreans to go about their merry way ‘enjoying life’ is simply not an option. It’s easy to just hop on Twitter, pop to the fridge for some leftovers, then look up a campsite for the weekend, and assume that the average N.Korean might choose to do the same, but no.

When your entire life has been devoted to loyalty to the Dear Leader & country, the threat of Death, and everyone spying on your every move, freedom, enlightenment, and the joys of frivolous existential wonderment are absent from the palette.

Setting people up to do a fair days work for a fair days pay gives them some stability, security, and sense of accomplishment, which would be the best thing one could do–at least for one entire generation.

As you can probably tell I’ve read many books on the Political, Social, and Economic state of this very fucked up country, including:

  • Dear Leader
  • Nothing to Envy: Ordinary Lives in North Korea
  • The Orphan Master’s Son: A Novel of North Korea
  • The Girl with Seven Names: A North Korean Defector’s Story
  • A Kim Jong-Il Production: The Incredible True Story of North Korea and the Most Audacious Kidnapping in History

And next I’m reading, ‘Dear Reader: The Unauthorized Autobiography of Kim Jong Il’

Where will it end? Am I obsessed? Why do I bother?

No-idea. But it’s been bonkers filling this huge gap in my knowledge about one of the most secretive countries on Earth.

I believe I will write a (fiction) book about this one day.

Deferring Javascript loads

Just discovered this way to speed up site loading times, by deferring the javascript:

function downloadJSAtOnload() {
var element = document.createElement(“script”);
element.src = “defer.js”;
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener(“load”, downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent(“onload”, downloadJSAtOnload);
else window.onload = downloadJSAtOnload;

The ‘defer.js’ is the name of the (non-crucial) file which you want to defer from loading at the start.

How I would use this is to:

  1. setup the basic site with all the essential theme loading elements.
  2. make note of the javascript libraries called.
  3. continue building the site with all additional plugins.
  4. check the javascript calls again, and defer all new ones.

I’ve got a few of new sites to do soon, so I’ll be trying this out and will report back of the progress and how it improves things.

I found this here, btw.

How to build a Self-hosted WordPress website

This blog post title is link bait.

Hopefully, you found this page because you want to start building a self-hosted wordpress website? If so, I’m not going to tell you how to do it, instead, I’m going to warn you (heavily) what you need to do incase whatever tutorial you’re follow doesn’t tell you the most important factor which will save your ass when you screw things up.

Yes, you will screw things up!

My advice, gained from a decade of building websites, is to install a plugin called ‘UpdraftPlus’. If you install this plugin (which is free), any screwup you make will be fixable. Any. Mistake.

Now you might not care about backups yet, if you haven’t made your website, but once you start, and make progress, you can very easily break things and lose everything.

So, by following this one small tip, you can save yourself a lot of headaches. You might be building a website for yourself, or for someone else, whatever you’re doing, go to the plugins section, search for and install the ‘UpdraftPlus’ plugin. Then follow its guide to set it up, and run a manual backup immediately.

Why must you do this? Well, if I haven’t bashed you over the head enough already to convince you that it’s important, then the best reason to do it, is because it gets you in to a pattern:

Backup : Backup : Backup.

  • You cannot build if you cannot backup.
  • You cannot be a developer if you cannot backup.
  • You cannot work with WordPress if you cannot backup.

Backing up is WordPress 101. Yet, no tutorial I’ve ever seen on-line will tell you to learn about backups on day 1.

This is wrong. You must learn how to back up and restore from errors from day one. You don’t even need the restoration knowledge, you just need to install and run Backups.

Backups sound boring – particularly if you’re a designer who wants to get creative and make some money. But what good is design, if you can’t restore when something goes wrong (and it will).

So, please, please, please learn to back up.

This post has been hastily written after I have had a backup nightmare. After more than a decade of building WordPress sites, I haven’t got good Backup skills. However, recently disovered the UpdraftPlus plugin and it saved my life.

I’ve been working on a big client website for months now, and quietly in the background has been the UpdraftPlus plugin running, banking copies of my site. Today, I screwed up all my WordPress CSS by switching themes – because a theme developer (someone much more knowledgeable than me) told me it would be ok to do so).

That professional wasn’t wrong, but they didn’t know my site setup well enough to advise. I followed their advise and lost all my formatting.

After an entire morning of trying to get things back, I suddenly remembered I had UpdraftPlus running. And eventually, after much reading of online guides on how to restore exactly (fearing that even restoring was going to screw more things up!) I managed to restored the database with a few clicks and get everything back.

*phew*

If I’ve been doing development for 10+years and can screw up – you definitely will.

Please learn to backup from day one. You have been warned.

Mark

No part of this post is an advert for UpdraftPlus. It’s just the one I had installed which saved my ass. I’ve also used WordPress Backup To Dropbox, but don’t find it as user friendly. What ever backup option you choose, learn how to use it!

Using iTunes Producer for iBooks upload

Just a quick note on iTunes Producer use.

  • Log in with the client account – not your own!
  • Have a copy of the book cover ready – 1440px on the shortest side. Note: landscape vs portrait – it’s not clear yet. I’ve just tried landscape, and will report back how that goes.
  • Get ready with your categories: Pick BISAC then drill down to where you want to be placed in the catalogue.
  • Have a description ready, and the page count.
  • Have the .epub, or .ibooks file(s) ready – you’ll need a sample file too! 10% of the book is fair.
  • Know your prices – this is where you’ll be able to set it for all territories. I picked everything (DRM free) and set the price for my UK value (£2.99) which worked out as $4.49. You also have to set a print book price: this is compulsory, so I picked £11.99 (even though there isn’t a print book).

That’s it. Pretty easy. I’ll feedback later as to how the upload and position in the store fares.

Mark

Amazon is killing me

Publish on Amazon and you can’t give away books.

Authors always want to promote their work in the easiest way they know – giving away a few review copies and offering discount codes. Amazon doesn’t like this, want it, or make it easy. Amazon are about Sales; they are cool with promotion, as long as they are doing it!

Smashwords doesn’t solve the problem as Amazon has limited them from uploading. Therefore, you can’t be sure if and when your title will be published to Amazon through them. Bah.

Amazon’s 90 day exclusivity clause f0rks everything.

———

Other things which need to be done by the Author (for my future reference really): they need to complete their financial info on this page https://kdp.amazon.com/account

back soon – Mark

My #NaNoWriMo #Fail and Why That’s OK.

A bookshop in Lyme Regis

This year I have failed to complete NaNoWriMo and I’m fine with it because I recognise why. This month would have been my fifth, non-consecutive Nano, and whilst having a good idea, and lots of pre-writing, I couldn’t complete it. The reason I couldn’t is because I have realised I’m way past caring about quantity.

Nanowrimo gives you a number of great skills which every new writer should be challenged to complete:

  • quantity
  • finishing
  • dropping the inner editor
  • discipline

If you really want to write for a living/career, you’ll need all of the above with the addition of planning and quality. Nanowrimo doesn’t deliver those two. The format doesn’t care a jot about it. Which is good, because it’s really hard to learn the other aspects if one focuses on quality, or plans without the labour of writing.

Quantity is the main goal. Without it you’ll just be trying to run a marathon by taking zero steps.

Finishing is the second goal. Most writers start with incredible enthusiasm, then lose motivation and direction and abandon the idea. Writing is hard; writing without finishing is simply playing. Not good.

Dropping the inner editor is the third goal. How can you amass quantity and finish if you’re continually going back over your working rereading? In Nano-land the editor is unnecessary until you’ve finished; and completing Nano really works to shut down that part of your brain.

Finally: discipline is the stealth strength of Nano. To write a novel isn’t particularly difficult; it’s easy to produce one body of work in our lifetime. Being a writer however, means completing this feat of stamina time and time again. Nano teaches you to get up early, use your lunch break wisely, and turn off the TV (and social life) in the evenings. If you’re serious about writing you will need to start treating it like a job.

The problem with the final strength of discipline is the Nano work-ethic stops in December.

This is one of the main things which frustrated me. After four times of successfully competing Nano, each month in December, I stopped writing and got my life back to normal. In that sense completing Nano to become a writer is more like asking a fish to take a massive gulp of air instead of learning to grow a pair of legs and walk on the land forever.

Congratulations: you’ve written a (big) story. You still aren’t a writer.

If you’re reading this and thinking, ‘Hey, I didn’t quit writing after Nano!’ Then great, you’re one of the very few people who I would say has a true writer-ethic. This blog post isn’t for you: it’s for all the December quitters—which includes myself.

Fixing Smashwords Epub validation errors

validator

Wow! I’ve just landed my clean HTML code with a load of epub validation errors!

Here’s what they mean:

tags! tags! tags!

First thing to do is to double (triple) check all your code is good. I found 1 closing div tag out and I got err’s. So check them all!.

1. img tag problems? Make sure there is no space between the last ” and the end of the closing tag. Eg:

 img src="#" alt="" height="100%" /> <-- bad
 img src="#" alt="" height="100%"/><-- good

Oddly, this only appeared to error on my first image of the page. So I recommend adjusting one and then running a validation check

2. em tags. Nope. Get rid of them. I had blockquotes too. In the end I got rid of them and added some font styles to replace the em tags, eg:

 div id="blockquote" style="text-align: center; font-size: 150%; font-style: italic;"

3. sup tags! Kill sups – add the following css:

style="vertical-align:super;font-size:.6em;"

Wait up a minute…

I’ve already managed to get my file to validate – Hooray?! I’m confused because many of the errors completely disappeared by making small changes. For example: errors appear to be created by blockquote and em tags (once corrected) vanished from the rest of file. I expected an inconsistency to be, erm, consistent. But no. em and sup tags are throughout my file, but the validator doesn’t care. Certain tags appear to cause issues: I’m looking at you em tag!

This place https://code.google.com/p/epubcheck/wiki/Errors didn’t appear to be much help in figuring out what the errors meant. Ahh well, at least my file has passed validation. If the validator link above passes, then it is extremely likely that the Smashwords meatgrinder will too – as it is based on the same thing.

Done – Mark 🙂

Kindle Book Development Process

convert

(note: the above isn’t my book btw – this is just a screengrab from the calibre website)

I’m done! Actually, yes. I’ve shipped my first version of the Kindle book to the client and am awaiting changes.

Sorry, but I’ve been so busy, I haven’t had time to update this page. Anyways, here is the process I’ve been working on:

  • Take the book text (I was working on a non-fiction title), and covert it to Markdown.
  • Run the book through a Leanpub.com conversion and you get a decent ‘epub’ file at the end.
  • Hooray, this has just solved a whole bunch of HTML formatting.
  • Add this epub file (it’s a book basically) to Calibre.
  • Edit the book.

Now things start to get easy or complicated depending on what you’re trying to achieve. Personally, I had a whole lot of layout issues, Table of Contents, images, references etc to deal with. You may not have this issue. Either way, I’m going to document what I can recall.

Essentially Leanpub creates a pretty good epub file, but I had a lot of files which I didn’t understand in my Calibre book editor, so to figure things out, I cleaned up my (xhtml) page code and saved it all out to new (html) files in a folder on my hard drive. Calibre doesn’t allow you to work on two books at a time, so I needed to save everything out individually. Why? Because the leanpub markdown file is singular, and the .epub file it creates is singular too. Confused? Yeah, don’t worry about it. Just keep reading!

Once I’d saved out my entire book into all the separate files I figured I’d need (css, table of contents, references, etc.) I created a brand new book. This got rid of all the weird files the Leanpub import created. I created all the individual pages I needed (naming the chapters appropriately) and pasted the page content back in from my hard drive backup. This left me with a ‘clean’ version 🙂

Don’t forget to add in the CSS link in the HEAD tag, and you should be set for formatting your page content.

Everything from this point was pretty easy. You will obviously need to know HTML to understand how to link up internal pages if you’re building a reference section, but if not, just crack on with tweaking page content and css code.

Don’t create your own Table of Contents as the Kindle conversion will create it’s own. This caused me a lot of headache – so don’t even bother trying until you’re experienced.

On that TOC note: once all your pages are into Calibre, you ‘build’ your TOC by going to Tools > Table of contents > Edit Table of contents. Easy to use and saves a lot of hassle.

Once you’re done save everything, close the editor, highlight your book, click to edit the book Info (meta data). Here you’ll be able to set the authors, the publication date, the tags, and comment description, and more. Once done hit Save. Now click to convert the file: in the top right drop down choose .azw3 and click convert. When that is done, connect up your Kindle and add it to your main memory. Eject it when done and check it for errors.

Once you’ve made a note of them. You’ll need to go back into the original epub file and make the changes. Be careful here as if you didn’t select .azw3 from the dropdown initially, you might have created duplicates. You’ll need to select the original epub file and edit that. Opening up a converted .epub or .azw3 file to edit will show you all sorts of page code which you didn’t write. This confused me so much, I actually removed the entire (converted) book from the Calibre library and imported my original saved epub file again. This has a downside of not saving the Meta data, but for me it wasn’t too bad to add it in again.

I ended up flipping to and from these converted and original epub files a lot in order to get to a final ‘good’ .azw3 file – but it was worth it.

Need help? Got stuck? Ping me a message. Either on here or my real website.