Homebrew: How to start and stop background services

Anyone that has installed application running in the background from Homebrew, knows how to use launchctl that actually runs every application when the computer restarts. It is pretty straight forward task but most of the time you need to know the location of the .plist file that defines how to run it installed with homebrew.

Now there is a quicker path how to control them by simply adding following package to home-brew:

brew tap gapple/services
 And you have available to start, stop services directly from home-brew with following command to get a list of active services:
brew services list
So for example if you have installed postgresql you can start it as a background service with:
brew services start postgresql
or stop the service with
brew services stop postgresql

Which is much more easier and simpler than finding the right .plist file inside cellar folder of brew

Extending Javascript objects with a help of AngularJS extend method

Multiple ways of extending javascript objects

/**
 * One-way reference from subclass to superclass (instance)
 * Most of the time this is what you want. It should be done
 * before adding other methods to Subclass.
 */
ChildClass.prototype = new SuperClass();
 
/**
 * Two-way reference
 * Superclass will also get any Subclass methods added later.
 */
ChildClass.prototype = SuperClass.prototype;
 
/**
 * Cloning behavior
 * This does not setup a reference, so instanceof will not work.
 */
angular.extend(ChildClass.prototype, SuperClass.prototype);
 
/**
 * Enhancing a single instance
 * This could be used to implement the decorator pattern.
 */
angular.extend(subClassInstance, SuperClass.prototype);

Be that likable person

Become genuinely interested in other people.

Smile.

Remember that a person’s name is to that person the sweetest and most important sound in any language.

Be a good listener. Encourage others to talk about themselves.

Talk in terms of the other person’s interests.

Make the other person feel important and do it sincerely.

Smile, smile, smile 🙂

AngularJS directive multiple element

How to get AngularJS directive multiple element

You probably know there exists opening ng-repeat-start and finishing directive ng-repeat-end like:

<ul>
 <li ng-repeat-start="user in users">
   {{user.firstName}}
 </li>
 <li ng-repeat-end>
   {{user.firstName}}
 </li>
</ul>

You would think it is a specially made directive that works that way but actually it is not. It is part of any directive so you can use it inside your too. When you create new directory and inside you factory function you need to return an object with multiElement options set to true. This way it will behave same as ngRepeat directive over multiple non nested fields. Small excerpt from ngRepeat.js file denoting this:

var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
  ...
  return {
    restrict: 'A',
    <strong>multiElement: true,</strong>
    transclude: 'element',
    priority: 1000,
    terminal: true,
    ...
   }
}];

From native angularJS directive there are few more directives that support multi element spanning. They are ngIf, ngShow, ngHide and ngSwitch. So by adding multiElement to your custom directive you can make to transclude over angularjs directive multiple elements at the same time. This also comes handy because you can do nesting of multiple elements if they are contained inside another one.

Timesaving AngularJS Cheatsheet

Perfect way to get start with AngularJS

There are two great things to use for looking up for AngularJS syntax, Dash.app with downloaded AngularJS documentation and a short cheatsheet by ProLoser. It helps you to speed up retrieval and common questions.

angularjs logo
AngularJS logo

 

Conquering Fear

What really keeps you from living your dreams?

What problem is most dominant in peoples lives?

The answer is: FEAR!

People live every day in fear. Fear of losing their wealth, fear of losing their loved ones, fear of making the wrong decisions, fear of being themselves, fear of growing up, fear of making a commitment. The list goes on and on.

The leading cause of people not fulfilling their dreams is NOT the fear of failure – itís the fear of success! The fear of actually accomplishing what they set out to do. The fear of living life to the fullest may have paralyzed you. This will cause you to never really try in your business, or if you do try, to sabotage your efforts so you never have to face your fear of success.

Most people live their lives in the grip of this fear and they arenít even aware that it has control over them! The fear is the one thing that can turn your dreams of financial freedom, loving relationships, and a fulfilling and significant life into a pattern of habits including procrastination, self-sabotage and other bad habits.

Fear is the dominate problem in your life today. The two questions you need to answer to conquer your fear are:

Which fear has the most control over your behavior? Is it the fear of failure, the fear of rejection, the fear of success, or is it all of them?

How do I interrupt the bad habits that I have developed as a means of protection from this fear? How do I interrupt the programming I have within me?

These are the two most significant questions when it comes to overcoming your fears. If you can answer these two questions, your life will forever change!

The reality of fear is that it is human and is a part of life. Itís not going to go away. Some fear is even healthy! It is a gift given to you to keep you safe and bring you closer to your creator.

