Close

Why YOUR Freelance Jobs are Getting Outsourced to Someone Who’ll Do It Cheaper

The answer: You’re not branding yourself effectively. If you were, your potential clients would never hire another developer just because they’re cheaper.

As business guru, Tom Peters, puts it:

“All of us need to understand the importance of branding. We are CEOs of our own companies: Me Inc. To be in business today, our most important job is to be head marketer for the brand called You.”

Of course, the big question is… how do you brand yourself effectively and fix your “outsourcing problem”?
(more…)

January 28, 2014

Justin Bieber Should Learn How to Code

Apparently, the Biebs was arrested this morning in Miami for drag racing and driving under the influence. If you’ve paid even a little attention, you know this has been coming for awhile now.

I don’t really hate on the kid too much because I understand he’s a kid with a lot of money and a lot of fame… and I wonder what kind of decisions I’d have made at that age with that money and that fame.

Probably not great ones.

But, it does make me think dude should learn how to code!

Why?

Here’s a few reasons why:
(more…)

January 23, 2014

Should You Just Give Up Learning How to Code?

Give Up Coding

I was recently asked:

Man… I truly hope I can just know what to do at some point without having to ask. You think PHP is an easy language to learn though?

When I read that, it reminds of the frustration I felt when I first started learning how to code. It can be very frustrating and make you feel like you want to give up. Should you? Here’s why I think you shouldn’t:

  1. It will get easier. The first few months are the most difficult. It truly is like learning a new language… not just a new way of speaking but a new way of thinking. But, once you’ve immersed yourself in it for awhile you do start to think differently… and each new piece you learn gets little bit easier. Eventually, learning new skills is pretty simple and happens very quickly.
  2. It’s worth it. Learning how to code may not be easy, but it’s definitely worth it. From a career perspective, you will eventually reach a point where you control your own destiny. You make what you want to make, you work with only the people you want to, and only on the projects you want to. And, you eventually can set your own hours, take off when you want… and you get to build cool new things as your “job”. All in all, it’s a pretty badass lifestyle.
  3. It’s your passion. If you’ve made it this far, my guess is that building things in code is something you’re passionate about. If not, you would have already given up. That being the case you probably couldn’t walk away even if you wanted to. Your mind would continually bring you back to it and you’d find yourself once again tinkering with code. So, you might as well embrace it. In fact, I believe that no matter how frustrating it may be at any given moment… if you follow your passion it will always work out better for you in the long-run.

Of course, learning how to code doesn’t have to be as hard as most of us make it. I learned this the hard when with PHP. I made several mistakes that prolonged my learning curve and set me back a few years. Fortunately, you don’t have to make these mistakes because I’m going to share with you what they are and how to avoid them:

  1. Don’t try to do it all on your own. This is easily the biggest mistakes new coders make. It has to do a little bit with ego and a little bit with this false belief that if you let somebody teach then you’re not “smart enough” to be a good coder. It’s absolutely false. I know some really great coders and what makes them great is that they’ll take instruction from anyone. If it can help them master something they need to know faster, they’ll do it. So, don’t be afraid to let others help you (in fact, I am offering to do just that for you when it comes to both PHP & MySQL and responsive web design).
  2. Don’t learn without a purpose. The next big mistake I made was to code just to code. I was too afraid to take on clients or put out an open-source project, so I would just code things I thought I was “supposed to” know. The problem is that, as a beginner, you have no idea what you’re “supposed to” know. So you end up wasting your time on a lot of things that just aren’t very fruitful. Also, without any kind of deadline from a client, you can prolong and put off your coding… which really slows you down. As scary as it might seem, I recommend you take on clients or start an open source project. You’ll speed up your learning curve dramatically by doing so.
  3. Don’t give up. Sounds bit circular but I made this mistake several times. I would get frustrated and quit for a few weeks or months. But, I also ended up coming back to wanting to learn more. And, the time I took off really set me back. Not only did I miss that time, but I usually had to re-teach myself things I had already learned. Coupled with the things above, it extended my learning curve from a year or so to almost 4 years before I really felt comfortable as a coder. That doesn’t mean you shouldn’t take breaks… just keep them short.

At the end of they day, I know learning how to code isn’t necessarily easy… but I believe it’s worth it. And, if you follow the advice above you can boost your progress and slash the amount of time it takes you to finally get over the hump and feel comfortable as a coder.

QUESTION: Have you ever considered giving up coding? How did you deal with it?

January 7, 2014

PHP Multiple Checkbox Array Handling

Handling Checkboxes in PHP Forms

I tend to get a lot of questions around checkbox handling when submitting forms to  PHP. Here’s a simple snippet to illustrate how it works:

<?php
print_r($_POST);
?>
<form method="post">
Car <input type="checkbox" name="stuff[car]" value="1" />
Dog <input type="checkbox" name="stuff[dog]" value="1" />
<input type="submit" value="Submit" />
</form>

A couple things to pay attention to here…

1. Notice the input names. They follow this pattern name[key]. The name is really the name of the “group” of checkboxes. The key is the name of that individual checkbox. This is how you know which checkboxes were checked and which weren’t. When submitted, this form will only include the checkboxes that ARE checked.

2. Notice the created array. When this form is submitted the output will look something like this:

Array ( [stuff] => Array ( [car] => 1 [dog] => 1 ) )

