Which framework to use in PHP

Posted by Margus Pala on April 20, 2017

While doing my freelancer projects I keep on monitoring what frameworks are out there. I have been working with Java for many years but have landed on PHP as smaller projects are much faster and easier to get off the ground.

The more I observe Google Trends the more obvious it gets that Laravel is coming here to stay. Only framework that has trouble dying is Symfony and it could also be because of Laravel. Not much else is needed to say that only one picture and all is clear which PHP framework you must learn if you want to be among the best.

Topics: Laravel, tips & tricks | No Comments »

“Everbody matters” book review

Posted by Margus Pala on February 25, 2016

This book talks how Barry-Wehmiller company has managed to survive and thrive bad times. This parent company has made over 50 acquisitions and they are best experts of how to turn around companies from near bankruptcy.

The mindset the book describes was discovered b accident. Starting to trust people and making sure the will be happy in work and even more in their personal life is doing wonders.

Barry-Wehmiller company has written down a few checklists of how the company culture must look like and what leaders in this company should follow. Also they have built series of courses that teaches this knowledge to all interested parties in the company.

As a summary I strongly recommend this book to anyone who feels that the atmosphere in his company is poisonous. It will help you turn the company around and become very strong in long term.

Topics: book review | No Comments »

Laravel 5 unit testing Form and TokenMismatchException in Middleware

Posted by Margus Pala on December 26, 2014

While unit testing in Laravel 4 you were able to turn off filters including CSRF check in testing environment. However in the Laravel 5 CSRF check has been move into the middleware and I have not yet found the way to turn CSRF check off easily.

As TokenMismatchException will happen when testing controllers that are processing forms then I needed a hack to run the tests properly. I made a change to Illuminate\Foundation\Http\Middleware\VerifyCsrfToken . I added bypassing token check if environment is testing. You can do it also if you change the method handle to be like this

public function handle($request, Closure $next)
{
 if (env("APP_ENV")=="testing" || $this->isReading($request) || $this->tokensMatch($request))
 {
   return $this->addCookieToResponse($request, $next($request));
 }
 throw new TokenMismatchException;
}

Topics: Laravel | 2 Comments »

Never Eat Alone and Other Secrets to Success, One Relationship at a Time

Posted by Margus Pala on December 21, 2014

Reading this book opened my eyes regarding the value of ones network of friends. You need help of other people in whatever you do. If you have the connections with needed people already before starting your new project then you will be off the ground much faster.eating alone

One of the most important lessons in networking is to be nice to other people and help then reach their goals. Even cleaning lady in your office is important, call her by name and tell how much you appreciate the clean office in the mornings!

You can take the title of this book literally. Actually you can schedule meetings with interesting people for every lunch. Very few people say no if you invite them to lunch. Usually you can ask your existing network to reinforce the relationship. Its also good idea to identify people you want to meet and find someone in your network to introduce you. When you go to lunch then be prepared. Find out all you can about this person and go to the lunch with a plan. Just keep in mind that these lunches are not only what you want but try to find something how you can help your companion also. From my own experience I recommend not to have lunch with same people every day though. Usually office workers go to eat with their colleagues and this does not help to expand your network too much.

Another important principle is to keep pinging your network. If you do not keep in touch then you will soon be forgotten. Congratulation on birthdays is natural in these Facebook times. From time to time you can give them a call, send an e-mail, invite to lunch or to house party.

Industry conferences are great way to let people know that you exist. Try to get some speaking arrangements. If you cannot get to the big events right away then start with small and eventually the invitations to big events will also come. When going to event try to identify people you want to get to know beforehand. Go early and find these people. After making such initial connection it makes sense to ask them to lunch or breakfast or dinner also later and have more in depth conversation.

 

If this got you interested then there are many more great tips in the book http://keithferrazzi.com/products/never-eat-alone

 

Topics: book review, business, networking | No Comments »

Laravel 5 Seeder not found

Posted by Margus Pala on December 14, 2014

