Quantcast
Channel: Justin Tadlock
Viewing all 153 articles
Browse latest View live

Day 2 of NaNoWriMo

$
0
0

National Novel Writing Month banner image.

It only took two days for me to start wandering around like a zombie. At 3,393 words, I’m barely out of the gates.

I knew today was going to be rough. The 2nd day of a 30-day challenge and it just so happened to be “shopping” day. I knew this beforehand. I knew I needed to buy groceries, cat food, and enough chicken feed to last a bit.

I’d prepared for this. I’d made a list of things to get me through at least another 2-3 weeks so that I didn’t have to waste precious time later in the month resupplying.

Yet, I overslept.

I rarely oversleep. I have cats who generally see that I’m up before the sun peaks above the pine trees in the morning. My “wake the fuck up” alarm, which I keep set for 7:30 a.m., was blaring.

Not a good way to start the day.

I lose a contact lens. I had one left to spare. I need to set an eye appointment at some point to re-up my prescription.

I didn’t sit down for my writing session until 1 p.m. I’ve never been a great afternoon, evening, or night writer. I do my best work early in the day, a few hours after I’ve allowed my body to slowly and naturally wake up.

But, I managed to haphazardly put words to screen, attempting to mine some gold from the long lost memories of my teen years as I jotted down prose of lust, love, and rebellion. Had I forgotten all I’d known? How can I describe those experiences?

Tomorrow, I should push beyond the 5,000-word mark and earn a new NaNoWriMo writing badge.

Maybe the weekend will be kind.


Election day and writing

$
0
0

Decorative solid blue image.

Today is election day in the U.S. I get to take my 19-year-old sister to vote for the first time. My faith in humanity and fellow countrymen makes me believe that our system will work. Checks and balances. That’s the intention of our three branches of government. In reality, the true check, the true balance, is the people.

As an Alabamian, I must come back down to reality. I have little hope that we’ll be anything but status quo. While there’s beauty in a place that’s holding on with all it’s got to remain unchanged, there’s a great sadness when underneath it all, so many must live with the boot of their own people firmly pressed to their necks.

I returned home several years ago to “get back in touch with my roots” and become a better writer. That means understanding the politics of this place. Maybe some of that knowledge will work its way into my novel. Maybe not. While I haven’t written much over the past few years, I have gained a greater understanding of the injustices that exist here that I wasn’t able to comprehend as a schoolkid. Those things stick with you. And, I should be doing more to make real changes. Perhaps one path toward that is to use whatever skills I may possess as a writer to shine a light on injustices in a mostly-forgotten place in the Deep South.

Today, I’ll vote.

Then, I’ll return home to my regular work, writing code and tutorials. I’ll spend some time working on my novel entry for the 2018 National Novel Writing Month. After 5 days, I’m up to 7,875 words of my 50,000-word goal. That’s about 1,575 words/day, which is a bit shy of my 1,667-word target.

I have a good excuse for being a few words behind. I only managed a bit over 700 on Saturday when I was practically on my deathbed. Through all of Friday night, I was up with stomach issues, hunkered over the toilet about once every hour. I’m not sure if it was some virus or something bad I ate, but it was the type of thing to make anyone come face to face with their own mortality. The human body can be wrecked in a matter of hours. Going from thinking you’re a healthy young man with the whole world in front of you to wishing for some temporary relief from it all is nothing to scoff at.

With no sleep or fuel in my body, Saturday was rough. But, I managed. I slowly reintroduced liquid and some solid food into my diet. I pulled an afternoon nap. Then, I used what energy I had to push through those 700+ words.

Frankly, I’m determined to finish NaNoWriMo this year. Deathbed or not, I was going to write some words. If nothing more than some scribblings on my notepad, pen would be put to paper.

I’m still weakened, but most of my strength has returned. My appetite is not what it was a few days ago, which may not be such a bad thing. I can afford to shed a few pounds.

I’m looking forward to finding out where my novel’s story goes. Maybe politics ends up playing some role. Maybe the events of today will shape how I view the world, and in turn, shape the stories that I tell.

Day 11 of NaNoWriMo

$
0
0

A coffee cup sitting on a desk next to a blank sheet of paper with a pen on top of it.

I just wrapped up 1,726 words for the day. I produced this in a 35-minute writing sprint and a later 45-minute sprint. Not bad for Day 11 of National Novel Writing Month (NaNoWriMo).

I’ve had two solid days in a row, which has given me hope that I may damn well finish this thing.

As a writer, you always have doubts. Half the initial battle is simply pushing those doubts aside and doing the work. Each day that you put in the work, you gain a bit more confidence that you’ll reach whatever goal you’re aiming for.

My manuscript is shit right now. But, it’s better shit than I had 11 days ago. First drafts are not meant to be Nobel-worthy prose. They’re brain dumps. You get the ideas out. You doubt yourself some more. Then, you put more words out.

Here’s my NaNoWriMo 2018 stats for the moment:

  • Total Words: 17,826
  • Words Remaining: 32,174
  • Average Words/Day: 1,620

NaNoWriMo is all about hitting the 50,000-word goal before the clock ticks 12 on December 1. Thirty days of dumping everything you can get onto the page.

More than that, it’s about building habits. I’m still struggling a bit with fitting things perfectly in my schedule. I’m getting better, but I still have a ways to go. I’ve written every day for 11 days now. That’s the big positive. Right now, I need to find the ideal time each day to write and stick to a schedule.

Over the last couple of days, I’ve started to find a bit more of a groove. I grew tired of the first character that I was following in my story. I found that I loved another character more. Then, I fell in love with a third character. It’s a good thing I’m writing in third person. I’ve hit a point where I can see some pieces coming together.

I have glaring plot holes. I’ve changed backstory from one chapter to another. But, I’m keeping my inner editor at bay. At the moment, it’s about telling the story. The other stuff can be addressed during the editing phase if/when I get there.

If there’s one piece of writing wisdom I’ve learned working on such a large project, it’s that I wish I would have made a basic outline of the story. Just having some idea of what should happen next would help me flow from scene to scene with less trouble. It’s something I’ll definitely do in future projects. I may try my hand at outlining some of the later stuff as I move along in this project.

Overall, I’m enjoying this challenge. Last week was tough after getting sick. There were certainly times when I thought of throwing in the towel, but I’m happy I pushed through. My energy levels have returned. I’m feeling much better. Tomorrow, I’m looking forward to sitting down once again and seeing where my story goes.

I will write a novel

$
0
0

Man adjusting typewriter. A page sits in the machine on a white table. There's a cup of coffee to the left and a phone sitting to the right.

I stepped outside and away from my porch this morning (I usually work on the front porch, breathing in the fresh air). I picked up a rake and gathered fallen red oak leaves into small piles that my cats are now frolicking in. Another pile seems to be the new, designated litter box.

I needed the movement. My muscles have had little work for the past three weeks outside of walking around the house and carrying the daily 5-gallon pail of water to the chickens and ducks. For the most part, I’ve been firmly glued to my chair on the porch.

I even made some coffee, which is not something I do often. I like coffee, but I tend to go on coffee-drinking binges where I’m slurping 32-ounce iced mochas at 2 a.m. and skipping whole nights of sleep. So, I limit myself to the heavenly concoction of fresh-ground coffee with chocolate or caramel or hazelnut to special occasions or just the random cup once in a while.

Yesterday, I completed my 19th day of National Novel Writing Month. That’s NaNoWriMo for those of you who haven’t followed my blog or have somehow missed the craze all November where people are posting daily word counts.

I finished the day with 34,275 words of NaNoWriMo’s challenge of 50,000 for the month. I’m in a good position at this point. I’m ahead of where I need to be and only have 15,725 words left to finish in the next 12 days (including today). If I keep up with my current pace of 1,803 words/day, I’ll have 2 days to spare. That’s good because I’m coming up on the busiest days of the month at the end of this week.

I can feel this NaNoWriMo win in my gut. I’ve come too far to let something like Thanksgiving, Black Friday, and Saturday’s Iron Bowl get in the way of crossing the 50K finish line and overcoming this challenge. After pushing through that stomach virus earlier in the month, this should feel like child’s play.

The novel I’m currently working on may never see the light of day. It needs a lot of work. I’ve changed so many things that anyone reading it now would think I’m hopping between alternate universes where one character is being portrayed by their doppelgänger from one chapter to the next.

Even though this work is so disjointed, I have a feeling that it’s the start of something bigger for me. I know for a fact that I have it within me to write a novel if I’m determined to do it. While I’m some 15K words away from completing the challenge, I already feel like I’ve won.

Aside from Pro WP Plugin Development, I’ve never written something this large in scope. And, I’ve certainly never written this much toward a work of fiction.

