Author: Daniel

  • WordPress: The server cannot process the image — How To Fix?

    WordPress: The server cannot process the image — How To Fix?

    The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.

    The above seen error swept a couple of hours out of my day. At the end, I’ve figured out what went wrong and I’m about to share how I fixed it.

    Solution

    1. Find out which php.ini is loaded by running the following command.
    php -i | grep 'php.ini'
    # Result
    
    Configuration File (php.ini) Path: /etc/php/7.x/cli
    1. Bump up the upload_max_filesize value. In my case, I bumped to 8M. I had to make this change in the /etc/php/7.4/fpm/php.ini file.
    ; Maximum allowed size for uploaded files.
    ; http://php.net/upload-max-filesize
    upload_max_filesize = 8M
    1. Restart PHP FPM service by running the following command.
    sudo systemctl restart php7.4-fpm.service

    By now the maximum upload file size displayed in the WordPress dashboad must have been set to the value you set in the php.ini file.

    Behind The Scenes

    If you’re interested in knowing what I tried before I arrived at the above solution then keep reading.

    1. Since the issue is obvious and related to file uploads, I tried to increase the memory limit using `wp-config.php`. But this did not solve the problem.
    define('WP_MEMORY_LIMIT', '256M');
    define('WP_MAX_MEMORY_LIMIT', '512M');
    1. Next I tried changing the upload_max_filesize value in php.ini file. I’m running a LEMP stack. However, changing the php.ini file did not solve the problem.

    The loaded php.ini can be found by running the following command.

    php -i | grep 'php.ini'
    # Result
    
    Loaded Configuration File: /etc/php/7.4/cli/php.ini

    I restarted the PHP service for the changes in php.ini file to take place using the following command.

    sudo systemctl reload php7.4
    1. I disabled gd PHP module and installed imagemagick PHP module. However, this did not solve the problem.

    You can run the following command to list all the installed PHP modules.

    php -m

    Today, I’m grateful to my two beautiful dogs who keep me sane by offering love licks when I’m busting through the roof.

  • How To Use Date Query With WP CLI?

    If you’re reading this post, I’m sure you don’t need an introduction on WP CLI.

    Inclined to use some stats in my monthly review post, I wanted to find out the total number of spam comments my blog received for the month of April.

    Thinking that WP CLI would make my task easier, I started looking at the documentation to find out the appropriate syntax to be used with the wp comment list command.

    To my surprise I found out that date query isn’t possible with WP CLI. I realized that I could leverage RESTful WP CLI and apply the date query.

    RESTful WP CLI query looks like the following.

    wp rest comment list

    Using the help command, I figured out the options to be passed.

    wp help rest comment list

    In order to get the list of spam comments for the month of April, I arrived at the following command.

    wp rest comment list --after='2022-03-31T23:59:59' --before='2022-05-01T00:00:00' --status='spam'

    Problems

    However, there were a couple of problems.

    • Authorization: In order to use the status option, authorization is must. Otherwise only the default value approve will be taken in to account.
    • Readability: The output contains all the comment table fields cluttering the entire console.
    • Getting the total count: A tabular display of data doesn’t output the total number of records.

    Authorization

    I solved the authorization problem using the user option in the command like shown below.

    wp rest comment list --after='2022-04-27T23:59:59' --before='2022-05-01T00:00:00' --status='spam' --user='admin'

    Readability

    I solved the readability problem using the field option in the command like shown below.

    wp rest comment list --after='2022-04-27T23:59:59' --before='2022-05-01T00:00:00' --status='spam' --user='admin' --field='id'

    Total Count

    You can obtain the count by using the --format=headers option.

    wp rest comment list --after='2022-04-27T23:59:59' --before='2022-05-01T00:00:00' --status='spam' --user='admin' --field='id' --format='headers'

    References

  • Unforeseen Bite

    I’ve been reading a lot on Canine psychology and body language since four years. The acquired knowledge helps me bond with any dog. I don’t approach dogs that are not comfortable with my interactions. Dogs communicate all the time using body language.

    Rain or shine, I walk my dogs every day. My eldest dog will turn four this December. We hardly missed a walk during these four years.

    I sometimes pet, talk to a few strays during our walks. I was walking one of my dogs like every other day. A stray came out of no where and bit my leg from behind.

    For a moment, I wanted to hurt that dog in return. But the knowledge I acquired helped me make the right decision. Dog’s don’t escalate to biting unless provoked. The dog appeared to disabled with a broken leg. She would’ve bit me out of pain or could even be because of rabies.

    I shooed the dog away and noticed that I was bleeding. I rushed to the hospital and got my first anti-rabies and TT shots.

    The bite doesn’t affect my love for dogs. However, I would be more cautious with the one that bit me.

    I wish I had a good knowledge on snakes as well. I happened to kill one that visited my house a few months ago.

    Today, I’m grateful to the Internet, a vast library, that made me a better person.

  • Delete All Git Stashes

    You can quickly clear your git stashes at once, by running the following command.

    git stash clear

  • Monthly Review: March 2021

    Like most people, I make great plans every new year. However, I lose track of my goals and live an ordinary life every year. I don’t want to let go of another year making meaningless choices. Hence, I wanted to reflect on my progress every month. These monthly reviews keep me accountable.

    Server Administration

    Unfortunately my cloud hosting server crashed this year. This unfortunate event led to a series of events that I’m proud of. You wouldn’t be reading this post otherwise.

    1. Moved to Linode cloud hosting.
    2. Setup backups that are saved on to a different server.
    3. Moved all my domains to Google domains.
    4. I shall soon retire my daniel@danieldeepak.com inbox.

    Pet Project

    I’ve been running Tap That Brain for a couple of years now. This month I decided to steer the course of the project radically. I made my mind to not indulge in in-person training sessions.

    Rather, I wanted to offer online dog training courses. Also, I’ve been wanting to run and manage a members-only forum / platform to discuss anything and everything dog training and dog parenting.

    1. Setup a members-only forum using Vanilla.
    2. Implemented single sign-on for Vanilla using WordPress log-in credentials.
    3. Began writing my first online course.
    4. Had setup newsletter to send out dog training tips for dog parents.

    Blogging

    1. Published 11 posts in my personal blog.
    2. Published 9 posts in Tap That Brain blog.

    Productivity

    Starting March, I’ve been following the deep work philosophy. Using deep work, I was able to get things done faster and better. I’ve been consistently clocking three deep work blocks every work day. Each work block would range between 45 minutes to 90 minutes depending on my energy level that day.

    Family

    Out of the blue, we visited Velankanni. The struggle in finding a stay will make the trip memorable forever.

  • Ubuntu Videos: No PGS Subtitle Decoder

    To get PGS subtitle decoder support, install the following packages.

    https://askubuntu.com/a/1142375/593022

  • [Adopted] Lab Puppy For Adoption

    Update: Thanks to the Almighty. We found a family for the puppy.

    I’m fostering a female Labrador Retriever pup since a week. I’m looking forward to meet a family who will be interested in adopting the pup.

    Adoption — Any caveats?

    Unfortunately, adoption conveys a wrong message to the wrong ears. Adoption does not mean taking home a pup at no cost.

    Instead, we, the caretakers of the parent dogs, want you to invest the money you would spend on buying a pup to the well-being of the pup. We’re more interested in letting go of the puppy to the right family than making money. We have day jobs that pays our bills.

    We aim to find the right family to take care of the pup like one of their own. We don’t stop there but educate the family so they can raise a companion dog that is joyous to have around. Finally, the dog ends up with a family that cares.

    So our aim with this adoption is to end up in a win-win-win situation. We win. The family wins. And the dog wins too.

    I’ve come up with a list of things that will help you raise the dog of your dreams. Before you roll up your sleeves to pick up the puppy, remember, you will be the puppy’s mother for the next 15 years of your life.

    1. By walking your dog at least 30 minutes twice a day, your dog would quietly rest throughout the day allowing you to do your chores.
    2. By spending at least 30 minutes bonding, you and your puppy would end up having a beautiful friendship. The stronger your friendship, the better the compliance from your puppy.
    3. By bathing your dog once every fortnight, you will ensure that your dog is free of ticks and fleas. In addition, your dog would smell good when you snuggle.
    4. By consulting with a veterinarian once every three months, you would ensure your pet’s health.
    5. By spending ~ 100 INR per day feeding good quality meat, you ensure your pup’s nutritional needs. Turkey / Rabbit / Beef / Quail / Mutton / Chicken are suitable for dogs in the listed order. This would save you from huge medical bills that occurs when you feed foods that are of low quality / not suitable to dogs.
    6. By spaying your dog at the right age, you would save your dog from physical and mental trauma. I strongly discourage artificial selection of dogs in breeding, unless the person who breeds knows the science of genetics.
    7. Labrador Retrievers do shed a lot. By investing in a good vaccum cleaner, you will save yourself from embarrassment when guests arrive at your doors.

    Can we meet the pup’s parents?

    You’re most welcome to meet the parents of the pup. Indeed, I strongly suggest you to meet the parents before meeting the pup.

    Health history

    The puppy was born on Dec 23, 2021. The pup is 3 months 3 days old at the time of writing this post. The puppy is vaccinated and the vaccination records will be handed over to the family. Both the pup’s parents were inspected by veterinarians shortly before the breeding. Out breeding technique was used. In other words, the parents are not related to each other.

    Training

    The puppy is currently being potty trained. In addition to potty training, the puppy is also socialized with kids, adults, loud sounds and various other real time scenarios of a urban lifestyle. The training would continue until a suitable family is found.

    Immediate expenses

    Like I mentioned earlier, adoption does not mean taking home a puppy at no cost. We would want you to spend on your pup’s well-being. If you choose to adopt this puppy, your immediate expenses would include the following.

    01. Flat leash and collar. I use the Birdie Collar and Leash Set for my other dogs and I strongly recommend the same because of the durability and convenience.

    02. Crate. If you have children under 14 years of age, I strongly recommend you to purchase a crate. I’ve seen my clients use M-Pets Voyager Wire Crate with 2 Doors and I recommend the same. You can get any crate but ensure to get one with a flat flooring for the dog to step on.

    03. Basics of foundation training course. This is an online course designed to help you communicate with your dog. You will also learn about the various training techniques that you can use to train your dog any behaviour using positive reinforcement. This course is priced at INR 9,999 /- But, I love to offer this course for you at INR 6,999 /-

    Interested In Adoption?

    If you’re still reading then you’re probably interested in adoption. Please fill up the Google form and I shall contact you. Preference will be given for people residing in and around Salem.

  • Is Your Breeder Ethical? Five Questions To Ask

    Yesterday, I ran into a breeder over a phone call. We had a conversation, of course, about breeding. I asked a couple of questions and his answers raised a lot of red flags.

    I was furious at first. But then I realized that people like him stand a chance because of lack of awareness amongst people. So I thought of sharing list of questions to ask that will help you differentiate ethical breeders from the unethical ones.

    01. How do you ensure your dog’s well-being?

    Ethical breeders care a lot about their dogs well-being (both physical and mental). They tend to meet their dogs biological, emotional and social needs.

    Learn more about how to keep dogs happier. So you can ask your breeder the right questions to know whether the mother and the pup were happy with the breeder.

    What does Animal Welfare Board Of India (AWBI) say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (7)

    02. How many dogs do you raise?

    Note that each dog demands at least 30 minutes of attention a day. Paying attention individually becomes challenging when there are more than 5 – 8 dogs.

    What does AWBI say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (24(5))

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (24(6d))

    03. Do you breed your bitches in all heat cycles?

    Like humans, dogs need interpregnancy interval to restore their physical and mental health. Bitches can be bred in alternate but NOT in all heat cycles. Bitches less than 18 months and more than 8 years of age should NOT be bred.

    What does AWBI say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (5(2))

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (5(3))

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (6(4))

    04. What breeding technique do you use?

    Out breeding is the only recommended technique unless the breed is at the verge of extinction. The parents are not related at all in the out breeding technique.

    What does AWBI say?

    fer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (6(2))

    05. When do you usually re-home a pup?

    Puppies need to be with the mother and their litter until at least they’re 6 weeks old. Re-homing a pup after 8 weeks is recommended. The 8 week period is crucial for their immunity, early socialization and bite inhibition.

    What does AWBI say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (8a)

    06. Vaccinations & De-worming

    Mother feeding is very important for pup’s immunity. So are vaccinations and de-worming. Your ethical breeder would educate and be happy to share those information with you.

    What does AWBI say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (7)

    07. The size of a dog’s shelter

    Dogs should be housed in comfortable shelters. The length of the shelter should be four times the size of the dog and the breadth should be two times the size of the dog.

    What does AWBI say?

    Refer The Prevention of Cruelty to Animals (Dog Breeding and Marketing Rules) Rules, 2017 (5)

    Note that my views on each section is in accordance with Animal Welfare Board Of India. The breeder whom I spoke to was neither ready to accept my views nor he had documents / references to exemplify his views.

    As dog parents, we’re responsible for selecting the right breeder. We would only be supporting puppy mills, otherwise.

  • Abundance In Scarcity

    Last Saturday, I took my family to a sports club with the intend to enjoy a swim. On our way back home, we stopped at a street vendor selling baby clothing.

    My wife and I try and support not only street vendors but also street artists when ever we can.

    The street vendor was a woman. We purchased about four items. The old lady encouraged us to try the clothing on, on our baby. We had a little conversation with the woman and we were happy with the purchase. We were preparing to leave.

    The woman looking at our kid pointing fingers at a mask made for kids, offered the mask at no charge. She also offered another clothing that she loved to see our baby put it on.

    We insisted her to take the money but she replied saying that she saw our kid like one of her grandchildren. She also said there’s only so much we can do with money and happiness matters the most beyond money.

    On our way back home, my wife and I realized that the old lady could have made a little more by aceepting the money we offered. But she felt joy and abundance in offering.

    Everyone fights their own battle in life. In the world of constant scarcity, the act of the woman, a street vendor, portrayed abundance.