ACL stands for Access Control List. ACL roles and permissions are very important if you are making a big application in laravel 7.X. this tutorial will explain how to implement User Roles and Permissions(ACL) using spatie/laravel-permission composer package. So basically I will do it from scratch how to create permissions, roles, and users with assigned roles, etc.

Roles and Permissions through you can create several types of users with different role and permission, i mean some user have only see a listing of items module, some user can also edit items modules, for delete and etc.

In this examples I…


Uninstall NodeJS from Ubuntu

The command will remove the package but retain the configuration files.

sudo apt-get remove nodejs
sudo apt-get autoremove

To remove both the package and the configuration files run:

sudo apt-get purge nodejs
sudo apt-get autoremove

Install NodeJS on Ubuntu

Adding the NodeJS PPA to Ubuntu

sudo apt-get install software-properties-common
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

After successfully adding the NodeJS PPA, It’s time now to install NodeJS using the command below.

sudo apt-get install nodejs

Verifying the version of NodeJS and NPM

node -v
npm -v

More Info : http://www.rscoder.com/2020/04/how-do-i-completely-uninstall-nodejs.html


Keyboard shortcut (Mac / Linux / Windows) to switch the focus between editor and integrated terminal in Visual Studio Code

ctrl+` : To Focus on Integrated Terminal

ctrl+1 : To Focus on Editor (If editor-2 command would be ctrl+2)

Example ::


Magento2 product errors: Item (Magento\Catalog\Model\Product\Interceptor) with the same ID “<id>” already exists.

Then you can use the below module to resolve the above error.

  • Create new folders RSCoder/DuplicateEntry in app/code Magento folder.
  • registration.php
<?php\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'RSCoder_DuplicateEntry',
__DIR__
);
  • etc/module.xml
<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="RSCoder_DuplicateEntry" setup_version="1.0.1"></module>
</config>
  • etc/di.xml
<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Eav\Model\Entity\Collection\AbstractCollection">
<plugin name="find_duplicate_entry" type="RSCoder\DuplicateEntry\plugin\Collection" sortOrder="20"/>
</type>
</config>
  • plugin/Collection.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
*/
namespace RSCoder\DuplicateEntry\plugin;
use Magento\Framework\Data\Collection\EntityFactoryInterface;
use Magento\Framework\Option\ArrayInterface;
class Collection
{
/**
* @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $subject
* @param \Closure $process
* @param \Magento\Framework\DataObject $dataObject
* @return $this
*/
public function aroundAddItem(\Magento\Eav\Model\Entity\Collection\AbstractCollection $subject, \Closure $process, \Magento\Framework\DataObject $dataObject)
{
try{
return $process($dataObject);
}catch ( \Exception $e){
return $this;
}
}
}

Now enable the above module & It’s working fine.

Reference Link: http://www.rscoder.com/2019/12/magento-2-how-to-resolve-item-with-same.html


There are many ways to create and use rounded buttons in Flutter, but I’m going to show you some ways that work great in my opinion.

Rounded button using RaisedButton

Padding(
padding: EdgeInsets.only(left: 150.0, right: 0.0),
child: RaisedButton(
textColor: Colors.white,
color: Colors.black,
child: Text("Search"),
onPressed: () {},
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
),
),
)


What is Async:

Async functions enable us to write promise-based code as if it were synchronous, but without blocking the execution thread. It operates asynchronously via the event-loop.

What is Await:

The await operator is used to wait for a Promise. It can be used inside an Async block only. The keyword Await makes JavaScript wait until the promise returns a result. It has to be noted that it only makes the asyncfunction block wait and not the whole program execution.

async function loadJson(url) { // (1)
let response = await fetch(url); // (2)

if (response.status == 200) {
let json…


/dev/kvm device: permission denied is the error that I got while trying to run Android Virtual Device(AVD) on a fresh install of Ubuntu 18.04.

The error message also shows a hint on what could be wrong: Grant current user access to /dev/kvm. A quick google search reveals that this is a common problem.

The easiest way to fix this would be to install qemu-kvm and then give appropriate permission to the current user.

Install qemu-kvm.

$ sudo apt install qemu-kvm

Use the adduser command to add your user to the kvm group.

$ sudo adduser <username> kvm

And then own the file /dev/kvm using chown.

$ sudo chown <username> /dev/kvm

After the above steps the AVD should work as expected.

Rahul Shukla

Back-End Developer & Hybrid App Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store