My fiction writing professor in college told the class on the first day the answer to the question that everyone would want to ask her by the end of the course—“Do I have what it takes to be a novelist?” She told us that every single person in that room had the talent to do it. But, it’s only the ones who put in the work that will actually become a novelist.

This is me putting in the work. I may have taken a few years of vacation, but I’m here now.

I am going to write a novel.

NaNoWriMo 2018: The home stretch

$
0
0

A desk in a dark room with a desk-lamp illuminating the area. A typewriter sits next to it.

Thanksgiving. Black Friday. Iron Bowl.

It’s a three-day time and energy suck for anyone who’s trying to maintain a high level of creative energy and get some work done. I managed to make it through the holiday and keep a good writing pace with 1,739, 2,331, and 859 words on each of the days. Yesterday was the toughest simply because my schedule didn’t allow for anything but a single 35-minute writing block.

National Novel Writing Month is now in its final week. At this point, many people have already won. Some folks passed the 50K-word finish line a week ago. Some are now soaring past 100K.

Me? I’m doing what I set out to do. I’m keeping a consistent pace and making it a habit to write every day regardless of whatever else is happening in my life.

Attempting to keep up with others would do little more than contribute to burnout. One of the things I love about NaNoWriMo is that I’m not competing against anyone else. The community is in this together. It’s encouraging to see others dealing with and overcoming many of the same struggles in their works of fiction. In the end, the only person you’re competing against is yourself. You either sit down, buckle up, and put in the work or you don’t.

I could’ve easily written yesterday off as a no-writing day, a day where life wasn’t going to allow me to put pen to paper. But, I felt the pull of my incomplete manuscript. It was calling me to continue the story. Habit. After three weeks of doing anything every day, it’s hard to break out of the routine. My habit-building plan was bearing fruit.

Early in the challenge, I was attempting to get to 1,500 words if I could. I knew if I could keep that pace, I could make up for any losses later. And, it seemed to work. I’ve had a number of 2,000+ word days since then and kept an overall pace of 1,822 words/day. I’ve built my writing muscles up to consistently write more in shorter bouts of time.

With the final 6 days of NaNoWriMo ahead, I have 6,254 words left to become a winner. I plan to hit that in 3 days and cross the 50K mark on Tuesday.

After you’ve written nearly 44K, a measly 6K is nothing.

I don’t intend to stop once I’ve crossed the finish line. I estimate that I’m only about 2/3 through with the story. There’s no “The End” for me this November. After NaNoWriMo is over, I want to finish the first draft of this novel.

Then, I want to get straight to work on my next writing project. I’ve had a good idea burning a hole in my brain for the last week or so that I want to spend some time on. It’d be a good time to let my first completed draft of this story sit. Perhaps I’ll come back and edit it after it’s mellowed for a time.

For now, I’ve got a challenge to win. 50K, here I come!

NaNoWriMo 2018 and Beyond

$
0
0

Winner's certificate for the 2018 National Novel Writing Month

Small ripples flow toward my chair at the edge of the lake, the aftershock of ducks playing across the way. They’re getting their morning bath in the cool water. I tug the plaid afghan tighter around my shoulders while waiting for the morning sun to breathe warmth across eastern side of the farm. The hens are already cackling, their voices overpowering the rooster who has been crowing since 3 a.m. One must have laid the first egg of the day. She and her sisters are letting the neighborhood know about it.

I take a sip of my coffee before opening the pages of my leather notebook, a gift passed down from my grandfather. I need to continue penning the great Southern American novel before hitting the fields. A few crops from the fall plantings remain. It’ll be winter soon. My morning routine will need to adjust. For now, I’m bearing through the chilly mornings. I want to enjoy what time I have left writing from my favorite spot.


Don’t mind me. I’m just picturing where I’d thought I’d be at this point in my life. The goal was to be a fulltime writer/novelist by the time I was in my 30s. My 40s at the latest. I always had this Walden-meets-lake-house-in-south-Alabama picture in my mind where I’d spend my mornings finding some inner truth about what it means to be human, to inhale the nature of the world and spew it out on the page.

Life has a funny way of taking you on twists and turns and side-streets and down-the-road-to-see-your-auntie and everything else in between.

I’ve been fortunate enough to do work that I love for the past decade, but it’s not the big dream. My dream of being a writer led me down the path of creating a blog. Then, I learned to code so that I could fix things on my blog, which led me to a career in Web dev. Now, I’m back to the beginning. I need to continue focusing on the reason for me going down this path in the first place—writing.

After 13 years since my first attempt at a novel, I decided it was time to put effort into realizing my dream of being a novelist. Therefore, I decided to give National Novel Writing Month another go.

I won.

The challenge was to write 50,000 words toward a completed first draft in 30 days. I passed the mark three days early. I wrapped up the month with 55,216 words. Trust me when I say that is no small feat when you’ve built up 13 years of fiction-writing rust.

Today I want to share some of the things that I learned during this journey.

No way I could write that much

When I tell people about the challenge, one thing they always say is that there’s no way they’d come close to writing that many words in a month. While I did say that it’s no small feat to punch out 50K words in a month, it’s actually not that hard when you break it down to smaller goals.

To hit that magical 50K finish line, you must average 1,667 words each day. That doesn’t mean you must hit that number every day. You can start out slower, get your writing muscles in shape, and finish out strong.

I kept a personal goal of shooting for at least 1,500 every day. I only seriously undershot that goal on 2 days—once when I was sick with a stomach virus and once on a busy Thanksgiving-esque weekened dinner with the family. I still wrote on each of those days without hitting my goals, but that was okay.

When it comes right down to it, consistency is more important. This is something I’ve learned over the years from Web development and other challenges I’ve taken on. Putting in daily work, no matter how much, will keep you on track for doing whatever it is that you set out to do.

Writing 1,000 or 2,000 words in a day is nothing for me. I do it often when writing blog posts, tutorials, or some form of documentation. I’m certain this post will be in that ballpark. Keeping that pace every day for a month made for a bit of a challenge.

For a good part of the month, I wasn’t on par with where I should’ve been to hit 50K. However, I was always close behind. Somewhere toward the end of the second week, I was blasting out 2,000+ words on some days. I’d built up a good habit and my fiction-writing muscles were churning away. In the final week, I was well ahead of where I needed to be, with two or three days of wiggle room in my schedule

Crossing the 50K finish line is great, but crossing the 25K midway point was the best part of the experience. Once I hit that, I was like, “I got this.”

The best piece of advice I can provide to anyone who might be considering writing a longer work of fiction is to not worry too much about the end goal of hitting 50K, 75K, or even 100K words. Think about consistently working on your manuscript and setting up smaller goals for yourself along the way.

Mastering a craft is work

One of the things I’ve tried to teach my younger brother recently is that he must put in the time and work to become a great songwriter. Talent is not enough to take him to the next level. Writing songs whenever the mood strikes you is not a great plan of action if your imagination isn’t in the mood every day.

In the opening paragraphs of this post, I laid out an idyllic vision of a writer’s morning. We all have these pictures in our heads of great artists building the most beautiful works of art when their muse gifts them with their next creation.

In reality, it’s all about honing your skills. Learning the craft. And doing it over and over and over.

When I first became a Web developer, I sucked at it. I mean I really sucked. I wrote my first bit of HTML code in the spring of 2003. It’s been 15 years now, and I’m still learning new things all the time. I’m always becoming better at what I do.

I’m a few chapters away from completing this first draft that I began on November 1st. As an avid reader, I can tell you that it’s not particularly good. I’m okay with that. It’ll probably be a while before I create something that I’m ready to share with the world.

What I have done is learn. I imagine in 10 years that I can look back and share this first draft as an example of everything not to do when writing a novel.

Practice makes perfect.

I know it’s a cliché, but it’s a good one. It’s a saying that we all learn from the time that we’re children. I will continue practicing and one day publish a novel.

Wrapping up the first draft

Today is the first day that I’m not required to write anything toward my first draft. The challenge is over, but the manuscript is unfinished. I’ll probably write something anyway. It’s in my bones now. Writing has become an addiction that I must satisfy.

I am going to slow my pace a bit. My next challenge is about finding the right balance between writing and my regular design/dev work. There’s only so many hours in a day that a person can spend doing deep work. Because I’m in a field that requires a high level of creativity, I need to not burn it all out on writing. I must save some of that energy for putting food on the table.

My new writing goal is going to be to hit 1,000 words each day until I complete the first draft. I’m estimating another 15,000-20,000 words before the story is complete. If all goes well, I will have completed my first first draft of a novel.

Beyond NaNoWriMo

I’d like to say that I’ll move immediately to the first revision phase of my current novel in January. Being perfectly honest, I have a couple of other ideas that I’d like to get into. The act of creating a story has opened my mind to other ideas, and I’m itching to work on them. I’ll wait to see how I feel about that after I’ve completed the first draft and made it through Christmas.