If you look at our inputs… “stuff” becomes the top-level array key, “dog” and “car” become the 2nd-level array keys, and the input values become the values of “dog” and “car” respectively.

With this, you can properly handle these checkboxes and process them accordingly.

December 31, 2013

Why I Code

It was mid-June 2011 in Texas. I had just been released from Active Duty for the Army and was on my way to pick up my then 3-year-old son, Davin, from daycare.

I pulled into the parking lot, hopped out of my car and headed toward the front door of the daycare. I remember feeling the heat hit my face as I strode across the parking lot.

It was hot… but it was a beautiful summer day. Not at all like what I was about to discover inside the daycare.

Why I Code

I made my way across the parking lot and in the front door to the receptionist’s desk. No one was there.

As I looked around, I heard what sounded like a faint yelling sound from around the corner. Instinctively, I moved toward the sound.

As I hurried down the hallway, the yelling got louder…

“Is this how you behave? Like animals? You are a bunch of monsters! You guys better start acting right or you’ll have hell to pay!”

As I got closer to the sound, I realized, “It’s coming from Davin’s room!”

Now angry, I swung open the door to his room. The room fell silent as everybody turned toward the door.

I saw the receptionist. Her face immediately turned bright red.

“Where’s his teacher?” I asked angrily.

“She called in sick today”, she said meekly.

“Davin, let’s go”, I said as I stepped away from the door. The receptionist hurried by me and back down the hallway to her desk.

Davin gathered his things and we headed down the hallway toward the front door.

When I reached the receptionist’s desk, she was typing frantically at her computer. I noticed she was typing an email to someone… the owners of the daycare I assumed.

“While you’re at it on that email… you can tell them that Davin will no longer be coming to daycare here. And, I won’t be giving a 2-week notice and I won’t be paying any termination fee. If they have a problem with that, then I’d be more than happy make this whole incident a public event”.

She said nothing.

Davin and I left the daycare and never went back. We never heard from them again.

The Moment I Realized Why I Code…

Davin had only gone to that daycare for a few months… but over the last few weeks I had noticed a change in his attitude. He had become a lot more irritable and grumpy. He became very demanding and had began yelling for the first time in his life.

Something had seemed off to me… that day in mid-June I figured out what.

From that day forward, I watched Davin at home. For most people, that would have been impossible. Most people would have been forced to find another daycare… and hoped the same things didn’t happen. They would have been helpless.

But, I code for a living.

I have the luxury of working from home and setting my own schedule.

And, that’s why I code…

I code for Davin. Regardless of your beliefs on parenting… the fact that I code for a living meant I could do something when a daycare went against mine. I didn’t need them. And, I got the added benefit of spending a lot more time with him (and all my other children)… which was good for both him and I.

I code to express myself. Coding is like any other artistic endeavor (Yes! Coding is an art!)… to be good it requires perspective, passion, and persistence. It is more a reflection of its writer than any hard fast “coding rules”. I code to find out who I am as a coder as much as anything else.

I code to learn. I’ve always believed and said the most important skill a coder can possess and facilitated within themselves is the ability to mentally abstract. There is a direct correlation between a coder’s “mental abstraction skill level” and the value of his code. I code to get better at coding… but I code to get better at thinking, as well.

I  couldn’t imagine not coding. It’s like a writer writing or a painter painting… it’s who I am. But, at the end of the day… it’s more than that. I don’t just code for me. I code so I never have to put my family in a position where they (or I) feel helpless.

And, I write all this because I think it’s important to remember when you’re feeling overwhelmed or un-motivated… why you’re here. So…

Question: Why do you code?

December 30, 2013

Force a Single (2, 3, 4…) Column Dashboard Layout in WordPress 3.8

Bring back single column

Prior to WordPress 3.8, you had the option to select the number of columns you wanted on your admin dashboard. Personally, I prefer 2.

However, in version 3.8… that option is gone. Here’s a handy little code snippet to bring it back:

function jmo_screen_layout_columns($columns) {
$columns['dashboard'] = 2;

return $columns;
}

add_filter('screen_layout_columns', 'jmo_screen_layout_columns');

function jmo_screen_layout_dashboard() {
return 2;
}

add_filter('get_user_option_screen_layout_dashboard', 'jmo_screen_layout_dashboard');

Just change all instances of “2” to the number of columns you’d like your admin dashboard to have and drop the code into your theme’s functions.php file and you’re all set.

December 27, 2013

A Simple PHP Class For Prepared Statements in MySQLi

PHP Prepared Statements Class

Prepared statements are all the rage right now in PHP development… and for good reason. Not only do prepared statements make your queries more secure… they also help future-proof your code by relying more heavily on PHP itself for that security.

If you’re not using prepared statements in your queries, you really should be. Here’s a simple class that helps you do just that using MySQLi:

<?php
if ( !class_exists( 'DB' ) ) {
class DB {
public function __construct($user, $password, $database, $host = 'localhost') {
$this->user = $user;
$this->password = $password;
$this->database = $database;
$this->host = $host;
}
protected function connect() {
return new mysqli($this->host, $this->user, $this->password, $this->database);
}
public function query($query) {
$db = $this->connect();
$result = $db->query($query);

while ( $row = $result->fetch_object() ) {
$results[] = $row;
}

return $results;
}
public function insert($table, $data, $format) {
// Check for $table or $data not set
if ( empty( $table ) || empty( $data ) ) {
return false;
}

// Connect to the database
$db = $this->connect();

// Cast $data and $format to arrays
$data = (array) $data;
$format = (array) $format;

// Build format string
$format = implode('', $format);
$format = str_replace('%', '', $format);

list( $fields, $placeholders, $values ) = $this->prep_query($data);

// Prepend $format onto $values
array_unshift($values, $format);

// Prepary our query for binding
$stmt = $db->prepare("INSERT INTO {$table} ({$fields}) VALUES ({$placeholders})");

// Dynamically bind values
call_user_func_array( array( $stmt, 'bind_param'), $this->ref_values($values));

// Execute the query
$stmt->execute();

// Check for successful insertion
if ( $stmt->affected_rows ) {
return true;
}

return false;
}
public function update($table, $data, $format, $where, $where_format) {
// Check for $table or $data not set
if ( empty( $table ) || empty( $data ) ) {
return false;
}

// Connect to the database
$db = $this->connect();

// Cast $data and $format to arrays
$data = (array) $data;
$format = (array) $format;

// Build format array
$format = implode('', $format);
$format = str_replace('%', '', $format);
$where_format = implode('', $where_format);
$where_format = str_replace('%', '', $where_format);
$format .= $where_format;

list( $fields, $placeholders, $values ) = $this->prep_query($data, 'update');

//Format where clause
$where_clause = '';
$where_values = '';
$count = 0;

foreach ( $where as $field => $value ) {
if ( $count > 0 ) {
$where_clause .= ' AND ';
}

$where_clause .= $field . '=?';
$where_values[] = $value;

$count++;
}

// Prepend $format onto $values
array_unshift($values, $format);
$values = array_merge($values, $where_values);

// Prepary our query for binding
$stmt = $db->prepare("UPDATE {$table} SET {$placeholders} WHERE {$where_clause}");

// Dynamically bind values
call_user_func_array( array( $stmt, 'bind_param'), $this->ref_values($values));

// Execute the query
$stmt->execute();

// Check for successful insertion
if ( $stmt->affected_rows ) {
return true;
}

return false;
}
public function select($query, $data, $format) {
// Connect to the database
$db = $this->connect();

//Prepare our query for binding
$stmt = $db->prepare($query);

//Normalize format
$format = implode('', $format);
$format = str_replace('%', '', $format);

// Prepend $format onto $values
array_unshift($data, $format);

//Dynamically bind values
call_user_func_array( array( $stmt, 'bind_param'), $this->ref_values($data));

//Execute the query
$stmt->execute();

//Fetch results
$result = $stmt->get_result();

//Create results object
while ($row = $result->fetch_object()) {
$results[] = $row;
}

return $results;
}
public function delete($table, $id) {
// Connect to the database
$db = $this->connect();

// Prepary our query for binding
$stmt = $db->prepare("DELETE FROM {$table} WHERE ID = ?");

// Dynamically bind values
$stmt->bind_param('d', $id);

// Execute the query
$stmt->execute();

// Check for successful insertion
if ( $stmt->affected_rows ) {
return true;
}
}
private function prep_query($data, $type='insert') {
// Instantiate $fields and $placeholders for looping
$fields = '';
$placeholders = '';
$values = array();

// Loop through $data and build $fields, $placeholders, and $values
foreach ( $data as $field => $value ) {
$fields .= "{$field},";
$values[] = $value;

if ( $type == 'update') {
$placeholders .= $field . '=?,';
} else {
$placeholders .= '?,';
}

}

// Normalize $fields and $placeholders for inserting
$fields = substr($fields, 0, -1);
$placeholders = substr($placeholders, 0, -1);

return array( $fields, $placeholders, $values );
}
private function ref_values($array) {
$refs = array();

foreach ($array as $key => $value) {
$refs[$key] = &$array[$key];
}

return $refs;
}
}
}

$db = new DB('root', '', 'test');
print_r($db->select('SELECT * FROM objects WHERE ID = ?', array(10), array('%d')));

I recommend walking through this code and unraveling how it all comes together. There are a few gotchas when using prepared statements in a dynamic way like this.

Or you could just check out my course PHP & MySQL 101 where I walk you step-by-step through building this exact class (and a lot more).

December 26, 2013

How to Get the Post Thumbnail Source URL in WordPress

Often, when working with WordPress, you’ll find the need to grab a post’s thumbnail source URL. Unfortunately, the_post_thumbnail() and get_the_post_thumbnail() only return the entire image tag.

How to Get a Post Thumbnail Source URL in WordPress

This handy little WordPress code snippet takes care of it for you, though:

function wp_get_thumb_src($post = false, $size = 'thumbnail') {
if ( ! $post ) {
global $post;
}

$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size );
$url = $thumb['0'];

return $url;
}

As you can see, you can post in a $post object or let it use the globalized $post object… depending on your needs. You can also pass in the image size you’re after. By default, it uses the “thumbnail” size.

Hopefully, you find it useful.

December 25, 2013

How to Use Media Queries to Build a Responsive Web Site

Media queries are the cornerstone of responsive web design. They are what make the kind of advanced responsive design we see today even possible.

So, here’s how to master using them…

How to Use Media Queries

So, What ARE Media Queries?

