Author: Junaid

  • Generate a Random String of Same Pattern as Given String

    Here is a PHP snippet showing how to generate a random string of same pattern as input string.

  • Replace Collation on a MySQL Dump File

    Sometimes we may find difficulty with importing a database from dump file which is created from a different machine. It may issue an error message like this: Which means the dump file uses a collation which the mysql server on the target machine not understanding. One solution is to replace the collation with one that…

  • Install and Run Multiple PHP Versions in Ubuntu 22.04

    I wanted to run both Drupal 7 and 9, as part of my work, in my machine now running on Ubuntu 22.04. Drupal 7 best run with PHP 5.6 while Drupal 9 requires either PHP 7.4 or 8.1 I could make it work after some research and try. Here is how I made it work.…

  • Quick Twig Template Rendering Without Much Set Up

    Sometimes, I want to prepare more readable output from my PHP scripts. It is good to create a template and render with values from script out put. Here is a quick way to render a twig template. First lets assume the HTML twig template (test-report.html.twig) is: Then we have this script, test-script.php: Keeping above two…

  • Turn ON Android Mobile Having Broken Power Button

    Power button of my mobile phone stopped working completely few weeks back. It showed some symptoms few days prior to that. I was being so careful not to drain out the battery as I would be required to press button to turn it back to ON, which I can’t because of broken button. But it…

  • Fertilizer Recommendations

    In this article I just note applications of various fertilizers. It is mainly to help myself to refer quickly as I can look into this article as needed. I may update this article as need to add or update info. Solution Preparation We need to mix 10 gram of fertilizer with 1 kg of water…

  • Install MySQL 5.7 on Ubuntu 20.04

    First follow installation instructions given at https://docs.docker.com/engine/install/ubuntu/ . Then make sure docker is running properly: Ensure it created the image by: Now, install docker MySQL 5.7 image and create a volume for storing data. Make a MySQL installation with command: Replace the password with your one. To show running instances: Login to docker instance terminal:…

  • Building Wheel for a Python Package Failed

    Today I was trying to install frappe-bench package within a newly created python 3 virtual environment in my Ubuntu 20.04. It gave this error in terminal. However, the package appeared to be installed even with above error. Then I got this SO thread in my search https://stackoverflow.com/questions/53204916/what-is-the-meaning-of-failed-building-wheel-for-x-in-pip-install. It has this answer from a pip maintainer…

  • Use Python Markdown Extension in Jupyter Notebooks

    I regularly use Python Markdown when working with Jupyter notebooks. It is actually straightforward to set up in Jupyter, but I always forget the exact steps to be followed whenever I set up Jupyter notebook especially after installing a new OS. So, there are those steps, I note here to help myself in future. First…