Angular vs. React vs. Vue: A 2017 comparison

Trying to figure out which Javascript framework I should learn. This blog by Jens Neuhaus says Vuejs is the easiest to learn. Also I still don’t understand why these frameworks are better than jQuery but that is for another time.

If you are an unexperienced Javascript developer — or if you worked mainly with jQuery in the last decade — you should think about using Vue. The paradigm shift is more pronounced when moving to React. Vue looks more like plain Javascript while also introducing some new ideas: components, an event-driven-model, and one-way data flow. It also has a small footprint.

Source: Angular vs. React vs. Vue: A 2017 comparison – unicorn.supplies – Medium

ReflectionException: Class Tests\Unit\Symfony\Component\HttpKernel\Exception\NotFoundHttpException does not exist

Running unit tests in Laravel, I was getting this error:

ReflectionException: Class Tests\Unit\Symfony\Component\HttpKernel\Exception\NotFoundHttpException does not exist

The issue was missing root backslash, make sure you have expected exception like:
$this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);

 

Working Remotely

As a developer, I am lucky that I get to work from home as needed. But I have never been 100% remote; Lately, I have been reading a lot about working remotely, remote first companies, Digital Nomad lifestyle etc. This is compilation of various resources that I have found useful so far:

The Ultimate Guide to Working Remotely – I haven’t gone through whole guide yet but so far it has been very informative.

Remote Job Search Boards

The Remote Freelancer – A massive list of remote jobs search boards. Hosted on GitHub.

Some of more popular remote job boards are:

And then a list of Remote Friendly Companies and another massive list of Resources for Remote Jobs and Digital Nomads on GitHub.

Freelancing Rates – These are based on locations in the US, Canada, England, and Austerlia. Though these probably don’t reflect remote only rates.

 

Upgrading to PHP 7.0 on Ubuntu 14

I upgraded PHP to version 7.0 on Ubuntu box. Running php -v on shell would show it as version 7.0. But Apache was still using PHP 5.6. I tried various methods to update settings for Apache but nothing worked until I issued following commands:


sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart

Source: PHP 7.0 (and 5.6) on Ubuntu | LornaJane

Digital Gold by Nathaniel Popper

Just finished reading Digital Gold by Nathaniel Popper (Affiliate Link).

The book is about Bitcoin and how it started. I have been hearing about Bitcoins and Cryptocurrencies since 2011. It seemed like it was not real money. It was only recently with surge in Bitcoin value that I got interested in it.

I was still skeptical of Bitcoin and the whole idea behind it. But after reading this book, I am coming around. The book was not preachy or pro-Bitcoin. It simply told the history and thinking behind Bitcoin, yet it was able to change my mind. I think Bitcoin and other decentralized currencies are the next big innovation that will change society and culture like the Internet and smartphones did. I like the idea of decentralized currency that is not controlled by any government or central authority.

In countries like Pakistan, there are a lot of rumors that government officials buys US Dollars before devaluing Pakistani Rupees, and end up earning hefty profits. In other developing countries like Argentina corruption might be less of an issue but government policies have caused runaway inflation. People in Argentina prefer to keep their savings in foreign currencies.

Bitcoin and decentralized currencies started with cypherpunks and libertarians. They still didn’t trust that governments & central banks will always take actions that are best for the people.

Bitcoin mining used to be possible on average laptops but lately only profitable way to do Bitcoin mining is using specialized hardware in a location with cheap electricity like China.

 

Setting Up Laravel on MacOS

After 3 years, I am using Laravel again at work. Laravel has extensive documentation but sometimes it can be a bit verbose. Here are command to get you started as soon as possible. This assumes pretty much fresh install of MacOS.

Install Homebrew

Check the official site for latest command
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install PHP 7.1

brew install homebrew/php/php7

Install MariaDB

brew install mariadb

Set MariaDB to start as service at the end of installation.

Install Composer

Get Composer from https://getcomposer.org/download/ and make sure to install it globally for easier use.

Install Laravel

composer global require "laravel/installer"

Add following line to .bash_profile in home directory
export PATH="$HOME/.composer/vendor/bin:$PATH"

And restart terminal or issue this command:
source ~/.bash_profile

Install Valet

Valet is very useful for setting up dev environment.
composer global require laravel/valet
valet install

Create Projects Directory

Now create a projects directory and let Valet know it should server from that directory.
mkdir ~/sites
cd ~/sites
valet park

Test your setup

Now in sites directory, create a new laravel project:
laravel new blog
and load http://blog.dev
If everything went smoothly, you should see a fresh Laravel project.

The E-Myth Revisited by Michael E. Gerber

