instruction stringlengths 71 95.1k |
|---|
I have multiple ranges and want to find out which range should the number fit between. The ranges are continous within a finited range. Is there any faster way to implement the below algorithm?
def range_checker(x: float) -> str:
for i in range(len(range_list) - 1):
if range_list[i] <= x < range_list[i + 1]... |
So I have this helper script that I use to move points around manually while debugging:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class MovablePoints : MonoBehaviour
{
public List<Vector2> points = new List<Vector2>();
public List<int> moveablePoints = ne... |
Edited: incorporated some feedback and added a lot of features
I've written a basic Doubly Linked List Class where every insertion into the class should be sorted into ascending order. The project will eventually merge two LinkedLists so the prev pointers to the Nodes will assist with that.
For now, I was looking for f... |
The following code tries to emulates a real employee/company relationship. I would like to recieve feedback on:
Any bad coding practices or code smells
Design in terms of practicality, effeciency, and ability to expand upon code
class Company():
def __init__(self, name, minimum_hiring_grades, required_work_experi... |
I have this code that uses loops and random generators to create a random list of values (operators, strings, integers, floats, and new lines) and a corresponding list of the correct tokens to test a lexer I have made. Currently it is estimated to take 1:50 (1 hour 50 mins) to create 1 billion tokens, but I am wonderin... |
Implementation of the Reservoir sampling algorithm A-ExpJ that allows sampling K random elements from a stream of elements according to their weights when we don't know the size of the stream in advance and don't have the memory to store all the elements of the stream.
Description of the algorithm: https://en.wikipedia... |
I implemented a generic insertion sort routine that can sort an array of any type. It's similar to the qsort function from the standard library. My goal it to optimize the code for readability above everything else, so I would appreciate any feedback.
void isort(void *base, size_t nmemb, size_t size, int (*compar)(cons... |
The following is a daytime client written in C that uses Tor to connect to a given daytime server. It assumes a Tor daemon is running on the system and that Tor can be reached via a specified UNIX domain socket. This uses the SOCKS5 protocol to talk to Tor, and then uses the daytime protocol to display the current date... |
First time doing program documentation, how is it? Any thing that was done good or poorly? What can I work on to make it better if need be?
/** primary class for MultiplicationTable */
public class MultiplicationTable {
/** This method is used to execute the program */
public static void main(String[] args) {
/**... |
I need to recreate project folders containing all article numbers acquired from a list.
It's searching for article names in the foldernames and inside the folders.
If the directory is found, it will copy the whole dir.
If a file matching the article is found, it will copy the parent dir.
Output:
Input the project name:... |
This code is about Lexicographic Ordering algorithms and its works but how can i change the style of the code to professional coding style?
from typing import List
def swap(_list: List, index1: int, index2: int):
_list[index1], _list[index2] = _list[index2], _list[index1]
return _list
def l... |
Review
I have written my own implementation of Array in JavaScript with the basic functionalities. Can anyone please review this code and point out the mistakes/how to make the implementation better?
Optimisation
The insert(item, index) function will insert an item in the array at the index index and shift every elemen... |
The project outline:
Write a program that goes to a photo-sharing site like Flickr or
Imgur, searches for a category of photos, and then downloads all the
resulting images. You could write a program that works with any photo
site that has a search feature.
My solution:
import sys, requests, os, bs4, time
from seleniu... |
I'm trying to refresh my very rusty SQL skills.
I have a table with device logs, collected every 5 minutes. I'm interested in counting the number of times a device is either 'connected' or 'disconnected' per device, per day.
deviceId, status, tag, timestamp
A, Connected, connectivity, 2022-10-27T09:25:02Z
B, ... |
I made this algorithm to compute Euler's totient function for large numbers. A sieve is used.
#include <iostream>
#include <cstdint>
#include <vector>
typedef uint64_t integer;
integer euler_totient(integer n) {
integer L1_CACHE = 32768;
integer phi_n=0;
if (n>0) {
phi_n++;
integer ... |
As you will probably notice very quickly from the code below, I'm not very experienced coder. Below is my attempt at valuating poker hands in Python. The code below may not be pretty but it seems to be doing the job. And it seems to be quick enough to evaluate ranges on flop and turn. The output allows for easy compari... |
I am new to R and to learn I start to code to do things that interest me. I have a biological background and I am very interested in bioinformatics.
I know some python, but I want to use R as tool to apply some statistical analysis, once R is build in that thinking.
K-mer are substrings/words counted in a slide window ... |
I made a function that turns all child from a JSON file to parents (or brothers?). It adds the parent name to the key, so there are no duplicates.
It works ok, but I would like to ask if there are better ways to do this, in a logic, pythonic and even syntaxic way. I feel I am stuck with if-else logic.
Thank you!
I have... |
The project outline:
2048 is a simple game where you combine tiles by sliding them up,
down, left, or right with the arrow keys. You can actually get a
fairly high score by repeatedly sliding in an up, right, down, and
left pattern over and over again. Write a program that will open the
game at https://gabrielecirulli... |
I am working on a web page where I am creating a JS object using {} and []. This object is passed into a handler. I wanted to see if there is a better way to create the object in JavaScript
My logic
Is to build the object is JS and then pass it into the Handler to be Deserialize and then saved into the db.
Can anyone p... |
I can define an interval with start and end in the format YYMMDD, but they can also be partial/periodic - meaning some elements (day, month or year) can be left blank.
For example, start = " 1115" and end = " 0115" the interval is 15th nov to 15th jan every year.
I want to check if a non-partial date is in the interv... |
Note - I posted updated code; see version 2 of this question.
I'm writing something like the Unity's shader graph and I'm kinda stuck on a property panel.
I add a float property, which name is Float, and then I add a second float property, which also is named Float (until I rename it). I'd like the second property name... |
So this is my first ever attempt so it's obviously bad. There has to be a better way to do this. A big thing I haven't implemented is trying to guarantee the structure of the input(i.e making sure date is input as mm/dd/yyyy and not just something like 1/1/1), so would like feedback on that. But other than that I just ... |
The code below is a sender/receiver setup in C++ where the sender is in one thread, the receiver is in another, and the data being sent/received is "shared" (global). The code uses the <thread> header, std::unique_lock, and std::condition_variable.
I would love a critique on everything below ConditionVariable.notify_on... |
I just learned programming and decided to copy projects in big book of python but in c++ and completed the first project. I would like to know your opinions and how can it be improved! Thanks in advance.
int getSecretNumber();
void getClues(int n, int m);
bool gameLoop{true};
int secretNum {getSecretNumber()};
int mai... |
If i can get a some reviews and suggestion on the code it would be highly appreciated.
( Please check the flowchart i've created first https://github.com/chetinn/Memory-Map-JS/blob/main/Memory%20Map%20User%20Story%20Flowchart.pdf )
It's also my first year in front end development
here's the netlify link for preview
htt... |
While introducing nullable reference types to our enterprise application's codebase, I found that we are often using LINQ on sequences of nullable reference types where we filter out the nulls using .Where(item => item is not null). The compiler does not see that the resulting sequence should not have nullable items an... |
As we know there is no standard way in compilers to standardize macros with compilers and different operating systems
So I created this library that contains standardized compiler, os, attributes macros and more.
Github Repository
Contents :
Architecture
This section contains some macros that can detect more than 20... |
I am writing some C++ code to interact with an external scripting language. I want to be able to register arbitrary C++ callable code as functions to be called from the script.
The scripting library offers an API to register function pointers with signature
std::string callback( std::vector<std::string> const& args);
... |
I am trying to build an abstraction that forces lock acquisition before data can be accessed.
This seems to work, but please tell me if what I am doing horribly wrong, and what I could improve.
I am using C++14 hence shared_timed_mutex
#include <mutex>
#include <shared_mutex>
template <class T>
class rw_locked
{
publ... |
The challenge is as follows:
"Julia conducted a 15 days of learning SQL contest. The start date of the contest was March 01, 2016 and the end date was March 15, 2016.
Write a query to print total number of unique hackers who made at least one submission each day (starting on the first day of the contest), and find the ... |
Preface: Before anyone suggest using pandas, no I don't want to use pandas, only pure python please.
The concept of my code is quite simple, given some list of strings in a text file formatted as such (all the same size):
#sample_test.txt
------dooadb-----
asdoutdocnbmasdgd
--sdfhteoadb-----
-----asdfhwi-----
----ssdwe... |
Goal:
Iterate through 100+ text files, parse for specific types of rows, return the row length for the desired row ONCE. Once, because these files have about 5-6 different types of rows with varying lengths but the same type of row will have the exact length. So, once the program has found a desired row, return the row... |
After inspecting fzf/shell/key-bindings.bash I came up with the following, to be put in my ~/.bashrc:
fzf_get_env_vars() {
local cmd opts selected
cmd='command env | command sed "s/=.*//;s/^/$/"'
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS -m"
selecte... |
I am fairly new to Rust and thought a good way to practice would be to write a multithreaded segmented Sieve of Eratosthenes. It performs ok (searches ten-billion numbers in about 11 seconds on my system, I tried one-hundred-billion but it couldn't allocate enough memory). I was just wondering if there was any clear im... |
The code snippet works perfectly fine, but someone said, and I quote, "this is some of the weirdest code i've seen", so I'd just like any advice for it. It's supposed to count the amount of times I click my left mouse button.
Is there anyway to make it more concise?
from pynput.mouse import Listener
import logging
log... |
i'm trying to find the winner of a 3x3 TicTacToe game. I user input N which is number of moves, and then N moves like (1,0), (0,2), etc. (X strats the game). At the end of the game the program should return who wins the game (X or 0) or "draw" if there is no winner. I have the following code:
namespace ConsoleApp20;
pu... |
I'm working my way through the finger exercises in John Guttag's book Introduction to Python Programming, third edition. The following finger exercise on page 143 describes encryption/decryption with a book cipher. The first exercise was to implement decoder and decrypt in the same style as encryption is working.
The b... |
Good afternoon, a few days ago I finished a personal project of a 7x10 led matrix programmed with the ATMEGA328p microcontroller. To control the matrix I use 2 74HC595 shift registers in cascade in the 10 columns and a CD4017 decade counter in the 7 rows. The 8 rows of the LED matrix are independently connected to a 2N... |
This provides custom classes to work with Outlook 2016's email security settings in trust center. Included are some top level functions to list outlook profiles, retrieve the data from a given profile, and to set data into the correct registry key.
This code works as-is but I have some comments for parts that I think c... |
I wrote a simple C++20 circular queue.
https://github.com/torrentg/cqueue
Here is cqueue.hpp
#pragma once
#include <memory>
#include <utility>
#include <concepts>
#include <algorithm>
#include <stdexcept>
namespace gto {
/**
* @brief Circular queue.
* @details Iterators are invalidated by: push(), push_front(), em... |
My code is about sending random poem from /etc/poem.conf to client using TCP sockets.
In this implementation my daemon have restart mechanism using SIGHUP signal and DEBUG mechanism using defining DEBUG macro during compilation.
My goals:
Simpler code
Less code
Cleaner code
#include <stdio.h>
#include <stdlib.h>
#inc... |
from itertools import combinations
for comb in combinations(range(1, 70), 5):
for PB in combinations(range(1, 27), 1):
if PB[0] in range(1, 27):
a = open(f"PowerBall{PB[0]}.txt", "a")
a.write(str(comb + PB))
a.write("\n")
print("\r", f"on: {comb + PB}", end="... |
I'm making a down payment form where the user enters a purchase price and can then enter the amount they want to pay as a down payment as either a dollar amount, a percent down or by using a range slider. Modifying one field will modify the others as they type.
// $ Down and % Down are readonly until purchase price e... |
I followed this algorithm to find strongly connected graph components in C and this code works (I think ... maybe there are bugs I am not aware of). I am wondering can I please get some feedback? thank you
scc.c
/**
* Kosaraju's algorithm implementation which is a linear time algorithm
* to find the strongly connecte... |
Here is a working support ticket bot for discord using discord.py api. There is a slash command to launch the system which brings up a button to submit a ticket which when clicked creates a new text channel where only the ticket creator and the admins have access. also, upon creation of the ticket(channel) a notificati... |
This function takes inputs from multiple different controls on a form, and maps them to values in a data accumulation class. This code was written specifically to keep logic, data, and display separated. I ended up at the time using reflection to take the values from the controls and mapping them to variables with th... |
Problem
I have a list of around ~1000 honorifics, see below for a sample.
Given an input string of a name, for example "her majesty queen elizabeth windsor", the function should return "elizabeth windsor". If there is no honorific present at the start of the name (to simplify the problem), the function should simple re... |
The project outline:
Write a program that, given the URL of a web page, will attempt to
download every linked page on the page. The program should flag any
pages that have a 404 “Not Found” status code and print them out as
broken links.
My solution:
# Usage: python link_verification.py "webpage to search"
import s... |
I just recently started learning how to program and how to use python and after watching a few courses I made a simple Rock paper scissors game where basically the script randomly chooses Rock, paper or scissors then you make your choice and depending on what the program picked and what you picked you either win, lose ... |
Let's say you have a simple pure function that applies a discount of 30% if the total price of a list of Items is over 30.00 (let's not delve into the fact that I'm using a Float to indicate the price):
promoGet30PercentOff :: [Item] -> Float
promoGet30PercentOff xs
| total > 30.0 = total * 0.7
| otherwise = tot... |
This is a real problem I had to fix recently. Imagine having generic array where you can have duplicate columns and rows.
You want to remove those duplicates as long as they are next to each other.
inline fun <reified T : Any?> Array<Array<T>>.toSimplified(): Array<Array<T>> {
return simplifyColumns().simplifyRows(... |
I have to identify added and deleted items between two objects with the same structure.
function difference(arr1, arr2) {
return arr1.filter((x) => !arr2.includes(x));
}
function compute_differences(before, after) {
let result = {
added: {},
removed: {},
};
const keys = [
...new Set(Object.keys(be... |
So I am making a program, the program keeps its previous running state in a file. Sometimes things happen and I have to revert to a "last known good" state. This means that the file needs to be backed up prior to being used.
So I wrote this little function to do the backup, and I'd love to hear your opinions/suggestion... |
The project outline:
Create a program multiplicationTable.py that takes a number N from the
command line and creates an N×N multiplication table in an Excel
spreadsheet.
My solution:
# A program to create a NxN multiplication table in excel
# Usage: python multiplication_table_maker.py "number" "folder to save the ta... |
I have the following employee/company system with dataclasses Employee and Company. There is also a LeaveApplication, Hirer and EmployeePromoter that are in a composition based model with company to fulfil functions. Lastly, there are two Enum called CompanyRoles and CompanyTeams.
I need advise on the following:
Wheth... |
I was given for homework to make a rock paper scissor game where I input my choice as a string either: "@" for rock, "[]" for paper or "X" for scissors. The computer chooses a random one and it's printed who wins. I'm worried that my code isn't good enough.
#include <stdio.h> /* printf, scanf, NULL */
#include <s... |
map = [
"......",
"..##..",
".##.#.",
"...###",
"###.##",
]
x1 = 0
x2 = 0
obstacle= ()
obstacle = list(obstacle)
j=0
for x,y in enumerate(map):
x1 = 1
for i in range(0, len(y)):
if len(y)- 1 == i and y[i] == "#" and y[i-1] == ".":
x2 = i+1
x1 = i+1
... |
Im a beginner in python and just started making little games and projects like this rock paper scissor one. Any advice to write this shorter or any better? I got kicked off of stack overflow for a post similar to this lol.
import time
import sys
import random
play_again='yes'
while play_again=='yes' or play_again=='y'... |
I wrote a very simple AI in C and connected it to the web through Ruby on Rails. It learns the fizzbuzz problem. I'm writing this because I'm back on the job market after 20 years. Of course, github didn't even exist back then. So, now the job hunt environment is totally different and I don't have the assets recru... |
I'm learning python and have built a simple script that just sets up my dev environment when working on front-end projects. I'm not very used to python and imagine there are probably numerous improvements to my code:
import subprocess
import pyautogui
import webbrowser
from time import sleep
WAIT_BETWEEN_COMMANDS: int... |
I've implemented constructor, push , pop, drop and some macro.
I need to know if the drop implementation is correct and is drop is really necessary?
Meanwhile I still didn't check about std::rc::Rc and lifetime implementations.
use std::mem;
#[derive(Debug, PartialEq)]
pub struct LinkedList<T> {
head: Option<Box<No... |
I am doing the filter declaring a final array. it seems that the codes are much. it can be shortened?
code :
const lookup = [
{
hfsUserCountryId: 2895,
countryCd: 140,
},
{
hfsUserCountryId: 2895,
countryCd: 1301,
},
];
const countries = [
{
"defaultOrder" : 0,
"label" : "data.Code.Co... |
I wrote a little C++ program that lets me transpile a syntax that allows running Shell in Python to legal Python and then execute it. Here is an example input:
filename = f'./data/lines.txt'
n_lines = int(`wc -l {filename}`.split()[0])
print(n_lines, 'lines in file')
This is transpiled to:
import subprocess
filena... |
Context: I have a client app which consumes an API. I want to call this API is async way (using java.net.http.HttpClient) and once I receive this data then I want to model the response because it can have either error or actual data in java.net.http.HttpResponse<String>. So it will be good if I cloud transform to model... |
I have a multi-page form to submit and update an application for an event built using ASP.NET Core MVC. Each page of the form consists of the display information managed by the organizer (1) and the information entered by the user (2) (e.g. a list of locations of venues (1) the the choice of venues (2)).
I want it to u... |
The project outline:
Write a program to read in the contents of several text files (you can
make the text files yourself) and insert those contents into a
spreadsheet, with one line of text per row. The lines of the first
text file will be in the cells of column A, the lines of the second
text file will be in the cell... |
I need help with this program:
Create a program that will accept the user's name and ID number. The
program will then ask for the department code, 1 is for the Toy
Section, 2 for Ladies' Wear, 3 for Men's Wear, and 4 for Kiddie
Section. If the user enters 1 (for example), it will show the products
on the Toy Selection... |
I have this switch case statement which maps an integer to a string. There can be multiple integers that maps to same string. objective here is to not to duplicate the string value and retrive the string value by passing the id.
public const int Product1 = 111;
public const int Product2 = 112;
public const ... |
The project outline:
Write a program that performs the tasks of the previous program in
reverse order: the program should open a spreadsheet and write the
cells of column A into one text file, the cells of column B into
another text file, and so on.
My solution:
# A program to read a spreadsheet and write it to a tex... |
I was doing an exercise from LeetCode in which consisted in repeatedly deleting any adjacent pairs of duplicate elements from a string, until there are only unique characters adjacent to each other.
With some help I made a function that can solve most test cases and optimized it a little bit, but the input string lengt... |
During each HTTP request incoming from my Angular front-end I send encrypted pair of access & refresh token. On the back-end ASP.NET web APIs are used.
The way I decrypt them currently is by creating 2 custom middlewares in one of the APIs (one after another):
The first one decrypt the access token, modifies the http ... |
Consider the following function that implements optimised O(log n) exponentiation by squaring:
#include <cstdint> // uintmax
// log-n optimised integer power function. Computes x to the power of y
constexpr std::uintmax_t pow(std::uintmax_t x, std::uintmax_t y) {
// base cases for efficiency and guaranteed terminat... |
I have solved the coding problem written here.
In summary:
Input: str = "red2 blue5 black4 green1 gold3"
Output: "green red gold black blue"
Here is my code:
def order_color(str1):
#Split string using the whitespaces and send to a list
#Sort elements within the list by the number
str2 = sorted(str1.split(... |
This is my task:
Each line in the file can be one of the following:
Updates to the limit order book in the following format:
u,<price>,<size>,bid - set bid size at <price> to <size>
u,<price>,<size>,ask - set ask size at <price> to <size>
Queries in the following format:
q,best_bid - print best bid price and size
q,be... |
This Jupyter Notebook code for the Wordle game works. After a lot of fixes, I have it working as it should. The code is a jumbled mess. I am open to any suggestions and/or criticism of my code. I am here to learn and improve my code. Any help would be much appreciated.
NLTK needs to be installed to use the code.
Link t... |
My input fields for the dates are not saved when the User presses the submit button. The page reloads and the values for the input fields are empty. So I'm using localStorage to save the values when it loads. I can't think of other JS functions or libraries that can help me clean this up.
<script type="text/javascript"... |
I'm learning Rust by solving exercises from different tracks on Exercism.
The below code is an implementation of "Protein Translation" from the Python track. I split protein into separate functions - nucleotide_sequence and codon_translation, which I think improves readability.
fn nucleotide_sequence(rna: &str) -> Vec<... |
In our code we deal with distances a lot, a distance being a number and unit
eg 15km, or 1.234mi
The current approach is to use 2 functions, convert_distance(), and format_distance()
Those 2 functions don't need review, but I will include their method signature here for reference.
function convert_distance(float $dista... |
I am working on this project where I need to building html from this object. There a a lot of loops and counter and wanted to see if there is a better way to do this
Any suggestions/comments are greatly appreciated to improve the code further. Thanks.
full function
https://jsfiddle.net/tjmcdevitt/xLbusdk3/10/
$.each(qu... |
This container reduces the number of memory allocations on queue-type operations (push + pop) compared to std::deque. Basic performance tests indicates a performance similar to std::deque where main cost is the calculation of index ((mFront+pos)%mReserved).
A first review was done by G.Sliepen. I tried to solve almost ... |
I'm starting to build an application for automated network troubleshooting. It's going without any issues so far.
I'm using an OOP approach @ which i create the widgets in the init method. what's bothering me is that when the application starts getting more complex (Ex: Adding way more widgets); the init method will ge... |
I am currently interested in implementing statistical measures. Other measures like mean, variance, and covariance are easy, but the mode feels harder than I thought. Is this good enough?
Note: float is used because I don't really intend to use it on big enough numbers. The size can be changed if needed.
Note 2: We can... |
So I've started getting familiar with Batch for the last year off and on, all self taught, and I've made a few little dinky projects here and there but I'm wanting to find out the best way to go about expanding my code. Using other programs for inspiration I've learned just the tip of the icebergs for "FOR loops" and u... |
I am reading the Rust book. I am on chapter 8; this is the assignment:
Given a list of integers, use a vector and return the median (when sorted, the value in the
middle position) and mode (the value that occurs most often; a hash map will be helpful
here) of the list.
And here is my code for it:
`
#![allow(un... |
You are to simulate a 2-bit half adder. You are not required to implement a real 2-bit half adder using logic gates; you are going to implement a black-box system using the microcontroller that functions as a 2-bit half adder.
Your system will have 4 inputs (2 for the first 2-bit number, and another 2 for the second 2-... |
This loading bar is really just for fun. I want to know other peoples ways of writing a loading bar that's considered animated like using time.sleep to give the "Loading effect". I know they're easier ways of writing it compared to mine, wanting to know how other people would code an animated loading bar?
import time
i... |
I'm writing something like the Unity's shader graph and I'm kinda stuck on a property panel.
I add a float property, which name is Float, and then I add a second float property, which also is named Float (until I rename it). I'd like the second property name to be renamed to Float(1)
What I tried at the beginning was a... |
I have this multidimensional array that generalizes vectors and matrices:
com.github.coderodde.util.MultidimensionalArray.java:
package com.github.coderodde.util;
/**
* This class implements a multidimensional array.
*
* @author Rodion "rodde" Efremov
* @version 1.6 (Nov 13, 2022)
* @since 1.6 (Nov 13, 2022)
*/... |
As we know, it is better to write to a disk in a separate thread because the bottleneck may be the disk, which is slower than the CPU (at the condition only one thread writes to the disk).
So I have implemented a "Consumer - Producer".
In fact, I realize I think it could be used for any generic task queue.
I would like... |
From an integer X representing a time duration in seconds produce a simplified string representation.
For example, given X=100, you should output: "1m40s"
Use the following abbreviations w,d,h,m,s to represent :
*1w is 1 week
1d is 1 day
1h is 1 hour
1m is 1 minute
1s is 1 second
Only the two largest non-zero units s... |
Task: implement an algorithm to find graph center \$Z(G)\$ given undirected tree \$G\$.
This is my first time programming in C++ so any (elementary) feedback is appreciated.
The way I did it is:
Run BFS from any node \$v_0\$ in \$G\$. Find node \$v_1\$ with \$\max_{v_1\in V(G)} \text{dist} (v_0,v_1)\$.
Run BFS from \$... |
I wrote this algorithm in JS with the main goal that it will give an answer for 10^750-10^1000 in 2-3 seconds but it solves 10^150 in 2-3 seconds so I am a little far from my goal, the problem is that I sieved through the algorithm couple of times, but nothing I do seems to speed the algorithm significantly.
I would a... |
I am a programmer who likes making clones of games. Having completed a version of Wordle in Python, I challenged myself with making a version of it in C++. This includes a solver as well (add a flag -s while running to activate solving mode.)
I used ANSI escape codes to create coloring and an interactive experience. Ho... |
I am a beginner at using Golang, I would like advice about the following program. It is a CLI tool that can check the expiration dates of HTTPS certificates concurrently. I have only used the standard library and would appreciate any feedback that I can learn from.
package main
import (
"context"
"crypto/tls"
... |
Referring to https://codereview.stackexchange.com/a/281185/266548. I'd like to iterate, every frame, over the values.
Do you think is a good idea to create std::vector<Property*> values_iterator? Or there is a better way to do it?
#include <algorithm>
#include <any>
#include <map>
#include <set>
#include <string>
#incl... |
I am trying to optimize a function called place_block. It is meant to give the best row, col coordinate in the matrix to place a given block of row and column size.
My current implementation is unreadable and bad practice. I'm looking for a better way to put it.
// Generates the best possible solution to place a given ... |
I have a database that contains many files, and each one of those files contains many tags that relate to the file in some form.
Some of those files need to have a digital signature applied to them and due to reasons unrelated to the question I need to store the original files that don't have the signature applied. I s... |
We get the most relevant feedback about a doctor depending on the speciality, intervention_type and sub_intervention_type a patient is going to use.
The ordering is important here, we match feedback on speciality and sub_intervention_type first. If that's not available, try less specific matches.
I wonder if there is a... |
I have created a tool to insert JSON objects with several rules:
Read the product status, and then insert based on the status
If there is no data in this status, then insert the object
If there is data in the status, then check the Name. If the name already exists then just insert the product Id into the existing one
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.