I will continue writing something.

While I talk about this being work, I haven’t mentioned how much fun it is. I love stories. Books. TV. Movies. D&D (which I recently played for the first time). I love it all. The great thing about writing a story is that you get to learn and grow and laugh and cry with characters that you created.

People ask me all the time what the story is about or what’s going to happen. I tell them that I don’t know; I haven’t finished the story yet. Writing is an act of discovery. With each new writing session, I learn something new about my characters that I didn’t know the day before. Non-writers think that’s weird and that I should already know what’s going to happen. The act of discovery is half the fun for me.

With that said, I want to try my hand at plotting an outline in the next first draft. At least build a rough path for my characters to travel and return to if they veer off course. I was a pantser this NaNoWriMo, which is someone who is writing by the seat of their pants.

I’m fairly certain that I’ll take on this challenge again in November 2019. In the meantime, I’ll keep working on my craft.

PHP Namespaces For WordPress Developers

$
0
0

Laptop sitting on a table with a notepad and pen in front of it.

It seems like ages ago when I stopped working with PHP 5.2, which is currently the minimum version to run WordPress. One of the primary reasons for this for me as a developer was to use PHP namespaces, introduced in PHP 5.3. There are many other useful features brought to the language in the past decade, but namespacing is one of my favorites.

With talk of WordPress bumping the minimum PHP version in 2019, I figured it was finally time to wrap up this post on why plugin and theme authors should be making the switch to proper namespaces now (or, rather should’ve already made the switch).

I encourage you to read the official PHP namespace documentation once you’ve finished this post, which will give you a more in-depth look over what you can do. This post is merely a primer and will cover the foundation of namespaces.

What are PHP namespaces?

In a nutshell, namespacing is a method of grouping all of your code under a custom name. That way, your classes, functions, and so on don’t clash with other people’s code running on the site at the same time.

If you create a class named Post and another plugin creates a class named Post, you get a fatal error. Developers have long dealt with this by prefixing their class names with something like Justin_, creating the Justin_Post class. Prefixing is one form of namespacing your code. However, prefixing is not formally supported by the language. There are no features built specifically for working with it.

With the release of PHP 5.3, the first iteration of an officially-supported namespaces came into being. Now, our fully-qualified Post class name becomes Justin\Post with Justin being the namespace.

If you’ve been prefixing function or class names, you’ve already been namespacing your code. Cool. Now, you can take it to the next level and use the officially-supported method.

How to create namespaces

To create a namespace for any particular class or group of functions, you need to declare the namespace at the top of the file. No other code should come before your namespace declaration other than the opening <?php tag or comments.

Here’s an example of a single class file (files with a class should only have that one class and no other functions or classes):

namespace Justin;

class Post {}

Here’s an example of a file with functions:

namespace Justin;

function do_something() {}

function do_something_else() {}

Once you’ve declared the namespace at the top of the file, all code within the file will be under that namespace.

Importing code from a different namespace

Let’s suppose we have a post helper class in our theme or plugin as shown in the following code block.

namespace Justin\Helpers;

class Post {}

We need to reference that in another namespace. For that, we’d utilize the use statement to import the Post class. use statements should come after the namespace declaration.

namespace Justin\Template;

use Justin\Helpers\Post;

class View {

	public function display() {
		$post = new Post();
	}
}

You can also use an alias for the Post class if you wish. In the following example, we give the Post class an alias of PostHelper.

namespace Justin\Template;

use Justin\Helpers\Post as PostHelper;

class View {

	public function display() {
		$post = new PostHelper();
	}
}

If you want to import a function instead of a class, the use statement is a little different. In the following example, use becomes use function.

use function func_name;

Referencing namespaced classes directly

You don’t necessarily need to import a class or function to use it outside its namespace. You can call the class using the fully-qualified class name.

$post = new \Justin\Helpers\Post();

For one-off uses, that makes a quick way to call up a class or function.

Autoloading and organization

No tutorial on namespaces would be complete without digging into the PSR-4: Autoloader standard. This is the standard used by the wider PHP development world. One day, I hope that WordPress itself will embrace it. While autoloading isn’t strictly related to namespaces, I’ve found that most developers who begin using namespaces almost immediately start seeing the benefits of autoloading.

Autoloading is a method of automatically loading class files when a given class is called. In the past, you may have been including all classes like in the following example.

require_once( __DIR__ . '/class-a.php' );
require_once( __DIR__ . '/class-b.php' );
require_once( __DIR__ . '/class-c.php' );

And, anytime you changed, added, or removed a class, you were forced to change your loading code. With autoloading, you no longer have to do that. Your classes are simply loaded when you call them. This also cuts back on the amount of code that you load at any given time. If a class isn’t called on a particular page, it’s simply not loaded. While this is unlikely to be a bottleneck in any particular application, we should still strive for that sort of efficiency in our code where possible.

The PSR-4 standard provides a couple of important things:

  • Method for naming classes, traits, and interfaces.
  • Rules on file and folder naming based on those classes.

Given our earlier classes of Justin\Helpers\Post and Justin\Template\View, your plugin files may be ordered something like the following.

plugin.php
	/src
		/Helpers
			/Post.php
		/Template
			/View.php

PSR-4 doesn’t say you need the /src folder, but it’s a widely-used convention. I prefer it as “the place where your PHP source code lives.”

The folders below /src follow our namespacing and class-naming rules.

  • Each sub-namespace gets its own folder (case-sensitive).
  • Each class gets its own file (case-sensitive).
  • Justin, the primary namespace, is not used. If you wished, you could use it as a folder.

Basically, the folder and file structure matches the fully-qualified class names. This simplicity makes autoloading easy.

Standards are good for development communities. By following PSR-4, it means that most PHP developers can pick up your code and immediately figure out where things are. Over the years of reviewing both theme and plugin code in the WP community, there’s nothing I dreaded more than not being able to find things because of some custom organizational system.

Autoloading with Composer

If you utilize Composer, which is outside the scope of this tutorial, autoloading classes is as simple as configuring the autoload argument in your composer.json:

"autoload"    : {
	"psr-4" : {
		"Justin\\" : "src/"
	}
},

Composer will handle autoloading your classes from there.

Custom autoloading

If you’re not using Composer, you’ll need to register an autoloader. I’ve included a sample one below. There are others out there that may suit you better.

spl_autoload_register( function( $class ) {

	$namespace = 'Justin\\';
	$path      = 'src';

	// Bail if the class is not in our namespace.
	if ( 0 !== strpos( $class, $namespace ) ) {
		return;
	}

	// Remove the namespace.
	$class = str_replace( $namespace, '', $class );

	// Build the filename.
	$file = realpath( __DIR__ . "/{$path}" );
	$file = $file . DIRECTORY_SEPARATOR . str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';

	// If the file exists for the class name, load it.
	if ( file_exists( $file ) ) {
		include( $file );
	}
} );

Start using namespaces today

Just because core WordPress hasn’t updated to newer versions of PHP doesn’t mean you can’t user newer features in your own plugins and themes. I’ve been running my most popular plugin on PHP 5.6+ this year with few user issues. Even those were just a matter of getting the user to upgrade from their Web host’s control panel.

Namespaces are widely-used throughout out the larger PHP development community. Getting used to working with them will help you better understand general PHP code when you come across other projects.

Winter 2018-2019 network TV schedule

$
0
0

Vintage brown television.

The fall network TV season is coming to an end. Shows are taking their mid-season breaks while families enjoy the holidays. For me, I’ve been more in a reading mood lately anyway, so it’s a nice to have a break from my regular shows.

For the most part, I’ve enjoyed my original fall 2018 lineup. I’ve let a couple of shows go. Some are edge case at the moment, depending on how things progress.

Schedule

The following is a look at my planned schedule. Shows with a * next to them are new additions. Dates listed are premieres or when a show changes spots in the schedule. Wednesdays and Fridays are getting pretty thin.

Sunday

  • 7:00-8:00 - God Friended Me (CBS) - 2/17
  • 7:00-8:00 - Supergirl (CW)
  • 8:00-9:00 - Charmed (CW)

The Orville will premiere on December 30 following an NFL doubleheader.

Monday

  • 7:00-8:00 - Arrow (CW)
  • 8:00-9:00 - Black Lightning (CW) - 1/21

Tuesday

  • 7:00-8:00 - The Gifted (Fox)
  • 7:00-8:00 - The Flash (CW)
  • 8:00-9:00 - Roswell, New Mexico * (CW) - 1/15
  • 9:00-10:00 - The Rookie (ABC)

Wednesday

  • 7:00-8:00 - Riverdale (CW)