Every person is born with three instinctive fears. These are: fear of falling, fear of loud noises, and fear of abandonment. These three fears were given to you to help you monitor what is going on around you. Think about it; it is fear that gives you the adrenaline rush that makes you escape from a situation that is really, truly unsafe. It also gives you the same rush that causes you to fight to win.

Faith is born in fear. God knew in His infinite wisdom that fear is what would drive His people back to Him. Although sometimes it is only in times of extreme fear that we look to God and choose Him. Take a look at your own life and think about the times you looked to God for His power and wisdom. Those were probably times of extreme fear. True faith is born from fear!

So what caused the gift of fear to be the number one problem in society today? Why do people let fear control their actions, beliefs and lives? The answer is the difference between reacting to fear and acting in fear. It has everything to do with your belief system.

Children typically react instinctively to fear, which is appropriate behavior at this age. Most adults don’t make the distinction between reacting to fear, as when they were a child, and acting with their intellect when dealing with fear.

People react instinctively to fear by either denying it or running away from it. They miss the power that comes from acting with their intellect, never allowing the fear to become the gift it was intended to be. Learn to act with your intellect by exposing your true fears and the beliefs they represent and free yourself so you can move on with all you are meant to do, have and become!

 

Be A Leader Not A Follower

Most people in life are happy to follow the lead of other people, to sit on the fence in a debate or have the attitude of hiding at the back of the class. The most successful people are leaders and make things happen for themselves by taking a positive attitude and through working very hard to reach their goals. We are all able to become leaders and this article may help you to achieve this status.

I grew up as a very nervous person, who had very little self-confidence and who was very shy. I was not happy being this way and often felt jealous of other people who were happy to speak up and take control of tasks and situations. I wanted to be one of these leaders and not the follower that I certainly had become.

In my early twenties, I decided that the time had arrived to make a series of life changing decisions. I was determined to have a happy and successful life and was aware that I needed to change my whole attitude and approach to life.

I was not happy at where I worked and joined an employment agency in an attempt to find alternative employment. In the reception area of the agency, I started speaking to a man who was also their hoping to find a different job. His name was Mark and we got on well and wished each other the best of luck in our quest to find work. We even exchanged phone numbers and vowed to keep each other up to date with our progress.

I was then interviewed by a man who explained his plan to help me to find this new role of work. He was very bright, clever and positive and had many interesting ideas. He seemed very confident that I would soon be employed for a different company more suited to the skills which I had.

At one stage of the meeting he described the scenario of a group interview. He suggested that we may be ushered into a large room with a big table. As we sat down there would be a sheet of paper asking the group to debate a particular subject. He stated that all of the people in the room would be in the same position, all looking for work, all nervous, however that in that room I could be whoever I wanted to be. He said that I needed to stand up and take the lead by stating that I would act as chairman and that if anyone had a comment that they wanted to make, that they could raise their hand. If I did this I would show my prospective employer that I was a leader.

I went home and thought about this and did not believe I had it in me to act in the way that he wanted me to, as I was not a leader. Later that evening Mark phoned and all he was talking about was the group interview scenario. He also stated that there was no way that he would be able to stand up either in the way that had been described.

I did not have to ever attend a group interview, but Mark did. He surprised himself by carrying out the advice and stated that after he had said his initial statement about being the chairman, that he had never felt so powerful and in control. For the rest of the day other members of the group had been regularly asking him questions as if he was some sort of team leader. He was very proud of himself and I am happy to report that he was successful at that interview and is very happy in his new position.

He has also taken the success and learning experience into his social life and states that he has never had a higher self-esteem. I am very pleased for him as he is a genuine person who works very hard. He is also one of only a few friends that I can honestly say that I trust.

I have taken inspiration from Mark and have entered into a career of helping people who stutter, to achieve fluency. This is something which I really enjoy and which gives me a large amount of job satisfaction. I am also far more confident than I ever have been and have at last found happiness.

In conclusion we all have it in us to be a leader. We need to be brave and determined to take control and remember that all we can do in life is to try our best. We are only sure about living one life, so lets be happy and not accept second best. Be a leader in life, not a follower.

 

Mac OS Lion and installing ruby 1.9.2

I am always having trouble with installing fresh rvm instance, so here are all steps needed in fresh rvm to install new ruby 1.9.2

export ARCHFLAGS="-arch x86_64"
export CC=gcc-4.2
rvm pkg install readline
rvm pkg install iconv
rvm pkg install zlib
rvm install 1.9.2 -C --with-readline-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr