Nodejs:Resolving EACCES permissions errors when installed from .pkg

I am a super fan of installing tools if a .pkg or .dmg is available instead of using tools like homebrew or nvm. Things worked well but recently I started getting errors when I tried to update some of my other node packages specifically the below error Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’ I then found some solutions here https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally, where they mentioned reinstall of node using nvm or to change npm default directory. I then chose to go with nvm which seemed easier, but I encountered a problem, how to uninstall the existing nodejs which I installed via pkg. …

Continue Reading

Python: Import from multiple folders

Some learnings with folder structure and import with Python, I was trying to make a REST Api using Python and Mongo db. My initial folder structure was like this I had problems with import, I was creating my Flask app in api.py, and I wanted to import my database functions into api.py and I was doing like this “from app.database.db import….” which somehow strangely conflicted the Flask app instance “app = Flask(name)”. Was giving ModuleNotFoundError: No module named ‘app’ Then I made the structure as below, renamed a few folders Then I had problems in accessing db.py as well as …

Continue Reading

Flutter: Plugin to get iso_countries

Often when we develop apps where we need to populate list of countries, search them etc, you may go by adding the data statically or using apis, but here lets use the power that lies with in your mobile phones. Most of the mobile system OS has these information embedded and we can avail those. I encountered a requirement while I was doing a personal project. I managed to create a plugin so that it benifit others, here you go https://pub.dev/packages/iso_countries

Continue Reading

UICollectionViewCells are resetting their size on refresh

Recently I was working on a scrollable tab bar, where I decided to use collectionview with estimatedSize as automatic as the tab titles were dynamic. I used a stackView inside the cell with all proper constraints and used the default flowlayout. Everything worked well unless there was a requirement to reload the tabs and what happened was once the reload happens, size of the cells became wrong, they shrinked suddenly. I could use the sizeForItem api but then I loose the dynamic behavior. Finally below are the steps that I did. I was creating the layout programmatically Set translatesAutoresizingMaskIntoConstraints false …

Continue Reading