I tried to create new seeder in Laravel 5 and the seeder class was not found. I douoble checked like 10 times anddid not find what was wrong. Finally I tried “php artisan optimize” and the Seeder start working again!

You can fix it also if you happen to get exception like this:

 exception 'ReflectionException' with message 'Class RouteSeeder does not exist' in /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:745
 Stack trace:
 #0 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(745): ReflectionClass->__construct('RouteSeeder')
 #1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(650): Illuminate\Container\Container->build('RouteSeeder', Array)
 #2 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(505): Illuminate\Container\Container->make('RouteSeeder', Array)
 #3 /var/www/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(55): Illuminate\Foundation\Application->make('RouteSeeder')
 #4 /var/www/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(37): Illuminate\Database\Seeder->resolve('RouteSeeder')
 #5 /var/www/resources/database/seeds/DatabaseSeeder.php(17): Illuminate\Database\Seeder->call('RouteSeeder')
 #6 /var/www/vendor/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php(57): DatabaseSeeder->run()
 #7 [internal function]: Illuminate\Database\Console\SeedCommand->fire()

Topics: Laravel | No Comments »

Namespaces and Laravel 5 with Eloquent Model-s

Posted by Margus Pala on December 14, 2014

Recently I tried out the Laravel 5.  A lot has changed, overall it is using even more cutting edge technologies and best practices. On the other hand its learning curve is not so good anymore and this makes it harder for nwebie developers to start with it.

Major change is that you have to deal with namespaces on your own. Also the extends Eloquent is now replaced with extends Model (Illuminate\Database\Eloquent\Model) .  If your model name is Port then you need to import it in your controllers etc via “use App\Port;”

Example class looks now like:

 <?php namespace App;
 use Illuminate\Database\Eloquent\Model;
 class Port extends Model {
 }

These are exceptions that might happen for you if you do not handle it properly:

Class ‘Illuminate\Database\Eloquent’ not found

FatalErrorException in Port.php line 5:Class ‘Eloquent’ not found

