instruction
stringlengths
71
95.1k
I am trying to determine the correctness of a helper method within my MaxHeap class. The goal of this helper method is, given the index of any node in the Max Heap, sink it to the correct level in the heap so that all of its children are greater than the node, and its parent is greater (essentially sink it to the corre...
is there a more elegant way to do what the code below does without use "foreach"? I am trying to load answers from questions but only the answers that contains a direct relation with an Appointment public function show(Request $request, Patient $patient) { $user = $request->user(); $appointments = Appointment:...
I found I need to loop through a list to create a brute force algorithm. Therefore, I decided to make a library, but to generalize the result by using a generator. There are three cases which is every single element, every pair of elements, and every triple of elements. The cases store a variable which contains the gen...
I'm doing freeCodeCamp's Coding Interview Prep to improve my JavaScript skills. This challenge is called "Word Frequency", and is based on the Rosetta Code's entry of the same name. The version I'm solving says: Given a text string and an integer n, return the n most common words in the file (and the number of their o...
So I came up with a "new" sorting algorithm: function indexSort(array, min, max) { var newArray = Array.from({length:Math.abs(max-min)}, () => 0); for (let i = 0; i < max; i++) { if (array.includes(array[i])) { newArray[array[i]] = array[i]; } } for (let i = 0; i < newArray.l...
I'm a newbie. I'm at Chapter 4 of Automate the Boring Stuff with Python. Comma Code Say you have a list value like this: spam = ['apples', 'bananas', 'tofu', 'cats'] Write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted befor...
I've a list of strings and a list of regular expressions. I need to categorize each string to get what type of string it is based on regex. This is my code: const caseARegex = /^[\s]*[0-9]{4}[\s]*-[\s]*[0-9]{4}[\s]*$/gi; const caseBRegex = /^[\s]*[0-9]{4}[\s]*-[\s]*$/gi; const caseCRegex_1 = /^[\s]*-[\s]*[0-9]{4}[\s]...
I'm trying to sort a Sector array and a Province array based on the language. sector.ts: export interface Sector { id: string; Label_FR: string; Label_NL: string; } province.ts: export interface Province { id: string; frenchName: string; dutchName: string; } constructor( private readonly...
r←n optimal img;bmp;bin;rgb ;i;p;v;b;euclid;most ;m;⎕IO ⍝ compute optimal palette ⍝ it is recomended using ⍝ a shrinked image ⎕IO←0 r←⍬ ⍝ 12996=114*2=(⌊0.45×255)*2, 0.45 is the threshold constant from the paper. euclid←{∧/12996≤+⌿×⍨r(-⍤1 0⍤¯1)⍥((3⍴256)∘⊤)⍵} most←(((⊢⍳⌈/)⊢/)⌷⊣/){⍺(+/⍵)}⌸ ⍝ 16*3 binning map, ...
This is a finished project where 2 players each roll 2 dice. If the sum of the number that a player has rolled is even, then 10 is added to their score; if the sum of their 2 rolls isn't even then 5 is subtracted from the player's score. If the player's first role = the second roll, then another roll is done and added ...
Intro: I started working three month ago and i have never used JavaScript before, i don't know what is the best practice in JS and i feel like my code can be improved a lot, so i'm here searching for tips and tricks or other infos who can make my code better. Task: Take in input a dictionary with all opening time of a ...
To learn some rust I decided to write a simple calculator. This calculator can take a string in the form of 1+2*3/4-5, and calculate the result. It does so while keeping the order of operations in mind (*/ before +-). I came up with the following: /// Token containing either a number or an operation. Never both. #[deri...
wordList is an array of non-empty strings ("words"). The following code I have written with the purpose of obtaining a Map, containing the unique words and their respective count: for (let p = 0; p < wordList.length; p++) { const word = wordList[p]; if (wordMap.has(word)) { wordMap.set(word, wordMap.get(word) ...
Looking for any suggestions - alternative design, improvements to readability, improvements to the comments, etc. I implemented this letter dictionary to see if it would faster than a regular dictionary in a Trie implementation. Keys into this dictionary must be lowercase letters. LetterDict maintains an integer bitse...
I have a string of Hebrew text which also contains":", "-", & "|". Attempting to replace "-", "|", and ":" with a space. How can I do this efficiently? string my_string = "עַל־פְּנֵי:על־פני|על־פני"; string[] replace_chars = new string[] {":","-","|"}; foreach (string char_change in replace_chars){ if(char_change ==...
I have the following entity, I am getting it in response of REST API. class Account { private String ownerId; private List<String> coOwners; } REST API accepts UUID and returns linked Account. Now my task here is to call this REST API for multiple bank accounts owned by the same person, combine coOwner and own...
This is my first game ever. I' learning C++ now and I decided to make a game. I saw a snake game that works with the draw-input-logic system and I really liked it. I tried to make a tic tac toe game. Please rate it and show me how can I improve it, or give me any other simple game ideas. input: x y; #include <iostream...
I did a lot of research trying to find a React Native component which could reference its own dimensions in order to scale different elements in its style, but could not find any solid examples. I created a hook which boils a component's dimension down to its simplest, easiest to use components and this is what I cooke...
Find shape of n-dim array that'd be formed from nested list of lists with variable lengths if we were to pad the lists to same length at each nest level. E.g. ls = [[1], [2, 3], [4, 5, 6]] # (3, 3) because ls_padded = [[1, 0, 0], [2, 3, 0], [4, 5, 6]] Attempt def find_shape(seq): ...
As part of a larger project, I've written the following code for interacting with git-annex's addurl command in batch mode. addurl takes a series of URLs and output filepaths on stdin, and it outputs a one-line JSON object for each file when that file finishes downloading. git-annex performs the downloads asynchronou...
I started out to learn more about C to learn more about low level programming and hardware and I can improve. It generates a random number between 1 and 4 then stores it into two variables. It takes in to x,y board values ranging to 1,4 in the board then if the two inputs equal the random values it gives a point and re...
So I've created this Header to include in all my PHP files, and think everything works as it should for now. But since it's the first time I'm creating one, I wanted to have it reviewed just to learn from you guys. LocalStorage doesn't work on stackoverflow, so to try this the example code have to be downloaded into yo...
I am coding a Splay Tree class in C++. I am looking for code review. Currently, my Splay Tree class has search and rotate function. I feel that I'm doing things overcomplicated. #include <iostream> #include <string> #include <fstream> #include <regex> using namespace std; class TreeNode { public: int key; Tre...
I have attempted [and made one] function to convert string to integer and catch errors in pure c Working method The whole working method is present in code itself The header file The str2num.h here:- #include<stdio.h> #include<stdlib.h> #include<string.h> int StrNumErr = 0; int str2numErrCheck(){ if(StrNumErr>0){...
Due to recent need I wrote a simple main function that has the goal to convert the C-style strings and arrays into a more STL-style. Then because I also had a need for it, I created a variation that converts all the involved std::strings into std::wstrings. So essentially this is to be seen as two parts: Converting C-...
I'm building a contact manager with Flask for a community group, and I'm working on the function to export contacts as a spreadsheet. I want to export either all contacts, only those who have been assigned to a ticket seller, only those assigned to a specific ticket seller, or those assigned to no ticket seller. The fo...
I have the following code snippet: for index, row in df.iterrows(): if row['MSI Status'] == 'MSS': print(row['Patient ID']) for dirpath, dirnames, filenames in os.walk(path): for dirname in dirnames: joined_path = os.path.join(path, dirname) if ro...
I have this view in SwiftUI; it works as expected, and for the most part, works great. My only concern with it is that it feels extremely clunky. Reading through the view itself is very difficult. Does anyone have recommendations for cleaning this thing up? Effectively, the sign in and register pages both have the same...
Have this code do what I want: If there is argument pass to constructor, initialize; otherwise, set it to default value? class Node { public: Node(string id, bool isNum, int level, string data, bool duplicate, Node *next) : id(id), isNum(isNum), level(level), data(data), duplicate(duplicate), next(next) {...
Here are implementations of both non-const and const view of submatrices, which is a subclass of my toy C++ matrix project: (C++20 : N-dimensional minimal Matrix class) MatrixView.h template <std::semiregular T, std::size_t N, bool Const> class MatrixView final : public MatrixBase<MatrixView<T, N, Const>, T, N> { publi...
Following is bubble sorting code. I tried bubble sort after reading theory. Please let me know if my solution is correct and if so anyway I can make it more efficient? static int[] BubbleSort(int[] arr) { int count = arr.Length; while (count > 0) { int swapC...
I'm learning Dynamic Programming and trying to solve this Target Sum array problem. I've to find an array of integers that sums to a given target sum using the integers of given input array. I've used memoization technique but still getting TLE. Can somebody help what I might be doing wrong. This is my code: #include <...
What do I need help with? I'm doing the challenge below, in which I need to increase code performance. It's currently at 63% and I need to increase it to at least 71% however I can't optimize more than the current one. How can it be optimized? Introduction You are a member of a biotechnology programming team that is r...
I have used below method for throttling which is a Higher Order Function (HOF), but find some difficulties to choose which one is better way to write it. Below are both methods. return of the setTimeout() assigned in a variable const throttle = (fn, delay) => { let timerId; if (timerId) { return; } return...
I have very recently learned some Python and found out about web scraping. This is my first bash at writing some code to get a playlist from a site I had previously been copying and pasting. I would love it if someone could have a look at the code and review it for me. Any advice, tips, suggestions welcome. sample URL ...
I need to classify URLs from a DataFrame and modify it by exact match and contains conditions: class PageClassifier: def __init__(self, contains_pat, match_pat): """ :param match_pat: A dict with exact match patterns in values as lists :type match_pat: dict :param contains_pat: A dic...
Realize the Radio and Channel classes that represent radio and a radio station. The radio class offers an argumentless constructor and the following methods: addChannel: stores and returns a new station, characterized by name, frequency. Attempting to store a station that has the same frequency as an already stored st...
Given the following data struct: typdef struct lista { int num1, num2; struct lista* sig; } nodoNum ; and a declared nodoNum pointer variable, the following function will take said variable and create nodes, link them and stop when the user inputs "0" as the first number and return a pointer to the first node ...
here it is my simple cash register app. It lacks some functionality ( class Payments should have more options like daily statements etc, class TillSettings needs more settings as well) but it does the job. Simple Cash Register and Stock Manager allows to add items to stock and then sell it and register total value of s...
Got this problem in a coding interview - Get the max value of a stack in O(1). The stack contains numbers only. Please review my solution. class Stack { data; maxVal; pop() { return this.data.pop(); } insert(x) { const cm = new CheckMax(); this.data.push(x); this.maxVal = cm.max.c...
Problem definition : Array partition problem Given an array of positive integers, divide it into three disjoint subsets having equal sum. These disjoint sets cover the complete array. Example Input: [7, 6, 1, 7] Output: [[7], [6, 1], [7]] Input: [7, 6, 2, 7] Output: Not possible to partition in three parts Input: [[1, ...
The goal is to have a function that can sort a series of all object types that implement the comparable interface. I'm not trying to improve the performance of the sort. I'm only trying to optimize my use of generics. I currently use T extends whatever and T[], however I was also considering to use T extends whatever a...
The program is supposed to be set as the default browser in Windows and allows me to select which browser profile I want to use when I open a link from another program. I have quite some experience in PHP, Java, C, C++, Pascal, but this is my first venture into Rust. Before I continue adding features I'd like to know h...
Recently, I was studying flask and my friend sent me a bit.ly link. Then the idea of a bit.ly clone struck my mind. This project uses Python - 3.10.0 flask - version 2.0.2 Bootstrap CSS. (I am very bad at CSS) sqlite3 I would appreciate you thoughts and improvements on my implementation. File directory structure - Bi...
Input The first line of input contains a string s: the word misspelled by your partner. Assume that your partner did not add or remove any letters; they only replaced letters with incorrect ones. The next line contains a single positive integer n indicating the number of possible valid words that your partner could ha...
I've created a simple Snakes and Ladders game. The goal is improving my knowledge about OOP.There are some basic rules. I need to be able to move my token. The token starts in the square 1. If the token is on square 1 and is moved by 3 then the token is on square 4. A player can win the game. The first who reaches the...
I have created a simple server that host html that has css. Please make sure if ur testing then change the paths relative to ur system in listhell.c in respond_main(..) function. The html file has to be named as html9.html and css has to be named as style9.css should be path to ../project directory/css directory. this ...
I have a solution to the following question which seems straightforward enough. However, I feel as if I am missing something. The question: Objective: You have given a character ‘A’ which is already printed. You are allowed to perform only 2 operations – Copy All – This operation will copy all the printed characters. P...
Find all subarrays from a given array in the least possible time complexity. Requirement: calculate the square of (sum of even-indexed elements) - (the sum of odd-indexed elements) of al the subarrays. Explanation of above code: I am iterating the array, and inserting all elements of the subarray in the innerList. Then...
this is my first real website I created after learning about web development. It's amazing to me that anyone would spare their free time to code review strangers' code. So thank you in advance. I'd like a general feedback and especially on the caching I implemented. The full Code (with ejs templates and media etc) is o...
I've seen Using asyncio and aiohttp in classes but could not really figure out how to apply this to my own code. The main idea of this code is to inherit from this RESTClient class whenever I build a new API Client. I'll probably improve on this code later to add functions to run multiple requests asynchronously. While...
This is a follow-up question for Calculate distances between two multi-dimensional arrays in Matlab. Given a set SX $$ S_{X} = \{ { X_{1}, X_{2}, X_{3}, \dots, X_{n} } \} $$ where n is the count of elements in set SX (the cardinality of set SX) There are $${{ n }\choose{2}}$$ element-wise distances in set SX. The mean ...
I wrote the following Bash scripts to make pull-mode backups with restic, a backup solution written in Golang, similar to Borg Backup. The main use case for this script is pulling backups into a central backup server that you trust, especially if you don't want to create a shell account or sftp user for every machine y...
I am making a UI library for the fun of it, and decided to use move semantics instead of pointers with new/delete. Everything is working, but I am not satisfied. Given this code: void ControlGroup::AddControl(Control&& control) noexcept { if(control.tabstop) control.taborder = GetMaxTabOrder() + 1; con...
I find myself frequently needing to create a new directory and changing to it enough to want to combine the two commands, so I figured it was a good opportunity to practice scripting with bash. The command I use to create and change to a directory is mkdir -p directory_name && cd directory_name, and that's the command ...
I want to create ENUM which maps different statuses: public enum BusinessCustomersStatus { A("active"), O("onboarding"), NV("not_verified"), private String status; BusinessCustomersStatus(String status) { this.status = status; } public String getStatus() { retu...
I recently came across the OneOf<T0,...,Tn> package from mcintyre321 via a video by Nick Chapsas, which presents the idea of holding exception types to be returned in the same object as would hold a successful result; e.g. public OneOf<User, InvalidEmail, EmailAlreadyExists> CreateUser { /* ... */ } This made me consi...
Created a new typedef and functions supporting it, making it user-friendly [specifically programmer-friendly]. What does the code do? It makes users [programmers] easy to deal with strings as most functions are there. Additionally, we can append, obtain substrings, replace string very very easily Also there is no spec...
So I implemented a program that takes an input file, two command strings and an output file to mimick the behaviour of running : <input cmd1 -option | cmd2 -option > output that's called like this : ./pipe input "cmd1 -opt" "cmd2 -opt" output and I did without using the wait system call since while there are open file...
I'm trying to learn OOP with PHP (I know it's hard because It's not an OOP language). I'm rewriting my procedural code to OOP.Please provide any feedback on my code, naming and file/folder structure. Structure: \classes Procurement.php ProcurementDetails.php \services DatabaseService.php ProcurementService.php ...
I am supposed to write code for an assignment. The goal is to make 2 threads (which are objects of a class that implements runnable) take turns printing the alphabet. One of them prints upper case while the other one prints lower case. (they print only a single letter each turn, not the whole alphabet, just for clarifi...
I play a lot of old-school western CRPGs, and most of them (if not all) require the player to generate an avatar at the start of a new game, including naming the character (with names that will never be pronounced). I want my character to have the most unique and beautiful name, with as few namesakes as possible and ma...
I have solved this problem from the CodeChef platform using the Python prorgamming language Here is the code: test_cases = int(input()) for _ in range(test_cases): n, d, h = [int(x) for x in input().split()] rain_amounts = [int(y) for y in input().split()] red_alert = False water_level = 0 for rain_amount...
How can I shorten my code for this? There are 6 variable sets of numbers, someone picks a number between 1-63, if their number is in a set, you add the first number of the list to the magic number variable. If it is not, you don't add anything, and move to the next set. I have used multiple while loops, but want a more...
I implemented a console version of a news ticker and I will be glad for a code review. It takes a text from the user and displays it for a given period. How may I get it better? #include <algorithm> #include <iostream> #include <cstdlib> #include <thread> #include <chrono> #include <string> int main() { using name...
While on SO someone posted this question and I gave it a quick try. My solution passed all the testcases. Link to the problem: Problem: (A) Mike and palindrome Question: Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one ...
I was trying to implement my own version of matplotlib's hist function and I came up with this: import numpy as np import matplotlib.pyplot as plt import numba as nb from numba import prange import time N = 10_000_000 normal = np.random.standard_normal(N) @nb.jit(parallel=True) def histogram(a, bins = 1000, density=...
I want to be able to create a hierarchy of classes and efficiently lookup them by common class attribute value. So far I've come up with this solution: class IndexedAttr: def __init__(self): self.cls = None self.name = None def find_cls(self, value): cls_by_value = self.cls.__cache__[se...
I've gone through the docs in a fair bit of detail and understand that a setState function can be passed a function if the previous state is needed. Here I am trying to, based on the state of a variable, set the state of another variable. This seems logically correct to me, but just feel weird. Looking for someone to s...
This week I dived into the issue of speeding up my program by either threading or multiprocessing. I did not understand well the difference between the two, but that became quite clear when I got the results. Below program is processing 12 text data files that has a Pandas DataFrame as output. It compares the execution...
Please verify jump searching algorithm that I have written and let me know if any bugs are present. I have tested it from my end, but still would like to get it verified for any missing corner scenarios. class JumpSearch { public static void main(String[] args) { int[] input = new int[] { 0, 1, 1, 2, 3, 5, ...
I am trying to implement a Left shift/ Right Shift on arrays. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { int A[10]; ...
For reasons, I want to implement a predicated version of std::for_each. I know that, in C++20, this is made somewhat redundant or less useful, as we can use std::ranges:views::filter; and that a more robust implementation than the one I present below might use conditional iterators (like Boost has), but - suppose I wan...
I had to implement a function for getting the Levenshtein distance of two strings for a problem. It linked to the Wikipedia Article for Levenshtein distance and mentioned I can use the dynamic programming solution. Following is my implementation. def levenshtein_distance(s, t): m, n = len(s) + 1, len(t) + 1 d =...
I want to create an In Memory Cache in .Net. The primary usage for this cache would be to store addresses... I want to keep around 1000 addresses in memory and once the cache is full, remove the Least Recently Used address from the cache. Microsoft provide 2 versions of MemoryCache, one is implemented in System.Runtime...
I have put together a small node application with Express.js and jsonplaceholder. On the homepage, it displays posts by all users. You can also filter posts by one user (author). In app.js I have: var createError = require('http-errors'); var express = require('express'); var axios = require('axios'); var path = requir...
I'd like to have a review on my C-style array wrapper. I based this on std::array implementation. I hope you can leave some feedback! array.ixx module; #include <cstddef> #include <stdexcept> #include <utility> #include <type_traits> #include <compare> export module array; export namespace stl { template<class T...
I have 3 different lists which I get in 3 separate API calls. persons 2. cars 3. categories What I need to do is: Get persons -> then pull cars ids from the persons list Gel cars based on the cares ids I got on #1 -> then pull categories ids from the cars list Get categories based on categories ids I got on #2 -> th...
I'm learning C++, and would like some guidance. I'm pretty sure I'm doing something wrong. This algorithm runs in O(n) time and uses O(n) external space. Could I make a more efficient algorithm for doing this, time and memory-wise? Also, could I multi-thread this? Here is my code. Ignore my coding style, I like making ...
At heart, this program is just the basic "FizzBuzz" program. However, the program was pushed further, by making it a client-server via Unix Socket: Server run, and listening on a socket. Client run with an argument, a file containing a JSON one query or more. The client opens the file and takes the queries. A typical ...
I got inspired by a recent question to do some benchmarking on the different methods to copy data and this is what I have come up with: #include <iostream> #include <iomanip> #include <chrono> #include <vector> #include <cstring> class TimedTest { public: TimedTest(const std::string& name) : name{ name }, ...
I'm writing a function which iterate through a list of objects and should return: true if all the items have the attributes (cp and type). false if all the items haven't the attributes (cp and type). throw an error if one of the attribute is missed in the object. const checkList = (list) => { if (list && !list.leng...
I want to learn about performance impact of different calculations and influences/optimizations like compiler flags, use of SSE, AVX etc. I'm going to code some small subroutines which will take place in almost every arithmetic operation in a special program, thus good code, portability and performance do! matter. Inso...
This is for leetcode problem: https://leetcode.com/problems/majority-element There is something wrong with the way I create solutions, and not sure how to stop doing it. Basically the problem is I always create a count variable. Here is it called greatest_count. For the if statement, I create a conditional, which I thi...
I'm trying to write a program whose input is an array of integers, and its size. This code has to delete each element which is smaller than the element to the left. We want to find number of times that we can process the array this way, until we can no longer delete any more elements. The contents of the array after we...
I was working on First Unique Character in a String Question Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode" Output: 0 Example 2: Input: s = "loveleetcode" Output: 2 Example 3: Input: s = "aabb" Output: -1 My Solut...
This is my implementation of the Pig Latin recommended exercise in The Rust Programming Language book. Any pointers on making this code more idiomatic or run more optimal? fn pig_latin() { let s = String::from("Some abobus string 32 text привет абоба 123"); let mut new_s = s.clone(); let consonant = Vec::f...
I consistently have code where I need to pull individual chunks of substrings out of a larger string; while I won't get into details, it's easy to replicate in a proof of concept: var data = "alja5nerjvnalskjnbaeviunreklvnaslidhfvbaelkjnrfvliasndve"; var open = data.Substring(0, 4); var inputLength = int.Parse(data.Sub...
For a particular problem, I need to have a list that: supports O(1) prepend, and that I can call bisect.bisect_left on, which means the list must be sorted. Prepending to a list via list.insert(0, item) is O(N); however, O(1) prepend can be emulated by maintaining the list in reverse order in which case list.append e...
This is a follow-up on my first question, Little program to measure costly operations, thanks for all answers and comments, esp. @JDługosz. I made a second attempt adapting a teaching program I found on the web. It already helps me to 'get a handle' on things normally hidden, e.g. i can see the effort for 'POW' compare...
the last couple of weeks i have been working on my own WordPress plugin. I am trying to do a class based codebase. My plugin works correctly, but i don't really know if this is the correct way to develop. I would like to learn the best practices. To demonstrate, here is my base plugin file: <?php /** * Blub Hamerhaa...
I have been working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twitter Bootstrap 4. The latest feature added is lazy loading of posts. From the Static_model (application\models\Static_model.php), which is responsible with the general settings, I can set $data['is_ajax_loading'] to true and e...
Problem description As the title indicates, I want to be able to write to and read from a binary file safely, in the sense that I want to have full control of everything that might go wrong. Since I am somewhat unfamiliar with all the flags of the ofstream class and not sure how to use them, I wrote the following code ...
This is a Python program that finds all possible ways a positive integer num can be expressed a sum of a number of integers between 1 and lim (including both ends). There is no limit on the number of integers, duplicates are allowed, same elements in different order is considered different. The output is a nested dicti...
I need to implement in Python the formula in the image. The set B is a set of real numbers \$-1 \le t \le 1\$. Also, \$\mathbb{F}_2\$ is a set with the elements 0 and 1. \$y_i\$ is the \$i\$-th element of \$y\$. This formula is part of an iterative part of my program. The number of iterations is about 10K (over x) and ...
I used recursion to generate fractal and got the desired result but I think my code can be better I started using MATLAB a few days ago and since than trying and learning new things. Now this code generates the fractal exactly as I wanted but I feel like it can a little bit neater. Any suggestions are welcome (even off...
So I've decided to practice I will turn all my scripts etc into GUI apps. So my 36 loc guess the number game turned into 136 loc. It's not the best looking, but it does work and on hard it's actually hard to beat computer sometimes. What are your thoughts guys? After finishing it I am not sure if my approach was right....
I was struggling to make the RadioButtons widget look presentable. Either the circles were not round, or the frame had a totally wrong shape, or both (see pictures below, and also this question on SO). So I had created a function that draws a reasonably good-looking one. It works (I have tested for the different number...
I would like to optimize the way that I save files. Each second I save lots of strings in different files. What I want to do is bunch up these IO tasks so they happen in bursts, instead of spread out randomly. I want to write files, but without performing too many IO operations at the same time, so I don't put the disk...
I am reinventing the wheel to write a function that serializes a (nested) data structure human readably. The default output is deliberately similar to that of json.dumps(var, indent=4), and I did my best to mimic the format of jsons output. But the output is fundamentally different from json. More specifically, the dat...