Skip to main content

Posts

Showing posts from April, 2020

Populate Whatsapp Link Based on Seller Phone Number WCFM

Hi all, Image from Pexels Today I'm going to share, how to populate WhatsApp link based on the seller number. My example today is based on Malaysia's phone number. The registration input doesn't have an input validator for the phone number, however, these are the most common number registered by users. 1) starting with 6 at front 2) starting with +6 at front 3) normal number without country code eg : 014xxxxxx Full code on how to populate whatsapp link for seller number basically, I introduced a simple pattern that has 2 groups. "#(^[6]\w*$)|(^[+][6]\w*$)#"; The patterns must have a delimeter added for PHP, in my case i use a `#`. You can use other delimiter that supported by PHP . The first pattern (^[6]\w*$) Checks whether the seller phone number starts with number 6 and followed with other characters. If it is matched, do nothing as the format is already correct. The second pattern (^[+][6]\w*$) Checks whether the seller phone ...

Adding Custom Field for Vendor Settings in WCFM

Hi all, just a quick sharing. How to add Custom Field for Vendor Settings in WCFM Image by Clker-Free-Vector-Images from Pixabay I wanted to add a custom field for Vendor Settings in WCFM . The field will be a checkbox with a label of "Verified". This field can only be filled by an admin. The purpose tells is to tell whether this vendor is verified or not and data is stored in `wp_usermeta` table. Okay, of course, if I use the paid extension for WCFM plugin this feature already included. But come on! I just want to add this simple function without paying any penny :P Thus I decided to DIM (Do it Myself). I was lucky that previously other WCFM users did a custom field for Vendor Settings and shared his solution on the WCFM forum. Aha. So I tested out, in the beginning, it was not working. The working code I included here for your reference. I also added the admin user check to ensure the field is only loaded for admin view :D. This code needed to be in...

AWS Workspace Device is not Authorized Linux Client

Have you guys tried the AWS Workspace? They are offering the service for free from April - June 2020. For a limited time, in response to COVID-19 , starting April 1, 2020 through June 30, 2020, Amazon WorkSpaces Free Tier provides up to 50 WorkSpaces with Windows Standard bundle with 80 GB Root and 50 GB User Volumes, running in AutoStop mode for up to 10,000 hours of combined use per month across all AWS Regions where WorkSpaces Free Tier is currently available. Additionally, the Amazon WorkSpaces Free Tier provides one WorkSpace with Windows Performance bundle with 80 GB Root and 100 GB User Volumes, running in AutoStop mode for up to 200 hours, two WorkSpaces with Linux Standard bundle with 80 GB Root and 50 GB User Volumes, running in AutoStop mode for up to 400 hours, and one WorkSpace with Windows Value bundle with 80 GB Root and 10 GB User Volume, running in AutoStop mode for up to 200 hours. All new customers that start using WorkSpaces for the first time during ...

Step by Step Read Android Logs using ADB Logcat in Ubuntu

Having ADB Logcat will be helpful in debugging our android application to check important logs for troubleshooting purposes. Using Ubuntu as your main operating system, you might come across this matter on how to debug our device application easily? Instead of installing doubtful Logcat applications on Google Play Store why not we just do it ourselves? Android Apps Awesome! Steps to Read Android Application Logs in Ubuntu using ADB Logcat. 1. Enable the developer mode in our Phone  This step varies from different phone models. Please checkout you phone-specific instructions to enable developer mode 2. Then enable the USB debugging in our phone  Usually in Settings > Additional Settings > Developer Options > Usb Debugging 3. Install the ADB tools  sudo apt install adb 4. Plug in the phone ensure that Ubuntu recognizes the phone you can see the "Android" / Phone device is mounted properly   5. Now run the ADB command to list available...

Python Quizzes for Job Interview Preparation

Sample of Python Quizzes and Questions for Job Interview I'm doing some revision on python programming. May this helps you as well. Please try to understand the logic ya after seeing the code answer. Image by Shahid Abdullah from Pixabay Data Structure Quiz Implement a group_by_owners function that: Accepts a dictionary containing the file owner name for each file name. Returns a dictionary containing a list of file names for each owner name, in any order. For example, for dictionary {'Input.txt': 'Randy', 'Code.py': 'Stan', 'Output.txt': 'Randy'} the group_by_owners function should return {'Randy': ['Input.txt', 'Output.txt'], 'Stan': ['Code.py']} . My code answer Result : defaultdict( , {'Randy': ['Input.txt', 'Output.txt'], 'Stan': ['Code.py']})  Some additional info : A defaultdict works exactly like a normal dict, but it ...