Programming Challenge: Array and Loop Manipulation (Intermediate)

This image is an illustration featuring a stylized scene with a central magnifying glass focused on a number 5 on a cube. The magnifying glass has a classic design with a blue tinted glass and a beige handle. Surrounding the magnifying glass are multiple cubes with numbers and mathematical symbols on their faces. The cubes have different numerical values such as 3, 4, 5, 6, 7, and 8, with mathematical operations next to them like "+4," "-2," "x4," and "?". Arrows around the cubes suggest movement or rearrangement, implying a dynamic or interactive aspect to the puzzle-like setting. The overall color scheme is warm with a monochromatic tan background that complements the blue and white of the cubes. The image could be interpreted as a metaphor for problem-solving, analysis, or mathematics, as it appears to represent a numerical puzzle or game being examined or solved.

Challenge Description:

You are provided with a list of n non-negative integers. Your task is to write a program that performs the following operations:

  1. Query Mode:
    • The program should first ask the user if they want to perform queries or updates: Enter 'Q' for query and 'U' for update.
    • If the user enters Q, prompt them to enter a range [l, r] (1-based index) and then output the sum of elements from index l to r inclusive.
  2. Update Mode:
    • If the user enters U, prompt them to enter an index i (1-based index) and a value v. Update the element at index i by adding v to it (this is an increment operation, not set).
    • After each update, print the new full array.

The challenge is designed to teach basic array manipulations and looping constructs, with a focus on handling user inputs and performing range queries and updates efficiently.

Continue reading “Programming Challenge: Array and Loop Manipulation (Intermediate)”

Toronto’s Lane Filtering Proposal: Where Do We Stand?

A dynamic daytime traffic scene on a multi-lane highway, viewed from behind a motorcyclist engaged in lane splitting. The motorcyclist, in clear focus, wears a black helmet, black jacket, white gloves, and light-colored pants, navigating skillfully between lanes. Surrounding vehicles include a mix of cars and a pickup truck, with urban buildings and a clear blue sky in the background, capturing the essence of rush-hour congestion.

In 2018, Toronto toyed with a concept that sparked interest among motorcyclists and raised eyebrows among the city’s drivers: lane filtering. This maneuver, which allows motorcyclists to weave between lanes of stopped or slow-moving traffic, promised a smoother ride for two-wheelers and posed questions about road safety and traffic flow. Fast forward to today, and many are left wondering, what ever happened to that proposal? Let’s revisit the facts and ponder the current state of lane filtering in Toronto.

Continue reading “Toronto’s Lane Filtering Proposal: Where Do We Stand?”

🌿 Ethical Wildlife Photography: A Guide 📸

This is a vibrant and fantastical illustration showing a photographer, kneeling with their camera on a tripod, capturing the serene beauty of an enchanted forest. The scene is drenched in sunlight filtering through the canopy, illuminating an array of flora and fauna. Several species of animals are depicted in harmony, including deer, rabbits, foxes, hedgehogs, and various birds, some in flight and others perched by the water. The flowing creek adds a sense of tranquility, with fish visible beneath the surface. This magical setting is bursting with color, from the lush green trees to the richly colored flowers and moss-covered stones. Butterflies flit in the air, adding to the fairytale ambiance. The composition invokes a sense of wonder and the richness of untouched nature through ethical photography.

The Ontario Parks blog post discusses the importance of ethical wildlife photography, highlighting seven common issues photographers should avoid, such as baiting wildlife, trampling off-trail, damaging habitats, introducing non-native species, unsafe roadside manners, following wildlife too closely, and using recordings to attract animals. It emphasizes respect for nature and the need to minimize impact while capturing the beauty of wildlife and landscapes, encouraging photographers to practice responsible behavior to protect the environment and its inhabitants.

Read more here.

US Sues Apple in Landmark iPhone Monopoly Lawsuit

The Department of Justice (DOJ), supported by 15 states and the District of Columbia, has filed a lawsuit against Apple in the U.S. District Court for the District of New Jersey, accusing the tech giant of monopolistic practices in violation of Section 2 of the Sherman Antitrust Act. The lawsuit highlights Apple’s dominance in the U.S. smartphone market, where it holds over 65% of the total market and more than 70% of the performance smartphone segment. It attributes Apple’s significant net income, which surpasses the GDP of over 100 countries, largely to the success of its iPhone product line.

Continue reading “US Sues Apple in Landmark iPhone Monopoly Lawsuit”

OTF Rejects Request from Ontario to Let Retired Teachers Work More

Key Takeaway

Ontario’s teachers unions have rejected a request from the Ministry of Education to extend the working period for retired teachers, emphasizing the need for the government to address staffing shortages more effectively.

Continue reading “OTF Rejects Request from Ontario to Let Retired Teachers Work More”

New Custom GPT: Find Keywords – A Powerful Tool for Content Analysis

New Custom GPT: Find Keywords

I’ve created a new Custom GPT that will reduce text to just the keywords. The GPT is named Find Keywords and can be found at https://chat.openai.com/g/g-mL985wIE7-find-keywords.

Note that it requires a subscription to ChatGPT Plus. Unfortunately, OpenAI does not offer trial subscriptions, and subscriptions cost $20 USD per month. Personally, I find the subscription well worth it for both personal programming projects and for personal productivity.

Continue reading “New Custom GPT: Find Keywords – A Powerful Tool for Content Analysis”

Google Gemini vs ChatGPT: Generating Alt-Text. Who Wins?

An illustrative comparison between Google Gemini and ChatGPT for generating alt-text, depicted through a split design. On the left, Google Gemini is symbolized by futuristic, abstract shapes in blues and greens, embodying innovation and digital intelligence. On the right, ChatGPT is represented through a network of interconnected nodes and lines in warm orange and red tones, highlighting advanced AI technology and communication. A bold 'VS' symbol in the center accentuates the competitive analysis between the two technologies, against a backdrop that merges both designs, suggesting a blend of competition and collaboration in the field of alt-text generation.

Introduction

I’m currently subscribing to ChatGPT and Google Gemini to test them both out. One of the tasks I often use chatbots for is creating alt-text for my images.

For the importance of using alt-text in your images, see this post.

The prompt given to Gemini and ChatGPT was: ‘Alt text for this image‘.

Here is the image I used. Note that it includes text instructions and images.

Continue reading “Google Gemini vs ChatGPT: Generating Alt-Text. Who Wins?”