Search This Blog

Monday, April 27, 2015

PHP IPC with Daemon Service using Message Queues, Shared Memory and Semaphores - PHP Classes blog - PHP Classes

PHP IPC with Daemon Service using Message Queues, Shared Memory and Semaphores - PHP Classes blog - PHP Classes

Introduction

In a previous article we learned about Creating a PHP Daemon Service. Now we are going to learn how to use methods to perform IPC - Inter-Process Communication - to communicate with daemon processes.

Message Queues

In the world of UNIX, there is an incredible variety of ways to send a message or a command to a daemon script and vice versa. But first I want to talk only about message queues - "System V IPC Messages Queues".
A long time ago I learned that a queue can be either in the System V IPC implementation, or in the POSIX implementation. I want to comment only about the System V implementation, as I know it better.
Lets get started. At the "normal" operating system level, queues are stored in memory. Queue data structures are available to all system programs. Just as in the file system, it is possible to configure queues access rights and message size. Usually a queue message size is small, less than 8 KB.
This introductory part is over. Lets move on to the practice with same example scripts.
queue-send.php
// Convert a path name and a project identifier to a System V IPC key $key = ftok(__FILE__, 'A'); // 555 for example  // Creating a message queue with a key, we need to use an integer value. $queue = msg_get_queue($key);  // Send a message. Note that all required fields are already filled, // but sometimes you want to serialize an object and put on a message or a lock. // Note that we specify a different type. Type - is a certain group in the queue. msg_send($queue, 1, 'message, type 1'); msg_send($queue, 2, 'message, type 2'); msg_send($queue, 3, 'message, type 3'); msg_send($queue, 1, 'message, type 1');  echo "send 4 messages\n";
queue-receive.php
$key = ftok('queue-send.php', 'A'); // 555 for example
$queue = msg_get_queue($key);  // Loop through all types of messages. for ($i = 1; $i <= 3; $i++) {     echo "type: {$i}\n";  // Loop through all, read messages are removed from the queue. // Here we find a constant MSG_IPC_NOWAIT, without it all will hang forever.     while ( msg_receive($queue, $i, $msgtype, 4096, $message, false, MSG_IPC_NOWAIT) ) {         echo "type: {$i}, msgtype: {$msgtype}, message: {$message}\n";     } }
Lets run on the first stage of the file queue-send.php, and then queue-receive.php.
u% php queue-send.php send 4 messages u% php queue-receive.php type: 1 type: 1, msgtype: 1, message: s:15:"message, type 1"; type: 1, msgtype: 1, message: s:15:"message, type 1"; type: 2 type: 2, msgtype: 2, message: s:15:"message, type 2"; type: 3 type: 3, msgtype: 3, message: s:15:"message, type 3";
You may notice that the messages have been grouped. The first group gathered 2 messages of the first type, and then the remaining messages.
If we would have indicated to receive messages of type 0, you would get all messages, regardless of the type.
while (msg_receive($queue, $i, $msgtype, 4096, $message, false, MSG_IPC_NOWAIT)) { // ... 
Here it is worth noting another feature of the queues: if we do not use the constant MSG_IPC_NOWAIT in the script and run the script queue-receive.php from a terminal, and then run periodically the file queue-send.php, we see how a daemon can effectively use this to wait jobs.
queue-receive-wait.php
$key = ftok('queue-send.php', 'A'); // 555 for example
$queue = msg_get_queue($key);  // Loop through all types of messages. // Loop through all, read messages are removed from the queue. while ( msg_receive($queue, 0, $msgtype, 4096, $message) ) {     echo "msgtype: {$msgtype}, message: {$message}\n"; } 
Actually that is the most interesting information of all I have said. There are also functions to get statistics, disposal and checking for the existence of queues.

Lets now try to write a daemon listening to a queue:

queue-daemon.php
// Fork process $pid = pcntl_fork(); $key = ftok('queue-send.php', 'A'); $queue = msg_get_queue($key);  if ($pid == -1) {     exit; } elseif ($pid) {     exit; } else {     while ( msg_receive($queue, 0, $msgtype, 4096, $message) ) {         echo "msgtype: {$msgtype}, message: {$message}\n";     } }  // Disengaged from the terminal posix_setsid();

Shared Memory

We have learned to work with queues, with which you can send small system messages. But then we may certainly be faced with the task of transmitting large amounts of data. My favorite type of system, System V, has solved the problem of rapid transmission and preservation of large data in memory using a mechanism called Shared Memory.
In short, the data in the Shared Memory lives until the system is rebooted. Since the data is in memory, it works much faster than if it was stored in a database somewhere in a file, or, God forgive me on a network share.
Lets try to write a simple example of data storage.
shared-memory-write-base.php
// This is the correct and recommended way to obtain a unique identifier. // Based on this approach, the system uses the inode table of the file system // and for greater uniqueness converts this number based on the second parameter. // The second parameter always goes one letter $id = ftok(__FILE__, 'A');  // Create or open the memory block // Here you can specify additional parameters, in particular the size of the block // or access rights for other users to access this memory block.  // We can simply specify the id instead of any integer value $shmId = shm_attach($id);  // As we have shared variables (any integer value) $var = 1;  // Check if we have the requested variables. if (shm_has_var($shmId, $var)) {     // If so, read the data     $data = (array) shm_get_var($shmId, $var); } else {     // If the data was not there.     $data = array(); }  // Save the in the resulting array value of this file. $data[time()] = file_get_contents(__FILE__);  // And writes the array in memory, specify where to save the variable. shm_put_var($shmId, $var, $data);  // Easy? 
Run this script several times to save the value in memory. Now lets write a script only to read from the memory.
shared-memory-read-base.php
// Read data from memory. $id = ftok(__DIR__ . '/shared-memory-write-base.php', 'A'); $shmId = shm_attach($id); $var = 1;   // Check if we have the requested variables. if (shm_has_var($shmId, $var)) {     $data = (array) shm_get_var($shmId, $var); } else {     $data = array(); }  // Iterate received and save them to files. foreach ($data as $key => $value) {     // A simple example, create a file from the data that we have saved.     $path = "/tmp/$key.php";     file_put_contents($path, $value);      echo $path . PHP_EOL; } 

Semaphores

So, in general terms, it should be clear for you by now how to work with shared memory. The only problems left to figure out are about a couple of nuances, such as: "What to do if two processes want to record one block of memory?" Or "How to store binary files of any size?".
To prevent simultaneous accesses we will use semaphores. Semaphores allow us to flag that we want to have exclusive access to some resource, like for instance a shared memory block. While that happens other processes will wait for their turn on semaphore.
In this code it explained clearly:
shared-memory-semaphors.php
// Let's try to save a binary file, the size of a couple of megabytes. // This script does the following: // If there is input, it reads it, otherwise it writes data into memory // In this case, when writing to the memory we put a sign lock - semaphore  // Everything is as usual, read the previous comments 
$id = ftok(__FILE__, 'A');  // Obtain a resource semaphore - lock feature. There is nothing wrong if we // use the same id that is used to obtain a resource shared memory 
$semId = sem_get($id);  // Put a lock. There's a caveat. If another process will encounter this lock, // it will wait until the lock is removed 
sem_acquire($semId);  // Specify your like picture 
$data = file_get_contents(__DIR__.'/06050396.JPG', FILE_BINARY);  // These can be large, so precaution is necessary to allocate such a way that would be enough 
$shmId = shm_attach($id, strlen($data)+4096); $var = 1;  
if (shm_has_var($shmId, $var)) {     // Obtain data from the memory           $data = shm_get_var($shmId, $var);      // Save our file somewhere     $filename = '/tmp/' . time();     file_put_contents($filename, $data, FILE_BINARY);      // Remove the memory block that started it all over again.     shm_remove($shmId); } else {     shm_put_var($shmId, $var, $data);  }  // Releases the lock. 
sem_release($semId); 
Now you can use the md5sum command line utility to compare two files, the original and the saved file. Or, you can open the file in image editor or whatever prefer to compare the images.

With this we are done with shared memory and semaphores. As your homework I want to ask you to write code that a demon will use semaphores to access shared memory.

Conclusion

Exchanging data between the daemons is very simple. This article described two options for data exchange: message queues and shared memory.

Post a comment here if you have questions or comments about how to exchange data with daemon services in PHP.

Google Developers Blog: A final farewell to ClientLogin, OAuth 1.0 (3LO), AuthSub, and OpenID 2.0

Google Developers Blog: A final farewell to ClientLogin, OAuth 1.0 (3LO), AuthSub, and OpenID 2.0

How To Become A UX Leader - Smashing Magazine

How To Become A UX Leader - Smashing Magazine

How To Become A UX Leader

  • By 
  • Let’s say you run a UX team. Better yet, let’s say you don’t. Let’s say you just want to do great work. You’re a consultant. You’re a newbie. You’re an intern. Your position is irrelevant. So is your title. What’s important here is that you want great UX to happen. You want it consistently. You want it now. You want it all the time.
    No matter your status or situation, whether director or loner, you are in a position to lead, to raise the bar in a place where it consistently sits lower than you think it should.
    As an in-house UX professional, I’ve formed and run UX teams for multiple companies. As a consultant, I’ve worked with dozens of clients on hundreds of projects. Here’s what I’ve learned about how to get what you want. Most of these things can be applied whether you’re inside of a company or consulting for one, whether you’re a fledgling designer or a veteran leader.
    Note: This article will be leaving out the stuff about how to be a good UX’er in the first place, such as how to do good research, define strategy, track and analyze data and so on. If you don’t know that part by now, there is a handy UX eBook Bundle available on these subjects.

    Do What You Ask

    There are a few things in common amongst the leaders I’ve encountered (in the web industry or otherwise) who are able to gain the respect of everyone around them. This is one of those things:
    They never ask people to do things they wouldn’t do themselves.
    Whether it’s taking out the garbage, making coffee or staying late to sweat out six screens for an app because of new requirements, UX leaders do what all UX’ers do: they design.
    Even if you’re at the top of your corporate ladder and should therefore be respected by default, there’s no other way to demonstrate your chops than to put your own expertise to work.
    Design something. Put up or shut up.

    Stay Calm

    This is some pretty basic pop psychology here, but it’s relevant:
    We teach others how to treat us. When we jump out of our seats at the slightest jostling, we teach people to yell “Boo!” When we get and stay anxious, we teach people to avoid us. When we push things off, we teach people they can’t trust us.
    When the CEO postpones everyone’s favorite project for three weeks to deal with legacy issues on a product you’re phasing out anyway and you sigh and roll your eyes, you teach the CEO to treat you like a nuisance rather than a leader.
    No matter what happens, remember that the way you act and react affects the way everyone else will see you the next time they need you to act or react. Stay calm in all situations andyou will have all the respect you’ll ever need to get things done when the chance comes.

    Never Mind The Bollocks

    There are a million distractions in every office, in every company, every day, that can keep you from finally getting that new product launched, finally fixing those old bugs or finally leaving work at a reasonable hour. They might be managers who treat whims like emergencies. They might be a CTO’s sudden urge to put in for an award. A design tweak at the request of the CEO’s best friend. They can even be the guy down the hall who uses his daily breaks as a reason to wander around and make sure everyone else is having a break, too.
    Distractions come in all shapes and sizes. Not one of them matters.
    Product design and management is a marathon. Relax. Panic and frustration will not make it happen any sooner. It certainly will not make it any more enjoyable. See past this stuff. Keep your eyes on the long term.
    Everything else is billboards; spend all your time reading them, and you’ll crash the car. Learn to ignore them.
    Everything else is billboards; spend all your time reading them, and you’ll crash the car. Learn to ignore them. (Image credit)

    Speak Up

    Someone hired you. In theory, they did this because you know some things. Yet, for some reason, the second you got hired, you stopped knowing things. You stopped asserting your knowledge, your passion, your care. You started being afraid. You started worrying about your job instead of your work.
    Well, guess what. It’s your job to know when something is bad, and to be able to say so. Assuming you are able to back up your arguments — assuming you can demonstrate that you know what you’re doing — your job is to do exactly that.
    Refuse to play along with bad ideas. Refuse to stop voicing your concerns, your ambitions, your evidence, your knowledge. Your passion for UX got you here. If they don’t want it now that they’re paying for it, get out. Refuse to work in a place that refuses to consider sound arguments formed by someone who cares deeply for them. If something is bad, and you can back up your opinion with insight, you need to be able to speak up. If you can’t, find someplace you can.
    However, if you’re new to the profession, backing up your arguments will be tougher for you. You’re also less likely to be able to see the complete picture (it’s always a much bigger picture than you think). Stick around long enough to get some valuable experience before you start asserting yourself much. Trying to claim a leadership role before you’re ready can damage your reputation before you even get going.

    Take Criticism Well

    When you critique others, you don’t want a lot of resistance. You want people to keep their heart rates in check long enough to think through what you’re telling them and to consider that you might have a point.
    Just as you need to be able to criticize, others need to be able to criticize you. Don’t be the person who shoots down any feedback that doesn’t go your way. You need people to see the problems in your work. Other people need to trust that you can handle objection.
    Take criticism well. Because you expect others to do the same.

    Invite, Include, Consider

    When you take on an effort to define the vision and strategy for a project — and you should do this for every project, regardless of its size or significance — include other people. Don’t do this because you’re trying to be cool and inclusive. Do it because you can’t define a project well without talking to stakeholders, users as well as team members.
    You may be a genius, but that doesn’t negate the fact that people produce better results in well-run groups than they can alone. (Numerous studies have proven this.)
    A “well-run” group, by the way, is one with a clear leader, whose job is to make the final decision, and at least one devil’s advocate, whose job is to poke holes in ideas and force people to back them up and think through them completely.
    Well-run groups are also limited to as few voices as possible — only those most crucial to the key decisions. Your job is to collect and listen to and consider opinions, but also to remember that there’s a gigantic difference between opinion and insight, and that the time it takes to consider too many opinions will keep you from putting any of your insights to work.
    Talk to everyone you can. Then, when you have a draft going of your vision and strategy, go back to those people and sell them on it.
    Talk to everyone you can. Then, when you have a draft going of your vision and strategy, go back to those people and sell them on it. (Image credit)

    Educate

    No company comprises UX experts alone. They comprise marketers and accountants and salespeople and product managers and executives and programmers. A single UX professional may not be found, in fact. But you need a bunch of people to be able to make good design decisions, because you can’t make them all on your own, and because you don’t have time to undo the bad ones other people will make in the absence of UX knowledge.
    So arm them. Arm them with insight, knowledge, technique, considerations, best practices, design standards and anything else you can use to help them make good design decisions.Explain every recommendation you make. Put out design standards that other people can apply. Explain how to think through UX decisions so that other people at least make the attempt to do it on their own. Do this all the time, every day.
    If you’re starting from zero, it will be a long time before this pays off. But you’ll enjoy it; people will develop respect for your knowledge along the way; and one day, it will indeed pay off. People with bad ideas will become people with good ideas. They’ll become people who helpyou produce great work.

    Teach Them To Teach

    Most of your job as a UX professional is not about designing, but about selling your ideas. It’s about convincing people that your recommendations are merited and considered and probably right (based on your experience and your research, which you will be able to show as part of your pitch).
    This is also true of everyone else on your UX team.
    If you are part of one, make it an absolute priority to teach the other people on the team how to sell their ideas. Make sure they know how to make their case, and that they need to in the first place.
    If you can’t convince, you can’t succeed. Neither can they.

    Clear Paths

    This one is for the managers:
    There are a lot of perspectives on the difference between management and leadership. The debate isn’t all that useful. What is useful, however, is to understand the difference between what should be managed and what gets managed. They are usually very different things.
    What usually gets managed are people. Managers think they are being paid to organize and to delegate and to track. This is a myth. Believing it is a detriment to productivity.
    People want to do good work. It’s human nature. They want to feel proud of their effort. If it seems like they don’t, it’s usually either because they think their current situation prevents them from doing so and have resigned to that idea; because your version of “good” and theirs have different definitions; or because you are at different points on the spectrum with regard to your ability to evaluate what “good” means. (In either case, addressing the underlying problem is the only effective way to deal with it.)
    Besides this, you have a distinct advantage that some other industries might not have: You work in the web industry. People who join the web industry do it with their whole selves. They become absolute freaks for this work. They love it. They eat it for breakfast.
    You don’t need to manage people in the web industry. You need to manage things awayfrom people in the web industry. Your job, in other words, is not to tell them what to do, but tokeep things out of their way so that they can do what they already want to do.
    Clear the path. Give them the space they need to do their jobs well. Most of the time, people who have the space will use it.
    Clear the path. Give them the space they need to do their jobs well. Most of the time, people who have the space will use it. (Image credit)
    If you’re doing everything you can to give a person what they need to do their job well, and they’re still not doing it, then you have a problem.
    Odds are, that won’t happen.

    Let Them Improve

    Another one for the managers:
    I once had a junior designer on my team who desperately wanted to do more strategy work. He told me so at least three times while we were in the midst of a Herculean effort to rid ourselves of technical debt. He was at his least challenged. He wanted to push himself.
    Soon after, a project I’d been pushing for came to fruition. The first step was to define a strategy (as it always should be). I wanted to do it myself. Badly. I gave it to him instead. I told him I’d be there for guidance and to answer questions if he needed but that the project was all his. (Secretly, I also committed to asking him loads of questions along the way that would allude to the kinds of things he should be thinking about.)
    He kicked ass on that project. He proved himself to a bunch of people in a bunch of ways. And he learned some things in the process that enabled me to go to him later as a strategic thinker.
    Again, people in the web industry already want to do great work. They want to learn more, take on more, build more, design more, ship more. They’re hungry. So feed them.
    When someone wants the chance to improve at something, find ways to let them. The next time a project comes up that appeals to that person, hand it off, even if you really want to do it yourself. Nine times out of ten, that person will step up. And both of you will be better off for it.

    Influence At Every Turn

    Every UX professional’s job has an internal part and an external part. To lead on the UX front, you must lead outside of the team as well inside of it.
    Every interaction you have with non-UX people in your company is an opportunity to espouse how you make decisions, to talk about how users view things and will view things and how you, as a company, should want them to view things.
    Remember, we teach people how to treat us. Every last UX person on the planet should act in a reasoned, deliberate, intelligent, dedicated manner, so that others in their organizations will treat them as such.

    Hire Well

    This is the last one specifically for managers:
    A few months ago, I was sitting on a stool at the front of a room in the Capitol Factory in Austin, Texas. Next to me was Harry Max, VP of Design for Rackspace and the man who will be forever known for designing the web’s first shopping cart. We’d given our respective talks, and the floor was open for questions. A few dozen sets of eyes were staring at us, and neither of us had any idea what question would come next. The third or fourth one was a nerve-shaker.
    “How do you know who to hire?”
    As in, when you bring in a gaggle of UX candidates to meet people, shake hands and answer questions, how do you know which one is good and which one is terrible when you don’t know the first thing about UX or how to evaluate its success?
    It was one of the best questions I’ve ever been asked by an audience member.
    It’s not an easy thing to answer. Volumes could be (and have been) written on what “UX” really means, and why, and how far it reaches into the business and what skills you actually need for your business or for this project. And the people who claim UX in their title have a huge range of backgrounds. Some have a degree in cognitive psychology and are experts in usability. Some just walked out of graphic design school yesterday. Even someone who’s been doing it for years may have just come from an organization that thinks the UX person is nothing more than a glorified wireframer. You need to be able to discern one from the other.
    There’s exactly one way to pick a great UX professional — or one with the potential to be great — out of a lineup.
    Look for the person asking all the best questions.
    There are two parts to this: all and best. A UX person asks questions — about the users, the business, the concerns, the needs, the prior decisions, the team, the goals. A great UX person wants to see the whole picture.
    Good UX folks don’t throw solutions at you. Not in the first minute. Not on the first day. They ask questions to understand every side of every angle of every issue in order to define a strategy to achieve the best work your team can offer.
    Good UX folks don’t throw solutions at you. Not in the first minute. Not on the first day. They ask questions to understand every side of every angle of every issue in order to define a strategy to achieve the best work your team can offer. (Image credit)
    They don’t pick colors; they ask questions to sort out how and when and why to use which color. They don’t devise layouts; they ask questions to determine relevance, priority, meaning. They don’t wait to be told what to do. They lead.
    If you are interviewing a UX person and you are the one asking all of the questions, call it off. This is not the UX person you’re looking for.

    Always Talk Psychology

    The root of design is psychology. Anything else is art or decoration or something else. We all know this much. A design is a plan, and a plan requires an intended outcome. For design to succeed, human psychology has to be at the center of it. No user can ever have the kind of feeling you hope they will have about your product unless you consider how they will approach it, get through it and talk about it later. Some elements will be used to convince them of the value of the product. Others will encourage them to take specific actions. Others will surprise them, placate them, make them laugh, piss them off. Whatever the intent, the approach should be applied to all design decisions that get made. This much is a given.
    It’s easy to forget, though, that other people don’t think about this like you do. They don’t realize that the root of design is psychology.
    A client of mine recently said as much. “There’s so much psychology involved!” To which I replied:
    “You’re in sales. Design is just like that.”
    Talk about the psychology. (And when you do, cite your sources.) Show people that there’s a lot more to UX than checkboxes and radio buttons. UX is psychology applied to design.

    Give Credit Away

    People love it when you give them credit. People also love people who freely give credit where credit is due. So give credit away. All the time. People will love you for it.
    But far beyond that, it will help you get things done. It’s counter-intuitive, for sure, but when you give credit away, people credit you for all kinds of things in return. Focus on building a team full of people who are respected and revered. Focus on building a reputation for your team rather than yourself. Care more about getting it right than putting your name on it.
    Don’t worry. You’ll get your credit.

    Be Unreasonable

    “The reasonable man adapts himself to the world,” said George Bernard Shaw, “the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.”
    This sounds like an ego trip. It’s not. It doesn’t mean you should try to get everyone to be like you. It means you should try to hold the world to your standard of excellence. It means you should try to design the world to that standard. You are a designer, after all. This is your special power. Use it.
    If something is crap, call it out. If something has a flaw, point at it (and then propose an improvement, because complaints alone are useless). If something doesn’t exist that should, say why, and, if it’s important enough, go after it with all your might. If you’re the only person who cares and you don’t care enough to make it happen, then it will not happen.
    Progress is made when people push hard for it. They stand for things. They forge good arguments. They convince, they challenge, they prove. It’s how the seatbelt was invented. It’s how America won its independence. It’s how “user experience” became a common notion and a ubiquitous demand. (Fifteen years ago, a lot fewer of us were fighting this fight. It was hard then. But it was a worthy war.)
    Don’t be reasonable. Be successful.

How to Help Someone Develop Emotional Intelligence - HBR

How to Help Someone Develop Emotional Intelligence - HBR

How to Help Someone Develop Emotional Intelligence

APRIL 24, 2015
APR15_24_150800267
If you are one of the unlucky people who must deal with a clueless colleague or a brutish boss, you’re not alone. Sadly, far too many people at work lack basic emotional intelligence. They simply don’t seem to have the self-awareness and the social skills that are necessary to work in our complicated multicultural and fast-moving companies. These people make life hell for the rest of us.
What can you do to turn these folks around and make work a healthier, happier, more productive place to be? Whose job is it, anyway, to fix these people?
If one of these socially awkward or downright nasty people works directly for you, it is indeed your job to do something. They ruin work teams and destroy productivity, not to mention morale. They’re little time bombs that go off when you least expect it — sucking up your time and draining everyone’s energy. They need to change, or they need to leave.
Here’s the problem: EI is difficult to develop because it is linked topsychological development and neurological pathways created over an entire lifetime. It takes a lot of effort to change long-standing habits of human interaction — not to mention foundational competencies like self-awareness and emotional self-control. People need to be invested in changing their behavior and developing their EI, or it just doesn’t happen. What this means in practice is that you don’t have even a remote chance of changing someone’s EI unless they want to change.
Most of us assume that people will change their behavior when told to do so by a person with authority (you, the manager). For complicated change and development, however, it is clear as day that people don’t sustain change when promised incentives like good assignments or a better office. And when threatened or punished, they get downright ornery and behave really badly. Carrot and stick performance management processes and the behaviorist approach upon which they are based are deeply flawed, and yet most of us start (and end) there, even in the most innovative organizations.
What does work is a) helping people find a deep and very personal vision of their own future and b) then helping them see how their current ways of operating might need a bit of work if that future is to be realized. These are the first two steps in Richard Boyatzis’ Intentional Change theory — which we’ve been testing with leaders for years. According to Boyatzis — and backed up by our work with leaders — here’s how people really can begin and sustain change on complex abilities linked to emotional intelligence:

