Category Archives: Uncategorized

Handling Warnings in an API

Recently, I was trying to find a way to handle warnings for an API.

Here was ChatGPT’s response:

To handle warnings for an API action that partially completed successfully, you can design the JSON response in a way that includes both success status and warning messages. Here’s a possible structure for the JSON response:

{
  "success": true,
  "message": "Event time adjusted successfully.",
  "warnings": [
    "Google Calendar sync failed. Please check your Google Calendar integration."
  ]
}

Let’s break down the response components:

  1. "success" (boolean): This field indicates whether the primary action (adjusting the time of the event in your scheduling system) was successful. If this value is true, it means the event was successfully moved in your system.
  2. "message" (string): This field provides a general success message describing the outcome of the primary action. In this case, it confirms that the event time was adjusted successfully.
  3. "warnings" (array of strings): This field contains warning messages to inform the user about any issues that occurred during secondary actions (e.g., the API call to sync with Google Calendar). If there are no warnings, this array can be empty. In the example above, we have a warning message related to the Google Calendar sync failure.

In your JavaScript code, when you receive the API response, you can check the "success" field first. If it’s true, you can display the "message" to inform the user that the event time has been adjusted successfully. Then, you can check if the "warnings" array is not empty. If there are warning messages present, you can display them to the user as well, alerting them about any secondary actions that might have failed.

Here’s an example of how you might handle the JSON response in JavaScript:

// Assuming you have received the API response as 'apiResponse' variable
if (apiResponse.success) {
  // Display success message to the user
  console.log(apiResponse.message);

  if (apiResponse.warnings.length > 0) {
    // Display warning messages to the user
    console.warn("Warnings:");
    apiResponse.warnings.forEach((warning) => {
      console.warn(warning);
    });
  }
} else {
  // Handle API failure here, if necessary
  console.error("API call failed:", apiResponse.message);
}

This way, you inform the user about the successful adjustment of the event in your system and any potential warnings related to the synchronization with external services like Google Calendar.

https://chat.openai.com/share/bd4ff3d8-f366-4645-a781-f488ad2e02fa

Text From Your PC – Your Phone App for Windows 10 – October 2018 Update

While Microsoft is still in the process of fixing their October 2018 update, I managed to download it before they pulled it. I did not encounter any issues with the installation process, nor did I lose any files.

Included in the latest update is the Your Phone app. This app lets a user view photos from their phone, as well as send and receive texts from your phone on Windows. While there are apps that already have this functionality, most you either need to pay for, or have ads. I have used MightyText for a few years, but recently it has become more restrictive. You used to be able to send 250 texts a month for free, but now just 125. Windows does not enforce such a limitation.

Setting up the app was easy. I had to download the Your Phone Companion app on my Android device. After signing into my Microsoft account on both my phone and the Your Phone app, I was good to go.

The downside with the Your Phone app is that it currently only syncs if the PC and phone are on the same network. The app is still in its early stages. I sometimes can’t connect to the phone at all, even when both are on the same network. But when it works, it works great. Windows-style notifications show you when a new text comes in. Contact names are synced as well; however, contact photos are not. MMS messages also don’t sync yet.

The Photos functionality in the Your Phone app is also limited. It currently only shows the last 25 photos you’ve taken/downloaded on your phone. This could be useful if you need to take a photo of something and transfer it to your computer quickly for work purposes or whatever. But it won’t be useful if you want to back up the photos on your phone. (For that, I recommend Google Photos). It would be nice to see access to all my photos.

That’s all for now. I figured I should write a blog post, since I haven’t done any since 2016!

How to Chat on Facebook Without Using the Messenger App

It’s been in the news lately. If you want to chat with someone on Facebook on mobile, you’ll soon be required to use the Messenger app. A few years ago, Facebook removed the ability to chat with your friends through the Facebook app, but retained the ability to chat with friends through its mobile web app. Now, they plan to remove the ability to chat from the web app as well. A lot of people are furious over Facebook’s decision for various reasons: having to download a separate app, the many permissions the app requests, et cetera.

But going forward, there is a way that people can still access there messages on mobile without the Messenger app. Go to the App Store/Play Store on your device and download Opera Mini.

Opera Mini is a data savings app. It runs a different version of Facebook

A version of Facebook which still has access to messages, with no indication that it is going to be taken away.