Here’s the official definition from the Mozilla Developer Network:

Media queries consist of a media type and can, as of the CSS3 specification, contain one or more expressions, expressed as media features, which resolve to either true or false.

Huh?

Think of media queries as conditional statements. You create a query that either resolves as true or false… and if TRUE, you designate certain CSS that then gets applied.

Here’s an example snippet:

@media screen and (max-width: 600px) {
.facet_sidebar {
display: none;
}
}

The above query says:

If the media type equals screen and the width is 600px or less… then apply these styles.

The “screen” part is the media type and can be things like “all”, “screen”, “print”, “tv”, etc ( Click here for a list of available media types).

The “max-width: 600px” part is the “expression expressed as a media feature” and can be things like max-width, max-device-width, orientation, etc (Click here for list of available media features).

And, the above statement will also resolve to true or false.

This is what allows us to target certain screen widths and change the way our site behaves based on that screen size. Essentially, this is responsive web design.

Finally, you have logical operators that help you “chain together” multiple expressions to target certain scenarios more specifically. Here’s an example snippet:

@media (min-width: 700px) and (orientation: landscape) { … }

Here’s you’ll notice the word “and” sandwiched between two expressions. This query states:

The screen must be at least 700px wide and the orientation of the device must be landscape.

You can use different logical operators like: and, comma-separated lists (or), not, etc (Click here for a list of available logical operators).

Where Do I Start?

At this point, you’re probably wondering where to start with all this. The most common way media queries are used is to target certain devices widths in order to change the display of a web site for different devices.

Here’s a common set of media queries (taken from Bootstrap 3.0):

@media (min-width: 768px) and (max-width: 979px) {}

@media (max-width: 767px) {}

@media (min-width: 1200px) {}

Here we’re targeting three different widths:

  • BETWEEN 768px and 979px
  • LESS THAN 767px
  • MORE THAN 1200px

Now, you might be wondering WHY these widths?

In my Responsive Web Design 101 course, I cover that particular question in great detail and show how you exactly how to structure your media queries to target different devices…

But, in a nutshell, these widths are based on common device widths. A number of devices (included iPads) have a width of 768px in the portrait orientation… thus the focus on widths around 768 pixels.

Also, common laptop widths are 1280px and 1366px… so the min-width:1200px is target those devices and anything bigger… while excluding iPads in the landscape position (1024px).

Why the 979px?

Well, 980px became a design standard on the web. So, designers (and web users for that matter) have gotten used to using that width. So,  you’ll often see media queries based around that width, as well.

All in all… media queries are about targeting certain groups of devices based on their widths. This allows us to create different designs for different devices and make our site look and function good no matter the device viewing it.

QUESTION: How do you use media queries in  your responsive designs? Do you have a standard set of queries that you use?

December 24, 2013

Coding Isn’t For You

I’ve been coding for almost 10 years now and I’m finally fully embracing that coding isn’t for me. It’s taken me awhile to reach this point, but the release of frustration is pretty amazing.

Please read on, though, because it’s probably not what you think.

Coding Isn't For You

You see, when I first started out coding… I did it for me. It was about me expressing myself, doing what I loved, making ME a living.

But, the reality of coding is that you’ll spend the majority of your time building stuff for other people. And, that’s why coding isn’t for YOU… it’s for them.

It’s a mutually-beneficial relationship where you achieve your goals by helping them achieve theirs. You win when they do.

I bring this up because as coders it’s easy to get caught up in our own view of how things should be done. It’s easy to believe that a client doesn’t know what they’re talking about and to get frustrated with them wanting things done a certain way.

And, it can even cause you to leave or screw up really beneficial relationships… because you want your way.

And, if you do… well, it’s your loss.

You still need to be an artist… but if you really want to be successful as a coder you need to fully embrace the fact that the more you help your clients achieve their goals… the more you will achieve yours.

And, that’s why coding isn’t for youit’s for them.

QUESTION: Do  you struggle with balancing your perspective on how something should be built vs how your client thinks it should be done? How have you dealt with it?

December 23, 2013

How to Fail in 2014

Brace for impact. As we near the end of 2013, you’re going to be hit with an onslaught of “how to succeed in 2014” posts. That’s all fine and well…

But, sometimes knowing what NOT to do can be more powerful that knowing what TO do. This is one of the times.

Imagine this…

Imagine if you were around 100 or so years ago and were a horse and buggy maker. Imagine if you had ignore this new “fancy” technology called a combustion engine that was making waves at the time.

Imagine how in a few short years you’d be put out of business as the automobile made your product obsolete.

Or, imagine even just a couple decades ago when this “fancy” new technology called the internet came out. Imagine if you ignored THAT.

Now, fast-forward to right now. Consider all the “fancy” mobile technology that’s taking the world by storm.

Wanna know how to fail as a web developer right now?

Ignore mobile.

Ignore mobile and watch as clients and site visitors slowly fade away. Ignore mobile and watch as your competitors slowly run you out of business. Ignore mobile and watch as your online business dreams vanish.

If you really want of fail in 2014… that’s exactly how.

Now, here’s what TO do in order to succeed…

Of course, you don’t want to fail and that’s why responsive web design is now more important than ever. The world has gone mobile and as a web developer you have to keep up if you want to stay relevant.

That said, LEARNING responsive web design isn’t necessarily easy. In fact, at first it can be quite confusing. Plus, there’s a very specific set of skills you need to learn in order to master responsive design… and, if you don’t know what those skills are…

Well, that makes it about 100x harder.

Thankfully, I’m going to tell you what you need to learn:

  1. the 3 different approaches to responsive web design and which one you should be taking
  2. the 5 individual skills that make responsive design “happen”
  3. how to work with and extend responsive frameworks

Once you master those things, you’ll be all set with responsive design.

Of course, if you want to fast-track your learning curve, I offer a responsive web design course that will teach you all of the above and more.

But, whether you take that course, a different course, and you learn it all on your own (not recommended)… make 2014 about mastering responsive design and building mobile-friendly web sites.

Frankly, you can’t afford not to.

December 10, 2013

How to Calculate an Age By Birthday Using PHP

This PHP function accepts a birthday as a parameter and will return the age based on that birthday. Handy for social sites/applications.

<?php
// PHP 5.3-
function birthday($birthday){
$age = strtotime($birthday);

if($age === false){
return false;
}

list($y1,$m1,$d1) = explode("-",date("Y-m-d",$age));

$now = strtotime("now");

list($y2,$m2,$d2) = explode("-",date("Y-m-d",$now));

$age = $y2 - $y1;

if((int)($m2.$d2) < (int)($m1.$d1))
$age -= 1;

return $age;
}

echo birthday('1981-05-18');

// PHP 5.3+
function birthday($birthday) {
$age = date_create($birthday)->diff(date_create('today'))->y;

return $age;
}

echo birthday('1981-05-18');

December 8, 2013

How Fear Can Kill Your Coding Career and How You Can Easily Overcome It

[powerpress]

How to Subscribe to the Podcast

It’s Really All About Fear, Isn’t It?

Today’s going to be a little tough I think… because today is about standing in front of the mirror a little bit. Let’s talk about fear. Let’s just put it on the table… you’re scared. It’s okay.

So am I… every day.

  • Scared you don’t really know what the hell you’re doing.
  • Scared somebody will find out.
  • Scared somebody will see your code and flame you into oblivion.
  • Scared you’ll wreck your client’s site.
  • Scared you’ll never get it figured out.
  • Scared you might break something.
  • Scared you might not be smart enough for this…

So, why am I bringing this up?

Because, the reality is… as a coder… fear is the one thing you’ll fight your entire career. At every level of mastery… there’s another level of mastery ahead of you that scares the s!@# out of you.

To be great, you have to get good at dealing with your fear. You have to figure out how to work through it and continue to push yourself anyway.

To take the client that scares the daylights out of you (what if I “f” it up?). To learn the skill you’re not sure you’re smart enough to figure out. To put your code out there to be mocked (and loved).

You have to do it.

If you can’t, quit now. It doesn’t get any easier. I promise.

BUT…

If you embrace and take it head on… you get better at dealing with it. The fear doesn’t go away, but how you handle it gets easier.

You get more confident. And, the conversations changes from “I have no idea how to do this, I don’t know where to start looking, I’ll never figure it out, my client will be pissed, they’ll tell everybody, the whole world will laugh at me, I will explode…”

Into…

“I have no idea how to do this, but I know I can figure it out”.

See the difference?

When I first started learning how to code, it scared the s!@# out of me. But, I said the two infamous words that have propelled me continually down this path and over every hurdle I encounter.

The two words I hope you’ll tell yourself when you feel that twinge of fear rising up telling you NOT to do whatever it is you really want to.

The two words (pardon my language here):

“Fuck it!”

Dumb? Maybe. But, try it. Things is, I know that fear hits you at times… so NEXT time just try it. Just say those two words to yourself and see how your attitude changes.

You might be surprised.

What About You?

Tell me why I’m wrong. Or, why I’m right. What has your experience shown you? Let me know in the comments below.

September 11, 2013

How Targeting Can Trump Credibility As a Freelancer

[powerpress]

Click to Subscribe to the Podcast via iTunes

Awhile back, I posted a video talking about how you can make more money in web design by laser-targeting the services you offer. Since then, I’ve received a little push-back from a few coders and I wanted to address their concerns.

Their two main arguments are:

  • Being too specific will cause you to lose jobs when you’re first starting out.
  • You have to build up credibility/rapport before you can start targeting more specifically

In the podcast, I cover both of these… but let me briefly summarize the points I made:

You CANNOT Get Too Specific. Period.

It’s as close to impossible as you can get… for you, as a freelancer, to get less business by targeting your services more specifically. Here’s why:

  • You only need a few regular clients (4-5) to sustain your business
  • It’s almost impossible to find a market on the web that doesn’t have 4-5 customers in it

Even if the number of clients you need is higher… say 10… it’s not 1 million or 10,000 or even 100. You couldn’t sustain that many clients anyway. In fact, once you start to get above 5 or so clients, it becomes un-manageable for you, as an individual, to handle all those clients at once.

So, you don’t need a ton of clients to sustain your business.

Even more, with the global nature of the web, it’s almost impossible to find a market with less than 10 or so customers in it. You probably could find one somewhere… but to do so, you’d have to get SO specific it would be obnoxious.

In practical terms, no matter how specific you get… you’ll always have enough customers to sustain you.

Specificity Will Trump Credibility in Many Instances

