Posts

Power Automate: Invalid type. Expected Object but got Null.

Image
As you may know, a JSON body is similar to a table but is raw data without any properties. The data just follow the JSON standard. You can format it into objects for further querying. That is why we use the  Parse JSON  task in Power Automate. You may face an error if the data is not properly declared.

Moving to Blogger.com

My website was moved from WordPress to Blogger.com recently. I used to run my blog on Bluehost . It was a three years contract. To be honest,  the Bluehost service was super stable. The website only failed less than three times in the last three years. However, the renewal price was over $300. Hence, I started to explore an alternative. WordPress.com was an excellent option. However, I experienced it a few years ago. I want to try something new. GitHub Pages is a trendy blog service. But it needs to be simpler to set up. Try if you have time.  Eventually, I decided to go with Blogger.com . I need something stable and long-lasting. Blogger.com has been a Google service since 1997. It is long enough to prove the service's stability. And it is free to use with some advanced features. Such as the custom domain, SSL and AdSense, etc... It is easy to import WordPress content to Blogger.com. Some online tools can convert the exported WordPress XML to Blogger.com format. It took me 15 m

“Autoplay audio” does not work on the Quizlet web version on MacOS

Quizlet is a flashcard application. You can use it to remember words, professional terms, or class notes. It has web and application editions.  The application edition works perfectly on iOS. It plays term and definition audio automatically. Quizlet calls it the "autoplay audio" feature. It is helpful to remember things with sounds. However, the function only sometimes works on Safari on MacOS. You may face similar problems. For example, the audio button is grayed out, or you must refresh the page several times to get the audio played. The fix is straightforward. Open a Safari window. Click Safari  on the top menu. Go to Settings . Go to the  Websites  tab. Go to Auto-Play . Select Allow All Auto-Play  for quizlet.com . This method is also applicable to similar issues on other websites.

How to List All Users in Terraform Cloud

Terraform has a rich API. However, the API documentation does not mention how to list all users. We can leverage the organization membership API and the PowerShell command Invoke-RestMethod to get a user list. 1. Create an organization token in Terraform Cloud. 2. Create the token variable ( $Token ) in PowerShell. $Token = "abcde" 3. Create the API parameters variable in PowerShell. $params = @{ Uri = "https://app.terraform.io/api/v2/organizations/ZHENGWU/organization-memberships?page%5Bsize%5D=100" Authentication = "Bearer" Token = $Token ContentType = "application/vnd.api+json" } Note: You need to replace ZHENGWU with your own organization name. And I used 100 at the end of the URI to retrieve the first 100 users. It can be any number.  4. Retrieve the API return and list the user's email address. $Test = Invoke-RestMethod @params $Test.data.attributes.email

Connect-NsxtServer shows "Unable to connect to the remote server"

When you run Connect-NsxtServer in the PowerCLI, it may show "Unable to connect to the remote server".  Because the error message is a little bit confusing with other login issues. It's not easy to troubleshoot. The actual reason is the NSX-T uses a self-signed certificate, and the PowerCLI cannot accept the certificate automatically. The fix is super easy. You need to set the PowerCLI to ignore the invalid certificate with the following command: Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction:Ignore -Confirm:$false

Move Terraform Providers to Other Folders

Create a new control file with the name .terraformrc or terraform.rc in your profile folder. Add the following line: plugin_cache_dir = "$HOME/.terraform.d/plugin-cache" Create the folder .terraform.d/plugin-cache in your profile folder. The providers will be downloaded to the cache folder when you run terraform init . If you don't want to create the control file in the profile folder. The alternative is to create an environment variable. export TF_PLUGIN_CACHE_DIR="$HOME/.terraform.d/plugin-cache"

How to Use Proxy on WSL 2

1. Install cntlm.sudo   apt-get install cntlm 2. Configure the permission for cntlm.conf file. sudo chmod 644 /etc/cntlm.conf 3. Configure proxy settings.  sudo vi /etc/cntlm.conf 4. Make sure the following parameters are configured. Domain XXX Username XXX Proxy 1.2.3.4:5678 NoProxy localhost, 127.0.0., 10. Listen 3128 5. Test connectivity. (Hit enter key if it asks a password) cntlm -M http://www.google.com 6. Generate hashed passwords. cntlm -H 7. Paste the generated passwords to the cntlm configuration file. 8. Configure proxy. export http_proxy=http://localhost:3128/ export https_proxy=http://localhost:3128 9. Start cntlm sudo cntlm -v -c /etc/cntlm.conf