Sure, you are still downloading a separate app, but this one does not require as nearly as many permissions as Facebook’s Messenger, plus it saves you tons of data.

I’ve saved 72% in data savings. A normal browser would have used 900 MB in the lifetime I’ve had Opera Mini installed. Opera Mini has used 259 MB in comparison.

Facebook Posting Without Your Knowledge? Try This!

For those of you having issues with your Facebook posting things you didn’t, and you use Facebook on a computer, I would advise you to run Avast Browser Clean-Up on your computer. It will scan for any add-ons in your browser(s) that could be using Facebook without your permission and remove them.

These unsolicited postings could also be caused by apps you’ve authorized on Facebook that you don’t use anymore or had a malicious intent when you signed into an app/website with Facebook. Go to your Facebook Settings > Apps and remove any Facebook applications you don’t use anymore, specifically those that have the ability to post content on your behalf, as those ones can like posts on your behalf.

A third culprit is websites that ask you to push the like button in order to see a video/content. In this case, pressing the like button could like something else instead on Facebook.

Also, it’s recommended that you change your Facebook password regularly. Use unique passwords for each website you login to. That way, if one website is hacked, and hackers are able to decrypt your password, they won’t be able to use it on any other site.

Stay safe out there.

Can’t Connect to Public WiFi? Try This

If you are ever in a restaurant that offers free WiFi, but it seems to not be working, it’s because you need to sign in to the network. The method to do this, though, is where many people get confused. Many people assume that if the WiFi icon says it is connected, then it should work. However, that is not the case. You usually have to agree to the terms and conditions of the free WiFi, which are automatically presented when you go to a non-HTTPS* website (see below for an explanation). So open your web browser and go to aw.ca. Any website will do as long as it does not use HTTPS. I use aw.ca because it is short and simple. The internal WiFi system will then redirect you to a webpage that usually has a check box and a button to agree to the terms and conditions and then connect.

HTTPS explanation: Simply trying to Google search for anything won’t get you online. Google uses HTTPS. The reason you won’t get online is the request to redirect the website is blocked because of the S in HTTPS, which stands for secure. It ensures the website you are visiting is encrypted so that all data is secure while in transit. You wouldn’t want to go to Facebook and have the system redirect you to a fake Facebook login page? Therefore, you must go to a website which does not use HTTPS. Then the system will be able to redirect your request and present you with the login page.

Some phones will automatically detect that you need to sign in to the network to use it. In that case, simply select the “Sign into network” in your notifications and accept the terms and conditions from there.

No Free Money for You…

Facebook Founder Mark Zuckerberg is not giving out $4.5 million dollars to lucky participants who repost the following message:

Mark Zuckerberg has announced that he is giving away $45 billion of Facebook stock. What you may not have heard is that he plans to give 10% of it away to people like YOU and ME! All you have to do is copy and paste this message into a post IMMEDIATELY. At midnight PST, Facebook will search through the day’s posts and award 1000 people with $4.5 million EACH as a way of saying thank you for making Facebook such a powerful vehicle for connection.
The message has been circulating for a few days. Mark is never going to give away his money to you. Stop spamming my feed. Thanks.

The Google Now Launcher – Updated and Revisited

This afternoon, I was on my Nexus 5, and noticed Google has made some changes to its launcher, the default on its Nexus line of phones. This update primarily features updates to the way the app drawer functions. Instead of cards that scroll horizontally, Google has opted to organize the apps in a vertical list, as seen below.

This version of the launcher has some new features. The app drawer now has a favorites bar, where common apps appear. I have not found a way to customize it yet, though it appears to have a limit of 4 icons. A dedicated app search bar has also been added. Though searches for apps before though Google’s main search bar, this one is much quicker at finding the specific app one is looking for. Holding down the app drawer icon will cause the search bar to be automatically opened, and the keyboard will pop up, allowing for a quick search to find the app one wishes to open.

Searching is easier in the new launcher.

Many people have complained about the way Google updated this app. Many do not like the scrolling list, as compared to the horizontal card option. However, third-party launchers, such as Nova Launcher, allow users to customize their app drawers, even organizing apps into folders. I have used custom launchers before, and many of them have many different options, but switching to a different launcher would mean losing certain abilities of Google’s launcher, such as the ability to say “Ok Google!” from any screen to start a search, the Google Now cards, and other Google-related features.