I go back to my contact lens example from the original post. I knew nothing about the brand of contact lens solution I bought. Even more, I HAD heard of the some of the other brands that were marketing themselves as “Multi-Purpose Solution”.

But, that didn’t matter.

I needed something very specific and I chose the product that marketed itself the best in that regard.

As a freelancer, you certainly want to build up your credibility. However, if you’re the only (or one of the only) people who can deliver a certain outcome for a client… guess what… they don’t really have a choice. They HAVE to choose you.

In fact, when you’re first starting out as a freelancer… one of the easiest ways to get clients right away is to offer a service that very few others can. Then, use that to build credibility and expand into other areas as you see fit.

What About You?

Tell me why I’m wrong. Or, why I’m right. What has your experience shown you? Let me know in the comments below.

September 3, 2013

Genesis: Move Navigation to Top

Here’s a little code snippet to move the primary navigation in the Geneses theme to the top of your pages:

// Child theme setup function
function child_theme_setup() {
// Remove the primary navigation from its current location
remove_action( 'genesis_after_header', 'genesis_do_nav' );

// Add the primary navigation to the top of the page
add_action( 'genesis_before_header', 'genesis_do_nav' );
}

// Hook into genesis_setup
add_action( 'genesis_setup', 'child_theme_setup' );

Of course, you could use this to hook the primary navigation in anywhere on the page. You’d just use a different hook with your add_action() statement.

August 22, 2013

WordPress Plugins Are Dead

iOS and Android have forever changed what people expect from their technology. For the most part, however, that wave of expectations hasn’t hit the WordPress community.

Sure, WordPress itself functions a lot like iOS and Android in a platform/app context… But, most of its plugins don’t.

That is changing.

And, in this new world… you’re either a plaform or an app… but you’re NEVER a plugin.

App vs Platform

iOS is a platform. Android is a platform. WordPress is a platform. Evernote is an app. Gmail is an app. SmartS3 is an app. Platforms are the operating system. Apps are the software that run on them.

And, what’s changing (where you need to be headed if develop a WordPress plugin) is users are beginning to expect your app (plugin) to be a platform.

We see a lot of plugins in WordPress. What we don’t see a lot of is plugins that have their own plugins.

The main difference between a platform and an app is how much of an infrastructure is in place for your software to be developed on top of.

We’ve seen some of this with WooThemes and what they’re doing with WooDojo. We’ve seen some with Gravity Forms and their “apps” market.

But, they’re few and far between… and the ones that exist are just in the early stages of development.

It’s not just about what “hooks” you have in your plugin. That is important (it NEEDS to be there)… but it’s also about:

  • What kind of delivery system do you have in place to deliver apps developed on your platform?
  • What kind of support do you offer developers?
  • Have you created a marketplace for developers to sell apps in an integrated way?
  • Do you have the back-end infrastructure in place to support all of this and make it easy for customers to use?

Who would you rather be? Apple selling millions of its platform largely due to its apps… earning a piece of the pie for every app sold on its platform or the app-maker earning solely based on what you yourself can develop?

Even more… and this is so absolutely critical to get… in a community like WordPress’ where many plugin authors are in direct competition with one another, do you think you can continue to stay viable when your competitors are thinking like Apple and you’re still thinking like Doodle Jump?

Not a “there’s always room for everybody” situation… but a you’re in direct competition with someone acting like Apple… building platforms with a full-blown marketplaces behind them… aimed squarely at running you out of business?

Who do you think wins?

What We Should Be Doing

For context, here’s my mindset…

I think of WordPress as a Content Management Platform. WishList Member is a WordPress plugin, but I see it as a Content Monetization Platform.

It sits on top of WordPress and exposes content monetization services to WordPress itself and to the apps developed on top of it.

That’s what our API is for.

But, in our little world, I think we need to go further.

I’ve gone to the point of being annoying about…

  • Integrating WishList Member deeper into WordPress… especially interface-wise.
  • Adding more and more ways for developers to interact with WLM (especially, hooks in our admin interface)
  • Upgrading, testing, re-working, documenting, etc our API.

All of this will become critical with what comes next. What comes next is what makes a plugin a platform whether you like it or not. What comes next is what makes it almost impossible for a competitor to beat you.

What comes next is what premium WordPress plugins 5-10 years from now will HAVE to be in order to even compete… let alone win.

So, what comes next?

July 12, 2013

Should I Use mysqli_real_escape_string With Prepared Statements in PHP?

Graham recently asked me:

Do I still need to used mysqli_real_escape_string when used prepared statements in PHP?

The simple answer is no.

The way it used to work is that you would take form input data, put that into a variable, and inject that data into your MySQL query in order to add that data to the database.

Now, a big problem with that is SQL Injection attacks where a hacker could inject SQL code into your query and perform actions on your database… which is something you definitely don’t want.

So, the standard solution became using mysql_real_escape_string to sanitize data before sending to the database.

Of course, that’s not the preferred solution anymore. Prepared statements are:

But, with PHP5, the PHP developers built an entire class into PHP for working MySQL. With that class, there are now prepared statements in PHP… and prepared statements allow you to “bind” data to a query using sprintf-like syntax… rather than “inject” your data into those queries.

And, with this new system, the methods that bind the data to your query do the sanitizing for you. So, mysqli_real_escape_string is no longer necessary WHEN you bind values this way.

