Life saver - live dev on Magento Cloud

Not many know about this but we can do live development / debugging on Magento. I will share quickly how to do that below. Thanks to James Cowie and Sylvain Delbosc for helping me get good sleep even with blocker issues coming :D.

Once we login to Magento cloud, we get all our code in /app directory and all the code is made readonly. This makes it difficult to edit any file and add logs or change code to verify our code changes on dev server. This is really required with complex architectures where we have integrated systems and issues are with specific scenarios which are not possible to replicate in local machines.

Most of the code is in Classes and glad we are using auto loaders :). There is a scope of adding our classes in /app/app/etc/NonComposerComponentRegistration.php file before all the code to include all files (basically right after the file comment). This will ensure our classes are loaded and not the ones from actual modules.

To do this, we have to copy our files inside …

Drupal 8: Updating field configuration in update hooks

Continuing to Reverting features in update hooks, I encountered a new scenario yesterday where I had to make a field translatable. Somehow we missed to make the field translatable during development and now since we are in update mode we need to handle it for existing sites as well.

At first I looked at the documentation at, which was a bit confusing and not helpful for the case at hand.

Then I looked into some of the core modules but that didn't work for me. For instance comment_update_8300() in docroot/core/modules/comment/comment.install

It made the field translatable in field definition for me using this approach but it didn't update anything in the interface even after doing drush cr and drush entity-updates.

Then I tried to look into how it's done in frontend and found out that it is also stored as entity now and so quickly tried to load it as entity and do the changes. It worked perfectly fine, tricky again and something that might take hours to figure o…

Drupal 8: Reverting features in update hooks

For all the developers of Drupal who had a very good development workflow in place and used to revert features in hook_update_N() to ensure the deployment notes were simply to run update.php or drush updb, there is a good news :)

Project that I'm currently working is in install mode and we are really happy to use features and CMI and get all the configurations stored into modules but today I got a call from the product manager asking me to do include the code in update hooks to ensure it doesn't require re-installing the demo site. At first moment, I was like sure will do that but realised in next few mins, isn't that removed from features in D8? Wait, how will I do this, there is no documentation about reverting configurations, we have drush cim, cex and UI ---- and there came my answer, let me debug and find out how the UI is doing it.

After few mins again, I found the solution - it was just two lines of code, seriously? Yeah, its a bit tricky though.

You can get the pa…

Solution to send mails from development systems/servers - Strictly for developers

I faced this issue many times when I had to test the mail feature in my projects. I then had to add SMTP library separately to check in different web based mails like Google Mail, Yahoo Mail, Outlook, etc. or need to upload the code to production servers where mails worked.

Mandrill (sends to any really account - preferred for UAT and Production systems) and Mailtrap (sends to single account for any email address - preferred for Development systems) provides a very good way to do this. With small changes in configuration of the server we can easily use this to send mails to any account without having SPAM issues.

Mandrill can also be a very useful tool to send mails in production if Client has budget or the number of mails are very limited. It provides tracking tools, graph and we can even configure BCC on all mails without changing code for debugging purpose.
Today, I will cover how to configure it in Postfix (Linux Ubuntu/CentOS/Amazon Linux) and XAMPP using Sendmail.

Installing Postfix

Few tips to speed up your system - Strictly for developers

Nowadays all applications are getting better and better and we are asked to upgrade our system more frequently then before. We must think once about managing our needs in the available resources and utilizing the resources in the best way. For instance, browsers have become smart and we love to see suggestions after typing "How to" in the browser search. But do we really want this? Think again. We can limit the system usage by limiting the number of processes ran by the applications in background. It might disable some new features, but we rarely use them.
For today, I will cover tips to make Firefox better and faster.
I know what I want to search, I don’t want suggestions and type ahead.
[Below setting is available in Options -> Advanced -> General (Win),
Firefox -> Preferences -> Advanced -> General (Mac)]
Disable hardware acceleration
[Below setting is available in Options -> Advanced -> General (Win),
Firefox -> Preferences -> Advanced -> General (…

Export Thunderbird contacts to CSV

1.Open Address Book
2.Click on tools
3.Click on export

4.Select CSV file format for exporting.

Steps to create a Facebook application.