One of my goal with this new blog is to organize my thoughts and knowledge. The E-Myth Revisited by Michael Gerber is a recent book I listened. So I will start with it.

My biggest takeaway from this book was that most people start business to create a job for themselves. For example, a person who enjoys baking may start a cake shop. The problem with this approach is that one is working in the business, not on it. The right way to start a business is with a goal of eliminating one’s job. For example, the person above should figure out a way to hire someone else to do baking.

This was a slightly hard lesson to digest because as programmer, I have often dreamed about starting consulting business. Mostly, so that I get to work with more interesting technologies.

The other lessons were:

Establish Processes & Document Everything

Create a business that can be easily franchised. In order for a business to be franchisable, it needs processes and systems. So document and create repeatable processes. You may never want to franchise, but well-established processes will help a business run smoother.

How to choose business

This was another interesting way to figure out what sort of business one should pursue.

  1. Start with your life’s goal. Of course, life’s goals change but choose something for now. It could be something like spend more time with family and volunteer at homeless shelter. It could be to own a biggest house in the town.
  2. Now choose your business strategy that will help you achieve your life’s goals. It could be a business that you can sell in a few years for $10 Million. Or it could be a business that can run on its own with minimal involvement from you and generate $100K yearly income.
  3. Finally, look at business opportunities. The first requirement for any business is revenues. Then see if it aligns with your business strategy. If your strategy is to generate semi-passive income while traveling the world, then pursuing a Silicon Valley style startup is probably not a good idea.

Write Job Descriptions

Another interesting idea presented was to write down all positions you see your business will need eventually. Draw organization chart. Then start hiring for each position. Initially, you will be filling all these positions, from CEO to lowest ranking worker. Your goal should be to work in each position, systemize it, and hire someone else. You should start filling positions at the bottom of chart first, slowly moving up as you systemize each position.

Manage by Delegation

One last point, many first time business owners manage by absenteeism once they hire someone. This usually doesn’t end well as employees then have no idea if they are doing good or not. Before you hire someone, their position should have well defined criterias to measure against. And you should actively review work done by your direct reports.


If you like to read this book, you can purchase it here using my Affiliate Link:

HSTS & NET::ERR_CERT_COMMON_NAME_INVALID

Without understanding, I had enabled HSTS on amerkhalid.com with option includeSubDomains. I had a subdomain that was used as “Custom Domain” to SmugMug site. After enabling HSTS, these subdomains started to throw NET::ERR_CERT_COMMON_NAME_INVALID.

The fix is of course simple, don’t use includeSubDomains. But that opens up your top level domain to man in middle attacks.

For now, I decided to follow the best practices and leave includeSubDomains enabled. And decided to not use custom domain for my SmugMug site.

Lastly, you can clear HSTS settings in Chrome by:

  1. Enter in Address Bar chrome://net-internals/#hsts
  2. Under “Delete domain” type your domain
  3. Hit “Delete” button.

 

Error: xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory is a command line tools instance

I have been playing with Cordova lately and was getting this error when building iOS version:

Error: xcode-select: error: tool 'xcodebuild' requires Xcode, 
but active developer directory is a command line tools instance

Even full install of Xcode didn’t fix this error.

The solution was to run following command to use full Xcode instead of command line tools version that I had installed earlier:

sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer

The Subtle Art of Not Giving a F*ck

I learned of Mark Manson through his blog, especially this post, 7 Strange Questions That Help You Find Your Purpose. Since then I have been on and off following his blog. He usually has a lot of good advice, so finally I decided to get his book. Makes it easier to have all information in one place.

I had no idea what Subtle Art of Not Giving a F*ck was about. It was an impulse purchase, perhaps to support his blog. It turns out to be a really good book. As a semi-regular reader of his blog, I sort of knew what his philosophies were. Still it was good to read everything in one place.

He is not encouraging to not care about anything but to care about things that matter. It is human nature to care. But a lot of us start to worry about things that don’t matter. Sometimes, it is because we have nothing to care about. For example, elderly lady in retirement home who has all her needs met, would get really pissed if her coupon is not accepted at super market because that is all she got.

Sometimes, we care about useless issues because real issues are too hard to deal with. For example, unemployed person may go back to school for their 3rd degree just because they are unable to get a job.

The basic idea is everyone cares about something but is it the right thing. His philosophy is very similar to Stoicism or even Buddhism philosophy.

The book is written well and easy to read. If anything negative, I would say that he is a bit verbose. Some of stories in it dragged on a bit too long. For example, when he was in his principle’s office, it was clear about what was going to happen but he dragged on that scene a bit too much.

Overall, I highly recommend this book especially if you are interested in some sort of self-help book.