Of course, if you have some other way you’re injecting input data into your queries, you still need to sanitize that data… and mysqli_real_escape_string is still the main method for doing that.

June 6, 2013

How Being Lazy Can Help You Stop Procrastinating

Listen to the Full 30-Minute Podcast Version

[powerpress]

Click to Subscribe to the Podcast via iTunes

Let me give you an example:

Yesterday, I was feeling completely burnt out. For the last couple weeks, I had been pushing real hard on a number of projects, working late nights, and basically strapped to my desk 24/7.

And, it was starting to catch up to me.

But, I had one more project I needed to finish and I really didn’t want to do it.

Now, I’ve learned over the years that the quality of my work is pretty horrific when I force myself to work when I don’t want to. So, instead of forcing myself to work on the project and “get it done”.

I was lazy.

I basically sat around all day, watched movies, ate too much, drank too much pop and was generally a complete bum.

However, as I did that… I also used a couple tricks I’ve learned to prep myself mentally to get ready to hit it hard again.

As time passed, I began to feel more and more naturally motivated to work on this final project. Soon, I reached a point where I was feeling inspired and I couldn’t stop thinking about how I wanted to do the project.

THEN, I went to work.

And, instead of me laboring over the project for days trying to force myself to get it done. That night, I stayed up a few hours later than normal and got it all done.

And, not only did I get it done without all the stress and hassle of forcing myself to do it… I got it done days before it was due.

The key is understanding how to tap into your natural motivation and let it build until you’re fully “turned on” and inspired to get a project done.

Now, if you stick with me, I’m going share those techniques with you and exactly what I did to stop procrastinating in these situations.

If you implement these techniques, you can virtually eliminate procrastination (and the stress that comes with it) from your life.

This is Why You Procrastinate

I’ve found two main reasons why coders procrastinate:

  1. The drama
  2. The mountain of work

We’re addicted to the drama. Let’s face it… after the initial bliss of learning how to code and feeling awesome because of all the cool things you know how to do… coding gets a little tedious.

Before you know it, you find yourself doing pretty much the same things over and over again for every project. And, you get a little bored.

Procrastinating until the last minute provides a sense of excitement. There’s a real possibility you might not get done in time, that your client will be pissed, that you’ll ruin your reputation and forever be banished from the brotherhood of coders…

See, how easy that is?

It’s easy to turn a little procrastination into a cheesy drama where you get to play the super-hero by swooping in and completing the project just in the nick of time.

Problem is, your works suffers. Not to mention, it’s also incredibly stressful. And, as you get more work, you find yourself bouncing from one project to another in this kind of dramatic fashion… and you get burnt out.

But, that’s not all…

Because, this pattern is fed by another that I call “Mountain of Work” syndrome.

Have you ever looked at a coding project, knowing full-well you need to get going on it right away, and began to see everything you’d need to do in order to get it done… and felt completely overwhelmed? And, as a result, instead of working on it… you put it off?

We all have.

The particular problem for coders is that the majority of the projects we work on provide enough ambiguity that it’s easy to blow the amount of work it’ll take way out of proportion.

Because, frankly, in a lot of cases… you don’t know what all a particular project or piece of a project will entail.

And, your mind will then tend to do what cognitive therapists call “maximize”. It’s worst-case scenario thinking. And, before you know it, your mind has you convinced that there’s absolutely no way you could ever get this project done.

So, you put it off…

But, you also have a sense that if you were just motivated enough, you could probably knock the project out pretty quickly. You just need some energy… some motivation… and that’s where the drama comes in.

Most of the time, coders procrastinate because they know that the drama of doing it last minute will give them the motivation they need to power through this “mountain” of a project.

And, because it feels good when you actually do pull through and “save the day”… this entire pattern is self-reinforcing. Your mind convinces you that this is a good way to go about things… because, in the end, it feels good.

Again, the problems come when you start to get more work. Now, because you have so many projects you’re trying to juggle at once… you start to fail. There’s time when you don’t save the day. There’s times when what you create in those moments is crap.

You notice. Your clients notice. And, it can quickly overwhelm.

I know… I’ve been there.

So, here’s how to get off the roller-coaster and use your natural tendencies to your advantage to get things done faster, perform better, and provide a better overall service.

Here’s How to Stop Procrastinating

First and foremost, you should never work when you don’t feel like it.

Now, I know… that sounds the exact opposite of what you probably think you should do… and what you’ve probably been told you should do…

But, it’s 100% true.

If you force yourself to work when you don’t feel like it, you antagonize your body to fight against. And, you set yourself for a bigger drop-off down the road.

Not to mention, 99.9% of the time…  your work will be crap.

Instead, you learn how to make yourself feel like working. Here’s a few methods I’ve learned to do just that:

1. Focus on something small you can get done right now. The problem of maximizing is in making the work seem like more than it is… so much more that it’s not even worth doing because there’s no way you could possibly ever get it done.

What’s really happening is you don’t feel like working right then. So, you maximize the work in order to rationalize not working on it right now.

To cure that, you need to hit yourself with a dose of reality. For me, the conversation literally goes like this:

Fantasy Me: “OMG! It’s so much work. I’ll never get it done. Why bother?”

Reality Me: “Well, you know, you could just knock out this small piece. It’s really easy and you could get it done pretty quick. That’s better than nothing.”