Thursday

  • 7:00-7:30 - The Big Bang Theory (CBS)
  • 7:30-8:00 - Young Sheldon (CBS)
  • 7:00-8:00 - Supernatural (CW)
  • 8:00-9:00 - Legacies (CW)
  • 8:00-9:00 - The Orville (Fox) - 1/3

Friday

  • 7:00-8:00 - Blindspot (NBC)

Thoughts on the season thus far

Here’s a rundown on some of the shows I’ve been watching. I’m not covering them all, particularly if I don’t have any strong feelings one way or another.

Charmed

I almost gave this reboot the boot after the first couple of episodes. Some of the dialogue neared feminazi territory. I love shows with strong, kick-ass heroines, but show me rather than tell me (see: original Charmed, Buffy the Vampire Slayer). Plus, the first bad guy was a cheap knock-off of the white walkers from Game of Thrones. The show started finding its balance and is one I look forward to each week.

God Friended Me

Atheist gets friend suggestions from a mysterious God account on social media? Sounds like the silliest show idea I can think of. Must watch. Really, I’ve been enjoying this show. There’s a little substance there. It’s been a feel-good ride where the protagonist helps people in need.

Supergirl

I was already a fan. This season has been about tackling xenophobia, racism, and sexism. At times, the issues have been a bit too in-your-face and not presented in a balanced manner (aside from one episode where Sam Witwer was superb in portraying his character’s backstory). It’s been mediocre at times this season; I just hope the writers can dig just a bit deeper.

Arrow

I had begun growing tired of the series. It was starting to show its age. Oliver Queen’s backstory was done. I wasn’t sure about the prison storyline at first, but I liked seeing Oliver becoming a broken man and having to overcome that. I’m excited about how he grows in the latter half of the season. Felicity has been my least-favorite character this round.

Legends of Tomorrow

It’s a fun show with a ragtag group of heroes (if we can call theme that) in a time-traveling machine. What’s not to love? The show doesn’t take itself too seriously, which makes it a fun ride. Constantine has added some balance. And, it’s nice to see Maisie Richardson-Sellers return as a regular.

Manifest

The idea seemed pretty cool. Airplane disappears for several years. No one on the plane knew they were gone when they return home. Some may have special powers. Maybe a bit like The 4400, which I loved. But, it took far too many episodes for anything worthwhile to actually happen. Maybe it’s found its stride by now. I wouldn’t know. I gave up.

Black Lightning

I wanted to love this show. I stuck through the first season. I’ve stuck through half of the second season. I’m a Cress Williams fan. But, I never fell in love with it like I did the other DC shows. I’ve been tuning in, mostly using it as background noise while I do other things around the house.

The Rookie

This is my favorite new show this season. It follows a middle-aged man who decides to become a cop. The premise is a built-in joke factory, but the show tackles social issues without going over the top. Plus, I’ll pretty much watch any series with Nathan Fillion.

Riverdale

I fell in love with season 1 of this show. But, my faith in has been dwindling. Mostly, I’m bored with it. It has some murder-mystery story arch based off D&D going on this season. It’s just sad at this point. But, Wednesday night is pretty dead, so I carry on.

All American

I was hoping for something with the quality of Friday Night Lights. This show did not fill that void. Too much about rich high school kids. Not enough about football. I’ve skipped the last two episodes and don’t plan on revisiting it.

Legacies

I like this continuation of The Vampire Diaries and The Originals. I grew tired of the first two. The show still has a lot of growing up to do. Or, maybe I’m just getting older and care less about the overly dramatic aspects of high school.

Blindspot

It was a cool concept in season 1. I enjoyed the second season. Now that we’re in season 4, I’m just watching for the sake of watching. Mostly, the show feels a bit played out.

Midnight, Texas

A supernatural show that’s not as good as the offerings on The CW. It has its moments. Mostly just filler for Friday nights with nothing to do. The Rev storyline this season had the best moments.


Hosting Interview With iThemes

$
0
0

I done a quick interview on Web hosting with iThemes. Hosting isn’t an area I’m particularly interested in, but it’s all a part of the process. I tend to think in terms of having ready-made solutions that aren’t a lot of work when it comes to the average user.

My Experience With Google Fi

$
0
0

After several years with Verizon, I’d had enough. It was time for a change.

I’d been paying around $55 per month for service while still using my old iPhone 4s. For several months, my iPhone no longer worked over cellular data. It’d been a good phone. Sturdy. Well-built. We had a good 5-year run together. But, it was time to move on.

As for Verizon, well, I don’t have a ton of good things to say about them. They have great coverage in most places. And, even though their coverage map claims to blanket my home and everywhere around, it doesn’t. The one good thing they had going for them was pretty much irrelevant for me. I have a couple of other horror stories dealing with their customer service and somewhat shady business practices, but this post isn’t about bashing Verizon (at least not too much).

I needed a new phone. And, upgrading with Verizon meant getting stuck in a contract and a bill that would be fairly high—higher than any amount of need or enjoyment I’d be getting from its use.

It was time to shop around.

Deciding on Google Fi

I knew for a fact that T-Mobile had good coverage in my area. Several of my friends and family use the service. I wasn’t sold on their offerings though.

Enter Google and its Project Fi, which is now simply Google Fi.

Instead of putting up their own cell towers, Google Fi utilizes Sprint, T-Mobile, and US Cellular towers. Your phone will attempt to find the best signal and switch you to that. Given the many T-Mobile towers in my area, this was a big plus. Calls also go over Wi-Fi.

Pricing is the other factor. Google has an ideal pricing structure for folks who spend a lot of time around Wi-Fi. For $20/month, you get unlimited talk time and text messages. Then, it costs $10/month for every GB of data. Once you hit 6 GB of data, you’re no longer charged. And, your speed is throttled after 15 GB. This is a non-issue for folks like me with near-constant access to Wi-Fi.

And, one of the biggest pluses is there’s no contract. I’ll repeat—no contract. No signing up for a two-year commitment to some company you may decide you don’t like in 6 months. No agonizingly long wait until you can make the switch elsewhere.

The Web site and app

If you’re a fan of Google services, you’ll feel right at home with their Web site and app. Everything is simple, fast, and to the point. I’ve never had to hunt down anything that I was searching for. I can check billing or anything else I need in seconds.

Other carriers could learn a few things from Google Fi in this regard. I feel like I’m constantly be bashed over the head with offers or new phone sales elsewhere. Competitor sites also tend to be slow and clunky.

Google Fi’s site and app interfaces were definitely checkmarks in the “pros” column when making a decision.

A new phone

When I first signed up for Google Fi, there were only a handful of phones that could be used with the service. That’s not the case today. Google has opened its service to many more phones now.

At any other time, not being able to use my existing phone would’ve been a deal-breaker for me. Fortunately, I was in the market for a new phone.

I had previously tested the Google Pixel, and using the latest Android felt just as natural as anything else I’ve used. Frankly, I like the experience a bit better than iOS. Making the switch to the Pixel was a great decision. It even replaced my iPad as my primary device when lounging around the house.

A year and a half later

I’m just past the year and a half mark with the Google Fi service. I’m still using the same Pixel phone and will likely continue using it for at least another year. It hasn’t shown much aging.

Overall, I’m happy with the service. I live in a rural area, about 20 minutes to the nearest small city. I get service at home, which is my main reason for finding a new carrier. There is one stretch of highway that’s a dead zone in an area that I frequently drive. But, it’s something you learn to live with in the country, regardless of the service provider.

My one complaint is the lag while talking over Wi-Fi, and my phone sometimes connects to that when people call in. I’m always a half second behind in the conversation. I suspect that has more to do with my home satellite Internet connection than anything, but I haven’t tested calling over Wi-Fi from a cable or DSL connection. For the most part, it’s a minor nuisance once in a while.

My largest service bill has been right under $25 for a month, which includes taxes and other required fees.

Get some free credit

If you sign up for the service, please use my Google Fi referral link. We’ll both get a $20 credit, which is pretty sweet. Actually, I’ll get a $100 credit for anyone who signs up by January 8, 2019.

I’m not just writing this post for the credit though. I thoroughly enjoy the service and plan on using it as long as Google continues providing great service.

One year with the Kindle Paperwhite

$
0
0

Kindle Paperwhite e-reader laid on top of a colorful library-esque case for the device.

As I write this, I’m counting down the hours until I can return to Brandon Sanderson’s Skyward. I immediately started reading it after wrapping up The Handmaid’s Tale by Margaret Atwood, which I snagged for a cheap $2.99 during Amazon’s Cyber Monday deal. I could’ve continued reading Sanderson’s work through the night, but I needed to get up and actually do some work this morning.

In January, I received a Kindle Paperwhite. It was a gift from an awesome supporter in the Theme Hybrid and WordPress community after seeing my plan to read 100 books this year. This is perhaps one of the most-used gifts I’ve ever received (outside of some gaming consoles I got as a kid).