HandleExceptions->fatalExceptionFromError(array(‘type’ => ‘1’, ‘message’ => ‘Class ‘Illuminate\Database\Eloquent’ not found’

FatalErrorException in AdminController.php line 12: Class ‘App\Http\Controllers\Port’ not found

Topics: Laravel | No Comments »

Apps for programmers to keep you healthy and fit

Posted by Margus Pala on December 11, 2014

Most IT people have trouble staying fit. I am also in upper limit of normal weight but I found some helpful apps recenlty.keep-calm-and-wait-for-ingress-invite-3

I believe that biggest problem is finding time to stay fit. Going to gym after works takes better part of the evening and you have to do it like 3 times a week which is not easy.

Firstly the famous 7 minute workout that some scientist say is as good as full scale training if you do it every day. Read more about it from http://well.blogs.nytimes.com/2013/05/09/the-scientific-7-minute-workout/

I have tried it for 2 months ca 5 times a week and I can see clear results already After first month I was able to do 50% more pushups. In 2 minutes I used to do around 45 and it went up to 70. I can see distintct muscles building from the mirror. I also feel not getting out of breath so easily. So this means it really works and makes you stronger. The app I use is https://play.google.com/store/apps/details?id=com.popularapp.sevenmins&hl=en

Second app for staying healthy is Ingress.  It is invite only augmented reality actiongame where you have to move around in the city from one portal to another and take these under you control. Usually I run for 50-100 meters from one portal to another, do actions on phone that is needed and run to another. Its is great hobby after the lunch for 10-15 minutes and while commuting between office and home.

It is amazing because the gamification moment helps you motivate to find some more minutes (or hours) to walk or run. Download it from https://play.google.com/store/apps/details?id=com.nianticproject.ingress&hl=en

Thirdly I have been able to lose some weight. There is nothing fancy here, just plain spending calories. In the summer I went to work and back with bicycle, I did some 30-40km trips with pulse in range of 130-140. This lasted 1,5h and used around 1800kcal. Considering that daily normal calorie intake is around 2500kcal then 3 times bicycling a week I lost around 5kg in 2 months. Unfortunately I had to make a pause because of knee injuryand then winter came with no daylight so there is big risk of getting killed in traffic. However same result can be achieved by same time and same pulse by walking, running, stairs climbing etc. App used is Endomondo https://play.google.com/store/apps/details?id=com.endomondo.android&hl=en

How are your experience with getting fit apps? Please write to comments.

Topics: Linux | No Comments »

Smartcuts: How Hackers, Innovators, and Icons Accelerate Success

Posted by Margus Pala on October 27, 2014

horse-pulling-carThis is must read book that everyone should read. I even listened this audiobook twice in a row to grasp the concepts better.

Have you wondered how typical US president career looks like? No, it is not advancing through all the voted positions one by one until you reach the top to become president. Instead typical president does something completely different and then switch career to become president. It rarely happens but if typical career politician will become president then history has shown how lausy job he has done.

Stand on the shoulder of giants, don’t start new things from scratch. Ask around and you will fins someone who has done it already so you can skip making a lot of mistakes.  If you want to use computer then should you know how electricity works or processor or operating system? No, you have to use what others have done already and only learn the specific program you use. I have found myself using this principle knowingly already a few times.

I love also 10x thinking principle. It generally means that improving something 10% is as difficult as improving 10x . Difference is that 10x principle makes you think differently. Most famous example is from Henri Ford, cars and horses. Making horses run 10% faster is similar in difficulty with making a car that can drive much faster than horse. This is the way how Elon Musk and his SpaceX can make 10x or 100x cheaper rocket launches than NASA can.

Topics: Linux | No Comments »

Startup CEO life is hard, experiences of Ben Horowitz

Posted by Margus Pala on June 30, 2014

If you are startup CEO or planning to be one then you will find many important lessons from book “The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers”hard-things

Book is very enjoyable to read, its almost like a thriller. It begins like biography of Ben from the times he build multibillion company at the time of .com bubble.  Besides all of the fun there are explained many critical things that startup CEO must know. A lot of attention is dedicated to building a team. How to choose best people and executives? How to keep them useful and engaged. How to fire your best friend and how to understand that firing must be done? What kind of people are suitable for what phase and what type of company executive positions?

All of these questions and more are answered in the book.

Read more from http://www.harpercollins.com/9780062273208/the-hard-thing-about-hard-things

Topics: Linux | No Comments »

Teaching my 9 year old kid about money – Why A students work for C students

Posted by Margus Pala on June 28, 2014

book-covers-a-studentFamous Robert T Kiyosaki who’s first bestseller was “Rich dad, poor dad” has written another book in sequence called “Why “A” Students Work for “C” Students and “B” Students Work for the Government”. This book feels like a vol 2 of “Rich dad, poor dad”

I got so much inspiration from that book that I made my 9 year old son to manage part of my investment portfolio to make money for himself. Estonian startup Bondora allows to invest money into relatively risky but high yield distributed loans. Most of the interest rates are between 20% and 35%. I started investing there around 1,5 years ago and now I gave my son the passwords and he is in charge of choosing best loan applications to invest in. We have been reviewing the portfolio 1-2 times a week. I feel that this will give him huge benefit in the future.

Main point of this book is that school system is not preparing our kids for the future enough and kids need to learn more about money, investing, passive income and not working for a salary. It is parents responsibility to fill in the gaps and prepare the kids to the future. It is especially important because governments are taking in loans and building expensive pension schemas which are severely underfunded. Our kids are the ones who will face the consequences and all the previous glorious civilizations ended up in ruin, why should we be any different?

Although the book is very right at many points then It repeats itself a lot and has too much advertising for the CashFlow game. I read it very eagerly at first but I read only two thirds of this book.

Read more from http://www.richdad.com/books/why-a-students-work-for-c-students.aspx

 

 

Topics: book review | No Comments »

Next Entries »