YOU AND YOUR TEAM

First, find the dream. If you’re coaching an employee, you must firsthelp him or her discover what’s important in life. Only then can you move on to aspects of work that are important to this person. Then, help your employee craft a clear and compelling vision of a future that includes powerful and positive relationships with family, friends, and coworkers. Notice that I’m talking about coaching your employee, not managing him.There’s a big difference.
Next, find out what’s really going on: What’s the current state of this person’s emotional intelligence? Once a person has a powerful dream to draw strength from, he’s strong enough to take the heat — to find out the truth. If you are now truly coaching him, you’re trusted and he’ll listen to you. Still, that’s probably not enough. You will want to find a way to gather input from others, either through a 360-degree feedback instrument like theESCI (Emotional and Social Competency Inventory), or a Leadership Self Study process (as described in our book, Becoming a Resonant Leader), which gives you the chance to talk directly to trusted friends about their EI and other skills.
Once you have the dream and the reality, it’s time for a gap analysis and a learning plan. Note that I did not say “performance management plan,” or even “development plan.” A learning plan is different in that it charts a direct path from the personal vision to what must be learned over time to get there — to actual skill development.
Learning goals are big. Take, for example, one executive I know. Talented though he was, he was in danger of being fired for his distinct lack of caring about the people around him. He wanted what he wanted, and watch out if you were in his way. He couldn’t seem to change until it finally dawned on him that his bulldozer style was playing out at home too, with his children. That didn’t fit at all with his dream of a happy, close-knit family, living close to one another throughout their lives. So, with a dream in hand and the ugly reality rearing its head at work and at home, he decided to work on developing empathy. As a learning goal, empathy is one of the toughest and most important competencies to develop. The capacity for emotional and cognitive empathy is laid down early in life, and then reinforced over many years. This gentleman had a good foundation for empathy in childhood, but intense schooling and a stint at an up-or-out management consulting firm drove it out of him. He needed to relearn how to read people and care about them. He was able to succeed. Yes, it took a good while, but he did it.
This sounds like a lot of hard work for your employee, and it can be. Here’s where a final important piece of the theory comes into play. They — and you — can’t do it alone. People need people — kind and supportive people — when embarking on a journey of self-development. Are you there for your employees? Do you help thme find other supporters, in addition to yourself, who will help when their confidence wanes or when they experience inevitable setbacks?
Developing one’s emotional intelligence can make the difference between success and failure in life and in work. And, if you’re the one responsible for people’s contributions to the team and your organization, you are actually on the hook to try to help those (many) people who are EI-challenged, deficient, and dangerous. It’s your job.
But what if you’re not the boss? You can still make a difference with colleagues, too. All of the same rules apply to how people change. You just need to find a different entry point. In my experience, that entry begins with you creating a safe space and establishing trust. Find something to like about these people and let them know it. Give them credit where credit is due, and then some (most of these folks are pretty insecure). Be kind. In other words, use your EI to help them get ready to work on theirs.
And finally, if none of this works, these “problem people” don’t belong on your team — or maybe even in your organization. If you’re a manager, that’s when it’s time to help them move on with dignity.