I had tested one of the earlier Kindles years ago. This was before the devices had backlights for reading in the dark and were not quite as nice to use. From that experience, I had determined that real books were still better.

Fast forward to January. By then, I felt like my physical book collection was getting out of hand. I was at a point in my life (and still am) where I was striving for more minimalism. I revisited the Kindle idea. They were certainly better than the models from years ago. This gift was the best thing that happened to me in terms of reading habits. While I’m a bit behind my goal of hitting 100 books for the year, I’ve read far more than I have in previous years. A lot of the reason for this is the versatility of the Kindle.

I still love the feel of a good ol’ paperback in my hands. I love the smell of used bookstores. I love picking over stacks of old novels at garage sales to find a diamond in the rough. But, the Kindle has pretty much been a godsend and become my primary method of reading.

The Kindle is easier to read

I’m not as young as I once was. My eyesight has never been great, but it’s gotten worse over the last few years. Being able to adjust the text size is nice. I can hold the Kindle at a comfortable position away from my face for reading.

The backlights in the Paperwhite also help in low-light situations. Previously, the only good place I had for reading at night was in a specific chair with a good light next to it. Now, I can lounge wherever without having to adjust the lighting of the room.

One-handed reading is something I prefer. I like being able to hold the book in one hand or the other while enjoying a good novel. Unfortunately, some books aren’t so great for that, particularly longer works. With the Paperwhite, I can hold the device and swipe from page to page with one hand.

The downsides of the Kindle

Perhaps my biggest complaint about the Kindle is that book covers are not as cool. The black-and-white versions are not as fun as the full-color print copies. I know you’re not supposed to judge a book by its cover, but book cover design is an art form in and of itself. I love a good cover design and will definitely pick up a book with an exceptional cover once in a while, regardless of whether I’m interested in the contents.

The second complaint I have is mostly a non-issue when you spend 99% of your time actually reading. The Kindle isn’t quite as responsive to swiping and tapping as modern cell phones and tablets. I imagine this has to do with the technology being different and geared toward the reading experience. It’s fine when simply flipping to the next page in the book. But, on other screens, it’s a minor annoyance.

My love of reading has returned

Well, I’ve always loved reading. I’ve just not done as much of it as I wanted these past few years. But, it’s become such a good habit for me this year that I even got back into writing. As most followers of this blog know, I competed in and won National Novel Writing Month last month, which was a huge accomplishment for me. I’m still working on finishing the novel I started.

So, more than my love of reading returning—my love of writing has.

Secondborn: Book Review

$
0
0

Cover image of the 'Secondborn' book by Amy A. Bartol.

I love stories set in a dystopian future where the protagonist(s) must break the societal chains holding them back and become a hero. Secondborn by Amy A. Bartol seemed like it’d fit into that mold.

Firstborns are the upper class. They rule the world. Secondborns are government property and essentially cannon-fodder in an ongoing war. Thirdborns are outlawed and killed. It’s similar to many other faction-based stories. Potentially pitting sibling against sibling seemed like an interesting take.

It was almost a cool concept until I realized early on that the population would be in a serious decline because only firstborns are allowed to bear offspring, one of whom would be a firstborn and the other a secondborn. After a few generations, there’d be few people left. Perhaps there was a good reason for this unsustainable society. I don’t know. The author never explained. Despite this serious flaw in how this world operates, I figured that it’s fiction. I could put aside this obvious foundational issue and see how I liked the story.

There’s a whole other faction system called Fates. Swords, Stars, and others. I can’t remember them all at this point.

Roselle St. Sismode comes from the most elite family in the Fate of Swords. The world has watched her grow from a small child until she reached adulthood when she shipped off to fight in the war with the other secondborn citizens. It’s through her eyes that we learn about this world. The problem? Roselle seemed like a kick-ass character that I’d enjoy growing with through this story. But, more often than not, it seems she’s just along for the ride with other characters, such as Hawthorne (her love interest), saving the day. I never felt that Roselle learned and grew as a person. Perhaps I was expecting more of her. And, maybe she gets there in Traitor Born, the second book in the series.

The romantic scenes were a bit awkward. But, I’m pretty forgiving on that front. It’s tough to write those scenes well. Given that Roselle’s character is fairly inexperienced having lived under the watchful eyes of the entire world, it sort of makes sense that it wouldn’t feel right. But, the chemistry wasn’t there. Hawthorne seemed little more than a love interest for the sake of having a hunky male in the story. A prop. Roselle could’ve just as easily stood on her own without him.

It’s not all complaints from me. Bartol excels at writing a fast-paced story at times. It was an easy read. It’d make for a fun afternoon adventure if you had little else to do. I like Bartol’s writing style well enough, which makes it tempting to see where the series progresses. I may pick up the second book for one such afternoon.

There’s enough twists and secrets to make me want to continue with the next book. The politics of how this society works would be interesting if the author dives more into that aspect of the world.

If you read Secondborn for pure entertainment and little more, you should enjoy this novel. This is for people who prefer young adult fiction.

⭐⭐/5 stars.

Christmas 2018 haul

$
0
0

Pile of books, including the D&D core rulebooks, Caraval, and Forest of a Thousand Lanterns. A Kindle Paperwhite sits at the bottom of the pile.

It’s been a long while since I blogged about the gifts that I’ve been fortunate enough to receive for Christmas. But, it’s always a fun thing to do. I enjoy seeing what others received, so I thought share I’d my Christmas 2018 haul.

This year seems to be the year of books. And socks (not pictured). 😊

I managed to get all three of the Dungeons & Dragons core rulebooks. A couple of awesome people got me the Player’s Handbook and Dungeon Master’s Guide earlier in the month. I’ve already devoured both and am looking forward to diving into the Monster’s Manual whenever I get a chance.

I’m still a D&D noob, but I’m learning more about the game. I wish I had known how fun it was in the previous 30-something years of my life. The tradition of people gathering around the fire and telling stories is one of the most uniquely human activities we can participate in. Turning this tradition into a fantasy-based game with dice is just plain fun. I’m hoping to eventually run my own games as the Dungeon Master.

Family members also picked up paperback copies of Forest of a Thousand Lanterns and Caraval for me. Both of these books seem to have unique concepts. I’ll probably start diving into these in the coming weeks.

At the bottom of the photo above is my Kindle Paperwhite with its new library painting cover. I’ve been breaking it in for a couple of weeks. I love this cover because it just makes me want to read more.

If I didn’t have enough to read, my parents made sure I would. They sent me an Amazon gift card that will definitely keep me in books for a few months. Although, I do wonder if they were just being lazy shoppers this Christmas instead of encouraging me to read more.

I did get restocked on socks this year. You can never go wrong gifting socks and lots of them. And underwear. Seriously. Especially for men. You know we’ll wear stuff until it’s ragged and aren’t likely to go buy new ones for ourselves.

The Handmaid's Tale

$
0
0

Cover image of 'The Handmaid's Tale' by Margaret Atwood.

The Handmaid’s Tale has become a bit of an anthem for protecting women’s rights and equality in the United States in these past couple of years. The adaptation of Margaret Atwood’s book into a television series had a bit to do with that. I’ve never watched the series, but I am aware of its impact culturally to some degree. I’m told the series deviates from the book.

Works that are so socially relevant and help define a movement are sometimes hard to review because you run the risk of the modern-day Internet mobs raining all manner of hell upon your life if you disagree with their interpretation. For that reason alone, I let this great literary work sit aside for a couple of years after first hearing of it. And, I’m glad I let it be. I needed time to allow my mind to dissociate the work from the movement.

I wanted to enjoy the work on its own merits and not at the complete demand of a social movement.

When I began reading, I nearly put the book down. There was dialogue without quotation marks, a standard that has existed a long time. I’m able to forgive authors some stylistic decisions for the sake of telling their story, but this particular issue was a major annoyance early on. As I continued reading, I realized that Offred, our narrator and protagonist, was telling the story of her past when this stylistic choice was used. I was able to adapt eventually, but I struggled with it for at least half the book.

My second issue with style was the use of commas to continually string thoughts together. I found it tough to slog through at first. However, I eventually learned to appreciate this choice. What was a bit of a nuisance became a powerful method of presenting Offred’s voice.

The Handmaid’s Tale is presented in a dystopian version of the United States called The Republic of Gilead. The people live under an authoritarian theocracy. Many of the population, particularly men, are sterile. The ultimate use of women is to have babies. These are the handmaids. There are other levels that women serve in the caste system, but the handmaids were the most important.

While this was very much a patriarchal society, men were also slaves to the state. That’s not something I hear as many people talking about. Yes, women were lower than women. They had fewer rights. But, men had to perform their duty to the state or face execution.

