Laravel 5.2: entrust migration exception

Laravel

Today I pulled a fresh Laravel 5.2 (5.2.31) installation to work on the new project in company, when I was trying to install entrust and execute the migration file I was popped by the above exception error in my Console.

Well was the exception is saying the issue is that there is no column specified for the foreign key on users table of my application.

To fix this you can easily open the entrust migration file and add your users table into it.

The reason that this happens is because when entrust is going to make the migration file it looks into config/auth.php file to lookup the name of your users table.

if you open the auth.php file you can see something similar to below in providers section:

entrust looks for table property within this array to find the name of the users table.

To fix the issue and make entrust migration generation works properly you need to add ‘table’ => ‘users’ in this array.

so the output should look like:

Then you can run php artisan entrust:migration and it will create the migration file with proper value for the foreign key reference.

Fix: Surface Pro 3 is not going to deep sleep in Windows 10

Surface Pro 3 Deep Sleep Mode

By default Surface Pro 3 will go into deep sleep (hibernate) mode once you don’t use it for around 4 hours. which is basically a good feature. it helps a lot with the battery.

Recently I realized that my surface pro 3 which is running latest version of windows 10 is not going to that state any more.

What I did was checking a lot of stuff in the sleep study report but the fix was much simpler than that.

To Fix this go to : Control Panel\All Control Panel Items\Power Options\Edit Plan Settings and Then click on Change Advanced Power Settings.

Open the sleep section and under hibernate after set your desired value for battery use.

That’s it. I chose to put the value of 120 minutes at there anywhere. but you can set it to 240 to get the same 4 hours back.

 

 

Should you kill background tasks in Android?

Should you use task killers or not

This debate has been there for a while now. When first Android came up lots of apps started to gain people attention by promoting themselves as a task killer and speed booster. I have used them too, there is no blame on them. Android is not doing a good job in restricting applications on system resources. That’s why we are having Android phones with huge hardware specifications that are even more powerful than many of our first computer, but in real world these devices start to lag after installing few apps. This is happening while Apple iPhone products which have much lesser amount of RAM and CPU run smoothly because Apple was strict about resource consumption by developers.
Although now days Android marshmallow is offering features like doze to reduce the battery usage of devices while they are sleeping, it’s still lacking on a proper background task manager.

If you have heard of greenify you should know that it is one of the most popular task killers among Android users at the moment.
Greenify will let the user to kill the background running apps by basically force stopping them. Well that is a really cool and handy app but does it really necessary that you do that to your apps?

My friend was asking about my idea on this yesterday. It’s obvious that when you kill an app and you start it again it uses more CPU time than when it’s already in the background, which will cause more battery drain.
But at the same time it really makes your phone and other apps experience when you don’t have tones of apps in your background.

What I’m trying to conclude here today is that both parties are right. Those who say that task killers are making phones faster and those who say that task killers actually drain your battery faster.

So should you be using a task killer? Or if you are using it, how should you be doing it?

To make sure you are aiming for both better performance and more battery life of your phone when you are using an app like greenify, you should look at yourself and see how do you use your phone. what are the apps that you use the most daily.

if you are a heavy Facebook user and you are one of those whom open Facebook every 10 minutes, then greenifying Facebook application on your phone, not only will not help with your performance, but even it will drain your battery every time you lunch it.

But let say you have ebay application installed on your phone, just like me, and you only use it few times in a month, Then greenifying that background service is not harmful but helps with over performance of your phone and battery life too.

Hope this writing can give you a bit of clue that whether to use Task Killers or Not.

 

Vagrant up and Vagrant Add Blank Error

Last week my boss told me that I have to be outstation in another state of Malaysia to be on the client side for a week. So since I work with a PC in company I requested for a laptop so when I’m outstation I can take it with me.

Well as usual once I got the machine I formatted it and installed my tools. after installing Vagrant and Visualbox I was getting an annoying blank error when running vagrant up for the first time.

Basically somehow it was not able to start downloading the box. After searches on the internet I came across the right solution which was to install Microsoft Visual C++ 2010 SP1 Redistributable Package. Yeah that did the trick.

So decided to post this here so if by any chance you also faced the same issue this blog post can save your time.

Laravel 5: Manual Pagination From Array.

Laravel

Laravel documents is not covering anything about making a pagination from your custom array. its very nice and easy to use pagination out of the box with eloquent queries, but if you want to know how to do it with your custom arrays then you might find it hard searching around in their website.

Anyway here is the easy and workable way of making a pagination out of your custom data array.

Continue reading Laravel 5: Manual Pagination From Array.