I wanted a way to generate an automatic but unique code or password without it being easily back-traceable and collision-proof. i.e. each time it is executed, it must generate a unique universal ID, aka UUID. Additionally, that code or password must be 8 characters long and must contain a combination of letters and numbers and […]
Tag: coding
Saving output from Turtle as an image (Python)
Saving output from the turtle module in Python involves a few unique steps compared to other libraries. The turtle module primarily uses the Tkinter canvas to render graphics, and saving these drawings typically requires converting the canvas to a PostScript file using the postscript() method. This file can then be converted to more common image […]
Given 4 numbers and a resulting number, create the equation to solve
You’re given four numbers and a result. You are supposed to create an equation with those four numbers that yield that given/desired result. Easy enough. Yeah, right! That’s the kind of puzzles some newspapers are running to challenge the readers as in Epoch Times et al. This is commonly referred to as the 4Numbers game. […]
Customizing Windows desktop wallpaper automatically, on schedule (Python)
With a little programming know-how, you can write your own dynamic Windows wallpaper app that can change its color to whatever color you want, to a random color that your app chose for you for the day, or set to your photos, images on a rotating basis or randomly picked from a list from your […]
How to convert a standard date format <-> Excel date serial number
You may already know that all date type values in Excel are converted to a serial number in Excel. This is an effective way to store date because not only do the digits take less space, it can be calculated upon for all sorts of date maths such as finding difference in days, months, years, […]
Division, Floor Division (Python)
In Python, the single forward slash ‘/’ performs a floating-point division unless you’re using Python 2.x,in which case it performs an integer division with integer operands. The double forward slash //, on the other hand, forces a floor division operator which performs an integer division and returnsthe largest integer less than or equal to the […]
How to parse json data from a restaurant
In this blog post, I’ll show you a real-life example of a restaurant menu encoded as a JSON file and how you can parse in your app, and subsequently display it in your custom UI as desired. Suppose you have a menu of items with details encoded in JSON format that looks like this: This […]
Sorting, grouping, defragging…a visual working demo
Watching a sorting, grouping, or just a defragmentation process graphically is both educational and curiously satisfying. So, I created a Python script that sorts a set of randomly placed, randomly colored, ungrouped tiles on a board by colors so that all like-colored tiles are placed consecutively, adjacently. Think of it like the good old Windows […]
Data cleansing challenge: non-ASCII characters
Non-ASCII characters can pose challenges in data cleansing for several reasons: Therefore, it’s a good practice to standardize or normalize text data to ASCII when possible, or ensure correct handling of non-ASCII characters. This helps to maintain data integrity and simplifies subsequent data processing tasks. Superscripts, subscripts, or “special” characters often look like ascii characters […]
Comparing and merging lists in Excel, Python
Identifying anomalies, duplicates, and updating data necessitates comparing information from various sources. Accurate execution of these tasks is crucial, whether working solely with spreadsheets or using a mix of tools and languages like databases and web services. In this post, I will demonstrate various methods for comparing lists of identical or differing sizes across different […]