As a man, I struggled with the first “rape” scene of the book. Even Offred didn’t want to directly call it rape. While the commander she served under had power over her, it wasn’t his power that forced the two to have sex in this instance. The state was the brutal rapist, forcing the two into an attempt of passionless procreation. In many ways, this was the worst scene from a male perspective. Most men do seek more than just the bottom half of a woman. We thrive on passion and love as much as anyone.

While the majority of men in this society had little power, women had no power. And, what power men did have, they did not wield it for good. Fred, the commander, used his status to get away with the things not officially sanctioned by the state. Because he was a man, he had enough leeway to manipulate the system. Men held the most power. When coupled with the authoritative hammer of religion, it’s not a good combination. This is a story that we’ve seen all throughout history. It still happens today in many parts of the world.

It’s a mistake to look at this objectively.

The epilogue is where Atwood’s brilliance shines. The discovery and deconstruction of Offred’s story, found recorded on tapes, was handled by men. These same men tell us that we must not apply modern (in the year 2195 AD) thinking to a society of a past. That we must look at these from a historical perspective and not make judgements. I remember such men teaching history courses when I attended college. As a society, I believe we must, at times, apply modern ethics to different cultures from the past in order to truly learn the lessons that these histories teach us. Ultimately, I have to believe that’s the lesson that Atwood wanted us to learn—we cannot simply view history without making moral judgements of the people who lived during that period, lest we repeat those mistakes from the past.

The Handmaid’s Tale is as relevant today as it was three decades ago. This novel is a champion for anyone who has the potential to be the oppressed, which is literally everyone. It should serve as a reminder that any society is only a handful of wrong turns to far less freedom than we enjoy today.

Atwood’s work is not something I’d recommend to everyone. You won’t find an exciting plot. You won’t find too many heroes. Depending on your outlook on life, you probably won’t feel particularly optimistic about the human condition. What you will find is a timeless look at the pain that the most powerful have inflicted upon others throughout history, shown through the eyes of a woman who has had everything taken from her.

⭐⭐⭐⭐/5 stars.

Christmas dice game

$
0
0

Cardboard paper dice with two index cards stacks, one reading 'Dare' and the other reading 'Truth'.

There’s an ongoing joke about that one drunk uncle everyone must tolerate during the holidays at family gatherings. Everyone has one of these, right? Now, imagine playing a game where said uncle was forced to prance like a reindeer across the living room floor to exchange gifts during a thrilling gift-swap game.

Or, imagine your sister having to pretend to be Santa riding in his sleigh until someone guessed who she was and what she was doing. What a way to get some revenge on a sibling. :)

Enter the holiday-gift-swap-dice game with a bit of truth or dare thrown in the mix (credit to The Dating Divas for the game idea).

Fortunately, my uncle wasn’t drunk this year, but that made it all the much better. As he hit a 5-spot on the die, he pulled the first “dare” card, which read, “Prance like a reindeer to someone across the room and swap gifts with them.” Having him perform the feat completely sober was as good a Christmas gift anyone could ask for.

The game was a huge success with my family. I don’t think we’ve all laughed that much as a group in years.

How to play the game

Everyone must bring a gift that is suitable for all participants. We kept our limit around $10. These gifts are placed in the middle of the room. The game begins by having everyone choose a [wrapped] gift and going back to their seats.

Then, someone gets to roll the die (doesn’t matter who starts—oldest, youngest, etc.). Everyone takes turns rolling, going in a clockwise direction. The game ends after every gift has been opened and everyone has had an equal number of rolls.

When you roll, here’s a list of the possible actions, depending on the number you hit:

  1. Everyone pass their gift to the left.
  2. Everyone pass their gift to the right.
  3. Swap your gift with anyone of your choosing.
  4. Pick a “Truth” card.
  5. Pick a “Dare” card.
  6. Open your gift. If already opened, choose someone else to open theirs.

You may need to make adjustments for your crowd. We had 10 people and went 4 rounds.

The die

I created a single, 6-inch die from scrap cardboard, printer paper, and tape. This made it big enough for everyone to see without having to stand around the table. But, it was small and light enough to toss around the room.

I don’t recommend normal dice for this, especially in a big crowd. You could also pick up some of them fuzzy dice. I wasn’t able to find those in town and opted to make my own.

Truth cards

I created 10 truth cards. These were more along the lines of the “have you ever” drinking game. Except for taking a drink, you stand and swap gifts with the others who have done the same. Some examples:

  • If you’ve ever re-gifted a gift…
  • If you’ve watched a Hallmark Christmas movie this year…

Dare cards

The dare cards were a fun mix of things. The end result of a dare card should be for someone to open a gift or exchange a gift with someone.

We had some charades like:

  • Pretend to be Santa riding his sleigh. Person to guess can open their gift.
  • Pretend to catch a snowflake on your tongue. Person to guess can open their gift.

We also had dares like having someone hum their favorite Christmas song or have each person in the group guess someone’s favorite Christmas movie. There’s a lot of fun that can be had with this.

One downside to this for our group was that a few of the older people cannot read. So, I had to limit cards mostly to things that I could read aloud to the group. For things like charades, I only passed those cards to people who could read.

I also ran out of dare cards before the game was over. I’d made 10, but people kept hitting 5 on the die. I’ll need to make more next year.

A twist for next year

Next year, I’ll likely replace truth cards with question/trivia cards where you get to open your gift if you answer the question correctly. I had a few of these mixed in with the dares this year, and they were more fun. For example:

  • Best Christmas movie: Die Hard.
  • Best romantic Christmas movie: Serendipity.

Loads of fun

All in all, I think everyone had a good time. All of the gifts were pretty fun. Some of the things we got in the $10 range were:

  • One yard of Snickers bars.
  • Two cans of holiday popcorn.
  • Cheap DVDs.
  • A case of 20 oz. sodas.
  • And more…

One of the main reasons I mixed it up this year is that everyone in previous years of playing white elephant were too nice. Most people rarely “stole” a gift from someone else if they thought the person liked what they had. This year, the choice was taken out of their hands. With this method, no gift is safe until the game ends, so you never know what you’ll end up with.


Whitelist validation in WordPress

$
0
0

Far too often when doing code reviews, I see developers lean too heavily on sanitize_text_field(), using it as a sort of catchall for sanitizing data. That’s usually not a good idea. Data should be sanitized based on what sort of data you’re expecting.

In this tutorial, I’m going to cover one method of making sure data is safe that not nearly enough WordPress developers utilize. It’s called whitelist validating, which simply validates a given value against a whitelist of allowed possibilities. When possible, I always prefer this sort of validating because it’s the safest method for making sure data is what it should be.

Whitelist validating is the act of taking a posted value and checking if that value exists within a limited set of allowed values. If the posted value is not in the whitelist, we reject it and return a safe default instead.

A simple example of whitelist validating

Let’s suppose we’re asking a user to input a favorite fruit. We have a limited number of allowed fruit. We’re going to look for the justin_favorite_fruit key.

I’ve broken this down in the following code. It’s simple to do.

// Get the value and remove the slashes that WP adds.
$value = wp_unslash( $_POST['justin_favorite_fruit'] );

// Create an array of allowed values.
$allowed = [
	'apple',
	'banana',
	'orange',
	'watermelon'
];

// Assign the favorite fruit if it's allowed. Fall back to a default.
$favorite_fruit = in_array( $value, $allowed ) ? $value : 'apple';

When to use whitelist validation

Do you have a list of predefined choices? Then, you should use whitelist validation. It’s as simple as that. The following types of settings are when you typically have choices.

  • Select dropdown field.
  • List of checkbox fields.
  • Radio fields.

There are other scenarios where you may want to use whitelist validation. One such example is if you only have a single valid value where you would check if the posted value is an exact match using ===.

Building a real-world scenario

In practice, you’ll likely want to make your code as DRY as possible. Your whitelist should also serve as your choices list. This will allow you to use it both for outputting the form field and for validating. Using our “fruits” example from above, let’s create a function that serves that purpose.

function fruit_choices() {
	return [
		'apple'      => __( 'Apple' ),
		'banana'     => __( 'Banana' ),
		'orange'     => __( 'Orange' ),
		'watermelon' => __( 'Watermelon' )
	];
}

Note that we’ve moved the actual choices to the array keys rather than the array values as in the earlier example. Therefore, you’d need to use either isset() or array_key_exists() for checking if a value is in the whitelist.

Use in the customizer

The following code is an example of adding a “Fruit” section with a “Favorite Fruit” dropdown in the customizer. You can see that we use the fruit_choices() function to provide the choices to our control and in the sanitize_callback for the setting.