Fantasy Me: “Screw you Reality Me! I don’t wanna!”

Reality Me: “Right, but you know you need to. And, deep down, I know you WANT to.”

Fantasy Me: “Ugh!”

Now, that doesn’t mean you will immediately feel like working. But, what it does is stop you from continuing to maximize. It injects a little reality into the equation and gets you to come back down to Earth a bit.

This is absolutely critical! You must do this… and usually first.

2. Focus on what excites you about this project. Once you’ve stopped the maximizing and injected a little reality into your thinking… it’s time to start to swing the pendulum the other way.

Remind yourself of what excited you about this project in the first place. Maybe, it’s the topic or content of the project. That is, what the project is about. Or, maybe, it’s the people you’re working with on the project. Maybe, it’s what you’ll need to learn in order to complete the project.

Or, maybe… it’s just the money you’ll earn as result of completing the project.

Whatever it is, dangle a little carrot out in front of yourself to remind you why you accepted this project in the first place.

As you do, you’ll start to feel your natural motivation gearing up. Your mind will begin to focus on the project and not let you think about anything else.

3. Ride the wave. As you start to feel more naturally motivated, let it build a little bit. Let it build to the point you just can’t stand to not go work on it. THAT is when you’re at your best and your performance will be optimal.

And, once you’ve started moving on the project and generated a little momentum… ride that wave for as long as you can. It’s important to recognize just how important that momentum is and find ways to sustain it.

Sometimes, it hits at 11pm at night. Sometimes, it’s 4am in the morning. Sometimes, it’s in the middle of some other event.

You need to organize your life in such a way that, as much as possible, you can immediately go work on a project when the inspiration hits you. Those moments are gold opportunities and you can’t let them slip away.

That may mean having a “sit-down” with your family and friends. It may mean changing some habits. But, whatever it means, it’s important to do everything you can to maximize those opportunities.

Managing Your Motivation

Now, keep in mind… what I just described is not a 5-minute process. It’s not some mental gimmick you can whip out and in 5 minutes feel all gung-ho to go work. It’s more of and understanding of how your mind naturally works and how to tap into it.

In most cases, the above process will take at least a few hours. Sometimes, it might take a whole day.

So, you need to be sure to effectively manage this with your clients. That means working “buffer time” into every project you accept. If you think it’ll take you 8 hours of actual to complete a project, tell your client that it’ll be a week or two.

Because, finding 8 hours to sit down and just code… among all the other things you need to do… is never easy. Factor in the time where you’re not going to feel like working… and finding 8 hours of time where you’re 100% inspired to work on that project is going to take a little bit.

And, although, your client may not immediately understand or agree if you told them that explicitly… believe me… they want you at your best. They want the hours you put in to be motivated and inspired hours… not “feeling forced” hours.

So, you build that time into your scheduling and set those expectations early on.

What’d You Just Say

So, in summary… here’s a few things to keep in mind:

  1. Never force yourself to work when you don’t feel like it
  2. Instead learn to naturally prod yourself into feeling like working
  3. Inject reality into your thinking by focusing on someting small you could get done right now
  4. Remind yourself of what excited you about the project in the first place
  5. Ride the wave of momentum you’ll create for as long as you can
  6. Be sure to manage your motivation and set clear expectations with your clients

John Is An Idiot

Completely disagree with me on all this? That’s cool. Why? I’d like to hear how you deal with procrastination. Or, maybe you completely agree… I’d like to know that, too. I’d like to hear about others who’ve used these techniques to stop procrastinating.

Leave your thoughts in the comments below and let’s have a conversation we can all benefit from.

May 30, 2013

How to Make More Money in Web Design

Listen to the Full 30-Minute Podcast Version

[powerpress]

Click to Subscribe to the Podcast via iTunes

Are You Losing Money Trying to Be Everything to Everybody?

I have 100% been guilty of this. When I first started marketing my services, I had a shotgun blast of an offer hoping potential clients would pick up on something and get in touch with me.

The problem?

It reeks of desperation. And, clients don’t want a desperate developer.

The more you try to be everything to everybody, the more you’ll be nothing to nobody. Potential clients won’t really know what your strengths are and what your core offer is.

And, they’ll know you’re not a master of everything.

So, instead of trying to be good at everything…

Pick One Thing and Be Great At It

I’m a WordPress developer. More specifically, I’m really good and working with WishList Member and building membership sites.

I could talk for days on what a successful membership design looks like. I have oodles of testimonials and portfolio items to show a client if need be.

I have a mega-ton of credibility as a developer of membership sites.

So, why market myself as anything else?

You should do the same.

You’ll be happier. Your clients will be happier. And, you’ll make more money in web design!

How to Figure Out What to Be Great At?

Of course, you may not know what your core offer is, yet. That’s okay… it’s easy to figure out. Your core offer is at the nexus of vision, passion, and talent. That is, it’s the one or two things you have perspective on (vision), you’re super passionate about, and you’re really good at doing.

If that’s not immediately clear to you…  then start taking on any project you can. You’ll figure out really quick what you HATE doing… and that’ll give you the clarity to see what you LOVE doing.

Did This Suck?

What did you think of this episode of John Morris TV? Did it suck? Want more? Let me know so I know what kind of content you want more. Leave a comment or like the video to let me know you liked it!

May 19, 2013