Remove Empty Strings from an Array in JavaScript and TypeScript

Remove empty strings from an array: Command Prompt output of filter(Boolean) and an explicit filter on an array of city names

To remove empty strings from an array, filter them out: values.filter(Boolean) is the short version and values.filter(value => value !== “”) is the explicit one. Both return a new array and leave the original alone. If the array also contains strings that are only spaces or tabs, trim first: values.filter(value => value.trim() !== “”). The … Read more >>

Python compile() Function: A Practical Guide

Python compile() Function

A few years ago, I built a small reporting utility for a sales team in Austin. The team wanted to save simple calculation rules in a configuration file, such as amount * 0.08 for a commission or units * price for a revenue total. Instead of hard-coding every rule, I needed a controlled way to turn those text expressions … Read more >>

Python classmethod() Function: Complete Guide With Examples

Python classmethod() Function

When I build small reporting tools, I often need to create the same kind of object from different inputs. One report may come from a CSV file, another from a dictionary returned by an API, and another from values entered in the terminal. Creating separate setup code outside the class gets messy fast. The Python classmethod() function … Read more >>

Python chr() Function: A Practical Guide With Examples

Python chr() Function

When I build small reporting scripts, I often need to create clean separators, checkmarks, labels, or encoded text without hard-coding every character. That is where the Python chr() function becomes useful. Give it a number, and it returns the matching character. For example, a CSV cleanup script may need to add a tab character between … Read more >>

Python callable() Function: Check Callables with Examples

Python callable() Function

You are building a small reporting script for a Chicago sales team. The script accepts a formatting rule from a settings file, then applies it to each sales record. Before calling that rule, you need to know whether it is actually something Python can run. That is where the callable() function helps. I have used it in … Read more >>

Python bytes() Function: A Practical Guide With Examples

Python bytes() Function

When I build small Python automation scripts, I often need to move data between two very different worlds. One side uses readable text, such as a customer name or a JSON response. The other side expects raw binary data, such as a file, an API request body, or a network message. That is where the … Read more >>

How to Use React Component with Children

React Component with Children

When I build admin portals and employee dashboards, I rarely want every card, panel, or page section to have fixed content. A reusable React component should provide the shared structure while letting each screen place its own headings, tables, forms, or buttons inside it. That is exactly what a React component with children solves. The children prop … Read more >>

React: Cannot Update a Component While Rendering a Different Component

React warning cannot update a component while rendering a different component, shown in the browser with the real console text

React prints this warning when one component changes another component’s state while it is rendering. Depending on your React version the text is either “Cannot update a component (Parent) while rendering a different component (Child)” or the older “Cannot update a component from inside the function body of a different component”. Both mean the same … Read more >>

How to Use react-vertical-timeline-component in React

React vertical timeline component: two timeline cards with blue numbered icons rendered by react-vertical-timeline-component

react-vertical-timeline-component renders a vertical timeline in React: a centre line with cards alternating left and right, each with a date and an icon. You install it, import its stylesheet, and put a <VerticalTimelineElement> inside a <VerticalTimeline> for every event. This guide builds one step by step, with a screenshot of what each version actually renders, … Read more >>

How to Build a JPG to PNG Converter Using Python

How to Build a JPG to PNG Converter Using Python

When I need to convert a batch of JPG images, opening each file and saving it manually quickly becomes repetitive. A small Python application makes this much easier, especially when you need to process several images at once. For this project, I built a JPG to PNG Converter using Python with Streamlit for the interface … Read more >>