add_action( 'customize_register', function( WP_Customize_Manager $manager ) {

	// Add custom section.
	$manager->add_section( 'fruit', [
		'title' => __( 'Fruit' )
	] );

	// Add a favorite fruit setting.
	$manager->add_setting( 'favorite_fruit', [
		'default'           => 'apple',
		'sanitize_callback' => function( $value ) {
			return array_key_exists( $value, fruit_choices() ) ? $value : 'apple';
		}
	] );

	// Add a favorite fruit select dropdown.
	$manager->add_control( 'favorite_fruit', [
		'section' => 'fruit',
		'label'   => __( 'Favorite Fruit' ),
		'type'    => 'select',
		'choices' => fruit_choices()
	] );
} );

Use on a plugin settings page

If you’re building a plugin settings page using the core Settings API, the following should be straightforward. We check the whitelist in the sanitize_callback function for register_setting().

I’m not going to cover how to create a settings page in WordPress with sections and fields. The following code just shows how to set up the whitelist validation aspect.

add_action( 'admin_init', function() {

	register_setting( 'settings_group', 'favorite_fruit', [
		'type'              => 'string',
		'sanitize_callback' => function( $value ) {
			return array_key_exists( $value, fruit_choices() ) ? $value : 'apple';
		}
	] );
} );

Smarter and safer

Whitelist validation means you have to worry far less about a whole host of other issues when sanitizing or validating data. Because you have a predefined list of valid values, you never have to worry about whether someone is sneaking in something fishy.

Skyward

$
0
0

Skyward book cover, feature a teen girl with a view of space behind her.

Honestly? I was a bit angry.

I was angry that the sequel to this book is planned for a fall 2019 release and wasn’t already available. That’s so effing long from now. How am I supposed to move on with my life knowing that there’s so much more to this story? Well, the first thing I done was pick up another Brandon Sanderson novel. Reading fiction by anyone else would’ve likely been a letdown after this adventure.

Skyward is marketed as young adult, but it’s better than most YA fiction that you’ll read. Spensa, call sign “Spin,” is the young protagonist and narrator of this story. She dreams of being a pilot and flying amongst the stars. There’s only one problem. Her father was a coward after deserting his team in the greatest battle for the survival of her people. She and her family were branded cowards. Her mother couldn’t get real work. Instead, they mostly relied on Spensa hunting cave rats to sell from a cart.

The last of humanity has been stranded on a foreign world for generations. They’re at war with an alien race who could attack at any moment. Spensa plans to join flight school, become a pilot, and clear her father’s name. She knew there was more to the story—that her father wasn’t a coward. But, there’s no way they’d let her in.

You’ll fall in love with Spensa’s over-the-top bravado, a persona that she has built for herself over the years of being called a coward. Her warrior’s heart filled with the great tale’s that her grandmother has passed down from old Earth. Despite the show she puts on, Spensa is an oddly-relatable character who is as flawed as us all. We all wear masks to hide our vulnerabilities.

Skyward is a story of a young girl overcoming all odds to be the hero that she was meant to be. A warrior. Defiant.

Spensa finds herself at odds with the de facto aristocracy—children born of pilots who fought in the great battle. But, she finds some unlikely friends and sidekicks along the way. She must learn to trust others after relying on her own wits over the years to survive.

Sanderson is a near-flawless writer. I only put the book down that first night because I had work the next morning. I was also in the midst of a few Christmas dinners, most of which I spent counting the minutes until I could return to Spensa’s adventure. There’s a complete story here, but Sanderson leaves you with enough questions that you’ll be the first in line in 2019 to purchase the sequel.

Hand’s down, this is the best book I’ve read in 2018. It’s an adventure that’s suitable for both teens and adults. It’s well worth every minute spent along for the ride.

⭐⭐⭐⭐⭐/5 stars.

2018 year in review

$
0
0

A bundled of dozens of freshly-picked carrots from the garden.

It happened last night. I’d felt the rumblings of it on occasion in the past couple of weeks. It’s that moment when you realize there’s something you’d simply rather be doing than the thing that you’re doing.

It was just past 9 p.m. I’d spent most of the night switching between reading Mistborn: The Final Empire and watching television. I’d just come off a second reading session and planned to put the book down for the night. I’d catch some show or another before getting a bit of shuteye. But, there was nothing I wanted to watch in particular. The novel was far more interesting than anything I had to watch. I could’ve chosen between 100s of shows or movies that I own on DVD/Blu-ray. I could’ve watched anything on Netflix. I could’ve switched to over-the-air TV. But, what was the point?

It took me a full year to get here, but I finally realized that I’d hit my true goal of the year. The goal beneath the goal where reading was more interesting to me than lazily watching TV.

I flipped back the cover to my Kindle Paperwhite and began reading again. I had about 80 pages left in the book and needed to know how the story ended.

The year of books

In January, I dubbed 2018 “the year of books.” My big goal of the year was to read 100 of them.

Yeah, that was a bit crazy.

After several years of only putting down about 15-20 books or so, it was a bit crazy to think that I’d hit 100 this year. I read a lot though. More than many previous years. I’m not exactly sure on the number because I didn’t track them, which I will definitely be doing in 2019.

There were times throughout the year when I got a bit lazy. There were months in the late spring and early summer where the most reading I done was with a bathroom book. At that time, I was trying to maintain my garden and keep up with my normal work. I didn’t have enough balance and my reading habits waned.

I did get a Kindle Paperwhite as a gift, which boosted my reading habits. My Kindle library is growing, and I have plenty of books awaiting in 2019.

I had planned to donate many of my old books to the high school library. However, after suggesting the same to a friend trying to get rid of some books on Facebook, the librarian commented on the post and didn’t seem too keen on the idea. So, I abandoned my own plan to do so.

I’ve also started reviewing books again here on the blog. It’s hard to believe that I’d gone over 11 years without reviewing a book. This is a practice that I hope to continue, sharing what great adventures I go on with the world.

Writing

I found my passion for writing again.

The biggest accomplishment of the year was competing in and winning National Novel Writing Month. It was one of the toughest and most rewarding experiences of my life. I’m glad to have done it and hope I can compete again next year.

My passion for blogging has also returned. A major part of this was finally deciding to drop WordPress and move to a custom system for my personal blog here. Over the years, I felt like WordPress simply didn’t suit me well as a blogger. My new system is far simpler and more focused on the things that I need for sharing my thoughts online. After June 2015, I hit a block and never fully recovered until a few months ago. I’ve written more this month than I have in any of the previous two years.

Dungeons & Dragons

This was the year that I first played D&D. I’ve known about the game for many years but have failed to find anyone in my group of friends to try it out. Fortunately, my cousin’s teenage kid plays and ran us through our first game. It was fun.

I was so excited about future adventures that I put all three of the core handbooks on my Amazon Wish List and got all three as gifts from some awesome folks.

10 years of Theme Hybrid

In August, I celebrated 10 years of running Theme Hybrid, my WordPress theme and plugin site. That was a huge accomplishment for me. I don’t think I really believed I’d be doing this thing for 10 years when I first began.

It also marked a turning point where I was going to refocus the site on two primary projects. One project would be my popular Members plugin (news on version 3.0 coming soon). The other project would be…

The Mythic starter theme

I spent most of the year working on a starter theme for WordPress, which I named Mythic. This was the culmination of everything I’ve learned in the past 10 years with a focus on the future of WordPress. It was good timing considering that WordPress itself is at a turning point in how it manages content.

I’m proud of the work that I and several others put into this project.

Finances

This year was a bit of a letdown financially. I had too many ups and downs, never seeing any sort of stability. Some of this had to do with putting too many projects on the backburner while I worked on the Mythic starter theme, which was not earning me any money in the many months it took to develop.

I’ve been fortunate to have been my own boss now for 10 years with a lot of flexibility with how I want to live my life. However, I need to do far better in the years to come. Right now, I’m just not where I need to be.

Gardening

It seems like ages ago since I’ve set foot in the garden. This past season was a mishmash of success and failure.

In the late winter and into spring was the brightest spot. I grew enough red potatoes that we never ran out. It was only this month that the remaining potatoes went bad from some freezing nights where they sat under a shed. I made enough onions to last well into the fall. I also grew bigger and better carrots than I ever have after several failed attempts in past years.

Most everything else during the late spring and summer months was mediocre at best. We had nearly two months of solid rain, never going more than three days without at least a shower. That pretty much makes it impossible to garden. Weeds take over. You can’t get in with a hoe and work soggy ground. It was a mess.

All along, there were a few bright spots. But, I’d grown tired of trying to fight against the messy rain and gave up the fight until 2019.

2019 goals

$
0
0

A dark forest illuminated by many lights.

It’s hard to believe that it’s the start of a new year. That’s what we say every year, right?

A new year always gives you a fresh slate on life, to a degree. There’s new possibilities. There’s hope for something greater than the year before. It’s an exciting time where you have a renewed sense of wonder about the world.

Last year, I decided on one major, concrete goal. I set it a bit high for what I was ready to tackle. But, I gave it a shot anyway. While I didn’t hit my target, the thing I wanted to really do underneath it all—become a more active reader—is something I accomplished. Concrete, definable, measurable goals are good things. Even if we don’t hit the mark, the attempt counts for something.

The trend for 2019 is to discard things that I don’t need and take the time to appreciate the things that bring me joy. Without further ado, here are my goals for the year.

Writing

After completing NaNoWriMo last year, I want to start fresh on a new novel. This time around, I will outline the plot and not get lost trying to figure out what it is I want to say. I have the beginnings of a sci-fi story jotted down at the moment. I’m not sure if that’s what I’ll pursue yet.

I also plan to create chunks of time in my schedule for working on the novel. Instead of daily writing, which can be a creativity killer for me working in a creative field, I’ll probably set aside time chunks 2 or 3 days each week. Most likely, some of this will happen on the weekend when I’m doing less “real” work.

Finding a creative balance between being a designer/developer and a writer is something I struggled with last year. It felt like it was all or nothing with one side always tugging at me more than the other.

As for NaNoWriMo 2019, I’m not sure yet. November is a long time from now. I’m tentatively marking it on my calendar with a note that whether I participate will depend on where I’m at with my planned novel for the year. I wouldn’t want to start a new project if I’m neck deep in one I’m already doing. I’d love to participate simply for the feeling of accomplishment that you get from completing the challenge.

Reading

I set a smaller goal of 40 books to read this year, which I’m tracking via my Goodreads account. I’ll be starting the new year fresh because I finished a book last night. So, I have a completely blank slate.

Last year, I shot for 100 books, which was too much. Setting the goal at 40 this year might seem low. However, I want a number I feel like I’ll definitely hit. Not to mention, I’ve recently started reading more Brandon Sanderson. If that trend continues into 2019 (I suspect it will), his epic fantasies are probably going to slow my completion rate down a bit. I want to enjoy reading and allow it to be a part of my daily life rather than feel like a chore. But, I also want to feel like I’m hitting a goal.

The primary goal is to simply continue finding time to read more and watch TV less, which brings me to my next goal.

Watch less TV

I love a good TV series. I have a huge collection of DVDs, a Netflix account, a YouTube Premium account, and an outdoor antenna. I have more available to me than I’d ever care to watch.

This year, I’m cancelling both my Netflix and YouTube Premium accounts. I’m not saying that I’ll keep them cancelled for the entire year. For example, I really want to watch season 2 of Kobra Kai when it returns. There’s a few Netflix series I’ll want to catch too. But, it’s time to take a break from both. They are getting cancelled this week as my monthly subscription runs out.

More than simply watching less TV, I want to only watch things that I find joy in. I need to learn to give up shows that I don’t care for and not continue watching because I want to feel some sense of completion. I have a bad habit of wanting to complete everything I start. Well, that’s sometimes a good habit to have. However, it’s bad when you’re not getting anything from it.

With that in mind, I’m going to revisit my Winter Network TV Schedule and cross out a show or two.

Less football

In 2018, this sort of became a late-year goal for me. Living in a small, rural town in Alabama, all anyone wants to talk about is [American] football. But, at this point in my life, it’s not something I care that much about. One of the things I done this year was simply not watch much football unless my alma mater (Auburn University) was playing over the air.

If you live outside the U.S. South, this might not seem like such a big deal. But, football is a way of life around here. Social functions are built around it. Business deals are made based on who you pull for. Children are branded from birth as a fan of a given team. It’s not something you can easily escape.

Don’t get me wrong; I love watching a game here and there. I was even an all-state player in high school and almost pursued the sport in college. But, the culture and huge time suck it takes up on a Saturday is not something I find much joy in.

For me, this is more about shedding an old part of myself that is still holding me back from being the person that I should be. The Justin from 10 or 15 years ago loved the game. The Justin today has other things that fulfill his life. There’s no good reason to hold onto that old part of who I was any more.

Tidying

I brought in the new year by reading The Life-Changing Magic of Tidying Up last night. A huge part of what I want to accomplish this year is to discard things that do not bring me joy. This book served as a way to help motivate me to do this and get the new year started right.

I hate clutter. I think most people do. But, I seem to get clutter anyway. In six months, I would like to be free of everything in my home that I don’t need or that I find no value in.

I’m putting together a list of my concrete plans to accomplish this, some based off this book. I’m fairly certain that you, dear reader, probably won’t find interest in that list.

Bullet journaling

Along with tidying, I’m giving bullet journaling a try. It’s next to impossible to find the perfect calendar or planner that fits what I need it to do. I can’t remember how many I’ve trashed over the years after using them for a while. Creating a bullet journal seems like it may fit the bill.

A bullet journal is a highly-customizable system that caters to the individual. You don’t necessarily need any sort of special notebook or planner to handle it. You can fill it out however you want and not follow any strict rules. It’s a system rather than a product.

Gardening

I’m cutting back this year. Way back. This is easier said than done for folks who get the gardening bug every Spring.

I tried to take on too much last year. I had a full garden that ate up way too much of my time. This year, I’m going to focus on things that continually produce great here and involve less day-to-day work.

Potatoes and onions will be the primary crops I focus on. They’re a lot of work when planting. Potatoes are a lot of work harvesting too. However, the work in between isn’t too bad. And, these two crops are something that we eat on a near-daily basis.

I’ll likely do a few other crops but not at a large scale. A few tomato and pepper plants can live next to the porch. I may do a row or two of carrots. But, I don’t have any plans for any calorie crops outside of potatoes. We get peas from local farms and dry beans are cheap to buy.

Finances

The goal here is to not buy useless shit. Or, don’t buy stuff when I already have it.

Seriously, I have like 8 different air fresheners when I only need one or two. I gave away unused candles as Christmas gifts. I don’t know why I buy things like this when I already have what I need on hand. It’s a habit I plan to break.

As part of my tidying goal, I also don’t plan to purchase any physical goods outside of necessities while I’m in the “discarding” phase of my journey. I’m sure I’ll make an exception for a movie or two. The Amazon gift card my parents got me for Christmas should help with that because it means I can simply purchase e-books for entertainment, which also fuels my reading goal.

Mistborn: The Final Empire

$
0
0

Cover of the Mistborn novel, featuring a girl, Vinn, in a cloak with two blades in her hands.

It’s Brandon Sanderson. Need I say anything else to convince you to read it?

Mistborn: The Final Empire is unlike your traditional fantasy. There are no dragons to slay. No elves and dwarves. No long, arduous journeys crossing continents. Most of the story takes place within one city and follows a band of thieves, not your most likely group of heroes.

Sanderson brings along a unique magic system and characters that feel as real as anyone you know in real life. You’ll grow with them as they take on a foolish quest that no one would dare go on.

Scadrial, the world this book takes place on, exists within The Cosmere, which is a universe that many of Sanderson’s works take place. Don’t worry; it’s okay to start here. The story isn’t tied to other novels. It’s just in the same universe.

This world has its own magic system called Allomancy, which is a nice break from old-school magic in traditional fantasy, where certain metals give powers to those who use them. What I liked most is that Sanderson didn’t just dump all of this info at once. He teaches you how the magic system works through story, never allowing you to forget the system. You won’t get lost later in the book trying to remember it.

The story takes place in the city of Luthadel in the Final Empire, in which the Lord Ruler has reigned for 1,000 years. He saved the world from some entity called The Darkness and has since shaped the world as everyone knows it. The world is a dark place. Ash falls upon everything. And few go out at night for fear of the mists and what lies within them. Plants are brown and fields worked by the slave class, the skaa. Most people can’t imagine a place where everything is lush and green.

The adventure closely follows a group of skaa thieves who have come together for the ultimate heist. Kelsier, the fearless and possibly a bit insane, leader brings in a new apprentice named Vinn. Vinn is broken, beaten, and serving off her brother’s debt. She hides herself away from the spotlight, hoping to remain unseen and unhurt. The real story is hers. Her journey from a scrawny girl into the woman that she’s meant to be is what the book is ultimately about.

In over 600 pages, Sanderson builds a complete universe through his story, one just as real as our own. There’s a lot to digest as he tackles politics, classism, and slavery. You’ll find yourself pulling for this band of thieves, especially Kelsier and Vinn, as they take on an impossible challenge.

When I began this book, I was fully prepared to give it a 4/5-star rating. It didn’t quite pull me in as much as Sanderson’s Skyward. However, this was an epic read. The story and characters needed time to develop. At a certain point, I was as invested in the journey as the characters themselves. And, that’s what great fiction writing is all about. You must feel what the characters feel and root for them.

Mistborn also gets credit for the book that finally made me turn off late-night TV and simply read for the pure enjoyment of reading.

⭐⭐⭐⭐⭐/5 stars.

Viewing all 153 articles
Browse latest View live




Latest Images